/* ==========================================================================
   Showroom bánh — Quản trị. Bảng màu / font / khoảng cách bám bản gốc.
   ========================================================================== */
:root {
  color-scheme: light;
  --fg: #111111;
  --secondary-fg: #333333;
  --edge: #eae0cf;
  --separator: #f0e6d6;
  --input-edge: #e2d7c5;
  --canvas: #fbf9f5;
  --surface: #ffffff;
  --soft: #fcfbf8;
  --field: #ffffff;
  --placeholder: #888888;
  --accent: #f0a953;
  --accent-fill: #e59819;
  --accent-text: #111111;
  --accent-contrast: #111111;
  --accent-soft: #fff6e0;
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #111111;
  --text: #222222;
  --line: #f0e6d6;
  --red: #d32f2f;
  --green: #e59819;
  --sidebar: #ffffff;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a, input, select, textarea {
  transition: background .18s, color .18s, border-color .18s, box-shadow .18s;
}

/* ---------- Layout ---------- */
#layout {
  min-height: 100vh;
  margin-left: 246px;
  padding: 22px 32px 0;
  max-width: 1900px;
}

#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 246px;
  background: var(--sidebar);
  padding: 20px 16px;
  color: #b3c9c1;
  box-shadow: none;
  border-right: 1px solid #204339;
  overflow-y: auto;
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: #386252 transparent;
}

#sidebar .sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid #1e3a2b;
  margin-bottom: 8px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 72px;
  padding: 8px 0 28px;
  color: #fff;
  font-size: 39px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #1c3a2c;
  color: #5fd39b;
  font-size: 19px;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 1;
  max-width: calc(100% - 68px);
}

.sidebar-company-logo {
  height: 38px;
  width: auto;
  max-width: 165px;
  object-fit: contain;
  flex: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.collapse {
  position: absolute;
  top: 30px;
  right: 18px;
  background: none;
  border: 0;
  color: #a4c7b9;
  cursor: pointer;
  font-size: 17px;
  padding: 4px;
  border-radius: 6px;
}
.collapse:hover { background: #ffffff14; }

#menu { padding-top: 4px; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin: 3px 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 450;
  color: #9ab2a1;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.menu-item:hover { background: #ffffff0f; color: #d6e6dc; }
.menu-item.active {
  background: #1c3a2c;
  color: #5fd39b;
  font-weight: 600;
  border-left-color: #5fd39b;
}
.menu-item .ti { font-size: 17px; flex: none; }

.menu-dropdown {
  border-bottom: 1px solid #1e3a2b;
  margin: 0;
  padding: 6px 0;
}
.menu-dropdown > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  color: #6f8f7c;
  text-transform: uppercase;
  border-radius: 8px;
}
.menu-dropdown > summary::-webkit-details-marker { display: none; }
.menu-dropdown > summary:hover { color: #c3d8cb; }
.menu-dropdown > summary .ti:first-child { font-size: 16px; }
.menu-dropdown > summary .ti:last-child {
  margin-left: auto;
  font-size: 13px;
  transition: transform .18s;
}
.menu-dropdown[open] > summary .ti:last-child { transform: rotate(180deg); }
.menu-dropdown > div { padding: 2px 0 6px; }

/* ---------- Header ---------- */
#layout > header {
  height: 76px;
  background: var(--card);
  border: 1px solid #e4ece8;
  border-radius: 15px;
  box-shadow: 0 3px 12px #153d2810;
  padding: 0 22px;
  margin: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 30px;
  max-width: 1440px;
}

#mobile {
  display: none;
  background: none;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
}

.welcome {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.welcome-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.welcome-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #28c76f;
  display: inline-block;
}

#search-open {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #96a7a0;
  padding: 11px 13px;
  max-width: 310px;
  border-radius: 9px;
  background: #f5f8f6;
  border: 1px solid #e9efeb;
  cursor: pointer;
  flex: 0;
  white-space: nowrap;
}
#search-open span { white-space: nowrap; }
#search-open:hover { border-color: var(--accent); color: var(--accent); }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.header-right > button,
.header-right > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--separator);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 17px;
  position: relative;
}
.header-right > a { width: auto; padding: 6px 10px; font-size: 12px; }
.header-right > button:hover,
.header-right > a:hover { border-color: var(--accent); color: var(--accent); }
.header-right sup {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--separator);
  color: var(--fg);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  transition: background .2s, color .2s;
}
.header-right sup.has-unread { background: var(--red); color: #fff; }
.header-right sup:empty, .header-right sup[data-zero="1"] { display: none; }

/* ---------- Thông báo (chuông) ---------- */
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-row {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: var(--soft);
  color: var(--fg);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.notif-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.notif-row strong { font-size: 12.5px; }
.notif-row p {
  margin: 4px 0;
  font-size: 12px;
  opacity: .8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-row small { font-size: 11px; opacity: .6; }

/* ---------- Content ---------- */
#content {
  max-width: 1440px;
  margin: 0;
  padding-bottom: 40px;
  min-width: 0;
}

.page-intro {
  position: relative;
  padding: 2px 0 24px;
  min-height: 95px;
}
.page-intro .eyebrow {
  font-size: 9px;
  letter-spacing: 1.3px;
  color: #a0b0a5;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.page-intro h1 {
  font-size: 25px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -.2px;
}
.page-intro p {
  margin: 0;
  color: #6f7f74;
  font-size: 13px;
  max-width: 760px;
  line-height: 1.6;
}
.page-intro .page-hint {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--green);
  background: #2f7d5b12;
  border-radius: 0 8px 8px 0;
  max-width: 760px;
  line-height: 1.6;
  font-size: 12px;
}
.page-intro.has-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.page-intro.has-actions > .intro-actions { margin-left: auto; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: none;
  border: 1px solid var(--separator);
  margin-bottom: 12px;
}
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--separator);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.card-head small { color: #ea5455; font-size: 13px; margin-left: 5px; }
.card-body { padding: 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: var(--accent-fill);
  color: #fff;
  cursor: pointer;
  line-height: 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 4px #0002;
}
.btn .ti { font-size: 17px; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.green { background: var(--accent); }
.btn.deep-green { background: var(--accent-fill); }
.btn.muted {
  background: var(--card);
  color: var(--text);
  border-color: var(--input-edge);
  box-shadow: none;
}
.btn.muted:hover { border-color: var(--accent); color: var(--accent); }
.btn.red { background: #d64541; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.toolbar {
  padding: 15px 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- List workspace ---------- */
.list-workspace {
  border: 1px solid #e4eae5;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.list-workspace .search-box {
  border: 0;
  border-bottom: 1px solid #eef2ee;
  border-radius: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 20px;
  flex-wrap: wrap;
}
.search-row { display: flex; align-items: center; gap: 0; }
.search-row input {
  width: 195px;
  border-radius: 6px 0 0 6px !important;
  height: 36px;
}
.search-row .btn {
  border-radius: 0 4px 4px 0;
  width: 62px;
  justify-content: center;
  height: 36px;
  padding: 0;
}
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-row select { width: auto; min-width: 150px; }

.table-card { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th {
  background: #fcfdfc;
  color: #91a998;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .65px;
  text-transform: uppercase;
  padding: 14px 10px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--separator);
}
td {
  padding: 11px 10px;
  font-size: 12px;
  border-top: 1px solid #eef2ef;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:hover { background: #fafcfb; }
td .row-actions { display: inline-flex; gap: 4px; }
td .row-actions a,
td .row-actions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--separator);
  background: var(--card);
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
}
td .row-actions a:hover,
td .row-actions button:hover { border-color: var(--accent); color: var(--accent); }
td .row-actions button[data-delete] { color: #b4362f; }
td .row-actions button[data-delete]:hover { border-color: #b4362f; }

.empty {
  height: 190px;
  text-align: center;
  color: #b1c0b5;
  font-size: 12px;
}

.order-input {
  width: 58px !important;
  padding: 5px 7px !important;
  min-height: 28px !important;
  text-align: center;
}

/* ---------- Pager ---------- */
.pager-wrap {
  padding: 12px 16px;
  border-top: 1px solid var(--separator);
  display: flex;
  justify-content: center;
}
.pager-wrap:empty { display: none; }
.pager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}
.pager-info {
  font-size: 11px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: .85;
}
.pager-info .ti { font-size: 14px; color: var(--accent); }
.pager-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btns button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--separator);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pager-btns button:hover { border-color: var(--accent); color: var(--accent); }
.pager-btns button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---------- Form ---------- */
.field { margin-bottom: 21px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #52775e;
  margin-bottom: 7px;
}
.field .hint {
  font-size: 11px;
  color: #9aae9e;
  margin-top: 5px;
  display: block;
}
.field .counter {
  float: right;
  font-size: 10.5px;
  font-weight: 500;
  color: #a8b8ad;
  letter-spacing: .02em;
}
.field .counter.over { color: #d64541; font-weight: 700; }

input:not([type=checkbox]):not([type=radio]):not([type=file]),
textarea,
select {
  border: 1px solid #dfe7e1;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: #536e5d;
  width: 100%;
  outline: none;
  font-size: 12px;
  box-shadow: none;
  min-height: 36px;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #1373441f;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #a8b8ad; }

input.input-invalid, textarea.input-invalid, select.input-invalid {
  border-color: #d64541 !important;
  background: #d6454112 !important;
  box-shadow: 0 0 0 3px #d6454129 !important;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Switch ---------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 11px;
  color: #879f8e;
  font-weight: 450;
  cursor: pointer;
}
.switch input {
  appearance: none;
  position: relative;
  background: #e0e8e3;
  border: 1px solid #d3ded7;
  border-radius: 16px;
  width: 35px;
  height: 19px;
  cursor: pointer;
  margin: 0;
  flex: none;
}
.switch input:checked { background: #00a142; border-color: #00a142; }
.switch input:before {
  content: "✓";
  color: #fff;
  font-size: 11px;
  position: absolute;
  left: 4px;
  top: 0;
  opacity: 0;
}
.switch input:checked:before { opacity: 1; }
.switch input:after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: .15s;
}
.switch input:checked:after { left: 18px; }
td .switch { margin: 0; }

/* ---------- Tabs ---------- */
.tabs {
  background: #fff;
  border-bottom: 1px solid #ebf0ec;
  padding: 0;
  gap: 25px;
  display: flex;
  border-radius: 0;
}
.tab {
  font-size: 12px;
  padding: 13px 7px;
  background: transparent;
  color: #839a8a;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
}
.tab:hover { color: var(--accent); }
.tab.selected {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-panel {
  border: 1px solid #e3ece6;
  border-radius: 9px;
  overflow: hidden;
  background: var(--card);
  margin-bottom: 12px;
}
.tab-content { padding: 24px; }

/* ---------- Editor (Tiptap) ---------- */
.editor {
  border: 1px solid #dfe7e1;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.editor-tools {
  background: #fbfcfb;
  border-bottom: 1px solid var(--separator);
  padding: 8px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.editor-tools.second { border-top: 1px solid var(--separator); border-bottom: 0; }
.editor-tools button {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #6f7f74;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.editor-tools button:hover { background: var(--accent-soft); color: var(--accent); }
.editor-tools button.active { background: var(--accent-soft); color: var(--accent); border-color: #cfe6da; }
.editor-tools .sep { width: 1px; background: var(--separator); margin: 4px 3px; }
.editor-area {
  min-height: 120px;
  padding: 14px 16px;
  outline: none;
  font-size: 13px;
  line-height: 1.7;
  color: #3f5b4c;
}
.editor-area:empty:before {
  content: attr(data-placeholder);
  color: #a8b8ad;
}
.editor-area p { margin: 0 0 10px; }
.editor-area p:last-child { margin-bottom: 0; }
.editor-area ul, .editor-area ol { margin: 0 0 10px; padding-left: 22px; }
.editor-area blockquote {
  margin: 0 0 10px;
  padding: 6px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: #4a6b58;
}
.editor-area a { color: var(--accent); text-decoration: underline; }
.editor-area img { max-width: 100%; border-radius: 6px; }
.editor-foot {
  font-size: 10px;
  padding: 6px 10px;
  border-top: 1px solid var(--separator);
  color: #9aae9e;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.editor-foot .keys { color: #b1c0b5; }

/* ---------- Upload ---------- */
.upload-box {
  border: 1.5px dashed #cfe0d6;
  border-radius: 9px;
  padding: 22px;
  text-align: center;
  background: #fbfdfc;
  color: #8fa79a;
  font-size: 12px;
  cursor: pointer;
}
.upload-box:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-box .ti { font-size: 26px; display: block; margin-bottom: 8px; color: var(--accent); }
.upload-box strong { display: block; color: #52775e; font-size: 13px; margin-bottom: 4px; }
.upload-preview { margin-top: 12px; }
.upload-preview img { max-width: 100%; max-height: 180px; border-radius: 6px; border: 1px solid var(--separator); }
.upload-box.uploading { opacity: .6; pointer-events: none; }
.upload-status { margin-top: 8px; font-size: 11.5px; color: #52775e; }
.upload-status.loading { color: #8fa79a; }
.upload-status.ok { color: var(--accent); }
.upload-status.error { color: #c0392b; }
body.dark .upload-status { color: #9db8a9; }
body.dark .upload-status.ok { color: #4fd1a5; }
body.dark .upload-status.error { color: #ff8b7a; }

/* ---------- Status card ---------- */
.status-card .card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  align-items: center;
}
.status-card .switch {
  margin: 0;
  font-size: 11px;
  gap: 6px;
  min-height: 26px;
  justify-content: space-between;
  display: flex;
}
.status-card .field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 0;
}
.status-card .field label { margin: 0; white-space: nowrap; }

/* ---------- Dashboard ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.dash-card {
  background: var(--card);
  border: 1px solid var(--separator);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}
.dash-card:hover { border-color: var(--accent); }
.dash-card .ico {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex: none;
}
.dash-card .num { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.dash-card .lbl { font-size: 11px; color: #8fa79a; margin-top: 2px; }

.chart {
  height: 180px;
  padding: 18px;
  display: flex;
  align-items: flex-end;
  gap: 15px;
  background: linear-gradient(0deg, #f5fbf7, transparent);
}
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%;
  max-width: 46px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: height .4s ease;
}
.chart .bar-lbl { font-size: 10px; color: #8fa79a; }
.chart .bar-val { font-size: 10px; font-weight: 600; color: var(--accent); }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
}
.quick-item:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.quick-item .ti { font-size: 16px; color: var(--accent); }

.todo-list { display: flex; flex-direction: column; }
.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--separator);
  font-size: 12px;
}
.todo-item:last-child { border-bottom: 0; }
.todo-item .ti { color: #e8a33d; font-size: 16px; }
.todo-item .go { margin-left: auto; color: var(--accent); font-size: 11px; font-weight: 600; }

/* ---------- Media ---------- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.media-item {
  border: 1px solid var(--separator);
  border-radius: 9px;
  overflow: hidden;
  background: var(--card);
  position: relative;
}
.media-item .thumb {
  height: 110px;
  background: #f2f6f3 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b1c0b5;
  font-size: 26px;
}
.media-item .meta { padding: 8px 10px; font-size: 10.5px; color: #8fa79a; }
.media-item .meta strong { display: block; color: var(--text); font-size: 11px; font-weight: 600; margin-bottom: 2px; word-break: break-all; }
.media-item .tag {
  position: absolute;
  top: 7px;
  left: 7px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ffffffdd;
  color: #52775e;
}
.media-item .tag.used { background: var(--accent); color: #fff; }

.media-chip {
  appearance: none;
  border: 1px solid var(--separator);
  background: var(--card);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.media-chip:hover { border-color: var(--accent); color: var(--accent); }
.media-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--soft);
  color: #888;
  font-size: 10.5px;
  font-weight: 700;
}
.media-chip.active .chip-count { background: #ffffff3d; color: #fff; }

/* ---------- Revisions ---------- */
.rev-list { display: flex; flex-direction: column; }
.rev-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--separator);
  font-size: 12px;
}
.rev-item:last-child { border-bottom: 0; }
.rev-item .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.rev-item .info { flex: 1; min-width: 0; }
.rev-item .info strong { display: block; font-size: 12.5px; color: var(--ink); font-weight: 600; }
.rev-item .info span { color: #8fa79a; font-size: 11px; }
.rev-item.current { background: var(--accent-soft); }

/* ---------- Mail ---------- */
.msg-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--soft);
  color: #6f7f74;
}
.msg-badge.source-contact { background: #e8f0fb; color: #2f6f8f; }
.msg-badge.unread { background: #fdeceb; color: #b4362f; }
.msg-badge.done { background: var(--accent-soft); color: var(--accent); }

/* ---------- Login ---------- */
body.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box { position: relative; width: 100%; max-width: 420px; margin: auto; }
.login-box .card { border-radius: 12px; box-shadow: 0 20px 60px #09201518; }
.login-box .card-head {
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px 18px;
  text-align: center;
}
.login-box .card-head h3 { font-size: 15px; color: var(--accent-fill); }
.login-company-logo {
  max-width: 210px;
  height: 48px;
  width: auto;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
  border: none;
  box-shadow: none;
  background: transparent;
}
.login-box .card-body { padding: 22px 24px 26px; }
.login-box .btn { width: 100%; justify-content: center; }
.login-hotline {
  display: block;
  margin-top: 18px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .02em;
  color: var(--accent-fill);
  line-height: 1.5;
}
.form-errors {
  color: #fff;
  background: #ea5455;
  margin: 16px 0 0;
  padding: 13px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 6px 18px #ea54554d;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-note {
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #3f6b52;
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  inset: auto 25px 25px auto;
  margin: 0;
  background: var(--accent-fill);
  color: #fff;
  padding: 10px 16px;
  border-radius: 2px;
  box-shadow: 0 3px 15px #0003;
  display: none;
  z-index: 50;
  max-width: min(460px, calc(100vw - 32px));
  overflow-wrap: anywhere;
  text-align: left;
  line-height: 1.45;
  font-size: 12px;
  pointer-events: none;
}
#toast.toast-show { display: flex; align-items: center; gap: 8px; animation: toastIn .22s ease; }
#toast.toast-success { background: #1f9d63; }
#toast.toast-error { background: #d64541; }
#toast.toast-info { background: #2f6f8f; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Dialog ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 20px 90px #09201530;
  background: var(--card);
  color: var(--text);
  width: min(600px, 90vw);
  padding: 20px;
}
dialog#modal { max-width: min(680px, 92vw); }
dialog::backdrop { background: #0b1f1633; backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 12px; font-size: 15px; color: var(--ink); }
dialog .btn { margin-top: 15px; }
#modal-content { font-size: 13px; line-height: 1.65; }
#modal-content dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
#modal-content dt { color: #8fa79a; font-size: 11.5px; }
#modal-content dd { margin: 0; font-size: 12.5px; }

/* ---------- Search palette ---------- */
#palette {
  position: fixed;
  inset: 0;
  background: #0b1f1640;
  backdrop-filter: blur(3px);
  z-index: 60;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}
#palette.open { display: flex; }
.palette-box {
  width: min(560px, 100%);
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 30px 90px #09201540;
  overflow: hidden;
  animation: palIn .18s ease;
}
@keyframes palIn {
  from { opacity: 0; transform: translateY(-8px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.palette-box input {
  border: 0 !important;
  border-bottom: 1px solid var(--separator) !important;
  border-radius: 0 !important;
  padding: 16px 18px !important;
  font-size: 14px !important;
  min-height: 52px !important;
  box-shadow: none !important;
}
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
}
.palette-item .grp { margin-left: auto; font-size: 10px; color: #a8b8ad; letter-spacing: .4px; }
.palette-item:hover, .palette-item.sel { background: var(--accent-soft); color: var(--accent); }
.palette-empty { padding: 22px; text-align: center; color: #a8b8ad; font-size: 12px; }

/* ---------- Footer ---------- */
#layout > footer {
  max-width: 1440px;
  margin: 0;
  padding: 17px 0;
  font-size: 10px;
  color: #94a89a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-status { color: #a0b2a5; display: inline-flex; align-items: center; gap: 7px; }
.foot-right { margin-left: auto; color: #9dae9f; }

/* ---------- Dark mode ---------- */
body.dark {
  color-scheme: dark;
  --fg: #dfefe5;
  --secondary-fg: #b2cabc;
  --edge: #2a4739;
  --separator: #2a4739;
  --input-edge: #3a5346;
  --canvas: #11221c;
  --surface: #193127;
  --soft: #1a2b22;
  --field: #193127;
  --placeholder: #7d938a;
  --accent: #3fbf85;
  --accent-fill: #2f9e6b;
  --accent-soft: #244a37;
  --bg: #11221c;
  --card: #193127;
  --ink: #dfefe5;
  --text: #b2cabc;
  --line: #2a4739;
  --red: #3fbf85;
  --green: #2f9e6b;
  --sidebar: #0e2219;
}
body.dark #sidebar { border-right-color: #1c2f26; color: #8fae9d; }
body.dark .menu-item { color: #9bb7a3; }
body.dark .menu-item.active { background: #1c3a2c; color: #5fd39b; }
body.dark #layout > header { border-color: var(--separator); box-shadow: none; }
body.dark #search-open { background: #1a2b22; border-color: #24382e; color: #8fae9d; }
body.dark .list-workspace { border-color: var(--separator); background: var(--surface); }
body.dark .list-workspace .search-box { border-bottom-color: var(--separator); }
body.dark th { background: #1a2b22; color: #7d938a; }
body.dark td { border-top-color: var(--separator); }
body.dark tbody tr:hover { background: #1a2b22; }
body.dark .editor-tools { background: #1a2b22; }
body.dark .editor-area { color: #c3d3ca; }
body.dark .upload-box { background: #1a2b22; border-color: #2c4035; }
body.dark .chart { background: none; }
body.dark .dash-card { background: var(--surface); }
body.dark .tab-panel { border-color: var(--separator); }
body.dark .tabs { background: var(--surface); border-color: var(--separator); }
body.dark .btn.muted { background: var(--surface); color: var(--text); }
body.dark .pager-btns button { background: var(--surface); }
body.dark .media-item { background: var(--surface); }
body.dark .media-item .thumb { background-color: #1a2b22; }
body.dark .rev-item.current { background: #1c3a2c; }
body.dark .page-intro .page-hint { background: #2f7d5b1f; }
body.dark .login-box .card { box-shadow: 0 20px 60px #0006; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  #layout { margin-left: 0; padding: 12px; }
  #sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  body.menu-open #sidebar { transform: translateX(0); }
  #mobile { display: inline-flex; }
  #layout > header { margin: 0 0 20px; gap: 12px; height: 64px; padding: 0 14px; }
  #content, #layout > footer { margin: 0; }
  #search-open span { display: none; }
  #search-open { max-width: 200px; padding: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .dashboard-grid { gap: 10px; }
  .page-intro h1 { font-size: 21px; }
}
@media (max-width: 560px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .header-right > a span { display: none; }
  .status-card .card-body { grid-template-columns: 1fr; }
}


/* ==========================================================================
   THEME MẬT ONG PHONG SƠN (TÔN VÀNG TRẮNG, NỀN TRẮNG CHỦ ĐẠO, CHỮ ĐEN)
   ========================================================================== */
body {
  background: #faf7f2 !important;
  color: #111111 !important;
}

#sidebar {
  background: #ffffff !important;
  color: #222222 !important;
  border-right: 1px solid #ede2cf !important;
  box-shadow: 2px 0 15px rgba(229, 152, 25, 0.05) !important;
}

#sidebar .sidebar-header {
  border-bottom: 1px solid #f2e7d5 !important;
}

.brand {
  color: #111111 !important;
}

.brand-symbol {
  background: #fff4d9 !important;
  color: #d98200 !important;
  border: 1px solid #f3dcac !important;
}

.sidebar-company-logo {
  width: 140px !important;
  height: 48px !important;
}

.collapse {
  color: #666666 !important;
}
.collapse:hover {
  background: #fff8eb !important;
  color: #d98200 !important;
}

.menu-item {
  color: #222222 !important;
  font-weight: 550 !important;
}
.menu-item:hover {
  background: #fff8eb !important;
  color: #d98200 !important;
}
.menu-item.active {
  background: #fff3d6 !important;
  color: #111111 !important;
  font-weight: 700 !important;
  border-left: 3px solid #f0a953 !important;
}
.menu-item .ti {
  color: #d98200 !important;
}

.menu-dropdown {
  border-bottom: 1px solid #f5ede0 !important;
}
.menu-dropdown > summary {
  color: #d98200 !important;
  font-weight: 800 !important;
  font-size: 10.5px !important;
}
.menu-dropdown > summary:hover {
  color: #111111 !important;
  background: #fff8eb !important;
}
.menu-dropdown > summary .ti:first-child {
  color: #d98200 !important;
}

#layout > header {
  background: #ffffff !important;
  border: 1px solid #ede2cf !important;
  box-shadow: 0 4px 16px rgba(229, 152, 25, 0.06) !important;
}

.welcome-name {
  color: #111111 !important;
  font-weight: 700 !important;
}

.welcome-dot {
  background: #f0a953 !important;
}

#search-open {
  background: #faf7f0 !important;
  border: 1px solid #e8dcce !important;
  color: #333333 !important;
}
#search-open:hover {
  border-color: #f0a953 !important;
  color: #111111 !important;
}

.header-right > button,
.header-right > a {
  background: #ffffff !important;
  border: 1px solid #e8dcce !important;
  color: #222222 !important;
}
.header-right > button:hover,
.header-right > a:hover {
  background: #fff8eb !important;
  border-color: #f0a953 !important;
  color: #d98200 !important;
}

.page-intro h1 {
  color: #111111 !important;
  font-weight: 800 !important;
}
.page-intro p {
  color: #333333 !important;
}
.page-intro .eyebrow {
  color: #d98200 !important;
  font-weight: 700 !important;
}

.card {
  background: #ffffff !important;
  border: 1px solid #ede2cf !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02) !important;
}

.card-head {
  border-bottom: 1px solid #f0e6d6 !important;
  color: #111111 !important;
}
.card-head h2, .card-head h3 {
  color: #111111 !important;
  font-weight: 700 !important;
}

label {
  color: #111111 !important;
  font-weight: 600 !important;
}

input, textarea, select {
  color: #111111 !important;
  background: #ffffff !important;
  border: 1px solid #ded3c0 !important;
}
input:focus, textarea:focus, select:focus {
  border-color: #f0a953 !important;
  box-shadow: 0 0 0 3px rgba(240, 169, 83, 0.2) !important;
}

.btn.green, button.btn-primary, .btn-primary {
  background: #f0a953 !important;
  color: #111111 !important;
  font-weight: 700 !important;
  border: 1px solid #e59819 !important;
}
.btn.green:hover, button.btn-primary:hover, .btn-primary:hover {
  background: #e59819 !important;
  color: #000000 !important;
}

.btn.muted {
  background: #ffffff !important;
  color: #222222 !important;
  border: 1px solid #e0d5c1 !important;
}
.btn.muted:hover {
  background: #fff8eb !important;
  border-color: #f0a953 !important;
}

table {
  background: #ffffff !important;
}
th {
  background: #faf6ee !important;
  color: #111111 !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #ede2cf !important;
}
td {
  color: #222222 !important;
  border-top: 1px solid #f4ecd9 !important;
}
tbody tr:hover {
  background: #fffdf7 !important;
}

body.login-view {
  background: radial-gradient(circle at 50% 30%, #fffdf7 0%, #f6edd9 100%) !important;
}
.login-box .card {
  background: #ffffff !important;
  border: 1px solid #ebdcc5 !important;
  box-shadow: 0 20px 60px rgba(229, 152, 25, 0.12) !important;
}
.login-box .card-head h3 {
  color: #111111 !important;
  font-weight: 800 !important;
}
.login-company-logo {
  max-width: 210px !important;
  height: 48px !important;
  width: auto !important;
  object-fit: contain !important;
  margin: 0 auto 12px !important;
  display: block !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
.login-hotline {
  color: #d98200 !important;
  font-weight: 800 !important;
}
