/* Logbook · Journal layout in the Ledger palette */
:root {
  --bg: #f6f4ef; --sheet: #fffdf9; --tint: #efece4; --tint2: #e8e3d8; --line: #e6e1d6; --line2: #efeae0;
  --ink: #2a2723; --ink2: #5b5547; --ink3: #6a6355; --accent: #8a4b3a; --accent2: #6e3a2c; --water: #e3e6e3;
  --danger: #a63244; --ok: #3f6b4a; --code: #6e685e;
  --serif: 'Newsreader', 'Times New Roman', Georgia, serif;
  --sans: 'Source Sans 3', 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', 'Consolas', 'Menlo', monospace;
  --top-h: 72px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.35; -webkit-font-smoothing: antialiased; overflow: hidden; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; } a:hover { color: var(--accent2); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
.muted { color: var(--ink3); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
::selection { background: var(--tint2); }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; height: var(--top-h); padding: 0 56px; border-bottom: 1px solid var(--line); gap: 24px; flex: 0 0 auto; }
.brand { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.wordmark { font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--ink); }
.brand-sub { font-size: 13px; color: var(--ink3); }
.tabs { display: flex; gap: 32px; padding-top: 12px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 15px; color: var(--ink2); }
.tab .bar { width: 100%; height: 2px; border-radius: 1px; background: transparent; }
.tab.active { color: var(--ink); font-weight: 600; } .tab.active .bar { background: var(--accent); }
.tab:hover { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 20px; }
.icon-btn { display: flex; align-items: center; justify-content: center; color: var(--ink2); width: 32px; height: 32px; border-radius: 16px; }
.icon-btn:hover { color: var(--ink); background: var(--tint); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: var(--ink3); }
.btn.primary { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.square { border-radius: 6px; }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: var(--tint); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--ink2); }

/* ---------- three pane ---------- */
main { flex: 1; min-height: 0; }
.mob-back { display: none; }
.three { display: grid; grid-template-columns: 332px minmax(0, 1fr) 336px; height: 100%; }
@media (max-width: 1360px) { .three { grid-template-columns: 300px minmax(0, 1fr) 300px; } }
@media (max-width: 1180px) { .three { grid-template-columns: 280px minmax(0, 1fr); } .three > .side { display: none; } }
.pane { min-height: 0; display: flex; flex-direction: column; }
.pane-left { padding: 28px 0 0 56px; }
@media (max-width: 1360px) { .pane-left { padding-left: 32px; } }
.pane-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 24px 12px 0; gap: 12px; }
.pane-title { font-family: var(--serif); font-size: 22px; color: var(--ink); }
.pane-title.link { cursor: pointer; border-bottom: 1px dashed transparent; } .pane-title.link:hover { border-bottom-color: var(--ink3); }
.pane-hours { font-family: var(--serif); font-size: 16px; color: var(--ink2); white-space: nowrap; }
.pane-hours small, .hrs small { font-size: 11px; color: var(--ink3); margin-left: 2px; font-family: var(--sans); }
.scroll { overflow-y: auto; min-height: 0; flex: 1; padding-right: 20px; padding-bottom: 40px; scrollbar-width: thin; scrollbar-color: var(--tint2) transparent; }
.scroll::-webkit-scrollbar { width: 8px; } .scroll::-webkit-scrollbar-thumb { background: var(--tint2); border-radius: 4px; }

/* search box (lists) */
.search { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--sheet); border: 1px solid var(--line); color: var(--ink3); margin: 0 24px 14px 0; }
.search input { flex: 1; border: 0; background: transparent; outline: 0; color: var(--ink); min-width: 0; }
.search input::placeholder { color: var(--ink3); }

/* ---------- timeline ---------- */
.month { margin-bottom: 18px; }
.month-head { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 0 10px; gap: 12px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.month-head .t { font-family: var(--serif); font-size: 20px; color: var(--ink); }
.month-head .t.link { cursor: pointer; border-bottom: 1px dashed transparent; text-align: left; } .month-head .t.link:hover { border-bottom-color: var(--ink3); }
.month.first .month-head { padding-top: 0; }
.day { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 14px; }
.day-num { display: flex; flex-direction: column; align-items: flex-start; padding-top: 6px; }
.day-num .d { font-family: var(--serif); font-size: 30px; line-height: 30px; color: var(--ink); font-variant-numeric: tabular-nums; }
.day-num .m { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink3); }
.rows { display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 8px; width: 100%; text-align: left; }
.row:hover { background: var(--tint); }
.row.sel { background: var(--tint); }
.row .route { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.row.sel .route { font-weight: 500; }
.row .route .arr { color: var(--ink3); }
.row .sub { font-size: 12px; color: var(--ink3); margin-top: 1px; }
.row .hrs { font-family: var(--serif); font-size: 16px; color: var(--ink2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .hrs.empty { color: var(--ink3); }
.sentinel { height: 1px; }
.loading { padding: 16px 0; color: var(--ink3); font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px 0 12px; border-radius: 14px; background: var(--tint); color: var(--ink); font-size: 13px; font-weight: 600; margin: 0 0 14px; max-width: 100%; }
.chip .x { color: var(--ink3); display: flex; } .chip .x:hover { color: var(--ink); }
.empty-note { padding: 24px 0; color: var(--ink3); font-size: 14px; line-height: 1.5; }

/* month picker */
.popover { position: absolute; z-index: 30; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(42,39,35,0.14); padding: 14px; min-width: 280px; }
.pop-years { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.pop-years select { flex: 1; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); padding: 0 8px; }
.pop-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pop-months button { height: 40px; border-radius: 6px; border: 1px solid var(--line2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; }
.pop-months button small { font-size: 10px; color: var(--ink3); }
.pop-months button:hover { background: var(--tint); }
.pop-months button:disabled { opacity: 0.35; cursor: default; }
.pop-months button.cur { border-color: var(--accent); }

/* ---------- sheet ---------- */
.sheet-wrap { padding: 28px 8px 28px 8px; min-height: 0; }
.sheet { display: flex; flex-direction: column; gap: 36px; padding: 44px 48px; background: var(--sheet); border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(42,39,35,0.06); height: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--tint2) transparent; }
@media (max-width: 1360px) { .sheet { padding: 36px 40px; } }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink3); }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink2); }
.status.dirty { color: var(--accent); }
.actions { display: flex; gap: 8px; align-items: center; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 20px; }
.hero .code { font-family: var(--serif); font-size: 64px; line-height: 1; letter-spacing: -0.02em; color: var(--code); white-space: nowrap; }
.hero .code.small { font-size: 40px; }
.hero .code.empty { color: var(--ink3); }
.hero .place { font-size: 15px; color: var(--ink2); margin-top: 8px; min-height: 20px; }
.hero .right { text-align: right; } .hero .right .code { text-align: right; }
.hero .mid { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink3); }
.hero .mid .hrs { font-family: var(--serif); font-size: 20px; color: var(--ink2); }
.hero .mid .line { display: flex; align-items: center; } .hero .mid .line i { display: block; width: 64px; height: 1px; background: var(--line); }
.hero .mid .line .plane { color: var(--accent); display: flex; padding: 0 2px; }
.hero .mid .tail { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; }
@media (max-width: 1360px) { .hero .code { font-size: 48px; } .hero .mid .line i { width: 36px; } }
.hero .code input { width: 100%; font: inherit; color: inherit; border: 0; border-bottom: 1px solid var(--line); background: transparent; outline: 0; padding: 0 0 4px; text-transform: uppercase; }
.hero .code input:focus { border-bottom-color: var(--accent); }
.hero .right .code input { text-align: right; }

.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px 56px; }
.section-grid.one { grid-template-columns: minmax(0, 1fr); }
.section { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.section h3 { font-family: var(--serif); font-size: 20px; font-weight: 400; color: var(--ink); margin: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 32px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 28px; }
.fields.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 24px; }
.fld { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); min-width: 0; position: relative; }
.fld label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink3); display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.fld .v { font-size: 17px; line-height: 24px; color: var(--ink); font-variant-numeric: tabular-nums; min-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fld .v.big { font-family: var(--serif); font-size: 24px; }
.fld .v.empty { color: var(--ink3); }
/* a long label wraps once the column is narrow (NIGHT T/O · LDG at laptop widths); pinning the value to the
   bottom of the stretched cell keeps every number in a grid row on one line, and is a no-op when nothing wraps */
.fld .v, .fld input, .fld select { margin-top: auto; }
.fld .v.mono { font-family: var(--mono); font-size: 16px; }
.fld .v a { color: var(--ink); border-bottom: 1px dotted var(--ink3); } .fld .v a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.fld input, .fld select, .fld textarea { width: 100%; border: 0; background: transparent; outline: 0; padding: 0; font-size: 17px; line-height: 24px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 0; }
.fld input.big { font-family: var(--serif); font-size: 24px; }
.fld input.mono { font-family: var(--mono); font-size: 16px; text-transform: uppercase; }
.fld input::placeholder, .fld textarea::placeholder { color: var(--ink3); font-weight: 400; }
.fld.edit { border-bottom-color: var(--line); } .fld.edit:focus-within { border-bottom-color: var(--accent); }
.fld.edit label { color: var(--ink2); }
.fld .use { white-space: nowrap; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 1px 5px; line-height: 1.3; }
.fld .use:hover { background: var(--accent); color: var(--sheet); }
.fld input[type=date] { font-family: var(--sans); }
.notes { font-size: 15px; line-height: 1.55; color: var(--ink2); white-space: pre-wrap; }
.notes.empty { color: var(--ink3); }
textarea.notes-input { width: 100%; min-height: 96px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); font-size: 15px; line-height: 1.55; outline: 0; }
textarea.notes-input:focus { border-color: var(--accent); }
.toggles { display: flex; flex-direction: column; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line2); font-size: 15px; color: var(--ink); gap: 16px; }
.switch { width: 40px; height: 24px; border-radius: 12px; background: var(--tint2); position: relative; transition: background .15s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 9px; background: var(--sheet); box-shadow: 0 1px 2px rgba(0,0,0,0.15); transition: left .15s; }
.switch.on { background: var(--accent); } .switch.on::after { left: 19px; }
.related { display: flex; flex-direction: column; }
.related button, .related a.rel { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line2); font-size: 15px; color: var(--ink); width: 100%; text-align: left; }
.related button:hover, .related a.rel:hover { color: var(--accent); }
.related .n { font-family: var(--serif); font-size: 18px; color: var(--ink2); }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(42,39,35,0.12); max-height: 260px; overflow-y: auto; margin-top: 4px; min-width: 240px; }
.ac-list div { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.ac-list div small { color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-list div.hi, .ac-list div:hover { background: var(--tint); }
.ac-list .k { font-family: var(--mono); }
.form-error { color: var(--danger); font-size: 13px; }

/* ---------- side column ---------- */
.side { padding: 28px 56px 28px 24px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
@media (max-width: 1360px) { .side { padding-right: 32px; } }
.card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; background: var(--tint); }
.card.click { cursor: pointer; } .card.click:hover { background: var(--tint2); }
.card .cap { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; gap: 8px; }
.card .cap .t { font-size: 13px; font-weight: 600; color: var(--ink); } .card .cap .s { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.card .cap .act { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); }
.card .kicker { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink3); }
.card .body { display: flex; flex-direction: column; gap: 4px; padding: 0 2px; }
.card .body .l1 { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--ink); }
.card .body .l1.sans { font-family: var(--sans); font-weight: 600; }
.card .body .l2 { font-size: 13px; color: var(--ink2); } .card .body .l3 { font-size: 13px; color: var(--ink3); }
.card .body a { color: inherit; } .card .body a:hover { color: var(--accent); }
.photo { width: 100%; aspect-ratio: 2.1; border-radius: 8px; background: var(--tint2) center/cover no-repeat; display: flex; align-items: flex-end; padding: 10px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink2); position: relative; overflow: hidden; }
.photo.has { color: transparent; cursor: pointer; }
.photo .ph-btn { position: absolute; right: 8px; bottom: 8px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink2); background: rgba(255,253,249,0.85); border-radius: 4px; padding: 3px 6px; }
.photo .ph-btn:hover { color: var(--ink); }
.map-thumb { width: 100%; aspect-ratio: 228 / 164; border-radius: 8px; background: var(--tint); overflow: hidden; }
.map-thumb svg { width: 100%; height: 100%; }
.person { display: flex; align-items: center; gap: 12px; }
.person .av { width: 34px; height: 34px; border-radius: 17px; background: var(--sheet); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--ink2); flex-shrink: 0; }
.person .nm { font-size: 14px; font-weight: 600; } .person .rl { font-size: 12px; color: var(--ink3); }
.person a { color: inherit; } .person a:hover { color: var(--accent); }
.text { font-size: 14px; color: var(--ink2); line-height: 1.5; padding: 0 2px; }
.bars { --lbl: 16px; display: flex; align-items: flex-end; gap: 2px; height: 72px; padding: 0 2px; }
.bars.tight { --lbl: 30px; height: 88px; }
.bars .col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.bars .col .v { font-size: 10px; line-height: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; white-space: nowrap; margin-bottom: 3px; }
.bars.tight .col .v { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9px; line-height: 10px; margin: 3px 0 2px; }
.bars .col i { display: block; width: 100%; background: var(--tint2); border-radius: 2px 2px 0 0; min-height: 2px; }
.bars-x { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink3); padding: 0 2px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 0 2px; }
.stat .k { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink3); }
.stat .v { font-family: var(--serif); font-size: 20px; line-height: 22px; color: var(--ink); margin-top: 2px; }
.stat .v small { font-size: 11px; font-family: var(--sans); color: var(--ink3); margin-left: 2px; }
.mini-list { display: flex; flex-direction: column; }
.mini-list a, .mini-list button { display: flex; justify-content: space-between; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line2); font-size: 13px; color: var(--ink); width: 100%; text-align: left; }
.mini-list a:hover, .mini-list button:hover { color: var(--accent); }
.mini-list .k { font-family: var(--mono); } .mini-list .n { color: var(--ink3); font-variant-numeric: tabular-nums; }

/* ---------- entity lists ---------- */
.list-body { position: relative; display: flex; min-height: 0; flex: 1; }
.list-body .scroll { padding-right: 34px; }
.group-head { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink3); padding: 12px 0 6px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 8px; width: 100%; text-align: left; }
.item:hover, .item.sel { background: var(--tint); }
.item .k { font-family: var(--mono); font-size: 14px; color: var(--ink); } .item.sel .k { font-weight: 500; }
.item .k.sans { font-family: var(--sans); font-size: 14px; }
.item .s { font-size: 12px; color: var(--ink3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .n { font-family: var(--serif); font-size: 15px; color: var(--ink2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .fav { color: var(--accent); margin-left: 4px; font-size: 11px; }
.item .thumb { width: 44px; height: 30px; border-radius: 4px; background: var(--tint2) center/cover; flex-shrink: 0; margin-right: 10px; }
.item .l { display: flex; align-items: center; min-width: 0; }
.index-rail { position: absolute; right: 8px; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; gap: 0; }
.index-rail button { font-size: 10px; line-height: 13px; color: var(--ink3); width: 16px; text-align: center; font-weight: 600; }
.index-rail button:hover { color: var(--accent); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(42,39,35,0.5); z-index: 100; padding: 24px; }
.lightbox { display: flex; flex-direction: column; gap: 20px; width: min(1040px, 100%); max-height: 100%; padding: 28px 32px 32px; border-radius: 18px; background: var(--sheet); box-shadow: 0 24px 80px rgba(42,39,35,0.35); }
.lightbox .lb-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lightbox .lb-title { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.lightbox .lb-title .r { font-family: var(--serif); font-size: 30px; color: var(--ink); } .lightbox .lb-title .r span { color: var(--ink3); }
.lightbox .lb-title .s { font-size: 14px; color: var(--ink2); }
.close { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line); color: var(--ink2); flex-shrink: 0; }
.close:hover { color: var(--ink); border-color: var(--ink3); }
.lightbox .map-full { width: 100%; aspect-ratio: 976 / 560; border-radius: 10px; background: var(--tint); overflow: hidden; }
.lightbox .map-full svg { width: 100%; height: 100%; }
.lightbox .photo-full { display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--tint); overflow: hidden; min-height: 0; }
.lightbox .photo-full img { max-width: 100%; max-height: calc(100vh - 200px); object-fit: contain; display: block; }
.lightbox .lb-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink3); gap: 16px; flex-wrap: wrap; }

.dialog { width: min(440px, 100%); padding: 28px 28px 24px; border-radius: 16px; background: var(--sheet); box-shadow: 0 24px 80px rgba(42,39,35,0.35); display: flex; flex-direction: column; gap: 18px; }
.dialog h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0; }
.dialog p { margin: 0; color: var(--ink2); line-height: 1.5; }
.dialog .actions { justify-content: flex-end; }

.search-overlay { align-items: flex-start; padding-top: 10vh; }
.search-box { width: min(680px, 100%); background: var(--sheet); border-radius: 16px; box-shadow: 0 24px 80px rgba(42,39,35,0.35); overflow: hidden; }
.search-box .in { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); color: var(--ink3); }
.search-box .in input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 18px; color: var(--ink); }
.search-box .res { max-height: 60vh; overflow-y: auto; padding: 8px 0 12px; }
.search-box .res .gh { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink3); padding: 12px 20px 4px; }
.search-box .res .r { display: flex; align-items: center; gap: 12px; padding: 8px 20px; width: 100%; text-align: left; font-size: 14px; }
.search-box .res .r:hover, .search-box .res .r.hi { background: var(--tint); }
.search-box .res .r .k { font-family: var(--mono); min-width: 120px; } .search-box .res .r .s { color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-box .res .r .d { margin-left: auto; color: var(--ink3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kbd { font-size: 11px; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink3); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.2); opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

.center-note { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ink3); font-size: 15px; text-align: center; line-height: 1.6; padding: 40px; }
.center-note b { font-family: var(--serif); font-weight: 400; font-size: 24px; color: var(--ink2); display: block; margin-bottom: 8px; }

/* ---------- home ---------- */
.home { height: 100%; overflow-y: auto; padding: 24px 56px 40px; display: flex; flex-direction: column; gap: 24px; scrollbar-width: thin; scrollbar-color: var(--tint2) transparent; }
@media (max-width: 1360px) { .home { padding: 24px 32px 40px; } }
.home-map { position: relative; flex: 0 0 auto; height: min(52vh, 560px); min-height: 320px; border-radius: 14px; border: 1px solid var(--line); background: var(--tint); overflow: hidden; }
.home-map svg.pinmap { width: 100%; height: 100%; cursor: grab; touch-action: none; user-select: none; }
.home-map svg.pinmap:active { cursor: grabbing; }
.home-map .pin { cursor: pointer; } .home-map .pin:hover circle { fill: var(--accent2); }
.pinmap-ctl { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 4px; }
.pinmap-ctl button { width: 30px; height: 30px; border-radius: 6px; background: var(--sheet); border: 1px solid var(--line); color: var(--ink); font-size: 16px; line-height: 1; box-shadow: 0 2px 8px rgba(42,39,35,0.08); }
.pinmap-ctl button:hover { border-color: var(--ink3); }
.pinmap-note { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--ink3); background: rgba(255,253,249,0.8); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.home-types { flex: 0 0 auto; }
.home-types-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 0 10px; }
.tbl-scroll { --row-h: 34px; max-height: calc(var(--row-h) * 16 + 2px); overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--sheet); scrollbar-width: thin; scrollbar-color: var(--tint2) transparent; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--tint); text-align: left; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink3); font-weight: 600; height: var(--row-h); padding: 0 16px; border-bottom: 1px solid var(--line); }
.tbl td { height: var(--row-h); padding: 0 16px; border-bottom: 1px solid var(--line2); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tbody tr { cursor: pointer; } .tbl tbody tr:hover td { background: var(--tint); }
.tbl td.mono { font-family: var(--mono); font-weight: 500; }

/* ---------- sign-in / roles ---------- */
body.readonly .admin-only { display: none !important; }
body.readonly .switch { pointer-events: none; }
body:not(.signed-in) .top-actions { visibility: hidden; }
.avatar { cursor: pointer; } .avatar:hover { border-color: var(--ink3); color: var(--ink); }
.login { height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 22px; padding: 32px 32px 28px; border-radius: 16px; background: var(--sheet); border: 1px solid var(--line); box-shadow: 0 24px 80px rgba(42,39,35,0.12); }
.login-card .kicker { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink3); }
.login-card h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: -16px 0 0; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role { position: relative; } .role input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.role span { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.role span b { font-size: 14px; } .role span small { font-size: 12px; color: var(--ink3); }
.role span:hover { border-color: var(--ink3); }
.role input:checked + span { border-color: var(--ink); background: var(--tint); }
.role input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-card .actions { justify-content: space-between; gap: 12px; }
.login-card .actions .btn { min-width: 100px; justify-content: center; }
.user-menu { position: fixed; top: calc(var(--top-h) - 8px); right: 56px; min-width: 220px; display: flex; flex-direction: column; gap: 14px; }
.user-menu .name { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.user-menu .role { font-size: 12px; color: var(--ink3); margin-top: 2px; }

/* ---------- responsive: tablets / small laptops ---------- */
@media (max-width: 1000px) {
  .top { padding: 0 24px; gap: 16px; }
  .tabs { gap: 20px; }
  .brand-sub { display: none; }
  .top-actions { gap: 12px; }
  #newFlightBtn span { display: none; }
  #newFlightBtn { padding: 0 9px; }
  .user-menu { right: 24px; }
  .pane-left { padding-left: 24px; }
  .side { padding-right: 24px; }
  .home { padding: 20px 24px 40px; }
}

/* ---------- responsive: phones ----------
   The header wraps to two rows (brand + actions, then a horizontally scrolling tab strip) and the
   three-pane layout becomes a single column: the list is the page until a row is picked, then the
   sheet and side cards stack in one scroller with a back link on top. app.js toggles .three.detail. */
@media (max-width: 720px) {
  :root { --top-h: 100px; }
  .top { flex-wrap: wrap; height: auto; min-height: var(--top-h); padding: env(safe-area-inset-top) 16px 0; gap: 0 12px; }
  .brand { order: 0; flex: 1; min-width: 0; height: 56px; align-items: center; }
  .wordmark { font-size: 22px; }
  .top-actions { order: 1; height: 56px; gap: 10px; }
  .tabs { order: 2; flex: 0 0 100%; height: 44px; padding: 0; gap: 0; margin: 0 -8px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; height: 100%; justify-content: flex-end; padding: 0 8px; gap: 8px; font-size: 14px; }
  .tab .bar { flex: 0 0 2px; }

  main > .three { display: flex; flex-direction: column; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; } /* main > : .fields.three shares the class name */
  .three > .pane-left { flex: 1; min-height: 0; padding: 14px 0 0 16px; }
  .three > .sheet-wrap, .three > .side { display: none; }
  .three.detail > .pane-left { display: none; }
  .three.detail > .sheet-wrap { display: flex; flex: 0 0 auto; height: auto; padding: 0; }
  .three.detail > .side { display: flex; flex: 0 0 auto; height: auto; overflow: visible; padding: 4px 16px calc(32px + env(safe-area-inset-bottom)); }
  .mob-back { display: flex; align-items: center; gap: 2px; padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--ink2); position: sticky; top: 0; z-index: 2; background: var(--bg); }
  .mob-back:hover { color: var(--ink); }
  .pane-head { padding: 0 16px 10px 0; }
  .pane-title { font-size: 20px; }
  .scroll { padding-right: 12px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .search { margin: 0 16px 12px 0; }
  .list-body .scroll { padding-right: 28px; }
  .index-rail { right: 4px; }
  .row { padding: 9px 10px; }

  .sheet { height: auto; overflow: visible; padding: 16px 16px 24px; gap: 26px; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .sheet-top { flex-wrap: wrap; gap: 10px; }
  .hero { gap: 10px; }
  .hero .code { font-size: 34px; } .hero .code.small { font-size: 26px; }
  .hero .mid .line i { width: 22px; }
  .hero .mid .hrs { font-size: 17px; }
  .hero .place { font-size: 13px; margin-top: 6px; }
  .section-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .section { gap: 14px; }
  .fields { gap: 14px 20px; }
  .fields.three { gap: 14px 12px; }
  .fields.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fld .v { font-size: 16px; } .fld .v.big { font-size: 22px; }
  .fld input { font-size: 16px; } .fld input.big { font-size: 22px; }
  .actions { flex-wrap: wrap; }
  .side { padding-top: 0; }

  .home { padding: 14px 16px calc(28px + env(safe-area-inset-bottom)); gap: 18px; }
  .home-map { height: 46vh; min-height: 260px; }
  .home .tbl th, .home .tbl td { padding: 0 10px; }
  .home .tbl th:nth-child(2), .home .tbl td:nth-child(2) { display: none; }

  .overlay { padding: 12px; }
  .lightbox { padding: 16px; gap: 14px; border-radius: 12px; }
  .lightbox .lb-title .r { font-size: 22px; }
  .lightbox .photo-full img { max-height: calc(100svh - 120px); }
  .dialog { padding: 20px; }
  .search-overlay { padding-top: 12px; }
  .search-box .res { max-height: 70vh; }
  .search-box .res .r .k { min-width: 80px; }
  .search-box .in input { font-size: 16px; }
  .user-menu { right: 12px; top: 56px; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); }
  .login-card { padding: 24px 20px 20px; }
  .center-note { padding: 24px; }
  .popover { max-width: calc(100vw - 24px); }
  /* iOS zooms into any focused control whose text is under 16px */
  .search input, textarea.notes-input, .pop-years select { font-size: 16px; }
}
