/* ==========================================================================
   POA&M Tracker — Mockup Design System
   Static UI mockups. No backend, no framework. Phase 1 scope.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand — deep navy chrome + refined blue accent */
  --nav-bg:            #111E36;
  --nav-bg-deep:       #0C1729;
  --nav-border:        rgba(255, 255, 255, .07);
  --nav-text:          #9AA8BF;
  --nav-text-hover:    #DDE5F0;
  --nav-text-active:   #FFFFFF;
  --nav-active-bg:     rgba(255, 255, 255, .09);
  --nav-section:       #64748B;

  --brand-50:          #EEF4FC;
  --brand-100:         #D8E7F8;
  --brand-300:         #5598E7;
  --brand-500:         #256ABF;
  --brand-600:         #1C5CAB;
  --brand-700:         #164A8C;

  /* Neutrals */
  --page:              #F5F7FA;
  --surface:           #FFFFFF;
  --surface-2:         #FAFBFC;
  --surface-3:         #F1F4F8;
  --border:            #E3E8EF;
  --border-strong:     #CFD7E3;
  --ink:               #101B2E;
  --ink-2:             #48566B;
  --ink-3:             #77849A;
  --ink-4:             #9AA5B6;

  /* Risk severity ramp — validated (worst all-pairs CVD ΔE 9.1, normal 15.1).
     Always paired with a visible label; never carries meaning by hue alone. */
  --risk-critical:     #A4161A;
  --risk-high:         #E2600F;
  --risk-moderate:     #EDA100;
  --risk-low:          #1BAF7A;

  /* Chart series — categorical slots 1..4, fixed order, never cycled */
  --series-1:          #2A78D6;
  --series-2:          #EB6834;
  --series-3:          #1BAF7A;
  --series-4:          #EDA100;

  /* Chart chrome */
  --grid:              #EAEEF4;
  --axis:              #CFD7E3;

  /* Feedback */
  --ok:                #0F7D3F;
  --ok-bg:             #E8F6EE;
  --warn:              #8A6100;
  --warn-bg:           #FDF6E3;
  --danger:            #A4161A;
  --danger-bg:         #FCEBEA;
  --info:              #1C5CAB;
  --info-bg:           #EEF4FC;

  /* Shape & depth */
  --r-sm:              5px;
  --r:                 8px;
  --r-lg:              12px;
  --shadow-xs:         0 1px 2px rgba(16, 27, 46, .06);
  --shadow-sm:         0 1px 3px rgba(16, 27, 46, .07), 0 1px 2px rgba(16, 27, 46, .04);
  --shadow:            0 4px 12px rgba(16, 27, 46, .08), 0 1px 3px rgba(16, 27, 46, .05);
  --shadow-lg:         0 16px 40px rgba(16, 27, 46, .16);

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

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
svg { display: block; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #C9D2E0; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #AEBACC; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

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

/* --------------------------------------------------------------------------
   3. App shell — left nav (default)
   -------------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  border-bottom: 1px solid var(--nav-border);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: none;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--brand-300), var(--brand-600));
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(37, 106, 191, .45);
}
.brand-mark svg { width: 17px; height: 17px; stroke: #fff; }
.brand-name { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -.015em; white-space: nowrap; }
.brand-name span { color: var(--brand-300); font-weight: 600; margin-left: .3em; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 24px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); background-clip: content-box; }

.nav-section {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--nav-section);
  padding: 16px 10px 7px;
}
.nav-section:first-child { padding-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8.5px 10px;
  border-radius: var(--r-sm);
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background .13s, color .13s;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.055); color: var(--nav-text-hover); text-decoration: none; }
.nav-item.is-active { background: var(--nav-active-bg); color: var(--nav-text-active); font-weight: 600; }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-300);
}
.nav-item svg { width: 17px; height: 17px; flex: none; stroke-width: 1.7; opacity: .92; }
.nav-item .nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  background: rgba(255,255,255,.13); color: #E4EAF3; letter-spacing: .01em;
}
.nav-count.is-alert { background: rgba(226, 96, 15, .9); color: #fff; }

.nav-foot { border-top: 1px solid var(--nav-border); padding: 12px; }
.nav-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.nav-user:hover { background: rgba(255,255,255,.055); }
.nav-user-meta { min-width: 0; display: flex; flex-direction: column; }
.nav-user-name { font-size: 13px; font-weight: 600; color: #E9EEF6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-role { font-size: 11.5px; color: var(--nav-section); white-space: nowrap; line-height: 1.35; }

/* Collapsed sidebar */
body.nav-collapsed .sidebar { width: 66px; flex-basis: 66px; }
body.nav-collapsed .brand { padding: 0 18px; }
body.nav-collapsed .brand-name,
body.nav-collapsed .nav-item .nav-label,
body.nav-collapsed .nav-count,
body.nav-collapsed .nav-user-meta { display: none; }
body.nav-collapsed .nav-section { text-align: center; padding: 14px 0 6px; font-size: 9px; }
body.nav-collapsed .nav-item { justify-content: center; padding: 9px 0; }
body.nav-collapsed .nav-user { justify-content: center; }

/* --------------------------------------------------------------------------
   4. Main column
   -------------------------------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.icon-btn {
  width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; background: transparent;
  border-radius: var(--r-sm); color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer;
  position: relative; transition: background .13s, color .13s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; stroke-width: 1.7; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--risk-high); border: 1.5px solid var(--surface);
}

.search {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-4); stroke-width: 1.8; pointer-events: none;
}
.search input {
  width: 100%; height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font: inherit; font-size: 13.5px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus { outline: none; background: var(--surface); border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--brand-50); }
.search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 600 10.5px var(--font); color: var(--ink-4);
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; background: var(--surface);
}

.topbar-spacer { flex: 1; }

.org-switch {
  display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 10px 0 11px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); cursor: pointer; color: var(--ink);
}
.org-switch:hover { background: var(--surface-2); }
.org-switch .org-logo {
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  background: var(--brand-600); color: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.org-switch .org-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.org-switch svg { width: 14px; height: 14px; color: var(--ink-3); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--brand-100); color: var(--brand-700);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.c2 { background: #FDF0E6; color: #9A4208; }
.avatar.c3 { background: #E9F8F2; color: #0A6E4C; }
.avatar.c4 { background: #F0EAFB; color: #4A3AA7; }
.avatar.c5 { background: #FCEBEA; color: #8A1114; }
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-group .avatar:first-child { margin-left: 0; }

.content { padding: 22px; flex: 1; }
.content.narrow { max-width: 900px; }

/* --------------------------------------------------------------------------
   5. Top-navigation variant  (body.nav-top)
   -------------------------------------------------------------------------- */
body.nav-top .app { flex-direction: column; }
body.nav-top .sidebar {
  width: 100%; flex-basis: auto; height: auto; position: sticky; top: 0;
  flex-direction: row; align-items: center; overflow: visible;
  padding-right: 16px; background: var(--nav-bg);
}
body.nav-top .brand { border-bottom: 0; border-right: 1px solid var(--nav-border); margin-right: 8px; }
body.nav-top .nav {
  display: flex; align-items: center; gap: 2px;
  padding: 0; overflow: visible; flex: 1;
}
body.nav-top .nav-section { display: none; }
body.nav-top .nav-group { position: relative; }
body.nav-top .nav-item { padding: 7px 11px; border-radius: var(--r-sm); }
body.nav-top .nav-item.is-active::before {
  left: 10px; right: 10px; top: auto; bottom: -8px;
  width: auto; height: 2.5px; border-radius: 3px;
}
body.nav-top .nav-foot { display: none; }
body.nav-top .nav-toggle { display: none; }
/* Both bars are sticky — the topbar parks below the nav bar rather than under it */
body.nav-top .topbar { top: var(--topbar-h); }

/* The group head is the top-nav dropdown trigger — hidden in left-nav mode */
.nav-group-head { display: none; }
body.nav-top .nav-group-head { display: flex; }
body.nav-top .nav-group-head > svg:last-child { width: 13px; height: 13px; opacity: .6; margin-left: -3px; }
body.nav-top .nav-group > .nav-item:not(.nav-group-head) { display: none; }
body.nav-top .nav-group:hover .nav-group-head { background: rgba(255,255,255,.055); color: var(--nav-text-hover); }

/* Top-nav dropdown groups */
.nav-group > .nav-menu { display: none; }
body.nav-top .nav-group > .nav-menu {
  position: absolute; top: calc(100% + 10px); left: 0; min-width: 218px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 50;
}
body.nav-top .nav-group:hover > .nav-menu { display: block; }
body.nav-top .nav-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
}
body.nav-top .nav-menu a:hover { background: var(--surface-3); color: var(--ink); }
body.nav-top .nav-menu a.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
body.nav-top .nav-menu svg { width: 16px; height: 16px; stroke-width: 1.7; }
body.nav-top .nav-menu .nav-menu-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* --------------------------------------------------------------------------
   6. Page header
   -------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.page-head-main { min-width: 0; flex: 1; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 5px; }
.breadcrumb a { color: var(--ink-3); }
.breadcrumb a:hover { color: var(--brand-600); }
.breadcrumb svg { width: 13px; height: 13px; opacity: .55; }
.page-title { font-size: 21px; font-weight: 650; letter-spacing: -.02em; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.page-sub { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; padding-top: 4px; }

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background .13s, border-color .13s, box-shadow .13s;
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-4); text-decoration: none; }
.btn svg { width: 16px; height: 16px; stroke-width: 1.9; flex: none; }

.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(28,92,171,.28); }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }

.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8A1114; border-color: #8A1114; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; box-shadow: none; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn.is-on { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); z-index: 1; font-weight: 650; }

/* --------------------------------------------------------------------------
   8. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head.no-border { border-bottom: 0; padding-bottom: 4px; }
.card-title { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; font-weight: 400; }
.card-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }
.card-body.flush { padding: 0; }
.card-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 10px;
}

/* --------------------------------------------------------------------------
   9. Stat tiles
   -------------------------------------------------------------------------- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 16px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 17px;
  display: flex; align-items: flex-start; gap: 12px;
  position: relative;
}
.stat-main { flex: 1; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--ink-3); font-weight: 550; letter-spacing: .005em; }
.stat-value { font-size: 27px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; margin-top: 5px; }
.stat-value small { font-size: 14px; font-weight: 550; color: var(--ink-3); letter-spacing: 0; }
.stat-meta { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 5px; color: var(--ink-3); }
.stat-meta svg { width: 13px; height: 13px; }
.stat-meta.up { color: var(--ok); }
.stat-meta.down { color: var(--danger); }
.stat-icon {
  width: 40px; height: 40px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600);
}
.stat-icon svg { width: 19px; height: 19px; stroke-width: 1.8; }
.stat-icon.warn { background: var(--warn-bg); color: #8A6100; }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.ok { background: var(--ok-bg); color: var(--ok); }
.stat-icon.high { background: #FDF0E6; color: #9A4208; }

/* --------------------------------------------------------------------------
   10. Badges & pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .005em;
  white-space: nowrap; line-height: 1.45;
  background: var(--surface-3); color: var(--ink-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: currentColor; }
.badge svg { width: 12px; height: 12px; stroke-width: 2.2; flex: none; }

/* Risk — hue + label always together */
.badge.risk-critical { background: #FCEBEA; color: #8A1114; }
.badge.risk-critical .dot { background: var(--risk-critical); }
.badge.risk-high     { background: #FDF0E6; color: #9A4208; }
.badge.risk-high .dot { background: var(--risk-high); }
.badge.risk-moderate { background: #FDF6E3; color: #7A5600; }
.badge.risk-moderate .dot { background: var(--risk-moderate); }
.badge.risk-low      { background: #E9F8F2; color: #0A6E4C; }
.badge.risk-low .dot { background: var(--risk-low); }

/* Workflow status */
.badge.st-open        { background: var(--brand-50); color: var(--brand-700); }
.badge.st-open .dot   { background: var(--brand-500); }
.badge.st-progress    { background: #EDF0FB; color: #3B3491; }
.badge.st-progress .dot { background: #4A3AA7; }
.badge.st-review      { background: #FDF6E3; color: #7A5600; }
.badge.st-review .dot { background: var(--risk-moderate); }
.badge.st-overdue     { background: #FCEBEA; color: #8A1114; }
.badge.st-overdue .dot { background: var(--risk-critical); }
.badge.st-closed      { background: var(--ok-bg); color: #0A6E4C; }
.badge.st-closed .dot { background: var(--ok); }
.badge.st-draft       { background: var(--surface-3); color: var(--ink-2); }
.badge.st-draft .dot  { background: var(--ink-4); }
.badge.st-delayed     { background: #FDF0E6; color: #9A4208; }
.badge.st-delayed .dot { background: var(--risk-high); }

.badge.solid-danger { background: var(--risk-critical); color: #fff; }
.badge.solid-warn { background: var(--risk-high); color: #fff; }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-2); font-weight: 600; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 11.5px; font-weight: 550; color: var(--ink-2);
}
.tag.brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .055em; color: var(--ink-3);
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--ink); }
table.tbl th .sort { display: inline-block; margin-left: 4px; opacity: .5; font-size: 9px; vertical-align: 1px; }
table.tbl th.is-sorted { color: var(--brand-600); }
table.tbl th.is-sorted .sort { opacity: 1; }
table.tbl td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  color: var(--ink-2); vertical-align: middle;
}
table.tbl tbody tr:hover td { background: #FAFBFD; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.nowrap, table.tbl th.nowrap { white-space: nowrap; }
table.tbl td.strong { color: var(--ink); font-weight: 600; }
table.tbl .cell-id { font-family: var(--mono); font-size: 12.5px; color: var(--brand-600); font-weight: 550; }
table.tbl .cell-title { color: var(--ink); font-weight: 600; display: block; margin-bottom: 2px; }
table.tbl .cell-desc {
  color: var(--ink-3); font-size: 12.5px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  max-width: 460px;
}
/* Dense registers have many nowrap columns; without a floor the descriptive
   column collapses and every title wraps to four lines. The table scrolls
   horizontally instead — see .table-wrap. */
table.tbl td:has(.cell-title) { min-width: 270px; }
table.tbl th.col-main, table.tbl td.col-main { min-width: 270px; }
table.tbl td.col-check, table.tbl th.col-check { width: 40px; padding-right: 0; }
table.tbl td.col-act, table.tbl th.col-act { width: 46px; text-align: right; }
table.tbl.compact td { padding: 8px 14px; }
table.tbl tr.is-selected td { background: var(--brand-50) !important; }

.owner { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.owner-name { font-size: 13px; color: var(--ink-2); }

.due { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.due-late { color: var(--danger); font-weight: 600; }
.due-soon { color: #9A4208; font-weight: 600; }

/* Checkbox / radio */
.chk {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border: 1.5px solid var(--border-strong);
  border-radius: 4px; background: var(--surface); cursor: pointer;
  display: inline-grid; place-items: center; vertical-align: -3px; flex: none;
}
.chk:checked { background: var(--brand-600); border-color: var(--brand-600); }
.chk:checked::after {
  content: ""; width: 9px; height: 5px; border: 2px solid #fff;
  border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px);
}
.chk.radio { border-radius: 50%; }
.chk.radio:checked { background: var(--surface); border-color: var(--brand-600); border-width: 5px; }
.chk.radio:checked::after { display: none; }

/* Toggle switch */
.switch { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 20px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .15s; }
.switch:checked { background: var(--brand-600); }
.switch:checked::after { transform: translateX(16px); }

/* --------------------------------------------------------------------------
   12. Filter bar
   -------------------------------------------------------------------------- */
.filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.filters .search { max-width: 300px; flex: 1 1 220px; }
.filters .spacer { flex: 1; }

.select {
  height: 36px; padding: 0 30px 0 11px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2377849A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 8px center;
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.select:focus { outline: none; border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--brand-50); }
.select.is-set { border-color: var(--brand-300); background-color: var(--brand-50); color: var(--brand-700); font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 6px 0 10px; border-radius: 20px;
  background: var(--brand-50); border: 1px solid var(--brand-100);
  color: var(--brand-700); font-size: 12.5px; font-weight: 600;
}
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; opacity: .65; }
.chip button:hover { background: rgba(28,92,171,.14); opacity: 1; }
.chip svg { width: 11px; height: 11px; stroke-width: 2.6; }

/* --------------------------------------------------------------------------
   13. Tabs
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 18px; overflow-x: auto; }
.tab {
  padding: 11px 13px; font-size: 13.5px; font-weight: 550;
  color: var(--ink-3); border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0;
  display: flex; align-items: center; gap: 7px; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-600); border-bottom-color: var(--brand-600); font-weight: 650; }
.tab .count { font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--ink-3); padding: 0 6px; border-radius: 20px; }
.tab.is-active .count { background: var(--brand-50); color: var(--brand-600); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* --------------------------------------------------------------------------
   14. Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label, .form-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.field label .req { color: var(--risk-critical); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; line-height: 1.45; }
.field .hint.guide { border-left: 2px solid var(--brand-100); padding-left: 8px; color: var(--ink-3); font-style: italic; }

.input, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink);
  padding: 0 11px; height: 38px;
}
.textarea { height: auto; padding: 9px 11px; line-height: 1.55; resize: vertical; min-height: 84px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .textarea:focus { outline: none; border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--brand-50); }
.input[readonly], .input[disabled] { background: var(--surface-3); color: var(--ink-3); }
.field .select { width: 100%; }

.form-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid.c3 .span-3 { grid-column: span 3; }

.fieldset { border: 0; padding: 0; margin: 0 0 6px; }
.fieldset legend {
  padding: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 14px; width: 100%;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.check-row { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; }
.check-row label { margin: 0; font-weight: 500; font-size: 13.5px; color: var(--ink); cursor: pointer; line-height: 1.45; }
.check-row .sub { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; margin-top: 2px; line-height: 1.45; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--r) 0 0 var(--r); }
.input-group .btn { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; height: 38px; }

/* --------------------------------------------------------------------------
   15. Alerts
   -------------------------------------------------------------------------- */
.alert {
  display: flex; gap: 11px; padding: 12px 14px;
  border-radius: var(--r); border: 1px solid; font-size: 13px; line-height: 1.5;
  margin-bottom: 16px;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; stroke-width: 1.9; }
.alert strong { display: block; margin-bottom: 2px; font-weight: 650; }
.alert.info { background: var(--info-bg); border-color: var(--brand-100); color: #16406F; }
.alert.warn { background: var(--warn-bg); border-color: #F3E3B8; color: #6B4B00; }
.alert.danger { background: var(--danger-bg); border-color: #F6D2D0; color: #7C1113; }
.alert.ok { background: var(--ok-bg); border-color: #C9E8D6; color: #0A5C31; }
.alert .alert-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }

/* --------------------------------------------------------------------------
   16. Timeline / activity / comments
   -------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -30px; top: 1px;
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--surface-3); border: 2px solid var(--surface);
  display: grid; place-items: center; color: var(--ink-3);
  box-shadow: 0 0 0 1.5px var(--border);
}
.tl-dot svg { width: 12px; height: 12px; stroke-width: 2.1; }
.tl-dot.brand { background: var(--brand-50); color: var(--brand-600); box-shadow: 0 0 0 1.5px var(--brand-100); }
.tl-dot.ok { background: var(--ok-bg); color: var(--ok); box-shadow: 0 0 0 1.5px #C9E8D6; }
.tl-dot.warn { background: var(--warn-bg); color: #8A6100; box-shadow: 0 0 0 1.5px #F3E3B8; }
.tl-dot.danger { background: var(--danger-bg); color: var(--danger); box-shadow: 0 0 0 1.5px #F6D2D0; }
.tl-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.tl-text b { color: var(--ink); font-weight: 600; }
.tl-time { font-size: 12px; color: var(--ink-4); margin-top: 3px; }
.tl-box {
  margin-top: 8px; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r); font-size: 13px; color: var(--ink-2);
}
.tl-diff { font-family: var(--mono); font-size: 12px; }
.tl-diff .old { color: var(--ink-3); text-decoration: line-through; }
.tl-diff .new { color: var(--ok); font-weight: 600; }

.comment { display: flex; gap: 11px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.comment-author { font-weight: 650; font-size: 13.5px; }
.comment-time { font-size: 12px; color: var(--ink-4); }
.comment-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.comment-text .mention { color: var(--brand-600); font-weight: 600; background: var(--brand-50); padding: 0 3px; border-radius: 3px; }
.comment-actions { display: flex; gap: 14px; margin-top: 7px; font-size: 12.5px; }
.comment-actions button { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 0; font-weight: 550; }
.comment-actions button:hover { color: var(--brand-600); }

/* --------------------------------------------------------------------------
   17. Detail layout & meta lists
   -------------------------------------------------------------------------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.split.wide-side { grid-template-columns: minmax(0, 1fr) 400px; }
.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.split-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }

.meta-list { display: flex; flex-direction: column; }
.meta-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.meta-row:last-child { border-bottom: 0; }
.meta-key { flex: 0 0 130px; color: var(--ink-3); font-weight: 550; }
.meta-val { flex: 1; min-width: 0; color: var(--ink); }
.meta-val.mono { font-family: var(--mono); font-size: 12.5px; }

.desc-block { font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.desc-block p:last-child { margin-bottom: 0; }

/* Progress */
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress .bar { height: 100%; border-radius: 6px; background: var(--brand-500); }
.progress .bar.ok { background: var(--ok); }
.progress .bar.warn { background: var(--risk-moderate); }
.progress .bar.danger { background: var(--risk-critical); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; min-width: 70px; }
.progress-row .pct { font-size: 12px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }

/* --------------------------------------------------------------------------
   18. Charts (inline SVG, hand-built)
   -------------------------------------------------------------------------- */
.chart { width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .axis-text { font: 11px var(--font); fill: var(--ink-4); font-variant-numeric: tabular-nums; }
.chart .axis-text.mid { fill: var(--ink-3); }
.chart .label-text { font: 12px var(--font); fill: var(--ink-2); }
.chart .value-text { font: 600 12px var(--font); fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .mark { transition: opacity .12s; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .mark, .chart g:hover > .mark { opacity: .82; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0 2px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-val { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-center { font: 650 24px var(--font); fill: var(--ink); text-anchor: middle; letter-spacing: -.02em; }
.donut-center-sub { font: 500 11px var(--font); fill: var(--ink-3); text-anchor: middle; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 2px; }
.donut-legend-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--r-sm); font-size: 13px;
}
.donut-legend-row:hover { background: var(--surface-2); }
.donut-legend-row .name { flex: 1; color: var(--ink-2); }
.donut-legend-row .n { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.donut-legend-row .p { color: var(--ink-3); font-size: 12px; width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.chart-tip {
  position: fixed; z-index: 90; pointer-events: none;
  background: #101B2E; color: #fff; border-radius: 6px;
  padding: 7px 10px; font-size: 12px; line-height: 1.45;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .1s;
  max-width: 220px;
}
.chart-tip.show { opacity: 1; }
.chart-tip .t-title { font-weight: 650; margin-bottom: 3px; }
.chart-tip .t-row { display: flex; align-items: center; gap: 6px; color: #C6D0E0; }
.chart-tip .t-row .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip .t-row b { color: #fff; margin-left: auto; font-variant-numeric: tabular-nums; }

/* Table-view twin */
.chart-table { display: none; }
.chart-table.show { display: block; }
.chart-table table { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.chart-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.chart-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--ink-2); }
.chart-table td.n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.chart-toggle { border: 0; background: none; color: var(--ink-3); font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 4px; font-weight: 550; }
.chart-toggle:hover { background: var(--surface-3); color: var(--ink); }

/* --------------------------------------------------------------------------
   19. Kanban
   -------------------------------------------------------------------------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.kan-col { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; }
.kan-head { display: flex; align-items: center; gap: 8px; padding: 3px 4px 11px; }
.kan-title { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.kan-count { font-size: 11px; font-weight: 700; background: var(--surface); border: 1px solid var(--border); color: var(--ink-3); padding: 0 6px; border-radius: 20px; }
.kan-head .icon-btn { margin-left: auto; width: 26px; height: 26px; }
.kan-head .icon-btn svg { width: 15px; height: 15px; }
.kan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 11px 12px; margin-bottom: 9px;
  box-shadow: var(--shadow-xs); cursor: grab;
}
.kan-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.kan-card:last-child { margin-bottom: 0; }
.kan-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.kan-card-id { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.kan-card-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: 9px; }
.kan-card-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-3); }
.kan-card-foot .spacer { flex: 1; }
.kan-card-foot svg { width: 13px; height: 13px; }

/* --------------------------------------------------------------------------
   20. Evidence / files
   -------------------------------------------------------------------------- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.file-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .13s, border-color .13s;
}
.file-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.file-thumb { height: 108px; background: var(--surface-3); display: grid; place-items: center; border-bottom: 1px solid var(--border); position: relative; }
.file-thumb svg { width: 34px; height: 34px; stroke-width: 1.5; }
.file-thumb .ext {
  position: absolute; bottom: 8px; right: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-3);
}
.ft-pdf { color: #A4161A; } .ft-xls { color: #0F7D3F; } .ft-img { color: #4A3AA7; }
.ft-doc { color: #1C5CAB; } .ft-log { color: #48566B; } .ft-zip { color: #9A4208; }
.file-meta { padding: 11px 12px; }
.file-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; margin-bottom: 5px; word-break: break-word; }
.file-info { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.file-foot { padding: 9px 12px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; gap: 7px; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2); padding: 30px 20px; text-align: center;
}
.dropzone:hover { border-color: var(--brand-300); background: var(--brand-50); }
.dropzone svg { width: 34px; height: 34px; margin: 0 auto 11px; color: var(--ink-4); stroke-width: 1.4; }
.dropzone .dz-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.dropzone .dz-sub { font-size: 12.5px; color: var(--ink-3); }

/* --------------------------------------------------------------------------
   21. Steps / wizard
   -------------------------------------------------------------------------- */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 20px; }
.step { display: flex; align-items: center; gap: 10px; flex: none; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--ink-3);
}
.step-label { font-size: 13px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.step.is-done .step-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.is-done .step-label { color: var(--ink-2); }
.step.is-current .step-num { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: 0 0 0 4px var(--brand-50); }
.step.is-current .step-label { color: var(--ink); }
.step-line { flex: 1; height: 1.5px; background: var(--border); margin: 0 14px; min-width: 20px; }
.step.is-done + .step-line, .step-line.is-done { background: var(--ok); }

/* --------------------------------------------------------------------------
   22. Misc
   -------------------------------------------------------------------------- */
.empty { text-align: center; padding: 44px 20px; }
.empty svg { width: 40px; height: 40px; color: var(--ink-4); margin: 0 auto 14px; stroke-width: 1.4; }
.empty h3 { font-size: 15px; margin-bottom: 5px; }
.empty p { color: var(--ink-3); font-size: 13px; max-width: 360px; margin: 0 auto 16px; }

.pagination { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.pagination .pages { display: flex; gap: 3px; margin-left: auto; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center;
}
.page-btn:hover { background: var(--surface-2); }
.page-btn.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.page-btn[disabled] { opacity: .45; pointer-events: none; }
.page-btn svg { width: 14px; height: 14px; }

.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 5px;
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border-radius: var(--r-sm); border: 0; background: none;
  font-size: 13px; color: var(--ink-2); cursor: pointer; text-align: left; text-decoration: none;
}
.menu a:hover, .menu button:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.menu svg { width: 15px; height: 15px; stroke-width: 1.8; }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu .danger { color: var(--danger); }
.menu .danger:hover { background: var(--danger-bg); }
.menu-wrap { position: relative; }

/* Modal (static demo — shown with .is-open) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 27, 46, .48);
  display: none; align-items: flex-start; justify-content: center; z-index: 100;
  padding: 60px 20px; overflow-y: auto; backdrop-filter: blur(1.5px);
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; overflow: hidden;
}
.modal.lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head .card-title { font-size: 15.5px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 20px; max-height: 62vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 9px; justify-content: flex-end; }

/* Login */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-visual {
  background: linear-gradient(155deg, #0C1729 0%, #111E36 45%, #16406F 100%);
  color: #fff; padding: 54px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.auth-visual::after {
  content: ""; position: absolute; right: -140px; bottom: -170px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(85,152,231,.26), transparent 68%);
}
.auth-form-side { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 384px; }
.auth-title { font-size: 24px; font-weight: 650; letter-spacing: -.025em; margin-bottom: 6px; }
.auth-sub { color: var(--ink-3); font-size: 13.5px; margin-bottom: 26px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ink-4); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-feature { display: flex; gap: 13px; margin-bottom: 22px; position: relative; z-index: 1; }
.auth-feature-icon { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex: none; }
.auth-feature-icon svg { width: 17px; height: 17px; stroke: #7FB0EE; stroke-width: 1.8; }
.auth-feature h4 { font-size: 13.5px; margin-bottom: 3px; color: #fff; }
.auth-feature p { font-size: 12.5px; color: #A9BCD6; margin: 0; line-height: 1.55; }

/* --------------------------------------------------------------------------
   Authentication — SSO, TOTP challenge, enrolment
   -------------------------------------------------------------------------- */

/* Identity-provider buttons */
.sso-btn {
  display: flex; align-items: center; gap: 11px;
  width: 100%; height: 46px; padding: 0 15px;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-xs); text-decoration: none;
  transition: background .13s, border-color .13s;
}
.sso-btn:hover { background: var(--surface-2); border-color: var(--ink-4); text-decoration: none; }
.sso-btn + .sso-btn { margin-top: 9px; }
.sso-btn .sso-mark { width: 20px; height: 20px; flex: none; display: grid; place-items: center; }
.sso-btn .sso-mark svg { width: 20px; height: 20px; }
.sso-btn .sso-meta { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--ink-4); }
.sso-btn.recommended { border-color: var(--brand-300); background: var(--brand-50); }
.sso-btn.recommended .sso-meta { color: var(--brand-600); }

/* Segmented one-time-code entry */
.code-input { display: flex; gap: 9px; }
.code-input input {
  width: 48px; height: 58px; flex: none;
  text-align: center; font-family: var(--font);
  font-size: 23px; font-weight: 650; color: var(--ink);
  font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); padding: 0;
}
.code-input input::-webkit-outer-spin-button,
.code-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.code-input input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
.code-input input.is-filled { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }
.code-input input.is-error { border-color: var(--risk-critical); background: var(--danger-bg); color: #8A1114; }

.code-timer { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }
.code-timer .track { flex: none; width: 96px; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.code-timer .fill { height: 100%; border-radius: 4px; background: var(--brand-500); }
.code-timer .fill.low { background: var(--risk-high); }

/* Alternative factor rows */
.auth-method {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); cursor: pointer; color: inherit;
  text-decoration: none; transition: border-color .13s, background .13s;
}
.auth-method + .auth-method { margin-top: 8px; }
.auth-method:hover { border-color: var(--brand-300); background: var(--brand-50); text-decoration: none; }
.auth-method.is-on { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-50); }
.auth-method.is-off { opacity: .55; pointer-events: none; }
.am-icon {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: var(--brand-50); color: var(--brand-600);
  display: grid; place-items: center;
}
.auth-method.is-on .am-icon { background: var(--brand-600); color: #fff; }
.am-icon svg { width: 19px; height: 19px; stroke-width: 1.8; }
.am-main { flex: 1; min-width: 0; }
.am-title { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.am-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }
.am-chev { color: var(--ink-4); flex: none; }
.am-chev svg { width: 17px; height: 17px; stroke-width: 2.1; }

/* Authenticator enrolment */
.qr-frame {
  width: 200px; height: 200px; flex: none;
  padding: 10px; border: 1px solid var(--border); border-radius: var(--r);
  background: #fff; box-shadow: var(--shadow-xs);
}
.qr-frame svg { width: 100%; height: 100%; }
.secret-key {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-3);
  font-family: var(--mono); font-size: 13px; letter-spacing: .09em; color: var(--ink);
  word-break: break-all;
}
.secret-key button { margin-left: auto; flex: none; }

.recovery-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-2);
}
.recovery-grid code {
  font-family: var(--mono); font-size: 13.5px; letter-spacing: .06em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.recovery-grid code::before { content: counter(rc) ". "; counter-increment: rc; color: var(--ink-4); font-size: 11.5px; }
.recovery-grid { counter-reset: rc; }

/* Trusted-device list */
.device-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.device-row:last-child { border-bottom: 0; }
.device-icon { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); display: grid; place-items: center; }
.device-icon svg { width: 17px; height: 17px; stroke-width: 1.8; }

/* Mockup index page */
.mock-hero { background: linear-gradient(150deg, #0C1729, #16406F); color: #fff; padding: 42px 34px; border-radius: var(--r-lg); margin-bottom: 24px; }
.mock-hero h1 { font-size: 27px; letter-spacing: -.03em; margin-bottom: 9px; }
.mock-hero p { color: #B8C8DE; font-size: 14.5px; max-width: 660px; margin: 0; line-height: 1.6; }
.mock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.mock-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 17px; box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit; transition: box-shadow .14s, transform .14s, border-color .14s;
}
.mock-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--brand-300); text-decoration: none; }
.mock-card .mc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.mock-card .mc-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; flex: none; }
.mock-card .mc-icon svg { width: 17px; height: 17px; stroke-width: 1.8; }
.mock-card h3 { font-size: 14.5px; }
.mock-card p { font-size: 12.5px; color: var(--ink-3); margin: 0; line-height: 1.55; }
.mock-card .mc-file { font-family: var(--mono); font-size: 11px; color: var(--ink-4); margin-top: 9px; }

/* Utilities */
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 650; color: var(--ink); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 24px; }
.hr { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.section-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }

/* --------------------------------------------------------------------------
   23. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .split { grid-template-columns: minmax(0, 1fr) 310px; }
  .kanban { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}
@media (max-width: 1024px) {
  .split, .split.wide-side, .split-2, .split-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid.c3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2, .form-grid.c3 .span-3 { grid-column: span 1; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
@media (max-width: 860px) {
  body:not(.nav-top) .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body:not(.nav-top).nav-open .sidebar { transform: none; }
  body.nav-top .nav { overflow-x: auto; }
  .main { width: 100%; }
  .content { padding: 16px; }
  .kanban { grid-template-columns: minmax(0, 1fr); }
  .search kbd, .org-switch .org-name { display: none; }
  .page-head { flex-direction: column; gap: 12px; }
  .page-actions { width: 100%; }
}

@media print {
  .sidebar, .topbar, .page-actions, .filters, .chart-toggle { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
