/* =========================================================================
 * Doka Locations Hub — css/app.css
 * The Engineer's Notebook design system (../engineers-notebook-style),
 * trimmed to what this app uses, plus the app-local rules at the bottom.
 *
 * The :root block is shared byte-for-byte with doka-platform-manager, Doka
 * Pocket CRM and TiplistToGo — never retune it per app.
 *
 * The one app-local rule: the location TYPE carries the colour everywhere
 * (spine, badge, detail rule, map pin) — branch teal, hq green, yard amber,
 * office purple. Brand tags are outline pills; they never colour a spine.
 * ========================================================================= */

:root {
  --paper: #F6F2E9;
  --card: #FFFDF7;
  --ink: #2B2A26;
  --ink-soft: #6B675C;
  --line: #DDD5C4;
  --line-soft: #EAE3D4;
  --rust: #B3502D;
  --rust-deep: #8F3E21;
  --amber: #E0A41B;
  --teal: #1F6F9C;
  --green: #4A7A43;
  --purple: #6E4FA3;
  --warn-bg: #F6E3DC;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --nav-h: 58px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(43, 42, 38, .10), 0 4px 14px rgba(43, 42, 38, .06);
}

* { box-sizing: border-box; }

/* Load-bearing. View switching uses the hidden attribute; an author
 * display:flex on a hidden pane paints an empty overlay over the whole app. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: var(--teal); }

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 640; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

.mono, code, kbd, pre, .kv dt, .kv dd { font-family: var(--font-mono); }
.muted { color: var(--ink-soft); }
.num { font-variant-numeric: tabular-nums; }

/* The signature small-caps label: field labels, section heads, KPI captions. */
.label, .ctl-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft);
}

.hint { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 0; }
.hint-warn { color: var(--rust-deep); }

/* ------------------------------------------------------------ buttons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--ink-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--rust); border-color: var(--rust-deep); color: #fff; font-weight: 600; }
.btn-primary:hover, .btn-primary:active { background: var(--rust-deep); }
.btn-ghost { border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { color: var(--ink); background: var(--paper); border-color: var(--line); }
.btn-ghost.danger { color: var(--rust-deep); border-color: var(--rust); }
.btn-link { border-color: var(--teal); color: var(--teal); text-decoration: none; }
.btn-tiny { font-size: 12px; padding: 3px 8px; }
.btn.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  color: var(--ink-soft); font-size: 14px; line-height: 1;
}
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.icon-btn.danger:hover { color: var(--rust-deep); }

/* Touch targets. Applied to the whole app (body.touch) — mobile first. */
.touch .btn { min-height: 42px; padding: 10px 16px; border-width: 1.5px; }
.touch .btn-tiny { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.touch .icon-btn { width: 40px; height: 40px; border-radius: 50%; font-size: 20px; }

/* ------------------------------------------------------------- inputs ---- */

.text-input, input[type=text], input[type=search], input[type=number],
input[type=email], input[type=tel], input[type=url], input[type=time], select, textarea {
  width: 100%;
  font-family: var(--font-body); font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--card); color: var(--ink);
}
textarea { resize: vertical; min-height: 52px; line-height: 1.5; }
.text-input:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal); outline-offset: -1px; border-color: var(--teal);
}
.touch .text-input, .touch input, .touch select, .touch textarea {
  font: inherit; padding: 10px 12px; border-width: 1.5px; border-radius: var(--radius);
}
.touch .text-input:focus, .touch input:focus, .touch select:focus, .touch textarea:focus {
  outline: none; border-color: var(--rust);
}
input.mono, textarea.mono { font-family: var(--font-mono); font-size: 13.5px; }

.search-input {
  flex: 1; min-width: 0; font: inherit;
  padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 22px;
  background: var(--card);
}
.search-input:focus { border-color: var(--rust); outline: none; }
.search-row { display: flex; gap: 8px; align-items: center; }

/* Labelled field in a form. */
.ctl { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid .ctl-wide { grid-column: 1 / -1; }
.ctl .hint { margin-top: 2px; }

/* -------------------------------------------------- chips & segments ---- */

.chip-row {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--card);
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  white-space: nowrap; min-height: 34px;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip-divider { flex: 0 0 1px; background: var(--line); margin: 6px 2px; }

.status-badge {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  padding: 2px 7px; border-radius: 4px;
  background: var(--ink-soft); color: #FFFDF7;
}

.pill {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  border: 1px solid var(--teal); color: var(--teal);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.pill-warn { border-color: var(--rust); color: var(--rust-deep); background: var(--warn-bg); }
.pill-soft { border-color: var(--line); color: var(--ink-soft); }

.segmented {
  display: inline-flex; gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.segmented button.active { background: var(--ink); color: var(--paper); }

.env-chip {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft);
  flex-shrink: 0;
}
.env-chip.is-dev { background: var(--amber); border-color: var(--amber); color: var(--ink); }

/* ------------------------------------------------- cards & the spine ---- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px; margin-bottom: 14px;
}
.card-title { font-family: var(--font-display); font-size: 17px; font-weight: 640; margin: 0 0 8px; }

/* The record card: a filed ticket stub with a coloured spine. */
.record-list { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 0; }
.record-card {
  position: relative; display: flex; overflow: hidden; cursor: pointer;
  width: 100%; text-align: left; color: inherit; text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.record-card:active { background: var(--paper); }
.record-card.is-hilite { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(179, 80, 45, .18); }
.card-spine { flex: 0 0 5px; background: var(--ink-soft); }
.card-body { flex: 1; min-width: 0; padding: 10px 12px 11px; }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); letter-spacing: .04em; }
.card-name {
  font-size: 16.5px; line-height: 1.2; margin: 4px 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-area { color: var(--ink-soft); }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-soft); }
.card-flag {
  font-size: 10.5px; font-weight: 700;
  background: var(--warn-bg); color: var(--rust-deep);
  border: 1px solid var(--rust); border-radius: 9px; padding: 1px 7px; white-space: nowrap;
}

/* The figure block: mono value over a small-caps caption. Used everywhere. */
.card-figures, .kpi-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; }
.kpi-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 18px; }
.kpi-strip::-webkit-scrollbar { display: none; }
.fig, .kpi { display: flex; flex-direction: column; line-height: 1.1; flex: 0 0 auto; }
.fig, .kpi-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.kpi-value { font-size: 15px; display: inline-flex; align-items: center; gap: 5px; }
.fig i, .kpi-label {
  font-style: normal; font-family: var(--font-body); font-weight: 400;
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft);
}
.fig.warn, .kpi.warn .kpi-value { color: var(--rust-deep); }
.fig .wx, .kpi-value .wx { width: 15px; height: 15px; vertical-align: -2px; }
.fig-row { display: inline-flex; align-items: center; gap: 5px; }

/* ------------------------------------------------------ key/value rows ---- */

.dgroup { margin-bottom: 22px; }
.dgroup h3 {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--font-body); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--rust);
  border-bottom: 1px solid var(--line); padding-bottom: 5px; margin-bottom: 8px;
}
.dgroup h3 .btn-tiny { text-transform: none; letter-spacing: 0; font-weight: 600; }
.dgroup-rows {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
}
.drow {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
}
.drow:last-child { border-bottom: 0; }
.drow-label { font-size: 13px; color: var(--ink-soft); flex: 0 1 46%; }
.drow-value {
  font-family: var(--font-mono); font-size: 13.5px; font-weight: 500;
  text-align: right; flex: 1; min-width: 0; overflow-wrap: anywhere;
}
.drow-value a { text-decoration: none; }
.drow-value.warn { color: var(--rust-deep); }

/* Two-line rows (hotels, contacts): a head line and a detail line. */
.trow { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.trow:last-child { border-bottom: 0; }
.trow-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.trow-name { font-weight: 600; font-size: 14.5px; min-width: 0; }
.trow-name .pill { margin-left: 6px; vertical-align: 1px; }
.trow-fig { font-family: var(--font-mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.trow-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.trow-sub .mono { font-size: 12.5px; }
.trow-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.trow-note { font-size: 13px; margin-top: 4px; }

/* -------------------------------------------------------- data tables ---- */

.tablewrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 7px; margin-top: 10px; background: var(--card); }
table.data { border-collapse: collapse; width: 100%; font-family: var(--font-mono); font-size: 12px; }
table.data th, table.data td {
  padding: 6px 9px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap;
}
table.data th {
  position: sticky; top: 0; background: var(--paper); user-select: none;
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-soft); border-bottom: 1px solid var(--line);
}
table.data tbody tr:nth-child(even) { background: #FBF7EE; }
table.data td.is-null { color: var(--ink-soft); font-style: italic; }
table.data td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.sans { font-family: var(--font-body); font-size: 13px; }
table.data td.acts { text-align: right; }
table.data td.acts .btn-tiny { margin-left: 4px; }
.cell-clip { display: inline-block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* ----------------------------------------------------- result / tone ---- */

.result { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 12px 0 14px; overflow: hidden; }
.result-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 15px; }
.result-headline { font-size: 14.5px; font-weight: 700; margin: 0 0 3px; }
.result-plain { font-size: 13px; margin: 0; }
.result-body { padding: 0 15px 12px; }

/* Tone drives every colour here. Nothing else sets them. */
.tone-ok     { border-left: 5px solid var(--green); }
.tone-empty  { border-left: 5px solid var(--teal); }
.tone-denied { border-left: 5px solid var(--rust); }
.tone-broken { border-left: 5px solid var(--amber); }
.tone-fatal  { border-left: 5px solid var(--rust-deep); }
.tone-denied .result-head, .tone-fatal .result-head { background: var(--warn-bg); }

.status-chip {
  font-family: var(--font-mono); font-size: 15px; font-weight: 600;
  padding: 3px 10px; border-radius: 6px; color: #fff; white-space: nowrap;
  background: var(--ink-soft);
}
.tone-ok .status-chip { background: var(--green); }
.tone-empty .status-chip { background: var(--teal); }
.tone-denied .status-chip, .tone-fatal .status-chip { background: var(--rust-deep); }
.tone-broken .status-chip { background: var(--amber); color: var(--ink); }

.raw {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.45; margin: 0;
  background: #FBF7EE; border: 1px solid var(--line-soft); border-radius: 7px;
  padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
details.raw-wrap { margin-top: 10px; }
details.raw-wrap > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 4px 0; }

/* --------------------------------------------- empty / loading / boot ---- */

.empty-state { text-align: center; padding: 48px 28px; color: var(--ink-soft); }
.empty-mark { font-size: 34px; color: var(--line); margin-bottom: 10px; line-height: 1; }
.empty-state h2 { color: var(--ink); font-size: 21px; margin-bottom: 6px; }
.empty-state p { margin: 0; }
.empty-state .btn { margin-top: 14px; }

.spinner {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--rust);
  animation: spin .8s linear infinite; vertical-align: middle;
}
.spinner-inline { width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-line { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; padding: 10px 0; }

/* ---- setup: sign-in and every other full-screen state ------------------- */

.setup {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px;
}
.setup-card { width: 100%; max-width: 420px; text-align: center; }
.brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--rust); margin-bottom: 18px;
}
.brand-rule { flex: 0 0 34px; height: 1px; background: var(--rust); opacity: .5; }
.setup-card h1 { font-size: 34px; line-height: 1.1; margin-bottom: 12px; }
.setup-sub { color: var(--ink-soft); margin: 0 0 22px; }
.setup-status { margin-top: 16px; min-height: 24px; font-family: var(--font-mono); font-size: 13px; }
.setup-error { color: var(--rust-deep); }
.setup-choice { width: 100%; margin-top: 8px; }
.setup-card .credit-line { margin-top: 28px; }

/* Clerk's prebuilt sign-in mounts here. */
.clerk-mount { display: flex; justify-content: center; margin: 6px 0 14px; min-height: 320px; }

/* ---------------------------------------------------------- topbar ------ */

.topbar {
  display: flex; align-items: center; gap: 14px;
  height: var(--nav-h); padding: 0 12px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; flex-direction: column; line-height: 1.15; flex-shrink: 0; text-decoration: none; color: inherit; }
.topbar-name { font-family: var(--font-mono); font-size: 14px; font-weight: 600; margin: 0; }
.topbar-sub { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--rust); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.account-wrap { position: relative; }
.touch .account-btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }

.menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  min-width: 200px; display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px;
}
.menu-item {
  display: block; width: 100%; text-align: left; text-decoration: none; color: inherit;
  padding: 9px 10px; border-radius: 7px; font-size: 14px; min-height: 40px;
}
.menu-item:hover, .menu-item:active { background: var(--paper); }
.menu-meta { padding: 4px 10px 8px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; overflow-wrap: anywhere; }

/* ------------------------------------------------ overlays & toast ------
 * z-index ladder — keep every overlay inside it:
 *   map / canvas internals  <= 1000  (contained by .map-strip isolation)
 *   sticky index header        20
 *   account menu               40
 *   full-screen detail       2000
 *   sheet / modal            2100
 *   toast                    2200
 */

.overlay { position: fixed; inset: 0; z-index: 2100; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(43, 42, 38, .42); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86dvh;
  display: flex; flex-direction: column;
  background: var(--paper); border-radius: 16px 16px 0 0;
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 38px; height: 4px; background: var(--line); border-radius: 2px; margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 4px; }
.sheet-scroll { overflow-y: auto; padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }

.modal-panel {
  position: absolute; left: 14px; right: 14px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px;
  max-width: 640px; margin: 0 auto; max-height: 86dvh; overflow-y: auto;
  background: var(--paper); border-radius: 14px; padding: 20px 16px;
  box-shadow: 0 12px 40px rgba(43, 42, 38, .3);
}
.modal-panel h2 { font-size: 19px; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }
.modal-actions .btn-ghost.danger { flex: 0 0 auto; }

.detail-view { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; background: var(--paper); }
.detail-head {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 4px solid var(--ink-soft);
}
.detail-title { flex: 1; min-width: 0; }
.detail-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.detail-title h2 { font-size: 21px; line-height: 1.15; margin: 2px 0 6px; }
.detail-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.detail-scroll { flex: 1; overflow-y: auto; padding: 12px 14px calc(24px + env(safe-area-inset-bottom)); }
.detail-back { flex: 0 0 auto; margin-top: 2px; }

.toast {
  position: fixed; left: 14px; right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 2200;
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius); padding: 11px 14px; font-size: 13.5px;
  box-shadow: 0 6px 22px rgba(43, 42, 38, .32);
  opacity: 0; transform: translateY(8px);
  transition: opacity .22s, transform .22s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* ------------------------------------------------------- credit tag ------
 * The maker's mark. Identical in every app in the family — do not reword it.
 * <a class="credit" href="https://josiahmdavidson.com" target="_blank"
 *    rel="noopener">Built by Claude + Josiah in Illinois 🌽</a> */

.credit {
  display: block; text-align: center; margin-top: 14px; padding-bottom: 20px;
  font-family: var(--font-body); font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); opacity: .6; text-decoration: none;
}
.credit:hover, .credit:active { opacity: .85; }

/* Rental counters, grouped by airport. The code is set in the inverted
 * "selected" treatment because picking the wrong airport's counter is the
 * mistake this section exists to prevent — it has to be unmissable at a
 * glance, not read out of a sentence. */
.rental-group + .rental-group { border-top: 1px solid var(--line); }
.rental-airport {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px 5px; background: var(--paper);
}
.rental-iata {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .06em;
  background: var(--ink); color: var(--paper); border-radius: 4px; padding: 2px 8px;
}
.rental-iata.is-off { background: var(--ink-soft); }
.rental-airport-name { font-size: 12.5px; color: var(--ink-soft); }
.rental-airport-drive {
  margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); white-space: nowrap;
}

/* Two credits on one line. The separator is punctuation, not content: it
 * takes the border tone so it recedes, and is not selectable. */
.credit-line {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  margin: 14px 0 0; padding-bottom: 20px;
}
.credit-line .credit { display: inline; margin-top: 0; padding-bottom: 0; }
.credit-sep {
  margin: 0 8px; color: var(--line); user-select: none;
  font-family: var(--font-body); font-size: 11.5px; font-weight: 600; opacity: .6;
}

/* -------------------------------------------------------- a11y & motion -- */

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible, .record-card:focus-visible { outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .spinner { animation: none; border-top-color: var(--line); }
}

/* =========================================================================
 * App-local rules — below the shared system, clearly marked.
 * ========================================================================= */

/* ---- the type → colour map ---------------------------------------------- */

.st-branch .card-spine, .record-card.st-branch .card-spine { background: var(--teal); }
.st-hq .card-spine,     .record-card.st-hq .card-spine     { background: var(--green); }
.st-yard .card-spine,   .record-card.st-yard .card-spine   { background: var(--amber); }
.st-dc .card-spine,     .record-card.st-dc .card-spine     { background: var(--amber); }
.st-office .card-spine, .record-card.st-office .card-spine { background: var(--purple); }

.status-badge.st-branch { background: var(--teal); }
.status-badge.st-hq     { background: var(--green); }
.status-badge.st-yard   { background: var(--amber); color: var(--ink); }
.status-badge.st-dc     { background: var(--amber); color: var(--ink); }
.status-badge.st-office { background: var(--purple); }

.detail-head.st-branch { border-bottom-color: var(--teal); }
.detail-head.st-hq     { border-bottom-color: var(--green); }
.detail-head.st-yard   { border-bottom-color: var(--amber); }
.detail-head.st-dc     { border-bottom-color: var(--amber); }
.detail-head.st-office { border-bottom-color: var(--purple); }

/* ---- index -------------------------------------------------------------- */

.index-head {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 10px 12px 6px;
}
.index-body { display: flex; flex-direction: column; }

/* isolation: isolate — Leaflet's internal panes reach z-index 1000; the
 * stacking context keeps them under the sticky header and every overlay. */
.map-strip { position: relative; isolation: isolate; z-index: 0; height: 180px; background: #E8E4D8; border-bottom: 1px solid var(--line); }
.map-canvas { position: absolute; inset: 0; background: #E8E4D8; }
.map-unavailable {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  height: 100%; padding: 12px; text-align: center; font-size: 12.5px; color: var(--ink-soft);
}
.map-unavailable .empty-mark { margin: 0; }
.leaflet-container { font-family: var(--font-body); }
.leaflet-container a { color: var(--teal); }
.leaflet-control-attribution { font-size: 9.5px !important; background: rgba(246, 242, 233, .8) !important; color: var(--ink-soft) !important; }
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: var(--shadow) !important; }
.leaflet-bar a { background: var(--card) !important; color: var(--ink) !important; border-bottom-color: var(--line-soft) !important; }
.map-tip {
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--font-body); font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow); border-radius: 6px;
}
.map-tip::before { border-top-color: var(--line); }

.index-list { flex: 1; }
.list-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-soft);
}
.list-meta button { color: var(--teal); font-family: var(--font-body); font-size: 12px; font-weight: 600; min-height: 32px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---- location page ------------------------------------------------------ */

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 18px; }
.action-grid .btn { width: 100%; }
.action-grid .btn-primary { grid-column: 1 / -1; }
.addr-block { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.45; margin: 0 0 12px; }
.addr-block .muted { font-family: var(--font-body); font-size: 12.5px; display: block; margin-top: 2px; }
.loc-map { position: relative; isolation: isolate; z-index: 0; height: 140px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #E8E4D8; margin-bottom: 14px; }
.loc-map .map-canvas { position: absolute; inset: 0; }

.wx-now { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; }
.wx-now .kpi-strip { margin-top: 0; }
.wx-days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.wx-day { text-align: center; background: var(--paper); border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 4px; }
.wx-day .wx { width: 22px; height: 22px; display: block; margin: 2px auto 4px; }
.wx-day-name { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.wx-day-t { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.wx-day-t span { color: var(--ink-soft); font-weight: 400; }
.wx-day-c { font-size: 11px; color: var(--ink-soft); }
.wx { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wx-stale { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); margin-top: 8px; }

.rec-row { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 10px; }
.rec-row:last-child { border-bottom: 0; }
.rec-vote {
  flex: 0 0 46px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 0; padding: 4px 0; border: 1.5px solid var(--line); border-radius: 9px; background: var(--card);
  color: var(--ink-soft); min-height: 46px;
}
.rec-vote b { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink); }
.rec-vote span { font-size: 15px; line-height: 1; }
.rec-vote.on { background: var(--rust); border-color: var(--rust-deep); color: #FFF8F0; }
.rec-vote.on b { color: #FFF8F0; }
.rec-vote:disabled { opacity: .5; }
.rec-main { flex: 1; min-width: 0; }
.rec-name { font-weight: 600; font-size: 14.5px; }
.rec-meta { font-size: 12.5px; color: var(--ink-soft); }
.rec-by { font-size: 12px; color: var(--ink-soft); font-style: italic; }
.rec-notes { font-size: 13px; margin-top: 3px; }
.rec-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rec-hidden { opacity: .6; }

.notes-block { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; font-size: 14px; white-space: pre-wrap; }
.detail-foot { text-align: center; padding: 14px 0 6px; }
.detail-foot .btn-ghost { color: var(--ink-soft); }
.stale-note { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); text-align: center; padding: 4px 0 0; }

/* ---- admin -------------------------------------------------------------- */

.admin-page { padding: 12px 12px 30px; max-width: 980px; margin: 0 auto; }
.admin-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; flex-wrap: wrap; }
.admin-crumbs a { text-decoration: none; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.admin-head h2 { font-size: 22px; }
.admin-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.admin-menu .card { margin: 0; text-align: left; cursor: pointer; text-decoration: none; color: inherit; display: block; }
.admin-menu .card:active { background: var(--paper); }
.admin-menu .card-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.admin-menu .card p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.admin-section { margin-top: 22px; }
.link-editor { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; }
.link-editor .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tags-hint { font-family: var(--font-mono); font-size: 11.5px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 42px; }
.check-row input { width: 20px; height: 20px; margin: 0; }
.hours-grid { display: grid; grid-template-columns: 44px 1fr 1fr 60px; gap: 6px; align-items: center; }
.hours-grid .label { text-align: right; }
.hours-grid input[type=time] { padding: 6px 8px; }
.hours-grid .closed { font-size: 12px; text-align: center; }
.touch .hours-grid input { padding: 6px 8px; font-size: 13px; border-radius: 7px; }

/* ------------------------------------------------------------ widths ----- */

@media (min-width: 740px) {
  .index-head, .record-list, .list-meta, .index-list .credit-line, .index-list .empty-state {
    max-width: 720px; margin-left: auto; margin-right: auto;
  }
  .index-head { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .detail-scroll, .detail-head { padding-left: max(14px, calc((100vw - 720px) / 2)); padding-right: max(14px, calc((100vw - 720px) / 2)); }
  .topbar { padding: 0 18px; }
}

/* Desktop: the map moves beside the list and grows (spec §5.1). */
@media (min-width: 900px) {
  .index-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); align-items: start; }
  .index-head { max-width: none; border-left: 0; border-right: 0; }
  .map-strip { order: 2; position: sticky; top: 96px; height: calc(100dvh - 120px); margin: 12px 12px 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .index-list { order: 1; }
  .record-list, .list-meta, .index-list .credit-line, .index-list .empty-state { max-width: none; }
  .loc-map { height: 200px; }
  .action-grid { grid-template-columns: repeat(4, 1fr); }
  .action-grid .btn-primary { grid-column: auto; }
}

@media (max-width: 600px) {
  .cell-clip { max-width: 180px; }
  .form-grid { grid-template-columns: 1fr; }
  .link-editor .row { grid-template-columns: 1fr; }
  .modal-panel { left: 8px; right: 8px; padding: 16px 12px; }
}
