/* TravelAdvisor — design system (paper + teal). Implements TravelAdvisor.dc.html. */
:root {
  --paper:#FFFFFF; --bg:#ECE6DC; --ink:#2A2520; --muted:#7C7268; --faint:#A89E92;
  --line:#E7DFD3; --line2:#DBD2C4; --primary:#1E6E66; --primary-d:#185A53; --soft:#E3F0EE;
  --radius:13px; --shadow:0 1px 2px rgba(40,32,24,.05),0 2px 6px rgba(40,32,24,.045);
}
* { box-sizing:border-box; }
html, body { margin:0; padding:0; }
body {
  background:var(--bg); color:var(--ink); font-size:15px; line-height:1.5;
  font-family:'Hanken Grotesk', system-ui, -apple-system, sans-serif;
}
a { color:inherit; text-decoration:none; }
button { font-family:inherit; cursor:pointer; border:none; background:none; color:inherit; }
input, select, textarea { font-family:inherit; color:var(--ink); }
:focus-visible { outline:2px solid var(--primary); outline-offset:2px; border-radius:4px; }
::selection { background:#CFE6E2; }
.serif { font-family:'Spectral', Georgia, serif; letter-spacing:-.01em; }
.muted { color:var(--muted); }
.faint { color:var(--faint); }
svg.ic { vertical-align:middle; flex:none; }

/* ---- top bar ---- */
.topbar { position:sticky; top:0; z-index:20; background:rgba(247,243,237,.86);
  backdrop-filter:blur(10px); border-bottom:1px solid var(--line); }
.topbar-inner { max-width:1120px; margin:0 auto; padding:11px 26px; display:flex; align-items:center; gap:14px; }
.brand { display:flex; align-items:center; gap:9px; font-weight:700; font-size:16px; letter-spacing:-.01em; }
.brand-mark { width:27px; height:27px; border-radius:8px; background:var(--primary); color:#fff;
  display:grid; place-items:center; flex:none; }
.crumb { color:var(--muted); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.crumb-sep { color:var(--faint); }
.topbar-link { display:flex; align-items:center; gap:7px; color:var(--muted);
  font-weight:500; padding:7px 11px; border-radius:9px; border:1px solid var(--line); }
.topbar-link:hover { background:#fff; }

/* toast (error surface) */
.toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%) translateY(8px);
  background:#3A2F28; color:#fff; padding:12px 18px; border-radius:10px; max-width:90vw;
  box-shadow:0 6px 24px rgba(40,32,24,.25); font-size:14px; font-weight:500; opacity:0;
  transition:opacity .18s, transform .18s; z-index:50; pointer-events:none; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* upload busy/idle state + spinner */
.upload-busy { display:none; align-items:center; gap:8px; }
.upload-form.htmx-request .upload-idle { display:none; }
.upload-form.htmx-request .upload-busy { display:inline-flex; }
.spinner { width:14px; height:14px; border:2px solid currentColor; border-right-color:transparent;
  border-radius:999px; display:inline-block; animation:spin .7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* trip settings */
.trip-settings { display:flex; align-items:center; gap:10px; margin-top:10px; flex-wrap:wrap; }

/* daily map */
.map-day { margin-bottom:22px; }

/* login page */
.login-wrap { min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-card { width:100%; max-width:380px; padding:28px 26px; }
.login-brand { display:flex; align-items:center; justify-content:center; gap:10px; margin-bottom:8px; }

.page { max-width:1120px; margin:0 auto; padding:26px 26px 80px; }
h1.title { font-family:'Spectral', Georgia, serif; font-weight:600; font-size:32px; margin:0 0 4px; letter-spacing:-.01em; }
h2.section { font-weight:650; font-size:16px; margin:0 0 12px; }
.lead { margin:0; color:var(--muted); }
.back-link { display:inline-flex; align-items:center; gap:5px; color:var(--muted); font-weight:500;
  font-size:13.5px; margin-bottom:10px; }

/* ---- buttons ---- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; background:var(--primary);
  color:#fff; font-weight:600; padding:10px 16px; border-radius:10px; box-shadow:var(--shadow); }
.btn:hover { background:var(--primary-d); }
.btn svg { color:#fff; }
.btn-outline { display:inline-flex; align-items:center; justify-content:center; gap:7px; background:#fff;
  color:var(--primary-d); font-weight:600; padding:9px 14px; border-radius:9px; border:1px solid var(--primary); }
.btn-outline:hover { background:var(--soft); }
.btn-soft { display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600;
  color:var(--muted); border:1px solid var(--line2); padding:6px 11px; border-radius:8px; }
.btn-soft:hover { background:#F4EFE8; }
.btn-block { width:100%; }
.icon-btn { width:30px; height:30px; display:grid; place-items:center; border-radius:8px; color:var(--faint); flex:none; }
.icon-btn:hover { background:#FBE6E3; color:#B23B30; }
.link-btn { color:var(--primary-d); font-weight:600; font-size:13px; }
.link-btn:hover { text-decoration:underline; }
.link-btn.danger { color:#B23B30; }

/* ---- generic inputs ---- */
.input, input[type=text], input[type=date], input[type=datetime-local], select {
  padding:10px 12px; border:1px solid var(--line2); border-radius:9px; font-size:14.5px; background:#FdFcFa; }
.field { display:flex; flex-direction:column; gap:5px; font-size:11.5px; color:var(--muted); font-weight:600; }
.field > input, .field > select { font-weight:400; }

/* ---- cards ---- */
.card { background:var(--paper); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.card-pad { padding:16px; }

/* ---- trips list ---- */
.page-head { margin-bottom:22px; display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.trip-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:11px; }
.trip-card { display:flex; align-items:center; gap:18px; background:var(--paper); border:1px solid var(--line);
  border-radius:var(--radius); padding:18px 20px; box-shadow:var(--shadow); }
.trip-card:hover { border-color:#CDBFAA; transform:translateY(-1px); }
.trip-avatar { flex:none; width:48px; height:48px; border-radius:12px; display:grid; place-items:center;
  font-family:'Spectral',serif; font-size:20px; font-weight:600; background:var(--soft); color:var(--primary-d); }
.trip-name { font-weight:650; font-size:17px; }
.trip-meta { color:var(--muted); font-size:13.5px; margin-top:3px; }

/* ---- trip detail layout + tabs ---- */
.trip-head { margin-bottom:18px; }
.trip-head h1 { font-family:'Spectral',serif; font-weight:600; font-size:29px; margin:0; letter-spacing:-.01em; }
.trip-layout { display:grid; grid-template-columns:208px 1fr; gap:26px; align-items:start; }
.tabs { display:flex; flex-direction:column; gap:3px; position:sticky; top:78px; }
.tab { display:flex; align-items:center; gap:10px; padding:10px 13px; border-radius:10px; font-weight:600;
  font-size:14.5px; white-space:nowrap; color:var(--muted); cursor:pointer; }
.tab:hover { background:#F4EFE8; }
.tab.tab-active { background:var(--soft); color:var(--primary-d); }
.tab svg { opacity:.9; }
.tab-content { min-width:0; }
.tab-content > h2.section:first-child { margin-top:0; }

/* ---- two-column ---- */
.two { display:grid; grid-template-columns:1fr 1fr; gap:14px; }

/* ---- type picker ---- */
.type-picker { display:flex; flex-wrap:wrap; gap:6px; }
.type-chip { display:flex; align-items:center; gap:6px; padding:6px 11px; border-radius:999px; font-size:13px;
  font-weight:600; border:1px solid var(--line2); color:var(--muted); background:#fff; }
.type-chip:hover { border-color:var(--primary); color:var(--primary-d); }
.upload-drop { border:1.5px dashed var(--line2); border-radius:10px; padding:16px; text-align:center;
  color:var(--muted); font-size:13.5px; cursor:pointer; background:#FBF8F4; display:flex; flex-direction:column;
  align-items:center; gap:6px; }
.upload-drop:hover { border-color:var(--primary); color:var(--primary-d); }

/* ---- item rows ---- */
.legend { display:flex; align-items:center; justify-content:space-between; margin:0 2px 10px; }
.legend-keys { display:flex; gap:13px; font-size:12px; color:var(--muted); }
.legend-keys span { display:flex; align-items:center; gap:5px; }
.dot { width:8px; height:8px; border-radius:999px; display:inline-block; }
.list { background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden; list-style:none; margin:0; padding:0; }
.row { display:flex; align-items:center; gap:12px; padding:12px 15px; border-top:1px solid var(--line); }
.row:first-child { border-top:none; }
.row-title { flex:1; min-width:0; text-align:left; font-weight:600; font-size:14.5px; display:flex;
  align-items:center; gap:8px; overflow:hidden; }
.row-title span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.row-title:hover { color:var(--primary-d); }
.empty { padding:26px; text-align:center; color:var(--muted); font-size:13.5px; }

/* type badges */
.type-badge { flex:none; display:inline-flex; align-items:center; gap:6px; padding:4px 9px; border-radius:8px;
  font-size:12px; font-weight:600; }
.type-flight { background:#E3F0EE; color:#185A53; }
.type-hotel { background:#EAE6F4; color:#5647A0; }
.type-restaurant { background:#F4E8D7; color:#93611F; }
.type-event { background:#F7E7E8; color:#A23A47; }
.type-transit { background:#E6EDF2; color:#3F6079; }
.type-wishlist { background:#F6EFD8; color:#8A6D1E; }

/* status pills */
.status-pill { flex:none; display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px;
  font-size:12px; font-weight:600; }
.status-verified { background:#EAF5EE; color:#1E6E48; }
.status-verified .dot { background:#37A05E; }
.status-pending { background:#FBF1DD; color:#7A5410; }
.status-pending .dot { background:#D69A2D; }
.status-flagged { background:#FBE6E3; color:#8C2C24; }
.status-flagged .dot { background:#D2503F; }
.dot7 { width:7px; height:7px; }

/* ---- plans ---- */
.bar-form { display:flex; gap:10px; align-items:center; flex-wrap:wrap; padding:14px 16px; }
.plan-stack { display:flex; flex-direction:column; gap:16px; }
.plan-card { background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden; }
.plan-card.is-active { border-color:#BFD8D3; }
.plan-head { padding:14px 16px; display:flex; align-items:center; gap:11px; flex-wrap:wrap; border-bottom:1px solid var(--line); }
.plan-name { font-family:'Spectral',serif; font-weight:600; font-size:18px; }
.badge-active { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:700; color:#fff;
  background:var(--primary); padding:3px 10px; border-radius:999px; }
.badge-active svg { color:#fff; }
.plan-actions { margin-left:auto; display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.plan-body { padding:6px 16px 14px; }

.day { margin-top:14px; }
.day-head { display:flex; align-items:baseline; gap:9px; margin-bottom:7px; }
.day-tag { font-size:11px; font-weight:700; color:#fff; background:#C3B7A6; border-radius:6px; padding:2px 7px; white-space:nowrap; }
.day-label { font-weight:650; font-size:14px; }
.quick-add { position:relative; }
.quick-add > summary { width:26px; height:26px; list-style:none; cursor:pointer; }
.quick-add > summary::-webkit-details-marker { display:none; }
.quick-add > summary:hover { background:#E9F3EC; color:#2E7D4F; }
.quick-add[open] > summary { background:#E9F3EC; color:#2E7D4F; }
.quick-add > form { display:flex; align-items:center; gap:7px; flex-wrap:wrap; margin-top:8px;
  background:#FBF8F3; border:1px solid var(--line); border-radius:10px; padding:9px 10px; }
.quick-add > form input { padding:7px 9px; border:1px solid var(--line2); border-radius:8px;
  font-size:13.5px; background:#fff; }
.quick-add > form input[name="title"] { flex:1; min-width:150px; }
.qa-dash { color:var(--faint); }
.day-rows { border-left:2px solid var(--line2); margin-left:6px; padding-left:14px; display:flex; flex-direction:column; gap:2px; }
.tl-row { display:flex; align-items:center; gap:11px; padding:7px 9px; border-radius:9px; position:relative; }
.tl-row:hover { background:#F8F4EE; }
.tl-dot { position:absolute; left:-21px; top:50%; width:9px; height:9px; border-radius:999px; border:2px solid #fff;
  transform:translateY(-50%); background:var(--primary); }
.tl-time { flex:none; width:128px; font-variant-numeric:tabular-nums; font-size:13px; font-weight:600; }
.tl-ic { flex:none; display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; border-radius:7px; }
.tl-title { flex:1; min-width:0; font-weight:550; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tl-title:hover { color:var(--primary-d); text-decoration:underline; }
.tl-note { margin:0 0 4px 40px; font-size:12.5px; color:var(--muted); font-style:italic; }

.add-to-plan { margin-top:16px; background:#FBF8F3; border:1px solid var(--line); border-radius:11px; padding:12px; }
.add-to-plan .label { font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin-bottom:9px; }
.add-to-plan .controls { display:flex; gap:8px; flex-wrap:wrap; align-items:end; }
.add-to-plan select, .add-to-plan input { padding:9px 10px; border:1px solid var(--line2); border-radius:8px; font-size:13.5px; background:#fff; }
.hint { font-size:12px; color:var(--faint); margin-top:8px; }
.item-reference summary { font-size:12.5px; font-weight:600; color:var(--primary-d); cursor:pointer; margin-top:10px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:9px; }
.chip-mini { display:inline-flex; align-items:center; gap:5px; font-size:12.5px; border:1px solid var(--line2);
  border-radius:999px; padding:4px 10px; background:#fff; }

/* ---- trip links ---- */
.links-form { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:6px; }
.links-form input { flex:1; min-width:150px; padding:9px 10px; border:1px solid var(--line2);
  border-radius:8px; font-size:13.5px; background:#fff; }
.links-list { list-style:none; margin:0; padding:0; }
.links-list li { display:flex; align-items:center; gap:9px; padding:8px 0; border-top:1px solid var(--line); }
.links-list .link-name { font-weight:550; font-size:14px; }
.links-list .link-name:hover { color:var(--primary-d); text-decoration:underline; }
.links-list .link-url { flex:1; min-width:0; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.plan-links { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:13px; }
.plan-link { display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:550;
  color:var(--primary-d); border:1px solid var(--line2); border-radius:999px; padding:5px 12px; background:#FBF8F3; }
.plan-link:hover { background:#F2ECE2; border-color:var(--primary); }

/* ---- todos ---- */
.todo-row { display:flex; align-items:center; gap:13px; padding:12px 15px; border-top:1px solid var(--line); }
.todo-row:first-child { border-top:none; }
.check { flex:none; width:23px; height:23px; border-radius:7px; display:grid; place-items:center; border:1.8px solid var(--line2); background:#fff; }
.check.done { background:var(--primary); border-color:var(--primary); }
.check.done svg { color:#fff; }
.todo-text { flex:1; min-width:0; font-size:14.5px; font-weight:550; }
.todo-done .todo-text { color:var(--muted); text-decoration:line-through; }
.due-pill { flex:none; display:inline-flex; align-items:center; gap:5px; font-size:12.5px; font-weight:600;
  padding:3px 10px; border-radius:999px; background:#F1ECE3; color:var(--muted); }

/* ---- validation ---- */
.val-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.note-empty { background:var(--paper); border:1px dashed var(--line2); border-radius:var(--radius); padding:42px 24px; text-align:center; }
.note-empty .bubble { width:54px; height:54px; border-radius:14px; background:var(--soft); display:grid; place-items:center;
  margin:0 auto 14px; color:var(--primary); }
.note-ok { background:#EAF5EE; border:1px solid #BFE3CC; border-radius:var(--radius); padding:34px 24px; text-align:center; color:#3C7A57; }
.note-ok .bubble { width:54px; height:54px; border-radius:999px; background:#37A05E; display:grid; place-items:center; margin:0 auto 14px; color:#fff; }
.note-ok .bubble svg { color:#fff; }
.note-ok strong { display:block; font-size:17px; color:#1E6E48; margin-bottom:4px; }
.diag-list { display:flex; flex-direction:column; gap:9px; }
.diag { background:var(--paper); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); display:flex; overflow:hidden; }
.diag-bar { flex:none; width:5px; }
.diag-body { flex:1; padding:13px 15px; display:flex; gap:13px; align-items:flex-start; }
.diag-msg { flex:1; min-width:0; font-size:14.5px; font-weight:550; line-height:1.45; }
.diag-src { font-size:12px; color:var(--faint); margin-top:5px; display:flex; align-items:center; gap:5px; }
.sev-badge { flex:none; margin-top:1px; display:inline-flex; align-items:center; gap:5px; font-size:11px;
  font-weight:700; letter-spacing:.03em; padding:3px 9px; border-radius:6px; }
.sev-CRITICAL { background:#FBE6E3; color:#B23B30; } .bar-CRITICAL { background:#D2503F; }
.sev-WARNING { background:#FBF1DD; color:#7A5410; } .bar-WARNING { background:#D69A2D; }
.sev-INFO { background:#E3F0EE; color:#185A53; } .bar-INFO { background:#1E6E66; }

/* ---- compile (printable) ---- */
.doc { background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:40px 44px; max-width:760px; margin:0 auto; }
.doc pre { white-space:pre-wrap; word-break:break-word; font-family:'Spectral',Georgia,serif; font-size:15px; line-height:1.7; margin:0; }
.doc-body { line-height:1.6; }
.doc-body h1 { font-family:'Spectral',serif; font-weight:600; font-size:26px; letter-spacing:-.01em; text-align:center; margin:0 0 6px; }
.doc-body h2 { font-family:'Spectral',serif; font-weight:600; font-size:18px; margin:24px 0 8px; padding-bottom:6px; border-bottom:1px solid var(--line2); }
.doc-body h3 { font-family:'Spectral',serif; font-weight:600; font-size:16px; margin:20px 0 8px; }
.doc-body ul { list-style:none; padding:0; margin:0; }
.doc-body li { padding:8px 0; border-bottom:1px dotted var(--line); }
.doc-body li:last-child { border-bottom:none; }
.doc-body strong { font-weight:650; }
.doc-body em { color:var(--muted); font-style:italic; }
.doc-body p { color:var(--muted); }
.compiled { background:#FBF8F3; border:1px solid var(--line); border-radius:8px; padding:1rem; white-space:pre-wrap; word-break:break-word; }

/* ---- item detail ---- */
.detail-head { display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:20px 22px; }
.detail-icon { flex:none; width:46px; height:46px; border-radius:12px; display:grid; place-items:center; }
.detail-head h1 { font-family:'Spectral',serif; font-weight:600; font-size:24px; margin:0; letter-spacing:-.01em; }
.banner { display:flex; gap:11px; border-radius:12px; padding:13px 15px; margin-bottom:16px; align-items:flex-start; }
.banner-flag { background:#FBE6E3; border:1px solid #F0C9C3; color:#8C2C24; font-size:13.5px; }
.banner-warn { background:#FBF1DD; border:1px solid #ECD7A8; color:#7A5410; font-size:13.5px; }
.kv-card .kv-head { padding:13px 16px; border-bottom:1px solid var(--line); font-weight:650; display:flex; align-items:center; gap:8px; }
.kv-card .kv-head svg { color:var(--primary); }
.kv-row { display:flex; gap:14px; padding:10px 16px; border-top:1px solid var(--line); font-size:14px; }
.kv-row .k { flex:none; width:140px; color:var(--muted); font-weight:500; }
.kv-row .v { flex:1; font-weight:550; }
.raw-row { padding:11px 16px; border-top:1px solid var(--line); }
.raw-top { display:flex; gap:12px; align-items:baseline; }
.raw-top .field-name { flex:none; width:130px; color:var(--muted); font-size:12.5px; font-weight:600; }
.raw-top .val { flex:1; font-size:14px; font-weight:600; }
.raw-mismatch { background:#FCF1EF; }
.mismatch-tag { font-size:11px; font-weight:700; color:#B23B30; background:#FBE6E3; padding:1px 7px; border-radius:5px; margin-left:6px; white-space:nowrap; }
.match-tag { color:#37A05E; font-weight:700; margin-left:6px; }
.quote { margin:7px 0 1px 142px; font-size:12.5px; color:var(--muted);
  font-family:ui-monospace,'SFMono-Regular',Menlo,monospace; background:#FBF8F3; border-left:2px solid var(--line2);
  padding:6px 10px; border-radius:0 6px 6px 0; line-height:1.5; }

/* ---- settings / storage ---- */
.storage-card { padding:22px; }
.storage-top { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:10px; }
.storage-track { height:13px; background:#EDE6DB; border-radius:999px; overflow:hidden; }
.storage-fill { height:100%; border-radius:999px; background:var(--primary); }
.storage-fill.full { background:#D69A2D; }

/* ---- responsive + print ---- */
@media (max-width:780px) {
  .trip-layout { grid-template-columns:1fr; gap:14px; }
  .tabs { flex-direction:row; overflow-x:auto; position:static; gap:6px; padding-bottom:4px; }
  .tabs::-webkit-scrollbar { height:0; }
  .two { grid-template-columns:1fr; }
  .page { padding:16px 14px 64px; }
  .hide-sm { display:none !important; }
}
@media print {
  .noprint { display:none !important; }
  body { background:#fff; color:#000; }
  .page { padding:0; max-width:none; margin:0; }
  /* The tab nav is hidden in print; collapse the grid so the document isn't trapped in the
     208px tab column (which left it at ~1/4 width). Let it fill the page. */
  .trip-layout { display:block !important; }
  .trip-head, .crumb { display:none !important; }
  .tab-content { min-width:0; }
  .doc { border:none; box-shadow:none; padding:0; max-width:none; margin:0; width:100%; }
  .doc-body { font-size:12pt; line-height:1.5; }
  .doc-body h1 { font-size:22pt; }
  .doc-body h2 { font-size:15pt; margin-top:18pt; }
  .doc-body h3 { font-size:13pt; }
  .doc-body li { break-inside:avoid; }
  .doc-body h2 { break-after:avoid; }
}
