/* Trip Planner.
   SCOPING CONTRACT: the class .trip-planner-app lives on the app ROOT
   WRAPPER (a div inside <body>), NEVER on <body> itself. Shared page
   components (site header/footer, the firebase-auth sign-out modal,
   #sync-banner, toasts injected by shared scripts) render OUTSIDE that
   wrapper and therefore can never be touched by app styles: the sign-out
   modal once diverged on this page purely because these rules sat on
   <body>. Page-level look (background, theme vars, mode classes
   tp-light / tp-shared / view-days) lives on body.tp-page. Enforced by
   sync-system/tests/shared-ui-consistency.test.mjs. */

  body.tp-page {
    /* single typography token: themes NEVER redefine it, so dark and light
       render identical type; controls reference it explicitly below instead
       of relying on a fragile inherit chain */
    --tp-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bg: #0e1116;
    --bg-soft: #161b23;
    --bg-card: #1b2230;
    --bg-raised: #222b3c;
    --border: #2c3648;
    --border-soft: #232c3c;
    --text: #e8edf5;
    --text-dim: #9aa7ba;
    --text-faint: #6b7789;
    --accent: #4f8cff;
    --accent-soft: rgba(79, 140, 255, 0.14);
    --green: #34c98e;
    --green-soft: rgba(52, 201, 142, 0.14);
    --amber: #f0b34e;
    --amber-soft: rgba(240, 179, 78, 0.14);
    --purple: #a78bfa;
    --purple-soft: rgba(167, 139, 250, 0.15);
    --red: #f2657a;
    --red-soft: rgba(242, 101, 122, 0.13);
    --gray-soft: rgba(154, 167, 186, 0.13);
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    --radius: 14px;
    color-scheme: dark;
  }
  body.tp-page.tp-light {
    --bg: #f3f5f9;
    --bg-soft: #ffffff;
    --bg-card: #ffffff;
    --bg-raised: #eef1f7;
    --border: #d6dce7;
    --border-soft: #e3e8f0;
    --text: #1c2432;
    --text-dim: #556174;
    --text-faint: #8b96a8;
    --accent: #2f6fe4;
    --accent-soft: rgba(47, 111, 228, 0.10);
    --green: #148f60;
    --green-soft: rgba(20, 143, 96, 0.11);
    --amber: #b07514;
    --amber-soft: rgba(176, 117, 20, 0.12);
    --purple: #7857d6;
    --purple-soft: rgba(120, 87, 214, 0.11);
    --red: #d43d55;
    --red-soft: rgba(212, 61, 85, 0.10);
    --gray-soft: rgba(85, 97, 116, 0.10);
    --shadow: 0 10px 28px rgba(28, 36, 50, 0.14);
    color-scheme: light;
  }
  .trip-planner-app *, .trip-planner-app *::before, .trip-planner-app *::after { box-sizing: border-box; }
  body.tp-page {
    margin: 0;
    background: var(--bg);
  }
  /* typography/color live on the app root, NOT body, so they cannot
     inherit into shared components appended to <body> */
  .trip-planner-app {
    color: var(--text);
    font: 15px/1.5 var(--tp-font);
    -webkit-font-smoothing: antialiased;
  }
  :where(.trip-planner-app) button { color: inherit; cursor: pointer; }
  .trip-planner-app input, .trip-planner-app select, .trip-planner-app textarea { color: var(--text); }

  /* main.css neutralizers: the site template styles bare elements (uppercase
     headings, 2.75em controls, 100%-width selects); undo that inside the app */
  /* buttons: zero-specificity base (:where) so component rules like
     .btn { font-weight: 600 } and .leg-btn { font-size: 12.5px } always win;
     still beats main.css's bare `button` rules via load order */
  :where(.trip-planner-app) button {
    font-family: var(--tp-font);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    height: auto;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
  }
  /* form fields need class-level specificity to beat main.css's
     input[type="search"] sizing; later component rules still win ties */
  .trip-planner-app input,
  .trip-planner-app select,
  .trip-planner-app textarea,
  .trip-planner-app option {
    font-family: var(--tp-font);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    height: auto;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
  }
  .trip-planner-app h1, .trip-planner-app h2, .trip-planner-app h3 {
    text-transform: none; letter-spacing: normal; color: var(--text);
  }
  /* width:auto undoes main.css's 100%-width inputs; sizing itself is owned
     by the .toolbar layout rules further down (lower specificity, so keep
     flex/width OUT of this neutralizer) */
  .trip-planner-app .toolbar input[type="search"] { width: auto; display: inline-block; }
  .trip-planner-app .toolbar select { width: auto; display: inline-block; }
  .trip-planner-app select.status-sel { width: auto; min-width: 90px; height: auto; }
  .trip-planner-app select.trip-select { width: auto; }
  /* the native dropdown popup: main.css hard-codes option { color:#444;
     background:#fff }, which renders a light popup inside dark mode.
     Retheme every select's options from the app tokens (flips with theme). */
  .trip-planner-app select option {
    color: var(--text);
    background-color: var(--bg-card);
  }
  /* main.css turns <body> into a flex container; without an explicit width
     a flex item sizes to min-content and overflows small screens */
  .tp-wrap { width: 100%; min-width: 0; max-width: 1180px; margin: 0 auto; padding: 20px 22px 80px; }

  /* ---------- header ---------- */
  .tp-head {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 6px 0 18px;
  }
  .logo { display: flex; align-items: center; gap: 10px; margin-right: auto; }
  .logo .mark { font-size: 26px; }
  .logo h1 { font-size: 21px; margin: 0; letter-spacing: 0.2px; }
  .logo .sub { color: var(--text-faint); font-size: 12px; margin-top: -3px; }
  .trip-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  select.trip-select {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 34px 8px 12px; font-weight: 600; min-width: 170px; max-width: 260px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239aa7ba' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
  }
  .icon-btn {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 11px; color: var(--text); line-height: 1;
    transition: border-color .15s, color .15s, background .15s;
  }
  .icon-btn svg { display: block; }
  .icon-btn:hover { color: var(--text); border-color: var(--accent); }
  .btn {
    border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px;
    padding: 8px 14px; font-weight: 600; color: var(--text);
    transition: border-color .15s, color .15s, background .15s, transform .05s;
  }
  .btn:hover { color: var(--text); border-color: var(--accent); }
  .btn:active { transform: translateY(1px); }
  .btn.primary {
    background: var(--accent); border-color: var(--accent); color: #fff;
  }
  .btn.primary:hover { filter: brightness(1.08); }
  .btn.danger { color: color-mix(in srgb, var(--red) 75%, var(--text-dim)); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
  .btn.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
  .btn.danger:active { color: #fff; background: var(--red); border-color: var(--red); }
  .tp-menu { position: relative; }
  .tp-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 190px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); padding: 6px; display: none;
  }
  .tp-menu.open .tp-menu-panel { display: block; }
  .trip-planner-app .tp-menu-panel button {
    display: block; width: 100%; text-align: left; background: none; border: 0;
    padding: 8px 10px; border-radius: 8px; color: var(--text);
  }
  .trip-planner-app .tp-menu-panel button:hover,
  .trip-planner-app .tp-menu-panel button:focus { background: var(--accent-soft); color: var(--text); }
  .tp-menu-panel .sep { height: 1px; background: var(--border-soft); margin: 5px 4px; }
  .tp-menu-build { padding: 6px 10px 2px; font-size: 10.5px; color: var(--text-faint); text-align: right; user-select: none; }
  .trip-planner-app .tp-menu-panel button.danger { color: var(--red); }

  /* interaction-state contract: dim/faint foregrounds are reserved for
     genuinely disabled controls; enabled ones always read light */
  .trip-planner-app button:disabled,
  .trip-planner-app select:disabled,
  .trip-planner-app input:disabled {
    color: var(--text-faint); opacity: 0.55; cursor: not-allowed;
  }
  .trip-planner-app button:focus-visible,
  .trip-planner-app select:focus-visible,
  .trip-planner-app input:focus-visible,
  .trip-planner-app textarea:focus-visible,
  .trip-planner-app a.btn:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
  }

  /* ---------- summary ---------- */
  .summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
  .chip {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 9px 14px; min-width: 118px;
  }
  .chip .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-faint); }
  .chip .v { font-size: 16px; font-weight: 700; margin-top: 1px; white-space: nowrap; }
  .chip .v small { font-weight: 500; color: var(--text-dim); font-size: 12px; }
  .chip.warn-chip .v { color: var(--amber); }
  .chip.ok-chip .v { color: var(--green); }

  /* ---------- toolbar ----------
     One anchored card strip, controls clustered by purpose:
     [primary] | [trip tools] | [history] | [view]  ......  [search + filters]
     Hairline separators between action groups; the find/filter cluster is
     pushed to the far edge; controls sit on the recessed surface color so
     nothing reads as floating. */
  .toolbar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px;
    background: var(--bg-card); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: 10px;
  }
  .tb-group { display: flex; align-items: center; gap: 6px; }
  .tb-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--border-soft); flex: none; }
  /* second tier: full-width find/filter row under a hairline; deliberate
     two-row layout beats width-dependent wrapping at every viewport */
  .tb-filters {
    flex: 1 1 100%; justify-content: flex-end;
    border-top: 1px solid var(--border-soft); padding-top: 10px; margin-top: 2px;
  }
  .tb-pair { display: inline-flex; }
  .tb-pair .icon-btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
  .tb-pair .icon-btn + .icon-btn { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
  .toolbar .btn, .toolbar .icon-btn { background: var(--bg-soft); }
  .toolbar .btn.primary { background: var(--accent); }
  .toolbar input[type="search"], .toolbar select {
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 12px;
  }
  .toolbar input[type="search"] { min-width: 140px; flex: 1 1 auto; max-width: 460px; margin-right: auto; }
  .toolbar input[type="search"]::placeholder { color: var(--text-faint); }
  .toolbar .view-switch { background: var(--bg-soft); }

  /* ---------- issues ---------- */
  .issues { margin: 0 0 14px; }
  .issues details {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius);
    overflow: hidden;
  }
  .issues summary {
    cursor: pointer; list-style: none; padding: 11px 16px; font-weight: 600;
    display: flex; align-items: center; gap: 10px; user-select: none;
  }
  .issues summary::-webkit-details-marker { display: none; }
  .issues .count-err { color: var(--red); }
  .issues .count-warn { color: var(--amber); }
  .issues ul { margin: 0; padding: 4px 16px 12px; list-style: none; }
  .issues li { padding: 6px 0; border-top: 1px solid var(--border-soft); display: flex; gap: 10px; align-items: baseline; }
  .issues li .tag { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; flex: none; }
  .issues li .tag.err { background: var(--red-soft); color: var(--red); }
  .issues li .tag.warn { background: var(--amber-soft); color: var(--amber); }
  .issues li a { color: var(--accent); cursor: pointer; text-decoration: none; }
  .issues li a:hover { text-decoration: underline; }

  /* ---------- timeline ---------- */
  .board { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
  .thead, .tp-row {
    display: grid;
    grid-template-columns: 150px 52px 118px minmax(220px, 2fr) 128px 150px 152px;
    gap: 12px; align-items: center; padding: 12px 18px;
  }
  .thead {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-faint);
    border-bottom: 1px solid var(--border); padding-top: 14px; padding-bottom: 10px;
    position: sticky; top: 0; background: var(--bg-card); z-index: 5;
  }
  .tp-row { border-bottom: 1px solid var(--border-soft); position: relative; transition: background .15s; }
  .tp-row:last-child { border-bottom: 0; }
  .tp-row:hover { background: var(--bg-raised); }
  .tp-row.flash { animation: flash 1.6s ease-out; }
  @keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
  .tp-row.has-err { box-shadow: inset 3px 0 0 var(--red); }
  .tp-row.has-warn { box-shadow: inset 3px 0 0 var(--amber); }
  .tp-row.is-cancelled .c-title, .tp-row.is-cancelled .c-details, .tp-row.is-cancelled .c-cost { opacity: 0.45; text-decoration: line-through; }
  .c-dates { font-weight: 700; font-size: 14px; }
  .c-dates .time { display: block; font-weight: 500; color: var(--text-faint); font-size: 12px; }
  .c-nights { color: var(--text-dim); text-align: center; font-variant-numeric: tabular-nums; }
  .type-pill {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; background: var(--gray-soft); color: var(--text-dim);
    white-space: nowrap;
  }
  .type-flight { background: var(--accent-soft); color: var(--accent); }
  .type-stay { background: var(--purple-soft); color: var(--purple); }
  .type-transport { background: rgba(66, 190, 224, 0.14); color: #46b9d8; }
  .type-activity { background: var(--green-soft); color: var(--green); }
  .c-title { font-weight: 600; }
  .c-title .loc { color: var(--text-dim); font-weight: 500; }
  .c-details { color: var(--text-dim); font-size: 13.5px; overflow-wrap: anywhere; }
  .c-details a { color: var(--accent); }
  select.status-sel {
    appearance: none; border: 0; border-radius: 999px; font-size: 12.5px; font-weight: 700;
    padding: 5px 24px 5px 12px; cursor: pointer; width: max-content; max-width: 100%;
    background-repeat: no-repeat; background-position: right 9px center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' stroke='currentColor' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  }
  .st-booked { background: var(--green-soft); color: var(--green); }
  .st-to-book { background: var(--amber-soft); color: var(--amber); }
  .st-decide { background: var(--purple-soft); color: var(--purple); }
  .st-cancelled { background: var(--gray-soft); color: var(--text-faint); }
  /* generous gap between the price (primary) and the row actions
     (secondary) so the shift arrows never read as attached to the cost;
     the matching header cell gets the same padding to stay aligned */
  .c-cost { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; padding-right: 20px; }
  .thead > div:nth-last-child(2) { padding-right: 20px; }
  .c-cost .per-night { display: block; font-weight: 500; font-size: 12px; color: var(--text-dim); }
  .c-cost .note { display: block; font-weight: 600; font-size: 12.5px; color: var(--text-dim); }
  .c-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .12s; }
  .tp-row:hover .c-actions, .tp-row:focus-within .c-actions { opacity: 1; }
  .row-btn {
    background: none; border: 1px solid transparent; border-radius: 8px; padding: 5px 7px;
    color: var(--text-dim); line-height: 1; font-size: 14px;
  }
  .row-btn:hover { color: var(--text); border-color: var(--border); background: var(--bg-soft); }
  .row-btn.danger { color: color-mix(in srgb, var(--red) 72%, var(--text-faint)); }
  .row-btn.danger:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }
  .row-btn.danger:active { color: #fff; background: var(--red); border-color: var(--red); }
  .gap-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 18px;
    background: var(--amber-soft); color: var(--amber); font-size: 13px; font-weight: 600;
    border-bottom: 1px solid var(--border-soft);
  }
  .day-sep {
    padding: 5px 18px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
    color: var(--text-faint); background: var(--bg-soft); border-bottom: 1px solid var(--border-soft);
  }
  .totals {
    display: flex; justify-content: flex-end; gap: 34px; padding: 15px 18px;
    border-top: 1px solid var(--border); background: var(--bg-soft); flex-wrap: wrap;
  }
  .totals .t { text-align: right; }
  .totals .t .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-faint); }
  .totals .t .v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .totals .t.confirmed .v { color: var(--green); }
  .totals .t.currency-pick { margin-right: auto; text-align: left; }
  .currency-sel {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 4px 10px; font-size: 13px; font-weight: 600; margin-top: 2px;
  }
  .cost-input-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
  .cost-prefix {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-dim); font-weight: 600; font-size: 14px; pointer-events: none;
  }
  .cost-input-wrap input { padding-left: 34px; }
  .cost-row { display: flex; gap: 8px; align-items: stretch; }
  .field .cost-cur-sel { width: auto; flex: none; min-width: 108px; font-weight: 600; }
  /* per-item converted cost hint next to the entered foreign amount */
  .c-cost .conv { display: block; font-weight: 500; font-size: 12px; color: var(--text-dim); }
  .c-cost .conv-off { color: var(--amber); }
  .c-meta-mobile .conv { color: var(--text-dim); font-weight: 500; }
  .totals-note { padding: 8px 18px; background: var(--bg-soft); color: var(--text-dim); font-size: 12.5px; border-top: 1px solid var(--border-soft); }

  /* ---------- trip-in-progress dimming (distinct from cancelled: no strike) ---------- */
  .tp-row.is-past .c-dates, .tp-row.is-past .c-nights, .tp-row.is-past .c-type,
  .tp-row.is-past .c-title, .tp-row.is-past .c-details, .tp-row.is-past .c-status,
  .tp-row.is-past .c-cost, .tp-row.is-past .c-meta-mobile { opacity: 0.55; }

  /* ---------- shared (read-only) view ---------- */
  .shared-banner {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 12px;
    padding: 12px 16px; margin: 0 0 14px; color: var(--text);
  }
  .shared-banner .sb-text { font-weight: 700; }
  .shared-banner .sb-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
  body.tp-shared #addBtn,
  body.tp-shared #shiftTripBtn,
  body.tp-shared #assistBtn,
  body.tp-shared .tb-pair,
  body.tp-shared .c-actions,
  body.tp-shared .leg-row { display: none !important; }
  body.tp-shared #tripSelect { pointer-events: none; opacity: 0.7; }
  body.tp-shared [data-act="ask-day"] { display: none !important; }

  /* ---------- visa modal ---------- */
  .visa-results { max-height: 46vh; overflow-y: auto; margin: 4px 0 12px; color: var(--text-dim); }
  .visa-row { display: flex; align-items: center; gap: 11px; padding: 10px 2px; border-top: 1px solid var(--border-soft); }
  .visa-row:first-child { border-top: 0; }
  .visa-flag { font-size: 20px; flex: none; }
  .visa-name { font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
  .visa-name small { display: block; font-weight: 500; color: var(--text-faint); font-size: 11.5px; }
  .visa-pill { padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
  .vp-free { background: var(--green-soft); color: var(--green); }
  .vp-arrival { background: var(--amber-soft); color: var(--amber); }
  .vp-evisa { background: var(--accent-soft); color: var(--accent); }
  .vp-required { background: var(--red-soft); color: var(--red); }
  .vp-home, .vp-unknown { background: var(--gray-soft); color: var(--text-dim); }
  .visa-verify { font-size: 12.5px; color: var(--accent); text-decoration: none; flex: none; }
  .visa-verify:hover { text-decoration: underline; }
  .rates-retry { padding: 2px 10px; font-size: 12px; margin-left: 8px; border-radius: 8px; }
  .visa-add { margin: 0 0 12px; }
  .visa-add select {
    width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 12px; color: var(--text-dim);
  }
  .visa-remove {
    background: none; border: 1px solid transparent; border-radius: 8px;
    padding: 3px 8px; font-size: 13px; line-height: 1; flex: none;
  }
  .visa-remove:hover { border-color: var(--red); }
  .trip-planner-app .visa-remove { color: var(--text-faint) !important; }
  .trip-planner-app .visa-remove:hover { color: var(--red) !important; }
  .visa-remind {
    flex: none; white-space: nowrap; border: 1px solid var(--border); border-radius: 8px;
    padding: 4px 9px; font-size: 12.5px; font-weight: 600;
  }
  .visa-remind:hover { border-color: var(--accent); background: var(--accent-soft); }
  .visa-count { color: var(--accent); font-weight: 800; }

  /* ---------- empty state ---------- */
  .empty { text-align: center; padding: 70px 20px; }
  .empty .big { font-size: 44px; }
  .empty h2 { margin: 10px 0 6px; }
  .empty p { color: var(--text-dim); margin: 0 0 22px; }
  .empty .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

  /* ---------- modal ---------- */
  .overlay {
    position: fixed; inset: 0; background: rgba(5, 8, 14, 0.62); z-index: 90;
    display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px;
    overflow-y: auto; backdrop-filter: blur(3px);
  }
  .overlay.open { display: flex; }
  body.tp-modal-open { overflow: hidden; }
  .modal:focus { outline: none; }
  .modal {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: var(--shadow); width: 560px; max-width: 100%; padding: 22px 24px 20px;
    animation: pop .16s ease-out;
  }
  .modal.small { width: 420px; }
  @keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
  .modal h2 { margin: 0 0 16px; font-size: 18px; }
  .field { margin-bottom: 13px; }
  .field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
  .field label small { color: var(--text-dim); }
  .trip-planner-app ::placeholder { color: var(--text-faint); opacity: 1; }
  .field input, .field select, .field textarea {
    width: 100%; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
    padding: 9px 12px; outline: none; transition: border-color .15s;
  }
  .field textarea { resize: vertical; min-height: 60px; }
  .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
  .field.invalid input, .field.invalid select { border-color: var(--red); }
  .field .err { display: none; color: var(--red); font-size: 12.5px; margin-top: 4px; }
  .field.invalid .err { display: block; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  .type-picker { display: flex; gap: 6px; flex-wrap: wrap; }
  .type-picker button {
    border: 1px solid var(--border); background: var(--bg-soft); border-radius: 999px;
    padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--text);
  }
  .trip-planner-app .type-picker button.on,
  .trip-planner-app .type-picker button.on:hover,
  .trip-planner-app .type-picker button.on:focus { border-color: var(--accent); color: #fff; background: var(--accent); }
  .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
  .modal-foot .left { margin-right: auto; }
  .radio-row { display: flex; flex-direction: column; gap: 8px; }
  .radio-row label { display: flex; gap: 9px; align-items: center; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; }
  .radio-row input { width: auto; }
  .stepper { display: flex; align-items: center; gap: 8px; }
  .stepper input { width: 90px; text-align: center; }
  .hint { font-size: 12.5px; color: var(--text-dim); margin-top: 5px; }

  /* ---------- toast ---------- */
  .toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
  .toast {
    background: var(--bg-raised); border: 1px solid var(--border); color: var(--text);
    border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow); font-weight: 600;
    display: flex; gap: 12px; align-items: center; animation: pop .18s ease-out;
  }
  .toast button { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 0; }


  /* ---------- main.css !important counter-pins ----------
     main.css paints ALL buttons `color: #555 !important`, red text on
     hover, and a translucent red flash on press (the sitewide
     "gray buttons, red hovers" trap). Those beat any specificity, so the
     app pins its own button colors with !important; among !important
     rules normal cascade applies, so the specific variants below the
     base win as usual. */
  .trip-planner-app button,
  .trip-planner-app a.btn { color: var(--text) !important; }
  .trip-planner-app button:hover,
  .trip-planner-app a.btn:hover { color: var(--text) !important; }
  .trip-planner-app .row-btn { color: var(--text-dim) !important; }
  .trip-planner-app .row-btn:hover { color: var(--text) !important; }
  .trip-planner-app .row-btn.danger { color: color-mix(in srgb, var(--red) 72%, var(--text-faint)) !important; }
  .trip-planner-app .row-btn.danger:hover { color: var(--red) !important; }
  .trip-planner-app .row-btn.danger:active { color: #fff !important; }
  .trip-planner-app .btn.danger { color: color-mix(in srgb, var(--red) 75%, var(--text-dim)) !important; }
  .trip-planner-app .btn.danger:hover { color: var(--red) !important; }
  .trip-planner-app .btn.danger:active { color: #fff !important; }
  .trip-planner-app .btn.primary,
  .trip-planner-app .btn.primary:hover,
  .trip-planner-app .btn.primary:active { color: #fff !important; }
  .trip-planner-app .view-switch button.on,
  .trip-planner-app .view-switch button.on:hover,
  .trip-planner-app .view-switch button.on:focus,
  .trip-planner-app .view-switch button.on:active { color: #fff !important; }
  .trip-planner-app .type-picker button.on,
  .trip-planner-app .type-picker button.on:hover,
  .trip-planner-app .type-picker button.on:focus { color: #fff !important; }
  .trip-planner-app .tp-menu-panel button.danger { color: var(--red) !important; }
  .trip-planner-app .leg-btn:hover { color: var(--accent) !important; }
  .trip-planner-app .icon-btn:hover { color: var(--text) !important; }
  .trip-planner-app .visa-remind { color: var(--accent) !important; }
  .trip-planner-app .visa-remind:hover { color: var(--accent) !important; }
  .trip-planner-app .doc-remove { color: var(--text-faint) !important; }
  .trip-planner-app .doc-remove:hover { color: var(--red) !important; }
  .trip-planner-app .rates-retry,
  .trip-planner-app .rates-retry:hover { color: var(--accent) !important; }
  .trip-planner-app .toast button,
  .trip-planner-app .toast button:hover { color: var(--accent) !important; }
  /* assistant: accept stays white-on-green, reject reads neutral then red on
     hover, maps links read as links (main.css would gray them all) */
  .trip-planner-app [data-act="accept-proposal"] {
    color: #fff !important; background: var(--green); border-color: var(--green);
  }
  .trip-planner-app [data-act="accept-proposal"]:hover { color: #fff !important; filter: brightness(1.08); }
  .trip-planner-app [data-act="reject-proposal"] { color: var(--text-dim) !important; }
  .trip-planner-app [data-act="reject-proposal"]:hover { color: var(--red) !important; border-color: var(--red); background: var(--red-soft); }
  .trip-planner-app .assist-maps-link,
  .trip-planner-app .assist-key-link,
  .trip-planner-app .assist-quick-links a { color: var(--accent) !important; }
  .trip-planner-app button:disabled { color: var(--text-faint) !important; }
  /* main.css also flashes rgba-red backgrounds on :hover:active */
  .trip-planner-app button:hover:active { background-color: transparent; }
  .trip-planner-app .btn:hover:active { background-color: var(--bg-card); }
  .trip-planner-app .btn.primary:hover:active { background-color: var(--accent); }
  .trip-planner-app .btn.danger:hover:active,
  .trip-planner-app .row-btn.danger:hover:active { background-color: var(--red); }
  .trip-planner-app [data-act="accept-proposal"]:hover:active { background-color: var(--green); }
  .trip-planner-app [data-act="reject-proposal"]:hover:active { background-color: var(--red-soft); }
  .trip-planner-app .tp-menu-panel button:hover:active { background-color: var(--accent-soft); }
  .trip-planner-app .view-switch button.on:hover:active,
  .trip-planner-app .type-picker button.on:hover:active { background-color: var(--accent); }
  /* ...and a 1px red inset ring on every button hover, a red hover
     background on .primary buttons, and a red focus ring on text fields
     (none of those are !important, so specificity pins suffice) */
  .trip-planner-app button:hover { box-shadow: none; }
  .trip-planner-app .btn.primary:hover { background-color: var(--accent); }
  .trip-planner-app input:focus,
  .trip-planner-app select:focus,
  .trip-planner-app textarea:focus { box-shadow: none; }

  /* ---------- view switch ---------- */
  .view-switch {
    display: inline-flex; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 3px; gap: 2px;
  }
  .view-switch button {
    border: 0; background: none; border-radius: 8px; padding: 6px 14px; font-weight: 600;
    color: var(--text);
  }
  .view-switch button:hover { color: var(--text); background: var(--accent-soft); }
  /* the active tab stays white-on-blue in EVERY state */
  .trip-planner-app .view-switch button.on,
  .trip-planner-app .view-switch button.on:hover,
  .trip-planner-app .view-switch button.on:focus,
  .trip-planner-app .view-switch button.on:active { background: var(--accent); color: #fff; }

  /* ---------- night coverage strip ---------- */
  .strip-box {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 12px 16px 10px; margin: 0 0 14px;
  }
  .strip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
  .strip-head .t { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-faint); font-weight: 700; }
  .strip-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-dim); }
  .strip-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
  .strip { display: flex; gap: 2px; }
  .strip .cell { flex: 1; min-width: 3px; height: 16px; border-radius: 3px; cursor: pointer; transition: transform .1s; }
  .strip .cell:hover { transform: scaleY(1.35); }
  .cell.cv-booked { background: var(--green); }
  .cell.cv-decide { background: var(--purple); }
  .cell.cv-to-book { background: var(--amber); }
  .cell.cv-transit { background: var(--accent); }
  .cell.cv-gap { background: repeating-linear-gradient(45deg, var(--red) 0 4px, transparent 4px 8px); border: 1px solid var(--red); }
  .cell.cv-none { background: var(--bg-raised); }
  .strip-dates { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); margin-top: 6px; }

  /* ---------- route legs ---------- */
  .leg-row { display: flex; justify-content: center; padding: 4px 18px; border-bottom: 1px solid var(--border-soft); background: var(--bg-soft); }
  .leg-btn {
    border: 1px dashed var(--border); background: none; border-radius: 999px;
    padding: 4px 14px; font-size: 12.5px; font-weight: 600; color: var(--text);
  }
  .leg-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
  .route-io { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
  .route-io .field { margin-bottom: 8px; }
  .route-swap { align-self: end; margin-bottom: 13px; font-size: 15px; }
  .route-result {
    background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 13px 15px; margin: 4px 0 12px; font-size: 14px; color: var(--text-dim); min-height: 46px;
  }
  .route-result b { color: var(--text); }
  .route-result.err { border-color: var(--red); background: var(--red-soft); color: var(--text); }
  .route-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 9px; }
  .route-head .arrow { color: var(--text-faint); font-weight: 400; }
  .route-head small { font-weight: 500; color: var(--text-faint); font-size: 12px; }
  .route-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 11px; }
  .route-pills .rp {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 999px;
    padding: 3px 11px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); white-space: nowrap;
  }
  .route-pills .rp.intl { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
  .mode-row { display: flex; gap: 11px; padding: 8px 0; border-top: 1px solid var(--border-soft); align-items: baseline; }
  .mode-row .mi { font-size: 17px; flex: none; width: 24px; text-align: center; }
  .mode-row b { color: var(--text); }
  .mode-row .dur { color: var(--accent); font-weight: 700; white-space: nowrap; }
  .mode-row small { display: block; color: var(--text-faint); margin-top: 1px; }
  .route-note { border-top: 1px solid var(--border-soft); padding-top: 9px; font-size: 12px; color: var(--text-faint); }
  .route-loading { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
  .spinner {
    width: 16px; height: 16px; border-radius: 50%; flex: none;
    border: 2px solid var(--border); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .route-links { display: flex; gap: 8px; flex-wrap: wrap; }
  .route-links a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }

  /* ---------- map ---------- */
  .map-box { display: none; }
  .map-box.on { display: block; }
  #mapCanvas {
    height: 540px; border-radius: var(--radius); border: 1px solid var(--border-soft);
    background: var(--bg-card); z-index: 1;
  }
  .map-status { color: var(--text-dim); font-size: 13px; padding: 9px 4px; min-height: 34px; }
  body.tp-page:not(.tp-light) #mapCanvas .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.6); }
  body.tp-page:not(.tp-light) #mapCanvas { background: #1a1f29; }
  .stop-pin {
    background: var(--accent); color: #fff; border-radius: 50%; width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
    border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  }
  .leaflet-popup-content { font: 13px/1.5 "Segoe UI", system-ui, sans-serif; }

  /* ---------- days view ---------- */
  .days-box { display: none; }
  .days-box.on { display: block; }
  .days-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
  .day-card {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 13px 15px; display: flex; flex-direction: column; gap: 8px;
  }
  .day-card.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  .dc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .dc-day { font-weight: 700; color: var(--text); }
  .dc-day small { font-weight: 500; color: var(--text-faint); }
  .dc-date { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
  .dc-weather { font-size: 12.5px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 5px 9px; }
  .dc-body { display: flex; flex-direction: column; gap: 6px; }
  .dc-event { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
  .dc-event .dc-ico { flex: none; font-size: 15px; }
  .dc-event .dc-label { flex: 1; color: var(--text); min-width: 0; }
  .dc-event .dc-label b { font-weight: 700; }
  .dc-event .dc-label .loc { color: var(--text-dim); font-weight: 400; }
  .dc-event .dc-time { flex: none; color: var(--text-dim); font-size: 12.5px; white-space: nowrap; }
  .dc-event.is-cancelled .dc-label { opacity: 0.5; text-decoration: line-through; }
  .dc-clip { margin-left: 4px; }
  .dc-staying { font-size: 14px; color: var(--text-dim); }
  .dc-empty { font-size: 13.5px; color: var(--text-faint); font-style: italic; }
  .tp-clip { color: var(--text-dim); font-size: 13px; }

  /* ---------- documents pocket ---------- */
  .docs-hint { font-size: 13px; color: var(--text-dim); }
  .docs-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 6px; }
  .docs-list:empty { margin: 0; }
  .doc-thumb {
    position: relative; width: 84px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  }
  .doc-preview {
    width: 64px; height: 64px; border-radius: 8px; border: 1px solid var(--border-soft);
    background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden;
  }
  .doc-preview img { width: 100%; height: 100%; object-fit: cover; }
  .doc-preview .doc-file { font-size: 28px; }
  .doc-name { font-size: 11px; color: var(--text-dim); max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .doc-remove {
    position: absolute; top: -6px; right: 2px; width: 20px; height: 20px; line-height: 1; padding: 0;
    border: 1px solid var(--border); background: var(--bg-card); border-radius: 50%; font-size: 12px;
  }
  .docs-err { color: var(--red); font-size: 12.5px; margin: 2px 0 6px; }

  /* ---------- error card ---------- */
  .error-card { padding: 40px 24px; text-align: center; }
  .error-card h2 { color: var(--red); margin: 0 0 8px; }
  .error-card p { color: var(--text-dim); margin: 0 0 18px; overflow-wrap: anywhere; }

  /* ---------- AI assistant panel ----------
     Fixed side panel (desktop) / full-screen sheet (mobile). Sits ABOVE the
     board but BELOW the .overlay modals (z-index 90) so a modal opened from
     the panel still covers it. */
  .tp-assist-panel {
    position: fixed; top: 0; right: 0; height: 100%; width: 420px; max-width: 100%;
    z-index: 80; background: var(--bg-card); border-left: 1px solid var(--border);
    box-shadow: -14px 0 40px rgba(0, 0, 0, 0.4);
    display: flex; flex-direction: column;
    /* the shared site header is fixed at z-index 10001; pad the panel down so
       its own head (title + close) is never buried under it */
    padding-top: 3.25rem;
  }
  .tp-assist-panel[hidden] { display: none; }
  .tp-assist-head {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft); flex: none;
  }
  .tp-assist-head h2 { margin: 0; font-size: 17px; margin-right: auto; }
  .tp-assist-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
  .assist-honesty {
    background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--border));
    border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--text-dim); line-height: 1.45;
  }
  .assist-focus-chip[hidden] { display: none; }
  .assist-focus-chip {
    display: flex; align-items: center; gap: 8px; background: var(--accent-soft);
    border: 1px solid var(--accent); border-radius: 999px; padding: 5px 6px 5px 13px;
    font-size: 13px; font-weight: 600; color: var(--text); align-self: flex-start;
  }
  .assist-focus-chip .chip-x {
    background: none; border: 0; padding: 2px 6px; line-height: 1; font-size: 13px; border-radius: 999px;
  }
  .tier-group { display: flex; flex-direction: column; gap: 8px; }
  .tier-card {
    display: flex; flex-direction: column; gap: 4px; padding: 11px 13px 11px 34px; position: relative;
    border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft); cursor: pointer;
  }
  .tier-card.on { border-color: var(--accent); background: var(--accent-soft); }
  .tier-card input { position: absolute; left: 12px; top: 13px; width: auto; margin: 0; }
  .tier-label { font-weight: 700; font-size: 14px; color: var(--text); }
  .tier-privacy { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
  .tier-body { display: flex; flex-direction: column; gap: 10px; }
  .assist-field { margin-bottom: 0; }
  .assist-field textarea { min-height: 66px; }
  .assist-quick-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
  .assist-quick-links .aql-label { color: var(--text-faint); }
  .assist-quick-links a { color: var(--accent); text-decoration: none; font-weight: 600; }
  .assist-quick-links a:hover { text-decoration: underline; }
  .assist-messages { display: flex; flex-direction: column; gap: 12px; }
  .assist-msg {
    border-radius: 12px; padding: 10px 13px; font-size: 13.5px; line-height: 1.5;
    white-space: pre-wrap; overflow-wrap: anywhere;
  }
  .assist-msg.assistant { background: var(--bg-soft); border: 1px solid var(--border-soft); color: var(--text); }
  .assist-msg.user { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--text); align-self: flex-end; max-width: 88%; }
  .assist-error {
    background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 45%, var(--border));
    color: var(--text); border-radius: 12px; padding: 10px 13px; font-size: 13px; line-height: 1.5;
  }
  /* typing indicator: three pulsing dots in an assistant-style bubble */
  .assist-typing { display: inline-flex; gap: 5px; align-items: center; align-self: flex-start; }
  .assist-typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint);
    animation: assistBlink 1.2s infinite ease-in-out both;
  }
  .assist-typing span:nth-child(2) { animation-delay: 0.15s; }
  .assist-typing span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes assistBlink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
  /* Tier 2 (bring your own key) fields */
  .assist-byok { display: flex; flex-direction: column; gap: 10px; }
  .assist-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .assist-byok .field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
  .assist-byok select, .assist-byok input[type="password"] { width: 100%; }
  .assist-key-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .assist-key-link { font-size: 12.5px; text-decoration: none; margin-left: auto; }
  .assist-key-link:hover { text-decoration: underline; }
  .assist-key-note { font-size: 12px; color: var(--text-faint); }
  .assist-site-note {
    background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 11px 13px; font-size: 12.5px; color: var(--text-dim); line-height: 1.45;
  }
  /* shared chat composer (Tiers 2 and 3) */
  .assist-composer[hidden] { display: none; }
  .assist-composer { display: flex; flex-direction: column; gap: 8px; }
  .assist-composer textarea {
    width: 100%; min-height: 52px; resize: vertical; border-radius: 12px;
    padding: 10px 12px; font: inherit; font-size: 13.5px; line-height: 1.45;
    background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  }
  .assist-composer textarea:focus { outline: none; border-color: var(--accent); }
  .assist-composer-row { display: flex; align-items: center; gap: 8px; }
  .assist-composer-row .assist-clear { margin-right: auto; }
  .assist-composer-row #assistSend { min-width: 92px; }
  .assist-proposals { display: flex; flex-direction: column; gap: 10px; }
  .assist-proposal {
    border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px;
    background: var(--bg-raised); display: flex; flex-direction: column; gap: 4px;
  }
  .assist-proposal.invalid { border-color: color-mix(in srgb, var(--amber) 50%, var(--border)); background: var(--amber-soft); }
  .assist-proposal.done { border-color: var(--green); background: var(--green-soft); }
  .assist-proposal.stale { border-color: var(--border); background: var(--bg-soft); }
  .ap-op { font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-faint); font-weight: 700; }
  .ap-title { font-weight: 700; font-size: 14.5px; color: var(--text); }
  .ap-meta, .ap-cost { font-size: 12.5px; color: var(--text-dim); }
  .ap-cost { font-weight: 700; }
  .assist-maps-link { font-size: 12.5px; color: var(--accent); text-decoration: none; align-self: flex-start; }
  .assist-maps-link:hover { text-decoration: underline; }
  .ap-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
  .assist-proposal .assist-accept { padding: 6px 14px; font-size: 13px; }
  .ap-reason { font-size: 13px; color: var(--text); }
  .ap-done { font-weight: 700; color: var(--green); font-size: 13.5px; }

  /* ---------- responsive ---------- */
  @media (max-width: 900px) {
    .tp-assist-panel { inset: 0; width: 100%; border-left: 0; }
    .thead { display: none; }
    .tp-row {
      grid-template-columns: 1fr auto;
      grid-template-areas: "dates status" "title title" "details details" "meta meta" "actions actions";
      gap: 6px 10px; padding: 14px 16px;
    }
    .c-dates { grid-area: dates; }
    .c-status { grid-area: status; justify-self: end; }
    .c-title { grid-area: title; font-size: 15.5px; }
    .c-details { grid-area: details; }
    .c-meta-mobile { grid-area: meta; display: flex !important; gap: 10px; align-items: center; flex-wrap: wrap; }
    .c-nights, .c-type, .c-cost { display: none; }
    .c-actions { grid-area: actions; opacity: 1; justify-content: flex-start; padding-top: 4px; }
    .row-btn { border-color: var(--border); padding: 7px 11px; }
    .totals { justify-content: space-between; gap: 16px; }
    .tb-sep { display: none; }
    .tb-filters { flex-wrap: wrap; }
    .tb-filters input[type="search"] { width: 100%; flex: 1 1 100%; min-width: 0; max-width: none; margin-right: 0; }
    .tb-filters select { flex: 1 1 0; }
    .grid3 { grid-template-columns: 1fr; }
  }
  .c-meta-mobile { display: none; }
  .c-meta-mobile .cost-m { font-weight: 700; }
  .c-meta-mobile .cost-m small { color: var(--text-dim); font-weight: 500; }
  .c-meta-mobile .per-night { display: inline; font-weight: 500; color: var(--text-dim); font-size: 12.5px; }
  .c-meta-mobile .per-night::before { content: " · "; }

  @media print {
    .toolbar, .c-actions, .tp-head .trip-bar, .issues, .empty .actions, .toasts { display: none !important; }
    body.tp-page { background: #fff; }
    .trip-planner-app { color: #000; }
    .board { border-color: #bbb; }
    .day-card { break-inside: avoid; }
    /* Days view: print only the day cards, not the (hidden) timeline/strip. */
    body.view-days .board, body.view-days .strip-box, body.view-days .summary { display: none !important; }
    body.view-days .days-box { display: block !important; }
  }
