/* Interior, Apple-style pass. Loaded after style.css. Dark, same palette as before.
   Rules kept from PAGE-RULES.md: 44px targets, visible focus, 4.5:1 text, never colour alone, reduced motion. */
:root {
  /* Original Interior colours: warm near-black, off-white ink, brass, crimson only for danger. */
  --bg: #0f1012; --panel: #17191c; --field: #0a0b0c; --seg: #24272b; --line: #34373d;
  --ink: #efeadc; --mute: #b0ad9f; --dim: #8f8d82;
  --accent: #dcae55; --accent-ink: #17110a; --tint: rgba(220, 174, 85, .14);
  --danger: #ec6b5c; --ok: #86bd8e; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.35);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --serif: var(--sans);
}
html.hc { --bg: #000; --panel: #0a0a0a; --field: #0a0a0a; --seg: #1a1a1a; --line: #9a9a9a; --ink: #fff; --mute: #e8e8e8; --dim: #dcdcdc; --accent: #ffd479; --accent-ink: #000; }
body { font-family: var(--sans); letter-spacing: -.003em; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--sans); letter-spacing: -.02em; font-weight: 700; }
.mono, .status, .eyebrow, .field label, th, .tag, .subhead, .gl, .crumbs, .stat .mono, .badge, .class-strip, .class-strip .mark, .group > .gl, .vgroup legend, .brand small, .issue::before, .hit.unread .hit-t::before, .navgroup summary {
  font-family: var(--sans); text-transform: none; letter-spacing: 0; }
.mono { color: var(--mute); font-size: .8125rem; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .8125rem; }
.field label { font-size: .8125rem; font-weight: 600; color: var(--mute); }

/* header: frosted bar, centred search */
.top { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px); border-bottom: 1px solid var(--line); }
.class-strip { background: none; border: 0; color: var(--mute); padding: 4px 20px 0; font-size: .75rem; }
.class-strip .mark { color: var(--danger); font-weight: 700; margin-right: 8px; }
.top-row { display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 560px) minmax(max-content, 1fr); gap: 16px; border: 0; padding: 6px 20px 10px; }
.brand { font: 700 1.05rem/1.1 var(--sans); letter-spacing: -.01em; }
.brand small { font-weight: 500; margin-top: 2px; font-size: .75rem; color: var(--mute); }
.who { margin-left: 0; justify-self: end; flex-wrap: nowrap; }
.cmd-btn { margin: 0; width: 100%; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--seg); border: 0; border-radius: 12px; color: var(--mute); cursor: pointer; text-align: left; }
.cmd-btn:hover { background: color-mix(in srgb, var(--seg) 80%, var(--ink) 8%); }
.cmd-btn span:not(.ico) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-btn kbd, kbd { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font: 600 .75rem var(--sans); padding: 2px 7px; color: var(--mute); }
.ico { display: inline-flex; flex: none; }
.admin-link[aria-current="page"] { color: var(--ink); background: var(--tint); }
.acct > summary { border-radius: 10px; padding: 0 12px; }
.acct > summary:hover { background: var(--seg); }
.acct-panel { border-radius: 14px; box-shadow: var(--shadow); background: var(--panel); }

/* sidebar: rounded rows, quiet selection */
.rail { gap: 2px; padding: 20px 10px 24px 16px; }
.rail a { border-radius: 10px; color: var(--ink); font-weight: 500; }
.rail a:hover { background: var(--seg); color: var(--ink); }
.rail a[aria-current="page"] { background: var(--tint); color: var(--accent); font-weight: 650; box-shadow: none; }
.rail-title { font-size: .75rem; font-weight: 700; color: var(--mute); padding: 4px 12px 8px; }
.rail-back { margin-top: 16px; color: var(--mute) !important; border-top: 1px solid var(--line); border-radius: 0 !important; padding-top: 4px; }
.rail.admin { border-left: 3px solid var(--accent); }

/* section tabs: segmented control */
.sectabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin: 0 0 22px; background: var(--seg); border: 0; border-radius: 12px; }
.sectabs a { min-height: 38px; padding: 0 16px; border: 0; margin: 0; border-radius: 9px; color: var(--mute); font-weight: 500; }
.sectabs a:hover { color: var(--ink); }
.sectabs a[aria-current="page"] { background: var(--panel); color: var(--ink); font-weight: 650; box-shadow: 0 1px 3px rgba(0,0,0,.15); border: 0; }
.crumbs { margin-bottom: 14px; }
.crumbs a:hover { color: var(--ink); }

/* page head */
.head { border: 0; padding-bottom: 8px; margin-bottom: 18px; }
.head h1, main > h1 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); line-height: 1.1; max-width: 28ch; }
.foot { border: 0; }

/* controls */
.btn { background: var(--seg); border: 0; border-radius: 10px; font-weight: 550; color: var(--ink); padding: 10px 18px; }
.btn:hover { background: color-mix(in srgb, var(--seg) 82%, var(--ink) 10%); border: 0; color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); color: var(--accent-ink); }
.btn.quiet { background: none; color: var(--mute); }
.btn.quiet:hover { background: var(--seg); color: var(--ink); }
.btn.danger { background: none; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--seg); color: var(--ink); font-weight: 550; text-decoration: none; cursor: pointer; }
.chip:hover { background: color-mix(in srgb, var(--seg) 80%, var(--ink) 10%); color: var(--ink); }
.field input, .field select, .field textarea, .card input, .sidebody textarea, .sidebody select, .checks, .filters select, .panel textarea, .modal textarea, .panel .row input[type=text], .modal select, main > textarea, .graph {
  background: var(--field); border: 1px solid var(--line); border-radius: 10px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--tint); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* cards, rows, tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; box-shadow: var(--shadow); }
.empty { border: 0; padding: 32px 0; }
.stat { border: 0; border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; }
.stat .n { font: 700 2rem var(--sans); letter-spacing: -.03em; }
.hit { border-radius: 10px; border-bottom: 0; padding: 12px 14px; margin: 0 -14px; }
.hit + .hit { border-top: 1px solid var(--line); border-radius: 0; }
.hit:hover, .hit:focus-visible { background: var(--seg); border-radius: 10px; }
.hit-t { font-family: var(--sans); font-weight: 600; }
table { border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
th { background: var(--panel); color: var(--mute); font-weight: 600; font-size: .8125rem; padding: 12px 14px; border-bottom: 1px solid var(--line); }
td, tbody th { padding: 14px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover, tbody tr:focus-visible { background: var(--seg); }
.tag { border: 0; border-radius: 999px; background: var(--seg); padding: 3px 10px; font-weight: 600; font-size: .75rem; }
.tag.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tag.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge { background: var(--accent); color: var(--accent-ink); }
.banner { border: 0; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); padding: 14px 18px; }
.banner.bad { box-shadow: inset 4px 0 0 var(--danger), var(--shadow); }
.banner.ok { box-shadow: inset 4px 0 0 var(--ok), var(--shadow); }
.card, .msg { border-radius: 12px; border-color: var(--line); background: var(--panel); }
.msg.mine { background: var(--tint); border-color: transparent; }
.bar.open { background: var(--tint); }
.bar.closed { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.graph { background: var(--panel); }
.gl { stroke: var(--line); }
.gn.hot { fill: color-mix(in srgb, var(--danger) 18%, var(--panel)); }
main.docmode .docmain { background: var(--seg); }
.page { font-family: "Iowan Old Style", Georgia, "Times New Roman", serif; border-radius: 6px; box-shadow: var(--shadow); }
.docside { border-radius: 14px; }

/* home: centred greeting with one big search */
.homehero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; padding: 28px 0 36px; }
.homehero h1 { font-size: clamp(2rem, 4vw, 2.75rem); max-width: none; }
.herosearch { width: min(680px, 100%); min-height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); color: var(--mute); font-size: 1.125rem; cursor: pointer; text-align: left; transition: box-shadow .18s ease-out; }
.herosearch:hover { box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 14px 36px rgba(0,0,0,.12); }
.herosearch span:not(.ico) { flex: 1; }
.herosearch .ico svg { width: 22px; height: 22px; }
.heroquick { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; }

/* search palette */
.cmd { background: rgba(0, 0, 0, .28); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); align-items: start; padding-top: 11vh; }
.cmd-panel { width: min(680px, 100%); max-height: 76vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.35); padding: 8px; }
.cmd-field { display: flex; align-items: center; gap: 12px; padding: 8px 14px; color: var(--mute); }
.cmd-field .ico svg { width: 22px; height: 22px; }
.cmd .cmd-field input { flex: 1; min-height: 48px; border: 0; background: none; box-shadow: none; font-size: 1.25rem; padding: 0; color: var(--ink); outline: none; border-radius: 0; }
.cmd .cmd-field input::-webkit-search-cancel-button { display: none; }
.cmd-status { margin: 0; padding: 0 16px 6px; min-height: 1.4em; font-size: .8125rem; color: var(--mute); border-bottom: 1px solid var(--line); }
.cmd-group { padding: 6px 0 2px; }
.cmd-head { padding: 6px 14px 4px; font-size: .75rem; font-weight: 700; color: var(--mute); }
.cmd-item { display: flex !important; align-items: center; gap: 12px; padding: 8px 12px; margin: 0; border: 0 !important; border-radius: 12px !important; min-height: 52px; text-decoration: none; color: var(--ink); }
.cmd-item[aria-selected="true"] { background: var(--tint); box-shadow: none; }
.cmd-glyph { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--seg); color: var(--mute); font-weight: 700; font-size: .875rem; }
.cmd-item[aria-selected="true"] .cmd-glyph, .cmd-item.top .cmd-glyph { background: var(--accent); color: var(--accent-ink); }
.cmd-text { display: flex; flex-direction: column; min-width: 0; }
.cmd-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-s, .cmd-snip { font-size: .8125rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* import */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 48px 24px; margin: 18px 0; border: 2px dashed var(--line); border-radius: 20px; background: var(--panel); cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone strong { font-size: 1.25rem; }
.dropzone span { color: var(--mute); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--tint); }
.sr:focus + .dropzone { outline: 3px solid var(--accent); outline-offset: 2px; }
.gdoc { margin: 28px 0 22px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.gdoc h2 { margin: 0; font-size: 1.25rem; }
.gdoc textarea { min-height: 112px; resize: vertical; font: .875rem/1.5 var(--mono); }
.gdoc-act { display: flex; justify-content: flex-start; }
.ev-view { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 24px; align-items: start; }
.ev-pic { background: #0a0b0c; border-radius: 14px; padding: 12px; display: flex; justify-content: center; }
.ev-img { max-width: 100%; max-height: 70vh; border-radius: 8px; -webkit-user-drag: none; user-select: none; }
.ev-side { display: flex; flex-direction: column; gap: 16px; }
.ev-hash { overflow-wrap: anywhere; color: var(--dim); }
@media (max-width: 1100px) { .ev-view { grid-template-columns: 1fr; } }
.imports { display: flex; flex-direction: column; gap: 10px; }
.imp-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) auto; gap: 8px 16px; align-items: center; padding: 12px 16px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); }
.imp-row.bad { box-shadow: inset 4px 0 0 var(--danger), var(--shadow); }
.imp-name { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 720px) { .imp-row { grid-template-columns: 1fr; } }

/* locked screen stays dark in any theme */
#veil { color: #d8d8dc; }
#veil h2 { color: #fff; }

/* small screens */
@media (max-width: 960px) { .top-row { grid-template-columns: auto 1fr auto; } .brand small { display: none; } }
@media (max-width: 760px) { .top-row { grid-template-columns: auto 1fr; } .cmd-btn { grid-column: 1 / -1; order: 5; } .who { justify-self: end; } }
@media (prefers-reduced-motion: reduce) { .herosearch, .dropzone { transition: none; } }
@media (max-width: 960px) { .acct .mono { display: none; } .who-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; } .cmd-btn kbd { display: none; } }
.acct > summary { white-space: nowrap; max-width: 280px; overflow: hidden; }
.acct > summary .who-name { overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.acct > summary .mono { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1180px) { .acct .mono { display: none; } .top-row { grid-template-columns: auto minmax(0, 1fr) auto; } .cmd-btn kbd { display: none; } }

/* dev builds: capture protection is off, so text can be selected and copied */
html.dev body { -webkit-user-select: text; user-select: text; }
html.dev img { pointer-events: auto; }
.devnote { color: var(--accent); font-weight: 600; }

/* unit files: grouped lists, one-line rows, progressive disclosure */
.setgroup { margin: 0 0 28px; }
.setgroup h2 { font-size: 1.125rem; margin: 0 0 2px; }
.setgroup > .mono { margin: 0 0 10px; }
.rowlist { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.rowitem { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 18px; color: var(--ink); text-decoration: none; }
.rowitem + .rowitem { border-top: 1px solid var(--line); }
.rowitem:hover, .rowitem:focus-visible { background: var(--seg); color: var(--ink); }
.ri-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ri-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-s { font-size: .8125rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-side { display: flex; align-items: center; gap: 12px; flex: none; }
.chev { color: var(--dim); font-size: 1.5rem; line-height: 1; }
.count { display: inline-block; min-width: 22px; padding: 1px 8px; border-radius: 999px; background: var(--seg); color: var(--mute); font: 600 .75rem var(--sans); text-align: center; }
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.filterbar input { flex: 1; min-width: 200px; }
.filterbar select { min-width: 150px; }
.filterbar input, .filterbar select { min-height: 44px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
.recgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.recside { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 96px; }
.recside .panel { margin: 0; }
.recmeta { margin: 0 0 14px; }
.statuscard { display: flex; flex-direction: column; gap: 10px; }
.statusnow { display: flex; gap: 8px; flex-wrap: wrap; }
.statusbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.disclose { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.disclose > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 18px; cursor: pointer; font-weight: 600; list-style: none; border-radius: 14px; }
.disclose > summary::-webkit-details-marker { display: none; }
.disclose > summary::after { content: "\203a"; color: var(--dim); font-size: 1.5rem; transition: transform .15s; margin-left: auto; }
.disclose[open] > summary::after { transform: rotate(90deg); }
.disclose > summary:hover { background: var(--seg); }
.dbody { padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.logrow { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-top: 1px solid var(--line); }
.logrow:first-child { border-top: 0; }
.danger-text { color: var(--danger) !important; align-self: flex-start; }
@media (max-width: 960px) { .recgrid { grid-template-columns: 1fr; } .recside { position: static; } .ri-side .mono { display: none; } }
@media (prefers-reduced-motion: reduce) { .disclose > summary::after { transition: none; } }
a.statlink { color: var(--ink); text-decoration: none; display: block; }
a.statlink:hover { background: var(--seg); }
.filtersbox { margin: 0 0 12px; }
.rail { top: 96px; max-height: calc(100vh - 96px); }
@media (max-width: 960px) { .rail { top: auto; max-height: none; } }

/* graph */
.graphstage { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; margin: 8px 0 12px; }
.graphcanvas { display: block; width: 100%; touch-action: none; outline-offset: -3px; }
.graphtip { position: absolute; pointer-events: none; background: var(--seg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .8125rem; max-width: 280px; z-index: 3; }
.gear { position: absolute; top: 12px; right: 12px; z-index: 4; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--seg); color: var(--ink); font-weight: 550; cursor: pointer; }
.gear[aria-expanded="true"] { background: var(--tint); color: var(--accent); }
.gzoom { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; gap: 6px; }
.gpanel { position: absolute; top: 60px; right: 12px; z-index: 4; width: min(320px, calc(100% - 24px)); max-height: calc(100% - 76px); overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: color-mix(in srgb, var(--panel) 92%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.gpanel[hidden] { display: none; }
.gpanel .disclose { background: none; border: 0; }
.gpanel .disclose > summary { min-height: 44px; padding: 0 8px; }
.gpanel .dbody { padding: 0 8px 10px; }
.gpanel input[type=search] { width: 100%; min-height: 44px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.gslider { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; font-size: .875rem; }
.gslider input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); min-height: 28px; }
.gdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 2px; }
.gdot[data-k="group"] { border-radius: 2px; transform: rotate(45deg) scale(.85); }
.gdot[data-k="case"] { border-radius: 2px; }
.gdot[data-k="subject"] { background: transparent !important; box-shadow: inset 0 0 0 3px var(--accent); }
.glegend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 14px; font-size: .875rem; color: var(--mute); }
.gl-item { display: inline-flex; align-items: center; gap: 6px; }
.graphmenu { position: absolute; z-index: 5; min-width: 190px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.graphmenu[hidden] { display: none; }
.gm-title { padding: 6px 10px; font-size: .75rem; font-weight: 700; color: var(--mute); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-item { display: block; width: 100%; min-height: 40px; text-align: left; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.gm-item:hover, .gm-item:focus-visible { background: var(--seg); }
.glist { max-height: 420px; overflow: auto; }
@media (max-width: 760px) { .gpanel { position: static; width: auto; max-height: none; border-radius: 0; border-width: 1px 0 0; } .gear { top: 8px; right: 8px; } }

/* messages: chat layout */
.chat { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 270px); min-height: 480px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.chatlist { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.chathead { padding: 16px 18px 6px; }
.chathead h1 { font-size: 1.5rem; }
.chatsearch { padding: 6px 14px 10px; }
.chatsearch input { width: 100%; min-height: 44px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.chatscroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.chatsec h2 { font-size: .75rem; font-weight: 700; color: var(--mute); padding: 14px 10px 4px; letter-spacing: 0; }
.chatrow { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 10px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.chatrow:hover { background: var(--seg); color: var(--ink); }
.chatrow.on { background: var(--tint); }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); font-weight: 650; font-size: .875rem; }
.avatar.big { width: 40px; height: 40px; }
.cr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-s { font-size: .8125rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.chatpane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.convohead { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 64px; }
.ch-main { flex: 1; min-width: 0; }
.ch-t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-s { font-size: .8125rem; color: var(--mute); }
.chatback { display: none; font-size: 2rem; line-height: 1; text-decoration: none; color: var(--accent); padding: 0 8px; min-height: 44px; align-items: center; }
.chatnote { margin: 0; padding: 8px 16px; font-size: .8125rem; color: var(--mute); background: var(--seg); }
.chatmsgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.daysep { align-self: center; margin: 10px 0 4px; padding: 2px 12px; border-radius: 999px; background: var(--seg); color: var(--mute); font-size: .75rem; font-weight: 600; }
.bubble { max-width: min(72%, 560px); align-self: flex-start; padding: 8px 12px 6px; background: var(--seg); border-radius: 18px 18px 18px 6px; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-radius: 18px 18px 6px 18px; }
.b-name { font-size: .75rem; font-weight: 700; color: var(--accent); }
.b-time { font-size: .6875rem; opacity: .7; text-align: right; margin-top: 2px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; background: var(--field); border: 1px solid var(--line); border-radius: 22px; padding: 10px 16px; line-height: 1.4; }
.composer .btn { border-radius: 22px; }
.chatpane > select { margin: 0 14px 12px; min-height: 44px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.chatpane .err { padding: 0 16px; }
.chatblank, .chatempty { margin: auto; text-align: center; color: var(--mute); max-width: 36ch; padding: 24px; }
.chatblank h2 { color: var(--ink); margin-bottom: 6px; }
@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 300px); }
  .chat[data-pane="list"] .chatpane, .chat[data-pane="convo"] .chatlist { display: none; }
  .chatback { display: inline-flex; }
}

/* search page, hide-text bar */
.searchbar { display: flex; gap: 10px; flex-wrap: wrap; }
.searchbar input { flex: 1; min-width: 220px; min-height: 52px; background: var(--field); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; font-size: 1.0625rem; }
.verdict { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.hidebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; margin: 0 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.hb-label { font-weight: 600; font-size: .875rem; }
.hidebar select { min-height: 40px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; }

/* inspection fixes: touch size, contrast, phone header, wrapping rows */
:root { --dim: #a3a094; }
.sectabs a { min-height: 44px; }
.class-strip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main table td a { display: inline-block; padding: 12px 0; }
.chat { grid-template-columns: 340px minmax(0, 1fr); }
@media (max-width: 760px) {
  .devnote { display: none; }
  .class-strip { padding: 4px 12px 0; }
  .top-row { padding: 4px 12px 8px; gap: 8px; }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .rowitem { flex-wrap: wrap; row-gap: 6px; }
  .ri-main { flex-basis: calc(100% - 30px); }
  .ri-side { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
  .rowitem .chev { display: none; }
  .head h1 { font-size: 1.75rem; }
}
.crumbs a { display: inline-block; padding: 6px 0; }
.card a, .group a { display: inline-block; padding: 10px 0; }
.gear { min-height: 44px; }
.panel .row input[type=text], .panel .row select { min-height: 44px; }
@media (max-width: 760px) { .ri-s { white-space: normal; } }

/* desktop only: the signed-in registry is hidden on phones and small windows */
#desktoponly { display: none; min-height: 100vh; place-items: center; padding: 32px; text-align: center; background: var(--bg); }
#desktoponly > div { max-width: 36ch; }
#desktoponly img { border-radius: 50%; margin-bottom: 18px; }
#desktoponly h1 { font-size: 1.75rem; margin-bottom: 10px; }
#desktoponly p { color: var(--mute); }
html.staff.phone #app, html.staff.phone #veil, html.staff.phone #mark { display: none !important; }
html.staff.phone #desktoponly { display: grid; }
@media (max-width: 899px) {
  html.staff #app, html.staff #veil, html.staff #mark { display: none !important; }
  html.staff #desktoponly { display: grid; }
}

/* people pictures */
img.avatar { object-fit: cover; background: var(--seg); pointer-events: none; }
.withavatar { display: flex; align-items: center; gap: 12px; }
.profilehead { display: flex; align-items: center; gap: 18px; }
.photoctl { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sr:focus-visible + .btn, .sr:focus + .btn { outline: 3px solid var(--accent); outline-offset: 2px; }
.acct > summary .avatar { margin-right: 8px; }

/* tabs made of buttons (tasks) look like the section tabs */
.sectabs button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 9px; background: none; color: var(--mute); font-weight: 500; cursor: pointer; }
.sectabs button:hover { color: var(--ink); }
.sectabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); font-weight: 650; box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* tasks at hand on the home page */
.handrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.handrow:first-of-type { border-top: 0; }
.handrow a { color: var(--ink); text-decoration: none; flex: 1; min-width: 0; }
.dropzone.small { padding: 18px 14px; margin: 8px 0; border-radius: 14px; }
.dropzone.small strong { font-size: 1rem; }
.dropzone.busy { opacity: .6; pointer-events: none; }
.ask-body p { margin: 0 0 10px; color: var(--mute); }
.ask-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* link picker, chips with a remove button, hidden rows */
.row[hidden] { display: none; }
.linkpick input { width: 100%; min-height: 44px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.linkfound { display: flex; flex-direction: column; margin-top: 6px; border-radius: 10px; overflow: hidden; }
.linkhit { display: flex; justify-content: space-between; gap: 10px; text-align: left; min-height: 44px; padding: 8px 12px; border: 0; border-top: 1px solid var(--line); background: var(--seg); color: var(--ink); cursor: pointer; }
.linkhit:hover { background: color-mix(in srgb, var(--seg) 80%, var(--ink) 10%); }
.linkchosen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip .chipx { margin-left: 8px; border: 0; background: none; color: var(--mute); font-size: 1.1rem; cursor: pointer; min-width: 32px; min-height: 32px; }

/* document toolbar: one row, pop-up groups */
.toolbar { flex-wrap: wrap; gap: 4px; align-items: center; }
.toolbar .tb { min-height: 40px; min-width: 40px; border: 0; border-radius: 9px; background: var(--seg); color: var(--ink); padding: 0 12px; font-weight: 550; }
.toolbar .tb:hover { background: color-mix(in srgb, var(--seg) 80%, var(--ink) 10%); }
.tbmenu { position: relative; }
.tbmenu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tbmenu > summary::-webkit-details-marker { display: none; }
.tbmenu .caret { font-size: .7rem; color: var(--mute); }
.tbpop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 200px; display: flex; flex-direction: column; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tbitem { min-height: 44px; text-align: left; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.tbitem:hover, .tbitem:focus-visible { background: var(--seg); }

/* Forms and dialogs: one look everywhere */
.field label .req { color: var(--dim); font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 4px; }
.field .hint, .toggle .hint { display: block; color: var(--dim); font-size: .8125rem; line-height: 1.4; }
.field { gap: 6px; }
.field[hidden], .toggle[hidden] { display: none; }
.field input[type=date] { color-scheme: dark; letter-spacing: normal; text-transform: none; font-family: inherit; }
html.hc .field input[type=date] { color-scheme: dark; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); cursor: pointer; }
.toggle:has(input:checked) { border-color: var(--accent); background: var(--tint); }
.toggle input { margin-top: 3px; width: 18px !important; height: 18px; }
.toggle-t { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.toggle-t .hint { font-weight: 400; }
.grid { gap: 18px 16px; }

.modal .panel { padding: 0; display: flex; flex-direction: column; width: min(600px, 100%); max-height: min(90vh, 860px); overflow: hidden; }
.modal .panel.wide { width: min(820px, 100%); }
.mhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.mhead h2 { margin: 0; font-size: 1.25rem; }
.mclose { min-width: 44px; min-height: 44px; margin: -8px -10px -8px 0; border: 0; background: none; color: var(--mute); font-size: 1.5rem; line-height: 1; border-radius: 10px; cursor: pointer; }
.mclose:hover { background: var(--seg); color: var(--ink); }
.mbody { overflow: auto; padding: 20px 24px 0; }
.dform { display: flex; flex-direction: column; gap: 20px; }
.mfoot { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); margin: 4px -24px 0; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mfoot .err { margin: 0; min-height: 0; flex: 1; }
.mactions { display: flex; gap: 10px; margin-left: auto; }
.mbody:not(:has(.mfoot)) { padding-bottom: 24px; }
input[type=date]::-webkit-datetime-edit, input[type=date]::-webkit-datetime-edit-fields-wrapper { color: var(--ink); padding: 0; }
input[type=date]::-webkit-datetime-edit-day-field, input[type=date]::-webkit-datetime-edit-month-field, input[type=date]::-webkit-datetime-edit-year-field { color: var(--ink); letter-spacing: normal; padding: 0 1px; }
input[type=date]::-webkit-datetime-edit-text { color: var(--mute); padding: 0 2px; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .8; }

/* Full-page forms use the same footer bar as dialogs: status left, actions right, main action last */
.formbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.formbar > .status, .formbar > .err { margin: 0 auto 0 0; min-height: 0; }
.stickybar.formbar { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-top: 16px; bottom: 12px; }
main.docmode .stickybar.formbar { border-radius: 0; border-width: 1px 0 0; margin-top: 16px; }
form.panel > .grid + .formbar, .panel.narrow > .formbar { margin-top: 22px; }
.panel.narrow .toggle, .panel.narrow .field { margin-top: 16px; }
.panel.narrow > .grid { margin-bottom: 0; }
.docmain > .field { margin-bottom: 20px; }
.section { margin-bottom: 32px; }
.grid > .field { justify-content: flex-end; }

/* Account menu: comfort settings as a segmented control and switches */
.acct-panel { padding: 14px 0 16px; }
.acct-panel .comfort { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 4px; padding: 0 16px 10px; }
.acct-panel .comfort fieldset { display: block; }
.acct-panel .comfort legend { float: none; display: block; margin: 0 0 8px; padding: 0; color: var(--dim); font-size: .8125rem; font-weight: 600; }
.seg-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; background: var(--seg); border-radius: 10px; }
label.seg-opt { display: block; position: relative; min-height: 40px; padding: 0; cursor: pointer; }
.seg-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg-opt span { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 8px; font-weight: 500; }
.seg-opt input:checked + span { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.35); font-weight: 600; outline: 1px solid var(--line); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); }
label.sw { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 0; border-top: 1px solid var(--line); }
.sw input { appearance: none; -webkit-appearance: none; flex: none; width: 44px !important; height: 26px !important; border-radius: 13px; background: var(--seg); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .15s; }
.sw input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.sw input:checked { background: var(--accent); border-color: var(--accent); }
.sw input:checked::after { transform: translateX(18px); }
.sw input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.acct-actions { padding: 12px 16px 0; border-top: 1px solid var(--line); }
.acct-actions .btn { flex: 1; min-height: 44px; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .sw input, .sw input::after { transition: none; } }

/* Shared: segmented groups and switches outside the account menu */
.vgroup .seg-group { width: 100%; }
.viewmenu .vgroup { display: block; }
.viewmenu .seg-opt span { font-size: .875rem; }
.dbody label.sw, .viewmenu label.sw { width: 100%; }
.sw-t { display: inline-flex; align-items: center; gap: 8px; }
.acct-panel .comfort label.sw:first-of-type { margin-top: 10px; }
/* Bare checkboxes in lists and forms: larger, easier to hit */
/* A tick box with its words is one full-width row, never run on with the next one. */
.vopt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 0; font-size: 1rem; line-height: 1.4; }
.vopt.seg-opt { width: auto; padding: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 24px; max-height: 240px; padding: 6px 16px; }
.checks .vopt { min-height: 40px; padding: 6px 0; }
input[type=radio]:not(.seg-opt input) { width: 20px !important; height: 20px; }
input[type=checkbox]:not([role=switch]) { appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center; width: 22px !important; height: 22px; margin: 0; border: 1.5px solid var(--mute); border-radius: 6px; background: transparent; cursor: pointer; transition: background .12s, border-color .12s; }
input[type=checkbox]:not([role=switch])::after { content: ""; width: 11px; height: 6px; border-left: 2.5px solid var(--accent-ink); border-bottom: 2.5px solid var(--accent-ink); transform: translateY(-1px) rotate(-45deg); opacity: 0; }
input[type=checkbox]:not([role=switch]):checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:not([role=switch]):checked::after { opacity: 1; }
input[type=checkbox]:not([role=switch]):hover:not(:disabled) { border-color: var(--ink); }
input[type=checkbox]:not([role=switch]):disabled { opacity: .5; cursor: default; }
input[type=checkbox]:not([role=switch]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { input[type=checkbox]:not([role=switch]) { transition: none; } }

.dir-pub { display: inline-flex; align-items: center; gap: 10px; margin: 6px 0; padding: 0 0 0 14px; border-left: 1px solid var(--line); }
.dir-pub label { color: var(--mute); white-space: nowrap; }
.dir-pub .dir-no { width: 76px; min-height: 44px; padding: 8px 12px; text-align: center; background: #0a0b0c; border: 1px solid var(--line); border-radius: 10px; }

/* Checklist: one step per row, state in words and a mark */
.todo-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.todo-head h2 { margin: 0; }
.todo { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.todo-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 60px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.todo-row:last-child { border-bottom: 0; }
.todo-mark { display: grid; place-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--mute); font-size: .8125rem; font-weight: 700; color: var(--accent-ink); }
.todo-row.done .todo-mark { background: var(--accent); border-color: var(--accent); }
.todo-t { font-weight: 600; }
.todo-row.done .todo-t { color: var(--mute); font-weight: 500; }
.todo-note { margin-top: 4px; max-width: 68ch; color: var(--mute); font-size: .875rem; line-height: 1.5; }
.todo-st { color: var(--mute); white-space: nowrap; }
.todo-act { width: auto; min-height: 44px; padding: 8px 14px; border-radius: 10px; background: var(--seg); white-space: nowrap; font-weight: 550; }


/* ---- Home: left-aligned ledger layout (PAGE-RULES: one title, one brass action, hairlines not boxes) ---- */
main:has(.homegrid) { max-width: 1180px; }
.homehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; padding: 8px 0 28px; }
.homehead .mono { margin-bottom: 8px; }
.homehead h1 { font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif; font-weight: 600; font-size: 2.5rem; line-height: 1.1; letter-spacing: -.015em; max-width: 30ch; }
.homelede { margin: 10px 0 0; color: var(--mute); font-size: 1.0625rem; max-width: 56ch; }
.homehead-a { display: flex; gap: 10px; flex-wrap: wrap; }
.homehead-a .btn { padding: 0 22px; display: inline-flex; align-items: center; text-decoration: none; }
.herosearch { width: 100%; border-radius: 12px; box-shadow: none; background: var(--field); }
.herosearch:hover { box-shadow: none; border-color: var(--mute); }
.homequick { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 22px; padding: 10px 0 0; }
.homequick a { color: var(--ink); text-decoration: none; padding: 12px 0; border-bottom: 1px solid transparent; }
.homequick a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.homegrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px clamp(32px, 5vw, 64px); align-items: start; margin-top: 28px; padding-top: 4px; }
.homemain, .homeside { min-width: 0; }
.homegrid .dash { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 20px 0 14px; margin: 0; }
.homegrid .dash h2 { font-size: 1.25rem; margin-bottom: 8px; }
.homegrid .panel.alertbox { border-top: 2px solid var(--danger); }
.homegrid .hit { margin: 0 -12px; padding: 12px; }
.homegrid .todo-head { margin-bottom: 4px; }
.homegrid .status { margin: 4px 0 8px; }
.ledger .stats { display: block; margin: 0; }
.ledger .stat { display: flex; flex-direction: row; align-items: baseline; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); box-shadow: none; border-radius: 0; background: none; }
.ledger .stat:last-child { border-bottom: 0; }
.ledger dt, .ledger dd { margin: 0; }
.ledger .stat .n { font: 600 1.75rem/1 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .homegrid { grid-template-columns: minmax(0, 1fr); } }


/* ---- Public home: left-aligned, hairline sections, one brass action ---- */
.pubnav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); }
.pubnav nav a:not(.btn) { padding: 12px 0; }
.pubnav .btn.small { display: inline-flex; align-items: center; text-decoration: none; }
.pubmain:has(.pubhome) { max-width: 1160px; padding-top: 24px; }
.pubhero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px clamp(32px, 6vw, 88px); align-items: end; padding: clamp(32px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); }
.pubhero h1 { font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif; font-weight: 600; font-size: clamp(2.25rem, 5.4vw, 3.75rem); line-height: 1.05; letter-spacing: -.02em; max-width: 16ch; margin: 10px 0 20px; }
.pubhero .lede { font-size: 1.25rem; line-height: 1.5; color: var(--mute); max-width: 46ch; margin: 0 0 32px; }
.pubhero-a { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 28px; }
.pubhero-a .btn { padding: 0 26px; display: inline-flex; align-items: center; text-decoration: none; }
.pubtext { color: var(--ink); text-decoration: none; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pubtext:hover { color: var(--accent); border-bottom-color: var(--accent); }
.pubacts { border-top: 1px solid var(--line); }
.pubact { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 44px; padding: 20px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: padding-left .18s ease-out; }
.pubact-t { display: flex; flex-direction: column; gap: 4px; }
.pubact-t b { font-size: 1.25rem; font-weight: 600; }
.pubact-t span { color: var(--mute); font-size: 1rem; max-width: 40ch; }
.pubact-go { color: var(--accent); font-size: 1.5rem; flex: none; }
.pubact:hover { padding-left: 8px; color: var(--ink); }
.pubsec { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px clamp(32px, 6vw, 88px); padding: 44px 0 52px; border-top: 1px solid var(--line); }
.pubsec-h h2 { font-size: 1.75rem; line-height: 1.2; margin-bottom: 12px; }
.pubsec-h p { color: var(--mute); max-width: 44ch; margin: 0; }
.pubunits, .pubsteps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pubunits li { display: flex; align-items: baseline; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 1.25rem; font-weight: 600; }
.pubunits .mono { font-weight: 500; }
.pubsteps li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.pubsteps li .mono { color: var(--accent); font-weight: 700; font-size: 1.25rem; }
.pubsteps b { font-size: 1.25rem; }
.pubsteps p { margin: 4px 0 0; color: var(--mute); max-width: 52ch; }
.pubfoot { color: var(--mute); }
@media (max-width: 860px) { .pubhero, .pubsec { grid-template-columns: minmax(0, 1fr); } .pubhero { align-items: start; } }
@media (prefers-reduced-motion: reduce) { .pubact { transition: none; } .pubact:hover { padding-left: 0; } }

/* Report pictures and profile photo pickers */
.field .lbl { font-size: .8125rem; font-weight: 600; color: var(--mute); }
.piclist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.piclist li { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.picthumb { display: block; width: 120px; height: 120px; object-fit: cover; border: 1px solid var(--line); border-radius: 10px; background: var(--panel, transparent); }
.piclist a { display: inline-block; }
.sr:focus-visible + label, .sr:focus-visible ~ label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Grouped forms and permission lists */
.fsec { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
.fsec:first-child { border-top: 0; padding-top: 0; }
.fsec h3 { font-size: 1rem; margin: 0 0 2px; }
.fsec .hint { margin: 0; color: var(--mute); font-size: .875rem; }
.permgroup { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 12px 0 0; display: grid; gap: 8px; }
.permgroup legend { font-weight: 600; padding: 0 8px 0 0; }

.permbox { display: grid; gap: 4px; max-height: 280px; overflow: auto; padding-right: 4px; }

/* Structure tree */
.unittree { display: grid; gap: 4px; margin-top: 12px; }
.unit > summary { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 4px; cursor: pointer; border-bottom: 1px solid var(--line); list-style: none; }
.unit > summary::-webkit-details-marker { display: none; }
.unit > summary::before { content: '\25B8'; color: var(--accent); width: 16px; display: inline-block; transition: transform .15s ease-out; }
.unit[open] > summary::before { transform: rotate(90deg); }
.unit .u-name { font-weight: 600; flex: 1; }
.unit .u-count { color: var(--mute); }
.unit .u-act { display: inline-flex; gap: 4px; }
.unit .u-body { margin-left: 20px; padding: 8px 0 8px 4px; }
.unit .unit > summary .u-name { font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .unit > summary::before { transition: none; } }

/* ---------- permission switches (rank page and member page) ----------
   One row per permission: name, what it allows, switch at the right. Groups flow in columns so all of them sit on
   the page at once, with no scroll box inside the page. */
.permhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.permhead h2 { margin: 0; }
.permhead input[type=search] { margin-left: auto; width: 240px; }
.permgrid { columns: 3 250px; column-gap: 32px; margin-top: 4px; }
.pgroup { break-inside: avoid; margin: 0 0 20px; }
.pgroup-h { display: flex; align-items: baseline; gap: 10px; padding: 10px 0 8px; border-bottom: 1px solid var(--line); }
.pgroup-h h3 { margin: 0; font-size: 1rem; }
.pgroup-h .n { color: var(--mute); font-size: 13px; }
.pgroup-h .btn { margin-left: auto; }
.permrow { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.permrow:last-child { border-bottom: 0; }
.permrow[hidden], .pgroup[hidden] { display: none; }
.pr-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-name { font-weight: 600; line-height: 1.3; }
.pr-desc { font-size: 13px; line-height: 1.4; color: var(--mute); }
.risk { display: inline-block; margin-left: 4px; padding: 0 6px; border: 1px solid var(--danger); border-radius: 4px; color: var(--danger); font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; vertical-align: 1px; }
.switch { flex: none; margin-left: auto; position: relative; width: 46px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--seg); cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--mute); transition: transform 150ms ease-out, background-color 150ms ease-out; }
.switch[aria-checked=true] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked=true]::after { transform: translateX(18px); background: var(--accent-ink); }
.switch:disabled { cursor: not-allowed; }
.switch:disabled[aria-checked=true] { background: var(--tint); border-style: dashed; }
.switch:disabled[aria-checked=true]::after { background: var(--accent); }
.permrow:has(.switch:disabled) { cursor: default; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch::after { transition: none; } }
.rankdetails { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rankdetails .wide { grid-column: span 3; }
.rankdetails .toggle { grid-column: span 1; align-self: end; }
/* Shows only when something changed, and stays in view at the bottom while you scroll. */
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 12px 16px; border: 1px solid var(--accent); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.savebar[hidden], .banner[hidden] { display: none; }
.savebar .msg { flex: 1; }
