/* ==========================================================================
   Twilight Solar — Operations platform design system
   One stylesheet for every page: the app shell, components, and the
   classes the existing order/quotation screens already use (so app.js
   renders into the new look without being rewritten).

   Palette comes from the logo: royal "panel" blue, a deep navy for the
   sidebar, and a warm solar amber for the few things that should pull the
   eye (alerts, the primary call-to-action on empty states). Light + dark
   themes share the same tokens; the legacy --navy/--grey variables used by
   inline styles in app.js are mapped onto them so they follow the theme.
   ========================================================================== */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --brand-50: #eef4ff;
  --brand-100: #dbe7ff;
  --brand-200: #bcd2fe;
  --brand-500: #2f6fe4;
  --brand-600: #1f55c7;
  --brand-700: #1a45a0;
  --brand-900: #0f2556;
  --accent: #f5a524;
  --accent-600: #d9860b;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef2f8;
  --border: #e3e8f1;
  --border-strong: #cfd7e5;
  --text: #0f1a2e;
  --text-2: #3c4a63;
  --muted: #66748d;
  --faint: #95a1b6;

  --ok: #15803d;      --ok-bg: #e8f6ee;     --ok-border: #b6e2c6;
  --warn: #9a5b00;    --warn-bg: #fff4dc;   --warn-border: #f5d58f;
  --danger: #c0262d;  --danger-bg: #fdecec; --danger-border: #f3b9b9;
  --info: #0b6aa0;    --info-bg: #e7f3fb;   --info-border: #b7dbf1;
  --neutral-bg: #eef1f6;

  --sidebar-bg: #0c1a38;
  --sidebar-bg-2: #10244d;
  --sidebar-text: rgba(226, 234, 250, .74);
  --sidebar-text-strong: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-active: rgba(92, 145, 255, .22);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(15, 26, 46, .06);
  --shadow-sm: 0 1px 3px rgba(15, 26, 46, .08), 0 1px 2px rgba(15, 26, 46, .04);
  --shadow-md: 0 6px 20px rgba(15, 26, 46, .10);
  --shadow-lg: 0 18px 50px rgba(15, 26, 46, .22);
  --ring: 0 0 0 3px rgba(47, 111, 228, .28);

  --sidebar-w: 252px;
  --topbar-h: 60px;

  /* legacy names used inside app.js inline styles */
  --navy: var(--brand-700);
  --navy-dark: var(--brand-900);
  --blue-light: var(--brand-50);
  --blue-accent: var(--brand-500);
  --grey: var(--muted);
  --grey-light: var(--border);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-50: #13244a;
  --brand-100: #1a2f5c;
  --brand-200: #25407a;
  --brand-500: #5b8ff5;
  --brand-600: #7aa5ff;
  --brand-700: #9dbcff;
  --brand-900: #cddcff;
  --bg: #0a1120;
  --surface: #111a2d;
  --surface-2: #0e1628;
  --surface-3: #18233a;
  --border: #223050;
  --border-strong: #2e3f64;
  --text: #e6ecf7;
  --text-2: #c2cce0;
  --muted: #8d9ab3;
  --faint: #6a7892;
  --ok: #4ade80;     --ok-bg: rgba(34, 197, 94, .12);  --ok-border: rgba(74, 222, 128, .3);
  --warn: #fbbf24;   --warn-bg: rgba(251, 191, 36, .12); --warn-border: rgba(251, 191, 36, .3);
  --danger: #f87171; --danger-bg: rgba(248, 113, 113, .12); --danger-border: rgba(248, 113, 113, .3);
  --info: #60c2f5;   --info-bg: rgba(96, 194, 245, .12); --info-border: rgba(96, 194, 245, .3);
  --neutral-bg: #1b263e;
  --sidebar-bg: #070e1d;
  --sidebar-bg-2: #0b1730;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--text); letter-spacing: -.01em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
img { max-width: 100%; }
::selection { background: var(--brand-200); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }
.hidden { display: none !important; }
/* sprite icons default to 18px; components below size them explicitly */
svg[aria-hidden="true"] { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); font-size: 13px; }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text); display: flex; flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.sb-brand {
  display: flex; align-items: center; gap: 11px; height: var(--topbar-h); padding: 0 18px;
  color: #fff; text-decoration: none !important; flex: none;
}
.sb-brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: #fff; display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(47, 111, 228, .35); overflow: hidden; flex: none;
}
.sb-brand .logo img { width: 30px; height: 30px; object-fit: contain; }
.sb-brand .t1 { font-weight: 700; font-size: 14.5px; letter-spacing: .01em; line-height: 1.1; }
.sb-brand .t2 { font-size: 11px; color: var(--sidebar-text); letter-spacing: .06em; text-transform: uppercase; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 6px 10px 18px; scrollbar-width: thin; }
.sb-group { margin-top: 14px; }
.sb-group-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: rgba(226, 234, 250, .42); padding: 0 10px 6px;
}
.sb-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none !important; font-weight: 500; font-size: 13.5px;
  position: relative; transition: background .12s, color .12s;
}
.sb-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sb-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.sb-link.active { background: var(--sidebar-active); color: #fff; }
.sb-link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sb-link .count {
  margin-left: auto; font-size: 11px; font-weight: 700; background: rgba(245, 165, 36, .18); color: #ffcf7a;
  border-radius: 999px; padding: 1px 7px;
}
.sb-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); flex: none; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: #fff; text-decoration: none !important; }
.sb-user:hover { background: var(--sidebar-hover); }
.sb-user .nm { font-weight: 600; font-size: 13px; line-height: 1.2; }
.sb-user .rl { font-size: 11.5px; color: var(--sidebar-text); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #3d7bf0, #6aa0ff); color: #fff; font-weight: 700; font-size: 12px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .crumbs .sec { color: var(--muted); font-size: 13px; }
.topbar .crumbs .sep { color: var(--faint); }
.topbar h1 { font-size: 16.5px; margin: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 260px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-xs);
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger svg { width: 16px; height: 16px; }
.search-trigger kbd { margin-left: auto; }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-3);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 18px;
}
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

.content { padding: 24px; width: 100%; max-width: 1360px; margin: 0 auto; flex: 1; }
.content.narrow { max-width: 1080px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.app-foot { padding: 18px 24px 26px; color: var(--faint); font-size: 12px; text-align: center; }

.sb-overlay { display: none; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-overlay { display: block; position: fixed; inset: 0; background: rgba(5, 10, 20, .5); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .search-trigger { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
}

/* ==========================================================================
   Components
   ========================================================================== */

/* --- buttons (also styles the legacy .btn variants used by app.js) --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--brand-600); background: var(--brand-600); color: #fff;
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
  box-shadow: 0 1px 2px rgba(31, 85, 199, .25);
}
:root[data-theme="dark"] .btn:not(.secondary):not(.ghost):not(.danger):not(.warn) { color: #0a1120; }
.btn:hover { background: var(--brand-700); border-color: var(--brand-700); }
:root[data-theme="dark"] .btn:not(.secondary):not(.ghost):not(.danger):not(.warn):hover { background: var(--brand-500); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.btn.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs);
}
.btn.secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: none; }
.btn.danger:hover { filter: brightness(.93); }
.btn.warn { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #231400; }
.btn.accent:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn .spinner { margin: 0; }
.linklike {
  background: none; border: none; color: var(--brand-600); font-size: 12px; cursor: pointer; padding: 0;
  text-decoration: underline; font-family: inherit;
}
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }

/* --- inputs --- */
input:not([type]), input[type=text], input[type=number], input[type=date], input[type=email], input[type=password],
input[type=search], input[type=tel], input[type=url], select, textarea {
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; min-height: 36px;
  transition: border-color .12s, box-shadow .12s; max-width: 100%;
}
textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
select { padding-right: 28px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-600); width: 16px !important; height: 16px; min-height: 0 !important;
  flex: none; margin: 0; padding: 0; }
input[type=file] { font: inherit; font-size: 13px; color: var(--text-2); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); }
input.needs-price { background: var(--warn-bg); border-color: var(--warn-border); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, label.grouplabel { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.field-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field.span-2 { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
@media (max-width: 720px) { .field-grid.cols-2, .field-grid.cols-3 { grid-template-columns: 1fr; } .field.span-2 { grid-column: auto; } }
.checkbox-row, .chk-group { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checkbox-row label, .chk-group .chk, label.check {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; font-weight: 500; color: var(--text);
}
.radio-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 32px; width: 100%; }

/* --- cards / panels --- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); margin-bottom: 20px;
}
.panel { padding: 22px; }
.panel > h2, .card-title-legacy {
  margin: 0 0 16px; font-size: 16px; font-weight: 650; color: var(--text);
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 18px; }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid .card { margin-bottom: 0; }
.grid > *, .stack > * { min-width: 0; }
@media (max-width: 640px) {
  .feed .fr { white-space: normal; max-width: 45%; }
  .feed .fr .pill, .feed .fr .badge { white-space: normal; text-align: right; }
  .card-head { flex-wrap: wrap; }
  .card-head .sub { flex-basis: 100%; order: 3; }
}
@media (max-width: 1100px) { .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.side { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .grid.g2, .grid.g3 { grid-template-columns: 1fr; }
  .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .k-value { font-size: 20px; }
  .kpi .k-ico { display: none; }
  .page-head h2 { font-size: 19px; }
}

/* --- KPI tiles --- */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
  text-decoration: none !important; color: inherit; }
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kpi .k-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .k-label svg { width: 16px; height: 16px; }
.kpi .k-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); }
.kpi.tone-warn .k-value { color: var(--warn); }
.kpi.tone-danger .k-value { color: var(--danger); }
.kpi.tone-ok .k-value { color: var(--ok); }
.kpi .k-ico { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600); }
.kpi .k-ico svg { width: 18px; height: 18px; }
.kpi.tone-warn .k-ico { background: var(--warn-bg); color: var(--warn); }
.kpi.tone-danger .k-ico { background: var(--danger-bg); color: var(--danger); }
.kpi.tone-ok .k-ico { background: var(--ok-bg); color: var(--ok); }

/* legacy summary cards (order summary screen) */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.summary-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: relative; }
.summary-card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-500); }
.summary-card .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.summary-card .value { font-size: 22px; font-weight: 750; color: var(--text); margin-top: 4px; font-variant-numeric: tabular-nums; }
.summary-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* --- tables --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table, table.list-table, table.catalog-table, table.items-table, table.sum-table.wide {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px;
}
table.table th, table.list-table th, table.catalog-table th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.table td, table.list-table td, table.catalog-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.table tbody tr:last-child td, table.list-table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover td, table.list-table tbody tr:hover td { background: var(--surface-2); }
table.table tr.clickable { cursor: pointer; }
table.table td.num, table.table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 220px; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
table.table .sub { font-size: 12px; color: var(--muted); }
table.table .title { font-weight: 600; color: var(--text); }
table.table.compact td { padding: 7px 12px; }
table.table input, table.table select { min-height: 32px; padding: 5px 8px; font-size: 13px; }
table.list-table code, table.table code { white-space: nowrap; background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-size: 12px; color: var(--text-2); }
table.list-table a.btn { margin-left: 4px; }
.card > .table-wrap:last-child table tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }

table.items-table th {
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); font-weight: 700;
}
table.items-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.items-table input, table.items-table textarea, table.items-table select { width: 100%; min-height: 32px; padding: 5px 8px; font-size: 13px; }
table.items-table td.num input { text-align: right; }
table.items-table td.amt { text-align: right; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.catalog-table input { width: 100%; min-height: 32px; padding: 5px 8px; }
.cat-row { background: var(--brand-50) !important; color: var(--brand-700); font-weight: 700; padding: 7px 10px; font-size: 12.5px; letter-spacing: .02em; }
td.refcell { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.ref-price { color: var(--brand-700); font-weight: 650; }
.code-line { font-size: 11px; color: var(--faint); margin-top: 2px; font-family: var(--mono); }
.ref-note { font-size: 11px; color: var(--muted); margin-top: 3px; font-style: italic; max-width: 380px; }
.note-input { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.qh { margin: 22px 0 10px; color: var(--text); font-size: 14px; font-weight: 650; }

table.sum-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.sum-table th { text-align: left; width: 220px; font-weight: 600; color: var(--muted); padding: 8px 12px 8px 0; vertical-align: top; font-size: 12.5px; }
table.sum-table td { padding: 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
table.sum-table.wide th { width: auto; padding: 8px 10px; background: var(--surface-2); text-transform: uppercase; font-size: 11.5px; letter-spacing: .04em; }
table.sum-table.wide td { padding: 8px 10px; }
table.sum-table input[type=text], table.sum-table input[type=number], table.sum-table select, table.sum-table textarea { width: 100%; max-width: 380px; }
table.sum-table.wide input, table.sum-table.wide select { max-width: none; }
table.sum-table textarea { max-width: none; min-height: 44px; }
.sum-block { margin-top: 24px; }
.sum-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 7px; margin: 0 0 10px; font-weight: 700; }
tr.row-rejected td { text-decoration: line-through; color: var(--muted); }
tr.row-rejected .pill, tr.row-rejected .btn { text-decoration: none; }
tr.row-warn td { background: var(--danger-bg) !important; }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.row-low td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* --- pills / badges --- */
.pill, .badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; line-height: 18px; white-space: nowrap;
  background: var(--neutral-bg); color: var(--text-2); border: 1px solid transparent;
}
.pill::before, .badge.dot::before { content: none; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.yes, .badge.ok, .pill.status-site_config_done, .pill.status-complete, .pill.proc-ready, .pill.cat-pricing,
.badge.status-received, .badge.w-active { background: var(--ok-bg); color: var(--ok); }
.pill.no, .badge.danger, .pill.cancelled, .pill.rejected, .badge.w-expired { background: var(--danger-bg); color: var(--danger); }
.pill.warn, .badge.warn, .pill.on-hold, .pill.status-processing, .pill.status-in_processing, .pill.status-ready_to_ship,
.pill.proc-waiting_components, .pill.cat-orders, .badge.w-expiring_soon, .badge.status-partial { background: var(--warn-bg); color: var(--warn); }
.pill.status-shipped, .pill.status-installation_done, .pill.proc-preparing, .badge.info, .badge.status-sent { background: var(--info-bg); color: var(--info); }
.pill.status-submitted, .pill.status-received, .pill.cat-auth, .badge.brand, .badge.status-draft { background: var(--brand-50); color: var(--brand-700); }
.pill.unknown, .pill.proc-pending, .badge.neutral, .badge.w-void, .badge.status-cancelled { background: var(--neutral-bg); color: var(--muted); }
.pill.cat-users { background: rgba(124, 58, 237, .12); color: #7c3aed; }
.pill.cat-customers, .pill.cat-quotations, .pill.cat-invoices { background: var(--info-bg); color: var(--info); }
.pill.cat-inventory { background: var(--ok-bg); color: var(--ok); }
.pill.cat-purchasing { background: var(--warn-bg); color: var(--warn); }
.tag { display: inline-block; background: var(--surface-3); color: var(--text-2); border-radius: 6px; padding: 1px 8px; font-size: 12px; margin: 1px 3px 1px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 12.5px; cursor: pointer; color: var(--text-2); font-weight: 550; }
.chip.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.chip .n { font-size: 11px; opacity: .75; }

/* --- notices / alerts --- */
.notice, .alert {
  display: flex; gap: 10px; align-items: flex-start; border-radius: var(--radius); padding: 11px 14px;
  font-size: 13.5px; margin-bottom: 16px; border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--warn);
}
.notice.error, .alert.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.notice.ok, .alert.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.alert.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert b { color: inherit; }

/* --- tabs (legacy records browser + new segmented tabs) --- */
.tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.tabs .tab {
  background: transparent; border: 1px solid transparent; color: var(--muted); padding: 0 12px; height: 34px;
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
}
.tabs .tab:hover { background: var(--surface-3); color: var(--text); }
.tabs .tab.active { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.tabs input[type=search] { flex: 1; min-width: 200px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.toolbar input[type=search] { min-width: 240px; }
.toolbar select { min-width: 150px; }
@media (max-width: 640px) { .toolbar input[type=search] { min-width: 0; width: 100%; } .toolbar select { min-width: 0; flex: 1; } }

/* --- legacy stepper (order flow) --- */
.steps { display: flex; gap: 0; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 6px; box-shadow: var(--shadow-xs); }
.steps .step { flex: 1; text-align: center; padding: 8px 10px; border-radius: 9px; font-size: 13px; color: var(--muted); font-weight: 600; }
.steps .step.active { background: var(--brand-600); color: #fff; }
.steps .step.done { color: var(--brand-600); }
.steps .step.done::before { content: "✓ "; }
.steps .step.skipped { color: var(--faint); text-decoration: line-through; }
@media (max-width: 640px) { .steps .step { font-size: 11.5px; padding: 7px 4px; } }

/* --- legacy home cards (order workspace) --- */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.action-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s, background .15s; display: flex; flex-direction: column;
}
.action-card:first-child { cursor: pointer; border-style: dashed; border-width: 1.5px; border-color: var(--brand-200); background: var(--brand-50); }
.action-card:hover, .action-card.dragover { border-color: var(--brand-500); box-shadow: var(--shadow-sm); }
.action-card h3 { margin: 12px 0 6px; font-size: 14.5px; }
.action-card p { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }
.action-card .btn { margin: 0 6px 6px 0; }
.action-card > div:last-child { display: flex; flex-wrap: wrap; }
.action-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand-600);
  color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; }
.action-icon.alt { background: var(--surface); color: var(--brand-600); border: 1px solid var(--border); }
.filename-line { margin-top: 14px; font-size: 13px; color: var(--brand-700); font-weight: 600; }
.dropzone { border: 2px dashed var(--brand-200); border-radius: var(--radius-lg); padding: 42px 20px; text-align: center; color: var(--muted);
  cursor: pointer; background: var(--brand-50); }
.dropzone.dragover { border-color: var(--brand-500); }
.section-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.section-block > .section-title { background: var(--surface-2); color: var(--text); padding: 9px 14px; font-weight: 650; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.section-block > .section-body { padding: 16px; }
.smartlogger-card { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.smartlogger-card h4 { margin: 0 0 8px; font-size: 13px; }
.summary-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.summary-head h2 { font-size: 16px !important; }
.totals { margin-top: 14px; margin-left: auto; width: 320px; max-width: 100%; }
.totals .row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13.5px; }
.totals .row.total { font-weight: 750; font-size: 17px; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; }
.totals .row input[type=number] { width: 80px; text-align: right; min-height: 30px; padding: 4px 6px; }
.footer-note { display: none; }

/* sign-off cards */
.sig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 16px; }
.sig-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.sig-card.signed { border-color: var(--ok-border); }
.sig-card.unsigned { border-color: var(--danger-border); }
.sig-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--surface-2); font-size: 12px; }
.sig-role { font-weight: 700; letter-spacing: .03em; }
.sig-image { padding: 8px; background: #fff; min-height: 96px; display: flex; align-items: center; justify-content: center; }
.sig-image img { max-height: 150px; }
.sig-meta { padding: 6px 10px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); }

/* tracker timeline */
.track-steps { display: flex; flex-direction: column; }
.track-step { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.track-step:last-child { padding-bottom: 0; }
.track-step::before { content: ""; position: absolute; left: 7px; top: 20px; bottom: -2px; width: 2px; background: var(--border); }
.track-step:last-child::before { display: none; }
.track-step.done::before { background: var(--brand-500); }
.track-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; margin-top: 2px; border: 2px solid var(--border-strong); background: var(--surface); z-index: 1; }
.track-step.done .track-dot { background: var(--brand-500); border-color: var(--brand-500); }
.track-step.current .track-dot { background: var(--surface); border-color: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-100); }
.track-step-label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.track-step.done .track-step-label, .track-step.current .track-step-label { color: var(--text); }
.track-step.current .track-step-label::after { content: "Current"; margin-left: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; background: var(--brand-600); color: #fff; border-radius: 4px; padding: 2px 6px; vertical-align: middle; }
.track-step-time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.proc-checklist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* --- modals (legacy .modal-backdrop/.modal used by app.js, plus ui.js) --- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 14, 28, .55); display: flex; align-items: flex-start; justify-content: center;
  z-index: 80; padding: 6vh 16px 16px; overflow-y: auto; animation: fadeIn .12s ease;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; width: 100%;
  max-width: 760px; max-height: none; box-shadow: var(--shadow-lg); animation: popIn .14s ease; position: relative;
}
.modal.modal-wide, .modal.wide { max-width: 1040px; }
.modal.narrow { max-width: 460px; }
.modal h2 { margin: 0 0 16px; font-size: 17px; font-weight: 700; padding-right: 30px; }
.modal .modal-x { position: absolute; top: 14px; right: 14px; }
.modal details { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.modal details + details { margin-top: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }
details summary { cursor: pointer; font-size: 13px; color: var(--brand-600); font-weight: 600; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* drawer (side panel) */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 28, .45); z-index: 70; animation: fadeIn .12s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 71;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideIn .18s ease; border-left: 1px solid var(--border); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--text); color: var(--bg); padding: 11px 14px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; animation: popIn .16s ease; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: #14532d; color: #eafff0; }
:root[data-theme="dark"] .toast.ok { background: #166534; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* dropdown menus */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md); padding: 6px; z-index: 60; display: none; }
.dropdown.open .menu { display: block; animation: popIn .12s; }
.menu a, .menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text);
  font: inherit; font-size: 13.5px; background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none !important; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
.menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu .head { padding: 8px 10px 6px; }
.menu .head .n { font-weight: 650; }
.menu .head .r { font-size: 12px; color: var(--muted); }

/* command palette */
.cmdk-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 28, .5); z-index: 100; display: flex; justify-content: center;
  padding-top: 12vh; animation: fadeIn .1s; backdrop-filter: blur(2px); }
.cmdk { width: min(640px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden; align-self: flex-start; animation: popIn .12s; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.cmdk-input svg { width: 18px; height: 18px; color: var(--muted); }
.cmdk-input input { border: 0; box-shadow: none !important; flex: 1; height: 54px; font-size: 15.5px; background: transparent; padding: 0; }
.cmdk-list { max-height: 60vh; overflow-y: auto; padding: 6px; }
.cmdk-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--faint); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--text); text-decoration: none !important; }
.cmdk-item .ty { font-size: 10.5px; font-weight: 700; color: var(--brand-600); background: var(--brand-50); border-radius: 5px; padding: 2px 6px; min-width: 64px; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.cmdk-item .tt { font-weight: 600; font-size: 13.5px; }
.cmdk-item .ss { font-size: 12px; color: var(--muted); margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.cmdk-item.active, .cmdk-item:hover { background: var(--surface-3); }
.cmdk-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }

/* empty states / skeletons */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ico { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.empty .ico svg { width: 26px; height: 26px; }
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.empty p { margin: 0 auto 14px; max-width: 420px; font-size: 13.5px; }
.skel { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite; border-radius: 6px; height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* key/value list */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 550; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* progress bars */
.bar { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand-500); border-radius: 999px; }
.bar.ok > span { background: var(--ok); }
.bar.warn > span { background: var(--accent); }
.bar.danger > span { background: var(--danger); }

/* stock level cell */
.stock { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.stock .q { font-weight: 700; font-variant-numeric: tabular-nums; }
.stock .q small { font-weight: 500; color: var(--muted); }

/* item thumbnail */
.thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--border); flex: none;
  display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.thumb svg { width: 18px; height: 18px; }
.thumb.lg { width: 100%; height: 220px; border-radius: 12px; }
.thumb.lg svg { width: 42px; height: 42px; }
.item-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }

/* pipeline (dashboard) */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.pipe { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); text-decoration: none !important; color: inherit; }
.pipe:hover { border-color: var(--brand-200); }
.pipe .n { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.pipe .l { font-size: 12px; color: var(--muted); line-height: 1.3; }
.pipe.zero .n { color: var(--faint); }

/* list rows (dashboard feeds) */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed .ft { font-weight: 600; font-size: 13.5px; }
.feed .fs { font-size: 12.5px; color: var(--muted); }
.feed .fr { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.feed a.ft { color: var(--text); }

/* permission matrix */
.matrix th.role { text-align: center; min-width: 96px; font-size: 11px; }
.matrix td.cell { text-align: center; }
.matrix tr.grp td { background: var(--surface-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.matrix .perm-name { font-weight: 600; }
.matrix .perm-desc { font-size: 12px; color: var(--muted); }
.matrix input:disabled { opacity: .55; }
.matrix .lock { color: var(--faint); font-size: 12px; }

/* login */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 20% 110%, rgba(245, 165, 36, .35), transparent 60%),
  linear-gradient(160deg, #0b1733 0%, #13306e 55%, #1f55c7 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; }
.auth-art .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; }
.auth-art .brand .logo { width: 44px; height: 44px; background: #fff; border-radius: 12px; display: grid; place-items: center; }
.auth-art .brand .logo img { width: 38px; }
.auth-art h1 { color: #fff; font-size: 34px; line-height: 1.15; margin: auto 0 14px; max-width: 460px; letter-spacing: -.02em; }
.auth-art p { color: rgba(255, 255, 255, .78); font-size: 15px; max-width: 440px; margin: 0 0 28px; }
.auth-art .feat { display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: rgba(255, 255, 255, .88); }
.auth-art .feat div { display: flex; gap: 10px; align-items: center; }
.auth-art .feat svg { width: 18px; height: 18px; color: var(--accent); }
.auth-art .sun { position: absolute; right: -120px; top: -120px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 165, 36, .55), rgba(245, 165, 36, 0) 65%); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 24px; margin: 0 0 4px; }
.auth-card .sub { color: var(--muted); margin: 0 0 24px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; height: 42px; margin-top: 6px; font-size: 14.5px; }
.auth-card .foot { margin-top: 26px; font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
@media (max-width: 860px) { .auth-page { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* public pages (order form / tracker) */
.public-top { background: linear-gradient(120deg, #0b1733, #1a45a0); color: #fff; }
.public-top .inner { max-width: 980px; margin: 0 auto; padding: 16px 20px; display: flex; align-items: center; gap: 12px; }
.public-top .logo { width: 38px; height: 38px; border-radius: 10px; background: #fff; display: grid; place-items: center; }
.public-top .logo img { width: 32px; }
.public-top .t1 { font-weight: 700; }
.public-top .t2 { font-size: 12px; opacity: .75; }
.public-top a { color: #fff; }
.public-wrap { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 0 40px; }

/* item detail */
.detail-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 760px) { .detail-hero { grid-template-columns: 1fr; } }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; }
.stat .l { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* planner */
.sup-group { margin-bottom: 18px; }
.sup-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.sup-head h3 { margin: 0; font-size: 14.5px; }
.qty-in { width: 96px; text-align: right; }
.why { font-size: 11.5px; color: var(--muted); }

/* serial pills */
.sn { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11.5px; background: var(--surface-3);
  border: 1px solid var(--border); padding: 1px 7px; border-radius: 6px; margin: 2px 4px 2px 0; }
.sn-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.sn-pick label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 9px;
  font-family: var(--mono); font-size: 12px; cursor: pointer; background: var(--surface); }
.sn-pick label:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); }

/* stock readiness panel on the order summary */
.readiness { border: 1px solid var(--border); border-radius: var(--radius-lg); margin: 16px 0; overflow: hidden; }
.readiness-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.readiness-head h3 { margin: 0; font-size: 14px; }

/* portal */
.portal-order { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.portal-order .po-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; flex-wrap: wrap; }
.portal-order .po-head h3 { margin: 0; font-size: 15.5px; }
.hstepper { display: flex; gap: 0; padding: 4px 18px 18px; overflow-x: auto; }
.hstep { flex: 1; min-width: 96px; position: relative; text-align: center; font-size: 11.5px; color: var(--muted); padding-top: 22px; }
.hstep::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--border); }
.hstep:first-child::before { left: 50%; }
.hstep:last-child::before { right: 50%; }
.hstep.done::before { background: var(--brand-500); }
.hstep .d { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--border-strong); }
.hstep.done .d { background: var(--brand-500); border-color: var(--brand-500); }
.hstep.current .d { border-color: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-100); }
.hstep.current, .hstep.done { color: var(--text); font-weight: 600; }

@media print {
  .sidebar, .topbar, .no-print, #toasts { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card, .panel { box-shadow: none; border-color: #ccc; }
}

/* move modal: fixed item */
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.mv-fixed { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.mv-fixed.hidden, .stack-sm.hidden { display: none; }
.table.lines-edit { table-layout: fixed; width: 100%; }
.table.lines-edit select, .table.lines-edit input { width: 100%; min-width: 0; max-width: 100%; }
.table.lines-edit td:last-child { text-align: right; }
.field-grid + .field-grid { margin-top: 14px; }
@media (max-width: 640px) {
  .toolbar > .input-icon { flex: 1 1 100% !important; min-width: 0 !important; }
  .toolbar > select { flex: 1 1 calc(50% - 4px); }
}

/* ---------- client price list builder ---------- */
#pl-sections .pl-sec { margin-bottom: 16px; }
.pl-sec-head { gap: 10px; }
.pl-sec-head .pl-sec-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; color: var(--text); border-color: transparent; background: transparent; padding-left: 6px; }
.pl-sec-head .pl-sec-title:hover { border-color: var(--border); }
.pl-sec-head .pl-sec-title:focus { border-color: var(--brand); background: var(--surface); }
.pl-sec-head .pl-move { display: inline-flex; gap: 2px; }
.pl-sec-body { padding-top: 10px; padding-bottom: 10px; }
.pl-sec-body .pl-sec-desc { width: 100%; font-style: italic; }
.pl-items textarea, .pl-items input[type=text] { width: 100%; min-width: 0; }
.pl-items textarea { resize: vertical; min-height: 38px; }
.pl-items td { vertical-align: top; }
.pl-items td:first-child { padding-top: 14px; }
.pl-items td.num { padding-top: 12px; white-space: nowrap; }
.pl-row-off td:not(:first-child) { opacity: .45; }
.pl-off .pl-sec-body, .pl-off .table-wrap { opacity: .45; }
.pl-noprice { color: var(--warn, #b45309); font-weight: 600; font-size: 12.5px; }
.pl-side { position: sticky; top: calc(var(--topbar-h, 60px) + 16px); }
@media (max-width: 1100px) { .pl-side { position: static; } }
@media (max-width: 720px) {
  .pl-items thead { display: none; }
  .pl-items tr { display: grid; grid-template-columns: 34px 1fr auto; gap: 6px 8px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
  .pl-items td { border: 0 !important; padding: 0 !important; }
  .pl-items td:nth-child(2) { grid-column: 2; grid-row: 1; }
  .pl-items td:nth-child(4) { grid-column: 3; grid-row: 1; }
  .pl-items td:nth-child(3) { grid-column: 2 / 4; grid-row: 2; }
  .pl-sec-head { flex-wrap: wrap; }
  .pl-sec-head .pl-sec-title { flex-basis: calc(100% - 110px); }
  .pl-sec-head .pl-sec-count { order: 5; flex-basis: 100%; padding-left: 30px; }
}
