/* SYNGORA — shared interface styles */
@font-face { font-family: Plex; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Plex; src: url(fonts/ibm-plex-sans-latin-400-italic.woff2) format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: Plex; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Plex; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: PlexCond; src: url(fonts/ibm-plex-sans-condensed-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: PlexCond; src: url(fonts/ibm-plex-sans-condensed-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --ink: #13293D;
  --ink-2: #3C5266;
  --ink-3: #6B7F90;
  --canvas: #EDF0F2;
  --surface: #FFFFFF;
  --line: #D4DBE0;
  --line-2: #E6EBEE;
  --ok: #2F7D5B;     --ok-bg: #E2F1E9;
  --warn: #A86A12;   --warn-bg: #FBEFD9;
  --breach: #B42318; --breach-bg: #FBE4E1;
  --nodata: #8C9AA5;
  --brand: #0F3D5E;
  --focus: #2B6CB0;
  --r-s: 4px; --r-m: 8px;
  --font: Plex, "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: PlexCond, "IBM Plex Sans Condensed", var(--font);
  --hatch: repeating-linear-gradient(135deg, transparent 0 5px, rgba(108,127,144,.28) 5px 6px);
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--canvas); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.25; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 .6rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .4rem; }
p { margin: 0 0 .75rem; max-width: 72ch; }
small, .muted { color: var(--ink-3); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail { background: var(--ink); color: #D7E1E8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail .ident { padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; gap: 12px; align-items: center; }
.rail .ident img { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: var(--r-s); padding: 3px; }
.rail .mark { width: 36px; height: 36px; border-radius: var(--r-s); background: var(--brand); display: grid; place-items: center; font-weight: 600; color: #fff; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.rail .ident .on { font-weight: 600; color: #fff; line-height: 1.2; font-size: .95rem; }
.rail .ident .sub { font-size: .78rem; color: #9FB2C1; }
.rail nav { padding: 10px 8px 24px; }
.rail .grp { font-size: .75rem; color: #8DA3B4; padding: 16px 12px 6px; }
.rail a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; color: #D7E1E8; border-radius: var(--r-s); font-size: .92rem; }
.rail a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.rail a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--brand-light, #7FB2D9); }
.rail a .count { margin-left: auto; font-family: var(--num); font-size: .8rem; background: var(--breach); color: #fff; padding: 0 7px; border-radius: 9px; }
.rail .foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: #9FB2C1; }
.rail .foot b { color: #fff; font-weight: 500; display: block; }
.rail .foot button { all: unset; cursor: pointer; color: #C9D6E0; text-decoration: underline; margin-top: 4px; }
.rail .product { font-size: .72rem; color: #6F889B; margin-top: 10px; }

main { min-width: 0; }
.topbar { height: 6px; background: var(--brand); }
.page { padding: 28px 36px 64px; max-width: 1440px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead .lede { color: var(--ink-2); margin-top: 6px; }
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; }
  .page { padding: 18px 16px 48px; }
  .menu-btn { display: inline-flex; position: fixed; right: 12px; top: 14px; z-index: 60; }
}

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel .phead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.panel .phead h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .g2, .g3 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- KPI blocks (status left edge; hatch for no data) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--nodata); border-radius: var(--r-s); padding: 12px 14px 10px; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; display: flex; flex-direction: column; gap: 4px; min-height: 132px; }
.kpi:hover { border-color: var(--ink-3); }
.kpi.ok { border-left-color: var(--ok); }
.kpi.warning { border-left-color: var(--warn); }
.kpi.breach { border-left-color: var(--breach); }
.kpi .kname { font-size: .88rem; font-weight: 500; line-height: 1.3; }
.kpi .kval { font-family: var(--num); font-size: 2rem; font-weight: 600; line-height: 1.05; letter-spacing: -.01em; }
.kpi .kval small { font-size: .9rem; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.kpi .kfoot { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: .78rem; color: var(--ink-3); }
.kpi .kfoot .spark { margin-left: auto; }
.nodata-val { display: inline-block; background: var(--hatch); color: var(--ink-2); font-family: var(--font); font-size: .85rem; font-weight: 500; padding: 4px 10px; border-radius: var(--r-s); border: 1px dashed var(--nodata); }
.mtype { font-size: .72rem; padding: 0 6px; border-radius: 3px; border: 1px solid currentColor; line-height: 1.5; white-space: nowrap; }
.mtype.compliance { color: #1D5C8C; } .mtype.maturity { color: #6A4C93; } .mtype.exposure { color: #9A3B1F; }
.mtype.effectiveness { color: #2F6B4F; } .mtype.completeness { color: #6B6A1F; } .mtype.performance { color: #2C5F73; } .mtype.timeliness { color: #8A4B08; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-3); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 5px; }

/* status chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; padding: 1px 8px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; font-weight: 500; }
.chip.ok, .chip.approved, .chip.clean { background: var(--ok-bg); color: var(--ok); }
.chip.warning, .chip.submitted, .chip.pending, .chip.returned, .chip.invited, .chip.pending_parent_approval { background: var(--warn-bg); color: var(--warn); }
.chip.breach, .chip.rejected, .chip.overdue, .chip.infected, .chip.critical, .chip.disabled, .chip.suspended { background: var(--breach-bg); color: var(--breach); }
.chip.no_data { background: var(--hatch), #F3F5F6; color: var(--ink-2); }
.chip.high { background: #FCE9DC; color: #A1420F; }
.sev { font-size: .78rem; font-weight: 500; }
.sev.critical { color: var(--breach); } .sev.high { color: #A1420F; } .sev.medium { color: var(--warn); } .sev.low, .sev.info { color: var(--ink-3); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: .8rem; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #F7F9FA; white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #F5F8FA; }
table.t td.n, table.t th.n { text-align: right; font-family: var(--num); font-variant-numeric: tabular-nums; }
table.t .title { font-weight: 500; }
table.t .ref { color: var(--ink-3); font-size: .8rem; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.empty p { margin: 0 auto 12px; }

/* bars for named comparisons */
.bars { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 70px; gap: 6px 12px; align-items: center; font-size: .88rem; }
.bars .track { height: 14px; background: var(--line-2); border-radius: 2px; position: relative; overflow: hidden; }
.bars .fill { height: 100%; background: var(--ink-2); }
.bars .fill.ok { background: var(--ok); } .bars .fill.warning { background: var(--warn); } .bars .fill.breach { background: var(--breach); }
.bars .track.nd { background: var(--hatch), #F3F5F6; }
.bars .target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }

/* ---------- forms ---------- */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--ink-2); font-weight: 500; }
label.f.req > span::after { content: " *"; color: var(--breach); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #BAC5CD; border-radius: var(--r-s); padding: 7px 10px; min-height: 36px; width: 100%; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: auto; min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.form .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 16px 16px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: .9rem; padding: 7px 14px; min-height: 36px; border-radius: var(--r-s); border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #0B1D2C; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: #AEBAC3; }
.btn.secondary:hover { background: #F2F5F7; }
.btn.danger { background: #fff; color: var(--breach); border-color: #E3A6A0; }
.btn.good { background: var(--ok); border-color: var(--ok); }
.btn.small { padding: 3px 10px; min-height: 28px; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { all: unset; cursor: pointer; padding: 8px 14px; font-size: .9rem; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.tabs button:focus-visible { outline: 2px solid var(--focus); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 20px; border-bottom: 1px solid var(--line-2); background: #FAFBFC; }
.filters label.f { min-width: 150px; }
.errors { background: var(--breach-bg); color: var(--breach); padding: 10px 14px; border-radius: var(--r-s); font-size: .88rem; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }
.note { background: #EEF3F7; border-left: 3px solid var(--ink-3); padding: 10px 14px; font-size: .86rem; color: var(--ink-2); border-radius: 0 var(--r-s) var(--r-s) 0; }
.locked { background: var(--warn-bg); border-left-color: var(--warn); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(19,41,61,.35); z-index: 80; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100%); background: var(--surface); z-index: 90; overflow-y: auto; box-shadow: -8px 0 32px rgba(19,41,61,.18); display: flex; flex-direction: column; }
.drawer .dhead { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; position: sticky; top: 0; background: #fff; z-index: 1; }
.drawer .dbody { padding: 18px 22px 40px; }
.x { all: unset; cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--ink-3); padding: 2px 6px; margin-left: auto; }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; }

/* toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r-s); z-index: 100; font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--breach); }

/* auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
.auth .side { background: var(--ink); color: #DCE5EC; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .side .wordmark { font-weight: 600; font-size: 1.25rem; color: #fff; letter-spacing: .02em; }
.auth .side h1 { color: #fff; font-size: 2.4rem; max-width: 15ch; line-height: 1.12; font-weight: 500; }
.auth .side p { color: #A9BCCB; max-width: 46ch; margin-top: 14px; }
.auth .side .lattice { position: absolute; right: -40px; bottom: -40px; opacity: .5; }
.auth .formside { background: #fff; padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth form { display: grid; gap: 14px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth .side { padding: 32px 24px; min-height: 0; } .auth .side h1 { font-size: 1.7rem; } .auth .side .lattice { display: none; } .auth .formside { padding: 32px 24px; } }

.colorpick { display: flex; gap: 8px; align-items: center; }
.colorpick input[type=color] { width: 44px; padding: 2px; }
.swatch { width: 18px; height: 18px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); display: inline-block; vertical-align: middle; }
.logo-prev { height: 44px; max-width: 160px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r-s); padding: 4px; background: #fff; }
.mod-toggle { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.mod-toggle:last-child { border-bottom: 0; }
.mod-toggle .line { font-size: .75rem; color: var(--ink-3); margin-left: auto; }
.pill-line { font-size: .75rem; color: var(--ink-3); }
.matrix td.cell { text-align: center; }
.hint { font-size: .8rem; color: var(--ink-3); font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* layout fixes */
.shell > div { min-width: 0; }
.btn.menu-btn { display: none; }
@media (max-width: 900px) { .btn.menu-btn { display: inline-flex; } }
label.f.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); align-self: end; min-height: 36px; }
input:disabled, select:disabled, textarea:disabled { background: #F3F5F6; color: var(--ink-2); border-color: var(--line); cursor: not-allowed; opacity: 1; -webkit-text-fill-color: var(--ink-2); }
.kpis { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.kpi .kfoot { flex-wrap: wrap; row-gap: 4px; }
.kpi .kfoot > span:not(.spark) { white-space: nowrap; }
