/* ==========================================================================
   TAG Finance — design system (shared with TAG Collectibles HQ)
   --------------------------------------------------------------------------
   Shell: the original dark TAG Collectibles HQ sidebar (restored), with the
   official TAG logo. Content: warm-white (light) or warm-charcoal (dark)
   surfaces, Bahnschrift headings, subtle dividers, moderate radii. One
   accent, brass/gold, marks "current" or "featured" only.

   Themes: <html data-theme="light|dark|system">, rendered by the server from
   the person's saved preference. "system" follows prefers-color-scheme.

   No external fonts, images or libraries (strict Content-Security-Policy).
   ========================================================================== */

/* ---------- 0. Brand font ----------
   Century Gothic Bold for the "TAG Collectibles HQ" wordmark only. A copy installed on the
   computer is used first; otherwise the file supplied by TAG is served from this application. */
@font-face {
  font-family: "TAG Wordmark";
  src: local("Century Gothic Bold"), local("CenturyGothic-Bold"), url("../fonts/century-gothic-bold.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- 1. Tokens ---------- */
:root {
  /* colour */
  --black: #000;
  --ink: #1f1e1c;          /* body text */
  --charcoal: #2b2a27;
  --stone: #5e5b54;        /* secondary text, 6.1:1 on paper */
  --stone-2: #6f6b63;      /* metadata, 4.8:1 on paper */
  --control: #8a867d;      /* form-control borders, 3:1+ */
  --rule-strong: #b9b5aa;
  --rule: #d9d6cd;         /* hairlines */
  --sand: #e9e7e0;         /* quiet fills */
  --paper: #f4f3ef;        /* page */
  --paper-2: #faf9f6;      /* row hover */
  --white: #fff;           /* working surfaces */

  --brass: #8a6914;        /* accent on light: current / featured / focus */
  --gold: #e0b43f;         /* accent on dark */

  --ok: #2e6b3a;   --ok-bg: #e4eee3;
  --warn: #7e5400; --warn-bg: #f5ead2;
  --bad: #a12a20;  --bad-bg: #f6e3df;
  --info: #2f4a6b; --info-bg: #e3e8ee;

  /* type */
  --font-display: "Bahnschrift", "DIN Alternate", "DIN Next", "Barlow Semi Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-code: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --fs-meta: .8125rem;     /* 13px: metadata, tags */
  --fs-small: .875rem;     /* 14px */
  --fs-body: 1rem;         /* 16px */
  --fs-lead: 1.1875rem;    /* 19px */
  --fs-h3: 1.0625rem;
  --fs-h2: 1.5rem;
  --fs-h1: clamp(2.125rem, 1.6rem + 1.7vw, 3rem);
  --fs-display: clamp(2.75rem, 1.4rem + 4.6vw, 5.75rem);

  /* space (4px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* layout */
  --page-max: 1280px;
  --gutter: 36px;
  --measure: 68ch;
  --topbar-h: 0px;         /* height of the sticky top bar on small screens */

  /* shape and depth */
  --r-xs: 2px; --r-sm: 4px; --r: 6px; --r-md: 8px;
  --lift: 0 1px 2px rgba(0, 0, 0, .05), 0 0 0 1px rgba(0, 0, 0, .045);
  --float: 0 18px 40px -12px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .06);
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* sidebar (restored original; dark in both themes) */
  --sb-bg: #1d1e21; --sb-bg-2: #26272b; --sb-text: #cfd0d3; --sb-muted: #8c8e93; --sb-active: #34363b; --sb-border: #2e3034;
  --sb-width: 300px;

  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f1e1c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Dark theme: warm charcoal surfaces, not an inversion. Defined twice: once for an explicit
   choice and once for "System default" when the device prefers dark. Keep the two in sync. */
:root[data-theme="dark"] {
  --black: #f2f0ea; --ink: #e2dfd7; --charcoal: #d4d1c8; --stone: #aba79d; --stone-2: #99958b;
  --control: #7d796f; --rule-strong: #57544d; --rule: #34332f; --sand: #2a2927;
  --paper: #151514; --paper-2: #1f1f1d; --white: #1c1c1b;
  --brass: #d9ad45; --gold: #e0b43f;
  --ok: #86c493; --ok-bg: #1b2b1f; --warn: #e3b25c; --warn-bg: #2e2514; --bad: #f08c80; --bad-bg: #36201d; --info: #9db9dc; --info-bg: #1b2533;
  --lift: 0 0 0 1px var(--rule); --float: 0 18px 40px -12px rgba(0, 0, 0, .7), 0 0 0 1px var(--rule);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2dfd7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --black: #f2f0ea; --ink: #e2dfd7; --charcoal: #d4d1c8; --stone: #aba79d; --stone-2: #99958b;
    --control: #7d796f; --rule-strong: #57544d; --rule: #34332f; --sand: #2a2927;
    --paper: #151514; --paper-2: #1f1f1d; --white: #1c1c1b;
    --brass: #d9ad45; --gold: #e0b43f;
    --ok: #86c493; --ok-bg: #1b2b1f; --warn: #e3b25c; --warn-bg: #2e2514; --bad: #f08c80; --bad-bg: #36201d; --info: #9db9dc; --info-bg: #1b2533;
    --lift: 0 0 0 1px var(--rule); --float: 0 18px 40px -12px rgba(0, 0, 0, .7), 0 0 0 1px var(--rule);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2dfd7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 400 var(--fs-body)/1.55 var(--font-text); color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; color: var(--black); }
h1, h2, .display { font-family: var(--font-display); font-weight: 600; font-stretch: 87.5%; }
h1, h2, h3, .lead-title, .app-name { text-wrap: balance; }
h1 { font-size: var(--fs-h1); line-height: 1.04; letter-spacing: -.015em; }
h2 { font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -.005em; }
h3 { font-size: var(--fs-h3); line-height: 1.35; font-weight: 650; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; }
[role="list"] { list-style: none; padding: 0; }
time, .num, td { font-variant-numeric: tabular-nums; }
strong { font-weight: 650; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; text-decoration-color: var(--rule-strong); transition: text-decoration-color .15s; }
a:hover { text-decoration-color: currentColor; }

code { font-family: var(--font-code); font-size: .875em; background: var(--sand); border-radius: var(--r-xs); padding: .1em .35em; overflow-wrap: anywhere; }

:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; border-radius: var(--r-xs); }
main:focus { outline: none; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: absolute; left: var(--s3); top: -80px; z-index: 200; background: var(--white); color: var(--black); padding: 10px 16px; font-weight: 650; border: 3px solid var(--brass); border-radius: var(--r-sm); text-decoration: none; }
.skip-link:focus { top: var(--s3); }

.ic { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.ic.sm { width: 16px; height: 16px; vertical-align: -3px; }
.ic.xs { width: 14px; height: 14px; vertical-align: -2px; }

.muted { color: var(--stone); }
.small { font-size: var(--fs-small); }
.nowrap { white-space: nowrap; }

/* ---------- 3. Application shell: the original TAG Collectibles HQ sidebar ----------
   Restored from the first version (colours, sizes, grouping, selected state and account area
   are the original values). Only the brand mark changed: the official TAG logo replaces the
   temporary "TAG" box. Small-screen behaviour follows the original toggle script. */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sb-width); flex: 0 0 var(--sb-width); background: var(--sb-bg); color: var(--sb-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; font-size: 15px; line-height: 1.5; z-index: 40;
  scrollbar-width: none; -ms-overflow-style: none; }   /* still scrolls (wheel, touch, keyboard); no visible bar */
.sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 14px 14px; border-bottom: 1px solid var(--sb-border); }
.brand-link { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
.brand-logo { display: block; width: 64px; height: auto; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand-text strong { display: block; color: #fff; font: 700 1.0625rem/1.25 "TAG Wordmark", "Century Gothic", var(--font-text); letter-spacing: .005em; white-space: nowrap; }
.brand-text small { display: block; color: var(--sb-muted); font-size: .76rem; white-space: nowrap; }
.nav-toggle { display: none; align-items: center; gap: 6px; background: none; border: 1px solid var(--sb-border); color: var(--sb-text); border-radius: 5px; padding: 6px 8px; cursor: pointer; font: inherit; font-size: .8125rem; }
.nav { padding: 6px 10px; flex: 1; }
.nav-group { padding: 8px 0 4px; }
.nav-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sb-muted); padding: 4px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: 5px; color: var(--sb-text); text-decoration: none; border-left: 3px solid transparent; }
.nav-link:hover { background: var(--sb-bg-2); color: #fff; }
.nav-link.active { background: var(--sb-active); color: #fff; border-left-color: #f1f1ee; }
.sidebar :focus-visible { outline-color: #9db8ff; }
.sidebar .ic { width: 18px; height: 18px; stroke-width: 1.8; vertical-align: -3px; }
.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid var(--sb-border); font-size: .86rem; }
.who { display: flex; align-items: center; gap: 10px; color: var(--sb-text); text-decoration: none; }
.who strong { display: block; color: #fff; }
.who small { color: var(--sb-muted); }
.who:hover strong { text-decoration: underline; }
.foot-actions { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; align-items: center; }
.foot-actions a, .foot-actions .linklike { color: var(--sb-text); background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.foot-actions a:hover, .foot-actions .linklike:hover { color: #fff; }
.foot-actions form { margin: 0; }
.version { color: var(--sb-muted); font-size: .75rem; margin: 10px 0 0; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
:root[data-theme="dark"] .sidebar { border-right: 1px solid var(--sb-border); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .sidebar { border-right: 1px solid var(--sb-border); } }

/* ---------- 4. Page frame ---------- */
.page { flex: 1; width: 100%; max-width: var(--page-max); padding: var(--s6) var(--gutter) var(--s8); }

.page-head { margin-bottom: var(--s7); padding-bottom: var(--s5); border-bottom: 1px solid var(--rule-strong); }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4) var(--s6); flex-wrap: wrap; }
.page-head-text { max-width: 52rem; min-width: 0; }
.page-head h1 { overflow-wrap: break-word; }
.subtitle { margin: var(--s3) 0 0; color: var(--stone); font-size: var(--fs-lead); line-height: 1.45; max-width: 62ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.page-actions form { margin: 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 var(--s4); font-size: var(--fs-small); color: var(--stone); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--rule-strong); }
.crumbs a { color: var(--stone); }
.crumbs [aria-current] { color: var(--ink); }

.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s1) var(--s4); border-top: 3px solid var(--black); padding-top: var(--s3); margin-bottom: var(--s5); }
.section-head h2 { font-size: 1.375rem; }
.section-head h3, .section-head-sm h2 { font: 600 1.125rem/1.2 var(--font-display); font-stretch: 87.5%; }
.section-link { font-size: var(--fs-small); color: var(--stone); white-space: nowrap; }

/* two-column page layout: main + supporting column */
.split { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: var(--s7) var(--s7); align-items: start; }
.split > * { min-width: 0; }
.stack > * + * { margin-top: var(--s7); }

/* ---------- 5. Components ---------- */
/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  font: 600 .9375rem/1.2 var(--font-text); color: var(--black); background: transparent;
  border: 1px solid var(--black); border-radius: var(--r-sm); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--sand); }
.btn.primary { background: var(--black); color: var(--white); }
.btn.primary:hover { background: var(--charcoal); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: .22em; }
.btn.ghost:hover { background: transparent; text-decoration-color: currentColor; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: var(--fs-small); }
.btn.block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* tags: small rectangular labels; dashed = fictional or placeholder */
.tag { display: inline-block; vertical-align: 2px; padding: 2px 6px; font: 600 .75rem/1.25 var(--font-text); color: var(--stone); border: 1px solid var(--rule-strong); border-radius: var(--r-xs); white-space: nowrap; }
.tag-demo { border-style: dashed; border-color: var(--control); color: var(--stone); }
.tag-ok { color: var(--ok); border-color: currentColor; }
.tag-warn { color: var(--warn); border-color: currentColor; }
.tag-bad { color: var(--bad); border-color: currentColor; }
.tag-quiet { background: var(--sand); border-color: var(--sand); }
.tag-current { color: var(--brass); border-color: currentColor; }

/* notices: persistent context (demo data, placeholders, warnings) */
.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); margin: 0 0 var(--s6); background: var(--sand); border-left: 3px dashed var(--control); color: var(--ink); }
.notice .ic { margin-top: 3px; color: var(--stone); }
.notice p { margin: 0; }
.notice-warn { background: var(--warn-bg); border-left: 3px solid var(--warn); }
.notice-warn .ic { color: var(--warn); }
.notice-info { background: var(--info-bg); border-left: 3px solid var(--info); }
.notice-info .ic { color: var(--info); }
.fineprint-notice { font-size: var(--fs-small); color: var(--stone); border-left: 2px dashed var(--control); padding-left: var(--s3); margin-bottom: var(--s4); }

/* flash messages: the result of something you just did */
.flashes { margin: 0 0 var(--s6); display: grid; gap: var(--s2); }
.flash { display: flex; gap: var(--s3); align-items: flex-start; margin: 0; padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--info-bg); color: var(--info); animation: flash-in .35s var(--ease) both; }
.flash .ic { margin-top: 3px; }
.flash span { color: var(--ink); }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.flash-error span { color: var(--ink); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* panels: white working surfaces for forms and tables */
.panel { background: var(--white); border-radius: var(--r); box-shadow: var(--lift); padding: var(--s6); }
.panel + .panel { margin-top: var(--s6); }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); margin-bottom: var(--s5); }
.panel-head h2 { font-size: 1.25rem; }
.panel-head p { margin: var(--s1) 0 0; color: var(--stone); font-size: var(--fs-small); }

/* forms */
.form { max-width: 720px; }
.field { margin: 0 0 var(--s5); min-width: 0; }
.field label, .label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9375rem; color: var(--black); }
.req { font-weight: 400; font-size: var(--fs-meta); color: var(--stone); margin-left: 6px; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input:not([type]), select, textarea {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px; font: 400 1rem/1.4 var(--font-text); color: var(--ink);
  background: var(--white); border: 1px solid var(--control); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--stone); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid transparent; outline-offset: 0; border-color: var(--black); box-shadow: 0 0 0 3px var(--brass); }
@media (forced-colors: active) { input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid CanvasText; outline-offset: 2px; } }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], input:user-invalid, textarea:user-invalid { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
textarea { line-height: 1.55; resize: vertical; min-height: 120px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.hint { margin: 6px 0 0; font-size: var(--fs-small); color: var(--stone); line-height: 1.45; }
.field.check { display: flex; align-items: center; gap: var(--s3); }
.field.check label { margin: 0; font-weight: 500; }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--black); flex: 0 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--rule); }
fieldset { border: 0; margin: 0 0 var(--s5); padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: var(--s4); font-weight: 650; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s5); }
.form-grid .span-all { grid-column: 1 / -1; }

/* toolbar: search and filters above a list */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin: 0 0 var(--s5); }
.toolbar .field { margin: 0; }
.toolbar .grow { flex: 1 1 320px; }
.search-input { position: relative; }
.search-input .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--stone); pointer-events: none; }
.search-input input { padding-left: 44px; min-height: 48px; font-size: 1.0625rem; }
.result-count { margin: 0 0 var(--s3); color: var(--stone); font-size: var(--fs-small); }

/* filter list: a quiet vertical/horizontal set of links with the current one marked */
.filters { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); border-bottom: 1px solid var(--rule); margin-bottom: var(--s5); }
.filters a { display: inline-flex; gap: 6px; align-items: baseline; padding: 10px 0; color: var(--stone); text-decoration: none; font-weight: 500; box-shadow: inset 0 -2px 0 transparent; }
.filters a:hover { color: var(--black); box-shadow: inset 0 -2px 0 var(--rule-strong); }
.filters a[aria-current] { color: var(--black); font-weight: 650; box-shadow: inset 0 -2px 0 var(--brass); }

/* tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: -3px; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; font-weight: 600; font-size: var(--fs-small); color: var(--stone); padding: 12px 16px; border-bottom: 1px solid var(--black); white-space: nowrap; background: var(--white); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--paper-2); }
.table tr.inactive td { color: var(--stone-2); }
.table.dense td { padding: 10px 16px; font-size: var(--fs-small); }
.table .sub { display: block; color: var(--stone); font-size: var(--fs-small); }
.table code { white-space: nowrap; overflow-wrap: normal; }
.table-wrap > .table { min-width: 760px; }
.table-wrap > .audit-table { min-width: 1040px; }

/* avatars: square, like a label, in muted earth tones */
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--r-sm); color: #fff; font: 600 .9375rem/1 var(--font-display); letter-spacing: .02em; background: var(--charcoal); }
.avatar.xs { width: 26px; height: 26px; font-size: .75rem; border-radius: var(--r-xs); }
.avatar.sm { width: 32px; height: 32px; font-size: .8125rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar.xl { width: 128px; height: 128px; font-size: 2.75rem; border-radius: var(--r); }
.avatar.has-photo { background: var(--sand); overflow: hidden; }
.avatar.has-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-c0 { background: #2b2a27; } .avatar-c1 { background: #4a4740; } .avatar-c2 { background: #5c4a2e; } .avatar-c3 { background: #34413a; }
.avatar-c4 { background: #3b3f4a; } .avatar-c5 { background: #5a3b36; } .avatar-c6 { background: #5e5226; } .avatar-c7 { background: #44403b; }

/* empty states */
.empty-block { padding: var(--s5) 0; color: var(--stone); }
.empty-block strong { color: var(--ink); }
.empty-block .btn { margin-top: var(--s4); }
.empty-page { padding: var(--s8) 0; max-width: 40rem; }
.empty-page h2 { font-size: 2rem; margin-bottom: var(--s3); }
.empty-page p { color: var(--stone); font-size: var(--fs-lead); }
.empty-page .btn { margin-top: var(--s4); }

/* definition lists */
.facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 0; margin: 0; }
.facts dt, .facts dd { padding: 12px 0; border-bottom: 1px solid var(--rule); margin: 0; }
.facts dt { color: var(--stone); font-size: var(--fs-small); padding-right: var(--s5); padding-top: 14px; }
.facts dd { overflow-wrap: anywhere; }

/* row lists: hairline-separated rows */
.row-list { border-top: 1px solid var(--rule); }
.row-list > li { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.row-title { font-weight: 650; color: var(--black); text-decoration: none; }
.row-title:hover { text-decoration: underline; }
.row-list p { margin: 4px 0 0; color: var(--stone); font-size: .9375rem; }
p.row-meta, .row-list p.row-meta, .doc-list p.row-meta, .article-list p.row-meta { font-size: var(--fs-meta); color: var(--stone-2); }
.row-meta > span:not(.meta-tags)::before { content: ""; display: inline-block; width: 1px; height: .8em; background: var(--rule-strong); margin: 0 10px; vertical-align: -1px; }

/* long-form text */
.prose { max-width: var(--measure); font-size: 1.0625rem; line-height: 1.7; }
.prose h2 { font-size: 1.5rem; margin: 1.8em 0 .5em; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.5em 0 .4em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: .35em 0; padding-left: .2em; }
.prose ol li::marker { font-family: var(--font-display); font-weight: 600; }
.prose a { text-decoration-color: var(--brass); }

/* ---------- 6. Home: a structured dashboard ---------- */
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s3) var(--s6); padding-bottom: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--rule); }
.dash-head h1 { font-size: clamp(1.75rem, 1.45rem + .9vw, 2.25rem); line-height: 1.1; }
.dash-head .subtitle { font-size: 1rem; margin-top: 6px; }
.dash-date { margin: 0; color: var(--stone); font-size: var(--fs-small); white-space: nowrap; }

.quick { margin-bottom: var(--s5); }
.quick ul { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.quick li { background: var(--white); }
.quick a { display: flex; gap: 10px; align-items: flex-start; height: 100%; padding: 14px 16px; text-decoration: none; transition: background-color .15s; }
.quick a:hover { background: var(--paper-2); }
.quick a:hover strong { text-decoration: underline; text-underline-offset: .2em; }
.quick .ic { color: var(--stone); margin-top: 1px; }
.quick strong { display: block; color: var(--black); font-size: .9375rem; line-height: 1.3; }
.quick a span span { display: block; color: var(--stone); font-size: var(--fs-meta); line-height: 1.35; margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.dash-col { display: grid; gap: var(--s5); min-width: 0; }
.dash-section { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); min-width: 0; }
.dash-section-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.dash-section-head h2 { font-size: 1.125rem; line-height: 1.25; }
.dash-section-head a { font-size: var(--fs-small); color: var(--stone); white-space: nowrap; }
.dash-section-body { padding: 4px 20px; }
.dash-section-body.padded { padding: 16px 20px 20px; }
.dash-list > li { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.dash-list > li:last-child { border-bottom: 0; }
.dash-list.dated > li { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: var(--s4); }
.dash-date-col { font: 600 var(--fs-small)/1.4 var(--font-display); color: var(--stone); padding-top: 1px; }
.dash-item-title { font-weight: 650; color: var(--black); text-decoration: none; }
.dash-item-title:hover { text-decoration: underline; }
.dash-list p { margin: 3px 0 0; color: var(--stone); font-size: .9375rem; }
.dash-list .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta-line { display: flex; flex-wrap: wrap; gap: 2px 0; font-size: var(--fs-meta) !important; color: var(--stone-2) !important; }
.meta-line > span + span::before { content: ""; display: inline-block; width: 1px; height: .8em; background: var(--rule-strong); margin: 0 10px; vertical-align: -1px; }
.pinned { display: inline-flex; align-items: center; gap: 5px; color: var(--brass); font-weight: 650; }
.tag-pinned { color: var(--brass); border-color: currentColor; }
.empty-inline { color: var(--stone); padding: 14px 0; margin: 0; }

.org-summary { margin: 0 0 var(--s3); color: var(--stone); }
.org-summary strong { color: var(--black); font: 600 1.5rem/1 var(--font-display); margin-right: 4px; }
.dept-list li { display: flex; justify-content: space-between; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: .9375rem; }
.dept-list li:last-child { border-bottom: 0; }
.dept-list a { text-decoration: none; color: var(--ink); }
.dept-list a:hover { text-decoration: underline; }
.dept-list .num { color: var(--stone); }
.fineprint-notice { font-size: var(--fs-small); color: var(--stone); border-left: 2px dashed var(--control); padding-left: var(--s3); margin-bottom: var(--s4); }
.admin-links li { border-bottom: 1px solid var(--rule); }
.admin-links li:last-child { border-bottom: 0; }
.admin-links a { display: flex; align-items: center; gap: 10px; padding: 11px 0; text-decoration: none; color: var(--ink); font-size: .9375rem; }
.admin-links a:hover { text-decoration: underline; }
.admin-links .ic { color: var(--stone); }

/* ---------- 7. Connected Apps ---------- */
.app-list { display: grid; gap: var(--s4); }
.app-slab { background: #000; color: #a8a49b; border-radius: var(--r); padding: var(--s5); }
.app-kind { margin: 0 0 var(--s4); font-size: var(--fs-meta); color: #a8a49b; padding-bottom: var(--s3); border-bottom: 1px solid #33322e; }
.app-name { font: 600 1.875rem/1.02 var(--font-display); font-stretch: 87.5%; letter-spacing: -.01em; color: #fff; margin: 0 0 var(--s3); max-width: 14ch; }
.app-desc { margin: 0 0 var(--s5); font-size: .9375rem; line-height: 1.5; }
.app-state { display: flex; gap: var(--s3); align-items: flex-start; padding-top: var(--s4); border-top: 1px solid #33322e; font-size: var(--fs-small); line-height: 1.5; }
.app-state .ic { color: #a8a49b; margin-top: 1px; }
.app-state strong { color: #fff; }
.app-state code { background: #22211f; color: #eceae3; }
.app-state-bad .ic, .app-state-bad strong { color: #f0a59b; }
.app-foot { margin: var(--s3) 0 0; font-size: var(--fs-meta); }
.app-slab :focus-visible { outline-color: var(--gold); }
.btn-on-dark { background: #fff; color: #000; border-color: #fff; }
.btn-on-dark:hover { background: var(--gold); border-color: var(--gold); color: #000; }
:root[data-theme="dark"] .app-slab, :root[data-theme="dark"] .app-icon { box-shadow: 0 0 0 1px #3a3935; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .app-slab, :root[data-theme="system"] .app-icon { box-shadow: 0 0 0 1px #3a3935; } }
.apps-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--s7); align-items: start; }
.apps-page .app-slab { padding: var(--s6); }
.apps-page .app-name { font-size: clamp(2.25rem, 1.6rem + 2vw, 3.25rem); max-width: 16ch; }
.apps-page .app-desc { font-size: 1.0625rem; max-width: 52ch; }
.how-list { border-top: 1px solid var(--rule); }
.how-list li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); color: var(--stone); font-size: .9375rem; }
.how-list li strong { display: block; color: var(--black); margin-bottom: 2px; }
.how-list .ic { margin-top: 2px; color: var(--stone); }
/* compact entry used on the Home dashboard */
.app-entry { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--s3); }
.app-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r); background: var(--sb-bg); color: #fff; }
.app-entry h3 { font-size: 1rem; font-weight: 650; }
.app-entry p { margin: 2px 0 0; color: var(--stone); font-size: var(--fs-small); }
.app-entry-state { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); padding-top: var(--s3); margin-top: var(--s1); border-top: 1px solid var(--rule); font-size: var(--fs-small); }
.state-dot { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.state-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--control); }
.state-dot.is-ok { color: var(--ok); } .state-dot.is-ok::before { background: var(--ok); }
.state-dot.is-bad { color: var(--bad); } .state-dot.is-bad::before { background: var(--bad); }
.state-dot.is-off { color: var(--stone); }
.app-entry-note { grid-column: 1 / -1; margin: 0; color: var(--stone); font-size: var(--fs-meta); }

/* ---------- 8. Shared page pieces ---------- */
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 1rem; }
.select-lg { min-height: 48px; min-width: 14rem; }
.select-sm { min-height: 32px; padding: 4px 32px 4px 10px; font-size: var(--fs-small); width: auto; display: inline-block; background-position: right 8px center; background-size: 16px; }
.section-intro { color: var(--stone); margin: calc(var(--s2) * -1) 0 var(--s4); font-size: .9375rem; }
.aside-note { color: var(--stone); font-size: var(--fs-small); line-height: 1.5; margin-top: var(--s4); }
.aside-action { margin-top: var(--s5); }
.facts-stacked { grid-template-columns: minmax(0, 1fr); }
.facts-stacked dt { border-bottom: 0; padding: 12px 0 0; }
.facts-stacked dd { padding: 2px 0 12px; }
.bio { font-size: var(--fs-lead); line-height: 1.55; max-width: 60ch; color: var(--charcoal); }
.back-link { margin-top: var(--s7); }
.back-link a { display: inline-flex; align-items: center; gap: 8px; color: var(--stone); }
.manage-box .manage-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.manage-box form { margin: 0; }
.format-help .format-list { display: grid; grid-template-columns: max-content 1fr; gap: 0 var(--s4); margin: var(--s4) 0 0; font-size: var(--fs-small); }
.format-help dt, .format-help dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.format-help dd { color: var(--stone); }
.notice-placeholder { border-left-style: dashed; }
.pager { display: flex; align-items: center; gap: var(--s4); margin-top: var(--s6); color: var(--stone); }

/* ---------- 9. Sign-in ---------- */
.auth-page { flex: 1; display: flex; min-height: 100vh; }
.auth-split { flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }
.auth-identity { background: var(--sb-bg); color: var(--sb-muted); padding: var(--s7) clamp(24px, 5vw, 80px); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s7); }
.auth-brand { display: flex; align-items: center; gap: var(--s4); margin: 0; }
.auth-brand img { display: block; width: 120px; height: auto; }
.auth-brand span { color: #fff; font: 700 1.375rem/1.15 "TAG Wordmark", "Century Gothic", var(--font-display); }
.auth-statement { font: 600 clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem)/1.12 var(--font-display); font-stretch: 87.5%; letter-spacing: -.01em; color: #fff; margin: 0; max-width: 18ch; text-wrap: balance; }
.auth-env { margin: 0; font-size: var(--fs-small); border-top: 1px solid var(--sb-border); padding-top: var(--s4); }
.auth-identity :focus-visible { outline-color: #9db8ff; }
.auth-form { padding: var(--s7) clamp(24px, 6vw, 96px); display: flex; flex-direction: column; justify-content: center; max-width: 40rem; width: 100%; }
.auth-form h1 { font-size: clamp(2.25rem, 1.8rem + 1.4vw, 3rem); }
.auth-lede { color: var(--stone); font-size: var(--fs-lead); margin: var(--s3) 0 var(--s6); }
.auth-form .form { max-width: 26rem; }
.auth-form .notice { max-width: 34rem; }
.auth-fine { max-width: 26rem; margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--rule); color: var(--stone); font-size: var(--fs-small); }
.auth-error { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: var(--s7) var(--gutter); max-width: var(--page-max); margin: 0 auto; width: 100%; }

/* ---------- 10. Errors ---------- */
.error-page { padding: var(--s8) 0; max-width: 44rem; }
.error-code { font: 600 clamp(5rem, 3rem + 8vw, 10rem)/.85 var(--font-display); font-stretch: 87.5%; letter-spacing: -.03em; color: var(--black); margin: 0 0 var(--s5); padding-bottom: var(--s4); border-bottom: 8px solid var(--black); display: inline-block; }
.error-page h1 { margin-bottom: var(--s3); }
.error-message { font-size: var(--fs-lead); color: var(--stone); }
.error-actions { margin-top: var(--s5); }

/* ---------- 11. People ---------- */
.person-hero { margin-bottom: var(--s7); padding-bottom: var(--s6); border-bottom: 8px solid var(--black); }
.person-hero-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s5) var(--s6); align-items: end; }
.photo-slot { display: grid; gap: 6px; justify-items: start; }
.photo-note { font-size: var(--fs-meta); color: var(--stone-2); }
.person-hero h1 { font-size: clamp(2.5rem, 1.6rem + 3vw, 4.25rem); line-height: .96; letter-spacing: -.02em; }
.person-role { margin: var(--s3) 0 0; font-size: 1.25rem; color: var(--charcoal); }
.person-role span::before, .person-tags > span:not(.tag) + span:not(.tag)::before { content: ""; display: inline-block; width: 1px; height: .8em; background: var(--rule-strong); margin: 0 12px; vertical-align: -1px; }
.person-tags { margin: var(--s2) 0 0; color: var(--stone); font-size: .9375rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.person-tags .tag { margin-left: 12px; }
.person-tags .tag:first-child { margin-left: 0; }
.person-hero .page-actions { align-self: end; }

.people-table { border-top: 1px solid var(--black); }
.people-row { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.6fr); gap: var(--s4); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.people-row:not(.people-head):hover { background: var(--paper-2); box-shadow: -8px 0 0 var(--paper-2), 8px 0 0 var(--paper-2); }
.people-head { padding: 10px 0; font-size: var(--fs-small); font-weight: 600; color: var(--stone); }
.people-name { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.people-name a { font-weight: 650; color: var(--black); text-decoration: none; }
.people-name a:hover { text-decoration: underline; }
.people-title { display: block; color: var(--stone); font-size: var(--fs-small); }
.people-dept, .people-loc { font-size: .9375rem; }
.people-email { font-size: .9375rem; overflow-wrap: anywhere; }
.people-email a { color: var(--stone); }

.chain { position: relative; padding-left: 22px; }
.chain::before { content: ""; position: absolute; left: 5px; top: 12px; bottom: 14px; width: 1px; background: var(--rule-strong); }
.chain li { position: relative; padding: 8px 0; }
.chain li::before { content: ""; position: absolute; left: -21px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1px solid var(--control); }
.chain li[aria-current]::before { background: var(--brass); border-color: var(--brass); }
.chain .sub { display: block; color: var(--stone); font-size: var(--fs-small); }
.mini-people { border-top: 1px solid var(--rule); }
.mini-people li { display: flex; gap: var(--s3); align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.mini-people .sub { display: block; color: var(--stone); font-size: var(--fs-small); }

/* org chart: an indented tree with connector lines, not a wall of cards */
.org-tree { margin: 0 0 var(--s5); padding: var(--s2) 0 0; border-top: 1px solid var(--black); }
.org-tree ul { margin: 0 0 0 19px; padding: 0 0 0 22px; border-left: 1px solid var(--rule-strong); }
.org-node { position: relative; }
.org-tree ul > .org-node::before { content: ""; position: absolute; left: -22px; top: 28px; width: 20px; border-top: 1px solid var(--rule-strong); }
.org-line { padding-left: 24px; }
.org-toggle > summary { list-style: none; position: absolute; left: -2px; top: 16px; width: 24px; height: 24px; display: grid; place-items: center; cursor: pointer; border-radius: var(--r-sm); color: var(--stone); }
.org-toggle > summary::-webkit-details-marker { display: none; }
.org-toggle > summary:hover { background: var(--sand); color: var(--black); }
.org-caret { transform: rotate(-90deg); transition: transform .15s var(--ease); }
.org-toggle[open] > summary .org-caret { transform: none; }
.org-person { display: flex; align-items: center; gap: var(--s3); padding: 10px 12px 10px 4px; min-width: 0; border-radius: var(--r-sm); }
.org-line:hover .org-person { background: var(--sand); }
.org-text { min-width: 0; flex: 1; }
.org-text a { font-weight: 650; color: var(--black); text-decoration: none; }
.org-text a:hover { text-decoration: underline; }
.org-role { display: block; color: var(--stone); font-size: var(--fs-small); }
.org-role span::before { content: ""; display: inline-block; width: 1px; height: .8em; background: var(--rule-strong); margin: 0 8px; vertical-align: -1px; }
.org-reports { font-size: var(--fs-meta); color: var(--stone); white-space: nowrap; }
.org-node.is-dim > .org-line .org-text a { color: var(--stone); font-weight: 500; }
.org-node.is-dim > .org-line .org-role, .org-node.is-dim > .org-line .org-reports { color: var(--stone-2); }
.org-node.is-dim > .org-line .avatar { background: var(--control); }
.org-node.is-match > .org-line .org-person { box-shadow: inset 3px 0 0 var(--brass); background: var(--white); padding-left: 12px; }

/* ---------- 12. Company News: a communications workspace ---------- */
.comms { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: var(--s5); align-items: start; }
.comms-rail { position: sticky; top: calc(var(--topbar-h) + var(--s5)); background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 6px; }
.rail-label { margin: 0; padding: 12px 10px 4px; font-size: var(--fs-meta); font-weight: 650; color: var(--stone); }
.rail-list a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: .9375rem; }
.rail-list a:hover { background: var(--sand); }
.rail-list a[aria-current] { background: var(--sand); color: var(--black); font-weight: 650; box-shadow: inset 3px 0 0 var(--brass); }
.rail-list .num { color: var(--stone-2); font-size: var(--fs-meta); font-weight: 500; }
.rail-list .ic { color: var(--stone); margin-right: 8px; }
.rail-list a > span:first-child { display: inline-flex; align-items: center; min-width: 0; }

.comms-main { min-width: 0; display: grid; gap: var(--s4); }
.feed { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.feed-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.feed-head h2 { font-size: 1.125rem; }
.feed-head p { margin: 0; color: var(--stone); font-size: var(--fs-small); }
.feed-group { margin: 0; padding: 16px 20px 2px; display: flex; align-items: center; gap: var(--s3); font: 650 var(--fs-meta)/1.3 var(--font-text); color: var(--stone); }
.feed-group::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.feed-group .ic { color: var(--brass); }
.feed-pinned { background: var(--paper-2); border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.post { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 14px 20px; position: relative; }
.post + .post { border-top: 1px solid var(--rule); }
.post:hover { background: var(--paper-2); }
.feed-pinned .post:hover { background: var(--sand); }
.post.is-pinned::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 2px 2px 0; background: var(--brass); }
.post-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: var(--fs-small); color: var(--stone); }
.post-author { font-weight: 650; color: var(--black); }
.post-time { font-size: var(--fs-meta); color: var(--stone-2); }
.post-head .tag { vertical-align: 0; }
.post-title { margin: 4px 0 0; font: 650 1.0625rem/1.35 var(--font-text); }
.post-title a { color: var(--black); text-decoration: none; }
.post-title a:hover { text-decoration: underline; }
.post-title a::after { content: ""; position: absolute; inset: 0; }  /* whole entry is the link target */
.post-summary { margin: 3px 0 0; color: var(--ink); max-width: 72ch; }
.post .tag, .post-head a { position: relative; z-index: 1; }

.post-full { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); }
.post-full-head { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s4); padding: var(--s5) var(--s6) var(--s5); border-bottom: 1px solid var(--rule); }
.post-full-head h1 { font-size: clamp(1.75rem, 1.4rem + 1vw, 2.375rem); line-height: 1.1; margin-top: 6px; }
.post-full-head .post-summary { margin-top: var(--s3); font-size: var(--fs-lead); line-height: 1.5; color: var(--charcoal); }
.post-full-body { padding: var(--s5) var(--s6) var(--s6); }
.post-full-foot { display: flex; flex-wrap: wrap; gap: 4px var(--s5); padding: 14px var(--s6); border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--stone); }
.post-full-foot dt { display: inline; color: var(--stone-2); margin-right: 6px; }
.post-full-foot dd { display: inline; margin: 0; color: var(--ink); }
.post-full-foot div { white-space: nowrap; }

.tools-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px 14px 10px 16px; background: var(--sand); border: 1px solid var(--rule); border-radius: var(--r-md); }
.tools-bar-label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-small); font-weight: 650; color: var(--charcoal); }
.tools-bar-label span { font-weight: 400; color: var(--stone); }
.tools-bar-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.tools-bar form { margin: 0; }
.comms-form { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: var(--s5); align-items: start; }
.comms .format-help { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s4) var(--s5); }
.comms .format-help .section-head { border-top: 0; padding-top: 0; }

.story-head { margin-bottom: var(--s7); padding-bottom: var(--s6); border-bottom: 8px solid var(--black); }
.story-head .notice { margin-bottom: var(--s5); }
.story-title { font-size: clamp(2.5rem, 1.5rem + 3.4vw, 4.5rem); line-height: .98; letter-spacing: -.022em; max-width: 20ch; }
.story-lead { margin: var(--s5) 0 0; font-size: clamp(1.1875rem, 1.05rem + .5vw, 1.4375rem); line-height: 1.45; color: var(--charcoal); max-width: 52ch; }
.story-split { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); }

.wiki-layout { display: grid; grid-template-columns: minmax(12rem, 3fr) minmax(0, 9fr); gap: var(--s7); align-items: start; }
.wiki-cats { position: sticky; top: calc(var(--topbar-h) + var(--s5)); border-top: 3px solid var(--black); padding-top: var(--s3); }
.cats-title { font-size: 1.125rem; margin-bottom: var(--s3); }
.wiki-cats ul { border-top: 1px solid var(--rule); }
.wiki-cats a { display: flex; justify-content: space-between; gap: var(--s3); padding: 10px 0 10px 12px; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-size: .9375rem; }
.wiki-cats a:hover { background: var(--sand); }
.wiki-cats a[aria-current] { font-weight: 650; color: var(--black); box-shadow: inset 3px 0 0 var(--brass); }
.wiki-cats .num { color: var(--stone-2); font-size: var(--fs-small); }
.article-list { border-top: 1px solid var(--black); }
.article-list li { padding: var(--s5) 0; border-bottom: 1px solid var(--rule); }
.article-list h3 { font: 600 1.375rem/1.15 var(--font-display); font-stretch: 87.5%; }
.article-list h3 a { color: var(--black); text-decoration: none; }
.article-list h3 a:hover { text-decoration: underline; text-decoration-color: var(--brass); text-decoration-thickness: 2px; }
.article-list p { margin: 6px 0 0; color: var(--stone); max-width: 64ch; }
.meta-tags { margin-left: 10px; }
.meta-tags .tag { vertical-align: 0; }

.wiki-aside { position: sticky; top: calc(var(--topbar-h) + var(--s5)); }
.toc { border-left: 1px solid var(--rule); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--stone); text-decoration: none; font-size: .9375rem; }
.toc a:hover { color: var(--black); border-left-color: var(--black); }
.revisions { border-top: 1px solid var(--rule); }
.revisions li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.revisions p { margin: 0; }
.rev-head a { font-weight: 650; }
.rev-meta { color: var(--stone); font-size: var(--fs-small); }
.rev-note { margin-top: 4px !important; font-size: var(--fs-small); color: var(--ink); }
.revisions li.is-current .rev-head a { color: var(--black); }

.legal-groups > section + section { margin-top: var(--s6); }
.doc-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, auto); gap: var(--s2) var(--s7); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.doc-list li:first-child { padding-top: 4px; }
.doc-list h3 { font-size: 1.0625rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.doc-list h3 a { color: var(--black); text-decoration: none; }
.doc-list h3 a:hover { text-decoration: underline; }
.doc-list p { margin: 4px 0 0; color: var(--stone); max-width: 64ch; }
.doc-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px var(--s3); margin: 0; font-size: var(--fs-small); align-content: start; }
.doc-meta dt { color: var(--stone-2); }
.doc-meta dd { margin: 0; color: var(--ink); }
.doc-head { margin-bottom: var(--s6); padding-bottom: var(--s5); border-bottom: 1px solid var(--rule-strong); }
.doc-head h1 { font-size: clamp(2rem, 1.6rem + 1.2vw, 2.75rem); line-height: 1.08; max-width: 26ch; }
.doc-head .story-lead { font-size: var(--fs-lead); margin-top: var(--s3); }
.doc-head .notice { margin-bottom: var(--s4); }

/* ---------- 13. Administration ---------- */
.panel-head.inset { padding: var(--s5) var(--s5) var(--s4); margin: 0; border-bottom: 1px solid var(--rule); }
.panel.flush .table th { background: var(--paper-2); }
.panel.flush + .panel { margin-top: var(--s6); }
.form-wide { max-width: none; }
.inline-form { display: flex; gap: var(--s2); align-items: center; margin: 0; flex-wrap: nowrap; }
.status-cell .tag { margin: 0 4px 4px 0; }
.cell-person { display: inline-flex; align-items: center; gap: var(--s2); }
.cell-person a { font-weight: 600; }
.row-menu > summary { list-style: none; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { background: var(--black); color: var(--white); }
.row-menu[open] .caret { transform: rotate(180deg); }
.row-menu-body { margin-top: var(--s2); padding: var(--s3); width: 16rem; background: var(--paper); border-radius: var(--r-sm); display: grid; gap: var(--s2); }
.row-menu-body form { margin: 0; }
.reset-form { display: grid; gap: 6px; padding-top: var(--s2); border-top: 1px solid var(--rule); }
.reset-form label { font-size: var(--fs-small); font-weight: 600; }
.reset-form input { min-height: 36px; padding: 6px 10px; font-size: var(--fs-small); }
.audit-table td { font-size: var(--fs-small); }
.audit-table .detail { font-family: var(--font-code); font-size: .8125rem; color: var(--stone); max-width: 28rem; overflow-wrap: anywhere; }
.empty-cell { color: var(--stone); padding: var(--s6) 16px !important; text-align: center; }

/* ---------- 14. Appearance preference ---------- */
.appearance-form fieldset { margin: 0; }
.appearance-form legend { margin-bottom: var(--s3); font-weight: 650; }
.appearance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.appearance-option { position: relative; }
.appearance-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.appearance-option label { display: grid; gap: 8px; height: 100%; padding: 10px; border: 1px solid var(--rule-strong); border-radius: var(--r-md); background: var(--white); cursor: pointer; font-size: var(--fs-small); font-weight: 600; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.appearance-option label:hover { border-color: var(--stone); }
.appearance-option input:checked + label { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.appearance-option input:focus-visible + label { outline: 3px solid var(--brass); outline-offset: 2px; }
.appearance-option .check { display: inline-flex; align-items: center; gap: 6px; }
.appearance-option .check .ic { visibility: hidden; color: var(--black); }
.appearance-option input:checked + label .check .ic { visibility: visible; }
.swatch { display: block; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--rule); overflow: hidden; position: relative; }
.swatch::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 26%; background: #1d1e21; }
.swatch::after { content: ""; position: absolute; left: 34%; right: 12%; top: 12px; height: 6px; border-radius: 3px; box-shadow: 0 12px 0 0 currentColor; background: currentColor; opacity: .45; }
.swatch-light { background: #f4f3ef; color: #1f1e1c; }
.swatch-dark { background: #151514; color: #e2dfd7; }
.swatch-system { background: linear-gradient(90deg, #f4f3ef 0 63%, #151514 63% 100%); color: #8a867d; }
.appearance-help { margin: var(--s3) 0 0; font-size: var(--fs-small); color: var(--stone); }

/* ---------- 15. Logo variants ---------- */
.logo-for-dark { display: none; }
:root[data-theme="dark"] .logo-for-light { display: none; }
:root[data-theme="dark"] .logo-for-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .logo-for-light { display: none; }
  :root[data-theme="system"] .logo-for-dark { display: block; }
}
.error-logo { display: block; width: 96px; height: auto; margin-bottom: var(--s6); }

/* ---------- 16. Engagement: recognition, TAG Coins, rewards ----------
   Calm and specific rather than gamified: square award marks like the avatars, one dark
   "slab" per page for the thing that matters most (balance, first place, coin awards), and
   brass only for coins. */
.seal { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--sand); color: var(--charcoal); }
.seal .ic { width: 24px; height: 24px; }
.seal.has-coins { background: var(--sb-bg); color: var(--gold); }
.seal-xs { width: 26px; height: 26px; border-radius: var(--r-xs); }
.seal-xs .ic { width: 16px; height: 16px; }
.seal-sm { width: 36px; height: 36px; }
.seal-sm .ic { width: 20px; height: 20px; }
.seal-lg { width: 72px; height: 72px; border-radius: var(--r); }
.seal-lg .ic { width: 38px; height: 38px; stroke-width: 1.3; }

.coins { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.coins .ic { color: var(--brass); }
.coins .num { font-weight: 650; color: var(--black); }
.coins.is-neg .num { color: var(--bad); }
.coins-lg .num { font: 600 1.375rem/1 var(--font-display); font-stretch: 87.5%; }
.coins-lg .ic { width: 18px; height: 18px; }
.coins-xl { gap: 8px; }
.coins-xl .num { font: 600 clamp(2.5rem, 2rem + 1.6vw, 3.5rem)/1 var(--font-display); font-stretch: 87.5%; letter-spacing: -.02em; }
.coins-xl .ic { width: 28px; height: 28px; stroke-width: 1.4; }
.tag-coins { display: inline-flex; align-items: center; gap: 6px; color: var(--brass); border-color: currentColor; }
.tag-coins .coins .num { color: inherit; }
.num-col { text-align: right !important; }
.count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--black); color: var(--white); font-size: .75rem; font-weight: 650; }
.person-link { font-weight: 600; }
a.person-link { color: inherit; text-decoration: none; }
a.person-link:hover { text-decoration: underline; }

/* recognition feed */
.rec { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px; padding: 18px 20px; position: relative; }
.rec + .rec { border-top: 1px solid var(--rule); }
.rec:hover { background: var(--paper-2); }
.rec.has-coins::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 2px 2px 0; background: var(--brass); }
.rec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; margin: 0; font-size: var(--fs-small); }
.rec-people { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.rec-people strong { color: var(--black); }
.rec-from { color: var(--stone); }
.rec-award { margin: 6px 0 0; font: 600 1.1875rem/1.2 var(--font-display); font-stretch: 87.5%; }
.rec-award a { color: var(--black); text-decoration: none; }
.rec-award a:hover { text-decoration: underline; }
.rec-award a::after { content: ""; position: absolute; inset: 0; }
.rec-msg { margin: 4px 0 0; max-width: 72ch; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rec-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 10px 0 0; font-size: var(--fs-meta); color: var(--stone-2); }
.rec-foot:empty { display: none; }
.rec .person-link, .rec .tag { position: relative; z-index: 1; }
.rec-comments { display: inline-flex; align-items: center; gap: 5px; }
.rail-awards { list-style: none; margin: 0; padding: 2px 4px 6px; }
.rail-awards li { display: flex; align-items: center; gap: 10px; padding: 6px 6px; font-size: var(--fs-small); color: var(--ink); line-height: 1.3; }
.rail-awards .sub { display: block; font-size: var(--fs-meta); color: var(--stone-2); }
.rail-awards .coins .num { font-weight: 600; color: var(--stone); }

/* give recognition */
.side-card { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s4) var(--s5); }
.side-card h2 { font-size: 1.125rem; margin-bottom: var(--s3); }
.side-card .how-list { border-top: 0; }
.side-card .how-list li:last-child { border-bottom: 0; }
.award-pick legend { font-weight: 600; font-size: .9375rem; }
.award-pick .req { font-weight: 400; }
.award-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.award-option { position: relative; }
.award-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.award-option label { display: flex; gap: 12px; align-items: flex-start; height: 100%; padding: 12px; border: 1px solid var(--rule-strong); border-radius: var(--r-md); background: var(--white); cursor: pointer; font-size: var(--fs-small); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.award-option label:hover { border-color: var(--stone); }
.award-option strong { display: block; color: var(--black); font-size: .9375rem; }
.award-option .sub { display: block; color: var(--stone); margin-top: 2px; line-height: 1.4; }
.award-coins { display: block; margin-top: 6px; color: var(--brass); font-weight: 600; font-size: var(--fs-meta); }
.award-coins .coins .num { color: inherit; }
.award-option input:checked + label { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); background: var(--paper-2); }
.award-option input:focus-visible + label { outline: 3px solid var(--brass); outline-offset: 2px; }

/* recognition detail */
.rec-full { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.rec-full-head { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--s5); padding: var(--s6); border-bottom: 1px solid var(--rule); }
.rec-kicker { margin: 0; font-size: var(--fs-meta); font-weight: 650; color: var(--stone); letter-spacing: .02em; }
.rec-full-head h1 { font-size: clamp(2rem, 1.5rem + 1.6vw, 3rem); line-height: 1.02; margin: 4px 0 var(--s4); }
.rec-pair { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }
.rec-person { display: inline-flex; align-items: center; gap: 10px; }
.rec-person .sub { display: block; font-size: var(--fs-meta); color: var(--stone-2); line-height: 1.2; }
.rec-person strong { font-size: 1.0625rem; color: var(--black); }
.rec-pair-arrow { color: var(--rule-strong); }
.rec-full-body { padding: var(--s6); }
.rec-quote { margin: 0; max-width: 60ch; font-size: clamp(1.1875rem, 1.05rem + .45vw, 1.4375rem); line-height: 1.5; color: var(--charcoal); border-left: 3px solid var(--brass); padding-left: var(--s5); white-space: pre-line; }
.rec-coin-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s4); margin: var(--s5) 0 0; padding-top: var(--s4); border-top: 1px solid var(--rule); color: var(--stone); font-size: var(--fs-small); }
.rec-tools { margin-top: var(--s4); }
.comments { margin-top: var(--s7); max-width: 52rem; }
.comments h2 { font-size: 1.375rem; display: flex; align-items: baseline; gap: 10px; margin-bottom: var(--s4); }
.comments h2 .num { font: 500 1rem/1 var(--font-text); color: var(--stone-2); }
.comment-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.comment { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.comment-body { margin: 4px 0 0; white-space: pre-line; }
.comment-remove { margin: 6px 0 0; font-size: var(--fs-meta); color: var(--stone); }
.comment-form { display: grid; gap: 8px; margin-top: var(--s5); }
.comment-form label { font-weight: 600; }

/* wallet */
.wallet-summary { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); margin-bottom: var(--s6); }
.stat { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s5); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat p { margin: 0; }
.stat-label { font-size: var(--fs-small); font-weight: 650; color: var(--stone); }
.stat-value { margin: 4px 0 !important; }
.stat-note { font-size: var(--fs-meta); color: var(--stone-2); }
.stat-main { background: var(--sb-bg); border-color: var(--sb-bg); color: var(--sb-text); }
.stat-main .stat-label { color: #cfcac0; }
.stat-main .stat-note { color: #a8a49b; }
.stat-main .coins .num { color: #fff; }
.stat-main .coins .ic { color: var(--gold); }
.wallet-layout { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: var(--s5); align-items: start; }
.wallet-empty { padding: var(--s6) var(--s5); }
.wallet-empty h2 { font-size: 1.5rem; }
.ledger-table .sub a { color: var(--stone); }
.ledger-table td.num-col { white-space: nowrap; }
.ledger-ok { margin: 0 0 var(--s5); font-size: var(--fs-small); color: var(--stone); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.profile-coins { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 0; }
.recog-counts { display: flex; gap: var(--s5); margin: 0 0 var(--s3); color: var(--stone); font-size: var(--fs-small); }
.recog-counts strong { font: 600 1.5rem/1 var(--font-display); color: var(--black); margin-right: 4px; }
.recog-mini { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.recog-mini li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: .9375rem; }
.recog-mini a { font-weight: 600; }
.recog-mini .sub { display: block; color: var(--stone); font-size: var(--fs-meta); }

/* leaderboard */
.board-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s3) var(--s5); border-bottom: 1px solid var(--rule); margin-bottom: var(--s4); }
.board-tabs { border-bottom: 0; margin: 0; }
.board-tabs a { align-items: center; }
.segmented { list-style: none; margin: 0 0 8px; padding: 3px; display: inline-flex; gap: 2px; background: var(--sand); border-radius: var(--r-sm); }
.segmented a { display: block; padding: 6px 12px; border-radius: 3px; color: var(--stone); text-decoration: none; font-size: var(--fs-small); font-weight: 600; }
.segmented a:hover { color: var(--black); }
.segmented a[aria-current] { background: var(--white); color: var(--black); box-shadow: var(--lift); }
.board-rule { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 var(--s6); max-width: 78ch; font-size: var(--fs-small); color: var(--stone); }
.board-rule .ic { margin-top: 2px; flex: 0 0 auto; }
.board-rule strong { color: var(--ink); }
.leaders { list-style: none; padding: 0; margin: 0 0 var(--s6); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.leader { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); align-items: center; background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s5); padding-top: var(--s6); overflow: hidden; }
.leader-rank { position: absolute; top: 10px; right: 16px; font: 600 3rem/1 var(--font-display); font-stretch: 87.5%; color: var(--sand); letter-spacing: -.03em; }
.leader-text { min-width: 0; position: relative; }
.leader-text p { margin: 0; }
.leader-name { font-weight: 650; font-size: 1.0625rem; color: var(--black); overflow-wrap: anywhere; }
.leader-dept { color: var(--stone); font-size: var(--fs-small); }
.leader-value { margin-top: 8px !important; display: flex; align-items: baseline; gap: 6px; color: var(--stone); font-size: var(--fs-small); }
.leader-value strong { font: 600 1.375rem/1 var(--font-display); color: var(--black); }
.leader-1 { background: var(--sb-bg); border-color: var(--sb-bg); color: var(--sb-text); }
.leader-1 .leader-rank { color: #34363b; }
.leader-1 .leader-name, .leader-1 .leader-name a, .leader-1 .leader-value strong, .leader-1 .coins .num { color: #fff; }
.leader-1 .leader-dept, .leader-1 .leader-value { color: #a8a49b; }
.leader-1 .coins .ic { color: var(--gold); }
.leader-1 .tag-demo { color: #cfcac0; border-color: #8c8e93; }
.leader-1 :focus-visible { outline-color: var(--gold); }
.board-table .rank-col { width: 5.5rem; }
.rank-num { font: 600 1.25rem/1 var(--font-display); color: var(--black); }
.board-table .sub { font-size: var(--fs-meta); }
.board-table tr.is-me td { background: var(--paper-2); }
.board-table tr.is-me td:first-child { box-shadow: inset 3px 0 0 var(--brass); }

/* rewards */
.balance-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 20px; margin-bottom: var(--s5); }
.balance-bar p { margin: 0; display: flex; align-items: center; gap: 12px; }
.balance-label { font-size: var(--fs-small); font-weight: 650; color: var(--stone); }
.balance-note { flex: 1 1 22rem; font-size: var(--fs-small); color: var(--stone); }
.reward-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: var(--s4); }
.reward-card { position: relative; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.reward-card:hover { border-color: var(--rule-strong); box-shadow: var(--lift); }
.reward-card.is-unavailable .reward-visual { opacity: .55; }
.reward-visual { aspect-ratio: 4 / 3; background: var(--sand); overflow: hidden; }
.reward-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.reward-ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--stone); background-color: var(--sand);
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, var(--rule) 14px 15px); }
.reward-ph .ic { width: 44px; height: 44px; stroke-width: 1.1; background: var(--sand); padding: 10px; box-sizing: content-box; border-radius: 50%; }
.reward-ph.large .ic { width: 80px; height: 80px; padding: 18px; }
.reward-info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.reward-info p { margin: 0; }
.reward-cat { font-size: var(--fs-meta); color: var(--stone-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.reward-name { font: 650 1.0625rem/1.3 var(--font-text); }
.reward-name a { color: var(--black); text-decoration: none; }
.reward-name a::after { content: ""; position: absolute; inset: 0; }
.reward-card:hover .reward-name a { text-decoration: underline; }
.reward-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto !important; padding-top: 10px; font-size: var(--fs-small); }
.reward-need { font-size: var(--fs-meta); color: var(--stone-2); }
.reward-detail { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s7); align-items: start; }
.reward-detail-visual { aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; background: var(--sand); border: 1px solid var(--rule); position: sticky; top: calc(var(--topbar-h) + var(--s5)); }
.reward-detail-text h1 { font-size: clamp(2rem, 1.5rem + 1.6vw, 3rem); line-height: 1.04; margin: 6px 0 var(--s3); }
.reward-price { margin: 0 0 var(--s4); }
.reward-desc { font-size: var(--fs-lead); line-height: 1.5; color: var(--charcoal); max-width: 56ch; }
.reward-detail .facts { margin: var(--s5) 0; }
.redeem-box { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s5); }
.redeem-box h2 { font-size: 1.25rem; margin-bottom: var(--s4); }
.redeem-form .field { max-width: 26rem; }
.blockers { list-style: none; padding: 0; margin: 0 0 var(--s4); display: grid; gap: 8px; }
.blockers li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--sand); border-radius: var(--r-sm); font-size: var(--fs-small); }
.blockers .ic { margin-top: 1px; color: var(--stone); }
.redeem-box > .hint { margin-top: var(--s4); }
.reward-history { margin-top: var(--s6); }
.reward-history h2 { font-size: 1.125rem; margin-bottom: var(--s3); }
.reward-history li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; font-size: var(--fs-small); }

/* engagement administration */
.row-actions { display: inline-flex; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.thumb { display: block; width: 44px; height: 44px; flex: 0 0 auto; border-radius: var(--r-sm); overflow: hidden; background: var(--sand); }
.reward-ph.thumb .ic { width: 18px; height: 18px; padding: 4px; }
.current-image { display: flex; gap: var(--s4); align-items: center; margin-bottom: var(--s4); }
.current-image .reward-img, .current-image .reward-ph { width: 88px; height: 88px; border-radius: var(--r-sm); }
.inset-block { padding: var(--s5); }
.comms-form + .panel, .comms-form + section { margin-top: var(--s6); }
.icon-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.icon-option { position: relative; }
.icon-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-option label { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--rule-strong); border-radius: var(--r-md); background: var(--white); cursor: pointer; font-size: var(--fs-meta); color: var(--stone); text-align: center; }
.icon-option label .ic { width: 26px; height: 26px; color: var(--charcoal); }
.icon-option input:checked + label { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); color: var(--black); }
.icon-option input:focus-visible + label { outline: 3px solid var(--brass); outline-offset: 2px; }
.queue { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s3); }
.queue-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4); align-items: start; background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px 20px; }
.queue-item p { margin: 0; }
.queue-title { font: 650 1.0625rem/1.35 var(--font-text); margin: 6px 0 2px; }
.queue-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--stone); }
.queue-note { margin-top: 6px !important; font-size: var(--fs-small); color: var(--ink); }
.queue-actions { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: flex-end; align-items: flex-start; max-width: 20rem; }
.queue-actions form { margin: 0; }
.queue .row-menu-body { position: relative; }

:root[data-theme="dark"] .stat-main, :root[data-theme="dark"] .leader-1, :root[data-theme="dark"] .seal.has-coins { box-shadow: 0 0 0 1px #3a3935; }
:root[data-theme="dark"] .reward-ph .ic { background: var(--sand); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .stat-main, :root[data-theme="system"] .leader-1, :root[data-theme="system"] .seal.has-coins { box-shadow: 0 0 0 1px #3a3935; }
}

@media (max-width: 1180px) {
  .wallet-layout { grid-template-columns: minmax(0, 1fr); }
  .leaders { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .leader-1 { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .reward-detail { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .reward-detail-visual { position: static; aspect-ratio: 16 / 9; }
  .rail-awards { display: none; }
}
@media (max-width: 760px) {
  .wallet-summary, .leaders { grid-template-columns: minmax(0, 1fr); }
  .award-options { grid-template-columns: minmax(0, 1fr); }
  .icon-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .rec > .seal { width: 36px; height: 36px; }
  .rec-full-head { grid-template-columns: minmax(0, 1fr); padding: var(--s5) var(--s4); gap: var(--s3); }
  .rec-full-body { padding: var(--s5) var(--s4); }
  .rec-quote { padding-left: var(--s4); }
  .queue-item { grid-template-columns: minmax(0, 1fr); }
  .queue-actions { justify-content: flex-start; max-width: none; }
  .board-controls { flex-direction: column; align-items: stretch; }
  .segmented { align-self: flex-start; }
  .balance-bar { padding: 12px 16px; }
  .reward-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); }
}

/* ---------- 17. Objectives & Tasks ---------- */
input[type=date], input[type=number], input[type=file] {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px; font: 400 1rem/1.4 var(--font-text); color: var(--ink);
  background: var(--white); border: 1px solid var(--control); border-radius: var(--r-sm); }
input[type=date] { max-width: 14rem; }
input[type=number] { max-width: 10rem; }
input[type=file] { padding: 8px; cursor: pointer; }
input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--black); flex: 0 0 auto; }
.progress-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.progress { -webkit-appearance: none; appearance: none; flex: 1; min-width: 6rem; height: 8px; border: 0; border-radius: 4px; background: var(--sand); overflow: hidden; color: var(--brass); }
.progress::-webkit-progress-bar { background: var(--sand); border-radius: 4px; }
.progress::-webkit-progress-value { background: var(--brass); border-radius: 4px; }
.progress::-moz-progress-bar { background: var(--brass); border-radius: 4px; }
.progress-num { font-size: var(--fs-small); font-weight: 650; color: var(--black); min-width: 3ch; text-align: right; }
.task-groups { display: grid; gap: var(--s6); }
.task-group h2 { font-size: 1.125rem; display: flex; align-items: baseline; gap: 8px; margin-bottom: var(--s3); }
.task-group h2 .num { font: 500 var(--fs-small)/1 var(--font-text); color: var(--stone-2); }
.is-overdue-group h2 { color: var(--bad); }
.task-list { list-style: none; padding: 0; margin: 0; background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); }
.task-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; }
.task-row + .task-row { border-top: 1px solid var(--rule); }
.task-row:hover { background: var(--paper-2); }
.task-row.is-overdue { box-shadow: inset 3px 0 0 var(--bad); }
.task-row.is-closed .task-title { color: var(--stone); text-decoration: line-through; text-decoration-color: var(--rule-strong); }
.task-check { margin: 0; }
.check-btn { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1.5px solid var(--control); border-radius: 50%; background: var(--white); color: transparent; cursor: pointer; transition: border-color .15s, color .15s, background-color .15s; }
.check-btn:hover { border-color: var(--ok); color: var(--ok); }
.check-btn.is-static { cursor: default; border-style: dashed; }
.check-btn.is-done { border-style: solid; border-color: var(--ok); background: var(--ok); color: var(--white); }
.task-main { min-width: 0; }
.task-title { font-weight: 650; color: var(--black); text-decoration: none; }
.task-title:hover { text-decoration: underline; }
.task-main .meta-line { margin: 2px 0 0; }
.task-main .meta-line .ic { vertical-align: -2px; }
.task-side { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px 10px; }
.due { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-small); color: var(--stone); white-space: nowrap; }
.due.is-overdue { color: var(--bad); font-weight: 650; }
.due.is-soon { color: var(--warn); font-weight: 600; }
.done-box { margin-top: var(--s6); }
.done-box summary { cursor: pointer; font-weight: 600; color: var(--stone); margin-bottom: var(--s3); }
.objective-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: var(--s4); }
.objective-card { display: grid; gap: 10px; align-content: start; background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 18px 20px; }
.objective-card.is-closed { background: var(--paper-2); }
.objective-card p { margin: 0; }
.objective-kicker { font-size: var(--fs-meta); color: var(--stone-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.objective-title { font: 600 1.25rem/1.15 var(--font-display); font-stretch: 87.5%; }
.objective-title a { color: var(--black); text-decoration: none; }
.objective-title a:hover { text-decoration: underline; }
.objective-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: var(--s4); max-width: 40rem; }
.objective-progress .progress-wrap { flex: 1 1 18rem; }
.sub-head { font-size: 1.25rem; margin: var(--s7) 0 var(--s4); }
.task-list.boxed { margin-bottom: var(--s4); }
.work-tags { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: var(--s3) 0 0; }
.work-desc { font-size: 1.0625rem; line-height: 1.6; max-width: 64ch; white-space: pre-line; }
.status-box { margin-top: var(--s6); max-width: 36rem; }
.status-form { display: grid; gap: var(--s4); justify-items: start; }
.segmented-choice { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--sand); border-radius: var(--r-sm); }
.segmented-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented-choice label { padding: 7px 14px; border-radius: 3px; font-size: var(--fs-small); font-weight: 600; color: var(--stone); cursor: pointer; }
.segmented-choice input:checked + label { background: var(--white); color: var(--black); box-shadow: var(--lift); }
.segmented-choice input:focus-visible + label { outline: 3px solid var(--brass); outline-offset: 1px; }
.toolbar .field.check { min-height: 44px; }
@media (max-width: 760px) {
  .task-row { grid-template-columns: 28px minmax(0, 1fr); padding: 12px; }
  .task-side { grid-column: 2; justify-content: flex-start; }
  .objective-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 18. New & Upcoming, and the Home additions ---------- */
.media-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s3); border-bottom: 1px solid var(--rule); margin-bottom: var(--s5); }
.media-nav .filters { border-bottom: 0; margin: 0; }
.media-nav .segmented .num { color: var(--stone-2); font-weight: 500; margin-left: 2px; }
.media-cover-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-cover-ph { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; background: var(--sb-bg); color: var(--gold); }
.media-cover-ph .ic { position: relative; z-index: 1; width: 40px; height: 40px; stroke-width: 1.2; }
.media-ph-word { position: absolute; left: -.04em; bottom: -.18em; font: 700 clamp(3.5rem, 2rem + 6vw, 7.5rem)/1 var(--font-display); font-stretch: 87.5%; letter-spacing: -.04em; color: rgba(255, 255, 255, .06); white-space: nowrap; }
.media-ph-event { background: #2a2620; }
.media-ph-behind { background: #22262a; }
.media-ph-release { background: #1d1e21; }
.media-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0; font-size: var(--fs-meta); font-weight: 650; color: var(--stone); }
.media-date { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--stone); }
.media-date.is-upcoming { color: var(--brass); }
.media-has-video { display: inline-flex; align-items: center; gap: 4px; }
.media-hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--s6); }
.media-hero-cover { aspect-ratio: 16 / 10; min-height: 100%; background: var(--sb-bg); }
.media-hero-text { padding: var(--s6); display: flex; flex-direction: column; justify-content: center; gap: var(--s3); }
.media-hero-title { font-size: clamp(2rem, 1.4rem + 2vw, 3.25rem); line-height: 1; letter-spacing: -.02em; }
.media-hero-title a { color: var(--black); text-decoration: none; }
.media-hero-title a:hover { text-decoration: underline; text-decoration-color: var(--brass); }
.media-hero-summary { font-size: var(--fs-lead); line-height: 1.5; color: var(--charcoal); margin: 0; }
.media-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--s5); }
.media-card { position: relative; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.media-card:hover { border-color: var(--rule-strong); box-shadow: var(--lift); }
.media-card-cover { aspect-ratio: 16 / 9; background: var(--sb-bg); }
.media-card-cover .media-ph-word { font-size: 4.5rem; }
.media-card-text { padding: 16px 18px 18px; display: grid; gap: 6px; }
.media-card-text p { margin: 0; }
.media-title { font: 600 1.375rem/1.1 var(--font-display); font-stretch: 87.5%; }
.media-title a { color: var(--black); text-decoration: none; }
.media-title a::after { content: ""; position: absolute; inset: 0; }
.media-card:hover .media-title a { text-decoration: underline; }
.media-card .tag { position: relative; z-index: 1; }
.media-summary { color: var(--stone); font-size: .9375rem; }
.media-tools { margin-bottom: var(--s5); }
.media-article { max-width: 60rem; }
.media-article-cover { aspect-ratio: 21 / 9; border-radius: var(--r-md); overflow: hidden; background: var(--sb-bg); margin-bottom: var(--s6); }
.media-article-cover .media-ph-word { font-size: clamp(5rem, 3rem + 8vw, 11rem); }
.media-article-head { margin-bottom: var(--s5); padding-bottom: var(--s5); border-bottom: 1px solid var(--rule); }
.media-article-head h1 { font-size: clamp(2.25rem, 1.5rem + 2.6vw, 4rem); line-height: 1; letter-spacing: -.02em; margin: var(--s3) 0 0; max-width: 22ch; }
.media-byline { display: flex; align-items: center; gap: 10px; margin: var(--s5) 0 0; }
.media-byline .sub { display: block; color: var(--stone); font-size: var(--fs-small); }
.media-video { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 var(--s5); }
.media-body { margin-top: var(--s4); }
.thumb-wide { width: 120px; height: 68px; }
.comms-form .format-help { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s4) var(--s5); }
.comms-form .format-help .section-head { border-top: 0; padding-top: 0; }

.engage-strip { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr); gap: var(--s5); margin-bottom: var(--s5); align-items: stretch; }
.engage-card { display: flex; flex-direction: column; }
.engage-card .dash-section-body { flex: 1; }
.coin-card { background: var(--sb-bg); border-color: var(--sb-bg); color: var(--sb-text); }
.coin-card .dash-section-head { border-bottom-color: #2e3034; }
.coin-card .dash-section-head h2 { color: #fff; }
.coin-card .dash-section-head a, .coin-card .coin-card-links a { color: #cfcac0; }
.coin-card .coins .num { color: #fff; }
.coin-card .coins .ic { color: var(--gold); }
.coin-card .meta-line { color: #a8a49b !important; }
.coin-card .meta-line > span + span::before { background: #4a4b50; }
.coin-card :focus-visible { outline-color: var(--gold); }
.coin-card-balance { margin: 4px 0 6px; }
.coin-card-links { margin: var(--s3) 0 0; font-size: var(--fs-small); }
.dash-list.compact > li { padding: 10px 0; }
.dash-foot { margin: 0; padding: 10px 0 12px; border-top: 1px solid var(--rule); font-size: var(--fs-meta); color: var(--stone-2); }
.text-bad { color: var(--bad); }
.mini-board { list-style: none; margin: 0; padding: 4px 0; }
.mini-board li { display: grid; grid-template-columns: 1.5rem 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; font-size: .9375rem; }
.mini-board .rank-num { font-size: 1rem; color: var(--stone); }
.mini-board li:first-child .rank-num { color: var(--brass); }
.mini-board-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-recog { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
.featured-media { overflow: hidden; }
.fm-link { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); text-decoration: none; color: inherit; }
.fm-cover { display: block; aspect-ratio: 16 / 10; background: var(--sb-bg); }
.fm-cover .media-ph-word { font-size: 5rem; }
.fm-text { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: var(--s5); }
.fm-title { font: 600 clamp(1.5rem, 1.2rem + 1vw, 2.125rem)/1.05 var(--font-display); font-stretch: 87.5%; color: var(--black); letter-spacing: -.01em; }
.fm-link:hover .fm-title { text-decoration: underline; text-decoration-color: var(--brass); }
.fm-summary { color: var(--stone); font-size: .9375rem; }
:root[data-theme="dark"] .coin-card, :root[data-theme="dark"] .media-cover-ph { box-shadow: 0 0 0 1px #3a3935; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .coin-card, :root[data-theme="system"] .media-cover-ph { box-shadow: 0 0 0 1px #3a3935; } }
@media (max-width: 1180px) {
  .engage-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .coin-card { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .media-hero { grid-template-columns: minmax(0, 1fr); }
  .media-hero-cover { aspect-ratio: 16 / 9; min-height: 0; }
}
@media (max-width: 760px) {
  .engage-strip { grid-template-columns: minmax(0, 1fr); }
  .fm-link { grid-template-columns: minmax(0, 1fr); }
  .fm-text, .media-hero-text { padding: var(--s4); }
  .media-nav { flex-direction: column; align-items: stretch; }
  .media-nav .segmented { align-self: flex-start; }
  .media-grid { grid-template-columns: minmax(0, 1fr); }
  .media-article-cover { aspect-ratio: 16 / 9; }
}

/* ---------- 18b. Company Alerts: two views under one sidebar tab ---------- */
.alerts-tabs { margin: calc(var(--s5) * -1) 0 var(--s5); }
.alerts-tabs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s6); border-bottom: 1px solid var(--rule); }
.alerts-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 0 12px; color: var(--stone); text-decoration: none; font: 600 1.0625rem/1.2 var(--font-text); box-shadow: inset 0 -3px 0 transparent; }
.alerts-tabs a:hover { color: var(--black); box-shadow: inset 0 -3px 0 var(--rule-strong); }
.alerts-tabs a[aria-current] { color: var(--black); box-shadow: inset 0 -3px 0 var(--brass); }
.alerts-tabs .ic { color: currentColor; }
.alerts-intro { margin: 0 0 var(--s4); }

/* ---------- 19. Profile photos ---------- */
.photo-editor { display: grid; gap: var(--s4); justify-items: start; }
.photo-preview .photo-canvas { display: block; width: 128px; height: 128px; border-radius: var(--r); }
.photo-form { display: grid; gap: var(--s3); justify-items: start; width: 100%; }
.photo-form .field { margin: 0; width: 100%; }
.photo-remove { margin: 0; }

/* ---------- 99. Responsive and motion ---------- */
@media (max-width: 1180px) {
  :root { --gutter: 28px; }
  .split, .apps-layout, .story-split { grid-template-columns: minmax(0, 1fr); }
  .wiki-aside, .wiki-cats { position: static; }
  .wiki-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .wiki-cats ul { display: flex; flex-wrap: wrap; gap: 0 var(--s5); border-top: 0; border-bottom: 1px solid var(--rule); }
  .wiki-cats a { border-bottom: 0; padding: 10px 0; }
  .wiki-cats a[aria-current] { box-shadow: inset 0 -2px 0 var(--brass); }
  .wiki-cats .cats-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wiki-cats { border-top: 0; padding-top: 0; }
  .quick ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-col.side { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); align-items: start; }
  .comms-form { grid-template-columns: minmax(0, 1fr); }
  .people-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); }
  .doc-list li { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .comms { grid-template-columns: minmax(0, 1fr); }
  .comms-rail { position: static; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding: 6px 8px; }
  .comms-rail .rail-label { display: none; }
  .comms-rail .rail-list { display: contents; }
  .comms-rail .rail-list a { padding: 6px 10px; }
  .comms-rail .rail-list a[aria-current] { box-shadow: inset 0 -2px 0 var(--brass); }
}
/* the original sidebar collapses to a top bar with a Menu button */
@media (max-width: 900px) {
  :root { --topbar-h: 59px; }
  .shell { flex-direction: column; }
  .sidebar { position: sticky; top: 0; width: 100%; flex: 0 0 auto; height: auto; max-height: 100vh; overflow-y: visible; }
  .sidebar.open { overflow-y: auto; }
  .brand { padding: 10px 14px; }
  .nav-toggle { display: inline-flex; }
  .sidebar .nav, .sidebar .sidebar-foot { display: none; }
  .sidebar.open .nav, .sidebar.open .sidebar-foot { display: block; }
  html:not(.js) .sidebar .nav, html:not(.js) .sidebar .sidebar-foot { display: block; }
  html:not(.js) .nav-toggle { display: none; }
  html:not(.js) .sidebar { position: static; }
  .auth-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-identity { gap: var(--s5); padding-top: var(--s6); padding-bottom: var(--s6); }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .page { padding-top: var(--s5); padding-bottom: var(--s7); }
  .quick ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-section-head, .dash-section-body, .feed-head, .post, .feed-group { padding-left: 16px; padding-right: 16px; }
  .dash-list.dated > li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .post { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .post .avatar { width: 32px; height: 32px; font-size: .8125rem; }
  .post-full-head { grid-template-columns: minmax(0, 1fr); padding: var(--s4); }
  .post-full-head > .avatar { display: none; }
  .post-full-body, .post-full-foot { padding-left: var(--s4); padding-right: var(--s4); }
  .appearance-options { grid-template-columns: minmax(0, 1fr); }
  .page-head { margin-bottom: var(--s6); }
  .panel { padding: var(--s5) var(--s4); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts dt { border-bottom: 0; padding-bottom: 0; }
  .facts dd { padding-top: 2px; }
  .actions .btn { flex: 1 1 auto; }
  .toolbar > .field, .toolbar > .btn { flex: 1 1 100%; }
  .select-lg { min-width: 0; }
  .person-hero-row { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .person-hero .page-actions { grid-column: 1 / -1; }
  .avatar.xl { width: 88px; height: 88px; font-size: 2rem; }
  .photo-note { display: none; }
  .people-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }
  .people-row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 14px 0; }
  .people-dept, .people-loc, .people-email { padding-left: 44px; font-size: var(--fs-small); color: var(--stone); }
  .people-table { position: relative; }
  .story-head, .person-hero { border-bottom-width: 6px; }
  .org-tree ul { margin-left: 10px; padding-left: 12px; }
  .org-tree ul > .org-node::before { left: -12px; width: 10px; }
  .org-reports { display: none; }
  .error-code { border-bottom-width: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .page-actions, .skip-link, .comms-rail, .tools-bar { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   TAG Finance additions
   ========================================================================== */
.text-bad { color: var(--bad); }
.wrap { overflow-wrap: anywhere; white-space: normal; }
.padded-list { border-top: 0; }
.padded-list > li { padding-left: var(--s5); padding-right: var(--s5); }
.padded-list > li:last-child { border-bottom: 0; }
.panel-title { font-size: 1.125rem; margin: 0 0 var(--s4); }
.stack-section + .stack-section { margin-top: var(--s7); }
.split > .stack-section + .stack-section { margin-top: 0; }
.field.check { display: flex; align-items: center; gap: var(--s2); }
.field.check input { width: auto; }
.field.check label { margin: 0; }

/* Headline numbers */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); margin: 0 0 var(--s7); }
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: var(--white); border-radius: var(--r); box-shadow: var(--lift); padding: var(--s5); min-width: 0; }
.kpi p { margin: 0; }
.kpi-label { color: var(--stone); font-size: var(--fs-small); font-weight: 600; }
.kpi-value { font-family: var(--font-display); font-size: clamp(1.5rem, 1.1rem + 1vw, 2rem); font-weight: 600; line-height: 1.15; margin-top: var(--s2) !important; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-value a { color: inherit; text-decoration: none; }
.kpi-value a:hover { text-decoration: underline; }
.kpi-note { color: var(--stone); font-size: var(--fs-meta); margin-top: var(--s2) !important; line-height: 1.4; }
.kpi-dark { background: var(--sb-bg); color: #fff; box-shadow: none; }
.kpi-dark .kpi-label { color: #cfcac0; }
.kpi-dark .kpi-note { color: #a8a49b; }
.kpi-warn { box-shadow: inset 3px 0 0 var(--warn), var(--lift); }
:root[data-theme="dark"] .kpi-dark { box-shadow: inset 0 3px 0 var(--gold), 0 0 0 1px #3a3935; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .kpi-dark { box-shadow: inset 0 3px 0 var(--gold), 0 0 0 1px #3a3935; } }
.split-after { margin-top: var(--s7); }

/* Approval queue on the overview */
.attention { margin-bottom: var(--s7); border-top: 3px solid var(--brass); }
.queue-list > li { display: grid; grid-template-columns: 8rem minmax(0, 1fr) auto; gap: var(--s2) var(--s4); align-items: baseline; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--rule); }
.queue-list > li:last-child { border-bottom: 0; }
.queue-list .tag { justify-self: start; }
.queue-list .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Record history */
.history h2 { font-size: 1.125rem; border-top: 3px solid var(--black); padding-top: var(--s3); margin: 0 0 var(--s3); }
.history-list > li { display: grid; grid-template-columns: minmax(0, 1fr); padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: var(--fs-small); }
.history-what { font-weight: 600; color: var(--ink); }
.history-when, .history-who { color: var(--stone); font-size: var(--fs-meta); }
.history-when { order: 2; }
.history-who { order: 3; }
.history-what { order: 1; }
.empty-inline { color: var(--stone); font-size: var(--fs-small); }

/* Decisions */
.decision-bar { margin-bottom: var(--s6); }
.step-form { display: inline-flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: 0; }
.step-form input[name="note"] { width: 15rem; max-width: 100%; min-height: 34px; padding: 4px 10px; font-size: var(--fs-small); }
.danger-zone { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px dashed var(--rule-strong); }

/* Invoice lines and attachments */
.lines-table input { width: 100%; min-width: 0; }
.lines-table .qty-col { width: 7.5rem; }
.lines-table .amt-col { width: 10rem; }
.lines-table td { padding: 6px 8px; }
.attach-form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s4); }
.attach-form input[type="file"] { flex: 1 1 14rem; min-width: 0; }
.mini-table th, .mini-table td { padding: 8px 10px; }

/* Imports and reports */
.how-steps { padding-left: 1.25rem; margin: 0; }
.how-steps li { margin-bottom: var(--s2); color: var(--stone); font-size: var(--fs-small); line-height: 1.5; }
.how-steps li::marker { color: var(--ink); font-weight: 600; }
.warn-list { margin: var(--s2) 0 0; padding-left: 1.25rem; }
.warn-list li { margin-bottom: 4px; }
.definitions { margin-top: var(--s6); border-top: 1px solid var(--rule); padding-top: var(--s4); color: var(--stone); font-size: var(--fs-small); }
.definitions summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.definitions dl, .definitions p { margin-top: var(--s3); }

/* Sign-in steps */
.auth-step { margin: 0 0 var(--s2); color: var(--stone); font-size: var(--fs-meta); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.setup-steps { padding-left: 1.25rem; margin: 0 0 var(--s5); }
.setup-steps > li { margin-bottom: var(--s4); line-height: 1.5; }
.setup-key { margin: var(--s2) 0 0; padding: var(--s3); background: var(--sand); border-radius: var(--r-sm); }
.setup-key code { font-family: var(--font-code); font-size: 1.0625rem; letter-spacing: .08em; word-spacing: .3em; overflow-wrap: anywhere; white-space: normal; }
.code-input { font-family: var(--font-code); font-size: 1.5rem !important; letter-spacing: .3em; text-align: center; max-width: 12rem; }

/* Royalty statement (printable) */
.statement-page { background: var(--paper); }
.statement { max-width: 960px; margin: 0 auto; padding: var(--s7) var(--s5); background: var(--white); }
.statement-head { display: flex; gap: var(--s5); align-items: center; border-bottom: 3px solid var(--black); padding-bottom: var(--s4); margin-bottom: var(--s5); }
.statement-head h1 { font-size: var(--fs-h2); margin: 0; }
.statement-head p { margin: 4px 0 0; color: var(--stone); }
.statement-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s5); margin: 0 0 var(--s6); font-size: var(--fs-small); }
.statement-facts dt { color: var(--stone); }
.statement-facts dd { margin: 0; }
.table tfoot th, .table tfoot td { background: transparent; border-bottom: 0; border-top: 1px solid var(--black); color: var(--ink); font-size: .9375rem; padding: 14px 16px; }
.table tfoot th[scope="row"] { text-align: left; }
.statement tfoot th, .statement tfoot td { padding: 10px 16px; border-top: 1px solid var(--rule); text-align: right; font-weight: 600; }
.statement-foot { margin-top: var(--s6); color: var(--stone); font-size: var(--fs-meta); }
@media print {
  .statement-page, .statement { background: #fff !important; color: #000; }
  .statement { padding: 0; max-width: none; }
  .statement .table th { background: #fff; }
}

@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .kpi-grid, .kpi-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .queue-list > li { grid-template-columns: minmax(0, 1fr); padding: var(--s3) var(--s4); }
  .queue-list .num { text-align: left; }
  .padded-list > li { padding-left: var(--s4); padding-right: var(--s4); }
  .step-form input[name="note"] { width: 100%; }
  .statement { padding: var(--s5) var(--s4); }
}

/* Sign in through TAG Collectibles HQ */
.auth-divider { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0; color: var(--stone); font-size: var(--fs-meta); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
