/* ---------- tokens (Bultex 99: navy #1A468E, sky #0994DC) ---------- */
:root {
  color-scheme: light;
  --brand-navy: #1A468E;
  --brand-navy-deep: #12346c;
  --brand-sky: #0994DC;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --surface-3: #e2e8f1;
  --border: #dfe5ee;
  --border-strong: #c8d1de;
  --text: #0f1c30;
  --text-2: #475569;
  --muted: #7a869a;
  --accent: #1A468E;
  --accent-hover: #143a78;
  --accent-soft: #e6eef9;
  --accent-text: #1A468E;
  --on-accent: #ffffff;
  --focus: #0994DC;
  --success: #0b7a2b;
  --success-soft: #e5f4e9;
  --danger: #c23434;
  --danger-soft: #fbeaea;
  --warning: #8a5a00;
  --warning-soft: #fdf3dc;
  --grid: #e7ebf1;
  --logo-ink: #1A468E;
  --logo-accent: #0994DC;
  --side-bg: linear-gradient(180deg, #1A468E 0%, #143a76 100%);
  --side-text: rgba(255, 255, 255, .78);
  --side-muted: rgba(255, 255, 255, .5);
  --side-hover: rgba(255, 255, 255, .08);
  --side-active: rgba(255, 255, 255, .15);
  --side-border: rgba(255, 255, 255, .12);
  --shadow-sm: 0 1px 2px rgba(15, 28, 48, .05);
  --shadow: 0 1px 2px rgba(15, 28, 48, .04), 0 4px 16px rgba(15, 28, 48, .07);
  --shadow-lg: 0 12px 40px rgba(15, 28, 48, .16);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 256px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b111c; --surface: #121a28; --surface-2: #19233a; --surface-3: #223049;
    --border: #233049; --border-strong: #32425f; --text: #e9eef6; --text-2: #b4bfd0; --muted: #8492a8;
    --accent: #2b9be0; --accent-hover: #4aaae6; --accent-soft: #14304f; --accent-text: #7cc4f2; --on-accent: #06121f;
    --success: #4cc46a; --success-soft: #16301d; --danger: #ef6b6b; --danger-soft: #3a1c1c;
    --warning: #f0b84a; --warning-soft: #3a2d12; --grid: #1e293d; --logo-ink: #ffffff;
    --side-bg: linear-gradient(180deg, #10264d 0%, #0b1a36 100%);
    --shadow-sm: none; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b111c; --surface: #121a28; --surface-2: #19233a; --surface-3: #223049;
  --border: #233049; --border-strong: #32425f; --text: #e9eef6; --text-2: #b4bfd0; --muted: #8492a8;
  --accent: #2b9be0; --accent-hover: #4aaae6; --accent-soft: #14304f; --accent-text: #7cc4f2; --on-accent: #06121f;
  --success: #4cc46a; --success-soft: #16301d; --danger: #ef6b6b; --danger-soft: #3a1c1c;
  --warning: #f0b84a; --warning-soft: #3a2d12; --grid: #1e293d; --logo-ink: #ffffff;
  --side-bg: linear-gradient(180deg, #10264d 0%, #0b1a36 100%);
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
.icon { flex: none; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- logo ---------- */
.logo { display: block; width: 100%; height: auto; }
.logo-ink { fill: var(--logo-ink); }
.logo-accent { fill: var(--logo-accent); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-text);
  --logo-ink: #ffffff; --focus: #7cc4f2;
}
.brand { display: block; padding: 24px 24px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 148px; }
.brand-sub {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted);
}
.brand-sub::before { content: ""; width: 18px; height: 2px; border-radius: 1px; background: var(--brand-sky); }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-section { margin: 20px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--side-text); font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-sky); }
.nav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-empty { display: flex; align-items: center; gap: 8px; padding: 6px 12px; color: var(--side-muted); font-size: 12.5px; }
.sidebar-foot { border-top: 1px solid var(--side-border); padding: 10px 12px; display: flex; align-items: center; gap: 6px; }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); color: #fff; }
.me:hover, .me.active { background: var(--side-hover); text-decoration: none; }
.me-text { min-width: 0; line-height: 1.25; }
.me-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 11.5px; color: var(--side-muted); }
.sidebar .avatar { background: rgba(255, 255, 255, .14); color: #fff; }
.sidebar .icon-btn { color: var(--side-text); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: #fff; }
.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 650;
}
.avatar.lg { width: 46px; height: 46px; font-size: 15px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 36px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-date { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.topbar-date .icon { color: var(--brand-sky); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-toggle, .topbar-logo { display: none; }
.topbar-logo .logo { width: 108px; }
.lang-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.lang-switch a { min-width: 38px; text-align: center; padding: 4px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 650; letter-spacing: .03em; color: var(--text-2); }
.lang-switch a:hover { color: var(--text); text-decoration: none; }
.lang-switch a.on { background: var(--accent); color: var(--on-accent); }
.content { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px 36px 48px; }
.notice-foot { padding: 14px 36px 22px; text-align: center; color: var(--muted); font-size: 12px; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(5, 15, 30, .45); z-index: 30; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px 0 8px; gap: 8px; }
  .nav-toggle, .topbar-logo { display: inline-grid; }
  .topbar-date { display: none; }
  .content { padding: 20px 16px 36px; }
  .notice-foot { padding: 12px 16px 20px; }
}

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tool-head { display: flex; align-items: center; gap: 14px; }
.tool-head .tool-icon { width: 44px; height: 44px; border-radius: 11px; }

/* ---------- cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head > div:first-child { min-width: 0; flex: 1 1 240px; }
.card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
/* grid children must be allowed to shrink, or long unbroken text pushes them under the next column */
.grid-2 > *, .grid-side > *, .stack > * { min-width: 0; }
@media (max-width: 1000px) { .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-title:first-child { margin-top: 0; }
.section-title .count { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 22px; }
.stat-value.stat-text { font-size: 18px; line-height: 1.3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; padding-top: 6px; }
.stats-3 .stat-value { font-size: 22px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } .stats-3 .stat-value { font-size: 17px; } }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-sky); }
.sticky-side { position: sticky; top: 78px; }
@media (max-width: 1000px) { .sticky-side { position: static; } }
.stat { padding: 16px 18px; }
.stat-label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- tool cards ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px; color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tool-card { position: relative; overflow: hidden; }
.tool-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--brand-navy), var(--brand-sky)); transform: scaleX(0); transform-origin: left; transition: transform .2s ease; }
.tool-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card:hover::after { transform: scaleX(1); }
.tool-card-top { display: flex; align-items: center; justify-content: space-between; }
.tool-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.tool-card h3 { font-size: 14.5px; }
.tool-card p { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool-card .go { color: var(--muted); }
.tool-card:hover .go { color: var(--accent-text); }
.recent { display: flex; gap: 10px; flex-wrap: wrap; }
.recent a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; color: var(--text); font-weight: 500; }
.recent a:hover { text-decoration: none; border-color: var(--border-strong); }
.recent .tool-icon { width: 26px; height: 26px; border-radius: 7px; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 48px 24px; }
.empty .empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 440px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }

/* ---------- hero banner (dashboard) ---------- */
.hero-banner {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 30px 32px 40px; margin-bottom: 28px; border-radius: 14px; color: #fff;
  background: radial-gradient(600px 260px at 100% 0%, rgba(9, 148, 220, .55), transparent 70%),
              linear-gradient(120deg, #1A468E 0%, #163d7d 60%, #12346c 100%);
  box-shadow: var(--shadow);
}
.hero-banner h1 { font-size: 26px; font-weight: 700; }
.hero-banner p { color: rgba(255, 255, 255, .8); margin-top: 6px; }
.hero-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .2); font-size: 13px; color: rgba(255, 255, 255, .9); }
.hero-pill strong { color: #fff; font-variant-numeric: tabular-nums; }
.ppe-kit { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ppe-kit span { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16); color: #fff; }
.ppe-kit span:nth-child(2n) { color: #7cc8f2; transform: translateY(8px); }
/* reflective tape, like on hi-vis workwear */
.hivis { position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  background: linear-gradient(to bottom, var(--brand-sky) 0 2px, #d5dde8 2px 8px, var(--brand-sky) 8px); opacity: .95; }
@media (max-width: 760px) {
  .hero-banner { flex-direction: column; align-items: flex-start; padding: 24px 20px 34px; }
  .hero-banner h1 { font-size: 22px; }
  .ppe-kit { justify-content: flex-start; }
  .ppe-kit span { width: 44px; height: 44px; border-radius: 12px; }
  .ppe-kit span:nth-child(2n) { transform: none; }
}
/* faint workwear print */
.ppe-pattern { position: absolute; inset: -40% -30%; display: flex; flex-direction: column; gap: 44px; transform: rotate(-14deg);
  color: rgba(255, 255, 255, .07); pointer-events: none; }
.ppe-row { display: flex; gap: 56px; }
.ppe-row:nth-child(2n) { transform: translateX(44px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 40px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label, .label { font-weight: 550; font-size: 13px; color: var(--text); }
.hint { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .field + .field { margin-top: 0; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check-title { font-weight: 550; }
.check-desc { color: var(--muted); font-size: 12.5px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-info { background: var(--accent-soft); color: var(--accent-text); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 34px; min-width: 240px; }
@media (max-width: 640px) { .search, .search .input { min-width: 0; width: 100%; } .toolbar > * { flex: 1 1 auto; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 550; font-size: 12px; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .r { text-align: right; }
.table a.row-link { color: var(--text); font-weight: 550; }
.person { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.person-name { font-weight: 550; color: var(--text); }
.person-sub { color: var(--muted); font-size: 12px; }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.bar-track { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--accent); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- access list ---------- */
.access-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.access-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.access-item:hover { background: var(--surface-2); }
.access-item input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.access-item .tool-icon { width: 32px; height: 32px; border-radius: 8px; }
.access-item .grow { flex: 1; min-width: 0; }
.access-item .name { font-weight: 550; }
.access-item .desc { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-tools { display: flex; gap: 6px; }

/* ---------- segmented control ---------- */
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented a { padding: 5px 12px; border-radius: 6px; color: var(--text-2); font-weight: 550; font-size: 13px; }
.segmented a:hover { color: var(--text); text-decoration: none; }
.segmented a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- chart ---------- */
/* swatches carry --c-l / --c-d inline; the theme picks one */
.sw { background: var(--c-l); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sw { background: var(--c-d); } }
:root[data-theme="dark"] .sw { background: var(--c-d); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.plot { position: relative; height: 220px; margin-left: 38px; }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.gridline.base { border-top-color: var(--border-strong); }
.gridline em { position: absolute; right: calc(100% + 8px); top: -8px; font-style: normal; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; position: relative; cursor: default; min-width: 0; }
.col::before { content: ""; position: absolute; inset: 0 -1px; border-radius: 4px; }
.col:hover::before { background: var(--surface-2); }
.col.is-today::after { content: ""; position: absolute; bottom: -6px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--muted); }
.seg { position: relative; width: 100%; max-width: 28px; margin: 0 auto; min-height: 2px; }
.seg.top { border-radius: 4px 4px 0 0; }
.xlabels { display: flex; gap: 2px; margin: 10px 0 0 38px; font-size: 11px; color: var(--muted); }
.xlabels span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 170px; max-width: 260px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg);
  font-size: 12.5px; color: var(--text); opacity: 0; transition: opacity .1s;
}
.tooltip.show { opacity: 1; }
.tooltip .tt-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; margin-bottom: 6px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tooltip .tt-row b { margin-left: auto; font-weight: 550; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- toast ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; gap: 10px; align-items: center;
  max-width: min(420px, calc(100vw - 32px)); padding: 12px 14px; border-radius: var(--radius);
  background: var(--brand-navy); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500;
  animation: toast-in .2s ease; transition: opacity .3s, transform .3s;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast button { margin-left: 6px; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0; display: grid; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 640px) { .toast { left: 16px; right: 16px; bottom: 16px; } }

/* ---------- copy box ---------- */
.copy-box { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 12px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); background: var(--surface-2); }
.copy-box code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }

/* ---------- details list ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.profile { display: flex; align-items: center; gap: 14px; }

/* ---------- auth ---------- */
.auth-body { background: var(--surface); }
.auth { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 48px;
  background: radial-gradient(700px 400px at 90% 10%, rgba(9, 148, 220, .45), transparent 70%), linear-gradient(140deg, #1A468E 0%, #12346c 100%);
  color: #fff; --logo-ink: #ffffff; }
.auth-brand-inner { position: relative; max-width: 380px; }
.auth-brand .logo { width: 260px; margin-bottom: 28px; }
.auth-brand h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.auth-brand p { color: rgba(255, 255, 255, .78); font-size: 15px; }
.auth-panel { position: relative; display: flex; align-items: center; justify-content: center; padding: 72px 24px 40px; background: var(--bg); }
.auth-lang { position: absolute; top: 18px; right: 20px; z-index: 3; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; font-weight: 700; }
.auth-sub { color: var(--text-2); margin: 6px 0 24px; }
.auth-foot { color: var(--muted); font-size: 12.5px; margin-top: 22px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-brand { padding: 34px 24px 40px; justify-content: flex-start; }
  .auth-brand .logo { width: 170px; margin-bottom: 16px; }
  .auth-brand h2 { font-size: 19px; }
  .auth-brand p { font-size: 13.5px; }
  .auth-panel { align-items: flex-start; padding: 28px 20px 40px; }
  .auth-lang { top: 16px; right: 16px; }
  .auth-lang .lang-switch { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); }
  .auth-lang .lang-switch a { color: rgba(255, 255, 255, .85); }
  .auth-lang .lang-switch a.on { background: #fff; color: var(--brand-navy); }
}

/* ---------- error ---------- */
.error-page { text-align: center; padding: 72px 16px; }
.error-icon { width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.error-code { font-size: 15px; font-weight: 700; letter-spacing: .12em; color: var(--muted); }
.error-page h1 { margin: 6px 0 8px; }
.error-page p { color: var(--text-2); margin-bottom: 20px; }

/* ---------- audit ---------- */
.audit-row td:first-child { white-space: nowrap; color: var(--muted); }

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