/* NYPD Officer Info — rebuild 2026-10-14.
   Bright, expansive light; rich deep-navy dark. Hairline rules, one accent,
   tabular numerals for data. System fonts + a serif display voice. */

:root {
  color-scheme: light dark;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --tabbar-h: 68px;
  --ease-out: cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f5f7fb;
  --ink: #0f1522;
  --muted: #5d6a82;
  --line: #e2e7f0;
  --accent: #1d3f9e;
  --accent-soft: #eef2fd;
  --input-bg: #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e1c;
  --surface: #111830;
  --ink: #edf1fa;
  --muted: #9fabc9;
  --line: #232d50;
  --accent: #8fadf9;
  --accent-soft: #16204a;
  --input-bg: #111830;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection { background: var(--accent); color: #fff; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 28px; }

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
  margin-bottom: 64px;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
  text-decoration: none;
  color: inherit;
}

.theme-toggle, .menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover, .menu-button:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg, .menu-button svg { width: 20px; height: 20px; }

/* ---------- hamburger menu ---------- */

.menu-wrap { position: relative; }
.menu-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 248px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px 22px;
  z-index: 50;
  box-shadow: 0 16px 40px rgba(10, 14, 28, 0.14);
}
.menu-heading {
  margin: 0 0 14px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- search ---------- */

.search-field { margin-bottom: 32px; }

.search-bar {
  display: flex;
  gap: 14px;
  align-items: stretch;
}
.search-bar #q { flex: 1 1 auto; min-width: 0; }

#search-go {
  flex: 0 0 auto;
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0 44px;
  border: none;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
}
#search-go:hover { background: var(--accent); color: var(--bg); }

#q, #uq {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1.35rem;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--input-bg);
  color: var(--ink);
  caret-color: var(--accent);
}
#q::placeholder, #uq::placeholder { color: var(--muted); opacity: 0.85; }

/* ---------- advanced search: one calm disclosure, never faceted boxes ---------- */

.advanced { margin-top: 14px; }

#advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: none;
  background: none;
  padding: 6px 2px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}
#advanced-toggle:hover { color: var(--accent); }
#advanced-toggle svg {
  width: 10px;
  height: 6px;
  transition: transform 0.2s ease;
}
#advanced-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.advanced-panel {
  margin-top: 8px;
  padding: 16px 0 6px;
  border-top: 1px solid var(--line);
}
.adv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.adv-row > label {
  flex: 0 0 6.5em;
  color: var(--muted);
  font-size: 0.92rem;
}
.adv-row > label code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}
.adv-row select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 8px 18px 8px 2px;
  cursor: pointer;
  max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%235d6a82' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
}
[data-theme="dark"] .adv-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%239fabc9' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
}
.adv-row select:hover { color: var(--accent); }
.adv-row input {
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 8px 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.adv-row input::placeholder { color: var(--muted); opacity: 0.85; }

/* ---------- controls: one quiet inline row, no faceted boxes ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 30px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}
.controls select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 8px 18px 8px 2px;
  cursor: pointer;
  max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%235d6a82' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
}
.controls select:hover { color: var(--accent); }
.controls #command {
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 8px 2px;
  min-width: 10em;
  flex: 0 1 14em;
}
.controls #command::placeholder { color: var(--muted); opacity: 0.85; }

/* salary source: three plain radios stacked in the menu's Settings panel,
   the checked one reads as ink */
.salary-settings {
  margin: 0;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.salary-settings label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
}
.salary-settings label:has(input:checked) { color: var(--ink); }
.salary-settings input[type="radio"] {
  accent-color: var(--accent);
  width: 0.95em;
  height: 0.95em;
  margin: 0;
}

/* unit page: the within-unit search keeps the big field */
.unit-search { margin: 4px 0 0; }

select:focus, input:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status {
  color: var(--muted);
  font-size: 0.95rem;
  min-height: 1.6em;
  margin: 18px 0 6px;
  font-variant-numeric: tabular-nums;
  /* The count text swaps per keystroke ("44 results." vs
     "Showing 60 of 150 results."): one fixed line that never wraps, so the
     results below never move (jitter fix). */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- results: hairline rows, no cards ---------- */

.results { padding-bottom: 72px; }

.result {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.result:first-child { border-top: 1px solid var(--line); }
a.result:hover .result-name { color: var(--accent); }

.insignia {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  color: var(--ink);
}
.insignia svg { width: 100%; height: 100%; display: block; }
a.result:hover .insignia { color: var(--accent); }

.result-main { flex: 1 1 auto; min-width: 0; }
.result-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.3;
}
.result-sub {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 5px;
  line-height: 1.4;
}
.result-tenure {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- searching: results are the hero ---------- */
/* The toggle must never change metrics: font-size/padding/margin swaps on the
   first keystroke were a visible jump (jitter fix). Color only. */

body.searching .status { color: var(--ink); }

/* ---------- officer profile ---------- */

.crumbs { color: var(--muted); font-size: 0.9rem; margin: 0 0 36px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.profile-head {
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 16px 0 48px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 48px;
}
.profile-head .insignia { width: 120px; height: 120px; }
.profile-name {
  font-family: var(--font-display);
  margin: 0;
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1.2;
  text-wrap: balance;
}
.profile-sub { margin: 8px 0 0; color: var(--muted); font-size: 1.05rem; }

.section { padding: 0 0 48px; margin-bottom: 48px; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: none; }
.section h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 24px;
}
.section h2 .count { color: var(--muted); font-family: var(--font-ui); font-size: 0.95rem; font-weight: 400; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 26px 36px;
  margin: 0;
}
.fact dt {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.fact dd { margin: 4px 0 0; font-size: 1.02rem; }
.fact dd, .fact dd a { font-variant-numeric: tabular-nums; }

.timeline, .plain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 640px;
}
.timeline li { display: flex; gap: 24px; align-items: baseline; }
.tl-date { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 7.5em; flex: 0 0 auto; }

.arrest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px 32px;
  max-width: 760px;
}
.arrest-cell { padding: 18px 0; border-top: 1px solid var(--line); }
.arrest-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.arrest-label { color: var(--muted); font-size: 0.88rem; }

.salary-figure {
  font-size: 1.9rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.salary-note { color: var(--muted); margin: 0; font-size: 0.95rem; }
.salary-source { color: var(--muted); font-size: 0.88rem; margin-top: 14px; }

.muted { color: var(--muted); }
.notice { padding: 32px 0; font-size: 1.05rem; }
.notice a { color: var(--accent); }

a { color: var(--accent); }

/* ---------- unit pages ---------- */

.unit-head { padding: 12px 0 40px; }
.unit-head h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  margin: 0 0 8px;
  text-wrap: balance;
}
.unit-count { color: var(--muted); font-variant-numeric: tabular-nums; margin: 0; }

.unit-index h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 52px 0 8px;
}
.precinct-chips { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.chip {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 44px 0 60px;
  font-size: 0.86rem;
  color: var(--muted);
}
.site-footer p { margin: 6px 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .site-header { margin-bottom: 44px; }
  /* Row on every viewport: the button keeps a fixed 96px so it never drops
     under the input and eats ~60px of vertical space. */
  #search-go { flex: 0 0 96px; width: 96px; padding: 0 8px; font-size: 1rem; }
  #q, #uq { font-size: 1.15rem; padding: 15px 18px; }
  .menu-panel { min-width: 224px; right: -10px; }
  .adv-row > label { flex-basis: 5.5em; }
  .controls { gap: 6px 14px; margin-top: 24px; font-size: 0.9rem; }
  .controls #command { min-width: 8em; flex: 1 1 10em; }
  .profile-head { gap: 24px; }
  .profile-head .insignia { width: 84px; height: 84px; }
  .profile-name { font-size: 1.6rem; }
  .result { gap: 16px; padding: 18px 2px; }
  .insignia { width: 38px; height: 38px; }
  .result-tenure { display: none; }
  .result-name { font-size: 1.04rem; }
  .salary-figure { font-size: 1.6rem; }
  .section { padding: 0 0 36px; margin-bottom: 36px; }
  .profile-head { padding-bottom: 36px; margin-bottom: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- officer profile: tenure ticker + hashmarks ---------- */

.profile-sub a { text-decoration: none; }
.profile-sub a:hover { text-decoration: underline; }

.tenure-big {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tenure-live {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hashmarks {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}
.hashmark {
  width: 9px;
  height: 22px;
  color: var(--accent);
}

/* ---------- salary source toggle (officer profile) ---------- */

.salary-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 22px;
}
.salary-tab {
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.salary-tab:hover { border-color: var(--accent); color: var(--accent); }
.salary-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.salary-main { margin-bottom: 18px; }
.salary-compare { border-top: 1px solid var(--line); }
.salary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  font: inherit;
  text-align: left;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}
.salary-row:last-child { border-bottom: none; }
.salary-row:hover .salary-row-name { color: var(--accent); }
.salary-row-name { color: var(--muted); font-size: 0.92rem; }
.salary-row-val { font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.salary-note-quiet { font-size: 0.85rem; margin-top: 3px; }

/* ---------- hamburger menu: full nav ---------- */

.menu-panel {
  max-height: calc(100dvh - 96px);
  max-width: calc(100vw - 40px);
  overflow-y: auto;
}
.menu-panel .menu-heading:not(:first-child) { margin-top: 20px; }
.menu-nav {
  display: flex;
  flex-direction: column;
  margin: 0 0 2px;
}
.menu-item {
  display: block;
  padding: 9px 2px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
  border-bottom: 1px solid var(--line);
}
.menu-item:first-child { border-top: 1px solid var(--line); }
.menu-item:hover { color: var(--accent); }
.menu-item[aria-current="page"] { font-weight: 600; }
.menu-home {
  display: block;
  margin: 18px 0 2px;
  padding: 16px 2px 0;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.menu-home:hover { color: var(--accent); }

/* ---------- static pages (Privacy, About, Settings) ---------- */

.doc { max-width: 660px; padding-bottom: 88px; }
.doc h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: 0.005em;
}
.doc .lede { font-size: 1.08rem; margin: 0 0 8px; }
.doc .section { padding-bottom: 40px; margin-bottom: 40px; }
.doc .section h2 { margin-top: 0; }
.doc p, .doc ul { margin: 0 0 16px; }
.doc ul { padding-left: 22px; }
.doc li { margin-bottom: 10px; }
.doc li::marker { color: var(--muted); }
.doc .setting-note { font-size: 0.92rem; }

/* ---------- command roster: the unit header reads as a section title ---------- */

.result-unit.is-head .result-name { font-size: 1.35rem; }

/* The chevron is a mobile-only affordance (native table-view rows); the
   right-side meta span reads the same on both viewports. */
.chev { display: none; }
.result-count, .result-held {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- search screen: one fixed screen, no page scroll (§2A) ---------- */
/* Home only: the body is a 100dvh flex column and .home-scroll is the single
   scroll container — large title, then the sticky search block, then the
   rows. The search bar pins (position:sticky) while results scroll beneath;
   desktop shares the same DOM with the large/compact titles hidden. The page
   itself never scrolls on the search screen, so the keyboard
   (interactive-widget=resizes-content shrinks the layout viewport and 100dvh
   with it) only ever resizes the scroll well. Other pages keep normal page
   scroll. */
body[data-page="home"] {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
}
body[data-page="home"] .site-header { flex: 0 0 auto; }
body[data-page="home"] main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.home-scroll {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.search-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  margin: 0 -28px;
  padding: 0 28px;
  transition: background-color 0.25s ease;
}
/* Large title (mobile): the iOS Settings/Contacts pattern — the big serif
   title scrolls away, and the compact inline title in the sticky block
   fades in as results scroll (opacity only, never a metric change, so the
   jitter proof holds). Desktop hides both. */
.large-title, .compact-title { display: none; }
body[data-page="home"] #results { padding-bottom: 24px; }
body[data-page="home"] .site-footer {
  flex: 0 0 auto;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
}

/* ---------- mobile keyboard: the results own every pixel ---------- */
/* body.kb-open is set while a search field is focused (initMobileKeyboard in
   app.js). Header, status line and footer drop out entirely while typing;
   an open Advanced Search panel is collapsed by the same handler. The
   compaction is scoped to small screens; desktop is untouched. Inputs stay
   >=16px so iOS never auto-zooms on focus. */
@media (max-width: 640px) {
  body.kb-open .site-header { display: none; }
  body.kb-open .site-footer { display: none; }
  body.kb-open .status { display: none; }
  body.kb-open .search-field { margin-bottom: 8px; }
  body.kb-open .advanced { margin-top: 4px; }
  body.kb-open #q, body.kb-open #uq { font-size: 16px; padding: 12px 16px; }
  body.kb-open #results { padding-bottom: 12px; }
}

/* ---------- theme swap: instant, never a fade through white ---------- */
/* The body's background/color transition otherwise sweeps dark->light
   through near-white over 250ms, which reads as a white flash on toggle. */
html.theme-swap, html.theme-swap *, html.theme-swap *::before, html.theme-swap *::after {
  transition: none !important;
}

/* ================= iOS app chrome (mobile only, max-width: 640px) ================ */
/* Desktop is untouched: everything below is scoped to small screens, so the
   desktop site keeps its current look. */

/* Base: the mobile chrome never renders on desktop. */
.tabbar, .more-scrim, .more-sheet, .back-btn { display: none; }

/* Units index: iOS-style section headers (typographic small caps). */
.index-letter {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 30px 0 2px;
  padding: 0 4px;
}

@media (max-width: 640px) {

  /* The hamburger's chrome moves to the More tab's bottom sheet on phones;
     desktop keeps the hamburger. */
  .menu-wrap { display: none; }

  /* Slim nav bar; the safe-area inset keeps it clear of the status bar. */
  .site-header {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 0 10px;
    margin-bottom: 0;
  }
  body:not([data-page="home"]) .site-header { margin-bottom: 26px; }
  .wordmark { font-size: 1.12rem; }

  /* Large title over the sticky search block. */
  .large-title {
    display: block;
    font-family: var(--font-display);
    font-size: 2.05rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    line-height: 1.15;
    margin: 10px 0 12px;
  }
  .search-sticky { margin: 0 -20px; padding: 0 20px; }
  .compact-title {
    display: block;
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 6px;
    opacity: 0;
    transition: opacity 0.18s ease;
  }

  /* Native table-view rows: full-bleed, hairline separators inset past the
     insignia (16px gap after it), chevron, 44px+ targets, :active press
     state instead of hover. */
  #results, #uresults, #units .results, .unit-index .results {
    margin-left: -20px;
    margin-right: -20px;
  }
  .result {
    position: relative;
    gap: 16px;
    padding: 13px 20px;
    min-height: 60px;
    border-bottom: none;
  }
  .result::after {
    content: "";
    position: absolute;
    left: 76px; /* 20px edge + 40px insignia + 16px gap */
    right: 0;
    bottom: 0;
    border-bottom: 1px solid var(--line);
  }
  .result-unit::after,
  .result-holder::after { left: 20px; }
  .result:first-child { border-top: 1px solid var(--line); }
  .chev {
    display: block;
    flex: 0 0 auto;
    width: 11px;
    height: 18px;
    color: var(--muted);
    opacity: 0.65;
  }
  a.result { -webkit-tap-highlight-color: transparent; }
  a.result:active { background: var(--accent-soft); }
  a.result:active .result-name { color: inherit; }
  .insignia { width: 40px; height: 40px; }
  .result-count, .result-held { font-size: 0.82rem; }

  /* iOS segmented control for the salary 3-way toggle. One track, three
     equal segments, the selected one raised. Labels never swap, so no
     width jumps. */
  .salary-toggle {
    gap: 0;
    padding: 3px;
    border-radius: 12px;
    background: var(--bg);
  }
  [data-theme="light"] .salary-toggle { background: var(--surface); }
  .salary-tab {
    flex: 1 1 0;
    min-width: 0; /* flex items default to min-width:auto: the longest label
      would steal width and the segments would stop being equal */
    border: none;
    border-radius: 9px;
    padding: 10px 4px;
    font-size: 0.86rem;
    white-space: nowrap;
    color: var(--muted);
    background: transparent;
  }
  .salary-tab:hover { border-color: transparent; color: var(--muted); }
  .salary-tab.is-active {
    background: var(--surface);
    border-color: transparent;
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(5, 8, 18, 0.28);
  }
  [data-theme="light"] .salary-tab.is-active { background: var(--input-bg); }

  /* Bottom tab bar. Fixed; the safe-area inset pads the home indicator. */
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: var(--input-bg);
    border-top: 1px solid var(--line);
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    padding: 4px 0;
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
  }
  .tab svg { width: 24px; height: 24px; }
  .tab.is-active { color: var(--accent); }

  /* Scroll pages leave room for the fixed bar; the home footer does too. */
  body:not([data-page="home"]) {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  }
  body[data-page="home"] .site-footer {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px) + var(--tabbar-h));
  }

  /* Back chevron on drill-in pages. */
  body.has-back .back-btn {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: 1rem;
    padding: 10px 8px 10px 0;
    margin-left: -4px;
    min-height: 44px;
    cursor: pointer;
  }
  body.has-back .back-btn svg { width: 20px; height: 20px; }

  /* More sheet: rises from the bottom edge and docks above the tab bar
     (the Apple Maps pattern), so the tab stays visible and tappable —
     tapping More again dismisses. The blur lives on the scrim, the sheet
     itself stays opaque. Closed = visibility:hidden (§2A). */
  .more-scrim[hidden], .more-sheet[hidden] { display: none !important; }
  /* The scrim covers the content but stops at the tab bar (the Apple Maps
     pattern): the tabs stay visible and tappable under the open sheet, so
     tapping More again dismisses and the other tabs navigate. */
  .more-scrim {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    background: rgba(9, 13, 26, 0.42);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  }
  .more-scrim.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease;
  }
  .more-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    z-index: 71;
    max-height: 84dvh;
    background: var(--input-bg);
    border-radius: 16px 16px 0 0;
    transform: translateY(103%);
    visibility: hidden;
    transition: transform 0.3s var(--ease-out), visibility 0s linear 0.3s;
  }
  .more-sheet.open {
    transform: none;
    visibility: visible;
    transition: transform 0.3s var(--ease-out);
  }
  .sheet-grabber {
    width: 38px;
    height: 5px;
    border-radius: 3px;
    background: var(--line);
    margin: 10px auto 2px;
    flex: 0 0 auto;
  }
  .more-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    padding: 8px 20px;
    border-bottom: 1px solid var(--line);
    font-size: 0.98rem;
  }
  .more-theme-row button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    padding: 0;
  }
  .more-theme-row button svg { width: 20px; height: 20px; }
  .more-sheet-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  /* The cloned menu panel becomes sheet content: un-position it. */
  .more-sheet .more-menu {
    position: static;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    min-width: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
  }

  /* Native push: the whole screen slides in from the right, transform only.
     Browser-back reveals get no animation; reduced-motion gets none. */
  body.page-push {
    animation: page-push-in 0.28s ease-out;
    overflow-x: hidden;
  }
  @keyframes page-push-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
  }

  /* While the keyboard is up the large title drops out with the header. */
  body.kb-open .large-title { display: none; }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  body.page-push { animation: none; }
}
