/* 2026 Golf Trip — "The Routing Plan"
 * Drafting-table minimalism: warm paper, one confident green, hairline rules,
 * a club scorecard hero, hole-number medallions, a contour route map.
 * System fonts only; fully offline. */

:root {
  --paper: #F7F6F1;
  --surface: #FFFFFF;
  --surface-alt: #EFEEE7;
  --ink: #16211B;
  --ink-muted: #5B6560;
  --green: #1A7A46;
  --green-deep: #0E3F27;
  --fairway: #E3EDE4;
  --sand: #E9DFC4;
  --flag: #C24232;
  --sky: #2E6E9E;
  --gold: #B4924D;
  --gold-text: #7A5E20;   /* AA-contrast gold for small text/pills on white/paper */
  --clay: #BE6A45;
  --graphite: #525B55;
  --hair: rgba(22, 33, 27, 0.12);
  --hair-soft: rgba(22, 33, 27, 0.07);
  --shadow: 0 1px 2px rgba(22, 33, 27, 0.08);
  --shadow-lift: 0 6px 20px rgba(22, 33, 27, 0.13);
  --contour: #D7D9C8;
  --ocean: #DCE8F0;
  --ocean-grat: #C9DCE9;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
  --head: "Helvetica Neue", Helvetica, "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --maxw: 1240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { overflow-x: hidden; }   /* safety net against any stray horizontal overflow */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
button { font-family: inherit; cursor: pointer; }

.page { max-width: var(--maxw); margin: 0 auto; padding: 0 24px 40px; }

/* Type-color tokens per tile type */
.type-flight  { --accent: var(--sky);    --chip-bg: #E4EEF5; --chip-fg: #2E6E9E; }
.type-drive   { --accent: var(--graphite);--chip-bg: #ECEEEB; --chip-fg: #525B55; }
.type-lodging { --accent: var(--gold);    --chip-bg: #F3ECD9; --chip-fg: #8A6E2E; }
.type-golf    { --accent: var(--green);   --chip-bg: #E3EDE4; --chip-fg: #0E3F27; }
.type-misc    { --accent: var(--clay);    --chip-bg: #F5E7DE; --chip-fg: #9A4E30; }

/* ------------------------------------------------------------------ *
 * Masthead
 * ------------------------------------------------------------------ */
.masthead {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 26px 0 18px; border-bottom: 1px solid var(--hair);
  position: relative; flex-wrap: wrap;
}
.mast-left { display: flex; align-items: center; gap: 16px; }
.mast-crest { color: var(--green); flex: 0 0 auto; }
.crest { width: 44px; height: 52px; display: block; }
.mast-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-muted); }
.mast-title { font-family: var(--head); font-weight: 300; letter-spacing: -0.01em; font-size: clamp(28px, 4vw, 44px); margin: 2px 0 0; line-height: 1.03; }
.mast-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.mast-meta { font-size: 11px; letter-spacing: 0.16em; color: var(--ink-muted); }

.opt-tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.opt-tab {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 12px 8px; text-align: left; color: var(--ink-muted);
  display: flex; flex-direction: column; gap: 1px; position: relative; transition: background .15s, color .15s;
}
.opt-tab:hover { background: var(--surface); color: var(--ink); }
.opt-tab-name { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.opt-tab-sub { font-size: 11px; color: var(--ink-muted); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-tab.active { color: var(--ink); }
.opt-tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 1px; height: 2px;
  background: var(--green); border-radius: 2px;
}

/* ------------------------------------------------------------------ *
 * Toolbar
 * ------------------------------------------------------------------ */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; flex-wrap: wrap; }
.tb-hint { font-size: 12.5px; color: var(--ink-muted); font-style: italic; }
.toolbar-right { display: flex; gap: 8px; }
.tbtn {
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 7px 13px; font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow);
  transition: border-color .15s, transform .1s;
}
.tbtn:hover { border-color: var(--green); transform: translateY(-1px); }
.tbtn-quiet { color: var(--ink-muted); box-shadow: none; background: transparent; }

/* Shared-save status pill (lives in .toolbar-left) */
.toolbar-left { display: flex; align-items: center; min-height: 30px; }
.sync-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-muted); letter-spacing: 0.01em; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); flex: 0 0 auto; transition: background .2s ease; }
.sync-pill[data-state="synced"]   .sync-dot { background: var(--green); }
.sync-pill[data-state="saving"]   .sync-dot { background: var(--gold-text); animation: sync-pulse 1s ease-in-out infinite; }
.sync-pill[data-state="offline"]  .sync-dot { background: #B8863B; }
.sync-pill[data-state="conflict"] .sync-dot { background: #B23B3B; }
.sync-pill[data-state="locked"]   .sync-dot { background: var(--ink-muted); }
@keyframes sync-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ------------------------------------------------------------------ *
 * Dashboard
 * ------------------------------------------------------------------ */
.dashboard { margin: 14px 0 8px; }
.dstrip {
  display: grid; grid-template-columns: repeat(5, 1fr) 118px; gap: 0;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.dcell { padding: 16px 18px; border-left: 1px solid var(--hair); }
.dcell:first-child { border-left: none; }
.dcell-label { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }
.dcell-value { font-family: var(--head); font-weight: 300; font-size: clamp(24px, 3vw, 32px); line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dcell-unit { font-size: 14px; color: var(--ink-muted); margin-left: 3px; }
.dcell-sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 3px; }
.dcell-label { display: flex; align-items: center; gap: 6px; }
.dcell-over { font-size: 8.5px; font-weight: 700; letter-spacing: 0.08em; color: #fff; background: var(--flag); border-radius: 3px; padding: 1px 4px; }
.dcell.breach .dcell-value { color: var(--flag); }
.dcell.breach .dcell-sub { color: var(--flag); font-weight: 500; }
.dcell.breach { background: rgba(194, 66, 50, 0.045); }
.dcell.breach:focus-visible { outline: 2px solid var(--flag); outline-offset: -2px; }

.plan-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-top: 10px; padding: 9px 14px; background: var(--surface); border: 1px solid var(--hair); border-left: 3px solid var(--green); border-radius: 10px; font-size: 12.5px; }
.plan-note-title { font-weight: 600; letter-spacing: 0.02em; }
.plan-note-sub { color: var(--green-deep); font-weight: 500; }
.plan-note-trade { color: var(--ink-muted); flex: 1; min-width: 220px; }

.dcell-meter { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--fairway); }
.pm-wrap { width: 46px; height: 46px; }
.parmeter { width: 46px; height: 46px; display: block; }
.pm-track { fill: none; stroke: #FFFFFF; stroke-width: 5; }
.pm-fill { fill: none; stroke: var(--green); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.pm-num { font-size: 12px; font-weight: 600; }

.settle {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; font-size: 12.5px;
}
.settle-item { color: var(--ink-muted); }
.settle-warn { color: var(--flag); }
.settle-net { margin-left: auto; font-weight: 600; color: var(--green-deep); }

/* ------------------------------------------------------------------ *
 * The spread: scorecard + map
 * ------------------------------------------------------------------ */
.spread { display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); gap: 22px; margin-top: 22px; align-items: start; }

.sc-strap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--gold); margin-bottom: 12px; }
.sc-strap-label { font-family: var(--head); font-size: 13px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }
.sc-strap-count { font-size: 11px; letter-spacing: 0.1em; color: var(--ink-muted); }

/* Scorecard */
.scorecard { position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
/* Fixed day column so every day's itinerary text starts at the same left edge. */
.sc-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 12px; align-items: start; padding: 11px 14px 11px 16px; border-bottom: 1px solid var(--hair-soft); transition: background .15s; }
.sc-row.alt { background: var(--surface-alt); }
.sc-row.is-off { opacity: 0.72; }
.sc-row.hl { background: var(--fairway); }
.sc-day { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.sc-daymeta { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding-top: 2px; }
.sc-date { font-size: 11px; color: var(--ink-muted); letter-spacing: 0.02em; white-space: nowrap; }
.sc-sub { font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--gold-text); text-transform: uppercase; }
.sc-plan { min-width: 0; }
.sc-headline { font-weight: 500; font-size: 14.5px; }
.sc-row.is-golf .sc-headline { color: var(--green-deep); }
.sc-chips { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.sc-chip-line { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.sc-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-muted); }
.sc-chip-ic { color: var(--accent); display: inline-flex; }
.sc-chip .gicon-sm { width: 13px; height: 13px; }
.sc-right { display: flex; align-items: center; gap: 8px; }
.sc-par { font-size: 11px; color: var(--ink-muted); }
.sc-vac { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--gold-text); border: 1px solid var(--gold); border-radius: 4px; padding: 1px 4px; }
.sc-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface-alt); border-top: 2px solid var(--hair); }
.sc-total-label { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-muted); }
.sc-total-figs { display: flex; gap: 16px; font-size: 12.5px; font-weight: 500; }

/* Medallion motif */
.medallion { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--ink); display: grid; place-items: center; flex: 0 0 auto; color: var(--ink); }
.medallion::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1px solid var(--hair); }
.med-num { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.med-golf { border-color: var(--green); color: var(--green-deep); }
.med-golf::after { border-color: rgba(26, 122, 70, 0.4); }

/* ------------------------------------------------------------------ *
 * Route map
 * ------------------------------------------------------------------ */
.map-wrap { background: var(--fairway); border: 1px solid var(--hair); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.routemap { width: 100%; height: auto; display: block; }
.map-ocean { fill: var(--ocean); }
.map-grat { stroke: var(--ocean-grat); stroke-width: 1; opacity: 0.5; }
.map-coast { fill: none; stroke: var(--ink); stroke-width: 1.5; opacity: 0.85; }
/* NC / SC state line — subtle, same ink as the region labels. */
.map-border { fill: none; stroke: var(--ink-muted); stroke-width: 1; opacity: 0.55; stroke-dasharray: 4 3; }
.map-contour { fill: none; stroke: var(--contour); stroke-width: 1; opacity: 0.75; }
.map-region, .map-ocean-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; fill: var(--ink-muted); opacity: 0.7; }
.map-ocean-label { fill: var(--sky); }
.map-leg { fill: none; stroke: var(--green); stroke-width: 2.4; stroke-linecap: round; opacity: 0.9; }
.map-badge-bg { fill: #fff; stroke: var(--hair); }
.map-leg-label { font-family: var(--mono); font-size: 10px; fill: var(--green-deep); font-weight: 600; }
.map-med { fill: #fff; stroke: var(--ink); stroke-width: 1.2; }
.map-med-inner { fill: none; stroke: var(--hair); stroke-width: 1; }
.map-plane { color: var(--ink); }
.map-flagstick { stroke: var(--ink); stroke-width: 1.4; }
.map-flag { fill: var(--flag); transform-box: fill-box; transform-origin: left center; }
.map-flag.fam { fill: var(--gold); }
.map-cup { fill: var(--green-deep); }
.map-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; fill: var(--ink); font-weight: 600; }
.map-north-arrow { fill: var(--ink); }
.map-north-n { font-family: var(--mono); font-size: 10px; fill: var(--ink-muted); text-anchor: middle; }
.map-scale-bar { stroke: var(--ink); stroke-width: 1.2; }
.map-scale-label { font-family: var(--mono); font-size: 9.5px; fill: var(--ink-muted); }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 4px 2px; }
.lg-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-muted); }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

/* gentle flag sway */
@keyframes sway { 0%,100% { transform: scaleX(1); } 50% { transform: scaleX(0.86); } }
.map-flag { animation: sway 4s ease-in-out infinite; }

/* ------------------------------------------------------------------ *
 * Board
 * ------------------------------------------------------------------ */
.board-divider { display: flex; align-items: center; gap: 14px; margin: 40px 0 16px; }
.board-divider::before, .board-divider::after { content: ""; height: 1px; background: var(--hair); flex: 1; }
.board-divider-label { font-family: var(--head); font-size: 12px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted); }

.board-scroller { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 16px; scroll-snap-type: x proximity; }
.col { flex: 0 0 268px; background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; display: flex; flex-direction: column; scroll-snap-align: start; box-shadow: var(--shadow); }
.col.hl { border-color: var(--green); }
.col-bag { background: var(--surface-alt); border-style: dashed; }
.col-head { padding: 12px 12px 8px; border-bottom: 1px solid var(--hair-soft); }
.col-headrow { display: flex; align-items: center; gap: 9px; }
.col-titles { min-width: 0; flex: 1; }
.col-title { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.col-bag .col-title { font-family: var(--head); letter-spacing: 0.04em; }
.col-sub { font-size: 11px; color: var(--ink-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-vac { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; color: var(--gold-text); border: 1px solid var(--gold); border-radius: 4px; padding: 1px 4px; }
.col-rename { background: transparent; border: none; padding: 0; color: var(--ink); font-size: 13px; font-weight: 600; text-align: left; cursor: text; border-radius: 4px; }
.col-rename:hover { color: var(--green); text-decoration: underline dotted; }
.col-del { margin-left: 2px; width: 22px; height: 22px; flex: 0 0 auto; border: 1px solid transparent; background: transparent; color: var(--ink-muted); border-radius: 6px; font-size: 11px; line-height: 1; }
.col-del:hover { color: var(--flag); border-color: var(--hair); background: rgba(194,66,50,.06); }
.col-flags { display: flex; gap: 4px; margin-top: 8px; }
.flagchip { font-size: 10px; letter-spacing: 0.04em; color: var(--ink-muted); background: transparent; border: 1px solid var(--hair); border-radius: 20px; padding: 2px 8px; transition: all .12s; }
.flagchip:hover { border-color: var(--ink-muted); }
.flagchip.on { color: #fff; background: var(--green); border-color: var(--green); }
/* Half vacation day — a lighter green tint between transparent and full. */
.flagchip.half { color: var(--green-deep); background: #CBE7D3; border-color: var(--green); }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 70px; flex: 1; transition: background .12s; border-radius: 0 0 12px 12px; }
.col-body.drop-active { background: var(--fairway); }
.col-empty { border: 1px dashed var(--hair); border-radius: 8px; padding: 18px 10px; text-align: center; color: var(--ink-muted); font-size: 12px; }
.col-add { margin: 0 10px 12px; border: 1px dashed var(--hair); background: transparent; color: var(--ink-muted); border-radius: 8px; padding: 8px; font-size: 12.5px; font-weight: 500; transition: all .12s; }
.col-add:hover { border-color: var(--green); color: var(--green); }
.col-adday { flex: 0 0 128px; background: transparent; border: 1px dashed var(--hair); box-shadow: none; align-items: center; justify-content: center; padding: 12px; }
.adday-btn { background: transparent; border: none; color: var(--ink-muted); font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; }
.adday-btn:hover { color: var(--green); }

.drop-ph { height: 3px; background: var(--green); border-radius: 3px; margin: 2px 0; opacity: 0.9; }

/* ------------------------------------------------------------------ *
 * Tiles
 * ------------------------------------------------------------------ */
.tile {
  position: relative; background: var(--surface); border: 1px solid var(--hair);
  border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 11px;
  box-shadow: var(--shadow); transition: transform .1s, box-shadow .15s, border-color .15s; outline: none;
}
.tile.type-golf { border-left-width: 4px; }
.tile.type-drive { border-left-style: dashed; }
.tile.is-flex { border-style: dashed; }
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); border-color: var(--accent); }
.tile:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.tile { touch-action: none; }
.drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none; margin: 0;
  opacity: 0.95; transform: rotate(1.5deg); box-shadow: var(--shadow-lift);
}
body.dragging-active { user-select: none; -webkit-user-select: none; cursor: grabbing; }

.tile-head { display: flex; align-items: center; gap: 8px; }
.tile-chip { width: 24px; height: 24px; border-radius: 7px; background: var(--chip-bg); color: var(--chip-fg); display: grid; place-items: center; flex: 0 0 auto; }
.gicon { width: 16px; height: 16px; display: block; }
.gicon-sm { width: 13px; height: 13px; }
.tile-headtext { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.tile-type { font-size: 10px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-muted); }
.tile-kicker { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--green); }
.tile-status { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 5px; border: 1px solid currentColor; background: transparent; }
.tile-status.s-idea { color: var(--ink-muted); }
.tile-status.s-tentative { color: var(--gold-text); }
.tile-status.s-confirmed { color: var(--green); background: rgba(26, 122, 70, 0.08); }
.tile-grip { display: grid; grid-template-columns: repeat(2, 3px); gap: 3px; margin-left: 2px; opacity: 0; transition: opacity .15s; }
.tile-grip i { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-muted); display: block; }
.tile:hover .tile-grip { opacity: 0.6; }
.tile-body { margin-top: 7px; }
.tile-title { font-weight: 500; font-size: 14px; line-height: 1.25; }
.tile-title.scratch { text-decoration: line-through; text-decoration-color: var(--flag); color: var(--ink-muted); }
.tile-meta { font-size: 11.5px; color: var(--ink-muted); margin-top: 3px; }
.tile-notes { font-size: 11.5px; color: var(--ink-muted); margin-top: 5px; line-height: 1.4; opacity: 0.92; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; min-height: 18px; }
.tile-cost { font-size: 12px; font-weight: 600; color: var(--green-deep); }
.tile-move { display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-move { opacity: 1; }
.tile:focus-within .tile-move, .tile:focus-within .tile-grip { opacity: 1; }
@media (hover: none) { .tile-move, .tile-grip { opacity: 1; } }
.mini { width: 22px; height: 20px; border: 1px solid var(--hair); background: var(--surface); border-radius: 5px; color: var(--ink-muted); font-size: 11px; line-height: 1; }
.mini:hover { border-color: var(--green); color: var(--green); }

/* ------------------------------------------------------------------ *
 * Type chooser + modal
 * ------------------------------------------------------------------ */
.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.type-choice { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px; border: 1px solid var(--hair); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--surface); transition: transform .1s, border-color .15s; }
.type-choice:hover { transform: translateY(-2px); border-color: var(--accent); }
.tc-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--chip-bg); color: var(--chip-fg); display: grid; place-items: center; }
.tc-ic .gicon { width: 20px; height: 20px; }
.tc-label { font-size: 12.5px; font-weight: 500; }

.modal-overlay { position: fixed; inset: 0; background: rgba(22, 33, 27, 0.42); display: grid; place-items: center; padding: 20px; z-index: 100; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(22, 33, 27, 0.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--hair); position: sticky; top: 0; background: var(--surface); }
.modal-title { font-family: var(--head); font-size: 15px; font-weight: 600; letter-spacing: 0.04em; }
.modal-x { border: none; background: transparent; font-size: 15px; color: var(--ink-muted); padding: 4px 8px; border-radius: 6px; }
.modal-x:hover { background: var(--surface-alt); color: var(--ink); }
.modal-body { padding: 16px 18px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-wide { grid-column: 1 / -1; }
.field-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.in { width: 100%; border: 1px solid var(--hair); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; color: var(--ink); background: var(--surface); }
.in:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px rgba(26, 122, 70, 0.15); }
textarea.in { resize: vertical; }
.modal-actions { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--hair); position: sticky; bottom: 0; background: var(--surface); }
.spacer { flex: 1; }
.btn { border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 500; border: 1px solid var(--hair); background: var(--surface); color: var(--ink); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { border-color: var(--ink-muted); }
.btn-danger { color: var(--flag); border-color: transparent; background: transparent; }
.btn-danger:hover { background: rgba(194, 66, 50, 0.08); }

.foot { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--hair); font-size: 12px; color: var(--ink-muted); text-align: center; }

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .spread { grid-template-columns: 1fr; }
  .dstrip { grid-template-columns: repeat(3, 1fr); }
  .dcell:nth-child(4), .dcell:nth-child(1) { border-left: 1px solid var(--hair); }
  .dcell:nth-child(1), .dcell:nth-child(4) { border-left: none; }
  .dcell-meter { grid-column: span 1; }
  /* keep the route map legible when the SVG scales down */
  .map-label { font-size: 15px; }
  .map-leg-label { font-size: 13px; }
  .map-region, .map-ocean-label { font-size: 13px; }
  .map-grat, .map-contours, .map-scale, .map-north { display: none; }
}

/* Touch: bigger hit areas for the small per-tile / per-day controls */
@media (hover: none) {
  .mini { min-width: 40px; min-height: 36px; }
  .flagchip { padding: 7px 12px; }
  .tile-status { padding: 6px 10px; }
  .col-del { width: 34px; height: 34px; }
}
@media (max-width: 560px) {
  .page { padding: 0 14px 30px; }
  .dstrip { grid-template-columns: repeat(2, 1fr); }
  .form { grid-template-columns: 1fr; }
  .mast-right { align-items: flex-start; width: 100%; }
}

/* ------------------------------------------------------------------ *
 * Print — isolate the shareable sheet (dashboard + scorecard + map)
 * ------------------------------------------------------------------ */
@media print {
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; overflow-x: visible; }
  .toolbar, .board-divider, .board, .foot, .opt-tabs { display: none !important; }
  .page { max-width: none; padding: 0; }
  .dstrip, .scorecard, .map-wrap { box-shadow: none; }
  .spread { grid-template-columns: 1fr 1fr; }
  .tile, .col { box-shadow: none; }
  /* keep meaningful blocks from splitting across pages */
  .dstrip, .plan-note, .settle, .scorecard, .map-wrap, .sc-row { break-inside: avoid; }
  @page { margin: 14mm; }
}

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