/* Grantee · base: tokens, type, shell and shared components ("Instrument" direction).
   Area stylesheets build on these tokens and classes; they never redefine them. */

:root {
  --surface: #FFFFFF;
  --canvas: #F2F3F5;
  --rule: #DCDFE4;
  --rule-strong: #C7CBD2;
  --ink: #16181D;
  --on-ink: #FFFFFF;
  --graphite: #5B616E;
  --quiet: #868C98;
  --stamp: #9E2A2B;
  --stamp-wash: rgba(158, 42, 43, .06);
  --green: #2E6B4F;
  --amber: #B7791F;
  --needs: #C2410C;
  --hover: #F6F7F8;
  --lit: rgba(158, 42, 43, .08);
  --scrim: rgba(22, 24, 29, .5);
  --paper: #FCFCFB;
  --paper-rule: #DCDFE4;
  --shadow: 0 1px 2px rgba(22,24,29,.06), 0 8px 24px rgba(22,24,29,.08);
  --shadow-sm: 0 1px 2px rgba(22,24,29,.06), 0 3px 10px rgba(22,24,29,.06);
  --ease: cubic-bezier(.2,.8,.2,1);
  --ease-stamp: cubic-bezier(.34,1.4,.64,1);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --top: 64px;
  --panel-w: 440px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #121417; --canvas: #0B0C0E; --rule: #262A31; --rule-strong: #363B44;
    --ink: #ECEEF1; --on-ink: #121417; --graphite: #9BA1AC; --quiet: #707683;
    --stamp: #E0675F; --stamp-wash: rgba(224,103,95,.08); --green: #5FB38A; --amber: #D9A043; --needs: #EF6F3A;
    --hover: #181B1F; --lit: rgba(224,103,95,.12); --scrim: rgba(0,0,0,.6);
    --paper: #E6E7E9; --paper-rule: #3A3F47;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 3px 10px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: #121417; --canvas: #0B0C0E; --rule: #262A31; --rule-strong: #363B44;
  --ink: #ECEEF1; --on-ink: #121417; --graphite: #9BA1AC; --quiet: #707683;
  --stamp: #E0675F; --stamp-wash: rgba(224,103,95,.08); --green: #5FB38A; --amber: #D9A043; --needs: #EF6F3A;
  --hover: #181B1F; --lit: rgba(224,103,95,.12); --scrim: rgba(0,0,0,.6);
  --paper: #E6E7E9; --paper-rule: #3A3F47;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 3px 10px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
body {
  background: var(--canvas); color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  font-feature-settings: "tnum" 1;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--graphite); }
.quiet { color: var(--quiet); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.phone-only { display: none !important; }

/* ── the clipped-corner stamp frame, shared by everything that is recorded ── */
.clip, .prov, .prov::before, .impression, .impression::before, .doc-afn, .doc-afn::before, .doc-box, .lg-sw.is-released, .ini, .frame-dash {
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
}

/* The empty impression: a dashed clipped frame meaning "a stamp lands here". Unverified things never get a solid frame. */
.frame-dash { --c: 4px; position: relative; padding: 10px; border: 1px dashed var(--rule-strong); }
.frame-dash::after {
  content: ""; position: absolute; inset: -1px; pointer-events: none;
  background:
    linear-gradient(to bottom right, transparent calc(50% - .6px), var(--rule-strong) calc(50% - .6px), var(--rule-strong) calc(50% + .6px), transparent calc(50% + .6px)) top left / var(--c) var(--c) no-repeat,
    linear-gradient(to bottom left, transparent calc(50% - .6px), var(--rule-strong) calc(50% - .6px), var(--rule-strong) calc(50% + .6px), transparent calc(50% + .6px)) top right / var(--c) var(--c) no-repeat,
    linear-gradient(to bottom left, transparent calc(50% - .6px), var(--rule-strong) calc(50% - .6px), var(--rule-strong) calc(50% + .6px), transparent calc(50% + .6px)) bottom left / var(--c) var(--c) no-repeat,
    linear-gradient(to bottom right, transparent calc(50% - .6px), var(--rule-strong) calc(50% - .6px), var(--rule-strong) calc(50% + .6px), transparent calc(50% + .6px)) bottom right / var(--c) var(--c) no-repeat;
}

/* ───────── top bar ───────── */
.top {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top); z-index: 30;
  display: flex; align-items: center; gap: 20px; padding: 0 16px 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.mark { display: flex; align-items: center; color: var(--ink); text-decoration: none; flex: none; }
.mark svg { display: block; }
.mark .m-sm { display: none; }
.mark text { font-family: var(--sans); font-stretch: 75%; font-weight: 650; }
.nav { display: flex; align-items: center; gap: 2px; height: 100%; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 11px; border-radius: 8px;
  color: var(--graphite); text-decoration: none; font-weight: 500; font-size: 14px;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -14px; height: 2px; background: var(--ink); }
.nav svg { flex: none; }
.nav .count { font: 500 11px/1 var(--mono); color: var(--graphite); padding: 3px 5px; border-radius: 4px; background: var(--canvas); }
.ico .ox { stroke: var(--stamp); }
.ico .fill { fill: currentColor; stroke: none; }

.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%; height: 38px; border: 1px solid var(--rule); border-radius: 9px; background: var(--canvas);
  padding: 0 40px 0 36px; font-size: 13.5px; outline: none; border-radius: 8px; transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
  -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--quiet); }
.search input:focus { border-color: var(--ink); background: var(--surface); }
.search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--graphite); pointer-events: none; }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 500 11px/1 var(--mono); color: var(--quiet); border: 1px solid var(--rule); border-radius: 4px; padding: 3px 5px; background: var(--surface); }
.results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; list-style: none; margin: 0; display: none; z-index: 40; max-height: min(460px, 70vh); overflow-y: auto; }
.results.open { display: block; }
.results .grp { padding: 8px 10px 4px; font-size: 11px; color: var(--quiet); cursor: default; }
.results li[role="option"] { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; min-height: 40px; }
.results li[aria-selected="true"], .results li[role="option"]:hover { background: var(--hover); }
.results li .r-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.results li .r-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results li .r-sub { font-size: 12.5px; color: var(--graphite); }
.results li > .mono { margin-left: auto; color: var(--graphite); font-size: 12.5px; flex: none; }
.results .empty { color: var(--graphite); cursor: default; padding: 10px; font-size: 13.5px; }
.results mark { background: none; color: inherit; font-weight: 650; }

.top-r { display: flex; align-items: center; gap: 6px; flex: none; }
.iconbtn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; color: var(--graphite); transition: background-color 160ms var(--ease), color 160ms var(--ease); }
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.search-btn { display: none; }
.acct { position: relative; }
.acct-btn { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 10px; border-radius: 8px; text-align: left; }
.acct-btn:hover { background: var(--hover); }
.acct-btn .who { display: flex; flex-direction: column; line-height: 1.15; }
.acct-btn .who b { font-weight: 600; font-size: 13.5px; }
.acct-btn .who span { font-size: 11px; color: var(--graphite); }
/* avatar: initials inside the clipped-corner stamp frame, with two ticks */
.ini { --c: 4px; position: relative; width: 30px; height: 30px; display: grid; place-items: center; flex: none; background: var(--ink); isolation: isolate; font: 650 11px/1 var(--sans); font-stretch: 75%; letter-spacing: .06em; }
.ini::before { content: ""; position: absolute; inset: 1.5px; background: var(--surface); z-index: -1; clip-path: polygon(3.4px 0, calc(100% - 3.4px) 0, 100% 3.4px, 100% calc(100% - 3.4px), calc(100% - 3.4px) 100%, 3.4px 100%, 0 calc(100% - 3.4px), 0 3.4px); }
.ini::after { content: ""; position: absolute; left: 11px; bottom: 4px; width: 1px; height: 3px; background: currentColor; box-shadow: 7px 0 0 currentColor; opacity: .8; }
.ini span { margin-top: -3px; }
.acct-btn:hover .ini::before { background: var(--hover); }
.menu { position: absolute; right: 0; top: 48px; width: 272px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: none; z-index: 40; }
.menu.open { display: block; }
.menu .hd { padding: 10px 10px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.menu .hd b { display: block; font-weight: 600; }
.menu .hd span { font-size: 12.5px; color: var(--graphite); }
.menu [role="menuitem"], .menu [role="menuitemradio"] { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; min-height: 36px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; text-align: left; text-decoration: none; }
.menu [role="menuitem"]:hover, .menu [role="menuitem"]:focus-visible, .menu [role="menuitemradio"]:hover, .menu [role="menuitemradio"]:focus-visible { background: var(--hover); outline: none; }
.menu [role="menuitem"] .mono { color: var(--graphite); font-size: 12.5px; }
.menu [role="menuitem"] svg { color: var(--graphite); flex: none; }
.menu [aria-checked="true"]::after { content: ""; width: 6px; height: 10px; border: solid var(--ink); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translate(-2px, -1px); flex: none; }
.menu .sep { height: 1px; background: var(--rule); margin: 6px 0; }
.menu .lbl { padding: 6px 10px 2px; font-size: 11px; color: var(--quiet); }
.menu .org { margin-top: 6px; border-top: 1px solid var(--rule); padding: 9px 10px 4px; font-size: 11px; color: var(--quiet); }

/* viewing-as band: a thin rule under the top bar when you are not yourself */
.viewas { position: fixed; z-index: 29; top: var(--top); left: 0; right: 0; height: 28px; display: none; align-items: center; justify-content: center; gap: 10px; background: var(--ink); color: var(--on-ink); font-size: 12.5px; }
.viewas button { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; min-height: 28px; }
body.is-viewas .viewas { display: flex; }

/* ───────── layouts and outlets ───────── */
#map { position: fixed; inset: 0; background: var(--canvas); }
body[data-layout="page"] #map, body[data-layout="page"] .legend { visibility: hidden; }
#page { position: fixed; top: var(--top); left: 0; right: 0; bottom: 0; z-index: 12; overflow-y: auto; overflow-x: hidden; background: var(--canvas); display: none; overscroll-behavior: contain; }
body[data-layout="page"] #page { display: block; }
body.is-viewas #page { top: calc(var(--top) + 28px); }
#sheet { display: none; }
body[data-layout="sheet"] #sheet { display: flex; }
body:not([data-layout="map"]) #record { display: none; }
body[data-layout="sheet"] .legend { display: none; }

/* page scaffolding for area screens */
.pg { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }
.pg-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pg-hd h1 { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 600; letter-spacing: -.015em; }
.pg-hd p { margin: 4px 0 0; color: var(--graphite); font-size: 13.5px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.card-pad { padding: 16px; }
.sec-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sec-hd h2 { margin: 0; font-size: 13.5px; font-weight: 600; }
.sec-hd span { font-size: 12.5px; color: var(--graphite); }

/* ───────── buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 8px;
  background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 13.5px; white-space: nowrap; flex: none; text-decoration: none;
  transition: background-color 160ms var(--ease), opacity 160ms var(--ease), transform 160ms var(--ease);
}
.btn:hover { background: color-mix(in srgb, var(--ink) 86%, var(--surface)); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .btn.cue { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--canvas); color: var(--quiet); cursor: not-allowed; border: 1px solid var(--rule); transform: none; }
.btn svg { flex: none; }
.btn-2 { background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); }
.btn-2:hover { background: var(--hover); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.link { font-weight: 600; font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule-strong); min-height: 32px; display: inline-flex; align-items: center; }
.link:hover { text-decoration-color: var(--ink); }

/* ───────── provenance chip ───────── */
.prov {
  --c: 4px; position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  height: 22px; padding: 0 8px; font: 500 11px/1 var(--mono); letter-spacing: -.01em; white-space: nowrap; text-decoration: none;
  color: var(--stamp); background: color-mix(in srgb, var(--stamp) 70%, transparent); cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.prov::before { --c: 3.6px; content: ""; position: absolute; inset: 1px; background: var(--surface); z-index: -1; transition: background-color 160ms var(--ease); }
.prov .k { font-weight: 500; letter-spacing: .04em; }
.prov .d { opacity: .5; }
.prov.ink { color: var(--ink); background: color-mix(in srgb, var(--ink) 55%, transparent); }
.prov:hover::before, .prov.lit::before { background: color-mix(in srgb, var(--stamp) 9%, var(--surface)); }
.prov.ink:hover::before, .prov.ink.lit::before { background: var(--hover); }
.prov:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
span.prov { cursor: default; }
/* unrecorded source (skip trace, utility): no frame, graphite text only */
.prov-un { display: inline-flex; align-items: center; gap: 6px; height: 22px; font: 400 11px/1 var(--mono); color: var(--graphite); white-space: nowrap; vertical-align: middle; }
.prov-un .k { letter-spacing: .04em; }

/* ───────── state label + swatches (shared with the map legend) ───────── */
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.st .lg-sw { width: 10px; height: 10px; }
.lg-sw { width: 14px; height: 14px; border-radius: 3px; flex: none; display: inline-block; }
.lg-sw.is-released { --c: 3px; background: var(--green); border-radius: 0; position: relative; }
.lg-sw.is-released::after { content: ""; position: absolute; inset: 3px; background: color-mix(in srgb, var(--green) 35%, var(--surface)); }
.st .lg-sw.is-released { --c: 2px; }
.st .lg-sw.is-released::after { inset: 2px; }
.lg-sw.is-review { background: color-mix(in srgb, var(--amber) 42%, var(--surface)); box-shadow: inset 0 0 0 1px var(--amber); }
.lg-sw.is-needs { background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule-strong); display: inline-grid; place-items: center; }
.lg-sw.is-needs::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--needs); }
.st .lg-sw.is-needs { box-shadow: none; background: transparent; }
.st .lg-sw.is-needs::after { width: 7px; height: 7px; }
.lg-sw.is-queued { background: repeating-linear-gradient(135deg, var(--graphite) 0 1px, transparent 1px 4px), var(--surface); box-shadow: inset 0 0 0 1px var(--graphite); opacity: .85; }
.lg-sw.is-unresearched { background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule-strong); }

/* ───────── the approval impression (motion signature) ───────── */
.impression {
  --c: 6px; position: absolute; right: 12px; top: -12px; z-index: 3; display: block; isolation: isolate;
  padding: 8px 12px 9px; background: var(--stamp); color: var(--stamp); opacity: .92;
  transform: rotate(-1.5deg); pointer-events: none; text-transform: uppercase;
}
.impression::before { --c: 4.6px; content: ""; position: absolute; inset: 1.5px; background: color-mix(in srgb, var(--surface) 94%, var(--stamp)); z-index: -1; }
.impression b { display: block; font: 700 17px/1 var(--sans); font-stretch: 75%; letter-spacing: .08em; }
.impression span { display: block; margin-top: 4px; font: 500 10px/1.2 var(--mono); letter-spacing: .02em; }
.impression svg { display: block; margin-top: 5px; }
.impression.static { position: relative; right: auto; top: auto; display: inline-block; }
.impression.land { animation: impress 220ms var(--ease-stamp) both, ink 160ms linear both; }
@keyframes impress { from { transform: scale(1.12) rotate(-3deg); } to { transform: scale(1) rotate(-1.5deg); } }
@keyframes ink { from { opacity: 0; } to { opacity: .92; } }

/* ───────── document tiles (letter portrait, AFN stamp upper right) ───────── */
.doc-tile { display: block; text-align: left; text-decoration: none; color: inherit; border-radius: 6px; min-width: 0; }
.doc-tile .paper { display: block; position: relative; aspect-ratio: 17 / 22; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); overflow: hidden; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
.doc-tile svg.txt { position: absolute; inset: 0; width: 100%; height: 100%; }
.doc-tile .lbl { display: block; font-size: 12.5px; font-weight: 600; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tile .sub { display: block; font: 400 10.5px/1.3 var(--mono); color: var(--graphite); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tile:hover .paper, .doc-tile.lit .paper { border-color: var(--stamp); box-shadow: 0 0 0 3px var(--lit); }
.doc-tile.ink:hover .paper, .doc-tile.ink.lit .paper { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent); }
.doc-tile:focus-visible { outline-offset: 3px; }
:root[data-theme="dark"] .doc-tile .paper { border-color: var(--paper-rule); }
.doc-afn, .doc-box {
  --c: 2px; position: absolute; top: 4px; right: 4px; padding: 2px 3px; isolation: isolate;
  font: 500 8px/1.12 var(--mono); letter-spacing: -.02em; text-align: left; white-space: nowrap; transform: rotate(-1.5deg);
}
.doc-afn { background: #9E2A2B; color: #9E2A2B; }
.doc-afn::before, .doc-box::before { --c: 1.5px; content: ""; position: absolute; inset: .75px; background: #FCFCFB; z-index: -1; }
.doc-box { background: #16181D; color: #16181D; transform: none; }
:root[data-theme="dark"] .doc-afn::before, :root[data-theme="dark"] .doc-box::before { background: #E6E7E9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .doc-afn::before, :root:not([data-theme="light"]) .doc-box::before { background: #E6E7E9; }
  :root:not([data-theme="light"]) .doc-tile .paper { border-color: var(--paper-rule); }
}

/* ───────── quiet status line (no toast stack) ───────── */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translate(-50%, 8px); width: max-content; max-width: min(520px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: var(--on-ink); font-size: 13.5px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a, .toast button { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.live { position: fixed; left: -9999px; top: 0; }

/* ───────── generic snap sheet (phone) ───────── */
.grip { display: none; }

/* ───────── forms ───────── */
.field-lbl { display: block; font-size: 12.5px; color: var(--graphite); margin-bottom: 4px; }
.input, .select, textarea.input {
  width: 100%; min-height: 38px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); padding: 8px 10px; font-size: 13.5px; outline: none;
}
.input:focus, .select:focus { border-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .impression.land { animation: ink 150ms linear both; transform: rotate(-1.5deg); }
  *, *::before, *::after { transition-duration: 1ms !important; }
}

/* ───────── phone tab bar (the four desks) ───────── */
.tabbar { display: none; }

/* ───────── phone shell ───────── */
@media (max-width: 720px) {
  :root { --top: 56px; --tab-h: calc(56px + env(safe-area-inset-bottom)); }
  body.is-field { --tab-h: 0px; }
  .phone-only { display: flex !important; }
  .top { gap: 8px; padding: 0 6px 0 10px; }
  .mark .m-lg { display: none; }
  .mark .m-sm { display: block; }
  .nav { display: none; }
  /* the search is a real input on phone: full width between the mark and the account frame */
  .search { display: block; flex: 1; max-width: none; margin-left: 0; min-width: 0; }
  .search input { height: 40px; font-size: 16px; padding-right: 10px; }
  .search kbd { display: none; }
  .search .results { position: fixed; top: calc(var(--top) - 4px); left: 8px; right: 8px; max-height: calc(100vh - var(--top) - var(--tab-h) - 16px); }
  .search-btn, #themeBtn { display: none; }
  .top-r { gap: 0; }
  .acct-btn { padding: 0 4px; height: 44px; }
  .acct-btn .who { display: none; }
  .menu { position: fixed; right: 8px; top: 60px; }
  .menu [role="menuitem"].phone-only, .menu [role="menuitemradio"].phone-only { display: flex !important; min-height: 44px; }
  .menu .sep.phone-only { display: block !important; }

  .tabbar {
    position: fixed; z-index: 28; left: 0; right: 0; bottom: 0; height: var(--tab-h); padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--surface); border-top: 1px solid var(--rule);
  }
  body.is-field .tabbar { display: none; }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 56px;
    color: var(--graphite); text-decoration: none; font: 500 11px/1 var(--sans); -webkit-tap-highlight-color: transparent;
    transition: color 160ms var(--ease);
  }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 50%; width: 28px; margin-left: -14px; height: 2px; background: var(--ink); }
  .tabbar a:focus-visible { outline-offset: -4px; }
  .tabbar .ox { stroke: var(--stamp); }
  .tabbar .tb-ico { position: relative; display: block; height: 20px; }
  .tabbar .tb-ico svg { display: block; }
  .tabbar .count { position: absolute; left: 14px; top: -5px; min-width: 18px; padding: 2px 3px; border-radius: 3px; background: var(--ink); color: var(--on-ink); font: 500 10px/1 var(--mono); text-align: center; }

  #page { bottom: var(--tab-h); }
  .pg { padding: 20px 16px 48px; }
  .pg-hd h1 { font-size: 21px; }
  /* compact on phone, always above the tab bar; over the map it also clears the record sheet */
  .toast { left: 8px; right: 8px; transform: translateY(8px); width: auto; max-width: none; padding: 8px 12px; font-size: 12.5px; gap: 10px; bottom: calc(var(--tab-h) + 8px); }
  .toast.show { transform: none; }
  .toast span { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .toast a, .toast button { margin-left: auto; min-height: 32px; display: inline-flex; align-items: center; }
  body[data-layout="map"] .toast { bottom: calc(var(--sheet-h, 0px) + var(--tab-h) + 8px); }
}
@media (max-width: 380px) {
  .top { gap: 6px; }
}
