/* REOI shared web components — the website/portal layer of the design system.
   Import order: fonts/fonts.css → tokens.css → web.css.
   The website inherits the report's language (CLAUDE.md, Design block): same
   tokens, same display serif at the first impressions (wordmark, login).
   Every value is a var(--token). Investment tiers per DESIGN.md: login and
   report-delivery get the polish; admin interior is held to the quality floor.
   Mono is sanctioned HERE (filenames, IDs, hashes) — web-admin only, never
   in reports. */

/* ---------- base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-ui-body);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  color: var(--color-ink);
  background: var(--color-paper);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); text-decoration: underline; }

h1, h2 { font-family: var(--font-display); font-weight: var(--weight-medium); }
h1 { font-size: var(--text-2xl-size); line-height: var(--text-2xl-line); }
h2 { font-size: var(--text-xl-size);  line-height: var(--text-xl-line); }

.mono { font-family: var(--font-mono); font-size: var(--text-xs-size); }

/* Section title — THE section label. One element, one voice, on every page of
   the portal: brass small-caps, a step up from a kicker, standing above the
   content it names. It may stand alone or carry a serif line beneath it; what
   it may not do is vary from tab to tab. (Owner-directed 2026-07-13, "Your
   portfolio" was getting lost; recoloured brass and stepped up 2026-07-25,
   §219, when five tabs made three competing header styles obvious.) */
.section-title {
  font-size: var(--text-lg-size); line-height: var(--text-lg-line);
  font-weight: var(--weight-bold); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--color-brass); margin-bottom: var(--space-2);
}

/* Small-caps labels — ONE look per role, because a label over data is one job.
   The portal had grown 15 variants of this (six letter-spacings, five colours)
   before §221 counted them; these three are what the roles actually are. */
.label,
.pf-tbl th,         /* graduated §223: identical values, so it JOINS the master */
.pf-kpi .k {        /* rather than restating them as a sixth treatment */
  font-size: var(--text-2xs-size); font-weight: var(--weight-bold);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-ink-muted);
}
.label-quiet,
.pf-kpi .k { color: var(--color-ink-faint); }    /* modifier, not a new treatment */
.label-accent,
.tile .t-kicker {   /* graduated §223 — the tile eyebrow IS this label */
  font-size: var(--text-2xs-size); font-weight: var(--weight-bold);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-brass);
}
.label-strong {     /* a card or panel title set as a label, not a heading */
  font-size: var(--text-xs-size); font-weight: var(--weight-bold);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-ink);
}

/* the wordmark — display serif, letterspaced; the same voice as the report cover */
.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg-size);
  letter-spacing: 0.26em;
  color: var(--color-accent);
}

/* ---------- buttons ----------
   Labels say the action ("Download report"), never "OK"/"Submit". */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-ui-body);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background: none;
}

.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--color-accent); color: var(--color-on-accent); }
.btn-primary:hover:not([disabled]) { background: var(--color-accent-dark); }

.btn-secondary { border-color: var(--color-rule-strong); color: var(--color-ink); background: var(--color-surface); }
.btn-secondary:hover:not([disabled]) { border-color: var(--color-accent); color: var(--color-accent); }

.btn-ghost { color: var(--color-accent); }
.btn-ghost:hover:not([disabled]) { background: var(--color-accent-tint); }

/* destructive only, and it always confirms before acting */
.btn-danger { background: var(--color-danger); color: var(--color-on-accent); }
.btn-danger:hover:not([disabled]) { opacity: 0.92; }

/* ---------- forms ----------
   Label above, help below; the error replaces the help and states the fix. */

.field { margin-bottom: var(--space-5); max-width: 26em; }

.field label {
  display: block;
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-1);
}

.field input, .field select, .field textarea {
  width: 100%;
  font-family: var(--font-ui-body);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  color: var(--color-ink);
  background: var(--color-surface);
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}

.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--color-ink-faint); }

.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-focus);
}

.field .help, .field .error {
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  margin-top: var(--space-1);
}

.field .help { color: var(--color-ink-faint); }
.field .error { color: var(--color-danger); display: none; }

.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--color-danger); }
.field.invalid .help { display: none; }
.field.invalid .error { display: block; }

/* ---------- status chips ----------
   Dot + label, never color alone. Failed states are actionable (pair with a ghost button). */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-rule);
  background: var(--color-surface);
}

.chip .dot { width: var(--space-2); height: var(--space-2); border-radius: var(--radius-lg); }

.chip-success   .dot { background: var(--color-success); }
.chip-warning   .dot { background: var(--color-warning); }
.chip-danger    .dot { background: var(--color-danger); }
.chip-tracking  .dot { background: var(--color-accent); }
.chip-neutral   .dot { background: var(--color-ink-faint); }

/* ---------- cards & modals ----------
   Elevation is meaningful: flat page, shadow-sm on cards, modal shadow only on modals. */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg-size);
  line-height: var(--text-lg-line);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-3);
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: var(--space-6);
  max-width: 32em;
}

/* Interactive cards lift: any card-like surface that responds to the pointer
   (portal tiles, report cards) rises and sharpens on hover/focus. Longhand
   border colors so a colored top edge (accent/brass) keeps its color. */
.lifts {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.lifts:hover, .lifts:focus-visible, .lifts:focus-within {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-left-color: var(--color-rule-strong);
  border-right-color: var(--color-rule-strong);
  border-bottom-color: var(--color-rule-strong);
}
@media (prefers-reduced-motion: reduce) {
  .lifts, .lifts:hover, .lifts:focus-visible, .lifts:focus-within { transition: none; transform: none; }
}

/* ---------- day / night switch ----------
   Every surface carries one (global CLAUDE.md §9). A page that provides its own
   #themeToggle in its header styles it there; a page that does not gets the
   floating variant mounted by Design/theme.js. */

#themeToggle { cursor: pointer; }
#themeToggle .tgl-icon { font-size: var(--data-unit-sm-size); }

.theme-float {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 40;
  box-shadow: var(--shadow-sm);
  font-size: var(--text-xs-size);
  padding: var(--space-1) var(--space-3);
}

/* ---------- site footer ----------
   Every page closes with the method-version stamp (DESIGN.md rule):
   <footer class="sitefoot"><span data-reoi-version></span></footer>
   + /version.js (generated from VERSION.md by sync-design.py). */

.sitefoot {
  text-align: center;
  color: var(--color-ink-faint);
  font-size: var(--text-2xs-size);
  line-height: var(--text-2xs-line);
  padding: var(--space-7) var(--space-4) var(--space-5);
}

/* ---------- admin tables ----------
   Quality floor: sticky header, hairline rows, hover tint, right-aligned
   actions, mono for filenames/IDs, tabular numerals. Dense and consistent. */

.admin-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm-size); line-height: var(--text-sm-line); }

.admin-table th {
  position: sticky;
  top: 0;
  background: var(--color-paper);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  text-align: left;
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule-strong);
}

.admin-table td {
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--color-rule);
  font-feature-settings: var(--font-features-figures);
}

.admin-table tbody tr:hover td { background: var(--color-accent-tint); }

.admin-table th.num, .admin-table td.num { text-align: right; }
.admin-table th.actions, .admin-table td.actions { text-align: right; padding-right: 0; }
.admin-table td.file { font-family: var(--font-mono); font-size: var(--text-xs-size); }

/* Awaiting-pull banner (W6, Upload Notification Design Note v1.0) — shown on
   the operator page whenever any submission sits sealed-but-not-ingested.
   Warning-accented but calm: it is a to-do, not an error. */
.seal-alert {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-sunken);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  color: var(--color-ink);
}
.seal-alert b { color: var(--color-warning); }

/* ---------- dashboard components (graduated from the portal, §223) ----------
   These are components, not one-page layout: a tile, a KPI cell, a dense data
   table, a status chip, an overlay + its panel. Moved VERBATIM out of
   Site/public/portal/index.html so any surface can use them and the web-spec
   sheet can show them. Names are historical (pf- = portfolio, tp- = tenant
   panel) and kept deliberately: renaming them would move markup for no
   visual gain. Everything left in the page is genuine layout — grids, tab
   bar, chart geometry, the tenant panel's own structure. */

.tile:hover, .tile:focus-visible { box-shadow: var(--shadow-sm); border-color: var(--color-rule-strong); }

.tile .t-kicker {   /* type comes from .label-accent above; this is the tile's own fit */
    line-height: 1.3; margin-bottom: 0;
  }

.tile .t-num { font-family: var(--font-ui-body); font-size: var(--data-figure-sm-size); line-height: 1.15; font-weight: var(--weight-bold); font-feature-settings: var(--font-features-figures); margin-top: 5px; }

.tile .t-sub { font-size: var(--data-note-size); line-height: 1.35; color: var(--color-ink-muted); margin-top: 4px; }

.tile .t-more { display: none; }

.overlay[hidden] { display: none; }

.ov-panel {
    background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-modal);
    border-top: 3px solid var(--color-brass);
    max-width: 760px; width: 100%; max-height: 82vh; overflow: auto;
    padding: var(--space-6) var(--space-7);
  }

.ov-panel { padding: var(--space-4) var(--space-3); max-height: 88vh; }

.pf-kpi { background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius-md); padding: var(--space-4) var(--space-4) var(--space-3); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }

.pf-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--color-accent); }

.pf-kpi.warn::before { background: var(--color-warning); }

.pf-kpi.crit::before { background: var(--color-danger); }

.pf-kpi .v { font-family: var(--font-ui-body); font-weight: var(--weight-bold); font-size: var(--data-hero-size); line-height: 1.05; margin-top: var(--space-1); font-feature-settings: var(--font-features-figures); }

.pf-kpi .v small { font-size: var(--data-unit-sm-size); color: var(--color-ink-faint); font-family: var(--font-ui-body); font-weight: var(--weight-semibold); }

.pf-kpi .v .star { color: var(--color-danger); font-size: var(--data-unit-size); }

.pf-kpi .s { font-size: var(--text-xs-size); line-height: var(--text-xs-line); color: var(--color-ink-muted); margin-top: var(--space-1); }

.pf-tbl th { text-align: left; padding: 0 var(--space-2) 6px 0; border-bottom: 1px solid var(--color-rule); }

.pf-tbl td { padding: 7px var(--space-2) 7px 0; border-bottom: 1px solid var(--color-rule); vertical-align: top; color: var(--color-ink); line-height: 1.35; font-feature-settings: var(--font-features-figures); }

.pf-tbl tr:last-child td { border-bottom: none; }

.pf-tbl td.r { text-align: right; white-space: nowrap; width: 1%; }

.pf-tbl td.d { color: var(--color-ink-muted); white-space: nowrap; }

.pf-tbl td.d.wrap { white-space: normal; }

.pf-tbl .star { color: var(--color-danger); font-weight: var(--weight-bold); white-space: nowrap; }

.tp-chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-2xs-size); font-weight: var(--weight-bold); padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }

.tp-chip.good { background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface)); color: var(--color-success); border-color: color-mix(in srgb, var(--color-success) 30%, transparent); }

.tp-chip.warn { background: color-mix(in srgb, var(--color-warning) 14%, var(--color-surface)); color: var(--color-warning); border-color: color-mix(in srgb, var(--color-warning) 30%, transparent); }

.tp-chip.crit { background: color-mix(in srgb, var(--color-danger) 14%, var(--color-surface)); color: var(--color-danger); border-color: color-mix(in srgb, var(--color-danger) 32%, transparent); }

.tp-chip.neut { background: var(--color-surface-sunken); color: var(--color-ink-muted); border-color: var(--color-rule); }
