:root {
  --navy-950:#0B1220;
  --navy-900:#111A2C;
  --navy-800:#1B2740;
  --navy-700:#293754;
  --navy-400:#6B7A99;

  --page-bg:#F4F6F9;
  --card-bg:#FFFFFF;
  --border:#E4E8EF;
  --border-strong:#D3D9E3;
  --text-1:#101828;
  --text-2:#5B6479;
  --text-3:#98A2B3;

  --teal:#0E7C7B;
  --teal-dark:#0A5F5E;
  --teal-50:#E7F5F4;
  --green:#12805C;
  --green-bg:#E3F6EC;
  --amber:#B76E00;
  --amber-bg:#FEF1DC;
  --blue:#1D5FBF;
  --blue-bg:#E8F0FD;
  --gray-bg:#F0F1F5;
  --red:#C4293A;
  --red-bg:#FCEAEC;

  --radius:10px;
  --radius-sm:7px;
  --shadow-card:0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-pop:0 8px 24px rgba(16,24,40,.12), 0 2px 6px rgba(16,24,40,.08);

  --font-sans:'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* legacy aliases kept for other dashboard templates */
  --color-bg:var(--page-bg);
  --color-surface:var(--card-bg);
  --color-border:var(--border);
  --color-text:var(--text-1);
  --color-text-muted:var(--text-2);
  --color-primary:var(--teal);
  --color-gray:var(--text-2);
  --color-red:var(--red);
  --color-panel-bg:#F8FAFC;
  --color-th-bg:#FAFBFC;
  --color-error-bg:#FEECEC;
  --color-error-text:#8A1C25;
  --color-success-bg:var(--green-bg);
  --color-success-text:var(--green);
  --radius-md:8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--page-bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--teal-dark); }

/* inline SVG icons */
.ic {
  width: 1.05em; height: 1.05em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.15em;
}
.ic-sm { width: .85em; height: .85em; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--navy-950);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  transform: translateX(0); transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--teal); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.brand-name { color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .1px; }
.nav { flex: 1; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px; color: var(--navy-400);
  font-size: 13.5px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.nav-item i { font-size: 17px; width: 17px; text-align: center; flex-shrink: 0; }
.nav-item .ic { width: 18px; height: 18px; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: var(--teal); color: #fff; }
.nav-item.active i { color: #fff; }
.nav-section-label {
  padding: 14px 12px 4px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--navy-500, #5b6b85);
}
.nav-section-label:first-child { padding-top: 4px; }
.nav-footer { padding: 12px 16px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.logout-form { margin: 0; }
.user-row {
  display: flex; align-items: center; gap: 9px;
  color: var(--navy-400); font-size: 12.5px; cursor: pointer;
  background: none; border: none; padding: 0; width: 100%; text-align: left;
  font-family: inherit;
}
.user-row:hover { color: #fff; }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-700); display: flex; align-items: center; justify-content: center; color: #cfd7e6; font-size: 11px; font-weight: 600; flex-shrink: 0; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(9,13,22,.45); z-index: 35; }
.sidebar-overlay.show { display: block; }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: 236px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: var(--card-bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.selling-limit-badge {
  display: inline-flex; align-items: baseline; gap: 5px; font-size: 12.5px;
  color: var(--text-2); background: var(--amber-bg); border: 1px solid #F6DDB4;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.selling-limit-badge__age { font-size: 11px; color: var(--text-3); }
.hamburger { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; width: 34px; height: 34px; align-items: center; justify-content: center; color: var(--text-2); cursor: pointer; }
.hamburger .ic { width: 18px; height: 18px; }
.topbar-heading {
  display: flex; align-items: baseline; gap: 7px; min-width: 0;
  font-size: 16px; line-height: 1.3;
}
.topbar-heading__root { font-size: 12.5px; font-weight: 500; color: var(--text-3); flex-shrink: 0; }
.topbar-heading__sep { font-size: 12.5px; color: var(--text-3); flex-shrink: 0; }
.topbar-heading b {
  font-weight: 700; color: var(--text-1); letter-spacing: -.15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-heading b a { color: inherit; text-decoration: none; }
.topbar-heading b a:hover { color: var(--teal-dark); }

.content { padding: 20px 24px 44px; flex: 1; min-width: 0; }
.content > h1 { font-size: 20px; margin: 0 0 16px; }
.content > h2 { font-size: 16px; margin: 22px 0 10px; }

/* record pages (detail / add / edit) — balanced, centered, not full-bleed */
.record-page { max-width: 1120px; margin-left: auto; margin-right: auto; }
.record-page .sheet { max-width: none; }

.page-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-actions__group { display: flex; align-items: center; gap: 10px; }

.record-title { margin-bottom: 20px; }
.record-title h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -.3px; line-height: 1.25;
  margin: 0; color: var(--text-1); overflow-wrap: anywhere;
}
.record-title .sub { display: block; margin-top: 6px; font-size: 13px; font-weight: 500; color: var(--text-3); }

/* ---------- Buttons ---------- */
.btn {
  height: 38px; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; white-space: nowrap;
  border: 1px solid transparent; text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.btn i { font-size: 16px; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary, .btn:not(.btn-outline):not(.btn-gray):not(.btn-red) { background: var(--teal); color: #fff; }
.btn-primary:hover, .btn:not(.btn-outline):not(.btn-gray):not(.btn-red):hover { background: var(--teal-dark); }
.btn-outline { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.btn-outline:hover { background: #F8FAFC; color: var(--text-1); border-color: var(--text-3); }
.btn-outline.active-filter { color: var(--teal-dark); border-color: var(--teal); background: var(--teal-50); }
.btn-gray { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.btn-gray:hover { background: #F8FAFC; color: var(--text-1); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #a51f2e; }
.count-chip { background: var(--gray-bg); border-radius: 5px; font-size: 11px; padding: 1px 6px; font-weight: 700; color: var(--text-2); }
.btn-outline.active-filter .count-chip { background: var(--teal); color: #fff; }

/* ---------- Toolbar ---------- */
.toolbar-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 14px 16px; margin-bottom: 16px;
}
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1 1 260px; min-width: 200px; margin: 0; }
.search-wrap .search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 0 12px 0 34px; font-size: 13.5px; color: var(--text-1); background: #FBFCFE; outline: none;
  font-family: inherit;
}
.search-input:focus { border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px var(--teal-50); }

.dd { position: relative; }
.dd-panel {
  position: absolute; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-pop); width: 240px; padding: 10px; z-index: 30;
}
.dd-panel.right { left: auto; right: 0; }
.dd-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; margin: 4px 4px 8px; }
.status-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-1);
  text-decoration: none;
}
.status-opt:hover { background: #F6F8FA; }
.status-opt.is-selected { background: var(--teal-50); color: var(--teal-dark); font-weight: 600; }
.status-opt-left { display: flex; align-items: center; gap: 8px; }
.sub-muted { color: var(--text-3); font-size: 12px; }

/* ---------- Bulk bar ---------- */
.bulk-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card-bg); color: var(--text-1);
  border: 1px solid var(--border); border-left: 3px solid var(--teal);
  border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
  box-shadow: var(--shadow-card); position: sticky; top: 66px; z-index: 15;
}
.bulk-bar > span:first-of-type { font-weight: 600; }
.bulk-bar .ic { width: 16px; height: 16px; color: var(--teal); }
.bulk-bar select { height: 34px; border-radius: 7px; border: 1px solid var(--border-strong); background: #FBFCFE; color: var(--text-1); padding: 0 10px; font-size: 13px; width: auto; max-width: 260px; }
.bulk-bar .btn { height: 34px; padding: 0 16px; }
.bulk-bar__count { font-size: 12px; color: var(--teal-dark); font-weight: 600; }
.bulk-bar__select-all { font-size: 12.5px; }
.bulk-bar__select-all a { color: var(--teal-dark); font-weight: 600; text-decoration: none; }
.bulk-bar__select-all a:hover { text-decoration: underline; }

/* Live "12/24 published" indicator — sits inline in the bulk-bar, right of Go */
.bulk-bar__progress { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.bulk-bar__progress #bulk-progress-label { font-weight: 600; color: var(--text-1); }
.bulk-bar__mini-bar { display: inline-block; width: 90px; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.bulk-bar__mini-fill { display: block; height: 100%; width: 0; background: var(--teal); transition: width .15s ease; }
#bulk-progress-count { color: var(--teal-dark); font-weight: 600; white-space: nowrap; }

.bulk-progress__log {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; margin-bottom: 14px;
  max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.bulk-progress__log .msg { margin-bottom: 0; padding: 6px 10px; font-size: 12.5px; }

/* ---------- Table ---------- */
.table-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { border-collapse: collapse; width: 100%; min-width: 1000px; background: transparent; }
.table-scroll thead th {
  position: sticky; top: 0; background: #FAFBFC; z-index: 5;
  text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .3px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-scroll thead th a { color: inherit; text-decoration: none; }
.table-scroll thead th a:hover { color: var(--teal-dark); }
.table-scroll tbody td { padding: 10px 14px; font-size: 13.5px; color: var(--text-1); border-bottom: 1px solid #EEF1F5; vertical-align: middle; text-align: center; }
.table-scroll .title-cell { margin: 0 auto; }
.table-scroll .thumb-cell, .table-scroll .action-group { justify-content: center; }
.table-scroll tbody tr:hover { background: #FAFBFD; }
.table-scroll tbody tr:last-child td { border-bottom: none; }
.table-scroll .empty-row { text-align: center; color: var(--text-3); padding: 40px 14px; }
.cb { width: 15px; height: 15px; accent-color: var(--teal); cursor: pointer; }

.table-scroll .num-input {
  width: 74px; height: 28px; border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 0 8px; font-size: 12.5px; color: var(--text-1); text-align: right; background: #FBFCFE; outline: none;
  font-family: inherit;
}
.table-scroll tbody td:has(.num-input) { padding-left: 10px; padding-right: 10px; }
/* tighten price / price-factor / quantity / after-factor / vevor-original columns */
.table-scroll tbody td:has(.num-input),
.table-scroll thead th:nth-child(5),
.table-scroll thead th:nth-child(6),
.table-scroll thead th:nth-child(7),
.table-scroll thead th:nth-child(8),
.table-scroll thead th:nth-child(9),
.table-scroll tbody td:nth-child(5),
.table-scroll tbody td:nth-child(6),
.table-scroll tbody td:nth-child(7),
.table-scroll tbody td:nth-child(8),
.table-scroll tbody td:nth-child(9) { padding-left: 6px; padding-right: 6px; }

/* keep the After Factor / VEVOR Original pair snug, but not so tight the value clips */
.table-scroll thead th:nth-child(8),
.table-scroll tbody td:nth-child(8) { padding-right: 0.2rem; white-space: nowrap; }
.table-scroll thead th:nth-child(9),
.table-scroll tbody td:nth-child(9) { padding-left: 0.2rem; white-space: nowrap; }

/* list thumbnails (ListingDashboard.image_thumb) — all images, small album */
.thumb-cell {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 4px;
  width: max-content;
}
.thumb-img {
  width: 34px; height: 34px; object-fit: cover; border-radius: 5px;
  border: 1px solid var(--border); background: #f4f6f8; display: block;
}
.thumb-img:hover { border-color: var(--teal); }

/* detail / edit gallery (ListingDashboard.image_gallery) — small album grid */
.img-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, 56px);
  gap: 6px;
}
.gallery-img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 5px;
  border: 1px solid var(--border); background: #f4f6f8; display: block;
}
.gallery-img:hover { border-color: var(--teal); }
.table-scroll .num-input:focus { border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px var(--teal-50); }

/* title cell (rendered by ListingDashboard.product_title) */
.title-cell { min-width: 120px; max-width: 190px; }
.table-scroll thead th:nth-child(3),
.table-scroll tbody td:nth-child(3) { padding-left: 6px; padding-right: 6px; }
.cell-title-link, .cell-title-link--plain {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.3;
}
/* Variant list: headers centered, data left-aligned, columns hug content (no big right gap) */
.table-card[data-model="catalog_variant"] .table-scroll table { width: auto; min-width: 0; }
.table-card[data-model="catalog_variant"] thead th,
.table-card[data-model="catalog_variant"] tbody td { text-align: center; }
.table-card[data-model="catalog_variant"] thead th,
.table-card[data-model="catalog_variant"] tbody td { padding-left: 10px; padding-right: 10px; }
.table-card[data-model="catalog_variant"] thead th:last-child,
.table-card[data-model="catalog_variant"] tbody td:last-child { width: 1%; white-space: nowrap; }

.cell-title-link { font-weight: 600; color: var(--teal-dark); text-decoration: none; }
a.cell-title-link::after { content: " \2197"; font-size: 11px; color: var(--text-3); }
a.cell-title-link:hover { text-decoration: underline; }
.cell-title-link--plain { color: var(--text-1); font-weight: 600; }
.variant-sub { color: var(--text-3); font-size: 12px; margin-top: 3px; }

/* description cell + instant hover tooltip (see #desc-tip in list.html) */
.desc-cell { cursor: help; }
#desc-tip {
  display: none; position: fixed; z-index: 200;
  max-width: 420px;
  white-space: pre-wrap; line-height: 1.45;
  background: #1e293b; color: #fff; font-size: 12.5px;
  padding: 9px 11px; border-radius: 7px;
  box-shadow: 0 6px 22px rgba(0,0,0,.28); pointer-events: none;
}
.price-static { font-weight: 600; color: var(--text-1); }

/* sticky action column */
.col-actions { white-space: nowrap; text-align: center; }
.table-scroll thead th.col-actions,
.table-scroll tbody td.col-actions { padding-left: 6px; padding-right: 8px; width: 1%; }
th.col-actions, td.col-actions {
  position: sticky; right: 0; background: var(--card-bg);
  box-shadow: -8px 0 8px -8px rgba(16,24,40,.15);
}
.table-scroll thead th.col-actions { background: #FAFBFC; z-index: 6; }
.table-scroll tbody tr:hover td.col-actions { background: #FAFBFD; }
.action-group { display: inline-flex; align-items: center; gap: 2px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: #fff;
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  text-decoration: none; transition: background .12s ease, border-color .12s ease, color .12s ease; flex-shrink: 0;
}
.icon-btn i { font-size: 16px; }
.icon-btn .ic { width: 16px; height: 16px; }
.icon-btn:hover { background: #F1F3F7; border-color: var(--border-strong); color: var(--text-1); }
.icon-btn.edit:hover { background: var(--teal-50); border-color: var(--teal); color: var(--teal-dark); }
.icon-btn.delete:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }

.id-copy { display: inline-flex; align-items: center; gap: 6px; }
.id-copy code { font-size: 12.5px; background: #F1F3F7; padding: 2px 6px; border-radius: 5px; }
.icon-btn.copy-btn { width: 24px; height: 24px; }
.icon-btn.copy-btn.copied { background: var(--teal-50); border-color: var(--teal); color: var(--teal-dark); }

/* ---------- Table footer / pagination ---------- */
.table-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.footer-count { font-size: 12.5px; color: var(--text-2); }
.footer-count b { color: var(--text-1); }
.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.page-btn:hover { background: #F8FAFC; }
.page-btn.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-btn .ic { width: 15px; height: 15px; }
.page-ellipsis { color: var(--text-3); padding: 0 4px; }

/* ---------- Messages ---------- */
.msg { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.msg-error { background: var(--color-error-bg); color: var(--color-error-text); border-color: #F4C6C9; }
.msg-success { background: var(--green-bg); color: var(--green); border-color: #BFE7CF; }
.msg-warning { background: var(--amber-bg); color: var(--amber); border-color: #F6DDB4; }

/* ---------- Shared components used by other dashboard pages ---------- */
h1 { font-size: 20px; }
table { border-collapse: collapse; width: 100%; background: var(--card-bg); }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; font-size: 13px; }
th { background: var(--color-th-bg); }
input, select, textarea {
  padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 7px;
  font-size: 13px; width: 100%; background: #fff; color: var(--text-1); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-50); }
input[type=checkbox], input[type=radio] { width: auto; }

.text-muted { color: var(--text-2); font-size: 13px; }
.text-error { color: var(--color-error-text); font-size: 13px; }

.card { background: var(--card-bg); padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card--narrow { max-width: 560px; }
.card--form { max-width: 640px; }
.panel { background: var(--color-panel-bg); padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.panel h3 { margin-top: 0; }
.kv-row { margin: 4px 0; font-size: 14px; }

.stat-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 150px; padding: 16px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; box-shadow: var(--shadow-card); }
.stat-card__value { font-size: 28px; font-weight: 700; }
.stat-card__value--live { color: var(--green); }
.stat-card__value--draft { color: var(--blue); }
.stat-card__value--order { color: var(--teal); }
.stat-card__label { color: var(--text-2); font-size: 13px; }

/* Status pills (home page recent table) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-ready { background: var(--green-bg); color: var(--green); } .pill-ready .dot { background: var(--green); }
.pill-review { background: var(--amber-bg); color: var(--amber); } .pill-review .dot { background: var(--amber); }
.pill-live { background: var(--blue-bg); color: var(--blue); } .pill-live .dot { background: var(--blue); }
.pill-draft { background: var(--gray-bg); color: var(--text-2); } .pill-draft .dot { background: var(--text-3); }
.pill-ended { background: var(--red-bg); color: var(--red); } .pill-ended .dot { background: var(--red); }

/* ---------- Analytics charts (home page) ---------- */
.analytics-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.chart-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 18px 20px;
}
.chart-card__head { margin-bottom: 14px; }
.chart-card__title { font-size: 14px; font-weight: 700; color: var(--text-1); margin: 0; }
.chart-card__sub { font-size: 12px; color: var(--text-3); }
.chart-empty { color: var(--text-3); font-size: 13px; padding: 30px 0; text-align: center; }

.donut-wrap { display: flex; align-items: center; justify-content: space-between; gap: 56px; flex-wrap: wrap; }
.donut { width: 168px; height: 168px; flex-shrink: 0; order: 0; }
.donut-wrap .chart-legend { order: 1; }
.donut circle { transition: stroke-dasharray .3s ease; }
.donut-total { font-size: 30px; font-weight: 700; fill: var(--text-1); }
.donut-cap { font-size: 12px; fill: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }

.chart-legend { list-style: none; margin: 0 0 0 auto; padding: 0; flex: 0 1 320px; min-width: 240px; display: flex; flex-direction: column; gap: 10px; }
.chart-legend li {
  display: grid; grid-template-columns: 12px 1fr 52px 52px;
  align-items: center; column-gap: 12px; font-size: 13px; color: var(--text-1);
}
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { color: var(--text-1); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.legend-pct {
  color: var(--text-3); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums;
  text-align: right; min-width: 46px;
}
.legend-head { padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.legend-head span { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.chart-legend--row { flex-direction: row; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.chart-legend--row li { display: flex; gap: 8px; }

.bar-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 12px; height: 190px; padding: 6px 4px 0; }
.bar-group { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.bar-pair { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.bar {
  width: 30px; min-height: 4px; border-radius: 5px 5px 0 0; position: relative;
  display: flex; justify-content: center;
}
.bar--listings { background: #0E7C7B; }
.bar--orders { background: #1D5FBF; }
.bar-val { position: absolute; top: -18px; font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.bar-label { font-size: 12px; color: var(--text-3); font-weight: 600; text-align: center; }

@media (max-width: 820px) {
  .analytics-grid { grid-template-columns: 1fr; }
}

.toolbar { margin-bottom: 12px; }
.record-count { color: var(--text-2); font-size: 13px; }
.link-plain { color: inherit; text-decoration: none; }

/* Page heading + lead text (detail / form / confirm pages) */
.page-lead { color: var(--text-2); font-size: 13.5px; margin: -6px 0 18px; }

.detail-actions { margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.section-heading { font-size: 15px; font-weight: 700; color: var(--text-1); margin: 28px 0 14px; }

/* Card that frames a form or a read-only record */
.sheet {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 22px; max-width: 720px;
}
.sheet--narrow { max-width: 520px; }

/* Grouped section label inside a sheet */
.field-section, .field-group__title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-3); font-weight: 700;
  margin: 24px 0 14px; padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
.field-section:first-of-type, .field-group__title:first-child { margin-top: 4px; }

.field, .form-row { margin-bottom: 16px; }
.field > label, .form-row__label {
  display: block; font-weight: 600; font-size: 13px;
  margin-bottom: 6px; color: var(--text-1);
}
.field .help, .form-row__help { color: var(--text-3); font-size: 12px; margin-top: 5px; display: block; }
.field .err, .form-row__error { color: var(--color-error-text); font-size: 12.5px; margin-top: 5px; }
.field-label-inline { display: inline-block; width: 140px; }

.form-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--border);
}

/* two-column field grid (add / edit forms) */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 30px; }
.form-grid > .field { margin-bottom: 18px; min-width: 0; }
.form-grid > .field--wide { grid-column: 1 / -1; }
.form-grid > .field:has(textarea),
.form-grid > .field:has(select[multiple]) { grid-column: 1 / -1; }
.field textarea { min-height: 120px; resize: vertical; }

/* Read-only detail sheet */
.detail-sheet { overflow: hidden; padding: 0; }
.detail-sheet + .detail-sheet { margin-top: 18px; }
.detail-sheet > h2 {
  margin: 0; padding: 13px 20px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; color: var(--text-3);
  background: var(--color-panel-bg); border-bottom: 1px solid var(--border);
}

/* label/value grid — related fields share a row */
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; padding: 6px 20px 12px; }
.kv { display: flex; flex-direction: column; gap: 5px; padding: 12px 0; border-bottom: 1px solid #EEF1F5; min-width: 0; }
.kv__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.kv__value { font-size: 13.5px; color: var(--text-1); line-height: 1.55; overflow-wrap: anywhere; }
.kv__value pre { white-space: pre-wrap; }
.kv--wide { grid-column: 1 / -1; }

.detail-table { width: 100%; min-width: 0; background: transparent; }
.detail-table th { width: 220px; color: var(--text-2); font-weight: 600; background: transparent; }
.relation-list { margin-top: 0; }

@media (max-width: 820px) {
  .kv-grid, .form-grid { grid-template-columns: 1fr; }
}

/* Confirm / warning callout */
.confirm-note {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--amber-bg); border: 1px solid #F2DBB0; color: #7A4E00;
  border-radius: 9px; padding: 14px 16px; font-size: 13.5px; margin-bottom: 18px;
}
.confirm-note .ic { width: 20px; height: 20px; flex-shrink: 0; color: var(--amber); margin-top: 1px; }
.confirm-note--danger { background: var(--red-bg); border-color: #F1C7CC; color: #8A1C25; }
.confirm-note--danger .ic { color: var(--red); }

/* Modal (in-page popup) — reuses .sheet for the panel */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(9,13,22,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay .sheet { box-shadow: var(--shadow-pop); width: 100%; max-width: 360px; padding: 18px; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-1); margin: 0 0 8px; }
.modal-target {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--text-2);
  background: var(--gray-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px; margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.modal-overlay .confirm-note { padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; }
.modal-overlay .form-actions { margin-top: 0; padding-top: 14px; }

/* Login page (standalone template, does not extend base.html) */
.login-page { font-family: var(--font-sans); background: var(--page-bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
.login-page .card { padding: 32px; border-radius: 12px; box-shadow: var(--shadow-pop); width: 320px; border: none; }
.login-page h1 { font-size: 20px; margin-top: 0; }
.login-page label { display: block; margin: 12px 0 4px; font-size: 14px; }
.login-page input { width: 100%; padding: 9px; border: 1px solid var(--border-strong); border-radius: 7px; }
.login-page button { margin-top: 16px; width: 100%; padding: 10px; background: var(--teal); color: #fff; border: none; border-radius: 7px; cursor: pointer; }
.login-page button:hover { background: var(--teal-dark); }
.login-page a { display: block; margin-top: 12px; font-size: 13px; color: var(--teal-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: flex; }
  .page-title { font-size: 17px; }
}
@media (max-width: 600px) {
  .content { padding: 14px 12px 28px; }
  .topbar { padding: 12px 14px; }
  .topbar-actions .btn span { display: none; }
  .search-wrap { flex: 1 1 100%; }
  .toolbar-row .btn-primary { flex: 1 1 100%; justify-content: center; }
  .dd { flex: 1 1 100%; }
  .dd .btn-outline { width: 100%; justify-content: space-between; }
  .dd-panel, .dd-panel.right { left: 0; right: 0; width: auto; }
}
