:root {
  /* "Pinboard": white, editorial serif headings, cards pinned to a board; the chat helps from the side. */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f3f0;
  --text: #161616;
  --muted: #6b6b6b;
  --border: #ececec;
  --ink: #161616;          /* black buttons, your messages' text, the current step */
  --ink-text: #ffffff;
  --accent: #3f5e4a;       /* pins, the planner's dot, small highlights */
  --accent-ink: #ffffff;
  --accent-soft: #e9efe9;
  --ok: #2f5d3e;
  --ok-soft: #e6f0e8;
  --user-bubble: #f1f0ec;
  --user-ink: #161616;
  --warn: #8a4b00;
  --warn-soft: #fff4e2;
  --error: #b42318;
  --radius: 18px;
  --shadow: 0 10px 30px rgb(22 22 22 / 6%);
  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1a1a1a;
    --surface-2: #242424;
    --text: #f2f2f0;
    --muted: #a3a3a0;
    --border: #2c2c2c;
    --ink: #f2f2f0;
    --ink-text: #121212;
    --accent: #8fb79b;
    --accent-ink: #0f1a12;
    --accent-soft: #1f2a22;
    --ok: #8fd1a4;
    --ok-soft: #16271b;
    --user-bubble: #262624;
    --user-ink: #f2f2f0;
    --warn: #f0b45a;
    --warn-soft: #33270f;
    --error: #ff8a80;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  display: flex;
  flex-direction: column;
}
h2 { font-size: 1.1rem; margin: 0; font-weight: 700; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; justify-content: flex-end; }
/* The trip you're in stays readable at every width (it used to shrink to a bare arrow). */
#tripSelect {
  flex: 0 1 340px; min-width: 120px; min-height: 40px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-weight: 600;
}

.btn {
  font: inherit; border-radius: 10px; padding: 8px 16px; min-height: 40px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--text); font-weight: 600; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.icon-btn svg { flex: none; }
.btn-small { padding: 5px 12px; min-height: 36px; font-size: 14px; }

.tabs { display: none; }

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 400px; min-height: 0; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 20px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: min(640px, 88%); padding: 11px 16px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.assistant { background: transparent; padding-left: 2px; align-self: flex-start; }
.msg.user { background: var(--user-bubble); color: var(--user-ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.error { background: transparent; border: 1px dashed var(--error); color: var(--error); align-self: flex-start; }
.typing { align-self: flex-start; color: var(--muted); padding: 4px 6px; }
.typing span { animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; max-width: 760px; width: 100%; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.card h3 { margin: 0; font-size: 1rem; }
.card .dates { color: var(--muted); font-size: 13px; }
.card p { margin: 0; font-size: 14px; }
.card .tag { font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.card .tag.special { background: var(--accent-soft); }
.card .source { font-size: 12px; color: var(--muted); }
.card .source a { color: inherit; }
.card .btn { align-self: flex-start; margin-top: 4px; }

.proposal { max-width: 520px; background: var(--warn-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.proposal .text { flex: 1 1 220px; font-size: 14px; }
.proposal .actions { display: flex; gap: 6px; }
.proposal.done { opacity: .7; }

.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.chip { font: inherit; font-size: 14px; font-weight: 600; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--text); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

.composer { display: flex; gap: 8px; align-items: flex-end; margin: 4px 16px max(14px, env(safe-area-inset-bottom)); padding: 6px 6px 6px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.composer:focus-within { border-color: var(--text); }
.composer textarea {
  flex: 1; resize: none; font: inherit; padding: 9px 0; border: 0; outline: none;
  background: transparent; color: var(--text); max-height: 160px;
}
.composer .btn-primary { background: var(--ink); color: var(--ink-text); }

.trip { border-left: 1px solid var(--border); background: var(--bg); padding: 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.trip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.status { font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.missing { font-size: 14px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.missing ul { margin: 4px 0 0; padding-left: 18px; }
.missing.done { background: var(--ok-soft); color: var(--ok); }
.fields { margin: 0; display: grid; gap: 10px; }
.fields div { display: grid; gap: 2px; }
.fields dt { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.fields dd { margin: 0; }
.fields dd.empty { color: var(--muted); font-style: italic; }
.weather-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.weather-box h3 { margin: 0 0 4px; font-size: 14px; }

.research { display: flex; flex-direction: column; gap: 10px; }
.research-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.research-head h2 { font-size: 1rem; }
.research-status { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { font-size: 14px; border-radius: 10px; padding: 8px 12px; background: var(--warn-soft); }
.notice.error { color: var(--error); }
.seg { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.seg button { flex: 1; font: inherit; font-size: 14px; border: 0; padding: 6px 6px; min-height: 36px; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.ritem { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ritem h3 { margin: 0; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ritem .score { font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--accent); }
.ritem .meta { color: var(--muted); font-size: 13px; }
.ritem p { margin: 0; }
.ritem .fit { background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; }
.ritem .warn { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.ratings { display: flex; flex-wrap: wrap; gap: 4px; }
.rating { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; }
a.rating:hover { text-decoration: underline; }
.ritem details { font-size: 13px; color: var(--muted); }
.ritem summary { cursor: pointer; }
.ritem ul { margin: 4px 0 0; padding-left: 18px; }
.google { border-top: 1px dashed var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.google-head { font-size: 14px; }
.conditions { font-size: 14px; margin: 0; padding-left: 18px; }
.conditions li { margin-bottom: 4px; }
.small-source { font-size: 12px; color: var(--muted); }
.small-source a { color: inherit; }

.panel-tabs { margin-top: -4px; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel[hidden] { display: none; }
.mode-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 16px 2px; font-size: 13px; }
.mode-bar .seg { flex: 0 1 260px; }

.itinerary { gap: 12px; }
.day { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.day-head { padding: 10px 14px; background: var(--ink); color: var(--ink-text); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.day-head h3 { margin: 0; font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.day-head .label { font-size: 13px; opacity: .85; }
.day-notes { margin: 0; padding: 6px 12px 0 28px; font-size: 12px; color: var(--muted); }
.day-items { list-style: none; margin: 0; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 4px; min-height: 36px; }
.day-items.drop-target { background: var(--accent-soft); }
.day-empty { font-size: 13px; color: var(--muted); padding: 6px; }
.travel { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 0 6px 0 30px; }
.it { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 8px 6px; border-radius: 10px; background: var(--surface); border: 1px solid transparent; }
.it.dragging { opacity: .4; }
.it.drop-before { border-top: 2px solid var(--accent); }
.handle { cursor: grab; color: var(--muted); user-select: none; font-size: 14px; line-height: 1.4; touch-action: none; }
.it-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.it-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.it-time { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.it-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.it-notes { font-size: 12px; color: var(--muted); }
.it-warn { font-size: 13px; color: var(--muted); }
.it-warn.problem { padding: 4px 8px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.it-controls { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.it-controls select, .it-controls button { font: inherit; font-size: 14px; min-height: 36px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.it-controls button.remove { color: var(--error); }
.it-controls button.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; padding: 6px 14px; font-size: 14px; }
.it-controls button.btn-primary:disabled { opacity: .55; }

.flights { gap: 10px; }
.test-badge { display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); }
.fq { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.fq .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.offer { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.offer.picked { border-color: var(--accent); }
.offer-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.offer-head .price { font-family: var(--mono); font-weight: 500; font-size: 16px; white-space: nowrap; }
.offer .pp { font-size: 12px; color: var(--muted); text-align: right; }
.offer .label { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.leg { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; font-size: 13px; align-items: baseline; }
.leg .t { font-family: var(--mono); font-weight: 500; }
.leg .mid { text-align: center; color: var(--muted); font-size: 12px; }
.offer .facts { display: flex; flex-wrap: wrap; gap: 4px; }
.checkout { border: 2px solid var(--accent); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pax { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pax legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.pax label { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.pax input, .pax select, .flights input[type=text] { font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 0; }
.pax .wide { grid-column: 1 / -1; }
.confirm { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.confirm input { margin-top: 3px; }
.origin-row { display: flex; gap: 6px; }
.origin-row input { flex: 1; }

.panel-tabs button { font-size: 14px; padding: 6px 4px; }
.link-row { display: flex; flex-wrap: wrap; gap: 6px; }
.link-row a { font-size: 14px; font-weight: 600; text-decoration: none; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--text); color: var(--text); background: var(--surface); }
.link-row a:hover { border-color: var(--accent); color: var(--accent); }
.booked-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.booked-form label { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.booked-form input, .booked-form select { font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 0; }
.booked-form .wide { grid-column: 1 / -1; }

.panel-tabs { flex-wrap: wrap; }
.panel-tabs button { flex: 1 1 auto; }
.entry-ok { color: var(--ok); font-weight: 600; }
.entry-action { color: var(--warn); font-weight: 600; }
.excerpt { white-space: pre-line; font-size: 13px; max-height: 220px; overflow: auto; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.level { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); }
.level.l3, .level.l4 { background: var(--warn-soft); color: var(--warn); }
.costs { width: 100%; border-collapse: collapse; font-size: 13px; }
.costs th, .costs td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.costs .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.costs tfoot td { border-bottom: 0; font-weight: 600; }
.status-pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status-pill.booked, .status-pill.recorded { background: var(--ok-soft); color: var(--ok); }
.budget-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.budget-bar span { display: block; height: 100%; background: var(--accent); }
.budget-bar.over span { background: var(--error); }
.cost-input { width: 90px; font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.row-flex { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-flex input { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 0; }

.flex-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.flex-opt { border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.flex-opt.cheapest { border-color: var(--accent); background: var(--accent-soft); }
.flex-opt.current { outline: 2px dashed var(--muted); outline-offset: -2px; }
.flex-opt b { font-size: 13px; }
.flex-opt button { font: inherit; font-size: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: 2px 4px; cursor: pointer; }
.watch { border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.alert-item { font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--warn-soft); }
.alert-item.read { background: var(--surface-2); color: var(--muted); }

.votes { display: flex; gap: 4px; align-items: center; }
.votes button { font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.votes button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.votes .who { font-size: 12px; color: var(--muted); }
.share-row { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.share-row code { font-size: 12px; overflow-wrap: anywhere; background: var(--surface-2); padding: 4px 6px; border-radius: 6px; }
.comment { font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.comment .meta { font-size: 12px; }
.msg-author { font-size: 12px; opacity: .8; display: block; margin-bottom: 2px; }
.guest-bar { padding: 6px 16px; font-size: 13px; background: var(--accent-soft); text-align: center; }

.settings { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); padding: 20px; }
.settings::backdrop { background: rgb(0 0 0 / 40%); }
.settings label { display: grid; gap: 4px; margin: 12px 0; font-size: 14px; }
.settings input, .settings select { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.settings .hint { font-size: 12px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--ink-text); padding: 8px 14px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); }

@media (max-width: 820px) {
  .brand span, #openSettings { font-size: 14px; }
  #newTrip { padding: 6px 10px; }
  .tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); }
  .tabs button { flex: 1; font: inherit; padding: 10px; border: 0; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
  .tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); font-weight: 700; }
  .badge { display: inline-block; min-width: 8px; height: 8px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout[data-active="chat"] .trip { display: none; }
  .layout[data-active="trip"] .chat { display: none; }
  .trip { border-left: 0; }
  .msg { max-width: 92%; }
}
@media (max-width: 480px) {
  .brand { font-size: 0; gap: 0; }
  .brand img { width: 24px; height: 24px; }
  .topbar { padding-inline: 12px; gap: 8px; }
  #tripSelect { flex: 1 1 auto; }
  #newTrip { font-size: 0; padding: 0; width: 40px; }  /* icon-sized "+" on phones */
  .icon-btn { padding: 0; width: 40px; justify-content: center; }
  .icon-btn span { display: none; }  /* icons only on phones; the label stays for screen readers via aria-label */
  #newTrip::before { content: "+"; font-size: 20px; }
}

/* ---------- guided flow: step bar and step cards in the chat ---------- */
.stepbar { list-style: none; margin: 0; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface); font-family: var(--mono); font-size: 13px; }
.stepbar .step > span, .stepbar .step > button { display: inline-block; padding: 5px 12px; border-radius: 999px; border: 1px dashed var(--muted); color: var(--muted); background: transparent; font: inherit; }
.stepbar .step > button { cursor: pointer; }
.stepbar .step > button:hover { border-color: var(--accent); color: var(--accent); }
.stepbar .step.done > * { color: var(--text); border: 1px solid transparent; background: var(--surface-2); }
.stepbar .step.current > *, .stepbar .step.working > * { color: var(--ink-text); background: var(--ink); border: 1px solid var(--ink); font-weight: 500; }
.stepbar .step.failed > * { color: var(--error); border: 1px solid var(--error); }
.stepbar .skipped > * { text-decoration: line-through; }
.stepbar .sep { color: var(--muted); }
.stepbar .step-note { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 6px; }
@media (max-width: 820px) { .stepbar .sep, .stepbar .step-note { display: none; } }
.chat-card { align-self: stretch; max-width: 760px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.chat-card > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.chat-card[open] > summary { margin-bottom: 8px; }
.chat-card h2 { margin: 0; font-size: 19px; }
.chat-card > :first-child:is(h2, .research-head) { padding-bottom: 12px; border-bottom: 2px dashed var(--border); }
.draft-day .day-head { display: flex; gap: 8px; align-items: baseline; }
.draft-day h3 { margin: 0; font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.draft-day ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.draft-day li { display: grid; grid-template-columns: 52px 1fr; column-gap: 8px; }
.draft-day li > :first-child { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.draft-day li .it-warn { grid-column: 2; }
.research-status.working { align-self: flex-start; }
/* Booked flights and check-ins read like a ticket stub: tear line, mono time. */
.it.booked { border: 0; border-bottom: 2px dashed var(--border); border-radius: 0; background: transparent; }
.it.booked .it-name { font-weight: 700; }
.status-pill.booked { align-self: flex-start; }

/* One "…" per itinerary item instead of a row of small controls. */
.it-more { position: relative; }
.it-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 32px; border-radius: 8px; color: var(--muted); font-size: 18px; line-height: 1; }
.it-more > summary::-webkit-details-marker { display: none; }
.it-more > summary:hover, .it-more[open] > summary { background: var(--surface-2); color: var(--text); }
.it-more[open] .it-controls { margin-top: 6px; }

/* ================= Pinboard layout ================= */
.btn, .chip, .seg, .seg button, .link-row a { border-radius: 999px; }
.btn-primary { background: var(--ink); color: var(--ink-text); font-weight: 600; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 500; }
.chip { border-color: var(--border); font-weight: 500; }
.chip:hover { border-color: var(--text); color: var(--text); }
.link-row a { border-color: var(--border); font-weight: 500; }
.link-row a:hover { border-color: var(--text); color: var(--text); }

.topbar { gap: 12px 28px; padding: 16px 32px; padding-top: max(16px, env(safe-area-inset-top)); border-bottom: 1px solid var(--border); background: var(--bg); flex-wrap: wrap; }
.brand { font-family: var(--serif); font-style: italic; font-size: 24px; font-weight: 400; letter-spacing: 0; text-transform: none; }
#tripSelect { flex: 0 1 280px; border-radius: 999px; background: var(--surface); padding: 0 14px; font-weight: 500; }
.topbar .stepbar { order: 0; flex: 0 1 auto; border: 0; background: transparent; padding: 0; gap: 4px 22px; font-family: var(--font); font-size: 14px; }
.stepbar .sep { display: none; }
.stepbar .step > span, .stepbar .step > button { border: 0; border-radius: 0; padding: 6px 0; background: transparent; color: var(--muted); }
.stepbar .step.done > *, .stepbar .step.skipped > * { background: transparent; border: 0; color: var(--muted); }
.stepbar .step.current > *, .stepbar .step.working > * { background: transparent; color: var(--text); border: 0; border-bottom: 1px solid var(--text); font-weight: 500; }
.stepbar .step > button:hover { color: var(--text); }
.stepbar .step-note { margin-left: 0; font-size: 13px; }

.layout { grid-template-columns: minmax(0, 1fr) 380px; }
.board { min-height: 0; overflow-y: auto; padding: 36px 40px 56px; display: flex; flex-direction: column; gap: 22px; }
.board-head .eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.board-head .status { font-family: var(--font); letter-spacing: .08em; background: var(--surface-2); color: var(--muted); font-size: 11px; }
.board-head h1 { margin: 8px 0 0; font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 5vw, 60px); line-height: 1.04; }
.lede { margin: 10px 0 0; max-width: 620px; color: var(--muted); font-size: 16px; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 4px 22px; background: transparent; padding: 0; border-bottom: 1px solid var(--border); margin: 0; }
.view-tabs button { flex: 0 0 auto; border: 0; border-radius: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; padding: 10px 0; min-height: 44px; margin-bottom: -1px; cursor: pointer; box-shadow: none; }
.view-tabs button[aria-pressed="true"] { color: var(--text); border-bottom: 1px solid var(--text); background: transparent; box-shadow: none; font-weight: 500; }
.stage { gap: 22px; }
.stage .flights, .stage > section { display: flex; flex-direction: column; gap: 16px; }

/* Cards pinned in uneven columns, like a board. */
.pinboard { columns: 3 260px; column-gap: 22px; }
.pinboard > * { break-inside: avoid; margin: 0 0 22px; }
.card.place { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 20px; gap: 8px; overflow: hidden; }
.card.place > .photo:first-child { margin: -18px -20px 6px; }
.card.note { background: var(--surface-2); border: 0; border-radius: var(--radius); padding: 22px; box-shadow: none; gap: 10px; }
.card.waiting { min-height: 160px; background: var(--surface-2); border: 0; box-shadow: none; }
.card.waiting.tall { min-height: 260px; }
.card-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 27px; line-height: 1.12; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-title .score { font-family: var(--font); font-size: 13px; color: var(--muted); font-weight: 500; }
.kicker { font-size: 13px; color: var(--muted); }
.card .tag { background: var(--surface-2); border-radius: 12px; }
.card .tag.special { background: var(--accent-soft); }
.badge-label { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); }
.photo + .badge-label { position: absolute; top: 14px; left: 14px; background: var(--surface); box-shadow: var(--shadow); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-top: 6px; }
.more-links > summary { list-style: none; display: inline-flex; align-items: center; }
.more-links > summary::-webkit-details-marker { display: none; }
.more-links[open] > .link-row { margin-top: 8px; }
.tag-pill { font-size: 14px; padding: 7px 14px; border-radius: 999px; background: var(--surface-2); }
.facts { margin: 0; display: grid; gap: 10px; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts dd.empty { color: var(--muted); font-style: italic; }
.todo { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.ritem { font-size: 14px; }
.research-head h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; }

.photo { margin: 0; position: relative; background: var(--surface-2); }
.photo img { display: block; width: 100%; max-height: 280px; object-fit: cover; }
.photo .credit { position: absolute; right: 8px; bottom: 8px; font-size: 11px; color: #fff; background: rgb(0 0 0 / 45%); padding: 2px 8px; border-radius: 999px; text-decoration: none; }
.thumb { margin: 0 0 8px; border-radius: 12px; overflow: hidden; position: relative; }
.thumb img { display: block; width: 100%; height: 120px; object-fit: cover; }
.thumb .credit { position: absolute; right: 6px; bottom: 6px; font-size: 10.5px; color: #fff; background: rgb(0 0 0 / 45%); padding: 1px 6px; border-radius: 999px; text-decoration: none; }

/* Booked flight and stay, pinned across the top. */
.strip { display: flex; flex-wrap: wrap; gap: 16px; }
.strip-card { flex: 1 1 260px; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.strip-title { font-family: var(--serif); font-size: 27px; line-height: 1.15; }
.board-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Days as columns of cards: the draft on the board, and the confirmed itinerary. */
.columns, .itinerary { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; align-items: start; }
.itinerary > p { grid-column: 1 / -1; }
.column { display: flex; flex-direction: column; gap: 12px; }
.column-head, .itinerary .day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 0 8px; border-bottom: 1px solid var(--text); background: transparent; color: var(--text); }
.column-head h2, .itinerary .day-head h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 30px; letter-spacing: 0; text-transform: none; }
.column-head span, .itinerary .day-head .label { font-size: 13px; color: var(--muted); opacity: 1; }
.mini-card { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.mini-card .thumb { margin: 0; border-radius: 0; }
.mini-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.mini-title { font-weight: 600; font-size: 15px; }
.mini-card.booked { background: var(--surface-2); border-color: transparent; }
.mini-card.empty { border-style: dashed; padding: 14px; color: var(--muted); font-size: 14px; }
.itinerary .day { border: 0; border-radius: 0; overflow: visible; background: transparent; display: flex; flex-direction: column; gap: 8px; }
.itinerary .day-items { padding: 6px 0 0; gap: 10px; }
.itinerary .it { border: 1px solid var(--border); border-radius: 16px; padding: 12px; grid-template-columns: 14px 1fr; background: var(--surface); }
.itinerary .it.booked { border: 0; border-radius: 16px; background: var(--surface-2); }
.itinerary .it .thumb { margin: -4px -4px 8px -4px; }
.itinerary .it-time { font-family: var(--font); font-variant-numeric: tabular-nums; }
.itinerary .travel { padding-left: 14px; font-family: var(--font); }

/* The chat, on the side. */
.chat { border-left: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 30%, var(--bg)); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 8px; font-size: 14px; font-weight: 600; }
.chat-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.sheet-toggle { display: none; margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); cursor: pointer; align-items: center; justify-content: center; }
.chat .messages { padding: 8px 22px; gap: 12px; }
.chat .msg { font-size: 14px; max-width: 92%; }
.chat .msg.assistant { color: color-mix(in srgb, var(--text) 82%, var(--bg)); padding: 0; }
.chat .msg.user { border-radius: 16px; }
.board-link { align-self: flex-start; font: inherit; font-size: 13px; font-weight: 500; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: 2px 0; cursor: pointer; }
.chat .quick-replies { padding: 4px 22px 8px; }
.chat .mode-bar { padding: 0 22px 6px; justify-content: flex-start; }
.chat .composer { margin: 6px 16px max(16px, env(safe-area-inset-bottom)); border-radius: 999px; padding: 5px 5px 5px 16px; align-items: center; }
.send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--ink); color: var(--ink-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.send:disabled { opacity: .45; cursor: default; }
.chat .proposal { border-radius: 16px; }

@media (max-width: 820px) {
  .topbar { padding: 12px 16px; gap: 8px 12px; }
  .topbar .stepbar { display: none; }
  .layout { display: block; }
  .board { padding: 20px 16px 220px; overflow: visible; }
  .board-head h1 { font-size: 40px; }
  .view-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 20px; }
  .view-tabs::-webkit-scrollbar { display: none; }
  .pinboard { columns: 2 150px; column-gap: 12px; }
  .pinboard > * { margin-bottom: 12px; }
  .card.place { padding: 12px 14px 14px; }
  .card.place > .photo:first-child { margin: -12px -14px 4px; }
  .card-title { font-size: 21px; }
  .columns, .itinerary { grid-template-columns: minmax(0, 1fr); }
  /* The chat becomes a panel at the bottom: the planner's latest line and the message box; pull up for all of it. */
  .chat { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 20; display: flex; flex-direction: column; max-height: 230px; border: 1px solid var(--border); border-radius: 22px; background: var(--bg); box-shadow: 0 -8px 30px rgb(22 22 22 / 10%); }
  .chat.open { max-height: min(86vh, 720px); top: auto; height: min(86vh, 720px); }
  .chat:not(.open) .messages { max-height: 78px; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40%); mask-image: linear-gradient(to bottom, transparent, #000 40%); }
  .chat:not(.open) .mode-bar { display: none; }
  .chat-head { padding: 10px 16px 0; }
  .sheet-toggle { display: inline-flex; }
  .chat.open .sheet-toggle svg { transform: rotate(180deg); }
  .chat .messages { padding: 6px 16px; }
  .chat .composer { margin: 6px 10px 10px; }
  .toast { bottom: 250px; }
}
