/* Brand fonts (self-hosted, SIL Open Font License). Used when a project's brand selects them. */
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("/fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url("/fonts/space-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("/fonts/space-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  /* Brand variables — overridden per project at runtime (see lib.js applyBrand). Defaults: KISOS. */
  --ink: #0B1A2E;          /* dark brand color: sidebar, hero, primary buttons */
  --ink-2: #13253F;
  --ink-3: #1D3352;
  --accent: #0E7FB0;       /* brand accent */
  --accent-ink: #0B6A94;   /* accent darkened for text on light backgrounds */
  --accent-soft: #E3F1F8;
  --accent-on-dark: #3BC3F0;
  --signal: #D41F2A;
  --signal-soft: #FCE9EA;
  --spark: #FDC81A;
  --paper: #F3F5F8;
  --card: #FFFFFF;
  --line: #DCE2EA;
  --line-2: #E9EDF2;
  --text: #1B2433;
  --slate: #3A4556;
  --muted: #6B7684;
  --gold: #8A6A1F;
  --gold-soft: #F6EFDD;
  --lib: #455161;
  --lib-soft: #E9EDF2;
  --ok: #1E8E5A;
  --ok-soft: #E3F4EB;
  --warn: #9A5B05;
  --warn-soft: #FDF2DF;
  --radius: 10px;
  --head: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(11, 26, 46, .05), 0 6px 18px rgba(11, 26, 46, .05);
}
body.font-kisos { --head: "Space Grotesk", system-ui, sans-serif; --sans: "IBM Plex Sans", system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--sans); color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--head); font-weight: 700; color: var(--ink); letter-spacing: -.015em; margin: 0; }
h1 { font-size: 28px; line-height: 1.15; } h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
button { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 6px; }
.signal { color: var(--signal); font-weight: 600; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #C3CDDC; display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; flex-direction: column; gap: 4px; padding: 2px 10px 18px; color: #fff; }
.brand img.logo { height: 26px; width: auto; max-width: 180px; object-fit: contain; object-position: left; }
.brand .wordmark { font-family: var(--head); font-weight: 700; font-size: 19px; letter-spacing: .01em; color: #fff; }
.brand small { color: var(--accent-on-dark); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 10px; color: #C3CDDC; padding: 8px 10px; border-radius: 8px; margin: 1px 0; }
.nav a:hover { background: var(--ink-2); text-decoration: none; color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #7F90AA; padding: 16px 10px 4px; font-weight: 700; }
.nav .count { margin-left: auto; background: var(--spark); color: var(--ink); border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.switcher { margin: 0 6px 10px; }
.switcher select { width: 100%; background: var(--ink-2); color: #fff; border: 1px solid var(--ink-3); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 12.5px; }
.side .me { margin-top: auto; border-top: 1px solid var(--ink-3); padding: 12px 10px 0; font-size: 12px; }
.side .me b { color: #fff; display: block; font-size: 13px; }
.side .me button { margin-top: 8px; }
.main { padding: 28px 36px 64px; min-width: 0; }
.demo-banner { background: var(--warn-soft); color: #6b4300; border: 1px solid #F1D7A3; padding: 6px 12px; border-radius: 8px; font-size: 12px; margin-bottom: 18px; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #C4CCD7; background: #FAFBFC; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-3); }
.btn.accent { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.danger { color: var(--signal); border-color: #F2C3C6; }
.btn.danger.solid { background: var(--signal); color: #fff; border-color: var(--signal); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(11, 26, 46, .05); }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.dark { background: transparent; color: #C3CDDC; border-color: var(--ink-3); }
.btn.dark:hover { background: var(--ink-2); color: #fff; }
.btn.google { background: #fff; color: #1f1f1f; border-color: #DADCE0; width: 100%; justify-content: center; padding: 9px 12px; font-weight: 600; }
label.f { display: block; font-weight: 600; font-size: 12px; color: var(--slate); margin-bottom: 4px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #CDD5DF; border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea.input { min-height: 72px; resize: vertical; }
.field + .field { margin-top: 12px; }
.row > .field + .field { margin-top: 0; }
.card .row + .field, .card .field + .row, .card .row + .row, .modal .row + .field, .modal .field + .row, .modal .row + .row { margin-top: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.code-input { font-family: var(--mono); font-size: 22px; letter-spacing: .35em; text-align: center; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid #CDD5DF; border-radius: 8px; background: #fff; }

/* ---------- Cards, chips, tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.card.dark { background: var(--ink); border-color: var(--ink); color: #C3CDDC; }
.card.dark h3 { color: #fff; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.room-card { padding: 16px 18px; cursor: pointer; transition: transform .08s, box-shadow .12s; display: block; color: inherit; }
.room-card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(11, 26, 46, .10); text-decoration: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #EDF0F4; color: var(--slate); white-space: nowrap; }
.chip.teal, .chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.brass, .chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip.lib { background: var(--lib-soft); color: var(--lib); }
.chip.red { background: var(--signal-soft); color: var(--signal); }
.chip.amber { background: var(--warn-soft); color: var(--warn); }
.chip.green { background: var(--ok-soft); color: var(--ok); }
.chip.ink { background: var(--ink); color: #fff; }
.chip.stage { background: #fff; border: 1px solid var(--line); color: var(--slate); }
.label-signed { background: var(--ok-soft); color: var(--ok); }
.label-proposed { background: var(--gold-soft); color: var(--gold); }
.label-pipeline { background: #EDF0F4; color: var(--slate); }
.label-modeled { background: var(--accent-soft); color: var(--accent-ink); }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.dim td { opacity: .55; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-family: var(--head); font-size: 26px; color: var(--ink); line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- Space ---------- */
.space-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.space-head .crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--signal); font-weight: 600; }
.tabs .count { background: var(--spark); color: var(--ink); border-radius: 99px; font-size: 10.5px; padding: 0 6px; margin-left: 4px; font-weight: 700; }
.files-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.tree { padding: 10px 6px; position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow: auto; }
.tree .zone { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; padding: 10px 10px 4px; display: flex; align-items: center; gap: 6px; }
.tree .zone.internal { color: var(--gold); }
.tree .zone.portal { color: var(--accent-ink); }
.tree .zone.library { color: var(--lib); }
.tree a { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 6px; color: var(--text); font-size: 13px; }
.tree a:hover { background: #F2F4F7; text-decoration: none; }
.tree a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.tree a.internal.on { background: var(--gold-soft); color: var(--gold); }
.tree a.library.on { background: var(--lib-soft); color: var(--lib); }
.tree .stg { margin-left: auto; font-size: 10px; color: var(--muted); font-weight: 700; }
.locked { margin: 10px 6px 4px; padding: 10px; border: 1px dashed #C6CFDA; border-radius: 8px; font-size: 12px; color: var(--muted); }
.locked .ls { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.zone-banner { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-radius: 8px; font-size: 12.5px; margin-bottom: 12px; }
.zone-banner.internal { background: var(--gold-soft); color: #5F4812; border: 1px solid #EADBB4; }
.zone-banner.portal { background: var(--accent-soft); color: #0B4F6E; border: 1px solid #C2DFEE; }
.zone-banner.library { background: var(--lib-soft); color: var(--slate); border: 1px solid #D5DCE5; }
.zone-banner.inbox { background: #EEF2FF; color: #26387E; border: 1px solid #CCD5F5; }
.list-row { display: grid; grid-template-columns: 28px 1fr 100px 150px auto; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #FAFBFC; }
.list-row .name { font-weight: 500; cursor: pointer; }
.list-row > * { min-width: 0; }
.list-row .fname { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.list-row .fname .name { display: block; }
.list-row .fname .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.list-row .fname .chips:empty { display: none; }
.list-row .name:hover { color: var(--accent-ink); }
.list-head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; background: #FAFBFC; border-radius: var(--radius) var(--radius) 0 0; }
.drop { border: 2px dashed #B8CFE0; border-radius: var(--radius); padding: 18px; text-align: center; color: #255B78; background: #F7FBFD; margin-bottom: 12px; }
.drop .exposure { margin-top: 6px; color: var(--ink); font-weight: 500; }
.drop.over { background: var(--accent-soft); border-color: var(--accent); }
.receipt { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.flag { display: flex; gap: 8px; align-items: flex-start; padding: 6px 10px; border-radius: 6px; font-size: 12.5px; }
.flag.esc { background: var(--signal-soft); color: #7A1218; }
.flag.info { background: #F1F3F6; color: var(--slate); }
.req-card { padding: 16px 18px; }
.req-card + .req-card { margin-top: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- Ask ---------- */
.ask-box { display: flex; gap: 8px; }
.ask-box .input { font-size: 15px; padding: 11px 14px; }
.answer { padding: 18px 20px; }
.answer p { margin: 0 0 8px; }
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 10.5px; font-weight: 700; margin: 0 2px; cursor: pointer; vertical-align: 1px; }
.unsupported { background: var(--signal-soft); border-radius: 4px; }
.source { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.source .n { width: 24px; height: 24px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
mark { background: #FFF1B8; color: inherit; padding: 0 1px; border-radius: 2px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suggest button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 12.5px; color: var(--slate); }
.suggest button:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Statements ---------- */
.att { padding: 16px 18px; }
.att + .att { margin-top: 12px; }
.att .stmt { font-family: var(--head); font-size: 17px; color: var(--ink); font-weight: 600; line-height: 1.35; }
.seal { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); font-weight: 600; }

/* ---------- Modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(11, 26, 46, .5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { width: min(820px, 100%); }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.modal .body { padding: 18px 20px; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; background: #FAFBFC; border-radius: 0 0 12px 12px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 200; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--signal); }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.alert.err { background: var(--signal-soft); color: #7A1218; border: 1px solid #F2C3C6; }
.alert.warn { background: var(--warn-soft); color: #5F3A03; border: 1px solid #F1D7A3; }
.alert.ok { background: var(--ok-soft); color: #0F5135; border: 1px solid #B9E2CB; }
.alert.info { background: var(--accent-soft); color: #0B4F6E; border: 1px solid #C2DFEE; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--ink); color: #B9C6D6; padding: 52px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .eyebrow { color: var(--accent-on-dark); }
.login-art h1 { color: #F3F5F8; font-size: 40px; line-height: 1.1; max-width: 520px; letter-spacing: -.02em; }
.login-art .lead { font-size: 16px; max-width: 520px; margin: 18px 0 0; color: #B9C6D6; }
.login-art .lead .signal { color: #FF4B4B; }
.login-art ul { list-style: none; padding: 0; margin: 30px 0 0; max-width: 520px; }
.login-art li { display: flex; gap: 12px; margin: 14px 0; color: #B9C6D6; }
.login-art li svg { flex: none; margin-top: 2px; color: var(--accent-on-dark); }
.login-art .foot { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #8FA2B8; }
.login-art img.logo { height: 30px; width: auto; max-width: 220px; object-fit: contain; object-position: left; }
.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-box { width: min(410px, 100%); }
.login-box h2 { margin-bottom: 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.qr { display: block; margin: 10px auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.persona { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; margin-top: 6px; }
.persona:hover { border-color: var(--accent); }
.avatar { width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; color: #fff; background: #4B5F7A; }
.avatar.ext { background: var(--accent-ink); }
.avatar.sec { background: var(--signal); }

/* ---------- Protected viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 100; background: #262C37; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.viewer .vbar { background: var(--ink); color: #E6E9EF; display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.viewer .vbar .title { font-weight: 600; }
.viewer .vbar .lock { color: var(--accent-on-dark); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.viewer .pages { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.viewer .page { position: relative; background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
.viewer canvas { display: block; }
.viewer .wm-live { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.viewer .wm-live span { position: absolute; font: 600 13px var(--sans); color: rgba(11, 26, 46, .09); transform: rotate(-28deg); white-space: nowrap; }
.viewer.shielded .pages { filter: blur(28px) grayscale(1); }
.viewer .shield { position: absolute; inset: 56px 0 0; display: grid; place-items: center; color: #fff; text-align: center; z-index: 3; pointer-events: none; }
.viewer .shield div { background: rgba(8, 14, 24, .88); padding: 18px 24px; border-radius: 10px; max-width: 420px; }
.viewer .status { color: #C7CCD6; padding: 60px; text-align: center; }

@media print {
  body * { display: none !important; }
  body::before { content: "Printing is disabled for protected data room content."; display: block; font: 16px sans-serif; padding: 40px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .files-layout { grid-template-columns: 1fr; }
  .tree { position: static; max-height: none; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .list-row { grid-template-columns: 28px 1fr auto; }
  .list-row .c-size, .list-row .c-date { display: none; }
  .main { padding: 18px; }
}
