:root {
  --font-sans: "Segoe UI", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --bg: #f3f7f6;
  --surface: #ffffff;
  --surface-2: #f8fbfa;
  --surface-3: #eef4f2;
  --ink: #142321;
  --ink-2: #425754;
  --ink-3: #70827f;
  --line: #dfe9e6;
  --line-strong: #c8d8d4;
  --primary: #0f766e;
  --primary-strong: #0b5d57;
  --primary-soft: #d7f0eb;
  --primary-ink: #073f3b;
  --accent: #b7791f;
  --accent-soft: #fdf3dd;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --success: #067647;
  --success-soft: #dcfae6;
  --info: #175cd3;
  --info-soft: #e0efff;
  --sidebar: #0b2422;
  --sidebar-2: #103431;
  --shadow-sm: 0 1px 2px rgba(10, 35, 32, .06), 0 1px 3px rgba(10, 35, 32, .08);
  --shadow-md: 0 10px 28px rgba(10, 35, 32, .10);
  --shadow-lg: 0 24px 60px rgba(5, 25, 23, .22);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 1.18rem; line-height: 1.3; letter-spacing: -.01em; }
h3 { font-size: 1rem; line-height: 1.35; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-3); padding: .12em .35em; border-radius: 5px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }
::selection { background: var(--primary-soft); }

.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.text-sm { font-size: .86rem; }
.text-xs { font-size: .78rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--bg); color: var(--ink-2);
}
.boot__mark {
  display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--primary); color: #fff; font-weight: 800; letter-spacing: .04em;
  box-shadow: var(--shadow-md);
}
.boot p { font-size: .9rem; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--primary); color: #fff;
  font-weight: 800; font-size: .95rem; letter-spacing: .03em;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.brand__text { font-weight: 750; font-size: 1.08rem; letter-spacing: -.02em; }
.brand--light .brand__mark { background: #5eead4; color: #073f3b; }
.brand--light .brand__text { color: #f0fdfa; }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
}
.auth__aside {
  position: relative;
  display: grid;
  align-items: end;
  padding: 56px;
  color: #eafffb;
  background:
    radial-gradient(1000px 500px at 15% 10%, rgba(94, 234, 212, .22), transparent 60%),
    radial-gradient(700px 460px at 90% 80%, rgba(15, 118, 110, .55), transparent 65%),
    linear-gradient(160deg, #0b2422 0%, #0f3b37 55%, #0b2a27 100%);
  overflow: hidden;
}
.auth__aside::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 85%);
  pointer-events: none;
}
.auth__aside-inner { position: relative; z-index: 1; max-width: 560px; display: grid; gap: 22px; }
.auth__aside h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.12; letter-spacing: -.035em; color: #fff; }
.auth__aside p { color: #b7d8d3; max-width: 500px; }
.auth__points { display: grid; gap: 10px; padding: 0; margin: 6px 0 0; list-style: none; }
.auth__points li { display: flex; gap: 10px; align-items: flex-start; color: #d8f5f0; font-size: .94rem; }
.auth__points li::before {
  content: ""; flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px;
  border-radius: 50%; background: rgba(94,234,212,.18);
  border: 1px solid rgba(94,234,212,.55);
  background-image: linear-gradient(45deg, transparent 45%, #5eead4 45% 55%, transparent 55%),
                    linear-gradient(-45deg, transparent 45%, #5eead4 45% 55%, transparent 55%);
  background-size: 8px 8px; background-position: center; background-repeat: no-repeat;
}
.auth__panel {
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px clamp(28px, 7vw, 92px);
  background: var(--surface);
}
.auth__brand { display: none; margin-bottom: 28px; }
.auth__panel h1 { font-size: 1.9rem; margin-bottom: 8px; }
.auth__panel > .muted { margin-bottom: 26px; }
.auth__panel .form { gap: 16px; }
.auth__foot { margin-top: 26px; font-size: .84rem; }
.form-error {
  color: var(--danger); background: var(--danger-soft);
  border: 1px solid #fecdca; border-radius: var(--radius-xs);
  padding: 10px 12px; font-size: .87rem;
}

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar) 0%, #081d1b 100%);
  color: #cfeeea;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar__head { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 16px; }
.sidebar__close { display: none; }
.sidebar__business {
  margin: 0 14px 12px; padding: 10px 12px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  display: grid; gap: 2px;
}
.sidebar__label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #79aaa4; }
.sidebar__business strong { font-size: .9rem; color: #eafffb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 14px; display: grid; gap: 2px; align-content: start; }
.nav__section {
  padding: 14px 12px 6px;
  font-size: .66rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: #6c9b96;
}
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: #b9d9d5; font-size: .89rem; font-weight: 550;
  text-decoration: none; border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav__item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav__item.is-active { background: rgba(94,234,212,.14); color: #ecfffc; border-color: rgba(94,234,212,.22); }
.nav__icon { width: 20px; height: 20px; flex: 0 0 auto; opacity: .9; }
.nav__badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px;
  border-radius: 999px; background: #fdb022; color: #3b2600;
  font-size: .68rem; font-weight: 800; text-align: center;
}
.sidebar__foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%;
  background: #134e48; color: #99f6e4; font-weight: 800; font-size: .82rem;
  border: 1px solid rgba(94,234,212,.25);
}
.user-chip__meta { display: grid; min-width: 0; line-height: 1.25; }
.user-chip__meta strong { font-size: .84rem; color: #ecfffc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-label { font-size: .7rem; color: #7fb6b0; text-transform: uppercase; letter-spacing: .08em; }
.main { min-height: 100vh; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 16px clamp(18px, 3vw, 34px);
  background: rgba(243, 247, 246, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; }
.topbar__eyebrow { font-size: .71rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-3); }
.topbar__title { font-size: 1.35rem; letter-spacing: -.02em; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar__date { font-size: .82rem; color: var(--ink-3); white-space: nowrap; }
.view { flex: 1; padding: clamp(18px, 3vw, 34px); outline: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(3, 20, 18, .45); backdrop-filter: blur(2px); }

/* ---------- Typography & layout ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head__title { display: grid; gap: 4px; }
.page-head__title h2 { font-size: 1.35rem; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 18px; }
.stack-sm { display: grid; gap: 10px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.divider { height: 1px; background: var(--line); border: 0; margin: 2px 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card__head h3 { font-size: .98rem; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card--soft { background: var(--surface-2); box-shadow: none; }
.stat {
  position: relative; overflow: hidden;
  padding: 18px;
  display: grid; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat::after {
  content: ""; position: absolute; right: -20px; top: -24px; width: 92px; height: 92px; border-radius: 50%;
  background: var(--primary-soft); opacity: .65;
}
.stat__label { position: relative; z-index: 1; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.stat__value { position: relative; z-index: 1; font-size: 1.45rem; font-weight: 760; letter-spacing: -.03em; }
.stat__hint { position: relative; z-index: 1; font-size: .78rem; color: var(--ink-3); }
.stat--accent::after { background: var(--accent-soft); }
.stat--danger::after { background: var(--danger-soft); }
.stat--info::after { background: var(--info-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-size: .87rem; font-weight: 650; line-height: 1.1;
  text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .nav__item:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .25); outline-offset: 1px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15,118,110,.25); }
.btn--primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: #912018; border-color: #912018; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); }
.btn--light { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #eafffb; }
.btn--light:hover { background: rgba(255,255,255,.16); }
.btn--sm { min-height: 32px; padding: 5px 10px; font-size: .79rem; border-radius: 8px; }
.btn--block { width: 100%; }
.btn--link { min-height: 0; padding: 0; border: 0; background: none; color: var(--primary); font-weight: 650; }
.btn--link:hover { background: none; text-decoration: underline; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 1rem; line-height: 1; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn--light { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: #d8f5f0; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.field__hint { font-size: .75rem; color: var(--ink-3); }
.field--span-2 { grid-column: span 2; }
.field--span-3 { grid-column: span 3; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-size: .89rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: #a9c2bd; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); outline: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }
textarea { min-height: 92px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--primary); }
.checkline { display: flex; align-items: flex-start; gap: 9px; font-size: .86rem; color: var(--ink-2); }
.checkline input { margin-top: 2px; }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; }
.search-box { position: relative; min-width: 220px; }
.search-box input { padding-left: 34px; }
.search-box::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%);
  border: 2px solid var(--ink-3); border-radius: 50%; box-sizing: border-box;
}
.search-box::after {
  content: ""; position: absolute; left: 24px; top: calc(50% + 4px); width: 6px; height: 2px;
  background: var(--ink-3); transform: rotate(45deg); border-radius: 2px;
}
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filter-bar .field { min-width: 150px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--ink-3);
  font-size: .7rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap;
}
table.data tbody tr:hover { background: #fbfdfc; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table-empty { padding: 36px 18px; text-align: center; color: var(--ink-3); }
.table-empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; }

/* ---------- Badges & alerts ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.6; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid transparent;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--accent-soft); color: #8a5300; }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--muted { background: var(--surface-3); color: var(--ink-3); }
.badge--primary { background: var(--primary-soft); color: var(--primary-ink); }
.alert {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 11px 13px; border-radius: var(--radius-xs);
  font-size: .84rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
}
.alert strong { display: block; }
.alert--warn { background: var(--accent-soft); border-color: #f5d9a8; color: #6b4100; }
.alert--danger { background: var(--danger-soft); border-color: #fecdca; color: var(--danger); }
.alert--info { background: var(--info-soft); border-color: #c7ddfb; color: #124a9e; }
.alert--success { background: var(--success-soft); border-color: #a9efc5; color: var(--success); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 18px;
  background: rgba(4, 22, 20, .52); backdrop-filter: blur(3px);
  animation: fade-in .12s ease;
}
.modal {
  width: min(680px, 100%); max-height: min(88vh, 900px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.4);
  animation: pop-in .16s ease;
  overflow: hidden;
}
.modal--sm { width: min(460px, 100%); }
.modal--lg { width: min(940px, 100%); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 1.05rem; }
.modal__head p { margin-top: 2px; font-size: .8rem; color: var(--ink-3); }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__body--flush { padding: 0; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.modal__close { flex: 0 0 auto; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 9px; width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px;
  background: #132a27; color: #edfffc; box-shadow: var(--shadow-md);
  font-size: .85rem; animation: toast-in .18s ease;
  border-left: 4px solid #5eead4;
}
.toast--error { border-left-color: #f97066; }
.toast--warn { border-left-color: #fdb022; }
.toast--success { border-left-color: #75e0a7; }
.toast strong { display: block; margin-bottom: 1px; }
.toast__close { margin-left: auto; background: none; border: 0; color: #a8d6d0; font-size: 1rem; line-height: 1; padding: 0 0 0 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Loading / empty ---------- */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(15,118,110,.2); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px;
}
.spinner--light { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; align-items: center; gap: 10px; padding: 46px; justify-content: center; color: var(--ink-3); }
.empty { display: grid; justify-items: center; gap: 7px; padding: 44px 18px; text-align: center; color: var(--ink-3); }
.empty strong { color: var(--ink-2); font-size: .98rem; }
.empty p { max-width: 460px; font-size: .85rem; }
.empty__mark {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px;
  background: var(--surface-3); color: var(--primary); font-weight: 800; font-size: 1.1rem;
}

/* ---------- Charts ---------- */
.chart-wrap { position: relative; width: 100%; min-height: 260px; }
.chart-wrap canvas { width: 100% !important; height: 260px !important; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  padding: 9px 13px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--ink-3); font-size: .86rem; font-weight: 650; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Misc components ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(0, 1.2fr); gap: 8px 16px; font-size: .86rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-ink); font-size: .84rem; }
.notice strong { display: block; }
.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.rule-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rule-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rule-card__title { display: grid; gap: 2px; }
.rule-card__title strong { font-size: .92rem; }
.rule-card__meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-3); }
.timeline { display: grid; gap: 0; }
.timeline__item { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); }
.timeline__item:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline__item::before {
  content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary);
}
.timeline__item--muted::before { border-color: var(--line-strong); }
.timeline__title { font-size: .88rem; font-weight: 650; }
.timeline__meta { font-size: .77rem; color: var(--ink-3); }
.progress { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.code-block {
  padding: 12px; border-radius: 10px; background: #0d2724; color: #d8f5f0;
  font-family: var(--font-mono); font-size: .78rem; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.diff { display: grid; gap: 4px; font-size: .78rem; }
.diff__row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.diff__row span:first-child { color: var(--ink-3); }
.diff__old { color: var(--danger); text-decoration: line-through; }
.diff__new { color: var(--success); }
.receipt { font-family: var(--font-mono); font-size: .8rem; line-height: 1.55; }
.receipt__head { text-align: center; padding-bottom: 10px; border-bottom: 1px dashed var(--ink-3); margin-bottom: 10px; }
.receipt__line { display: flex; justify-content: space-between; gap: 12px; }
.receipt__total { border-top: 1px dashed var(--ink-3); margin-top: 8px; padding-top: 8px; font-weight: 700; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-title h3 { font-size: .95rem; }
.list-reset { list-style: none; padding: 0; margin: 0; }
.employee-pick { display: grid; gap: 7px; max-height: 220px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.employee-pick label { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.employee-pick input[type="number"] { width: 78px; min-height: 32px; padding: 4px 7px; }
.items-editor { display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 80px 120px 120px 40px; gap: 8px; align-items: center; }
.item-row--head { font-size: .7rem; font-weight: 750; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.item-total { text-align: right; font-variant-numeric: tabular-nums; }
.summary-box { display: grid; gap: 7px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; }
.summary-box__line { display: flex; justify-content: space-between; gap: 12px; }
.summary-box__line--total { border-top: 1px solid var(--line-strong); margin-top: 4px; padding-top: 8px; font-weight: 750; font-size: 1rem; }
.simulation { display: grid; gap: 12px; }
.simulation__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.simulation__cell { padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.simulation__cell span { display: block; font-size: .72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.simulation__cell strong { display: block; margin-top: 3px; font-size: .95rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .auth__brand { display: flex; }
  .auth__panel { min-height: 100vh; padding: 40px 24px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: none; }
  .sidebar__close { display: inline-grid; }
  .main { margin-left: 0; }
  .topbar__menu { display: inline-grid; }
  .topbar__date { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .field--span-2, .field--span-3 { grid-column: auto; }
  .item-row { grid-template-columns: 1fr 70px 100px 36px; }
  .item-row > :nth-child(4) { display: none; }
}
@media (max-width: 560px) {
  .view { padding: 16px 14px 28px; }
  .topbar { padding: 12px 14px; }
  .topbar__title { font-size: 1.12rem; }
  .page-head { flex-direction: column; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .stat__value { font-size: 1.25rem; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .toast-root { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .search-box { width: 100%; }
  .filter-bar .field { flex: 1 1 120px; }
  .item-row { grid-template-columns: 1fr 62px 34px; }
  .item-row > :nth-child(3), .item-row > :nth-child(4) { display: none; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .page-head__actions, .toast-root, .modal__foot, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .view { padding: 0; }
  .card { box-shadow: none; border-color: #bbb; }
  .modal-backdrop { position: static; display: block; background: none; padding: 0; }
  .modal { box-shadow: none; border: 0; max-height: none; width: 100%; }
  .modal__body { overflow: visible; }
}
