/* ============================================================
   Corro — GRC platform mockup
   Design system mirrors the reference "type UI" enterprise theme.
   Exact color tokens lifted from the reference stylesheet.
   ============================================================ */

/* ---------- Light theme (default) ---------- */
:root {
  --app-bg:        #f9fafb;
  --surface:       #ffffff;
  --surface-2:     #f9fafb;
  --surface-3:     #f3f4f6;
  --surface-hover: #f3f4f6;
  --border:        #e5e7eb;
  --border-strong: #d1d5dc;

  --text:          #111827;   /* heading */
  --text-body:     #4b5563;   /* body    */
  --text-muted:    #6b7280;   /* subtle  */
  --text-faint:    #9ca3af;

  --brand:         #1447e6;
  --brand-strong:  #193cb8;
  --brand-medium:  #bedbff;
  --brand-soft:    #dbeafe;
  --brand-softer:  #eef6ff;
  --fg-brand:      #1447e6;

  --success:       #007a55;
  --success-fg:    #047857;
  --success-soft:  #ecfdf5;
  --success-medium:#d0fae5;
  --success-border:#a7f3d0;

  --danger:        #c70036;
  --danger-fg:     #be123c;
  --danger-soft:   #fef0f2;
  --danger-medium: #ffe4e6;
  --danger-border: #fecdd3;

  --warning:       #f97316;
  --warning-strong:#c2410c;
  --warning-fg:    #7c2d12;
  --warning-soft:  #fff7ed;
  --warning-medium:#ffedd5;
  --warning-border:#fed7aa;

  --purple:        #a855f7;
  --purple-soft:   #f5edff;
  --sky:           #0ea5e9;
  --sky-soft:      #e6f6fe;
  --teal:          #0d9488;
  --teal-soft:     #e5f6f4;

  --radius:        8px;
  --radius-sm:     6px;
  --radius-lg:     12px;
  --radius-pill:   9999px;

  --shadow-xs: 0 1px 2px #1118270d;
  --shadow-sm: 0 1px 3px #11182714, 0 1px 2px #1118270a;
  --shadow-md: 0 4px 6px #1118270f, 0 2px 4px #1118270a;
  --shadow-lg: 0 10px 15px #11182714, 0 4px 6px #1118270a;
  --shadow-xl: 0 20px 25px #1118271a, 0 8px 10px #11182714;

  --sidebar-w: 68px;
  --topbar-h: 64px;

  /* dark icon rail (matches reference --dark-strong) */
  --rail-bg: #111827;
  --rail-border: #1f2937;
  --rail-icon: #9ca3af;
  --rail-hover: #1f2937;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  --app-bg:        #030712;
  --surface:       #101828;
  --surface-2:     #1e2939;
  --surface-3:     #333e4f;
  --surface-hover: #1e2939;
  --border:        #1f2937;
  --border-strong: #374151;

  --text:          #ffffff;
  --text-body:     #cbd5e1;
  --text-muted:    #9ca3af;
  --text-faint:    #6b7280;

  --brand:         #155dfc;
  --brand-strong:  #1447e6;
  --brand-medium:  #1c398e;
  --brand-soft:    #16233f;
  --brand-softer:  #101a30;
  --fg-brand:      #51a2ff;

  --success:       #009966;
  --success-fg:    #34d399;
  --success-soft:  #0a2620;
  --success-medium:#0d3b2e;
  --success-border:#0d4b39;

  --danger:        #ef3b6b;
  --danger-fg:     #fb7185;
  --danger-soft:   #2a0a14;
  --danger-medium: #3f0f1e;
  --danger-border: #5a1730;

  --warning:       #f97316;
  --warning-strong:#fb923c;
  --warning-fg:    #fbbf24;
  --warning-soft:  #2a1708;
  --warning-medium:#3a2210;
  --warning-border:#5a3417;

  --purple-soft:   #241633;
  --sky-soft:      #0a2230;
  --teal-soft:     #0a2422;

  --rail-bg: #0b1220;
  --rail-border: #1f2937;
  --rail-icon: #9ca3af;
  --rail-hover: #1f2937;

  --shadow-xs: 0 1px 2px #00000040;
  --shadow-sm: 0 1px 3px #00000059, 0 1px 2px #00000040;
  --shadow-md: 0 4px 6px #00000059, 0 2px 4px #00000040;
  --shadow-lg: 0 10px 15px #00000066, 0 4px 6px #00000040;
  --shadow-xl: 0 20px 25px #00000073, 0 8px 10px #00000059;

  --ring: 0 0 0 3px color-mix(in srgb, var(--fg-brand) 30%, transparent);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--app-bg);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02","cv03","cv04","cv11";
}
h1,h2,h3,h4,h5 { color: var(--text); margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
svg { vertical-align: middle; }
.spark { vertical-align: baseline; }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
}
.side-brand .logo { width: 34px; height: 34px; border-radius: 9px; flex: none; box-shadow: var(--shadow-sm); }
.side-brand .name { font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -0.02em; }
.side-brand .tag { font-size: 10px; color: var(--text-muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.side-nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-faint); padding: 8px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 1px 0; border-radius: var(--radius-sm);
  color: var(--text-body); font-weight: 500; font-size: 13.5px;
  position: relative; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--text-muted); }
.nav-item.active { background: var(--brand-softer); color: var(--brand); font-weight: 600; }
.nav-item.active svg { color: var(--brand); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item .count {
  margin-left: auto; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center;
  padding: 1px 6px; border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--text-muted);
}
.nav-item.active .count { background: var(--brand); color: #fff; }
.nav-item .count.alert { background: var(--danger-medium); color: var(--danger-fg); }

.side-user {
  border-top: 1px solid var(--border); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.side-user:hover { background: var(--surface-hover); cursor: pointer; }
.avatar {
  width: 34px; height: 34px; border-radius: var(--radius-pill); flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #fff;
  background: linear-gradient(135deg, #1e5bff, #1447e6); letter-spacing: .02em;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.side-user .meta { min-width: 0; }
.side-user .meta .nm { font-weight: 650; color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .meta .rl { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .chev { margin-left: auto; color: var(--text-faint); }

/* ---------- Main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; flex: 1; min-height: calc(100vh - 5px); }
.topbar {
  height: var(--topbar-h); position: sticky; top: 5px; z-index: 30;
  background: color-mix(in srgb, var(--app-bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
}
.topbar .titles { min-width: 0; }
.topbar .titles h1 { font-size: 17px; line-height: 1.2; }
.topbar .titles p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px; width: 260px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 10px; color: var(--text-muted); font-size: 13px; transition: border .12s, box-shadow .12s;
}
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search svg { width: 15px; height: 15px; }
.topbar-search .kbd { margin-left: auto; }
.kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px;
}
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; position: relative;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text-muted); transition: background .12s, color .12s, border .12s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 2px solid var(--app-bg); }

.content { padding: 24px 24px 48px; max-width: 1440px; width: 100%; margin: 0; flex: 1 0 auto; }
@media (max-width: 1100px){ .content { padding: 20px; } }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  font-weight: 600; font-size: 13px; border: 1px solid transparent;
  background: var(--surface); color: var(--text); border-color: var(--border);
  transition: background .12s, border .12s, box-shadow .12s, transform .04s; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: var(--shadow-xs); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-body); }
.btn.ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { filter: brightness(1.05); }
.btn.success { background: var(--success); color: #fff; border-color: var(--success); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn.sm svg { width: 14px; height: 14px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ============================================================
   Cards & primitives
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 16px; font-weight: 600; }
.card-head .sub { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 24px; }
.card-body.tight { padding: 8px; }

.grid { display: grid; gap: 24px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px){ .g-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 900px){ .g-3, .g-2 { grid-template-columns: 1fr; } .g-4 { grid-template-columns: 1fr; } }
.cols { display: grid; gap: 24px; }
.cols.a { grid-template-columns: 1.6fr 1fr; }
.cols.b { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px){ .cols.a, .cols.b { grid-template-columns: 1fr; } }
/* grid/flex children must be allowed to shrink below their content size */
.cols > *, .grid > * { min-width: 0; }

/* KPI stat card */
.kpi { padding: 24px; }
.kpi .top { display: flex; align-items: center; gap: 10px; }
.kpi .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.kpi .ic svg { width: 19px; height: 19px; }
.kpi .lbl { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.kpi .val { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; margin-top: 14px; line-height: 1.1; }
.kpi .delta { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; margin-top: 8px; }
.kpi .delta svg { width: 14px; height: 14px; }
.delta.up { color: var(--success-fg); }
.delta.down { color: var(--danger-fg); }
.delta.flat { color: var(--text-muted); }

.tint-brand { background: var(--brand-soft); color: var(--brand); }
.tint-success { background: var(--success-medium); color: var(--success-fg); }
.tint-warning { background: var(--warning-medium); color: var(--warning-strong); }
.tint-danger { background: var(--danger-medium); color: var(--danger-fg); }
.tint-purple { background: var(--purple-soft); color: var(--purple); }
.tint-sky { background: var(--sky-soft); color: var(--sky); }
.tint-teal { background: var(--teal-soft); color: var(--teal); }

/* Badges / pills */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 650; white-space: nowrap;
  border: 1px solid transparent;
}
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.gray    { background: var(--surface-3); color: var(--text-muted); border-color: var(--border); }
.badge.brand   { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-medium); }
.badge.success { background: var(--success-soft); color: var(--success-fg); border-color: var(--success-border); }
.badge.warning { background: var(--warning-soft); color: var(--warning-strong); border-color: var(--warning-border); }
.badge.danger  { background: var(--danger-soft); color: var(--danger-fg); border-color: var(--danger-border); }
.badge.purple  { background: var(--purple-soft); color: var(--purple); border-color: color-mix(in srgb, var(--purple) 30%, transparent); }
.badge.sky     { background: var(--sky-soft); color: var(--sky); border-color: color-mix(in srgb, var(--sky) 30%, transparent); }
.badge.teal    { background: var(--teal-soft); color: var(--teal); border-color: color-mix(in srgb, var(--teal) 30%, transparent); }

.tag { display: inline-flex; align-items:center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-body); border: 1px solid var(--border); }

/* Progress */
.bar { height: 8px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--brand); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar.thin { height: 6px; }
.bar > span.ok { background: var(--success); }
.bar > span.warn { background: var(--warning); }
.bar > span.bad { background: var(--danger); }

.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 11px 0; }
.meter-row + .meter-row { border-top: 1px solid var(--border); }
.meter-row .nm { font-weight: 550; color: var(--text); font-size: 13px; }
.meter-row .vv { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.meter-row .bar { grid-column: 1 / -1; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface-3);
}
table.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-body); vertical-align: middle; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl td .primary-cell { color: var(--text); font-weight: 600; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-strong { color: var(--text); font-weight: 600; }
.cell-2 { display: flex; flex-direction: column; gap: 2px; }
.cell-2 .s { font-size: 11.5px; color: var(--text-muted); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .1s; }
tr:hover .row-actions { opacity: 1; }

.checkbox { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-strong); display: inline-grid; place-items: center; background: var(--surface); cursor: pointer; transition: all .12s; flex: none; }
.checkbox.on { background: var(--brand); border-color: var(--brand); }
.checkbox svg { width: 11px; height: 11px; color: #fff; opacity: 0; }
.checkbox.on svg { opacity: 1; }

/* Toolbar above tables */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.search-inp { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 10px; height: 36px; min-width: 220px; }
.search-inp svg { width: 15px; height: 15px; color: var(--text-muted); flex:none; }
.search-inp input { border: none; background: transparent; outline: none; color: var(--text); font-size: 13px; width: 100%; font-family: inherit; }
.search-inp input::placeholder { color: var(--text-faint); }

.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--radius); padding: 3px; gap: 2px; border: 1px solid var(--border); }
.seg button { border: none; background: transparent; height: 28px; padding: 0 12px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-f { height: 30px; padding: 0 11px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-body); font-weight: 600; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.chip-f:hover { border-color: var(--border-strong); }
.chip-f.on { background: var(--brand-softer); border-color: var(--brand-medium); color: var(--brand); }
.chip-f .n { font-size: 11px; opacity: .8; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { border: none; background: transparent; padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--text-muted); position: relative; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand); }
.tabs button.on::after { content:""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; }
.tabs button .count { font-size: 11px; margin-left: 6px; background: var(--surface-3); color: var(--text-muted); padding: 1px 6px; border-radius: var(--radius-pill); font-weight: 700; }

/* Page header (in-content) */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.page-head .t h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.page-head .t p { margin: 8px 0 0; color: var(--text-muted); font-size: 14px; max-width: 72ch; line-height: 1.5; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* Section title */
.sec-title { display:flex; align-items:center; gap:10px; margin: 32px 0 16px; }
.sec-title h3 { font-size: 15px; }
.sec-title .line { flex:1; height:1px; background: var(--border); }

/* Lists (activity, tasks) */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 12px 4px; }
.feed-item + .feed-item { border-top: 1px solid var(--border); }
.feed-item .dotc { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.feed-item .dotc svg { width: 15px; height: 15px; }
.feed-item .fb { min-width: 0; flex: 1; }
.feed-item .fb .ft { font-size: 13px; color: var(--text); font-weight: 600; }
.feed-item .fb .fs { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.feed-item .fb .fm { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

.task-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; }
.task-item + .task-item { border-top: 1px solid var(--border); }
.task-item .tb { flex: 1; min-width: 0; }
.task-item .tt { font-weight: 600; color: var(--text); font-size: 13px; }
.task-item.done .tt { text-decoration: line-through; color: var(--text-faint); }
.task-item .tm { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Donut / charts */
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 150px; height: 150px; flex: none; }
.donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut .center .big { font-size: 30px; font-weight: 750; color: var(--text); letter-spacing: -.02em; line-height: 1; }
.donut .center .small { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.legend .lg { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .lg .nm { color: var(--text-body); }
.legend .lg .vv { margin-left: auto; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.spark { width: 100%; height: 46px; display: block; }

/* Risk heatmap */
.heat { display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 6px; }
.heat .hlabel { display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.heat .hcell { aspect-ratio: 1.7 / 1; border-radius: 8px; display: grid; place-items: center; font-weight: 750; font-size: 15px; color: #fff; position: relative; cursor: pointer; transition: transform .1s; border: 1px solid #ffffff20; }
.heat .hcell:hover { transform: scale(1.04); z-index: 2; box-shadow: var(--shadow-md); }
.heat .hcell.empty { color: #ffffff90; }
.heat .axis-y { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }
.heat .axis-x { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }

/* Empty state */
.empty { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty .eic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--surface-3); color: var(--text-faint); }
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ============================================================
   Modal / drawer / toast / dropdown
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: color-mix(in srgb, #0b1220 55%, transparent);
  backdrop-filter: blur(2px); display: grid; place-items: center; padding: 24px;
  opacity: 0; animation: fade .16s forwards;
}
@keyframes fade { to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); max-height: 90vh; display: flex; flex-direction: column;
  transform: translateY(8px) scale(.98); animation: pop .18s cubic-bezier(.2,.9,.3,1) forwards;
}
.modal.wide { max-width: 780px; }
@keyframes pop { to { transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-head .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); justify-content: flex-end; }
.modal-foot .spacer { flex: 1; }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; z-index: 100; background: color-mix(in srgb, #0b1220 45%, transparent); opacity: 0; animation: fade .16s forwards; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 620px; max-width: 94vw; z-index: 101;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column; transform: translateX(100%); animation: slidein .24s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes slidein { to { transform: none; } }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }

/* Forms */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.input, .select, textarea.input {
  width: 100%; height: 38px; padding: 0 11px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit; outline: none;
  transition: border .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 9px 11px; min-height: 84px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder { color: var(--text-faint); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.segmented-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-weight: 600; font-size: 12.5px; color: var(--text-body); cursor: pointer; }
.choice.on { border-color: var(--brand); background: var(--brand-softer); color: var(--brand); }

/* Dropdown menu */
.menu {
  position: absolute; z-index: 200; min-width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  padding: 6px; transform-origin: top right; animation: pop .12s ease forwards;
}
.menu .mi { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-body); font-weight: 500; }
.menu .mi:hover { background: var(--surface-hover); color: var(--text); }
.menu .mi svg { width: 16px; height: 16px; color: var(--text-muted); }
.menu .mi.danger { color: var(--danger-fg); }
.menu .mi.danger svg { color: var(--danger-fg); }
.menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-head { padding: 8px 10px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }

/* Notifications panel */
.notif { padding: 12px; display: flex; gap: 11px; border-radius: var(--radius); }
.notif:hover { background: var(--surface-hover); }
.notif .nic { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.notif .nic svg { width: 15px; height: 15px; }
.notif .nt { font-size: 12.5px; color: var(--text); font-weight: 600; }
.notif .ns { font-size: 12px; color: var(--text-muted); }
.notif .nm { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* Toasts */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 300px; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); padding: 13px 14px; display: flex; gap: 11px; align-items: flex-start;
  transform: translateX(20px); opacity: 0; animation: toastin .22s cubic-bezier(.2,.8,.2,1) forwards;
}
.toast.out { animation: toastout .2s forwards; }
@keyframes toastin { to { transform: none; opacity: 1; } }
@keyframes toastout { to { transform: translateX(20px); opacity: 0; } }
.toast .tic { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.toast .tic svg { width: 16px; height: 16px; }
.toast .tt { font-size: 13px; font-weight: 650; color: var(--text); }
.toast .tsx { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* Command palette */
.cmdk { width: 100%; max-width: 600px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); overflow: hidden; transform: translateY(-6px); animation: pop .16s forwards; align-self: flex-start; margin-top: 10vh; }
.cmdk-inp { display: flex; align-items: center; gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--border); }
.cmdk-inp svg { width: 18px; height: 18px; color: var(--text-muted); }
.cmdk-inp input { flex: 1; border: none; background: transparent; outline: none; font-size: 15px; color: var(--text); font-family: inherit; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; color: var(--text-body); }
.cmdk-item .ci { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-muted); flex: none; }
.cmdk-item .ci svg { width: 16px; height: 16px; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--brand-softer); color: var(--brand); }
.cmdk-item.sel .ci, .cmdk-item:hover .ci { background: var(--brand-soft); color: var(--brand); }
.cmdk-item .cg { margin-left: auto; font-size: 11px; color: var(--text-faint); }

/* misc */
.muted { color: var(--text-muted); }
.strong { color: var(--text); font-weight: 650; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline .si .v { font-size: 21px; font-weight: 700; color: var(--text); }
.stat-inline .si .l { font-size: 12px; color: var(--text-muted); }
.hoverable:hover { background: var(--surface-2); }
.link { color: var(--brand); font-weight: 600; }
.link:hover { text-decoration: underline; }

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* framework logo tiles */
.fw-tile { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; letter-spacing: -.02em; flex:none; }

/* trust center public look */
.tc-hero { border-radius: var(--radius-lg); padding: 34px; background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: #fff; }
.tc-hero h2 { color: #fff; font-size: 24px; }

/* responsive: the icon rail is only 68px, so it stays at every width */
@media (max-width: 760px){
  .topbar-search { display: none; }
  .chip-ctx span:not(.tav) { display: none; }
  .content { padding: 16px; }
}

/* ============================================================
   Two-level icon rail + hover/click flyout
   ============================================================ */
/* --- dark icon rail (area selector) --- */
.rail {
  background: var(--rail-bg); border-right: 1px solid var(--rail-border);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: sticky; top: 5px; height: calc(100vh - 5px); width: 56px; flex: none; padding: 10px 0; z-index: 50;
}
.rail-logo { width: 34px; height: 34px; border-radius: 9px; margin-bottom: 10px; flex: none; cursor: pointer; }
.rail-scroll { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; overflow-y: auto; overflow-x: visible; }
.rail-scroll::-webkit-scrollbar { width: 0; }
.rail-icon {
  width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center; position: relative;
  background: transparent; border: none; color: var(--rail-icon); transition: background .15s, color .15s; flex: none;
}
.rail-icon svg { width: 22px; height: 22px; }
.rail-icon:hover { background: var(--rail-hover); color: #fff; }
.rail-icon.active { background: var(--brand); color: #fff; }
.rail-icon .rdot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--rail-bg); }
.rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding-top: 8px; }
.rail-avatar { cursor: pointer; box-shadow: 0 0 0 2px var(--rail-border); }

/* --- always-on left nav panel (shows the active area's items) --- */
.leftnav {
  width: var(--leftnav-w, 244px); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 5px; height: calc(100vh - 5px); overflow: hidden;
  transition: width .18s cubic-bezier(.2,.8,.2,1), opacity .12s;
}
.app.nav-collapsed .leftnav { width: 0; border-right: none; opacity: 0; }

/* drag handle to resize the left nav vs. main */
.nav-resizer {
  flex: none; width: 8px; margin: 0 -4px; cursor: col-resize; position: sticky; top: 5px; height: calc(100vh - 5px);
  z-index: 46; align-self: stretch;
}
.nav-resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 2px; background: transparent; transition: background .12s;
}
.nav-resizer:hover::after, .app.resizing .nav-resizer::after { background: var(--brand); }
.app.nav-collapsed .nav-resizer { display: none; }
.app.resizing { cursor: col-resize; user-select: none; }
.app.resizing .leftnav { transition: none; }
.app.resizing iframe { pointer-events: none; }
.leftnav-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.leftnav-head .wm { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-weight: 600; font-size: 20px; color: var(--text); letter-spacing: 0; }
.leftnav-head .collapse { margin-left: auto; }
/* redundant with the topbar panel toggle (#nav-expand) — kept in the DOM but hidden */
#nav-collapse { display: none; }
.leftnav-profile {
  margin: 0 12px 12px; display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.leftnav-profile:hover { border-color: var(--border-strong); }
.leftnav-profile .meta { min-width: 0; flex: 1; }
.leftnav-profile .meta .nm { font-weight: 600; color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leftnav-profile .meta .rl { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leftnav-profile .chev { color: var(--text-faint); flex: none; }
.leftnav-scroll { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-area-label { text-transform: uppercase; letter-spacing: .06em; padding: 8px 12px 8px; font-size: 11px; font-weight: 600; color: var(--text-faint); }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  color: var(--text-body); font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-link svg { width: 20px; height: 20px; color: var(--text-muted); flex: none; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.active { background: var(--brand-softer); color: var(--brand-strong); font-weight: 600; }
.nav-link.active svg { color: var(--brand); }
.nav-link .count { margin-left: auto; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; }
.nav-link .count.alert { background: var(--danger); }
.nav-link .lock { margin-left: auto; color: var(--text-faint); }

/* flyout panel that appears next to a rail icon */
.flyout {
  position: fixed; z-index: 90; min-width: 214px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  padding: 8px; transform-origin: left center; animation: flyin .12s ease forwards;
}
@keyframes flyin { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
.flyout .fly-head { padding: 6px 10px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.fly-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-body); font-weight: 500; white-space: nowrap; }
.fly-item svg { width: 17px; height: 17px; color: var(--text-muted); flex: none; }
.fly-item:hover { background: var(--surface-hover); color: var(--text); }
.fly-item.active { background: var(--brand-softer); color: var(--brand); font-weight: 600; }
.fly-item.active svg { color: var(--brand); }
.fly-item .count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--text-muted); }
.fly-item .count.alert { background: var(--danger-medium); color: var(--danger-fg); }
.fly-item .lock { margin-left: auto; color: var(--text-faint); }

/* topbar workspace / role chips */
.chip-ctx { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; }
.chip-ctx:hover { border-color: var(--border-strong); }
.chip-ctx .tav { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: none; }
.chip-ctx svg { width: 15px; height: 15px; color: var(--text-muted); }
.viewas { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 11px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 650; }
.viewas.auditor { background: var(--success-soft); color: var(--success-fg); border: 1px solid var(--success-border); }
.viewas.employee { background: var(--warning-soft); color: var(--warning-strong); border: 1px solid var(--warning-border); }
.viewas.contributor { background: var(--purple-soft); color: var(--purple); border: 1px solid color-mix(in srgb, var(--purple) 30%, transparent); }
.viewas .exit { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.viewas .exit:hover { background: #ffffff40; }
.viewas .exit svg { width: 13px; height: 13px; }

/* menu with subtitle rows (tenant / role switchers) */
.menu .mi.two { align-items: flex-start; }
.menu .mi.two .ml { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.menu .mi.two .ml .s { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.menu .mi.two.on { background: var(--brand-softer); }
.menu .mi .tav { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: none; }
.menu .mi .chk { margin-left: auto; color: var(--brand); flex: none; }

/* ============================================================
   Footer + Powered-by badge
   ============================================================ */
.app-footer {
  border-top: 1px solid var(--border); height: 56px; min-height: 56px; padding: 0 24px; display: flex; align-items: center; gap: 14px;
  color: var(--text-muted); font-size: 12.5px; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap;
}
.app-footer > * { flex: none; }
.app-footer .spacer { flex: 1; }
.app-footer .made { display: inline-flex; align-items: center; gap: 5px; }
.app-footer .made svg { width: 14px; height: 14px; color: var(--danger); fill: var(--danger); }
.app-footer a { color: var(--text-muted); font-weight: 550; }
.app-footer a:hover { color: var(--text); }
.app-footer .fdot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.app-footer .spacer { flex: 1; }
.powered {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 7px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 11.5px; font-weight: 650;
}
.powered img { width: 20px; height: 20px; border-radius: 5px; background: var(--rail-bg); padding: 2px; }
.powered b { color: var(--text); font-weight: 700; }
.powered.on-dark { background: #ffffff1a; border-color: #ffffff33; color: #ffffffcc; }
.powered.on-dark b { color: #fff; }

/* utility spacing */
.mt-0{margin-top:0}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-0{margin-bottom:0}.mb-8{margin-bottom:8px}.mb-16{margin-bottom:16px}
.gap-6{gap:6px}.gap-16{gap:16px}
.f-1{flex:1}.tar{text-align:right}.tac{text-align:center}
.fs-12{font-size:12px}.fs-13{font-size:13px}
.nowrap{white-space:nowrap}
