/* ==========================================================================
   SiteRISE Fold kit. Phase 1 components on top of fold.css.
   Every value comes from a token in fold.css. No new colors.
   ========================================================================== */

/* Dark tokens scoped to an element, so the kit can show both themes at once. */
.theme-dark {
  color-scheme: dark;
  --bg: #14161C; --surface: #1D2029; --bg-elevated: #262A35; --under: #14161C;
  --text: #E9ECF2; --heading: #FFFFFF; --muted: #A3AABB; --slate: #7D8599;
  --border: #2E3340; --border-strong: #3B4150;
  --teal: #2FE3C5; --teal-dark: #5CEBD3; --deep: #2FE3C5; --deep-2: #7FF0DE;
  --accent-fill: #2FE3C5; --accent-fill-2: #5CEBD3; --on-accent: #17181F; --focus: #2FE3C5;
  --yes-bg: #173A33; --yes-fg: #5EE0B9; --no-bg: #3D2220; --no-fg: #FF8F80;
  --neutral-bg: #262A35; --neutral-fg: #A3AABB;
  --warn: #F0B429; --warn-bg: rgba(240,180,41,.12); --warn-line: #8A6D00; --on-warn: #17181F;
  --danger-fill: #E8695C; --on-danger: #17181F;
  --chart-accent: #2FE3C5; --chart-rest: #4A5163; --chart-axis: #3A3F4D; --chart-grid: #252934;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -10px rgba(0,0,0,.6);
  background: var(--bg); color: var(--text);
}
.theme-light { color-scheme: light; background: var(--bg); color: var(--text); }

/* ---- 12 column grid, spans 3, 4, 6, 12 only ---------------------------- */
.g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.g12 > * { grid-column: span 12; min-width: 0; }
.g12 > .s3 { grid-column: span 3; } .g12 > .s4 { grid-column: span 4; }
.g12 > .s6 { grid-column: span 6; } .g12 > .s8 { grid-column: span 8; }
@media (max-width: 1100px) { .g12 > .s3 { grid-column: span 6; } .g12 > .s4, .g12 > .s8 { grid-column: span 12; } }
@media (max-width: 760px) { .g12 > .s3, .g12 > .s6 { grid-column: span 12; } .g12 { gap: 12px; } }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- Ink band: interpretation only (forecasts, opportunities, plans) --- */
.band {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--ink); color: #E6E8EF; padding: 26px 28px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}
:root[data-theme="dark"] .band, .theme-dark .band { background: #0B0C10; box-shadow: inset 0 0 0 1px #262A35; }
.band::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(45deg, transparent 48.5%, rgba(255,255,255,.05) 48.5% 51.5%, transparent 51.5%),
                    linear-gradient(-45deg, transparent 48.5%, rgba(255,255,255,.03) 48.5% 51.5%, transparent 51.5%);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(100deg, transparent 30%, #000 100%); mask-image: linear-gradient(100deg, transparent 30%, #000 100%);
}
.band h2, .band h3 { color: #FFFFFF; }
.band a { color: #2FE3C5; }
.band .band-eyebrow { font: 700 11px var(--font-display); font-stretch: 112%; letter-spacing: .14em; text-transform: uppercase; color: #2FE3C5; }
.band .band-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 12px; color: #9AA3B5; }
.band .band-meta b { color: #E6E8EF; font-weight: 600; }
.band ol, .band ul { margin: 14px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.55; }
.band .wedge { position: absolute; right: 0; top: 0; height: 100%; width: auto; z-index: -1; opacity: .9; }
/* The band is ink whether the theme was chosen in SiteRISE or by the device. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .band { background: #0B0C10; box-shadow: inset 0 0 0 1px #262A35; } }
/* Text, pills and buttons on the ink band. The band is ink in both themes,
   so these use the sidebar's ink-safe colours rather than page tokens. */
.band { --band-text: var(--side-text); --band-muted: var(--side-muted); color: var(--band-text); }
.band p, .band li, .band td { color: var(--band-text); }
.band .muted, .band small, .band .meta { color: var(--band-muted); }
.band .btn-ghost { color: var(--side-text); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); background: transparent; }
.band .btn-ghost:hover { background: rgba(255,255,255,.08); }
.band .pill { background: rgba(255,255,255,.10); color: var(--side-text); }
.band .pill.yes { background: rgba(47,227,197,.18); color: #2FE3C5; }
.band .pill.pending, .band .pill.warn { background: rgba(255,196,77,.18); color: #FFC44D; }
.band table th { color: var(--band-muted); }
.band table td, .band table th { border-color: rgba(255,255,255,.12); }
/* Figures on the band: page tokens are dark in the light theme, so a KPI value
   on ink would vanish. (0,3,0) so it beats the compat KPI rule. */
.band .kpi .value, .band .card .value, .band .value { color: #FFFFFF; }
.band .kpi .label, .band .kpi .meta { color: var(--band-muted); }

/* ---- Internal: agency-only content ------------------------------------- */
.internal { position: relative; box-shadow: inset 4px 0 0 var(--steel); }
.card.internal { padding-left: 24px; }
.tag-internal {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px;
  font: 700 10.5px var(--font-display); font-stretch: 112%; letter-spacing: .14em; text-transform: uppercase;
  color: #FFFFFF; background: var(--steel);
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
}
html[data-role="client"] .agency-only { display: none !important; }

/* ---- Subject bar (tabs) ------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: 22px; }
.tabs a, .tabs button {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px;
  font: 600 13.5px var(--font-body); color: var(--muted); white-space: nowrap; text-decoration: none;
}
.tabs a:hover, .tabs button:hover { color: var(--heading); text-decoration: none; }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--heading); }
.tabs [aria-current="page"]::after, .tabs [aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; background: var(--accent-fill);
  clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
}
.tabs .nav-count { position: static; margin-left: 2px; }

/* ---- Toolbar above lists ------------------------------------------------ */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.search {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; min-width: 240px; flex: 0 1 320px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--muted);
  clip-path: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm));
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input { border: 0; outline: 0; background: transparent; font: 500 13.5px var(--font-body); color: var(--heading); width: 100%; }

/* ---- Chips (filters) ---------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  font: 600 12.5px var(--font-body); color: var(--heading); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong);
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); cursor: pointer;
}
.chip:hover { background: var(--bg-elevated); }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); box-shadow: none; }
.chip .x { width: 12px; height: 12px; }
.chip svg.pmark, .chip .lg { width: 14px; height: 14px; }

/* ---- Status chips: one per post / item state --------------------------- */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; white-space: nowrap;
  font: 600 11.5px var(--font-body); color: var(--neutral-fg); background: var(--neutral-bg);
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
}
.status::before { content: ""; width: 7px; height: 7px; background: currentColor; flex: none; }
.status.draft::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.status.review { color: var(--warn); background: var(--warn-bg); }
.status.review::before { transform: rotate(45deg); width: 6px; height: 6px; }
.status.approved, .status.scheduled { color: var(--deep); background: var(--yes-bg); }
.status.scheduled::before { transform: rotate(45deg); width: 6px; height: 6px; }
.status.published { color: var(--yes-fg); background: var(--yes-bg); }
.status.published::before { clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); width: 8px; height: 8px; }
.status.failed { color: var(--no-fg); background: var(--no-bg); }
.status.failed::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 8px; height: 8px; }
.status.removed { text-decoration: line-through; }

/* Count badge (unread, waiting) reuses .nav-count colours */
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; font: 700 11px var(--font-body); color: var(--count-fg); background: var(--count-bg); }
.badge.quiet { color: var(--heading); background: var(--bg-elevated); }

/* ---- Forms -------------------------------------------------------------- */
.form { display: grid; gap: 18px; max-width: 720px; }
.fset { display: grid; gap: 16px; padding: 22px 0; border-top: 1px solid var(--border); }
.fset:first-child { border-top: 0; padding-top: 0; }
.fset > h3 { font-size: 15px; }
.fset > .fset-sub { margin-top: -10px; font-size: 12.5px; color: var(--muted); }
.frow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .frow { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .lab { font: 600 12.5px var(--font-body); color: var(--heading); }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--no-fg); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.field .err::before { content: ""; width: 8px; height: 8px; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 0; outline: 0;
  font: 500 14px var(--font-body); color: var(--heading); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  clip-path: polygon(0 0, calc(100% - var(--cut-sm)) 0, 100% var(--cut-sm), 100% 100%, 0 100%);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-size: 5px 5px; background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-repeat: no-repeat; padding-right: 32px; }
.input:focus, .select:focus, .textarea:focus { box-shadow: inset 0 0 0 2px var(--focus); }
.input.bad { box-shadow: inset 0 0 0 2px var(--no-fg); }
.input[disabled] { color: var(--muted); background: var(--bg-elevated); }
.input::placeholder, .textarea::placeholder { color: var(--slate); }

/* Checkbox and radio: square and octagon */
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; font-size: 13.5px; cursor: pointer; }
.check input { appearance: none; width: 18px; height: 18px; flex: none; margin: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-strong); cursor: pointer; display: grid; place-items: center; }
.check input:checked { background: var(--accent-fill); box-shadow: none; }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input[type=radio] { clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%); } /* a sharper octagon: it read as a circle on a phone */
.check input[type=radio]:checked::after { width: 8px; height: 8px; border: 0; transform: none; background: var(--on-accent); clip-path: inherit; }
.check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Toggle: a slanted track with a square knob */
.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 13.5px; min-height: 36px; }
.toggle input { appearance: none; position: relative; width: 44px; height: 24px; flex: none; margin: 0; cursor: pointer; background: var(--border-strong);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); transition: background .12s; }
.toggle input::after { content: ""; position: absolute; top: 4px; left: 8px; width: 16px; height: 16px; background: var(--surface); transition: transform .18s cubic-bezier(.2,.7,.2,1); }
.toggle input:checked { background: var(--accent-fill); }
:root[data-theme="dark"] .toggle input:checked::after, .theme-dark .toggle input:checked::after { background: #17181F; }
.toggle input:checked::after { transform: translateX(12px); }
.toggle input:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Date picker */
.dpick { width: 280px; padding: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.dpick .dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font: 700 14px var(--font-display); font-stretch: 112%; color: var(--heading); }
.dpick .dp-head button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); }
.dpick .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 12.5px; }
.dpick .dp-grid span { color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; }
.dpick .dp-grid button { height: 34px; font: 500 12.5px var(--font-body); color: var(--heading); font-variant-numeric: tabular-nums; }
.dpick .dp-grid button:hover { background: var(--bg-elevated); }
.dpick .dp-grid .in { background: var(--yes-bg); color: var(--deep); }
.dpick .dp-grid .end { background: var(--accent-fill); color: var(--on-accent); clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%); }
.dpick .dp-grid .off { color: var(--slate); pointer-events: none; }
.dpick .dp-grid .today { box-shadow: inset 0 -2px 0 var(--deep); }

/* ---- Lists and tables --------------------------------------------------- */
.list { display: grid; background: var(--surface); border: 1px solid var(--border); }
.list > .li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; }
.list > .li:first-child { border-top: 0; }
.list > a.li:hover { background: var(--bg-elevated); text-decoration: none; }
.li .li-t { font-weight: 600; color: var(--heading); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .li-s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.li .li-r { display: flex; align-items: center; gap: 10px; }
.ptable .tt { font-weight: 600; color: var(--heading); }
.ptable .ts { font-size: 12px; color: var(--muted); }
.ptable tbody tr:hover td { background: var(--bg-elevated); }
.ptable .actions { text-align: right; white-space: nowrap; }
.twrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); }
.twrap .ptable { min-width: 720px; }
.twrap .ptable th:first-child, .twrap .ptable td:first-child { padding-left: 18px; }
.twrap .ptable th:last-child, .twrap .ptable td:last-child { padding-right: 18px; }

/* Monogram and small avatars */
.mono { width: 36px; height: 36px; flex: none; display: grid; place-items: center; font: 800 12.5px var(--font-display); font-stretch: 112%; color: #FFFFFF; background: var(--steel);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); }
.mono.ink { background: var(--ink); } .mono.mint { background: var(--mint); color: #17181F; } .mono.sky { background: var(--sky); color: #17181F; }
.mono.sm { width: 28px; height: 28px; font-size: 11px; }

/* Pagination */
.pager { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.pager .pg-info { margin-right: auto; }
.pager a, .pager button { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 8px; font: 600 13px var(--font-body); color: var(--heading); text-decoration: none; }
.pager a:hover { background: var(--bg-elevated); text-decoration: none; }
.pager [aria-current="page"] { background: var(--accent-fill); color: var(--on-accent); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }

/* Key-value list */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--heading); font-weight: 500; }

/* ---- KPI tile ----------------------------------------------------------- */
.kpi .label { font: 600 12px var(--font-body); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .label svg { width: 16px; height: 16px; }
.kpi .value { margin-top: 8px; font: 800 36px var(--font-display); font-stretch: 108%; letter-spacing: -.02em; line-height: 1; color: var(--heading); font-variant-numeric: tabular-nums; }
.kpi .meta { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.kpi.lead .value { font-size: 56px; }
.card.link { color: inherit; text-decoration: none; display: block; transition: box-shadow .12s; }
.card.link:hover { text-decoration: none; box-shadow: var(--shadow), inset 0 0 0 1px var(--border-strong); }

/* ---- Images: placeholders until real media loads ----------------------- */
.img {
  position: relative; aspect-ratio: 1; overflow: hidden; background: var(--bg-elevated);
  background-image: linear-gradient(45deg, transparent 48%, var(--pattern-ink) 48% 52%, transparent 52%), linear-gradient(-45deg, transparent 48%, var(--pattern-ink) 48% 52%, transparent 52%);
  background-size: 22px 22px; display: flex; align-items: flex-end;
}
.img.t1 { background-color: #E6DCCF; } .img.t2 { background-color: #D9E4E8; } .img.t3 { background-color: #E9E1D2; } .img.t4 { background-color: #DCE3DA; } .img.t5 { background-color: #E4D8D2; }
:root[data-theme="dark"] .img.t1, .theme-dark .img.t1 { background-color: #3A332C; } :root[data-theme="dark"] .img.t2, .theme-dark .img.t2 { background-color: #2B3439; }
:root[data-theme="dark"] .img.t3, .theme-dark .img.t3 { background-color: #38332A; } :root[data-theme="dark"] .img.t4, .theme-dark .img.t4 { background-color: #2D352E; }
:root[data-theme="dark"] .img.t5, .theme-dark .img.t5 { background-color: #382F2C; }
.img.wide { aspect-ratio: 16 / 9; } .img.tall { aspect-ratio: 4 / 5; }
.img .cap { font: 500 10.5px ui-monospace, Menlo, monospace; color: var(--muted); padding: 8px 10px; line-height: 1.3; }
.img .ov { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.img .ov .pmark { width: 18px; height: 18px; }
.img .count { position: absolute; top: 8px; right: 8px; padding: 2px 7px; font: 700 11px var(--font-body); color: #FFFFFF; background: rgba(23,24,31,.72); }

/* File tile */
.ftile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); }
.ftile .ficon { width: 36px; height: 44px; display: grid; place-items: end center; padding-bottom: 5px; font: 800 9px var(--font-display); font-stretch: 112%; letter-spacing: .06em; color: #FFFFFF; background: var(--steel);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.ftile .ficon.pdf { background: #8C3B32; } .ftile .ficon.doc { background: var(--steel); } .ftile .ficon.img { background: var(--green); } .ftile .ficon.xls { background: #3C6E3F; }
.ftile .fn { font-weight: 600; color: var(--heading); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftile .fm { font-size: 12px; color: var(--muted); }

/* Upload drop zone */
.drop { display: grid; place-items: center; gap: 8px; text-align: center; padding: 28px 20px; border: 1.5px dashed var(--border-strong); background: var(--surface); color: var(--muted); font-size: 13px; }
.drop b { color: var(--heading); font-size: 14px; }
.drop.over { border-color: var(--deep); background: var(--yes-bg); }
.drop .facet { width: 26px; height: 22px; }

/* Post tile: picture plus views, clicks and shares only */
.ptile { background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.ptile .pt-body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.ptile .pt-date { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ptile .pt-date .pmark { width: 16px; height: 16px; }
.ptile .pt-cap { font-size: 13px; color: var(--heading); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ptile .pt-m { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.ptile .pt-m div { padding: 10px 12px; border-left: 1px solid var(--border); }
.ptile .pt-m div:first-child { border-left: 0; }
.ptile .pt-m dt { font-size: 11px; color: var(--muted); }
.ptile .pt-m dd { font: 750 17px var(--font-display); font-stretch: 108%; color: var(--heading); font-variant-numeric: tabular-nums; margin-top: 2px; }
.ptile .pt-m dd.nr { font: 600 11.5px var(--font-body); color: var(--muted); padding-top: 4px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }

/* ---- Comment thread ------------------------------------------------------ */
.thread { display: grid; gap: 16px; }
.cmt { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.cmt .c-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); }
.cmt .c-head b { color: var(--heading); font-size: 13.5px; }
.cmt .c-body { margin-top: 4px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.cmt .c-act { margin-top: 6px; display: flex; gap: 14px; font-size: 12px; }
.cmt.agency-note .c-body { padding: 10px 12px; background: var(--bg-elevated); box-shadow: inset 3px 0 0 var(--steel); }
.cmt.resolved { opacity: .62; }
.composer { display: grid; gap: 10px; padding: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); }
.composer textarea { border: 0; outline: 0; background: transparent; resize: vertical; min-height: 64px; font: 400 14px var(--font-body); color: var(--heading); }
.composer .row { justify-content: flex-end; }

/* Chat bubbles (Messages) */
.chat { display: grid; gap: 14px; }
.msg { max-width: 72%; display: grid; gap: 4px; }
.msg .bub { padding: 10px 14px; font-size: 14px; line-height: 1.5; background: var(--surface); border: 1px solid var(--border); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); }
.msg .meta { font-size: 11.5px; color: var(--muted); }
.msg.me { justify-self: end; }
.msg.me .bub { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; }
.msg.me .meta { text-align: right; }
.daydiv { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.daydiv::before, .daydiv::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---- Calendar ------------------------------------------------------------ */
.cal { background: var(--surface); border: 1px solid var(--border); }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal-head span { padding: 10px 10px; font: 700 11px var(--font-display); font-stretch: 112%; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell { min-height: 118px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell .d { font: 600 12px var(--font-body); color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-cell.out { background: var(--bg); }
.cal-cell.out .d { color: var(--slate); }
.cal-cell.today .d { display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--on-accent); background: var(--accent-fill); clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 0 100%); }
.cal-cell .more { font-size: 11.5px; font-weight: 600; color: var(--deep); }
.ev { display: flex; align-items: center; gap: 6px; padding: 4px 6px; font-size: 11.5px; line-height: 1.3; color: var(--heading); background: var(--bg-elevated); text-decoration: none; min-width: 0; box-shadow: inset 3px 0 0 var(--chart-rest); }
.ev:hover { text-decoration: none; background: var(--border); }
.ev .pmark { width: 13px; height: 13px; flex: none; }
.ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.published { box-shadow: inset 3px 0 0 var(--yes-fg); }
.ev.scheduled { box-shadow: inset 3px 0 0 var(--deep); }
.ev.review { box-shadow: inset 3px 0 0 var(--warn); }
.ev.draft { box-shadow: inset 3px 0 0 var(--border-strong); background: transparent; outline: 1px dashed var(--border-strong); outline-offset: -1px; }
.ev.failed { box-shadow: inset 3px 0 0 var(--no-fg); }
.ev.blog { box-shadow: inset 3px 0 0 var(--steel); }
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); }
.week .wh { padding: 10px 8px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.week .wh b { display: block; font: 800 20px var(--font-display); font-stretch: 108%; color: var(--heading); }
.week .wh.today b { color: var(--deep); }
.week .th { padding: 6px 8px; font-size: 11px; color: var(--muted); text-align: right; border-top: 1px solid var(--border); height: 64px; font-variant-numeric: tabular-nums; }
.week .wc { border-left: 1px solid var(--border); border-top: 1px solid var(--border); padding: 4px; height: 64px; display: grid; align-content: start; gap: 4px; }
@media (max-width: 760px) {
  .cal-head span { padding: 8px 4px; font-size: 10px; letter-spacing: .04em; text-align: center; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-cell .ev span, .cal-cell .more { display: none; }
  .cal-cell .ev { padding: 3px; justify-content: center; }
  .week { grid-template-columns: 40px repeat(7, minmax(0, 1fr)); overflow-x: auto; }
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; background: var(--bg-elevated); }

/* ---- States -------------------------------------------------------------- */
.state { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); }
.state .glyph { width: 40px; height: 40px; }
.state h3 { font-size: 15px; }
.state p { margin-top: 3px; font-size: 13px; color: var(--muted); max-width: 64ch; }
.state.notconn { background: var(--warn-bg); border-color: var(--warn-line); }
.state.notconn h3 { color: var(--warn); }
.state.error { box-shadow: inset 4px 0 0 var(--no-fg); }
.state.stale { background: var(--bg-elevated); border-color: transparent; padding: 10px 14px; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.state.stale p { margin: 0; color: var(--text); }
.stale-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--warn); }
.stale-tag::before { content: ""; width: 7px; height: 7px; background: currentColor; transform: rotate(45deg); }
@media (max-width: 640px) { .state { grid-template-columns: auto minmax(0, 1fr); } .state > .btn { grid-column: 1 / -1; justify-self: start; } }
.skel { display: block; background: linear-gradient(90deg, var(--bg-elevated) 0%, var(--border) 50%, var(--bg-elevated) 100%); background-size: 200% 100%; animation: fk-sh 1.6s linear infinite; }
@keyframes fk-sh { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ---- Toast and modal ----------------------------------------------------- */
.toast { display: flex; align-items: center; gap: 12px; min-width: 300px; max-width: 440px; padding: 12px 14px 12px 16px; background: var(--ink); color: #E6E8EF; font-size: 13.5px;
  box-shadow: 0 18px 50px -18px rgba(23,24,31,.5); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
:root[data-theme="dark"] .toast, .theme-dark .toast { background: #F2F4F7; color: #17181F; }
.toast .t-ic { width: 18px; height: 18px; flex: none; color: #2FE3C5; }
:root[data-theme="dark"] .toast .t-ic, .theme-dark .toast .t-ic { color: #0B7A68; }
.toast .t-act { margin-left: auto; font-weight: 700; color: #2FE3C5; background: none; border: 0; cursor: pointer; font-size: 13px; }
:root[data-theme="dark"] .toast .t-act, .theme-dark .toast .t-act { color: #0B7A68; }
.toast.err .t-ic { color: #FF8F80; }
.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; }
.toast-host .toast { animation: fk-in .18s cubic-bezier(.2,.7,.2,1); }
@keyframes fk-in { from { opacity: 0; transform: translateY(8px); } }
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(23,24,31,.5); display: grid; place-items: center; padding: 20px; }
.scrim[hidden] { display: none; }
.modal { position: relative; width: min(520px, 100%); background: var(--surface); padding: 24px; box-shadow: 0 30px 80px -24px rgba(0,0,0,.45);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%); }
.modal h2 { font-size: 20px; }
.modal .m-body { margin-top: 10px; font-size: 14px; color: var(--text); line-height: 1.6; }
.modal .m-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.modal .m-close { position: absolute; top: 12px; right: 18px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); }
.modal.inline { box-shadow: var(--shadow); border: 1px solid var(--border); }
.btn-danger { background: var(--danger-fill); color: var(--on-danger); }
.btn-danger:hover { filter: brightness(1.06); }

/* Split pane (list + detail) */
.split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--border); min-height: 560px; }
.split > .pane-l { border-right: 1px solid var(--border); min-width: 0; }
.split > .pane-r { min-width: 0; display: flex; flex-direction: column; }
.pane-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.pane-head h3 { font-size: 15px; }
.conv { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.conv:hover { background: var(--bg-elevated); text-decoration: none; }
.conv[aria-current="true"] { background: var(--bg-elevated); box-shadow: inset 3px 0 0 var(--accent-fill); }
.conv .cv-t { font-weight: 600; color: var(--heading); font-size: 13.5px; }
.conv .cv-s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.conv .cv-r { font-size: 11.5px; color: var(--muted); text-align: right; display: grid; gap: 6px; justify-items: end; }
.conv.unread .cv-t::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; background: var(--deep); transform: rotate(45deg) translateY(-2px); }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } .split > .pane-l { border-right: 0; border-bottom: 1px solid var(--border); } }

/* Stepper (approval flow) */
.steps { display: flex; gap: 0; flex-wrap: wrap; }
.steps li { list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 18px 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--bg-elevated); margin-right: 4px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%); }
.steps li:first-child { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); }
.steps li.done { color: var(--yes-fg); background: var(--yes-bg); }
.steps li.now { color: var(--on-accent); background: var(--accent-fill); }

/* Progress bar */
.bar { height: 8px; background: var(--bg-elevated); }
.bar > i { display: block; height: 100%; background: var(--chart-accent); }

/* Mini line (sparkline) */
.spark { width: 100%; height: 36px; }
.spark polyline { fill: none; stroke: var(--chart-accent); stroke-width: 2; }
.spark .base { stroke: var(--chart-axis); stroke-width: 1; }

/* Score gauge */
.gauge { display: flex; align-items: center; gap: 16px; }
.gauge .g-oct { width: 72px; height: 72px; flex: none; display: grid; place-items: center; font: 800 26px var(--font-display); font-stretch: 108%; color: var(--heading); font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--chart-accent) calc(var(--v) * 1%), var(--bg-elevated) 0); clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); position: relative; }
.gauge .g-oct::before { content: ""; position: absolute; inset: 7px; background: var(--surface); clip-path: inherit; }
.gauge .g-oct span { position: relative; }

/* ---- Public pages (no shell) ------------------------------------------- */
.public { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.public .p-art { position: relative; overflow: hidden; background: #17181F; color: #E6E8EF; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; }
.public .p-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(45deg, transparent 48.5%, rgba(255,255,255,.05) 48.5% 51.5%, transparent 51.5%), linear-gradient(-45deg, transparent 48.5%, rgba(255,255,255,.03) 48.5% 51.5%, transparent 51.5%); background-size: 28px 28px; }
.public .p-art .p-wedge { position: absolute; right: 0; top: 0; height: 100%; z-index: -1; }
.public .p-art h1 { color: #FFFFFF; font-size: 44px; font-weight: 850; max-width: 12ch; line-height: 1.04; letter-spacing: -.02em; }
.public .p-form { display: grid; align-content: center; justify-items: center; padding: 40px 24px; }
.public .p-card { width: min(440px, 100%); }
@media (max-width: 900px) { .public { grid-template-columns: minmax(0, 1fr); } .public .p-art { padding: 28px 24px; min-height: 220px; } .public .p-art h1 { font-size: 32px; } }

/* ---- Mockup bar (design files only, not part of the product) ---------- */
.mockbar { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; background: #17181F; color: #9AA3B5; font: 600 11px var(--font-body); letter-spacing: .04em;
  box-shadow: 0 12px 40px -12px rgba(0,0,0,.5); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); }
.mockbar b { color: #E6E8EF; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; }
.mockbar button { min-height: 30px; padding: 0 10px; font: 600 12px var(--font-body); color: #E6E8EF; background: rgba(255,255,255,.06); }
.mockbar button[aria-pressed="true"] { background: #2FE3C5; color: #17181F; }
@media print { .mockbar { display: none; } }

/* View switching inside one template file */
[data-view][hidden] { display: none !important; }

/* ---- Report pages (monthly and quarterly PDF) -------------------------- */
.rdoc { display: grid; justify-content: center; gap: 28px; padding: 8px 0 40px; min-width: 0; overflow: hidden; }
.rpage {
  color-scheme: light;
  --bg: #F2F4F7; --surface: #FFFFFF; --bg-elevated: #E9EDF2; --under: #FFFFFF;
  --text: #1B1D25; --heading: #17181F; --muted: #5B6275; --slate: #7A8298; --border: #DFE4EB; --border-strong: #C9CFD9;
  --deep: #0B7A68; --accent-fill: #17181F; --on-accent: #FFFFFF; --yes-bg: #E3F4EE; --yes-fg: #176B57; --no-bg: #FDECEA; --no-fg: #B42318;
  --neutral-bg: #EDF0F4; --neutral-fg: #505768; --chart-accent: #11A488; --chart-rest: #B4BCC8; --chart-axis: #C9CDD6; --chart-fb: #2270A8; --chart-ig: #11A488;
  --pattern-ink: rgba(57,106,135,.10); --shadow: none;
  position: relative; width: 816px; height: 1056px; overflow: hidden; background: #FFFFFF; color: var(--text);
  padding: 56px 60px 64px; display: flex; flex-direction: column; gap: 22px;
  box-shadow: 0 1px 2px rgba(23,24,31,.06), 0 18px 50px -20px rgba(23,24,31,.35);
}
.rpage .img.t1 { background-color: #E6DCCF; } .rpage .img.t2 { background-color: #D9E4E8; } .rpage .img.t3 { background-color: #E9E1D2; } .rpage .img.t4 { background-color: #DCE3DA; } .rpage .img.t5 { background-color: #E4D8D2; }
.rpage.cover { background: #17181F; color: #E6E8EF; padding: 64px; justify-content: space-between; isolation: isolate; }
.rpage.cover::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(45deg, transparent 48.5%, rgba(255,255,255,.05) 48.5% 51.5%, transparent 51.5%), linear-gradient(-45deg, transparent 48.5%, rgba(255,255,255,.03) 48.5% 51.5%, transparent 51.5%); background-size: 28px 28px; }
.rpage.cover .wedge { position: absolute; right: 0; top: 0; height: 72%; z-index: -1; }
.rpage.cover h1 { color: #FFFFFF; font-size: 76px; font-weight: 850; line-height: .98; letter-spacing: -.025em; }
.rpage.cover .rc-kind { font: 700 13px var(--font-display); font-stretch: 112%; letter-spacing: .16em; text-transform: uppercase; color: #2FE3C5; }
.rpage.cover .rc-meta { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 48px; font-size: 13px; color: #9AA3B5; }
.rpage.cover .rc-meta b { display: block; color: #FFFFFF; font-size: 15px; font-weight: 600; margin-top: 2px; }
.rp-head { display: flex; align-items: flex-end; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid #17181F; }
.rp-head .rp-n { font: 850 44px var(--font-display); font-stretch: 112%; line-height: .9; color: #17181F; }
.rp-head h2 { font-size: 26px; font-weight: 850; letter-spacing: -.015em; }
.rp-head .rp-sub { white-space: nowrap; margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.rp-foot { position: absolute; left: 60px; right: 60px; bottom: 26px; display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; }
.rgrid { display: grid; gap: 14px; }
.rgrid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rgrid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rbox { background: #FFFFFF; border: 1px solid var(--border); padding: 16px 18px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.rbox.soft { background: #F2F4F7; border-color: transparent; }
.rbox .rl { font: 600 11.5px var(--font-body); color: var(--muted); display: flex; gap: 6px; align-items: center; }
.rbox .rv { font: 850 34px var(--font-display); font-stretch: 108%; letter-spacing: -.02em; line-height: 1; color: #17181F; margin-top: 8px; font-variant-numeric: tabular-nums; }
.rbox .rm { margin-top: 8px; font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rpage .delta { font-size: 11px; }
.rpage h3 { font-size: 15px; }
.rpage .ptile .pt-cap { font-size: 11.5px; -webkit-line-clamp: 1; }
.rpage .ptile .pt-body { padding: 8px 10px; gap: 4px; }
.rpage .ptile .pt-date { font-size: 11px; }
.rpage .ptile .pt-m div { padding: 7px 9px; }
.rpage .ptile .pt-m dd { font-size: 14px; }
.rpage .ptile .pt-m dd.nr { font-size: 10px; }
.rpage .ptile .img .cap { font-size: 9px; }
.rpage .ptile .img { aspect-ratio: 4 / 3; }
.vis { position: relative; height: 14px; background: #E9EDF2; margin: 30px 0 26px; }
.vis > i { position: absolute; left: 0; top: 0; bottom: 0; background: #11A488; }
.vis .mk { position: absolute; top: -26px; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; text-align: center; }
.vis .mk::after { content: ""; position: absolute; left: 50%; top: 18px; width: 2px; height: 22px; background: #17181F; transform: translateX(-50%); }
.vis .sc { position: absolute; bottom: -20px; font-size: 10px; color: var(--muted); }
.mbars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; height: 96px; border-bottom: 1px solid var(--chart-axis); }
.mbars div { display: grid; align-content: end; gap: 4px; height: 100%; text-align: center; }
.mbars b { font: 700 11px var(--font-body); color: #17181F; font-variant-numeric: tabular-nums; }
.mbars i { display: block; background: var(--chart-rest); clip-path: polygon(0 3px, 3px 0, 100% 0, 100% 100%, 0 100%); }
.mbars div:last-child i { background: var(--chart-accent); }
.mbars-x { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.rclose { margin-top: auto; background: #17181F; color: #E6E8EF; padding: 22px 26px; display: flex; gap: 18px; align-items: center; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%); }
.rclose .facet { width: 30px; height: 26px; flex: none; }
.rclose p { font: 700 17px var(--font-display); font-stretch: 108%; color: #FFFFFF; line-height: 1.35; }
.rclose a { color: #2FE3C5; font-size: 12.5px; }
.rtable { width: 100%; border-collapse: collapse; font-size: 12px; }
.rtable th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--border-strong); }
.rtable td { padding: 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.rtable .r { text-align: right; }
.rtable tr.me td { font-weight: 700; color: #17181F; background: #E3F4EE; }
.rbar { display: inline-block; height: 8px; background: var(--chart-rest); vertical-align: middle; margin-right: 6px; }
tr.me .rbar { background: var(--chart-accent); }
.rp-note { font-size: 11px; color: var(--muted); }
.rpbar { position: sticky; top: 76px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); }
@media print {
  @page { size: letter; margin: 0; }
  body * { visibility: hidden; } .rdoc, .rdoc * { visibility: visible; }
  .rdoc { position: absolute; left: 0; top: 0; gap: 0; padding: 0; }
  .rpage { box-shadow: none; break-after: page; zoom: 1; }
}

/* Disabled buttons: the same dimmed look on every page. */
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"], .btn.is-disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:disabled::after, .btn[disabled]::after { display: none; }

/* File pickers: the browser's grey button, drawn as a Fold ghost button. */
input[type="file"] { font: 500 13px var(--font-body); color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: 600 12.5px var(--font-body); color: var(--heading); background: var(--surface);
  border: 0; box-shadow: inset 0 0 0 1px var(--border-strong); padding: 8px 12px; margin-right: 10px; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}
input[type="file"]::file-selector-button:hover { background: var(--bg-elevated); }

/* ==========================================================================
   Phones. Mike's note after seeing the Fold on his phone: "everything's still
   rounded." On a desk the kit is square, but iOS Safari draws its own rounded
   controls (text fields, selects, buttons, date and time pickers, search
   boxes, checkboxes and radios) whenever a control keeps its native
   appearance, and a few old styles.css rules still reach a phone. Everything
   below is shared by every Fold base (base.html, the public pages, the
   restaurant and resale shells), so it lives here and not in a page.
   ========================================================================== */
@media (max-width: 760px) {
  /* 1. No rounded corner anywhere on a phone. A page rule or a leftover in
     styles.css cannot round anything below this width. The one shape the
     kit draws round is the chart legend dot, and it uses clip-path, so it
     is untouched. */
  :is(body.fold, body.fold-public) *,
  :is(body.fold, body.fold-public) *::before,
  :is(body.fold, body.fold-public) *::after { border-radius: 0 !important; }
  :is(body.fold, body.fold-public) { -webkit-tap-highlight-color: transparent; }

  /* 2. Browser-drawn controls. Take the native look off so the Fold field
     (an inset hairline and a cut corner) is what the phone draws. */
  :is(body.fold, body.fold-public) :is(button, textarea, select,
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color])) {
    -webkit-appearance: none; appearance: none;
  }
  :is(body.fold, body.fold-public) input[type=search]::-webkit-search-decoration,
  :is(body.fold, body.fold-public) input[type=search]::-webkit-search-cancel-button,
  :is(body.fold, body.fold-public) input[type=search]::-webkit-search-results-button { -webkit-appearance: none; }
  /* iOS collapses a date or time field to nothing once its native chip is
     gone, and centres the value. Give it the field's height and a left edge. */
  :is(body.fold, body.fold-public) :is(input[type=date], input[type=time], input[type=datetime-local], input[type=month]) {
    min-height: 44px; min-width: 0; display: block; text-align: left;
  }
  :is(body.fold, body.fold-public) :is(input[type=date], input[type=time], input[type=datetime-local], input[type=month])::-webkit-date-and-time-value {
    text-align: left; min-height: 1.4em; margin: 0;
  }
  /* A bare select (no .select, no .field) still needs its arrow once the
     native one is gone: the same two-line chevron the kit's .select draws. */
  :where(body.fold, body.fold-public) :where(select:not([multiple]):not([size])) {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
    background-size: 5px 5px; background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-repeat: no-repeat;
    padding-right: 32px;
  }
  /* A checkbox or radio outside the kit's .check (old markup, a table row,
     a plain form) is drawn as the kit draws them: a square and an octagon.
     :where() keeps this at zero specificity, so a page that hides its inputs
     behind pill labels, or draws its own, still wins. */
  :where(body.fold, body.fold-public) :where(input[type=checkbox], input[type=radio]) {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin: 0; flex: none;
    background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border-strong); cursor: pointer;
    display: inline-grid; place-items: center; vertical-align: middle; position: relative;
  }
  :where(body.fold, body.fold-public) :where(input[type=checkbox], input[type=radio]):checked { background: var(--accent-fill); box-shadow: none; }
  :where(body.fold, body.fold-public) :where(input[type=checkbox]):checked::after {
    content: ""; width: 10px; height: 5px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px);
  }
  :where(body.fold, body.fold-public) :where(input[type=radio]) { clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%); }
  :where(body.fold, body.fold-public) :where(input[type=radio]):checked::after { content: ""; width: 8px; height: 8px; background: var(--on-accent); clip-path: inherit; }
  :where(body.fold, body.fold-public) :where(input[type=checkbox], input[type=radio]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  /* A range slider: square thumb, hairline track. */
  :is(body.fold, body.fold-public) input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 44px; }
  :is(body.fold, body.fold-public) input[type=range]::-webkit-slider-runnable-track { height: 3px; background: var(--border-strong); }
  :is(body.fold, body.fold-public) input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -10px; background: var(--accent-fill);
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%); }
  :is(body.fold, body.fold-public) input[type=range]::-moz-range-track { height: 3px; background: var(--border-strong); }
  :is(body.fold, body.fold-public) input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; background: var(--accent-fill); }
  :is(body.fold, body.fold-public) :is(progress, meter) { -webkit-appearance: none; appearance: none; height: 8px; border: 0; background: var(--bg-elevated); }
  :is(body.fold, body.fold-public) progress::-webkit-progress-bar { background: var(--bg-elevated); }
  :is(body.fold, body.fold-public) progress::-webkit-progress-value { background: var(--chart-accent); }
  /* The browser's own file picker button, square like the ghost button. */
  :is(body.fold, body.fold-public) input[type=file]::file-selector-button { min-height: 44px; }
  /* Images and video in tiles and lists: square, never a rounded thumbnail. */
  :is(body.fold, body.fold-public) :is(img, video, canvas) { border-radius: 0 !important; }

  /* 3. Tap targets. The kit's own buttons, chips, tabs and pagers reach 44px
     on a phone. A page's own tighter rule still wins where it is more
     specific, and the audit in wave5/mobile lists what is left. */
  .btn, .btn-sm, .btn-link, .chip, .sa-chip, .tabs a, .tabs button, .pager a, .pager button,
  .seg button, .seg a, .sr-subject a, .tableview > summary, .check, .toggle, .steps li { min-height: 44px; }
  .chip, .sa-chip { padding-top: 0; padding-bottom: 0; }
  .pager a, .pager button { min-width: 44px; height: 44px; }
  .input, .select, .textarea, .search { min-height: 44px; }
  .modal .m-close, .dpick .dp-head button { width: 44px; height: 44px; }
  .dpick .dp-grid button { height: 40px; }
  .sa-info { width: 44px; height: 44px; }

  /* 4. Geometry the desk has and the phone did not.
     The ink band keeps its diagonal lattice at phone size, across the top
     rather than only on the right, where a narrow band had none left. */
  .band::before {
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.55) 40%, transparent 85%);
            mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.55) 40%, transparent 85%);
  }
  .band { padding: 22px 18px; }
  /* Section titles take the mint to sky rule the page title has: the hairline
     after the heading starts mint, turns sky and fades to the border. */
  .section-head .line { height: 3px; background: linear-gradient(90deg, var(--mint) 0, var(--sky) 36px, var(--border) 96px); }
  .section-head .line::after { top: -5px; }
  /* The kit toast: a cut corner and full width at the thumb. */
  .toast-host { left: 12px; right: 12px; bottom: 12px; transform: none; }
  .toast { min-width: 0; max-width: none; width: 100%; }
  /* The kit modal on a phone: a sheet at the foot with a cut top corner. */
  .scrim { align-items: end; padding: 0; }
  .modal { width: 100%; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%); }
  /* Cards and lists: the corner cut stays readable at a phone's card width. */
  .card { padding: 16px; }
  .card::before { width: 20px; height: 20px; }
  .list > .li { padding: 12px 14px; gap: 12px; }
  /* Steps: at phone width they stack, and each keeps its chevron. */
  .steps li { margin-bottom: 4px; }
}
