/* Wenze Transport Services - Safety & Compliance dashboard.
   Brand: deep navy and signal red, on a light working surface. Dense enough
   for a dispatch desk, calm enough to read all day. No external fonts: the
   CSP allows only same-origin styles and fonts. */

:root {
  --navy: #1c2a4f;
  --navy-2: #24365f;
  --navy-3: #2f4474;
  --navy-soft: #e9edf6;
  --red: #e5322d;
  --red-strong: #c4211d;
  --red-soft: #fdecec;

  --accent: #2456c8;
  --accent-soft: #eaf0fd;
  --accent-strong: #1a43a3;

  --good: #14884a;
  --good-soft: #e6f6ec;
  --warn: #d47b06;
  --warn-soft: #fff3df;
  --bad: #d12b26;
  --bad-soft: #fdeceb;

  --ink: #10192e;
  --ink-2: #2f3b55;
  --ink-3: #64708a;
  --ink-4: #98a2b8;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e2e7ef;
  --line-strong: #c9d2df;

  --radius: 12px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 25, 46, .05), 0 2px 8px rgba(16, 25, 46, .05);
  --shadow-lg: 0 8px 28px rgba(16, 25, 46, .14);

  --sidebar-w: 236px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

/* The HTML `hidden` attribute must win over any display rule below. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }

a { color: var(--accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* --------------------------------------------------------------- layout */

.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--navy) 0%, #172242 100%);
  color: #dbe2f2;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 18px; }
.brand-logo { width: 44px; height: 44px; border-radius: 10px; background: #fff; padding: 3px; flex: 0 0 auto; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-text { font-weight: 700; font-size: 14px; color: #fff; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; color: #9fb0d4; text-transform: uppercase; letter-spacing: .09em; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #7f92bb;
  padding: 14px 10px 6px;
}
.nav-group:first-child { padding-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: #c8d2ea;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}
.nav-icon { width: 16px; text-align: center; color: #8ea3d1; font-size: 12px; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.is-active { background: rgba(255, 255, 255, .13); color: #fff; }
.nav-item.is-active .nav-icon { color: #fff; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; gap: 10px; }

.company-card { display: flex; flex-direction: column; padding: 0 6px; gap: 1px; }
.company-name { font-size: 12px; color: #dbe2f2; font-weight: 600; }
.company-line { font-size: 11.5px; color: #8ea3d1; font-family: var(--mono); }

.who { display: flex; flex-direction: column; padding: 0 6px; }
.who-name { font-weight: 600; font-size: 13px; color: #fff; }
.who-role { color: #8ea3d1; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }

.sidebar .btn-quiet { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); color: #e6ecf8; }
.sidebar .btn-quiet:hover { background: rgba(255, 255, 255, .12); }

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

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.page-title { flex: 0 0 auto; }
.page-sub { font-size: 12px; color: var(--ink-3); }

.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.menu-btn { display: none; }

.content { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.page-foot {
  margin-top: auto;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------- controls */

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }

.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }

.btn-quiet { border-color: var(--line); color: var(--ink-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 9px; font-size: 12px; }

.btn-link { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 4px; text-decoration: underline; }

.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); width: 32px; height: 32px; cursor: pointer; font-size: 15px; line-height: 1; }

.chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  padding: 5px 11px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.period-picker { display: inline-flex; }
.period-picker .chip:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.period-picker .chip:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.period-picker .chip + .chip { border-left: 0; }
.chip.is-active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }

.custom-range { display: inline-flex; align-items: center; gap: 6px; }

input[type="text"], input[type="password"], input[type="date"], input[type="email"],
input[type="number"], input[type="search"], select, textarea {
  font: inherit;
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
}
input:disabled, select:disabled { background: #f1f5f9; color: var(--ink-3); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-hint { margin: 0; font-size: 12px; color: var(--ink-3); }

.form-error { background: var(--bad-soft); border: 1px solid #f6c9c6; color: #991b1b; border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13px; margin: 0 0 14px; }

/* --------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin-right: auto; }
.card-sub { color: var(--ink-3); font-size: 12.5px; }
.card-accent { border-top: 3px solid var(--navy); }
.card-alert { border-top: 3px solid var(--red); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-hero { grid-template-columns: minmax(280px, 360px) 1fr; }
.grid-wide { grid-template-columns: 2fr 1fr; }

/* --------------------------------------------------------------- score hero */

.score-hero { display: flex; flex-direction: column; gap: 14px; }
.score-main { display: flex; align-items: baseline; gap: 12px; }
.score-value { font-size: 48px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; color: var(--navy); }

.grade-badge { display: inline-grid; place-items: center; min-width: 44px; padding: 5px 10px; border-radius: 8px; font-size: 19px; font-weight: 700; }
.grade-a { background: var(--good-soft); color: #0f6b3a; }
.grade-b { background: var(--accent-soft); color: var(--accent-strong); }
.grade-c { background: var(--warn-soft); color: #a45a05; }
.grade-d, .grade-f { background: var(--bad-soft); color: #a61f1b; }
.grade-na { background: #f1f5f9; color: var(--ink-3); }

.trend { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trend-up { color: var(--good); }
.trend-down { color: var(--bad); }
.trend-flat, .trend-unknown { color: var(--ink-3); }

.bar-row { display: flex; flex-direction: column; gap: 5px; }
.bar-label { display: flex; font-size: 12.5px; color: var(--ink-2); }
.bar-label span:last-child { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-track { height: 8px; background: #edf1f7; border-radius: 999px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bar-fill.is-good { background: var(--good); }
.bar-fill.is-warn { background: var(--warn); }
.bar-fill.is-bad { background: var(--bad); }
.bar-fill.is-none { background: var(--line-strong); }

/* --------------------------------------------------------------- KPI tiles */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.metric { background: var(--surface); padding: 12px 14px; }
.metric-label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; color: var(--navy); }
.metric-note { font-size: 11.5px; color: var(--ink-4); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi-label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--navy); line-height: 1.1; }
.kpi-value.is-bad { color: var(--bad); }
.kpi-value.is-good { color: var(--good); }
.kpi-value.is-warn { color: var(--warn); }
.kpi-note { font-size: 12px; color: var(--ink-3); }
.kpi-spark { height: 34px; margin-top: 4px; }

/* --------------------------------------------------------------- status */

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-alert { background: var(--bad-soft); color: #a61f1b; }
.status-watch { background: var(--warn-soft); color: #a45a05; }
.status-ok { background: var(--good-soft); color: #0f6b3a; }
.status-not-public, .status-no-data { background: #eef1f6; color: var(--ink-3); }

/* --------------------------------------------------------------- BASIC cards */

.basic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }

.basic-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  position: relative;
  min-width: 0;
}
.basic-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.basic-card.is-alert { border-color: #f1b8b5; background: linear-gradient(180deg, #fff6f5 0%, #fff 60%); }
.basic-card.is-watch { border-color: #f3d9a8; }
.basic-card.is-open { outline: 2px solid var(--navy); outline-offset: -1px; }

.basic-card-head { display: flex; align-items: flex-start; gap: 8px; }
.basic-card-title { font-size: 13px; font-weight: 650; color: var(--ink); flex: 1; }
.basic-card-value { display: flex; align-items: baseline; gap: 6px; }
.basic-card-pct { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; color: var(--navy); letter-spacing: -0.02em; }
.basic-card.is-alert .basic-card-pct { color: var(--bad); }
.basic-card-unit { font-size: 12px; color: var(--ink-3); }
.basic-card-meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.basic-card-meta b { color: var(--ink-2); font-weight: 600; }

/* Percentile gauge with the intervention threshold marked. */
.gauge { position: relative; height: 10px; background: #edf1f7; border-radius: 999px; }
.gauge-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--good); }
.gauge-fill.is-watch { background: var(--warn); }
.gauge-fill.is-alert { background: var(--bad); }
.gauge-threshold { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--navy); border-radius: 1px; }
.gauge-threshold::after { content: attr(data-label); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--ink-3); white-space: nowrap; margin-top: 1px; }
.gauge-wrap { padding-bottom: 12px; }

/* --------------------------------------------------------------- priority list */

.priority-list { display: flex; flex-direction: column; gap: 10px; }
.priority {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 12px;
  padding: 10px 12px 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.priority-bar { background: var(--ink-4); }
.priority-alert .priority-bar { background: var(--red); }
.priority-watch .priority-bar { background: var(--warn); }
.priority-info .priority-bar { background: var(--accent); }
.priority-title { font-weight: 650; font-size: 13px; margin-bottom: 2px; }
.priority-text { font-size: 12.5px; color: var(--ink-2); }

/* --------------------------------------------------------------- timeline */

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 112px 14px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f4f8; align-items: start; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-when { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--ink-4); }
.timeline-up .timeline-dot { background: var(--bad); }
.timeline-down .timeline-dot { background: var(--good); }
.timeline-new .timeline-dot { background: var(--accent); }
.timeline-text { font-size: 12.5px; color: var(--ink-2); }
.timeline-text .tag { margin-right: 6px; }

/* --------------------------------------------------------------- tables */

.table-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap.is-full { max-height: none; overflow: visible; }
.table-wrap.is-full thead th { position: static; }
.codes { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }

thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11.5px; font-weight: 650; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 12px; white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--ink); }
thead th .sort-caret { color: var(--accent); margin-left: 3px; }

tbody td { padding: 8px 12px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.is-clickable { cursor: pointer; }

.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--ink-3); }

.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef1f6; color: var(--ink-2); }
.pill-good { background: var(--good-soft); color: #0f6b3a; }
.pill-warn { background: var(--warn-soft); color: #a45a05; }
.pill-bad { background: var(--bad-soft); color: #a61f1b; }
.pill-info { background: var(--accent-soft); color: var(--accent-strong); }
.pill-navy { background: var(--navy-soft); color: var(--navy); }

.rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--navy-soft); color: var(--navy); font-size: 11.5px; font-weight: 700; }
.rank-1 { background: var(--red); color: #fff; }
.rank-2 { background: #f0a09c; color: #7a1512; }
.rank-3 { background: #f7cfcd; color: #7a1512; }

/* Inline bar inside a table cell. */
.cell-bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.cell-bar-track { flex: 1; height: 6px; background: #edf1f7; border-radius: 999px; overflow: hidden; }
.cell-bar-fill { height: 100%; background: var(--navy); border-radius: 999px; }
.cell-bar-fill.is-bad { background: var(--bad); }
.cell-bar-fill.is-warn { background: var(--warn); }
.cell-bar-value { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; min-width: 44px; text-align: right; }

/* Heat cells for the behaviour matrix. */
.heat { display: inline-grid; place-items: center; min-width: 30px; height: 24px; border-radius: 5px; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.heat-0 { color: var(--ink-4); }
.heat-1 { background: #fde8e7; color: #7a1512; }
.heat-2 { background: #f9c4c1; color: #7a1512; }
.heat-3 { background: #f19a95; color: #fff; }
.heat-4 { background: var(--red); color: #fff; font-weight: 700; }

.table-foot { display: flex; align-items: center; gap: 10px; padding: 10px 2px 0; font-size: 12.5px; color: var(--ink-3); }
.table-foot .spacer { margin-left: auto; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { margin-left: auto; }

/* --------------------------------------------------------------- basics (legacy list) */

.basic-list { display: flex; flex-direction: column; gap: 11px; }
.basic-row { display: grid; grid-template-columns: 1fr; gap: 4px; }
.basic-head { display: flex; font-size: 12.5px; gap: 8px; }
.basic-head .name { color: var(--ink-2); }
.basic-head .stats { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- callouts */

.callout { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; border: 1px solid var(--line); background: var(--surface-2); }
.callout-alert { background: var(--red-soft); border-color: #f1b8b5; color: #7a1512; }
.callout-warn { background: var(--warn-soft); border-color: #f3d9a8; color: #7a4506; }
.callout-good { background: var(--good-soft); border-color: #bfe5cc; color: #0f5130; }
.callout h3 { margin-bottom: 4px; font-size: 13px; }
.callout p { margin: 0; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout li { margin: 3px 0; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 18px; }
.detail-item { display: flex; flex-direction: column; gap: 1px; }
.detail-label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.detail-value { font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--swatch, var(--navy)); }

.chart-box { position: relative; }

/* --------------------------------------------------------------- states */

.empty { padding: 34px 20px; text-align: center; color: var(--ink-3); }
.empty h3 { color: var(--ink-2); margin-bottom: 5px; }
.empty p { margin: 0 auto; max-width: 46ch; font-size: 13px; }

.banner { margin: 0 22px; padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--line); background: var(--surface); }
.banner-warn { background: var(--warn-soft); border-color: #f3d9a8; color: #7a4506; }
.banner-bad { background: var(--bad-soft); border-color: #f6c9c6; color: #991b1b; }
.banner-info { background: var(--accent-soft); border-color: #c7d7fb; color: var(--accent-strong); }

.skeleton-page { display: flex; flex-direction: column; gap: 16px; }
.sk { background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 37%, #eef2f7 63%); background-size: 400% 100%; border-radius: var(--radius); animation: sk 1.3s ease-in-out infinite; }
.sk-card { height: 140px; }
.sk-table { height: 320px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* --------------------------------------------------------------- toast + modal */

.toast-root { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: 9px 13px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-lg); max-width: 380px; }
.toast-bad { background: #991b1b; }
.toast-good { background: #0f6b3a; }

.modal-root { position: fixed; inset: 0; background: rgba(16, 25, 46, .5); display: grid; place-items: center; padding: 20px; z-index: 90; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 20px; }
.modal h2 { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.code-list { font-family: var(--mono); font-size: 13px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.qr-holder { display: grid; place-items: center; padding: 10px; }
.qr-holder img { border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* --------------------------------------------------------------- login */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(229, 50, 45, .12), transparent 60%),
    linear-gradient(160deg, #1c2a4f 0%, #24365f 45%, #16203d 100%);
}
.login-shell { width: min(420px, calc(100vw - 32px)); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-logo { width: 56px; height: 56px; }
.login-brand h1 { font-size: 17px; color: var(--navy); }
.login-sub { margin: 2px 0 0; color: var(--ink-3); font-size: 12.5px; }
.login-footnote { text-align: center; color: #9fb0d4; font-size: 11.5px; margin-top: 16px; }
.login-company { text-align: center; color: #c8d2ea; font-size: 12px; margin-top: 4px; }

.reset-done { background: var(--good-soft); border: 1px solid #bfe5cc; color: #0f5130; border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13px; margin: 0 0 14px; }

/* --------------------------------------------------------------- settings */

.setting-group { margin-bottom: 22px; }
.setting-group h3 { margin-bottom: 9px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; }
.setting-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.setting-item { display: flex; flex-direction: column; gap: 4px; }
.setting-item label { font-size: 12.5px; color: var(--ink-2); }
.setting-item input, .setting-item select { width: 100%; }
.setting-item .hint { font-size: 11.5px; color: var(--ink-4); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.mapping-table select { width: 100%; }

.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 30px 20px; text-align: center; background: #fbfdff; cursor: pointer; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone p { margin: 5px 0; color: var(--ink-3); font-size: 13px; }

/* --------------------------------------------------------------- password */

.password-wrap { position: relative; display: block; }
.password-wrap .password-input { width: 100%; padding-right: 62px; }
.password-toggle {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  appearance: none; border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 4px 6px; border-radius: var(--radius-sm); line-height: 1;
}
.password-toggle:hover { background: var(--accent-soft); }

/* --------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-wide { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .grid-hero, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-btn { display: block; }
  .content { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .banner { margin: 0 14px; }
  .table-wrap { max-height: none; }
  .code-list { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .timeline-item { grid-template-columns: 80px 14px 1fr; }
}

/* --------------------------------------------------------------- print */

@media print {
  .sidebar, .topbar-tools, .menu-btn, .toast-root, .modal-root, .btn, .table-foot, .page-foot { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .topbar { position: static; border-bottom: 1px solid #000; }
  .content { padding: 0; gap: 12px; }
  .card, .kpi, .basic-card { break-inside: avoid; box-shadow: none; border-color: #999; }
  .table-wrap { max-height: none; overflow: visible; border-color: #999; }
  thead th { position: static; background: #eee; color: #000; }
  body { background: #fff; font-size: 11px; }
  a { text-decoration: none; color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (prefers-contrast: more) {
  :root { --line: #94a3b8; --line-strong: #64748b; --ink-3: #475569; }
}
