/* CuisineHub — CRM theme
   Tokens follow the validated data-viz palette (warm neutrals, blue accent, reserved status colors).
   Light values live on :root; dark values are redefined for the OS setting and the manual toggle. */

:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  --accent: #2a78d6;
  --accent-text: #1c5cab;
  --accent-soft: rgba(42, 120, 214, 0.10);
  --btn: #256abf;
  --btn-hover: #1c5cab;
  --series-1: #2a78d6;

  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --bad-text: #d03b3b;

  --shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.05);
  --shadow-md: 0 12px 32px rgba(11, 11, 11, 0.12);
  --radius: 14px;
  --sidebar-w: 264px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --line: #2c2c2a;
    --line-strong: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-text: #86b6ef;
    --accent-soft: rgba(57, 135, 229, 0.16);
    --series-1: #3987e5;
    --good-text: #0ca30c;
    --bad-text: #e66767;
    --shadow-sm: none;
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --line: #2c2c2a;
  --line-strong: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-text: #86b6ef;
  --accent-soft: rgba(57, 135, 229, 0.16);
  --series-1: #3987e5;
  --good-text: #0ca30c;
  --bad-text: #e66767;
  --shadow-sm: none;
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1360px; margin-inline: auto; padding: 28px 32px 56px; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #184f95, #3987e5); color: #fff;
  box-shadow: 0 4px 12px rgba(42, 120, 214, 0.35);
}
.brand-mark .icon { width: 20px; height: 20px; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -0.01em; }
.brand-text small { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-title {
  margin: 16px 10px 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3);
}
.nav-title:first-child { margin-top: 0; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; margin-top: 8px;
  border-top: 1px solid var(--border);
}
.sidebar-user-text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.sidebar-user-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-text small { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.avatar-lg { width: 72px; height: 72px; font-size: 22px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.search {
  display: flex; align-items: center; gap: 10px; flex: 1; max-width: 520px; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--ink-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search kbd {
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
  font: 600 11px var(--font); color: var(--ink-2);
}
.topbar-actions { display: flex; gap: 6px; margin-left: auto; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-toggle { display: none; }
.theme-toggle .when-dark, :root[data-theme="dark"] .theme-toggle .when-light { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: contents; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-subtitle { margin-top: 4px; color: var(--ink-2); }
.page-actions form { margin: 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px; position: relative;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head .muted { font-size: 13px; margin-top: 2px; }
.link { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 10px; font-weight: 600; transition: background 0.15s, opacity 0.15s;
}
.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--btn-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--critical); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--critical) 85%, #000); }
.btn-danger-ghost { background: transparent; color: var(--bad-text); border-color: color-mix(in srgb, var(--critical) 35%, transparent); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--critical) 8%, transparent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; height: 42px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge-demo { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot-good { background: var(--good); }
.dot-warning { background: var(--warning); }
.dot-serious { background: var(--serious); }
.dot-critical { background: var(--critical); }

.alert {
  margin: 20px 0 4px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--bad-text);
  border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
}

/* Grids */
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid > * { min-width: 0; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-charts, .grid-lists { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-profile { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }

/* KPI tiles */
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { color: var(--ink-2); font-weight: 500; }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.kpi-value { margin: 14px 0 12px; font-size: 30px; line-height: 1.1; font-weight: 650; letter-spacing: -0.03em; }
.kpi-unit { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.delta .icon { width: 15px; height: 15px; }
.delta-good { color: var(--good-text); }
.delta-bad { color: var(--bad-text); }
.delta-neutral { color: var(--ink-2); }

/* Tables */
.table-wrap { overflow-x: auto; margin-inline: -22px; }
.card-flush .table-wrap { margin-inline: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 10px 14px; text-align: left; white-space: nowrap; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3);
  background: var(--surface-2); border-block: 1px solid var(--line);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-sub { display: block; font-size: 12px; color: var(--ink-3); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:first-child { padding-top: 0; }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list-end { display: flex; align-items: center; gap: 12px; }
.list-value { min-width: 56px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Details (profile) */
.details { margin: 0; display: grid; }
.details > div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.details > div:last-child { border-bottom: 0; padding-bottom: 0; }
.details dt { color: var(--ink-2); }
.details dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.profile-card { display: grid; justify-items: center; gap: 6px; text-align: center; padding-block: 32px; }
.profile-card h2 { margin-top: 10px; font-size: 18px; }
.profile-card .badge { margin-top: 10px; }

/* Empty state */
.empty { display: grid; justify-items: center; gap: 6px; padding: 56px 24px 64px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty h2 { font-size: 16px; }
.empty p { max-width: 420px; color: var(--ink-2); }

/* ---------- Charts ---------- */
.chart { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 12px; }
.chart-y, .chart-plot { position: relative; height: 240px; }
.chart-y span {
  position: absolute; right: 0; bottom: var(--p); transform: translateY(50%);
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.gridline { position: absolute; left: 0; right: 0; bottom: var(--p); height: 1px; background: var(--line); }
.gridline.is-baseline { background: var(--line-strong); }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-area { fill: var(--series-1); opacity: 0.1; }
.chart-x { grid-column: 2; display: grid; grid-template-columns: repeat(var(--n), 1fr); margin-top: 10px; }
.chart-x span { text-align: center; font-size: 12px; color: var(--ink-3); text-transform: capitalize; }

/* Hover layer: one full-height column per point (large hit target) */
.hit { position: absolute; top: 0; bottom: 0; left: calc(var(--i) / var(--n) * 100%); width: calc(100% / var(--n)); }
.hit::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line-strong); opacity: 0; }
.hit:hover::before { opacity: 1; }
.hit .dot {
  position: absolute; left: 50%; top: var(--y); width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: var(--series-1); box-shadow: 0 0 0 2px var(--surface); opacity: 0;
}
.hit.is-last .dot, .hit:hover .dot { opacity: 1; }

/* Tooltip */
.tip {
  position: absolute; z-index: 10; display: none; padding: 8px 12px; border-radius: 10px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  font-size: 13px; pointer-events: none;
}
.tip-title { display: block; font-size: 12px; color: var(--ink-2); text-transform: capitalize; }
.hit .tip { bottom: calc(100% - var(--y) + 14px); left: 50%; transform: translateX(-50%); }
.hit.is-first .tip { left: 0; transform: none; }
.hit.is-last .tip { left: auto; right: 0; transform: none; }
.hit:hover .tip, .hbar:hover .tip { display: block; }

/* Horizontal bars */
.hbars { display: grid; gap: 16px; }
.hbar { position: relative; display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); align-items: center; gap: 12px; }
.hbar-label { color: var(--ink-2); font-size: 13px; }
.hbar-track { display: flex; align-items: center; height: 24px; }
.hbar-fill { flex: none; height: 16px; width: var(--w); min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series-1); }
.hbar-value { margin-left: 8px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tip-bar { top: -8px; right: 0; transform: translateY(-100%); }

/* ---------- Auth ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-aside {
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px; padding: 40px 56px;
  color: #fff; background:
    radial-gradient(900px 500px at 0% 0%, rgba(134, 182, 239, 0.28), transparent 60%),
    linear-gradient(160deg, #0d366b 0%, #184f95 55%, #2a78d6 100%);
}
.brand-light { padding: 0; }
.brand-light .brand-mark { background: rgba(255, 255, 255, 0.16); box-shadow: none; }
.brand-light small { color: rgba(255, 255, 255, 0.72); }
.auth-pitch h2 { max-width: 460px; font-size: 32px; line-height: 1.2; letter-spacing: -0.03em; font-weight: 650; }
.auth-pitch ul { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 16px; }
.auth-pitch li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.86); }
.auth-pitch li .icon { width: 36px; height: 36px; padding: 9px; border-radius: 10px; background: rgba(255, 255, 255, 0.14); }
.auth-main { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; }
.auth-card .btn-block { margin-top: 24px; }

/* ---------- Responsive ---------- */
.scrim { display: none; }

@media (max-width: 1100px) {
  .grid-charts, .grid-lists, .grid-profile { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: 280px; transform: translateX(-100%);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
  }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-md); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.4); }
  .nav-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
}

@media (max-width: 520px) {
  .search kbd { display: none; }
  .chart { grid-template-columns: 44px minmax(0, 1fr); column-gap: 8px; }
  .hbar { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .details > div { flex-direction: column; gap: 2px; }
  .details dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Lists, forms, details (CRUD pages) ---------- */
[hidden] { display: none !important; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.stack-sm { display: grid; gap: 10px; }
.stack-sm form { margin: 0; }

.messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message {
  padding: 11px 14px; border-radius: 10px; font-weight: 500; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.message-success { border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.message-error { border-color: color-mix(in srgb, var(--critical) 40%, transparent); background: color-mix(in srgb, var(--critical) 8%, var(--surface)); color: var(--bad-text); }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.search-inline { flex: 1 1 260px; max-width: 420px; height: 38px; background: var(--bg); }
.toolbar-count { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 500;
  color: var(--ink-2); background: var(--surface); transition: background 0.15s, color 0.15s;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 600; }

.table th.actions, .table td.actions { width: 1%; text-align: right; white-space: nowrap; }
.table td.actions { padding-block: 6px; }
.table td.actions .icon-btn { display: inline-grid; width: 34px; height: 34px; }
.table tfoot td { padding: 14px; border-top: 1px solid var(--line-strong); }
.table tfoot td:last-child { padding-right: 22px; }
.cell-link:hover strong { color: var(--accent-text); }
.cell-sub-bad { color: var(--bad-text); }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user > span:last-child { display: grid; }
.icon-btn-danger:hover { background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--bad-text); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); }
.pagination-links { display: flex; gap: 8px; }

/* Forms */
.form-card { max-width: 920px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.field { display: grid; gap: 6px; margin-top: 18px; align-content: start; }
.field label { font-size: 13px; font-weight: 600; }
.field .req { color: var(--bad-text); }
.field input:not([type="checkbox"]), .field select, .field textarea, .lines input:not([type="checkbox"]), .lines select {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .lines input:focus, .lines select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--critical); }
.field-wide { grid-column: 1 / -1; }
.field-check { align-content: end; }
.check { display: flex; align-items: center; gap: 10px; min-height: 42px; font-weight: 500 !important; }
.check input { width: 18px; height: 18px; accent-color: var(--btn); }
.help { font-size: 12.5px; color: var(--ink-3); }
.field-error { font-size: 12.5px; color: var(--bad-text); margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.stack > .form-actions { margin-top: 0; }
.confirm { display: grid; justify-items: center; gap: 8px; text-align: center; padding-block: 40px; }
.confirm .form-actions { justify-content: center; }
.empty-icon-danger { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--bad-text); }

/* Order lines */
.lines-table td { vertical-align: top; padding-block: 10px; }
.lines-table th:nth-child(2), .lines-table td:nth-child(2) { width: 150px; }
.lines-table th:nth-child(3), .lines-table td:nth-child(3) { width: 170px; }
.lines-table th:nth-child(4), .lines-table td:nth-child(4) { width: 130px; }
.lines-table td[data-line-total] { padding-top: 21px; font-weight: 600; }
.lines-table td:first-child { min-width: 240px; }
.lines-table .actions .icon-btn { margin-top: 2px; }
.lines-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.lines-total { font-size: 15px; color: var(--ink-2); }
.lines-total strong { margin-left: 8px; font-size: 20px; color: var(--ink); letter-spacing: -0.02em; }

/* Detail pages */
.grid-detail { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.note { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); white-space: pre-line; }
.chart-note { margin-top: 14px; font-size: 13px; }

@media (max-width: 1100px) { .grid-detail { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar, .pagination { padding-inline: 16px; }
  .toolbar-count { margin-left: 0; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}

/* Settings tabs */
.tabs { display: flex; gap: 4px; margin: -8px 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  padding: 10px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; white-space: nowrap;
  font-weight: 500; color: var(--ink-2); transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.help ul { margin: 6px 0 0; padding-left: 18px; }
.help li { margin-bottom: 2px; }
