/* OCF Data Room — OCF house style, light (single-theme by design). */

:root {
  /* OCF brand book 2025 (as Mirage and DueDil): navy on paper, copper accent,
     Cormorant Garamond headings, Manrope text — self-hosted, the CSP allows nothing else. */
  --ink:        #f9f6f4;   /* page background */
  --ink-2:      #ffffff;
  --panel:      #ffffff;
  --panel-2:    #faf8f6;
  --rule:       #e5e0dc;
  --rule-soft:  #eeebe8;
  --fg:         #1e2537;
  --fg-dim:     #6b7280;
  --fg-faint:   #9ca3af;
  --gold:       #9f5a2e;   /* OCF copper (brand book) — white button text passes AA */
  --gold-br:    #913f0d;
  --gold-dim:   #b8794a;
  --jade:       #1f6b45;
  --jade-dim:   #185a39;
  --danger:     #9a3324;
  --warn:       #a96a12;
  --ok:         #1f6b45;
  --navy:       #020626;
  --shadow:     0 1px 2px rgba(2,6,38,.06), 0 4px 16px rgba(2,6,38,.05);
  --radius:     10px;
  --font:       "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:       ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@font-face { font-family: 'Cormorant Garamond'; src: url('/assets/fonts/cormorant-garamond.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/assets/fonts/manrope.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ink);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-br); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; line-height: 1.2; text-wrap: balance; }
h1, h2 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; color: var(--navy); }
h1 { font-size: 1.95rem; }
h1 { font-size: 1.6rem; margin: 0 0 .35rem; }
h2 { font-size: 1.15rem; margin: 1.8rem 0 .8rem; }
small { color: var(--fg-dim); }

/* ---- App shell ---------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column; padding: 1.1rem .9rem;
  position: sticky; top: 0; height: 100vh;
}
.brandmark { display: flex; align-items: center; gap: .6rem; padding: .3rem .4rem 1.1rem; }
.brandmark__logo { width: 36px; height: 36px; object-fit: contain; flex: 0 0 auto; }
.brandmark__text { font-weight: 600; display: flex; flex-direction: column; line-height: 1.1; }
.brandmark__text small { color: var(--fg-faint); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; font-size: .62rem; }
.nav { display: flex; flex-direction: column; gap: .12rem; flex: 1; }
.nav a {
  color: var(--fg-dim); padding: .55rem .7rem; border-radius: 8px; font-size: .92rem;
  display: flex; align-items: center; gap: .5rem;
}
.nav a:hover { background: var(--panel); color: var(--fg); text-decoration: none; }
.nav a.on { background: var(--panel-2); color: var(--fg); box-shadow: inset 3px 0 0 var(--gold); }
.side__foot { border-top: 1px solid var(--rule-soft); padding-top: .8rem; }
.whoami { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .5rem; }
.whoami__email { font-size: .8rem; color: var(--fg-dim); word-break: break-all; }
.side__links { display: flex; align-items: center; justify-content: space-between; }
.side__links a, .linkbtn { color: var(--fg-faint); font-size: .82rem; }
.linkbtn { background: none; border: 0; cursor: pointer; padding: 0; font: inherit; }
.linkbtn:hover { color: var(--gold-br); }
.inline { display: inline; }

.main { padding: 1.8rem 2rem 4rem; max-width: 1180px; width: 100%; }

/* ---- Auth card ---------------------------------------------------------- */
.authbody { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem;
  background: radial-gradient(1200px 500px at 50% -10%, #ffffff, var(--ink)); }
.authcard { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px;
  box-shadow: var(--shadow); padding: 2rem 1.8rem; width: 100%; max-width: 400px; }
.authcard__brand { display: flex; flex-direction: column; align-items: center; gap: .55rem; margin-bottom: 1.4rem; text-align: center; }
.authcard__logo { width: 88px; height: 88px; object-fit: contain; }
.authcard__logo--wide { width: 230px; height: auto; }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: .55rem; width: 100%;
  background: var(--navy); color: #fff; border-radius: 8px; padding: .7rem 1rem; font-weight: 600; }
.sso-btn:hover { text-decoration: none; background: #131530; }
.sso-btn img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.sso-or { display: flex; align-items: center; gap: .7rem; color: var(--fg-faint); font-size: .85rem; margin: 1.1rem 0 .4rem; }
.sso-or::before, .sso-or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.authcard__name strong { display: block; font-size: 1.02rem; }
.authcard__name small { color: var(--fg-faint); text-transform: uppercase; letter-spacing: .1em; font-size: .62rem; }
.authcard h1 { font-size: 1.25rem; }
.authcard__foot { color: var(--fg-faint); font-size: .74rem; margin: 1.4rem 0 0; text-align: center; }

/* 2FA enrolment QR (rendered client-side into #qr). */
.qr-box { display: grid; place-items: center; background: #fff; border-radius: 10px;
  padding: 10px; margin: .8rem auto; width: 212px; height: 212px; color: #666; font-size: .78rem; text-align: center; }
.qr-box svg { width: 190px; height: 190px; display: block; }

/* ---- Forms -------------------------------------------------------------- */
label { display: block; font-size: .82rem; color: var(--fg-dim); margin: .9rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; background: var(--ink-2); border: 1px solid var(--rule);
  color: var(--fg); padding: .6rem .7rem; border-radius: 8px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
textarea { min-height: 90px; resize: vertical; }
.hint { color: var(--fg-faint); font-size: .78rem; margin: .3rem 0 0; }
.bar { display: flex; gap: .6rem; align-items: center; margin-top: 1.2rem; flex-wrap: wrap; }

button, .btn {
  background: var(--gold); color: #ffffff; border: 0; padding: .6rem 1.1rem;
  border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
}
button:hover, .btn:hover { background: var(--gold-br); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--fg); border: 1px solid var(--rule); }
.btn--ghost:hover { background: var(--panel-2); }
.btn--jade { background: var(--jade); color: #052018; }
.btn--jade:hover { background: #63cfae; }
.btn--danger { background: transparent; color: var(--danger); border: 1px solid #f1c9c3; }
.btn--danger:hover { background: #2a1818; }
.btn--sm { padding: .35rem .7rem; font-size: .82rem; white-space: nowrap; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Panels / cards ----------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.lede { color: var(--fg-dim); margin: 0 0 1.3rem; max-width: 70ch; }
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Stat tiles --------------------------------------------------------- */
.stat { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat__n { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat__l { color: var(--fg-dim); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.stat--gold .stat__n { color: var(--gold-br); }
.stat--jade .stat__n { color: var(--jade); }

/* ---- Badges / roles / chips --------------------------------------------- */
/* Explicit background so a chip rendered as a <button> never inherits the gold
   button style (which made grey-on-gold, unreadable chips). */
.role, .tag, .badge { display: inline-block; font-size: .7rem; font-weight: 500; line-height: 1.5;
  padding: .12rem .55rem; border-radius: 999px; border: 1px solid var(--rule); background: var(--ink-2);
  color: var(--fg-dim); letter-spacing: .03em; white-space: nowrap; vertical-align: middle; }
button.tag, button.badge, button.role { cursor: pointer; font-family: inherit; }
/* Plain tags (manager allocations, category pills) read as light text on a subtle pill. */
.tag { color: var(--fg); background: var(--panel-2); }
button.tag:hover { border-color: var(--danger); color: var(--danger); background: var(--panel); }
.role--admin { color: var(--gold-br); border-color: #e3cfa8; background: #fbf0dd; }
.role--manager { color: var(--jade); border-color: #bfe0cd; background: #e7f3ec; }
.role--viewer { color: var(--fg-dim); }
.badge--ok { color: var(--ok); border-color: #bfe0cd; }
.badge--warn { color: var(--warn); border-color: #ecd6ad; }
.badge--bad { color: var(--danger); border-color: #f1c9c3; }
.badge--invited { color: var(--warn); border-color: #ecd6ad; }
.badge--active { color: var(--ok); border-color: #bfe0cd; }
.badge--suspended { color: var(--danger); border-color: #f1c9c3; }

/* ---- Chips (room / access tags, some with an inline remove) ------------- */
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--panel-2);
  border: 1px solid var(--rule); border-radius: 999px; padding: .2rem .6rem;
  font-size: .78rem; line-height: 1.3; margin: .15rem .25rem .15rem 0; white-space: nowrap; }
.chip strong { font-weight: 600; }
.chip__f { display: inline; margin: 0; }
.chip__x { background: transparent; border: 0; color: var(--fg-faint); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0; margin-left: .1rem; }
.chip__x:hover { color: var(--danger); }
.access-section { margin: 0 0 2rem; }
.access-section h2 { margin: 0 0 .7rem; }

/* ---- Tables ------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.tbl th { color: var(--fg-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tbl tr:hover td { background: var(--ink-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; }

/* ---- Flash -------------------------------------------------------------- */
.flash { padding: .7rem 1rem; border-radius: 8px; margin: 0 0 1rem; border: 1px solid var(--rule); font-size: .9rem; }
.flash--ok { background: #e7f3ec; border-color: #bfe0cd; color: #185a39; }
.flash--err { background: #fbe9e7; border-color: #f1c9c3; color: #8f2d22; }
.flash--info { background: #10202b; border-color: #244050; color: #a9cde0; }

.msg { padding: .7rem 1rem; border-radius: 8px; margin: .5rem 0; font-size: .9rem; border: 1px solid var(--rule); }
.msg.bad { background: #fbe9e7; border-color: #f1c9c3; color: #8f2d22; }
.msg.ok  { background: #e7f3ec; border-color: #bfe0cd; color: #185a39; }

/* ---- File / folder browser --------------------------------------------- */
.crumbs { display: flex; gap: .4rem; align-items: center; color: var(--fg-faint); font-size: .85rem; margin-bottom: 1rem; flex-wrap: wrap; }
.crumbs a { color: var(--fg-dim); }
.crumbs span.sep { color: var(--fg-faint); }

.rowitem { display: flex; align-items: center; gap: .8rem; }
.ficon { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; font-size: .66rem;
  font-weight: 700; letter-spacing: .02em; background: var(--panel-2); border: 1px solid var(--rule); color: var(--fg-dim); }
.ficon--pdf { color: #9a3324; border-color: #f1c9c3; }
.ficon--image { color: #7fc4ff; border-color: #1e3a4a; }
.ficon--doc { color: #8fb4ff; border-color: #22304a; }
.ficon--sheet { color: #86d6a6; border-color: #1e4030; }
.ficon--slides { color: #a96a12; border-color: #ecd6ad; }
.ficon--folder { color: var(--gold-br); border-color: #e3cfa8; background: #fbf0dd; }
.ficon--archive, .ficon--text, .ficon--file { color: var(--fg-dim); }
/* OCF — Confidential compartment: same square as the folder tiles, in red, with
   a diagonal "restricted" stroke across it. */
.ficon--ocf { color: var(--danger); border-color: #5a2420; background: #241010;
  position: relative; overflow: hidden; z-index: 0; }
/* Diagonal "restricted" stroke sits BEHIND the OCF letters (z-index:-1, above the
   tile background) so it marks the tile without cutting through the text. */
.ficon--ocf::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background: linear-gradient(to top right, transparent calc(50% - 1px),
    rgba(228,119,109,.5) calc(50% - 1px), rgba(228,119,109,.5) calc(50% + 1px), transparent calc(50% + 1px)); }

.dropzone { border: 2px dashed var(--rule); border-radius: var(--radius); padding: 1.4rem; text-align: center;
  color: var(--fg-dim); transition: .15s; }
.dropzone.drag { border-color: var(--gold); background: var(--panel); color: var(--fg); }

/* ---- Misc --------------------------------------------------------------- */
.toolbar { display: flex; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; flex-wrap: wrap; }
.toolbar__actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filterform { display: inline-flex; align-items: center; gap: .4rem; }
.filterform__label { font-size: .82rem; color: var(--fg-faint); white-space: nowrap; }
.filterform select { width: auto; max-width: 260px; padding: .35rem .6rem; font-size: .85rem; }
.muted { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .85em; }
.spacer { flex: 1; }
.empty { text-align: center; color: var(--fg-faint); padding: 2.5rem 1rem; }
.pill-row { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ---- Instruction manual (guide) ----------------------------------------- */
.manual { max-width: 880px; }
.manual h2 { border-top: 1px solid var(--rule); padding-top: 1.5rem; margin-top: 2.2rem; scroll-margin-top: 1rem; }
.manual p, .manual li { line-height: 1.7; }
.manual ol, .manual ul { padding-left: 1.3rem; }
.manual li { margin: .3rem 0; }
.manual code { background: var(--ink-2); border: 1px solid var(--rule-soft); border-radius: 4px; padding: .05rem .35rem; font-size: .9em; }
.manual .toc { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.2rem; margin: 1.2rem 0 1.8rem; }
.manual .toc strong { display: block; margin-bottom: .4rem; color: var(--fg-dim); text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.manual .toc a { display: block; padding: .18rem 0; font-size: .92rem; }
.manual figure { margin: 1.1rem 0 1.6rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 10px; }
.manual figure img { width: 100%; display: block; border-radius: 6px; border: 1px solid var(--rule-soft); }
.manual figcaption { color: var(--fg-dim); font-size: .82rem; margin-top: .55rem; text-align: center; }
.manual .callout { background: var(--ink-2); border-left: 3px solid var(--gold); padding: .7rem 1rem; border-radius: 6px; margin: 1.1rem 0; font-size: .92rem; color: var(--fg-dim); }

/* ---- In-browser PDF viewer (PDF.js canvas, view-only lock) -------------- */
.pdfview { max-height: 82vh; overflow: auto; background: #e7e2dd; padding: 14px 0; text-align: center; }
.pdfview .pdfpage { display: block; margin: 0 auto 14px; max-width: 100%; height: auto; box-shadow: 0 4px 16px rgba(0,0,0,.4); }

/* ---- In-browser .docx viewer (docx-preview) ----------------------------- */
.docxview { max-height: 82vh; overflow: auto; background: #e7e2dd; padding: 14px 0; }
.docxview .docx-wrapper { background: transparent; padding: 0; }
.docxview .docx { margin: 0 auto 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.docxview__loading, .docxview__fail { padding: 2.5rem 1rem; text-align: center; color: var(--fg-dim); background: var(--ink); }

/* ---- Impersonation ------------------------------------------------------ */
.imp-bar { display: flex; align-items: center; gap: .5rem; margin: 0 0 1.2rem; padding: .45rem .7rem;
  background: var(--panel); border: 1px dashed var(--rule); border-radius: 8px; flex-wrap: wrap; }
.imp-bar__label { color: var(--fg-dim); font-size: .82rem; font-weight: 600; }
.imp-bar select { max-width: 300px; width: auto; }
.imp-banner { display: flex; align-items: center; justify-content: space-between; gap: .9rem; flex-wrap: wrap;
  margin: 0 0 1.2rem; padding: .6rem .9rem; border-radius: 8px;
  background: #3a2a10; border: 1px solid #6b5020; color: #f3dca6; font-size: .9rem; }
.imp-banner--ro { background: #10242e; border-color: #22506a; color: #bfe0ef; }

.meter { height: 8px; background: var(--ink-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--rule); }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--jade-dim), var(--jade)); }

/* ---- Responsive --------------------------------------------------------- */
/* Mobile top bar + hamburger (hidden on desktop). */
.appbar { display: none; }
.appbar__burger { display: none; }
.side-backdrop { display: none; }

@media (max-width: 860px) {
  /* Top bar with the hamburger; the sidebar slides in over the content so the
     page keeps its full width instead of losing a margin to a docked menu. */
  .appbar {
    display: flex; align-items: center; gap: .7rem;
    position: sticky; top: 0; z-index: 40;
    padding: calc(env(safe-area-inset-top) + .55rem) 1rem .55rem;
    background: linear-gradient(180deg, var(--ink-2), rgba(11,17,22,.94));
    border-bottom: 1px solid var(--rule); backdrop-filter: saturate(1.3) blur(10px);
  }
  .appbar__burger {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 40px; height: 40px; flex: 0 0 auto; padding: 0 9px;
    background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; cursor: pointer;
  }
  .appbar__burger span { display: block; height: 2px; border-radius: 2px; background: var(--fg); transition: transform .2s, opacity .2s; }
  .appbar__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .appbar__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .appbar__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .appbar__brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; min-width: 0; }
  .appbar__brand img { width: 26px; height: 26px; object-fit: contain; flex: 0 0 auto; }
  .appbar__brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar__console { margin-left: auto; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; background: var(--panel); border: 1px solid var(--rule); color: var(--gold-br); }

  .shell { display: block; }
  .side {
    position: fixed; top: 0; left: 0; z-index: 60; height: 100vh; width: 270px; max-width: 84vw;
    flex-direction: column; align-items: stretch; padding: 1.1rem .9rem;
    transform: translateX(-100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
    overflow-y: auto; box-shadow: 2px 0 30px rgba(0,0,0,.5);
  }
  .side.open { transform: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(2,6,38,.35); }
  .side-backdrop[hidden] { display: none; }
  .nav { flex-direction: column; flex: 1; }

  .main { padding: 1.2rem 1rem 3rem; max-width: 100%; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  body.nav-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ---- The non-disclosure agreement ---------------------------------------
   The signing page is an auth-chain page like /login and /2fa, but it carries
   a whole contract rather than two fields, so it widens the card it sits in.
   -------------------------------------------------------------------------- */

/* Dancing Script, SIL Open Font License, served from nda/fonts via the signing
   page. The signature has to look the same to everybody who opens the document
   afterwards, so the browser shows it in the same hand GD draws it in for the
   PDF — neither depending on what the reader happens to have installed. */
@font-face {
  font-family: 'NDASignature';
  src: url('/assets/fonts/dancing-script.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

/* Set by dr_auth_start(), rather than reaching up the tree with :has(). */
.authcard--wide { max-width: 760px; }

.nda h1 { font-size: 1.3rem; margin-bottom: .2rem; }

/* The agreement itself: scrollable, so the form stays reachable on a phone
   without scrolling past four pages of clauses to find it. */
.nda-agreement {
  max-height: 52vh; overflow-y: auto; margin: 1rem 0 1.4rem;
  padding: 1rem 1.1rem; background: var(--ink-2);
  border: 1px solid var(--rule); border-radius: var(--radius);
  font-size: .86rem; line-height: 1.62;
}
.nda-agreement h2 { margin: 0 0 .8rem; font-size: 1rem; letter-spacing: .02em; }
.nda-agreement h3 { margin: 1.1rem 0 .35rem; font-size: .88rem; color: var(--fg); }
.nda-agreement p { margin: 0 0 .6rem; color: var(--fg-dim); }

/* A gap in the agreement, and the same gap once filled. The point of the
   highlight is that somebody can watch their own details appear in the
   document rather than trusting that they will. */
.nda-fill {
  padding: 0 .22em; border-radius: 3px;
  background: rgba(224,178,74,.14); color: var(--warn);
  box-decoration-break: clone;
}
.nda-fill.is-filled { background: rgba(75,189,156,.15); color: var(--jade); font-weight: 600; }
.nda-later { color: var(--fg-faint); font-style: italic; }

.nda-form fieldset.nda-set { border: 0; padding: 0; margin: 0 0 1rem; }
.nda-form legend { padding: 0; font-weight: 600; font-size: .82rem; color: var(--fg-dim); }
.nda-choice {
  display: flex; align-items: flex-start; gap: .5rem; margin: .45rem 0;
  font-size: .86rem; color: var(--fg-dim); font-weight: 400;
}
.nda-choice input { width: auto; margin-top: .25rem; flex: none; }
/* Tucked up under the field it explains, but only when it follows one — a
   negative margin after the submit bar pulled it over the button. */
.nda-help { font-size: .76rem; margin: .35rem 0 .9rem; }
.nda-form input + .nda-help,
.nda-form textarea + .nda-help { margin-top: -.4rem; }
.nda-error { color: var(--danger); font-size: .8rem; margin: -.4rem 0 .9rem; }

/* The typed signature, shown as it will be written. */
.nda-signature {
  min-height: 3rem; margin: .5rem 0 1rem; padding: .2rem .1rem;
  font-family: 'NDASignature', 'Snell Roundhand', 'Brush Script MT', cursive;
  font-size: 2rem; line-height: 1.35; color: var(--fg);
  border-bottom: 1px solid var(--rule);
}
.nda-signature.is-matching { border-bottom-color: var(--jade); }

.nda-pad {
  display: block; width: 100%; height: 180px; background: #fff;
  border: 1px solid var(--rule); border-radius: var(--radius); touch-action: none;
}
.nda-draw { margin: 0 0 1rem; }

@media (max-width: 680px) {
  .nda-agreement { max-height: 44vh; font-size: .82rem; }
  .nda-signature { font-size: 1.6rem; }
}

/* ---- Agreements (admin) -------------------------------------------------- */

/* A third message tone. There was bad and ok; an agreement awaiting a decision
   is neither — nothing has gone wrong and nothing is settled. */
.msg.warn { background: #fbf0dd; border-color: #ecd6ad; color: #7a4c0c; }

/* Where a record stands, as one word. */
.pill {
  display: inline-block; padding: .14rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--rule); color: var(--fg-dim);
}
.pill--ok   { background: #e7f3ec; border-color: #bfe0cd; color: #185a39; }
.pill--warn { background: #fbf0dd; border-color: #ecd6ad; color: #7a4c0c; }
.pill--bad  { background: #fbe9e7; border-color: #f1c9c3; color: #8f2d22; }

/* A table used as a list of facts rather than rows of records: the headings
   are a left-hand column. */
.tbl--facts th {
  text-align: left; white-space: nowrap; vertical-align: top;
  width: 12em; color: var(--fg-faint); font-weight: 600;
}

/* The agreement text, read-only, as it was signed. */
.nda-plain {
  max-height: 420px; overflow-y: auto; margin: 0 0 1.5rem; padding: 1rem 1.1rem;
  background: var(--ink-2); border: 1px solid var(--rule); border-radius: var(--radius);
  font: .8rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; word-wrap: break-word; color: var(--fg-dim);
}

/* "Keep me signed in" checkbox on the auth card */
.checkrow { display:flex; align-items:center; gap:.5rem; margin:.1rem 0 .2rem; color:var(--fg-faint); font-size:.9rem; }
.checkrow input { width:auto; }

/* OCF Assistant launcher sitting beside a room heading on the viewer home. */
.roomhead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.4rem 0 .6rem; }
.roomhead h2 { margin: 0; }

/* OCF Assistant room picker (the /assistant menu page) */
.ai-rooms { display: flex; flex-direction: column; gap: .7rem; max-width: 640px; margin-top: 1rem; }
.ai-room { display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: .9rem 1rem; color: var(--fg);
  font: inherit; transition: border-color .15s, background .15s, transform .05s; }
.ai-room:hover { border-color: var(--gold-dim); background: var(--ink-2); }
.ai-room:active { transform: scale(.995); }
.ai-room__spark { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--ink); background: linear-gradient(145deg, var(--gold-br), var(--gold)); box-shadow: 0 2px 8px rgba(201,168,76,.25); }
.ai-room__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-room__body strong { font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-room__body small { font-size: .82rem; color: var(--fg-faint); }
.ai-room__go { flex: none; color: var(--gold); font-size: 1.5rem; line-height: 1; opacity: .8; }

/* ---- Row action buttons (keep two small buttons together, right-aligned) -- */
.rowbtns { display: inline-flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---- Modal (viewer activity, loaded via fetch) --------------------------- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start;
  justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal__backdrop { position: fixed; inset: 0; background: rgba(2,6,38,.4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.modal__card { position: relative; width: 100%; max-width: 760px; margin: auto 0;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.3rem; border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 1;
  background: var(--panel); border-radius: var(--radius) var(--radius) 0 0; }
.modal__title { margin: 0; font-size: 1.1rem; }
.modal__close { background: transparent; border: 0; color: var(--fg-dim); font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.modal__close:hover { color: var(--fg); }
.modal__body { padding: 1.2rem 1.3rem 1.4rem; }
.modal__loading { padding: 1.4rem 0; }
body.modal-open { overflow: hidden; }

/* ---- Activity detail (inside the modal) ---------------------------------- */
.act-id { margin: -.2rem 0 1rem; color: var(--fg-dim); font-size: .85rem; }
.act-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.modal .stat { padding: .75rem .85rem; }
.modal .stat__n { font-size: 1.5rem; }
.act-sum { margin: .5rem 0 .2rem; color: var(--fg-dim); font-size: .85rem; line-height: 1.55; }
.act-h { margin: 1.5rem 0 .6rem; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-faint); font-weight: 600; border-top: 1px solid var(--rule-soft); padding-top: 1.1rem; }

/* A 30-day strip: one column per day, bottom-anchored jade fill. */
.act-days { display: flex; align-items: stretch; gap: 2px; height: 56px; margin: .2rem 0; }
.act-days__col { flex: 1 1 0; display: flex; align-items: flex-end; min-width: 0;
  background: var(--rule-soft); border-radius: 2px; overflow: hidden; }
.act-days__col i { display: block; width: 100%; min-height: 0; background: var(--jade); border-radius: 2px; }

/* Horizontal labelled bars (folders, document types). */
.hbar { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 2.6rem; align-items: center; gap: .6rem; margin: .4rem 0; }
.hbar__label { min-width: 0; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__label small { color: var(--fg-faint); }
.hbar__track { position: relative; height: 8px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.hbar__fill { position: absolute; inset: 0 auto 0 0; background: var(--jade); border-radius: 5px; }
.hbar__fill--gold { background: var(--gold); }
.hbar__n { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--fg-dim); text-align: right; }

/* Recent-activity timeline. */
.actlist { list-style: none; margin: .2rem 0 0; padding: 0; }
.actlist li { display: flex; gap: .7rem; align-items: baseline; padding: .45rem 0;
  border-bottom: 1px solid var(--rule-soft); font-size: .85rem; }
.actlist li:last-child { border-bottom: 0; }
.actlist__when { flex: 0 0 auto; min-width: 8.5rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.actlist__what { flex: 1 1 auto; min-width: 0; }
.actlist__act { flex: 0 0 auto; }

@media (max-width: 560px) {
  .act-stats { grid-template-columns: repeat(2, 1fr); }
  .hbar { grid-template-columns: minmax(70px, 110px) 1fr 2.4rem; }
  .actlist li { flex-wrap: wrap; gap: .25rem .6rem; }
  .actlist__when { min-width: 0; order: 2; }
  .actlist__what { order: 1; flex-basis: 100%; }
  .actlist__act { order: 3; }
}

/* ---- Team access request: form notice, modal width, dashboard banner ------ */
.modal__card--form { max-width: 560px; }
.formnote { background: rgba(75,189,156,.08); border: 1px solid var(--jade-dim); border-radius: 9px;
  padding: .7rem .85rem; margin: 1.1rem 0 .2rem; font-size: .82rem; color: var(--fg-dim); line-height: 1.5; }
.formnote strong { color: var(--jade); }
.panel--flag { border-color: var(--warn); }
.reqbanner { display: flex; align-items: center; gap: .7rem; margin: 1rem 0 0; padding: .7rem 1rem;
  background: rgba(224,178,74,.1); border: 1px solid var(--warn); border-radius: var(--radius);
  color: var(--fg); text-decoration: none; }
.reqbanner:hover { background: rgba(224,178,74,.16); }
.reqbanner__n { flex: none; min-width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center;
  justify-content: center; background: var(--warn); color: #241c05; font-weight: 700; border-radius: 999px; font-size: .9rem; }
.reqbanner__go { margin-left: auto; color: var(--gold-br); font-size: .85rem; white-space: nowrap; }
@media (max-width: 560px) { .reqbanner { flex-wrap: wrap; } .reqbanner__go { margin-left: 0; flex-basis: 100%; } }
