/* ============================================================
   Hoa Mặt Trời — Component layer
   Depends on colors_and_type.css. The full reusable component set:
   shell · breadcrumb · cards · KPI tiles · nav · tabs · buttons ·
   status pills · chips · tables · sticky action bar · modal/drawer ·
   banners · badges · forms · dignity gate · empty/loading · toast ·
   pagination.
   ============================================================ */

/* ----------------------------------------------------------------
   LAYOUT SHELL
   ---------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.scrim { display: none; }

/* --- Sidebar --- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-700) 100%);
  color: #cfd0ee;
  display: flex;
  flex-direction: column;
  padding: var(--s5) var(--s3) var(--s4);
  overflow-y: auto;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3) var(--s5);
}
.sidebar__brand img { width: 38px; height: 38px; flex: none; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1; }
.sidebar__brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--cream);
  letter-spacing: .01em;
}
.sidebar__brand-sub {
  font-family: var(--font-ui);
  font-size: 9.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--navy-300);
  margin-top: 3px;
}
.nav-group { margin-top: var(--s4); }
.nav-group__label {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #7a7ab8;
  padding: 0 var(--s3) var(--s2);
  font-weight: 600;
}

/* --- Sidebar nav item (default / active / badge) --- */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 11px var(--s3);
  border-radius: var(--r-sm);
  color: #c5c6e8;
  font-weight: 500;
  font-size: var(--t-base);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 4px;
  transition: background .14s ease, color .14s ease;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item .ico { width: 18px; height: 18px; flex: none; stroke-width: 2; opacity: .9; }
.nav-item.is-active {
  background: rgba(13,144,152,.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--teal), inset 0 0 0 1px rgba(13,144,152,.35);
}
.nav-item.is-active .ico { color: var(--sunflower); opacity: 1; }
.nav-item__badge {
  margin-left: auto;
  background: var(--sunflower);
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  min-width: 20px; height: 20px;
  border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
.sidebar__foot { margin-top: auto; padding-top: var(--s4); }

/* --- Main column --- */
.main { display: flex; flex-direction: column; min-width: 0; }

/* --- Top bar --- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s7);
}
.topbar__title { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.topbar__area { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); font-weight: 600; }
.topbar__page { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }
.topbar__search {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--app-bg); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 7px 14px; width: 260px; max-width: 30vw;
  color: var(--muted);
}
.topbar__search input { border: none; background: none; outline: none; font: inherit; color: var(--ink); width: 100%; }
.topbar__user { display: flex; align-items: center; gap: var(--s3); }
.avatar {
  width: 34px; height: 34px; border-radius: var(--r-pill);
  background: var(--navy); color: var(--cream);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  flex: none;
}
/* Hidden on desktop. Specificity .icon-btn.hamburger beats the later
   `.icon-btn { display:inline-flex }` rule, which otherwise re-shows it. */
.icon-btn.hamburger { display: none; }

/* --- Content frame --- */
.content { padding: var(--s8) var(--s8) var(--s9); max-width: var(--content-max); width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); margin-bottom: var(--s7); flex-wrap: wrap; }
.page-head h1 { font-size: var(--t-h1); }
.page-head__sub { color: var(--muted); font-size: var(--t-base); margin-top: 4px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin: var(--s8) 0 var(--s5); }
.section-head h2 { font-size: var(--t-h2); }

/* ----------------------------------------------------------------
   BREADCRUMB
   ---------------------------------------------------------------- */
.breadcrumb { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb__sep { color: var(--faint); }
.breadcrumb__current { color: var(--ink); font-weight: 600; }

/* ----------------------------------------------------------------
   CARDS
   ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card--cream { background: var(--cream); border-color: var(--cream-deep); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s5) var(--s6) var(--s4); border-bottom: 1px solid var(--hairline-2); }
.card__head h3 { font-size: var(--t-h3); }
.card__title-meta { color: var(--muted); font-size: var(--t-sm); margin-top: 2px; }
.card__body { padding: var(--s6); }
.card__foot { padding: var(--s4) var(--s6); border-top: 1px solid var(--hairline-2); display: flex; align-items: center; gap: var(--s3); }

/* ----------------------------------------------------------------
   KPI TILES
   ---------------------------------------------------------------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); gap: var(--s5); }
.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--s6);
  text-align: left;
  cursor: pointer;
  display: block; width: 100%;
  text-decoration: none; color: inherit;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  overflow: hidden;
}
.kpi::after { /* sunflower wash accent */
  content: ""; position: absolute; right: -28px; top: -28px;
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--sunflower-soft), transparent 70%);
  opacity: .6; pointer-events: none;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--cream-deep); }
.kpi:hover .kpi__cta { opacity: 1; transform: translateX(0); }
.kpi__label { font-size: var(--t-sm); color: var(--muted); font-weight: 600; letter-spacing: var(--track-label); display: flex; align-items: center; gap: var(--s2); }
.kpi__label .ico { width: 16px; height: 16px; color: var(--teal); }
.kpi__value { font-family: var(--font-display); font-weight: 600; font-size: var(--t-display); color: var(--navy); line-height: 1; margin: var(--s3) 0 var(--s1); }
.kpi__value small { font-size: 1rem; color: var(--muted); font-family: var(--font-ui); font-weight: 500; }
.kpi__delta { font-size: var(--t-sm); font-weight: 600; }
.kpi__delta.up { color: var(--ok-fg); }
.kpi__delta.down { color: var(--danger-fg); }
.kpi__cta { position: absolute; right: var(--s5); bottom: var(--s5); color: var(--teal); font-weight: 600; font-size: var(--t-sm); opacity: 0; transform: translateX(-4px); transition: .14s ease; display: flex; align-items: center; gap: 4px; }

/* KPI mini-preview variant */
.kpi--preview { cursor: default; }
.kpi--preview:hover { transform: none; }
.kpi__preview { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px dashed var(--hairline); display: flex; flex-direction: column; gap: 6px; }
.kpi__preview-item { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); color: var(--ink); }
.kpi__preview-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sunflower-deep); flex: none; }
.kpi__preview-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__preview-link { margin-top: 4px; font-size: var(--t-sm); font-weight: 600; color: var(--teal); display: inline-flex; align-items: center; gap: 4px; }

/* ----------------------------------------------------------------
   ACTION LAUNCHPAD  (Overview "Cần bạn xử lý hôm nay")
   A list of tappable rows: coloured status icon + text/meta + a
   hover-revealed "Xử lý ->". Routes straight to the area in need.
   ---------------------------------------------------------------- */
.action-list { padding: 4px 0; }
.action-row {
  display: flex; align-items: center; gap: var(--s4);
  padding: 16px var(--s6);
  border-bottom: 1px solid var(--hairline);
  text-decoration: none; transition: background .12s ease;
}
.action-row:last-child { border-bottom: none; }
.action-row:hover { background: var(--surface-2); text-decoration: none; }
.action-row:hover .action-row__go { opacity: 1; transform: translateX(0); }
.action-row__ic {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.action-row__ic .ico { width: 18px; height: 18px; }
.action-row__ic--rev { background: var(--st-rev-bg); color: var(--st-rev-fg); }
.action-row__ic--trip { background: var(--teal-soft); color: var(--teal-deep); }
.action-row__ic--petal { background: var(--cream-deep); color: var(--sunflower-deep); }
.action-row__body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.action-row__text { font-weight: 600; color: var(--navy); font-size: var(--t-base); }
.action-row__meta { color: var(--muted); font-size: var(--t-sm); }
.action-row__go {
  color: var(--teal); font-weight: 600; font-size: var(--t-sm);
  display: inline-flex; align-items: center; gap: 5px;
  opacity: .5; transform: translateX(-4px); transition: .14s ease; white-space: nowrap;
}
.action-row__go .ico { width: 15px; height: 15px; }

/* ----------------------------------------------------------------
   BUTTONS
   ---------------------------------------------------------------- */
.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: var(--t-base);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; transition: background .14s, border-color .14s, transform .06s, box-shadow .14s;
  text-decoration: none; line-height: 1.1; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--sunflower); color: var(--navy); box-shadow: var(--sh-1); }
.btn--primary:hover { background: var(--sunflower-deep); text-decoration: none; color: var(--navy); }
.btn--primary:focus-visible { box-shadow: var(--focus-ring); }
.btn--secondary { background: var(--surface); color: var(--navy); border-color: var(--hairline); }
.btn--secondary:hover { background: var(--surface-2); border-color: #d6dbe5; text-decoration: none; }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { background: rgba(42,42,114,.06); text-decoration: none; }
.btn--danger { background: var(--surface); color: var(--danger-fg); border-color: var(--danger-bd); }
.btn--danger:hover { background: var(--danger-bg); text-decoration: none; }
.btn--teal { background: var(--teal); color: #fff; }
.btn--teal:hover { background: var(--teal-deep); color: #fff; text-decoration: none; }
.btn--sm { padding: 6px 11px; font-size: var(--t-sm); }
.btn--lg { padding: 12px 22px; font-size: var(--t-lg); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }

/* Icon-only button */
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--hairline);
  background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: .14s;
}
.icon-btn:hover { color: var(--navy); border-color: #d6dbe5; background: var(--surface-2); }
.icon-btn .ico { width: 18px; height: 18px; }

/* ----------------------------------------------------------------
   STATUS PILLS (6-state)
   ---------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui); font-weight: 600; font-size: var(--t-xs);
  letter-spacing: .02em; padding: 3px 10px; border-radius: var(--r-pill);
  border: 1px solid transparent; white-space: nowrap; line-height: 1.4;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill--wait { background: var(--st-wait-bg); color: var(--st-wait-fg); border-color: var(--st-wait-bd); }
.pill--proc { background: var(--st-proc-bg); color: var(--st-proc-fg); border-color: var(--st-proc-bd); }
.pill--rev  { background: var(--st-rev-bg);  color: var(--st-rev-fg);  border-color: var(--st-rev-bd); }
.pill--appr { background: var(--st-appr-bg); color: var(--st-appr-fg); border-color: var(--st-appr-bd); }
.pill--pub  { background: var(--st-pub-bg);  color: var(--st-pub-fg);  border-color: var(--st-pub-bd); }
.pill--rej  { background: var(--st-rej-bg);  color: var(--st-rej-fg);  border-color: var(--st-rej-bd); }

/* ----------------------------------------------------------------
   CHECKLIST CHIPS + NEEDS-CHANGES NOTE CHIP
   ---------------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--t-xs); font-weight: 600; padding: 3px 9px;
  border-radius: var(--r-pill); border: 1px solid var(--hairline);
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.chip .ico { width: 12px; height: 12px; }
.chip--ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.chip--wait { background: var(--st-wait-bg); color: var(--st-wait-fg); border-color: var(--st-wait-bd); }
.chip--fail { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-bd); }
.note-chip {
  display: inline-flex; align-items: flex-start; gap: 6px;
  font-size: var(--t-sm); font-weight: 500; padding: 5px 10px;
  border-radius: var(--r-sm); border: 1px solid var(--st-rev-bd);
  background: var(--st-rev-bg); color: var(--st-rev-fg); line-height: 1.35;
}
.note-chip .ico { width: 13px; height: 13px; margin-top: 1px; flex: none; }
.note-chip b { font-weight: 600; }

/* ----------------------------------------------------------------
   TABLES
   ---------------------------------------------------------------- */
.table-wrap { border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-1); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--t-base); }
table.data thead th {
  position: sticky; top: var(--topbar-h); z-index: 5;
  background: var(--surface-2); color: var(--muted);
  font-weight: 600; font-size: var(--t-sm); text-align: left;
  letter-spacing: var(--track-label); padding: 13px var(--s5);
  border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
table.data tbody td { padding: 15px var(--s5); border-bottom: 1px solid var(--hairline-2); vertical-align: middle; color: var(--ink); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.is-selected { background: var(--cream); }
.td-strong { font-weight: 600; color: var(--navy); }
.td-meta { color: var(--muted); font-size: var(--t-sm); }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-link { color: var(--navy); font-weight: 600; }
.row-link:hover { color: var(--teal); }

/* ----------------------------------------------------------------
   SECONDARY TAB BAR (e.g. finance sub-nav)
   ---------------------------------------------------------------- */
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--hairline); margin-bottom: var(--s6); overflow-x: auto; }
.tab {
  padding: 10px var(--s4); font-weight: 600; font-size: var(--t-base);
  color: var(--muted); border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none;
  transition: color .14s, border-color .14s;
}
.tab:hover { color: var(--navy); text-decoration: none; }
.tab.is-active { color: var(--navy); border-bottom-color: var(--sunflower); }
.tab__count { color: var(--faint); font-weight: 500; margin-left: 5px; }

/* ----------------------------------------------------------------
   VERTICAL SECONDARY NAV (sub-rail inside the content frame)
   A calmer alternative to the horizontal tab bar for areas with
   their own sections (e.g. Tài trợ & tài chính).
   ---------------------------------------------------------------- */
.subnav-layout { display: grid; grid-template-columns: 208px 1fr; gap: var(--s6); align-items: start; }
.subnav { position: sticky; top: calc(var(--topbar-h) + var(--s5)); display: flex; flex-direction: column; }
.subnav__label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 0 var(--s3) var(--s2); }
.subnav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px var(--s3); border-radius: var(--r-sm);
  color: var(--muted); font-weight: 600; font-size: var(--t-base);
  border: 1px solid transparent; background: none; cursor: pointer;
  text-align: left; width: 100%; text-decoration: none; margin-bottom: 2px;
  transition: background .14s, color .14s, box-shadow .14s, border-color .14s;
}
.subnav__item .ico { width: 17px; height: 17px; flex: none; opacity: .85; }
.subnav__item:hover { background: rgba(42,42,114,.05); color: var(--navy); text-decoration: none; }
.subnav__item.is-active {
  background: var(--surface); color: var(--navy);
  border-color: var(--hairline); box-shadow: inset 3px 0 0 var(--teal), var(--sh-1);
}
.subnav__item.is-active .ico { color: var(--teal); opacity: 1; }
.subnav__count {
  margin-left: auto; font-size: 11px; font-weight: 700; line-height: 1;
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--hairline-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.subnav__item.is-active .subnav__count { background: var(--sunflower); color: var(--navy); }

@media (max-width: 760px) {
  .subnav-layout { grid-template-columns: 1fr; gap: var(--s4); }
  .subnav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .subnav__label { display: none; }
  .subnav__item { width: auto; white-space: nowrap; margin-bottom: 0; }
  .subnav__item.is-active { box-shadow: inset 0 -2px 0 var(--teal); border-color: transparent; background: none; }
}

/* ----------------------------------------------------------------
   STICKY ACTION BAR (approval decision controls)
   ---------------------------------------------------------------- */
.action-bar {
  position: sticky; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.94); backdrop-filter: saturate(150%) blur(10px);
  border: 1px solid var(--hairline); border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  padding: var(--s4) var(--s5);
  display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap;
  margin-top: var(--s5);
}
.action-bar__gate { display: flex; align-items: center; gap: var(--s3); flex: 1; min-width: 240px; }
.action-bar__actions { display: flex; gap: var(--s3); margin-left: auto; }

/* ----------------------------------------------------------------
   DIGNITY GATE CHECKBOX  (disabled-until-checked Approve)
   ---------------------------------------------------------------- */
.dignity {
  display: flex; align-items: flex-start; gap: var(--s3);
  background: var(--cream); border: 1px solid var(--cream-deep);
  border-radius: var(--r-md); padding: var(--s3) var(--s4);
}
.dignity input[type="checkbox"] { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--teal); flex: none; cursor: pointer; }
.dignity label { font-weight: 600; color: var(--navy); cursor: pointer; line-height: 1.3; }
.dignity small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ----------------------------------------------------------------
   FORMS
   ---------------------------------------------------------------- */
.field { margin-bottom: var(--s4); }
.field > label { display: block; font-weight: 600; font-size: var(--t-sm); color: var(--navy); margin-bottom: 6px; }
.field__hint { color: var(--muted); font-size: var(--t-sm); margin-top: 5px; }
.input, .textarea, .select {
  width: 100%; font: inherit; font-size: var(--t-base); color: var(--ink);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 9px 12px; transition: border-color .14s, box-shadow .14s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus-ring-teal); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7686' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }

/* Inline edit affordance */
.inline-edit { display: inline-flex; align-items: center; gap: 6px; }
.inline-edit__btn { border: none; background: none; color: var(--teal); font: inherit; font-weight: 600; font-size: var(--t-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: var(--r-xs); }
.inline-edit__btn:hover { background: var(--teal-soft); }
.inline-edit__btn .ico { width: 13px; height: 13px; }

/* ----------------------------------------------------------------
   BANNERS / ALERTS + MOCK-DATA BADGE
   ---------------------------------------------------------------- */
.banner {
  display: flex; align-items: flex-start; gap: var(--s3);
  border-radius: var(--r-md); padding: var(--s3) var(--s4);
  border: 1px solid; font-size: var(--t-base); margin-bottom: var(--s5);
}
.banner .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner__body { flex: 1; }
.banner__body b { font-weight: 600; }
.banner__close { margin-left: auto; }
.banner--info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.banner--warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.banner--ok   { background: var(--ok-bg);   color: var(--ok-fg);   border-color: var(--ok-bd); }
.banner--cream { background: var(--cream); color: var(--ink); border-color: var(--cream-deep); }

.badge-mock {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: repeating-linear-gradient(45deg, var(--st-wait-bg), var(--st-wait-bg) 5px, #e6e9ee 5px, #e6e9ee 10px);
  color: var(--st-wait-fg); border: 1px dashed #c2c8d2;
}

/* ----------------------------------------------------------------
   MODAL / DRAWER
   ---------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28,36,48,.42); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: var(--s5);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-pop);
  width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  transform: translateY(8px) scale(.99); transition: transform .18s ease;
}
.overlay.is-open .modal { transform: none; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: var(--s5) var(--s5) var(--s4); border-bottom: 1px solid var(--hairline-2); }
.modal__head h3 { font-size: var(--t-h3); }
.modal__body { padding: var(--s5); }
.modal__foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--hairline-2); display: flex; gap: var(--s3); justify-content: flex-end; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 92vw; z-index: 100;
  background: var(--surface); box-shadow: var(--sh-pop);
  transform: translateX(100%); transition: transform .22s ease;
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s5); border-bottom: 1px solid var(--hairline-2); }
.drawer__body { padding: var(--s5); overflow: auto; flex: 1; }
.drawer__foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--hairline-2); display: flex; gap: var(--s3); }

/* ----------------------------------------------------------------
   EMPTY + LOADING STATES
   ---------------------------------------------------------------- */
.empty { text-align: center; padding: var(--s9) var(--s5); color: var(--muted); }
.empty__art { width: 64px; height: 64px; margin: 0 auto var(--s4); opacity: .9; }
.empty h3 { color: var(--navy); margin-bottom: 6px; }
.empty p { max-width: 38ch; margin: 0 auto var(--s4); }

.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: var(--r-xs); }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.skeleton--line { height: 12px; margin-bottom: 8px; }
.skeleton--title { height: 22px; width: 45%; margin-bottom: 14px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--hairline); border-top-color: var(--teal); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------
   TOAST / FLASH
   ---------------------------------------------------------------- */
.toast-stack { position: fixed; bottom: var(--s6); right: var(--s6); z-index: 200; display: flex; flex-direction: column; gap: var(--s3); }
.toast {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--navy); color: #fff; border-radius: var(--r-md);
  padding: var(--s3) var(--s4); box-shadow: var(--sh-pop); font-weight: 500;
  min-width: 260px; max-width: 360px;
}
.toast .ico { width: 18px; height: 18px; flex: none; }
.toast--ok { background: var(--ok-fg); }
.toast--warn { background: var(--warn-fg); }
.toast__close { margin-left: auto; color: inherit; opacity: .8; }

/* ----------------------------------------------------------------
   PAGINATION
   ---------------------------------------------------------------- */
.pager { display: flex; align-items: center; gap: 4px; justify-content: center; padding: var(--s4); }
.pager__btn {
  min-width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: var(--t-sm);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0 9px;
}
.pager__btn:hover { background: var(--surface-2); border-color: #d6dbe5; }
.pager__btn.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager__btn[disabled] { opacity: .4; cursor: not-allowed; }
.pager__info { color: var(--muted); font-size: var(--t-sm); margin: 0 var(--s3); }

/* ----------------------------------------------------------------
   UTILITY
   ---------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap1 { gap: var(--s1); } .gap2 { gap: var(--s2); } .gap3 { gap: var(--s3); } .gap4 { gap: var(--s4); } .gap5 { gap: var(--s5); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.serif { font-family: var(--font-display); }
.right { margin-left: auto; }
.divider { height: 1px; background: var(--hairline); border: none; margin: var(--s5) 0; }
/* Line-icon defaults. The sprite's stroke attrs live on a <g> in <defs> that
   does NOT propagate through <use>; without these the cloned symbols default to
   fill:black/stroke:none and render as solid black blobs. Set them here so every
   <svg class="ico"><use/></svg> inherits the stroke styling (currentColor). */
.ico {
  display: inline-block; vertical-align: middle;
  width: 1em; height: 1em;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.topbar__search .ico { width: 16px; height: 16px; flex: none; }

/* ----------------------------------------------------------------
   RESPONSIVE — collapse shell at ~920px
   ---------------------------------------------------------------- */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 110;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--sh-pop);
  }
  .sidebar.is-open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(28,36,48,.42); z-index: 105; opacity: 0; pointer-events: none; transition: opacity .18s; }
  .scrim.is-open { display: block; opacity: 1; pointer-events: auto; }
  .icon-btn.hamburger { display: inline-flex; }
  .content { padding: var(--s5); }
  .topbar { padding: 0 var(--s5); }
  table.data thead th { position: static; }
}
