/* CIMA Technical Repository. Same design tokens as the code tracker (app/public/static/app.css):
   CIMA leaf green, paper background, serif titles, sans UI, hairline rules instead of boxes. */

@font-face { font-family: "Plex Sans"; src: url("/static/fonts/IBMPlexSans-400.woff2") format("woff2"); font-weight: 100 700; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("/static/fonts/SourceSerif4-500.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }

:root {
  --paper: #faf7f0;
  --surface: #ffffff;
  --ink: #18241e;
  --ink-2: #47534c;
  --ink-3: #636d67;
  --rule: #e5dfd2;
  --rule-strong: #cdc5b3;
  --leaf: #419d78;
  --leaf-ink: #26694d;
  --leaf-wash: #eaf3ee;
  --danger: #a2382b;
  --danger-wash: #fbeeec;
  --serif: "Source Serif", Georgia, "Times New Roman", serif;
  --sans: "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 1080px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.55 var(--sans); border-top: 3px solid var(--leaf); }
a { color: var(--leaf-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--leaf-ink); outline-offset: 2px; border-radius: 2px; }
table, .num, .count { font-variant-numeric: tabular-nums lining-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 5; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 4px; }
.skip:focus { top: 8px; color: #fff; }

/* Header */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; max-width: var(--measure); margin: 0 auto; padding: 14px var(--gutter); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand .product { font-weight: 600; font-size: 15px; padding-left: 12px; border-left: 1px solid var(--rule-strong); line-height: 1.2; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 8px 10px; border-radius: 4px; }
.nav a:hover { color: var(--ink); background: rgba(24, 36, 30, 0.05); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--leaf); border-radius: 0; }
.search { display: flex; gap: 6px; }
.search input { width: 210px; max-width: 100%; }
.usermenu { position: relative; font-size: 13px; }
.usermenu summary { cursor: pointer; color: var(--ink-2); padding: 8px 4px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu .menu { position: absolute; right: 0; z-index: 2; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 6px; min-width: 140px; }
.usermenu .menu a { display: block; padding: 8px 10px; text-decoration: none; }
/* "Sign out" is a form button (it has to POST), styled as the menu link it replaces. */
button.linklike { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--leaf-ink); font-weight: 400; padding: 8px 10px; min-height: 40px; border-radius: 4px; }
button.linklike:hover { background: var(--leaf-wash); color: var(--ink); }

/* Page */
main { max-width: var(--measure); margin: 0 auto; padding: 28px var(--gutter) 64px; border-top: 1px solid var(--rule); }
h1 { font: 600 32px/1.15 var(--serif); letter-spacing: -0.015em; margin: 0 0 10px; overflow-wrap: anywhere; }
h2 { font: 600 20px/1.25 var(--serif); letter-spacing: -0.01em; margin: 0 0 4px; }
h2.rule { border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin: 40px 0 14px; scroll-margin-top: 12px; }
h3.subrule { font: 600 16px/1.3 var(--sans); margin: 22px 0 8px; scroll-margin-top: 12px; }
h2.rule .count, h3.subrule .count, .jump .count { font: 400 13px var(--sans); color: var(--ink-3); margin-left: 4px; }
/* Links to the subfolders of a long topic. */
.jump { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 12px 16px; margin: 0 0 8px; max-width: 760px; }
.jump p { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.jump ul { list-style: none; margin: 0; padding: 0; }
.jump > ul { columns: 2; column-gap: 28px; }
.jump ul ul { margin: 2px 0 4px 14px; padding-left: 12px; border-left: 1px solid var(--rule); }
.jump ul ul li { font-size: 14px; padding: 3px 0; }
.jump li { padding: 4px 0; break-inside: avoid; font-size: 14.5px; }
.jump a { text-decoration: none; }
.jump a:hover { text-decoration: underline; }
.lead { font-size: 16.5px; color: var(--ink-2); max-width: 68ch; margin: 0 0 20px; }
.crumb { font-size: 13px; color: var(--ink-3); margin: 0 0 8px; }
.hint { font-size: 13px; color: var(--ink-3); max-width: 72ch; }
.empty { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 18px 20px; color: var(--ink-2); max-width: 68ch; }
.preview-note { font-size: 13px; background: var(--leaf-wash); border-left: 3px solid var(--leaf); padding: 6px 10px; display: inline-block; }
ul.plain { padding-left: 20px; max-width: 68ch; }

/* Topics list */
.topics { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }
.topics li { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 13px 16px; border-bottom: 1px solid var(--rule); }
.topics li:last-child { border-bottom: 0; }
.topics a { font-weight: 500; font-size: 16px; text-decoration: none; padding: 4px 0; }
.topics a:hover { text-decoration: underline; }
.topics .count { color: var(--ink-3); font-size: 13px; }
.badge { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--leaf-ink); background: var(--leaf-wash); border-radius: 3px; padding: 2px 7px; white-space: nowrap; }
.badge.off { color: var(--ink-2); background: var(--rule); }

/* Tables */
.grid { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--rule); }
.grid th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--rule-strong); }
.grid td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
.grid td.num, .grid td.kind { white-space: nowrap; color: var(--ink-2); }
/* Dates, roles and other short facts never break mid-word ("11/12/2 026" at tablet widths, review round 6). */
.grid td.nw { white-space: nowrap; overflow-wrap: normal; }
.grid td.actions { white-space: nowrap; font-size: 13px; }
/* People and Topic access hold forms in this cell: let them wrap, or a tablet scrolls sideways
   (code review 11/12/2026: 109 px too wide at 768). Document tables keep their two buttons on one line. */
.grid.cards:not(.docs) td.actions { white-space: normal; }
/* The first column (an email address or a topic name) keeps a readable width; the buttons do the wrapping. */
.grid.cards:not(.docs) td.title { min-width: 190px; }
form.inline button { white-space: nowrap; }
/* Same column widths in every document table, so stacked tables on a topic page line up. */
/* Narrowed 11/16/2026: on search results (which add the Topic column) the Document column was 215 px
   of a 1,048 px table, so titles and excerpts wrapped every three words. */
.docs td.kind { width: 96px; }
.docs td.num { width: 84px; }
.docs td.actions { width: 172px; }
.docs td.upd { width: 116px; color: var(--ink-2); }
.docs td.where { width: 19%; }
/* Titles and row links read as links by color and weight; the underline appears on hover and focus,
   so a table of fifty documents is not fifty underlines. */
.doc-title { font-weight: 500; }
/* Search excerpt (spec §8n): a line of the document's own text under its title, matched words marked. */
td.title .excerpt { margin-top: 4px; font-size: 13.5px; line-height: 1.45; font-weight: 400; color: var(--ink-3); overflow-wrap: anywhere; }
td.title .excerpt b { font-weight: 600; color: var(--ink); background: var(--leaf-wash); border-radius: 2px; padding: 0 2px; }
.grid td a { text-decoration: none; }
.grid td a:hover, .grid td a:focus-visible { text-decoration: underline; }
/* Open / Watch / Download: small bordered buttons, the same in every table. */
a.act { display: inline-block; font-size: 13px; font-weight: 500; line-height: 1; padding: 7px 10px; border: 1px solid var(--rule-strong); border-radius: 4px; background: var(--surface); color: var(--leaf-ink); text-decoration: none; }
a.act + a.act { margin-left: 6px; }
a.act:hover { border-color: var(--leaf-ink); background: var(--leaf-wash); color: var(--leaf-ink); text-decoration: none; }
.sub { color: var(--ink-3); }

/* Forms */
input, select, textarea, button { font: inherit; color: inherit; }
input[type="search"], input[type="email"], select, textarea { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 4px; padding: 8px 10px; min-height: 40px; }
textarea { width: 100%; max-width: 560px; display: block; }
button { border: 1px solid var(--leaf-ink); background: var(--leaf-ink); color: #fff; border-radius: 4px; padding: 8px 14px; min-height: 40px; cursor: pointer; font-weight: 500; }
button:hover { background: var(--ink); border-color: var(--ink); }
button.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger-wash); }
form.stack { display: grid; gap: 8px; justify-items: start; max-width: 560px; }
form.stack label { font-weight: 500; font-size: 14px; margin-top: 6px; }
form.stack { grid-template-columns: minmax(0, 1fr); }
form.stack select { width: 100%; max-width: 100%; }
form.stack label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; min-height: 40px; }
/* position: relative keeps each row's visually hidden label inside the table's own scroll area.
   Without it the label is placed against the page and makes a phone scroll sideways. */
form.inline { position: relative; display: inline-flex; gap: 6px; align-items: center; margin: 2px 6px 2px 0; }
form.inline button, form.inline select { min-height: 34px; padding: 4px 10px; font-size: 13px; }
td.actions form.inline { white-space: normal; }
.flash { background: var(--leaf-wash); border-left: 3px solid var(--leaf); padding: 10px 14px; max-width: 72ch; }
.flash.err { background: var(--danger-wash); border-left-color: var(--danger); }

.player { width: 100%; max-width: 960px; background: #000; display: block; margin: 8px 0 14px; }

/* Landing page, which is also the sign-in page (src/login.js). The sign-in box sits at the top
   right on a wide screen and directly under the logo, full width, on a narrow one. The status
   line's classes are set by the kit's script. */
.landing-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; max-width: var(--measure); margin: 0 auto; padding: 18px var(--gutter); }
/* order: the logo always comes first; the tablet rule that reorders the app header must not move it. */
.landing-top .brand { padding-top: 22px; order: 0; }
.landing-top .signin-box { order: 1; }
/* min-width: 0 lets the box shrink below its field-plus-button width (it was 25 px too wide at 320). */
.signin-box { flex: 0 1 400px; min-width: 0; }
.signin-box label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.signin-row { display: flex; gap: 6px; }
.signin-row input { flex: 1 1 auto; min-width: 0; }
.signin-row button { white-space: nowrap; }
@media (max-width: 359px) { .signin-row { flex-wrap: wrap; } .signin-row button { flex: 1 1 100%; } }
.signin-box .alert { margin: 8px 0 0; }
.landing-main { border-top: 1px solid var(--rule); padding-top: 56px; padding-bottom: 72px; }
.landing-main h1 { font-size: 40px; max-width: 20ch; margin-bottom: 16px; }
.landing-main .lead { font-size: 18px; max-width: 58ch; margin-bottom: 32px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--leaf-ink); margin: 0 0 10px; }
.landing-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--ink); max-width: 900px; }
.landing-facts li { padding: 16px 20px 4px 0; font-size: 14.5px; color: var(--ink-2); }
.landing-facts li + li { padding-left: 20px; border-left: 1px solid var(--rule); }
.landing-facts strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.alert { padding: 10px 14px; margin: 0 0 14px; border-left: 3px solid var(--leaf); background: var(--leaf-wash); font-size: 14px; }
.alert-error { border-left-color: var(--danger); background: var(--danger-wash); }
.alert[hidden] { display: none; }

.foot { max-width: var(--measure); margin: 0 auto; padding: 18px var(--gutter) 40px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-3); }
.foot p { margin: 0 0 4px; }

/* Tablets and small laptops: the account menu sits on the brand's row. */
@media (max-width: 900px) {
  .top { gap: 10px 16px; }
  .brand { order: 1; }
  .usermenu { order: 2; margin-left: auto; }
  .nav { order: 3; margin-left: 0; width: 100%; }
  .search { order: 4; width: 100%; }
  .search input { flex: 1; width: auto; }
  .usermenu summary { max-width: 46vw; }
}

/* Tablets, 721 to 1023 px. People, Topic access and Activity switch to cards here already: each row
   carries a select and up to three buttons, and as a table those need more width than a tablet has
   (measured 11/12/2026: 116 px too wide at 768). Document tables stay tables until 720. The rules
   are the phone card rules below, for tables that are not .docs. */
@media (min-width: 721px) and (max-width: 1023px) {
  .grid.cards:not(.docs) { overflow: visible; border: 0; background: none; }
  .grid.cards:not(.docs) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid.cards:not(.docs) tbody, .grid.cards:not(.docs) tr, .grid.cards:not(.docs) td { display: block; width: auto; }
  .grid.cards:not(.docs) tr { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
  .grid.cards:not(.docs) td { border: 0; padding: 0; overflow-wrap: anywhere; white-space: normal; }
  .grid.cards:not(.docs) td.title { font-weight: 500; font-size: 15.5px; margin-bottom: 4px; }
  .grid.cards:not(.docs) td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); }
  .grid.cards:not(.docs) td[data-label]::after { content: "\A"; white-space: pre; }
  .grid.cards:not(.docs) td.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 14px; }
  .grid.cards:not(.docs) td.actions:empty { display: none; }
  .grid.cards:not(.docs) form.inline { display: flex; flex-wrap: wrap; width: 100%; margin: 0; }
  .grid.cards:not(.docs) form.inline select { flex: 1 1 180px; min-width: 0; }
  .grid.cards:not(.docs) form.inline button, .grid.cards:not(.docs) form.inline select { min-height: 44px; font-size: 14px; }
  .grid.cards:not(.docs) td.title { min-width: 0; }
  /* On a tablet the row's controls sit side by side at their natural width, not one per line. */
  .grid.cards:not(.docs) form.inline { width: auto; display: inline-flex; flex-wrap: nowrap; margin: 0 8px 0 0; }
  .grid.cards:not(.docs) td.actions { align-items: center; }
  .grid.cards:not(.docs) form.inline select { flex: 0 1 auto; max-width: 100%; }
}

/* Phones. Tables marked .cards become one card per row: the title on top, the other cells as a
   line of labelled facts, and the actions as full-height buttons. Nothing is hidden behind a
   sideways scroll (11/12/2026: Open and Download were off-screen on a 375 px phone). Tables
   without .cards (the two history tables) scroll inside themselves. The page never scrolls sideways;
   scripts/browser-check/smoke.py S13 measures that at 320, 375, 768 and 1024 px. */
@media (max-width: 720px) {
  h1 { font-size: 26px; }
  main { padding-top: 22px; }
  .nav a { padding: 10px 10px; }
  .topics li { padding: 6px 14px; }
  .topics a { flex: 1 1 100%; padding: 14px 0 8px; }
  .topics .count { padding-bottom: 8px; }
  .grid { display: block; overflow-x: auto; }
  .grid th, .grid td { overflow-wrap: normal; }

  .grid.cards { overflow: visible; border: 0; background: none; }
  .grid.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid.cards tbody, .grid.cards tr, .grid.cards td { display: block; width: auto; }
  .grid.cards tr { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
  .grid.cards td { border: 0; padding: 0; overflow-wrap: anywhere; white-space: normal; }
  .grid.cards td.title { font-weight: 500; font-size: 15.5px; margin-bottom: 4px; }
  .grid.cards td.kind, .grid.cards td.num, .grid.cards td.where, .grid.cards td[data-label] { display: inline; font-size: 13px; color: var(--ink-2); }
  .grid.cards td.kind::after, .grid.cards td.where::after { content: " · "; color: var(--ink-3); }
  /* The document date carries its own separator and label, and disappears whole when there is no date. */
  .grid.cards.docs td.upd::before { content: " · " attr(data-label) ": "; color: var(--ink-3); }
  .grid.cards.docs td.upd::after { content: none; }
  .grid.cards.docs td.upd:empty { display: none; }
  .grid.cards td.upd { white-space: nowrap; }
  /* "2.8 MB" and "PowerPoint" stay whole (11/16/2026: the size split across two lines at 390 px). */
  .grid.cards td.num, .grid.cards td.kind { white-space: nowrap; }
  .jump > ul { columns: 1; }
  .jump li { padding: 9px 0; }
  .grid.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); }
  .grid.cards td[data-label]::after { content: "\A"; white-space: pre; }
  .grid.cards td.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 14px; }
  .grid.cards td.actions:empty { display: none; }
  a.act { padding: 13px 16px; font-size: 14px; }
  .grid.cards a.act { margin-left: 0; }
  .grid.cards form.inline { display: flex; flex-wrap: wrap; width: 100%; margin: 0; }
  .grid.cards form.inline select { flex: 1 1 180px; min-width: 0; }
  .grid.cards form.inline button, .grid.cards form.inline select { min-height: 44px; font-size: 14px; }
  button, input[type="search"], input[type="email"], select { min-height: 44px; }
  .landing-top { padding-bottom: 20px; }
  .landing-top .brand { padding-top: 0; }
  .signin-box { flex: 1 1 100%; }
  .landing-main { padding-top: 32px; padding-bottom: 48px; }
  .landing-main h1 { font-size: 28px; }
  .landing-main .lead { font-size: 16.5px; margin-bottom: 24px; }
  .landing-facts { grid-template-columns: 1fr; }
  .landing-facts li, .landing-facts li + li { padding: 14px 0; border-left: 0; border-bottom: 1px solid var(--rule); }
}
