/* Trip Planner v15 design system.
   Idea: a transit route map on paper. The day timeline is the hero: one vertical route line,
   stops colored by category. Everything else stays quiet: hairline rules, one accent, no card piles. */

:root {
  --paper: #ffffff;
  --paper-2: #f4f5f7;
  --paper-3: #e9ebef;
  --ink: #14213d;
  --ink-2: #4b5565;
  --ink-3: #7b8494;
  --rule: #d9dee7;
  --rule-2: #edf0f4;
  --accent: #0d5ef2;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --good: #15803d;
  --good-soft: #e5f5ea;
  --warn: #b45309;
  --warn-soft: #fdf1e2;
  --danger: #b91c1c;
  --danger-soft: #fbe8e8;

  --c-move: #2563eb;
  --c-food: #dc2626;
  --c-cafe: #b45309;
  --c-sight: #059669;
  --c-shop: #c026d3;
  --c-hotel: #4f46e5;
  --c-booking: #0891b2;
  --c-prep: #64748b;
  --c-backup: #94a3b8;
  --c-etc: #475569;

  --font: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --fs-0: 12px; --fs-1: 13px; --fs-2: 15px; --fs-3: 17px; --fs-4: 20px; --fs-5: 24px; --fs-6: 30px;
  --r-1: 6px; --r-2: 10px; --r-3: 16px;
  --bar-h: 56px;
  --tabs-h: 44px;
  --nav-h: 60px;
  --gutter: 24px;
  --shadow-drawer: -18px 0 48px rgba(20, 33, 61, .16);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .hero h1 { font-size: 26px; }
  .hero-meta { font-size: var(--fs-1); gap: 10px; }
  .view-head .row { width: 100%; }
  .section-head { flex-wrap: wrap; }
  .section-head > .row { width: 100%; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-2);
  line-height: 1.5;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--fs-6); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: var(--fs-4); font-weight: 700; letter-spacing: -0.005em; line-height: 1.3; }
h3 { font-size: var(--fs-3); font-weight: 700; line-height: 1.35; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: var(--fs-1); }
.tiny { font-size: var(--fs-0); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 24px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hr { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- app frame ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  height: var(--bar-h); padding: 0 var(--gutter);
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.brand { min-width: 0; flex: 1 1 auto; display: flex; align-items: baseline; gap: 10px; }
.brand-title { font-weight: 700; font-size: var(--fs-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--ink-3); font-size: var(--fs-1); white-space: nowrap; }
.bar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.tabs {
  position: sticky; top: var(--bar-h); z-index: 39;
  display: flex; gap: 4px; height: var(--tabs-h); padding: 0 calc(var(--gutter) - 10px);
  background: var(--paper); border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; border: 0; background: none; padding: 0 10px; color: var(--ink-2);
  font-weight: 500; white-space: nowrap; cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); }
.tab:hover { color: var(--ink); }

.view { padding: 20px var(--gutter) 40px; max-width: 1320px; margin: 0 auto; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head p { color: var(--ink-2); margin-top: 4px; }

.bottom-nav { display: none; }
@media (max-width: 760px) {
  .tabs { display: none; }
  .app-bar { gap: 10px; }
  .brand-sub { display: none; }
  .view { padding-bottom: calc(var(--nav-h) + 24px); }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper); border-top: 1px solid var(--rule);
  }
  .bottom-nav button {
    border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 2px;
    color: var(--ink-3); font-size: 11px; font-weight: 500;
  }
  .bottom-nav button[aria-selected="true"] { color: var(--ink); font-weight: 700; }
  .bottom-nav svg { width: 22px; height: 22px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: var(--r-2);
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s var(--ease), border-color .12s var(--ease);
}
.btn:hover { background: var(--paper-2); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #1f2d52; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #0b4fd0; }
.btn-danger { color: var(--danger); border-color: #efc5c5; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--paper-2); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: var(--fs-1); border-radius: var(--r-1); }
.btn-block { width: 100%; }
.icon-btn { width: 36px; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: #b9cdfc; color: var(--accent); }

/* ---------- pills, chips, status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: var(--fs-0); font-weight: 600; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }
.status-dot[data-status="online"] { background: var(--good); }
.status-dot[data-status="syncing"] { background: var(--warn); }
.status-dot[data-status="offline"] { background: var(--danger); }

.presence { display: flex; align-items: center; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper-3); color: var(--ink); font-size: 12px; font-weight: 700;
  border: 2px solid var(--paper); margin-left: -8px;
}
.avatar:first-child { margin-left: 0; }
.avatar.me { background: var(--ink); color: #fff; }

.type-chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-0); font-weight: 600; color: var(--ink-2); }
.type-chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--c-etc)); }

[data-type="move"] { --c: var(--c-move); }
[data-type="food"] { --c: var(--c-food); }
[data-type="cafe"] { --c: var(--c-cafe); }
[data-type="sight"] { --c: var(--c-sight); }
[data-type="shop"] { --c: var(--c-shop); }
[data-type="hotel"] { --c: var(--c-hotel); }
[data-type="booking"] { --c: var(--c-booking); }
[data-type="prep"] { --c: var(--c-prep); }
[data-type="backup"] { --c: var(--c-backup); }
[data-type="etc"] { --c: var(--c-etc); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0;
  min-width: 72px; padding: 6px 10px; border-radius: var(--r-2); border: 1px solid var(--rule);
  background: var(--paper); cursor: pointer; text-align: left; line-height: 1.25;
}
.chip b { font-size: var(--fs-1); }
.chip span { font-size: var(--fs-0); color: var(--ink-3); }
.chip[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-selected="true"] span { color: rgba(255, 255, 255, .7); }
.chip.today { border-color: var(--accent); }

/* ---------- forms ---------- */
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--r-1); padding: 8px 10px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type="checkbox"] { width: 18px; height: 18px; padding: 0; accent-color: var(--ink); }
textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234b5565' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.field { display: grid; gap: 4px; }
.field > label, .field-label { font-size: var(--fs-1); font-weight: 600; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-help { font-size: var(--fs-0); color: var(--ink-3); }
.inline-edit { border-color: transparent; background: transparent; padding: 4px 6px; }
.inline-edit:hover { border-color: var(--rule); }
.view-mode .inline-edit { pointer-events: none; }

/* ---------- surfaces ---------- */
.panel { border: 1px solid var(--rule); border-radius: var(--r-3); background: var(--paper); padding: 16px; }
.panel-tight { padding: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.section { padding: 20px 0; border-top: 1px solid var(--rule); }
.section:first-child { border-top: 0; padding-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); border: 1px dashed var(--rule); border-radius: var(--r-2); }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule-2); }
.list-item:first-child { border-top: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: var(--fs-1); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-1); }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); padding: 8px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table td { padding: 6px 8px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.table td input, .table td select, .table td textarea { min-width: 110px; padding: 6px 8px; }
.table td textarea { min-height: 38px; }
.table td.num, .table th.num { text-align: right; }
.table td.actions { width: 1%; white-space: nowrap; }

/* ---------- layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- toast, modal, drawer ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translate(-50%, 12px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-2); font-size: var(--fs-1);
  opacity: 0; pointer-events: none; transition: opacity .16s var(--ease), transform .16s var(--ease); z-index: 90; max-width: min(92vw, 480px);
}
@media (min-width: 761px) { .toast { bottom: 24px; } }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--warn); }
.toast.danger { background: var(--danger); }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20, 33, 61, .42); display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: var(--paper); border-radius: var(--r-3); padding: 20px; box-shadow: 0 24px 70px rgba(20, 33, 61, .28); }
.modal h2 { margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.backdrop { position: fixed; inset: var(--bar-h) 0 0 0; z-index: 60; background: rgba(20, 33, 61, .34); opacity: 0; pointer-events: none; transition: opacity .16s var(--ease); }
.backdrop.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: var(--bar-h); bottom: 0; z-index: 70; width: min(440px, 94vw); background: var(--paper);
  overflow: auto; overscroll-behavior: contain; padding: 16px; transition: transform .18s var(--ease);
}
.drawer-right { right: 0; transform: translateX(104%); box-shadow: var(--shadow-drawer); border-left: 1px solid var(--rule); }
.drawer-left { left: 0; transform: translateX(-104%); box-shadow: 18px 0 48px rgba(20, 33, 61, .16); border-right: 1px solid var(--rule); }
.drawer:not(.open) { visibility: hidden; pointer-events: none; transition: transform .18s var(--ease), visibility 0s linear .18s; }
.drawer.open { transform: translateX(0); visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
@media (max-width: 760px) { .drawer { bottom: var(--nav-h); } .backdrop { bottom: var(--nav-h); } }
@media (max-width: 640px) {
  .drawer-right, .drawer-left { top: auto; left: 0; right: 0; width: auto; max-height: calc(86vh - var(--nav-h)); border-radius: var(--r-3) var(--r-3) 0 0; transform: translateY(104%); border: 1px solid var(--rule); border-bottom: 0; box-shadow: 0 -18px 48px rgba(20, 33, 61, .18); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .drawer.open { transform: translateY(0); }
}

/* ---------- gate and landing ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter); background: var(--paper-2); }
.gate-card { width: min(440px, 100%); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-3); padding: 28px; }
.gate-card h1 { font-size: var(--fs-5); margin-bottom: 4px; }
.gate-card .error { color: var(--danger); font-size: var(--fs-1); margin-top: 8px; }
.landing { max-width: 960px; margin: 0 auto; padding: 48px var(--gutter) 64px; }
.landing-hero { display: grid; gap: 14px; margin-bottom: 40px; max-width: 620px; }
.landing-hero h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.02em; }
.landing-hero p { color: var(--ink-2); font-size: var(--fs-3); }
.landing-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .landing-grid { grid-template-columns: 1fr; } }
.recent-list .list-item { justify-content: space-between; }

/* ---------- schedule: the hero ---------- */
.schedule-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.schedule-layout.pool-hidden { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1000px) { .schedule-layout { grid-template-columns: minmax(0, 1fr); } }
.pool { position: sticky; top: calc(var(--bar-h) + var(--tabs-h) + 16px); max-height: calc(100dvh - var(--bar-h) - var(--tabs-h) - 32px); overflow: auto; display: grid; gap: 10px; align-content: start; }
.pool-list { display: grid; gap: 6px; }
.cand {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 10px 8px 0; border: 1px solid var(--rule); border-radius: var(--r-2); background: var(--paper); cursor: grab;
}
.cand::before { content: ""; align-self: stretch; border-radius: 4px 0 0 4px; background: var(--c, var(--c-etc)); }
.cand:active { cursor: grabbing; }
.cand b { display: block; font-size: var(--fs-1); line-height: 1.3; }
.cand span { font-size: var(--fs-0); color: var(--ink-3); }
.cand .btn { opacity: 0; }
.cand:hover .btn, .cand:focus-within .btn { opacity: 1; }
@media (hover: none) { .cand .btn { opacity: 1; } }

.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 0 10px; }
.day-head h2 { font-size: var(--fs-4); }
.day-head .date { color: var(--ink-3); font-size: var(--fs-1); margin-left: 8px; }

.tl-wrap { position: relative; overflow: auto; max-height: calc(100dvh - var(--bar-h) - var(--tabs-h) - 150px); border: 1px solid var(--rule); border-radius: var(--r-3); background: var(--paper); }
.tl { position: relative; --px: 1.15; padding-left: 52px; }
.tl-hour { position: absolute; left: 0; right: 0; border-top: 1px solid var(--rule-2); }
.tl-hour span { position: absolute; left: 10px; top: -9px; font-size: var(--fs-0); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-half { position: absolute; left: 52px; right: 0; border-top: 1px dashed var(--rule-2); }
.tl-route { position: absolute; top: 0; bottom: 0; left: 62px; width: 2px; background: var(--rule); border-radius: 2px; }
.tl-now { position: absolute; left: 52px; right: 0; border-top: 2px solid var(--accent); z-index: 3; pointer-events: none; }
.tl-now::before { content: ""; position: absolute; left: 4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.blk {
  position: absolute; left: 76px; right: 12px; min-height: 26px; border-radius: var(--r-2);
  background: color-mix(in srgb, var(--c, var(--c-etc)) 11%, white);
  border: 1px solid color-mix(in srgb, var(--c, var(--c-etc)) 28%, white);
  padding: 5px 10px 5px 12px; cursor: pointer; user-select: none; touch-action: none; overflow: hidden;
  transition: box-shadow .12s var(--ease);
}
.blk::before { content: ""; position: absolute; left: -20px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--c-etc)); box-shadow: 0 0 0 3px var(--paper); }
.blk::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--c-etc)); }
.blk.selected { box-shadow: 0 0 0 2px var(--ink); z-index: 2; }
.blk.dragging { opacity: .85; box-shadow: 0 10px 24px rgba(20, 33, 61, .2); z-index: 5; }
.blk-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.blk-title { font-weight: 700; font-size: var(--fs-1); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.blk-time { font-size: var(--fs-0); color: var(--ink-2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.blk-sub { font-size: var(--fs-0); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk.compact .blk-sub { display: none; }
.blk.compact { padding-top: 3px; padding-bottom: 3px; }
.blk.compact::before { top: 7px; }
.blk-handle { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; cursor: ns-resize; }
.blk-handle::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 26px; height: 3px; margin-left: -13px; border-radius: 2px; background: color-mix(in srgb, var(--c, var(--c-etc)) 45%, white); opacity: 0; }
.blk:hover .blk-handle::after, .blk.selected .blk-handle::after { opacity: 1; }
.view-mode .blk { cursor: default; }
.view-mode .blk-handle { display: none; }
.tl-drop-help { position: absolute; left: 76px; right: 12px; top: 120px; padding: 14px; border: 1px dashed var(--rule); border-radius: var(--r-2); color: var(--ink-3); font-size: var(--fs-1); text-align: center; }
.tl-wrap.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* multi-day overview */
.days-grid { display: grid; grid-auto-flow: column; grid-template-columns: 52px; grid-auto-columns: minmax(220px, 1fr); gap: 0; min-width: max-content; }
.days-grid .day-col { border-left: 1px solid var(--rule); min-width: 220px; }
.days-grid .day-col:first-child { border-left: 0; }
@media (max-width: 760px) { .days-grid { grid-auto-columns: minmax(168px, 1fr); } .days-grid .day-col { min-width: 168px; } .day-col .blk-time { display: none; } }
.day-col-head { position: sticky; top: 0; z-index: 4; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 8px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.day-col-head b { font-size: var(--fs-1); }
.day-col-head span { font-size: var(--fs-0); color: var(--ink-3); }
.day-col .tl { padding-left: 0; }
.day-col .tl-route { left: 14px; }
.day-col .blk { left: 26px; right: 8px; }
.day-col .blk::before { left: -17px; }
.axis-col { position: sticky; left: 0; z-index: 5; background: var(--paper); width: 52px; min-width: 52px; border-right: 1px solid var(--rule); }
.axis-col .tl-hour span { left: 8px; }
.axis-col .day-col-head { visibility: hidden; }

/* list mode (mobile first): stations on a route line, each stop a tinted card */
.agenda { display: grid; gap: 8px; }
.agenda-item { display: grid; grid-template-columns: 42px 22px minmax(0, 1fr); gap: 0 8px; position: relative; cursor: pointer; }
.agenda-time { font-variant-numeric: tabular-nums; font-size: var(--fs-1); color: var(--ink-2); line-height: 1.35; padding-top: 9px; }
.agenda-time small { display: block; color: var(--ink-3); font-size: var(--fs-0); }
.agenda-rail { position: relative; display: flex; justify-content: center; align-items: flex-start; }
.agenda-rail::before { content: ""; position: absolute; top: 0; bottom: -8px; left: 50%; width: 2px; margin-left: -1px; background: var(--rule); }
.agenda-item:first-child .agenda-rail::before { top: 12px; }
.agenda-item:last-child .agenda-rail::before { bottom: auto; height: 12px; }
.agenda-rail .tmark { position: relative; z-index: 1; margin-top: 9px; box-shadow: 0 0 0 3px var(--paper); }
.agenda-main {
  min-width: 0; padding: 9px 12px 10px; border-radius: var(--r-2);
  background: color-mix(in srgb, var(--c, var(--c-etc)) 9%, white);
  border: 1px solid color-mix(in srgb, var(--c, var(--c-etc)) 24%, white); border-left: 3px solid var(--c, var(--c-etc));
}
.agenda-item:hover .agenda-main { border-color: color-mix(in srgb, var(--c, var(--c-etc)) 45%, white); border-left-color: var(--c, var(--c-etc)); }
.agenda-title { font-weight: 700; line-height: 1.3; }
.agenda-sub { font-size: var(--fs-1); color: var(--ink-2); margin-top: 1px; }
.agenda-memo { font-size: var(--fs-1); color: var(--ink-2); margin-top: 4px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.agenda-link { margin-top: 6px; }
.agenda-link a { font-weight: 600; color: var(--accent); }
.agenda-item.selected .agenda-main { box-shadow: 0 0 0 2px var(--ink); }

/* per-day brief: meals, visits, stay */
.day-brief { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-2); background: var(--paper-2); margin: 10px 0 12px; font-size: var(--fs-1); }
.brief-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.brief-k { color: var(--ink-3); font-size: var(--fs-0); font-weight: 600; }
.brief-v { color: var(--ink-2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.type-chip small { color: var(--ink-3); font-weight: 500; font-size: inherit; }
.type-chip.none { color: var(--ink-3); --c: var(--rule); }
.day-brief.in-day { display: none; }
@media (max-width: 760px) { .day-brief.in-day { display: grid; } }

/* type marks */
.tmark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--c, var(--c-etc)); color: #fff; flex: 0 0 auto; vertical-align: -5px; }
.tmark svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tmark.sm { width: 16px; height: 16px; vertical-align: -3px; }
.tmark.sm svg { width: 10px; height: 10px; }
.blk-line .tmark { margin-right: 6px; }
.blk.compact .tmark { display: none; }
.cand b .tmark { margin-right: 6px; }

/* ---------- home ---------- */
.hero { display: grid; gap: 10px; padding: 8px 0 24px; }
.hero h1 { font-size: clamp(26px, 4vw, 36px); }
.hero-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); }
.hero-meta b { color: var(--ink); }
.day-strip { position: relative; display: flex; gap: 4px; overflow-x: auto; padding: 14px 0 2px; margin-top: 4px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-strip::before { content: ""; position: absolute; left: 6px; right: 12px; top: 19px; height: 2px; background: var(--ink); }
.day-stop { position: relative; flex: 0 0 auto; min-width: 92px; border: 0; background: none; text-align: left; padding: 14px 10px 4px 0; color: var(--ink-3); font-size: var(--fs-0); display: grid; gap: 1px; cursor: pointer; border-radius: var(--r-1); }
.day-stop::before { content: ""; position: absolute; left: 0; top: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 3px solid var(--ink); box-sizing: border-box; }
.day-stop.today::before { background: var(--accent); border-color: var(--accent); }
.day-stop b { color: var(--ink); font-size: var(--fs-1); }
.day-stop .stop-region { color: var(--ink-2); }
.day-stop:hover b { color: var(--accent); }
.today-card { border: 1px solid var(--ink); border-radius: var(--r-3); padding: 16px; display: grid; gap: 10px; }
.day-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.day-card { border: 1px solid var(--rule); border-radius: var(--r-3); padding: 14px; display: grid; gap: 8px; align-content: start; cursor: pointer; }
.day-card:hover { border-color: var(--ink-3); }
.day-card.today { border-color: var(--accent); border-width: 2px; padding: 13px; }
.day-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.day-card-head b { font-size: var(--fs-3); }
.day-card-head span { color: var(--ink-3); font-size: var(--fs-1); }
.mini-list { display: grid; gap: 4px; font-size: var(--fs-1); }
.mini-item { display: grid; grid-template-columns: 40px 16px minmax(0, 1fr); gap: 6px; align-items: center; }
.mini-item time { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: var(--fs-0); }
.mini-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-more { border: 0; background: none; padding: 2px 0 0; color: var(--accent); font-weight: 600; font-size: var(--fs-0); cursor: pointer; text-align: left; justify-self: start; }
.day-card-foot { display: grid; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--rule); }
.meal-table th:first-child { width: 90px; }
.progress { height: 6px; border-radius: 3px; background: var(--paper-3); overflow: hidden; }
.progress > div { height: 100%; background: var(--good); border-radius: 3px; }
.activity { display: grid; gap: 6px; font-size: var(--fs-1); }
.activity-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; color: var(--ink-2); }
.activity-item b { color: var(--ink); font-weight: 600; }
.activity-item time { color: var(--ink-3); font-size: var(--fs-0); white-space: nowrap; }

/* ---------- notes ---------- */
.notes-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .notes-layout { grid-template-columns: 1fr; } }
.note-list button { width: 100%; text-align: left; border: 0; border-top: 1px solid var(--rule-2); background: none; padding: 10px 6px; cursor: pointer; display: grid; gap: 2px; }
.note-list button:first-child { border-top: 0; }
.note-list button[aria-selected="true"] { background: var(--paper-2); border-radius: var(--r-1); }
.note-list b { font-size: var(--fs-1); }
.note-list span { font-size: var(--fs-0); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-body { min-height: 220px; line-height: 1.6; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.image-tile { position: relative; border: 1px solid var(--rule); border-radius: var(--r-2); overflow: hidden; background: var(--paper-2); }
.image-tile img { width: 100%; height: 140px; object-fit: cover; cursor: zoom-in; }
.image-tile .btn { position: absolute; top: 6px; right: 6px; }
.image-tile figcaption { font-size: var(--fs-0); color: var(--ink-3); padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropzone { border: 1px dashed var(--rule); border-radius: var(--r-2); padding: 12px; text-align: center; color: var(--ink-3); font-size: var(--fs-1); }
.dropzone.over { border-color: var(--accent); color: var(--accent); }

/* ---------- weather ---------- */
.weather-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
@media (max-width: 760px) { .weather-days { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding-bottom: 8px; } .weather-days > * { flex: 0 0 min(86vw, 340px); scroll-snap-align: start; } }
.weather-card { border: 1px solid var(--rule); border-radius: var(--r-3); padding: 14px; display: grid; gap: 10px; align-content: start; }
.weather-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.weather-temp { font-size: var(--fs-5); font-weight: 700; font-variant-numeric: tabular-nums; }
.weather-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: var(--fs-1); }
.weather-stats span { display: block; color: var(--ink-3); font-size: var(--fs-0); }
.hours { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.hour { flex: 0 0 64px; border: 1px solid var(--rule-2); border-radius: var(--r-1); padding: 6px 4px; text-align: center; font-size: var(--fs-0); display: grid; gap: 2px; }
.hour.rainy { background: var(--accent-soft); border-color: #c6d7fd; }
.hour b { font-size: var(--fs-1); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .app-bar, .tabs, .bottom-nav, .drawer, .backdrop, .toast { display: none !important; }
  .view { padding: 0; max-width: none; }
}

/* ---------- notes (appended) ---------- */
.notes-chips { display: grid; gap: 8px; }
.notes-chips .btn { justify-self: start; }
.notes-chips .chip { white-space: nowrap; }
.dropzone[data-act="dropzone"] .small { color: var(--ink-3); }
textarea.note-body { width: 100%; resize: vertical; }

/* ---------- settings (appended) ---------- */
.settings-form { display: grid; gap: 14px; }
.settings-list { margin: 0; padding: 0; list-style: none; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }

/* ---------- weather (appended) ---------- */
.weather-card { min-width: 0; }
.weather-card .hours { max-width: 100%; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.weather-card select { max-width: 150px; }
.hour { white-space: nowrap; }
