/* =========================================================
   CSKGlass — Static ASP.NET MVC / Razor-friendly stylesheet
   No frameworks required. Bootstrap optional.
   ========================================================= */

:root {
  /* Cool slate neutrals */
  --bg: #f4f6f9;
  --bg-elev: #ffffff;
  --bg-muted: #eef2f6;
  --bg-sunken: #e9eef4;
  --line: #e3e8ef;
  --line-strong: #d2dae3;
  --line-soft: #edf1f6;

  /* Ink */
  --ink-1: #0b1726;
  --ink-2: #324155;
  --ink-3: #5b6a80;
  --ink-4: #8593a8;
  --ink-5: #aab5c5;

  /* Brand — deep navy + cyan accent (glass industry) */
  --brand: #0e2747;
  --brand-700: #103766;
  --brand-600: #1b4e88;
  --accent: #0aa2c0;
  --accent-600: #0892ad;
  --accent-50: #e3f6fa;

  /* Sidebar */
  --side: #0b1f3a;
  --side-2: #0e2747;
  --side-line: #1a3257;
  --side-ink: #cdd8e8;
  --side-ink-dim: #7a8bab;

  /* Status — orders */
  --st-new-bg: #eef3ff;       --st-new-fg: #2949a5;
  --st-conf-bg: #e7f1ff;      --st-conf-fg: #1e478e;
  --st-prod-bg: #fff2e0;      --st-prod-fg: #8a4a06;
  --st-ready-bg: #e5f8ee;     --st-ready-fg: #115d3a;
  --st-deliv-bg: #e8f4ff;     --st-deliv-fg: #0e4f88;
  --st-cancel-bg: #f3e9eb;    --st-cancel-fg: #8b2a35;

  /* Station accents */
  --stn-cut:    #b88200;   --stn-cut-bg: #fbf3df;
  --stn-tgh:    #c25a00;   --stn-tgh-bg: #fdebdc;
  --stn-spacer: #4a5b73;   --stn-spacer-bg: #e5eaf1;
  --stn-lam:    #b0376a;   --stn-lam-bg: #fbe3ec;
  --stn-dgu:    #6b3fb0;   --stn-dgu-bg: #ece2fb;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-1: 0 1px 0 rgba(11,23,38,0.04), 0 1px 2px rgba(11,23,38,0.05);
  --shadow-2: 0 1px 0 rgba(11,23,38,0.04), 0 6px 18px -8px rgba(11,23,38,0.15);
  --shadow-pop: 0 10px 30px -10px rgba(11,23,38,0.30), 0 2px 8px rgba(11,23,38,0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mono { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-feature-settings: "tnum"; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-50); color: var(--brand); }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}
.app.is-login { display: block; }

/* Sidebar */
.sidebar {
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #06152a;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--side-line);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(135deg, #16e0ff 0%, #0aa2c0 45%, #155da3 100%);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 4px 10px rgba(10,162,192,0.25);
  flex-shrink: 0;
}
.brand-mark::before {
  content: ""; position: absolute; inset: 0; border-radius: 7px;
  background:
    linear-gradient(135deg, transparent 38%, rgba(255,255,255,0.55) 39%, rgba(255,255,255,0.55) 41%, transparent 42%),
    linear-gradient(135deg, transparent 62%, rgba(255,255,255,0.32) 63%, rgba(255,255,255,0.32) 64%, transparent 65%);
}
.brand-symbol {
  width: 38px;
  height: 38px;
  padding: 4px;
  border-radius: 9px;
  background: #fff;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.brand-name { font-weight: 600; letter-spacing: 0.2px; color: #fff; font-size: 14px; }
.brand-sub { font-size: 9px; color: var(--side-ink-dim); letter-spacing: 0.45px; text-transform: uppercase; white-space: nowrap; }

.nav { padding: 8px 8px 4px; flex: 1; overflow-y: auto; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #20365a; border-radius: 6px; }
.nav-section {
  color: var(--side-ink-dim);
  font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 1px 0;
  border-radius: 6px;
  color: var(--side-ink);
  font-size: 13px;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: #102a4b; color: #fff; }
.nav-item.active { background: #133560; color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px;
  width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-item .ico { width: 16px; height: 16px; flex-shrink: 0; color: #8aa0c4; }
.nav-item.active .ico, .nav-item:hover .ico { color: #fff; }
.nav-item .chev { margin-left: auto; opacity: 0.5; transition: transform 0.15s; }
.nav-item.is-open .chev { transform: rotate(180deg); }
.nav-item .nav-badge {
  margin-left: auto;
  background: #1a3257; color: #cfe6ff;
  font-size: 10px; padding: 2px 6px; border-radius: 999px;
  font-weight: 600;
}
.nav-sub { padding-left: 30px; padding-right: 4px; display: none; }
.nav-group.is-open .nav-sub { display: block; }
.nav-sub .nav-item { padding: 5px 10px; font-size: 12.5px; color: #aabbd6; }
.nav-sub .nav-item.active { background: transparent; color: #fff; }
.nav-sub .nav-item.active::before { background: var(--accent); left: -22px; }

.side-user {
  border-top: 1px solid var(--side-line);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #0aa2c0, #155da3);
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.side-user .who { color: #fff; font-size: 12.5px; font-weight: 500; line-height: 1.1; }
.side-user .role { color: var(--side-ink-dim); font-size: 11px; }

/* ============ Main + topbar ============ */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 18px; height: 52px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 20;
}
.crumbs { color: var(--ink-3); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.crumbs .sep { color: var(--ink-5); display: inline-flex; }
.crumbs .cur { color: var(--ink-1); font-weight: 500; }
.crumbs a { color: var(--ink-3); cursor: pointer; }
.crumbs a:hover { color: var(--ink-1); }
.search {
  margin-left: auto; width: 320px; position: relative;
}
.search input {
  width: 100%; height: 32px;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px 0 30px;
  font-size: 12.5px;
  outline: none;
}
.search input:focus { background: #fff; border-color: var(--line-strong); }
.search .sico { position: absolute; left: 9px; top: 8px; color: var(--ink-4); }
.search kbd {
  position: absolute; right: 8px; top: 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px; color: var(--ink-3);
  background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px;
}
.top-icon-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--ink-2); position: relative;
}
.top-icon-btn:hover { background: var(--bg-muted); color: var(--ink-1); }
.top-icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
}
.lang {
  height: 32px; padding: 0 10px; border-radius: 6px;
  font-size: 12px; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px;
}
.lang:hover { background: var(--bg-muted); }

/* ============ Page ============ */
.page { flex: 1; overflow-y: auto; }
.page-inner { padding: 18px 24px 36px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.2px; color: var(--ink-1); margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink-3); font-size: 12px;
  margin-bottom: 6px;
  cursor: pointer;
}
.back-link:hover { color: var(--ink-1); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: 6px;
  font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-1);
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s;
}
.btn:hover { background: var(--bg-muted); }
.btn:disabled, .btn.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn .ico { width: 14px; height: 14px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--ink-1); }
.btn-danger { color: #a31f31; border-color: #efd3d8; background: #fff; }
.btn-danger:hover { background: #fbeef0; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 5px; }
.btn-xs { height: 24px; padding: 0 7px; font-size: 11.5px; border-radius: 4px; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 28px; }
.btn-icon.btn-xs { width: 24px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ============ Cards ============ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px;
}
.card-title { font-weight: 600; font-size: 13.5px; color: var(--ink-1); }
.card-sub { color: var(--ink-3); font-size: 12px; }
.card-body { padding: 14px 16px; }

/* ============ KPI ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kpi-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.kpi {
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-1);
}
.kpi-label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 600; color: var(--ink-1); margin-top: 4px; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: 11.5px; margin-top: 2px; display: inline-flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: #137a48; }
.kpi-delta.down { color: #a31f31; }
.kpi-icon {
  position: absolute; right: 12px; top: 12px;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-50); color: var(--accent-600);
  display: grid; place-items: center;
}
.kpi.tone-amber .kpi-icon  { background: #fdf2dc; color: #b88200; }
.kpi.tone-orange .kpi-icon { background: #fde6d4; color: #c25a00; }
.kpi.tone-green .kpi-icon  { background: #def5e8; color: #137a48; }
.kpi.tone-blue .kpi-icon   { background: #def0fb; color: #1f80d1; }
.kpi.tone-rose .kpi-icon   { background: #fbe1ea; color: #b0376a; }
.kpi.tone-slate .kpi-icon  { background: #e5eaf1; color: #4a5b73; }
.kpi.tone-violet .kpi-icon { background: #ece2fb; color: #6b3fb0; }

/* ============ Table ============ */
.tbl-wrap {
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.tbl-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fcfdfe;
  flex-wrap: wrap;
}
.tbl-toolbar .grow { flex: 1; }
.tbl-search {
  position: relative; width: 260px;
}
.tbl-search input {
  width: 100%; height: 30px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 6px;
  padding: 0 8px 0 28px;
  font-size: 12px;
  outline: none;
}
.tbl-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.tbl-search .sico { position: absolute; left: 8px; top: 7px; color: var(--ink-4); }

.tbl-scroll { overflow: auto; max-height: calc(100vh - 280px); }
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  white-space: nowrap;
}
.tbl thead th {
  position: sticky; top: 0;
  background: #f7f9fc;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.tbl thead th.sortable { cursor: pointer; user-select: none; }
.tbl thead th.sortable:hover { color: var(--ink-1); background: #f1f4f8; }
.tbl thead th .sortmark { color: var(--ink-5); margin-left: 4px; font-size: 10px; }
.tbl thead th.is-sorted .sortmark { color: var(--accent); }
.tbl tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-1);
  vertical-align: middle;
}
.tbl tbody tr:hover td { background: #f7fafc; }
.tbl tbody tr.is-selected td { background: #ecf6fb; }
.tbl tbody tr.is-selected:hover td { background: #e0f1f7; }
.tbl td.num, .tbl th.num { text-align: right; font-family: "IBM Plex Mono", monospace; font-feature-settings: "tnum"; }
.tbl td.actions, .tbl th.actions { text-align: right; padding-right: 10px; }
.tbl td.muted { color: var(--ink-3); }
.tbl .cell-check { width: 28px; padding-left: 12px; padding-right: 4px; }
.tbl .cell-id { font-family: "IBM Plex Mono", monospace; color: var(--ink-2); font-size: 11.5px; }
.tbl.compact tbody td { padding: 5px 10px; }
.tbl.is-clickable tbody tr { cursor: pointer; }

.tbl-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: #fcfdfe;
  display: flex; align-items: center; gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.pager { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.pager .pg {
  min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 5px; font-size: 12px;
  display: grid; place-items: center;
  color: var(--ink-2);
}
.pager .pg:hover { background: var(--bg-muted); color: var(--ink-1); }
.pager .pg.active { background: var(--brand); color: #fff; }

/* ============ Badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-muted); color: var(--ink-2);
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-new        { background: var(--st-new-bg);    color: var(--st-new-fg); }
.badge-confirmed  { background: var(--st-conf-bg);   color: var(--st-conf-fg); }
.badge-production { background: var(--st-prod-bg);   color: var(--st-prod-fg); }
.badge-ready      { background: var(--st-ready-bg);  color: var(--st-ready-fg); }
.badge-delivered  { background: var(--st-deliv-bg);  color: var(--st-deliv-fg); }
.badge-cancelled  { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }
.badge-waiting    { background: #eef2f6; color: #4a5b73; }
.badge-inprogress { background: #fff2e0; color: #8a4a06; }
.badge-done       { background: #e5f8ee; color: #115d3a; }
.badge-archived   { background: #ecedf0; color: #6b7488; }
.badge-draft      { background: #eef2f6; color: #4a5b73; }
.badge-issued     { background: var(--st-conf-bg);  color: var(--st-conf-fg); }
.badge-paid       { background: var(--st-ready-bg); color: var(--st-ready-fg); }
.badge-overdue    { background: var(--st-cancel-bg);color: var(--st-cancel-fg); }

.chk-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px;
}
.chk-cell.yes { background: #e5f8ee; color: #137a48; }
.chk-cell.no  { background: #f4f6f9; color: var(--ink-5); }
.chk-cell.no::before { content: ""; width: 8px; height: 1px; background: currentColor; }

/* ============ Inputs ============ */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .lbl {
  font-size: 11.5px; color: var(--ink-3); font-weight: 500;
}
.field > label.req::after, .lbl.req::after { content: " *"; color: #c63d4f; }
.input, .select, .textarea {
  height: 34px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--ink-1);
  outline: none;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-50);
}
.textarea { height: auto; padding: 9px 10px; resize: vertical; min-height: 70px; font-family: inherit; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.input-grp { position: relative; }
.input-grp .suffix {
  position: absolute; right: 10px; top: 0; bottom: 0;
  display: flex; align-items: center;
  color: var(--ink-4); font-size: 11.5px;
  pointer-events: none;
}
.input-grp .input { padding-right: 38px; }

/* Searchable dropdown: search lives inside the opened menu. */
.searchable-select { position: relative; }
.searchable-select.is-open { z-index: 70; }
.form-section.has-open-select { position: relative; z-index: 70; }
.searchable-select-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  text-align: left; cursor: pointer; color: var(--ink-1);
}
.searchable-select-trigger.is-invalid { border-color: #c63d4f; }
.searchable-select-chevron { color: var(--ink-3); font-size: 16px; line-height: 1; transition: transform .15s; }
.searchable-select-trigger[aria-expanded="true"] .searchable-select-chevron { transform: rotate(180deg); }
.searchable-select-input {
  width: 100%; margin-bottom: 4px;
}
.searchable-select-menu {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
  padding: 5px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: #fff; box-shadow: 0 10px 28px rgba(24, 45, 75, .16);
}
.searchable-select-options { max-height: 190px; overflow-y: auto; overscroll-behavior: contain; }
.searchable-select-option {
  display: block; width: 100%; border: 0; border-radius: 5px;
  background: transparent; color: var(--ink-1); text-align: left;
  padding: 8px 9px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.searchable-select-option:hover, .searchable-select-option.is-active { background: var(--accent-50); color: var(--brand); }
.searchable-select-empty { padding: 10px 9px; color: var(--ink-4); font-size: 12.5px; }

/* Switch */
.switch {
  position: relative;
  width: 32px; height: 18px;
  background: var(--line-strong); border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  display: inline-block;
}
.switch::after {
  content: ""; position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.switch.is-on { background: var(--accent); }
.switch.is-on::after { transform: translateX(14px); }
.switch.is-disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.switch-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; padding: 6px 0; cursor: pointer; user-select: none;
}
.switch-row .lbl-inline { color: var(--ink-1); font-weight: 500; }
.switch-row .lbl-inline-sub { color: var(--ink-3); font-size: 11.5px; }

/* Check */
.check {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; font-size: 12.5px; color: var(--ink-2);
  user-select: none;
}
.check .box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  display: grid; place-items: center;
  background: #fff;
  flex-shrink: 0;
}
.check .box svg { display: none; width: 12px; height: 12px; color: #fff; }
.check.is-on .box { background: var(--accent); border-color: var(--accent); }
.check.is-on .box svg { display: block; }

/* Form sections */
.form-section { background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-1); }
.fs-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.fs-num {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
}
.fs-title { font-weight: 600; font-size: 13px; }
.fs-sub { color: var(--ink-3); font-size: 12px; margin-left: auto; }
.fs-body { padding: 14px 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 14px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink-1); }
.tab.active { color: var(--brand); border-bottom-color: var(--accent); }
.tab .count {
  margin-left: 6px;
  background: var(--bg-muted); color: var(--ink-3);
  font-size: 11px; padding: 1px 6px; border-radius: 999px;
  font-weight: 600;
}
.tab.active .count { background: var(--accent-50); color: var(--accent-600); }

/* ============ Modal & Drawer ============ */
.scrim {
  position: fixed; inset: 0;
  background: rgba(11,31,58,0.45);
  display: grid; place-items: center;
  z-index: 100; padding: 24px;
}
[hidden] { display: none !important; }
.modal {
  width: 100%; max-width: 460px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 30px 80px -20px rgba(11,31,58,0.6);
  overflow: hidden;
}
.modal .m-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal .m-title { font-size: 15px; font-weight: 600; }
.modal .m-body { padding: 16px 18px; color: var(--ink-2); font-size: 13px; }
.modal .m-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: #fcfdfe; }

.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(11,31,58,0.4); z-index: 90;
}
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 720px; max-width: 100vw;
  background: #fff;
  box-shadow: -10px 0 40px rgba(11,31,58,0.2);
  z-index: 91;
  display: flex; flex-direction: column;
}
.drawer.size-sm { width: 480px; }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-head .d-title { font-weight: 600; font-size: 14px; }
.drawer-head .d-sub { color: var(--ink-3); font-size: 11.5px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }

/* ============ Dropdowns ============ */
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow-pop);
  min-width: 200px; padding: 4px;
  z-index: 30;
}
.dm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 12.5px; color: var(--ink-1);
  cursor: pointer;
  white-space: nowrap;
}
.dm-item:hover { background: var(--bg-muted); }
.dm-item.danger { color: #a31f31; }
.dm-item.danger:hover { background: #fbeef0; }
.dm-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ============ Toast ============ */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast {
  background: #0b1f3a; color: #fff;
  padding: 10px 14px; border-radius: 8px;
  font-size: 12.5px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 16px 40px -10px rgba(11,31,58,0.5);
  min-width: 240px;
  animation: toastIn 0.18s ease-out;
}
.toast.success { background: #115d3a; }
.toast.error   { background: #a31f31; }
@keyframes toastIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ============ Misc helpers ============ */
.row-flex { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.divider-v { width: 1px; height: 18px; background: var(--line); align-self: center; }
.muted { color: var(--ink-3); }
.tiny { font-size: 11.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: #fff; border: 1px dashed var(--line-strong);
  color: var(--ink-2);
}
.chip.active { background: var(--accent-50); border-color: var(--accent); color: var(--brand); border-style: solid; }
.chip .x { color: var(--ink-4); cursor: pointer; display: inline-flex; }
.chip:hover { background: var(--bg-muted); }

/* ============ Station header ============ */
.station-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  color: #fff;
  background: var(--brand);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.station-head::before {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.station-head .st-ico {
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(255,255,255,0.16);
  display: grid; place-items: center;
}
.station-head .st-title { font-size: 18px; font-weight: 600; letter-spacing: -0.2px; }
.station-head .st-sub { font-size: 12.5px; opacity: 0.8; }
.station-head .st-stats { margin-left: auto; display: flex; gap: 24px; position: relative; z-index: 1; }
.station-head .st-stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.station-head .st-stat .l { font-size: 11px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.5px; }
.stn-cut    > .station-head { background: linear-gradient(120deg, #8a6300, #b88200); }
.stn-tgh    > .station-head { background: linear-gradient(120deg, #944300, #c25a00); }
.stn-spacer > .station-head { background: linear-gradient(120deg, #2c3950, #4a5b73); }
.stn-lam    > .station-head { background: linear-gradient(120deg, #802550, #b0376a); }
.stn-dgu    > .station-head { background: linear-gradient(120deg, #4a2b85, #6b3fb0); }

/* progress */
.progress {
  position: relative;
  height: 6px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden;
  min-width: 80px;
}
.progress .bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; }
.progress.amber  .bar { background: #b88200; }
.progress.orange .bar { background: #c25a00; }
.progress.slate  .bar { background: #4a5b73; }
.progress.rose   .bar { background: #b0376a; }
.progress.violet .bar { background: #6b3fb0; }
.progress.green  .bar { background: #137a48; }

/* summary panel */
.summary-card {
  background: linear-gradient(135deg, #fff, #f7fafc);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
  margin-bottom: 14px;
  position: relative;
}
.summary-card::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.summary-card.cols-3 { grid-template-columns: repeat(3, 1fr); }
.summary-card.cols-4 { grid-template-columns: repeat(4, 1fr); }
.summary-card .s-it .l { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.5px; }
.summary-card .s-it .v { font-size: 14px; font-weight: 600; color: var(--ink-1); margin-top: 2px; }
.summary-card .s-it .v.mono { font-family: "IBM Plex Mono", monospace; font-size: 13px; }

/* empty */
.empty { padding: 36px 24px; text-align: center; color: var(--ink-3); }
.empty .e-ico {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--bg-muted); color: var(--ink-4);
  display: inline-grid; place-items: center;
  margin-bottom: 10px;
}
.empty h4 { color: var(--ink-1); margin: 0 0 4px; font-weight: 600; }

/* report cards */
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.report-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.15s, transform 0.15s;
}
.report-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.report-card .rc-ico {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--accent-50); color: var(--accent-600);
  display: grid; place-items: center;
}
.report-card.tone-amber  .rc-ico { background: #fdf2dc; color: #b88200; }
.report-card.tone-rose   .rc-ico { background: #fbe1ea; color: #b0376a; }
.report-card.tone-violet .rc-ico { background: #ece2fb; color: #6b3fb0; }
.report-card.tone-slate  .rc-ico { background: #e5eaf1; color: #4a5b73; }
.report-card.tone-green  .rc-ico { background: #def5e8; color: #137a48; }
.report-card h4 { margin: 0; font-size: 14px; font-weight: 600; }
.report-card p { margin: 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.report-card .rc-foot { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }

/* ============ Login ============ */
.login {
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 80% 10%, rgba(10,162,192,0.18), transparent 60%),
    radial-gradient(700px 500px at 10% 90%, rgba(21,93,163,0.18), transparent 60%),
    linear-gradient(180deg, #0b1f3a 0%, #0e2747 100%);
  display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-art {
  position: relative; overflow: hidden; color: #fff;
  padding: 48px 56px;
  display: flex; flex-direction: column;
}
.login-brand {
  width: 158px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(0,0,0,0.24);
  position: relative;
  z-index: 1;
}
.login-brand img { display: block; width: 100%; height: auto; }
.login-art .pitch { margin-top: auto; max-width: 460px; }
.login-art h1 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 500;
  font-size: 38px; line-height: 1.15;
  letter-spacing: -0.5px;
  color: #fff;
  margin: 0 0 14px;
}
.login-art h1 em { color: #5eddf0; font-style: normal; }
.login-art p { color: #a7b8d4; font-size: 14px; max-width: 380px; }
.login-art .stats { display: flex; gap: 32px; margin-top: 24px; }
.login-art .stat .v { font-size: 22px; font-weight: 600; color: #fff; }
.login-art .stat .l { font-size: 11px; color: #7a8bab; text-transform: uppercase; letter-spacing: 0.6px; }
.glassart { position: absolute; right: -60px; top: 80px; width: 520px; height: 380px; pointer-events: none; opacity: 0.7; }
.glassart .pane {
  position: absolute; border-radius: 6px;
  background: linear-gradient(135deg, rgba(94,221,240,0.15), rgba(21,93,163,0.05));
  border: 1px solid rgba(94,221,240,0.25);
  box-shadow: inset 0 0 60px rgba(94,221,240,0.08);
}
.glassart .pane::after {
  content: ""; position: absolute; inset: 0; border-radius: 6px;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
}
.glassart .p1 { left: 40px;  top: 30px; width: 220px; height: 280px; transform: rotate(-6deg); }
.glassart .p2 { left: 180px; top: 70px; width: 240px; height: 240px; transform: rotate(4deg);  }
.glassart .p3 { left: 290px; top: 30px; width: 180px; height: 320px; transform: rotate(-2deg); }
.login-form-wrap { background: #f4f6f9; display: grid; place-items: center; padding: 32px; }
.login-card {
  width: 100%; max-width: 400px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 32px 32px 24px;
  box-shadow: 0 30px 60px -20px rgba(11,31,58,0.25);
}
.login-card h2 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-card .lc-sub { color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 12px; }
.login-card .row { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 18px; font-size: 12.5px; }
.login-card .row a { color: var(--accent-600); font-weight: 500; cursor: pointer; }
.login-card .btn { width: 100%; height: 38px; justify-content: center; font-size: 13.5px; }
.login-card .ver { text-align: center; color: var(--ink-4); font-size: 11px; margin-top: 18px; font-family: "IBM Plex Mono", monospace; }

/* ============ Print paper preview ============ */
.print-paper {
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 36px 40px;
  box-shadow: var(--shadow-2);
  color: #111;
}
.print-paper .pp-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding-bottom: 18px;
  border-bottom: 2px solid #0b1f3a;
}
.print-paper .pp-meta {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 16px; padding: 16px 0;
  border-bottom: 1px solid #eee;
}
.print-paper .pp-meta .l {
  font-size: 10px; color: #999;
  text-transform: uppercase; letter-spacing: 0.6px;
}
.print-paper .pp-tbl { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 12px; }
.print-paper .pp-tbl th {
  text-align: left; padding: 8px 6px; font-size: 10px;
  color: #666; text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid #0b1f3a;
}
.print-paper .pp-tbl td { padding: 8px 6px; border-bottom: 1px solid #f0f0f0; }
.print-paper .pp-tbl .num { text-align: right; }
.print-paper .pp-sign {
  margin-top: 28px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px;
  font-size: 10px;
}
.print-paper .pp-sign .line { border-bottom: 1px solid #333; padding-bottom: 20px; }

/* ============ Page section visibility ============ */
.page-section { display: none; }
.page-section.is-active { display: block; }
.has-login .app:not(.is-login) { display: none; }

/* ============ Responsive ============ */

/* Hamburger toggle + off-canvas backdrop — hidden on desktop */
.nav-toggle-btn { display: none; }
.nav-backdrop   { display: none; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .summary-card { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .search { width: 220px; }
}

/* Tablet & phone: collapse the app shell to a single column and turn the
   sidebar into a full off-canvas drawer (preserving ALL nav text and
   sub-menus — workstation screens must stay reachable on tablets). */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }

  .nav-toggle-btn { display: inline-flex; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 268px;
    max-width: 84vw;
    z-index: 110;
    transform: translateX(-100%);
    transition: transform 0.18s ease-out;
    box-shadow: 12px 0 40px rgba(11,31,58,0.3);
  }
  .app.nav-open .sidebar { transform: translateX(0); }

  .nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(11,31,58,0.45);
    z-index: 105;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
  }
  .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  /* The global search collapses into the off-canvas nav's territory —
     hide it from the topbar on narrow screens to avoid crowding. */
  .search { display: none; }

  /* Crumbs absorb the freed space so the bell/profile stay pinned right
     now that .search no longer carries margin-left:auto. */
  .crumbs { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 780px) {
  .page-inner { padding: 16px 16px 32px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }

  .kpi-grid, .kpi-grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .summary-card, .summary-card.cols-3, .summary-card.cols-4 { grid-template-columns: 1fr 1fr; }
  .report-grid { grid-template-columns: 1fr; }

  .station-head { flex-wrap: wrap; row-gap: 12px; }
  .station-head .st-stats { margin-left: 0; width: 100%; justify-content: space-between; gap: 14px; }

  .drawer { width: 100vw; }
  .tbl-search { width: 100%; }
  .tbl-toolbar { flex-wrap: wrap; }
}

@media (max-width: 540px) {
  .kpi-grid, .kpi-grid.cols-4 { grid-template-columns: 1fr; }
  .summary-card, .summary-card.cols-3, .summary-card.cols-4 { grid-template-columns: 1fr; }

  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form-wrap { padding: 20px 14px; }
  .login-card { padding: 24px 20px 18px; max-width: 100%; }

  .page-title { font-size: 19px; }
}

@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .lang span { display: none; }
}

/* Print */
@media print {
  .sidebar, .topbar, .page-actions, .page-head .back-link, .nav-backdrop { display: none !important; }
  .app { display: block; }
  .page { overflow: visible; }
}
