/* 하늘길 web — mobile first (Fold cover screen), two panes from 840px, light/dark.
   Design tokens: brand #4194C3 (primary) · #424242 (ink) · var(--brand-base) (base). Every colour below comes from
   the token block; contrast ratios are listed in docs/redesign-notes.md. */
:root {
  /* brand */
  --brand: #4194C3; --brand-ink: #424242; --brand-base: #FFFFFF;
  /* primary scale (tints/shades of #4194C3) */
  --p-50: #ECF4F9; --p-100: #D9EAF3; --p-300: #A0CAE1; --p-500: #4194C3; --p-600: #316F92; --p-700: #2A607F;
  /* neutral scale (#424242 mixed with white / black) */
  --n-0: #FFFFFF; --n-50: #F7F7F7; --n-100: #EFEFEF; --n-200: #E3E3E3; --n-300: #D0D0D0; --n-500: #6B6B6B;
  --n-700: #4D4D4D; --n-800: #424242; --n-900: #333333; --n-950: #2B2B2B;

  /* semantic (light) */
  --bg: var(--n-50); --surface: var(--n-0); --surface-2: var(--n-100); --line: var(--n-200); --line-strong: var(--n-300);
  --text: var(--n-800); --muted: var(--n-500);
  --primary: var(--p-500);            /* fills, bars, dots, focus ring, indicators (non-text) */
  --primary-text: var(--p-600);       /* links and small primary text: 5.50:1 on white */
  --primary-fill: var(--p-600);       /* solid buttons with white labels: 5.50:1 */
  --primary-fill-hover: var(--p-700);
  --on-primary: #FFFFFF;
  --primary-soft: var(--p-50);        /* selected / hover backgrounds */
  --on-primary-soft: var(--p-700);    /* text on primary-soft: 6.13:1 */
  --primary-muted: var(--p-300);      /* secondary bars (planned budget) */
  --focus: var(--p-600);              /* focus ring: >=4.6:1 on every light surface */
  --danger: #A8433C; --danger-soft: #F7ECEB; --on-danger: #FFFFFF;
  --input-bg: var(--n-100); --input-line: transparent;
  --toast-bg: var(--n-800); --toast-text: #FFFFFF; --toast-action: var(--p-300); --toast-error: #8E3832;
  --scrim: rgba(43, 43, 43, .45);
  --shadow-1: 0 1px 2px rgba(66, 66, 66, .06), 0 1px 1px rgba(66, 66, 66, .04);
  --shadow-2: 0 6px 20px rgba(49, 111, 146, .22);
  --shadow-3: 0 8px 28px rgba(43, 43, 43, .22);
  --card-line: rgba(66, 66, 66, .07);

  /* legacy aliases (kept so nothing that still references them breaks) */
  --accent: var(--primary-text); --accent-2: var(--primary-soft); --on-accent: var(--on-primary);
  --danger-2: var(--danger-soft); --warn: var(--text); --warn-2: var(--surface-2); --ok: var(--primary-text);

  /* spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  /* type scale */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px;
  /* radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  --radius: var(--r-lg);
  --tap: 44px; --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
/* dark: surfaces built on #424242, #4194C3 accents */
:root[data-theme="dark"] {
  --bg: var(--n-900); --surface: var(--n-800); --surface-2: var(--n-700); --line: #595959; --line-strong: #686868;
  --text: #F5F5F5; --muted: #C2C2C2;
  --primary: var(--p-500); --primary-text: #97C4DE; --primary-fill: var(--p-600); --primary-fill-hover: var(--p-700); --on-primary: #FFFFFF;
  --primary-soft: #426376; --on-primary-soft: #F5F5F5; --primary-muted: #5E8BA6; --focus: #7AB4D5;
  --danger: #F0A39C; --danger-soft: #523F3E; --on-danger: #2B2B2B;
  --input-bg: var(--n-900); --input-line: #595959;
  --toast-bg: var(--n-950); --toast-text: #FFFFFF; --toast-action: var(--p-300); --toast-error: #7A302B;
  --scrim: rgba(0, 0, 0, .55);
  --shadow-1: none; --shadow-2: 0 6px 20px rgba(0, 0, 0, .45); --shadow-3: 0 8px 28px rgba(0, 0, 0, .5);
  --card-line: #4D4D4D;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: var(--n-900); --surface: var(--n-800); --surface-2: var(--n-700); --line: #595959; --line-strong: #686868;
    --text: #F5F5F5; --muted: #C2C2C2;
    --primary: var(--p-500); --primary-text: #97C4DE; --primary-fill: var(--p-600); --primary-fill-hover: var(--p-700); --on-primary: #FFFFFF;
    --primary-soft: #426376; --on-primary-soft: #F5F5F5; --primary-muted: #5E8BA6; --focus: #7AB4D5;
    --danger: #F0A39C; --danger-soft: #523F3E; --on-danger: #2B2B2B;
    --input-bg: var(--n-900); --input-line: #595959;
    --toast-bg: var(--n-950); --toast-text: #FFFFFF; --toast-action: var(--p-300); --toast-error: #7A302B;
    --scrim: rgba(0, 0, 0, .55);
    --shadow-1: none; --shadow-2: 0 6px 20px rgba(0, 0, 0, .45); --shadow-3: 0 8px 28px rgba(0, 0, 0, .5);
    --card-line: #4D4D4D;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.78) contrast(1.08) saturate(.8); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.78) contrast(1.08) saturate(.8); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; -webkit-tap-highlight-color: transparent; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-text); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 800; } h2 { font-size: var(--fs-lg); font-weight: 700; } h3 { font-size: var(--fs-md); font-weight: 700; } h4 { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
p { margin: var(--s-1) 0; }
.ic { width: 22px; height: 22px; fill: currentColor; flex: none; vertical-align: middle; }
.flip { transform: scaleX(-1); }
.muted { color: var(--muted); } .small, small { font-size: var(--fs-sm); } .block { display: block; }
.grow { flex: 1 1 auto; min-width: 0; } .center { text-align: center; padding: var(--s-3); }
.pre { white-space: pre-wrap; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: var(--s-2); } .row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.row-end { display: flex; justify-content: flex-end; margin-bottom: var(--s-2); }
.warn-text { color: var(--danger); } .accent { color: var(--primary-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { :not(.leaflet-container *), :not(.leaflet-container *)::before, :not(.leaflet-container *)::after { transition: none !important; animation: none !important; } }
.boot { display: grid; place-items: center; height: 100dvh; font-weight: 800; font-size: var(--fs-xl); color: var(--primary-text); letter-spacing: .02em; }

/* ---------- shell ---------- */
#app.shell { min-height: 100dvh; }
.rail { display: none; }
.main { min-width: 0; }
body.compact .main { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-h); color: var(--muted); text-decoration: none; font-size: var(--fs-xs); font-weight: 600; }
.nav-item .ic { width: 56px; height: 30px; padding: 3px 16px; border-radius: var(--r-pill); transition: background .15s; }
.nav-item.on { color: var(--primary-text); font-weight: 700; }
.nav-item.on .ic { background: var(--primary-soft); color: var(--primary-text); }
body.wide #app.shell { display: grid; grid-template-columns: 80px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
body.wide .rail { display: flex; flex-direction: column; align-items: center; gap: var(--s-1); padding: var(--s-3) 0; background: var(--surface); border-right: 1px solid var(--line); }
body.wide .bottom-nav { display: none; }
body.wide .main { height: 100dvh; overflow: auto; }
body.wide .main:has(> .split) { overflow: hidden; display: flex; flex-direction: column; }
.rail-logo { display: block; margin-bottom: var(--s-3); }
.rail-logo img { width: 40px; height: 40px; border-radius: 11px; display: block; }
.rail .nav-item { flex: none; width: 72px; min-height: 60px; }
.split { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); flex: 1; min-height: 0; height: 100%; }
@media (min-width: 1280px) { .split { grid-template-columns: 440px minmax(0, 1fr); } }
.pane-left { border-right: 1px solid var(--line); min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.pane-right { min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.pane-scroll { overflow: auto; min-height: 0; flex: 1; overscroll-behavior: contain; }
.pane-col { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.center-fill { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
body.wide .page { max-width: 760px; margin: 0 auto; }
/* right pane on wide screens: keep reading width calm instead of stretching rows edge to edge */
body.wide .right-body > .page-pad, body.wide .right-body > .exp-view, body.wide .right-body > .settle-view,
body.wide .right-body > .expense-form { max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; }
body.wide .right-body > .exp-view, body.wide .right-body > .settle-view { padding: 0 var(--s-4); }
.stale-banner { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); background: var(--n-800); color: var(--brand-base); font-size: var(--fs-sm); position: sticky; top: 0; z-index: 30; }
.stale-banner .ic { width: 18px; height: 18px; }

/* ---------- headers ---------- */
.page-head { display: flex; align-items: center; gap: var(--s-2); min-height: 60px; padding: calc(var(--s-3) + var(--safe-t)) var(--s-2) var(--s-2) var(--s-4); }
.page-head h1 { flex: 1; font-size: var(--fs-2xl); }
.page-head .icon-btn:first-child { margin-left: calc(-1 * var(--s-2)); }
.page-pad { padding: var(--s-2) var(--s-4) var(--s-6); }
.sub-head { display: flex; align-items: center; gap: var(--s-2); margin: 0 calc(-1 * var(--s-2)) var(--s-3); }
.sec-title { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); margin: var(--s-5) 0 var(--s-2); display: flex; align-items: center; gap: var(--s-1); }
.sec-title .ic { width: 18px; height: 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; }
.trip-head { display: flex; align-items: center; gap: var(--s-1); padding: calc(var(--s-2) + var(--safe-t)) var(--s-1) var(--s-1); background: var(--bg); }
.trip-head-main { flex: 1; min-width: 0; }
.trip-head-title { font-size: var(--fs-lg); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-head-sub { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; }
.trip-head-actions { display: flex; }
.trip-head-sub .avatar { width: 20px; height: 20px; font-size: 10px; margin-left: -4px; border-width: 1.5px; }
.trip-head-sub .avatars .avatar:first-child { margin-left: 0; }
.tabs { display: flex; gap: 0; padding: 0 var(--s-2); border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
body.compact .trip-page .tabs { position: sticky; top: 0; z-index: 20; }
.tab { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 0 var(--s-3); min-height: 46px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: var(--fs-md); white-space: nowrap; position: relative; }
.tab.on { color: var(--primary-text); }
.tab.on::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }

/* ---------- buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-4); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 700; font-size: var(--fs-md); white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--on-primary-soft); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ic { width: 20px; height: 20px; }
.btn.small { min-height: var(--tap); padding: 0 var(--s-3); font-size: var(--fs-sm); border-radius: var(--r-md); }
.btn.small .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-fill-hover); border-color: var(--primary-fill-hover); color: var(--on-primary); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn.block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.primary.loading::after { border-color: var(--brand-base) transparent var(--brand-base) transparent; }
.btn-row { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; margin: var(--s-3) 0; }
.btn-row.left { justify-content: flex-start; } .btn-row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.btn-row > .btn { flex: 1 1 auto; }
.icon-btn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border: 0; background: transparent; color: var(--text); border-radius: 50%; cursor: pointer; position: relative; flex: none; transition: background .15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: var(--tap); height: var(--tap); }
.icon-btn.small .ic { width: 20px; height: 20px; }
.with-badge .badge { position: absolute; top: 3px; right: 0; min-width: 20px; height: 18px; padding: 0 5px; display: grid; place-items: center; font-size: 10px; line-height: 1; background: var(--primary-fill); color: var(--on-primary); border-radius: var(--r-pill); font-weight: 800; border: 2px solid var(--bg); font-variant-numeric: tabular-nums; }
.input { width: 100%; min-height: var(--tap); padding: 10px var(--s-3); border-radius: var(--r-md); border: 1px solid var(--input-line); background: var(--input-bg); color: var(--text); transition: border-color .15s, background .15s; }
.input::placeholder { color: var(--muted); opacity: 1; }
textarea.input { resize: vertical; }
select.input { padding-right: 28px; }
.input:focus { outline: none; border-color: var(--focus); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.field { display: flex; flex-direction: column; gap: 6px; margin: var(--s-3) 0; min-width: 0; }
.field-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 700; }
.hint { color: var(--muted); font-size: var(--fs-xs); }
.note { color: var(--muted); font-size: var(--fs-sm); background: var(--surface-2); padding: var(--s-3); border-radius: var(--r-md); }
.form-error { color: var(--danger); min-height: 1.2em; font-size: var(--fs-sm); font-weight: 600; }
.input-row { display: flex; gap: var(--s-2); align-items: center; }
.input-row > .input { flex: 1; min-width: 0; }
.input-row > select.input { flex: 0 1 auto; width: auto; max-width: 48%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-3); }
@media (max-width: 360px) { .grid2 { grid-template-columns: 1fr; } }
details.coords, details.fx-manual { margin: var(--s-2) 0; }
details > summary { cursor: pointer; color: var(--primary-text); font-weight: 700; min-height: var(--tap); display: flex; align-items: center; }
.form-group { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); margin: var(--s-3) 0; }
.form-group h4 { margin-top: var(--s-2); }
.form-foot { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + var(--s-2)); padding-top: var(--s-2); }
body.wide .form-foot { bottom: var(--s-3); }

/* seg + chips + switch */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-md); padding: 2px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg.full { display: flex; margin-bottom: var(--s-3); }
.seg.full .seg-item { flex: 1; }
.seg-item { border: 0; background: transparent; min-height: var(--tap); padding: 0 var(--s-3); border-radius: 10px; cursor: pointer; font-weight: 700; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.seg-item.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(43, 43, 43, .14); }
:root[data-theme="dark"] .seg-item.on { background: var(--n-500); color: var(--brand-base); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-theme="dark"]) .seg-item.on { background: var(--n-500); color: var(--brand-base); } }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chips.small { gap: 6px; margin-top: var(--s-2); }
.chip { display: inline-flex; align-items: center; gap: var(--s-1); min-height: var(--tap); padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.chip .ic { width: 16px; height: 16px; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--on-primary-soft); font-weight: 700; }
.chip-x { border: 0; background: transparent; display: inline-grid; place-items: center; padding: 0; cursor: pointer; color: inherit; }
.chips.small .chip { min-height: var(--tap); padding: 0 var(--s-3); font-size: var(--fs-sm); }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px var(--s-2); border-radius: 6px; background: var(--surface-2); font-size: var(--fs-xs); font-weight: 600; color: var(--muted); white-space: nowrap; }
.tag .ic { width: 14px; height: 14px; }
.tag.accent { background: var(--primary-soft); color: var(--on-primary-soft); }
.tag.spent { color: var(--text); background: var(--surface-2); }
.tag.done { color: var(--on-primary-soft); background: var(--primary-soft); display: inline-block; margin-top: 2px; }
.tag.muted-tag { opacity: .85; }
.switch-row { display: flex; align-items: center; gap: var(--s-3); min-height: 52px; padding: 6px 0; cursor: pointer; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: -7px -2px; margin: 0; cursor: pointer; width: calc(100% + 4px); height: calc(100% + 14px); }
.switch-ui { position: absolute; inset: 0; background: var(--line-strong); border-radius: var(--r-pill); transition: background .15s; pointer-events: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-base); transition: transform .15s; box-shadow: 0 1px 3px rgba(43, 43, 43, .3); }
.switch input:checked + .switch-ui { background: var(--primary-fill); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--focus); outline-offset: 2px; }

/* cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); border: 1px solid var(--card-line); padding: var(--s-4); margin: var(--s-3) 0; }
.card h3 { margin-bottom: var(--s-2); }
.empty { text-align: center; padding: var(--s-8) var(--s-4); color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.empty p { margin: 0; max-width: 28em; }
.empty-ic { width: 72px; height: 72px; padding: 18px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.loading-box { display: flex; align-items: center; justify-content: center; gap: var(--s-3); padding: var(--s-8) 0; color: var(--muted); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; margin: var(--s-2) 0 var(--s-1); }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: var(--r-pill); }
.bar.over > span { background: var(--danger); }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
/* labels break only between words (Korean labels like 주소 used to break one syllable per line) */
.kv .k { color: var(--muted); min-width: 0; flex: 0 0 auto; max-width: 50%; word-break: keep-all; overflow-wrap: normal; }
.kv .v { text-align: right; font-variant-numeric: tabular-nums; min-width: 0; flex: 1 1 auto; }
button.kv .k, .bd-group .kv .k { flex: 1 1 auto; max-width: none; color: var(--text); overflow-wrap: anywhere; }
button.kv .v, .bd-group .kv .v { flex: none; }
.kv.total { font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; }
.kv.total .k { color: var(--text); }
.row-btn { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; min-height: var(--tap); align-items: center; }
.row-btn:hover { background: var(--surface-2); }
.warn-row { display: flex; align-items: center; gap: var(--s-2); width: 100%; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); border: 0; border-left: 3px solid var(--danger); margin: var(--s-2) 0; text-align: left; cursor: pointer; font-size: var(--fs-sm); }
.warn-row .ic { color: var(--danger); }
.avatars { display: inline-flex; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 700; border: 2px solid var(--surface); margin-left: -6px; flex: none; }
.avatars .avatar:first-child { margin-left: 0; }
.avatar.more { background: var(--surface-2); color: var(--muted); }
.big { font-size: var(--fs-xl); font-weight: 800; display: block; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* FAB */
.fab { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + var(--s-4)); margin: var(--s-3) var(--s-4) var(--s-3) auto; display: flex; width: fit-content; align-items: center; gap: var(--s-2); min-height: 52px; padding: 0 var(--s-5) 0 var(--s-4); border-radius: var(--r-lg); border: 0; background: var(--primary-fill); color: var(--on-primary); font-weight: 800; font-size: var(--fs-md); box-shadow: var(--shadow-2); cursor: pointer; z-index: 10; }
.fab:hover { background: var(--primary-fill-hover); }
body.wide .fab { bottom: var(--s-5); }

/* ---------- login ---------- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); background: var(--surface); }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: var(--shadow-2); }
.login-card h1 { font-size: 28px; margin-top: var(--s-4); letter-spacing: .02em; }
.login-card h1 + p { margin-top: var(--s-1); }
.login-form { text-align: left; margin-top: var(--s-6); }
.pw-wrap { position: relative; } .pw-wrap .input { padding-right: 48px; }
.pw-eye { position: absolute; right: 0; top: 0; color: var(--muted); }
.login-form .btn.primary { margin-top: var(--s-2); min-height: 48px; }
.login-foot { margin-top: var(--s-6); font-size: var(--fs-xs); }

/* ---------- trip list ---------- */
.trip-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); border: 1px solid var(--card-line); padding: var(--s-3) var(--s-2) var(--s-4) var(--s-4); margin: var(--s-3) 0; cursor: pointer; transition: border-color .15s; }
.trip-card:hover { border-color: var(--line-strong); }
.trip-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.trip-card.is-hidden { opacity: .7; }
.trip-card > .row-between:first-child { margin-right: -2px; }
.trip-title { font-size: var(--fs-lg); font-weight: 800; }
.trip-card .chips.small { margin-top: 0; }
.trip-dates { color: var(--muted); font-size: var(--fs-sm); margin: 2px 0 var(--s-2); padding-right: var(--s-2); }
.trip-card > .row-between { padding-right: var(--s-2); }
.trip-card > .row-between:first-child { padding-right: 0; }
.trip-status { font-size: var(--fs-sm); font-weight: 700; color: var(--primary-text); }
.trip-budget { margin-top: var(--s-3); padding: var(--s-3) var(--s-2) 0 0; font-size: var(--fs-sm); border-top: 1px solid var(--line); color: var(--muted); }
.trip-budget .row-between span:last-child { color: var(--text); font-weight: 700; }
.between-card { display: flex; align-items: center; gap: var(--s-2); color: var(--on-primary-soft); background: var(--primary-soft); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; margin-top: var(--s-3); }

/* ---------- timeline ---------- */
.tl-pane { display: flex; flex-direction: column; min-height: 0; }
.tl-pane.wide { flex: 1; }
.tl-pane.wide .tl-scroll { flex: 1; overflow: auto; overscroll-behavior: contain; }
.day-chips { display: flex; gap: var(--s-2); overflow-x: auto; padding: var(--s-2) var(--s-3); scrollbar-width: none; background: var(--bg); }
body.compact .trip-page .day-chips { position: sticky; top: 47px; z-index: 19; border-bottom: 1px solid var(--line); }
.day-chip { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 72px; min-height: 50px; padding: var(--s-1) var(--s-3); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: var(--fs-xs); color: var(--muted); line-height: 1.3; }
.day-chip strong { color: var(--text); font-size: var(--fs-sm); }
.day-chip.on { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--on-primary); }
.day-chip.on strong { color: var(--on-primary); }
.day-chip.today:not(.on) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.day-chip.drop-target { outline: 3px dashed var(--primary); }
.tl-toolbar { display: flex; align-items: center; gap: var(--s-1); padding: var(--s-2) var(--s-1) var(--s-1) var(--s-4); }
.tl-toolbar h2 { font-size: var(--fs-md); }
.timeline { padding: 0 0 0 2px; position: relative; }
.tl-item { display: grid; grid-template-columns: 62px 30px minmax(0, 1fr) var(--tap); align-items: stretch; position: relative; }
.tl-time { text-align: right; padding: 14px 4px 0 0; font-size: var(--fs-xs); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.3; color: var(--text); }
.tl-time span { font-weight: 700; white-space: nowrap; } .tl-time small { display: block; white-space: nowrap; font-size: 11px; color: var(--muted); }
.tl-rail { position: relative; display: flex; justify-content: center; }
.tl-rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--line); transform: translateX(-50%); }
.tl-rail.dashed::before { background: repeating-linear-gradient(var(--line-strong) 0 4px, transparent 4px 8px); }
.tl-dot { position: relative; margin-top: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--brand-base); display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg); }
.tl-dot .ic { width: 15px; height: 15px; }
.tl-mini { position: relative; margin-top: 11px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line-strong); color: var(--muted); display: grid; place-items: center; }
.tl-mini .ic { width: 13px; height: 13px; }
.plan-card { margin: 6px 0; padding: var(--s-3) var(--s-1) var(--s-3) var(--s-3); cursor: pointer; }
.tl-card.selected .plan-card { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-top { display: flex; align-items: flex-start; gap: var(--s-2); }
.plan-top > .icon-btn.small { margin: -10px -2px -10px 0; }
.num-badge { flex: none; display: grid; place-items: center; min-width: 20px; height: 20px; border-radius: var(--r-pill); background: var(--primary-fill); color: var(--on-primary); font-size: 11px; font-weight: 800; margin-top: 1px; padding: 0 5px; font-variant-numeric: tabular-nums; }
.plan-titles { flex: 1; min-width: 0; }
.plan-title { font-size: var(--fs-md); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-place { font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 0; }
.plan-memo { font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; margin: var(--s-2) 0 0; padding-right: var(--s-2); }
.plan-card .chips.small { padding-right: var(--s-2); }
.photo-strip { display: flex; gap: var(--s-1); margin-top: var(--s-2); }
.thumb { width: 56px; height: 56px; border-radius: var(--r-sm); overflow: hidden; border: 0; padding: 0; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--muted); font-weight: 700; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; margin: 6px 0; }
.photo-grid .thumb { width: 100%; height: auto; aspect-ratio: 1; }
.drag-handle { border: 0; background: transparent; color: var(--line-strong); cursor: grab; display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; width: var(--tap); min-height: var(--tap); align-self: center; border-radius: var(--r-md); }
.drag-handle:hover { color: var(--muted); background: var(--surface-2); }
:root[data-theme="dark"] .drag-handle { color: var(--muted); }
.drag-handle .ic { width: 20px; height: 20px; }
.drag-handle.small { min-height: var(--tap); }
.dragging { z-index: 50; position: relative; opacity: .95; }
.dragging .card, .dragging .move-body, .dragging.check-item { box-shadow: var(--shadow-3); }
body.is-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.tl-move .move-body, .tl-hint .hint-body { margin: 2px 0; border: 0; background: transparent; text-align: left; padding: var(--s-2) var(--s-2); min-height: var(--tap); cursor: pointer; font-size: var(--fs-sm); display: flex; align-items: center; flex-wrap: wrap; gap: 2px; border-radius: var(--r-md); min-width: 0; color: var(--text); }
.tl-move .move-body:hover, .tl-hint .hint-body:hover { background: var(--surface-2); }
.tl-hint .hint-body { color: var(--muted); font-size: var(--fs-xs); }
.tl-hint .hint-body .ic, .tl-move .move-body .ic { width: 15px; height: 15px; }
.memo-card { margin: 6px 0; background: var(--surface-2); border: 0; box-shadow: none; padding: var(--s-2) var(--s-1) var(--s-3) var(--s-3); cursor: pointer; }
.memo-card .plan-top { align-items: center; }
.memo-card .plan-top > .icon-btn.small { margin: -6px -2px -6px 0; }
.memo-text { white-space: pre-wrap; margin: var(--s-1) 0 0; padding-right: var(--s-2); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.memo-card.expanded .memo-text { display: block; }
.tz-divider { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-3) var(--s-2) 6px; color: var(--primary-text); font-size: var(--fs-xs); font-weight: 700; }
.tz-divider::before, .tz-divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--primary) 45%, transparent); }
.acc-banner { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-2) var(--s-2) var(--s-2) 62px; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--primary-soft); color: var(--on-primary-soft); font-size: var(--fs-sm); font-weight: 600; }
.acc-banner .ic { width: 18px; height: 18px; }
.empty-day { padding: var(--s-6) var(--s-4) var(--s-2); text-align: center; }
.tl-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-4) var(--s-4) var(--s-5); }
.tl-actions .btn { flex: 1 1 calc(50% - var(--s-2)); }
.tl-actions .wide-btn { flex-basis: 100%; }
.sel-box { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--primary-fill); }
.sel-bar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); background: var(--surface); border-top: 1px solid var(--line); z-index: 25; flex-wrap: wrap; }
body.wide .sel-bar { bottom: 0; }

/* plan detail */
.plan-detail { padding: var(--s-1) 2px var(--s-4); }
.pane-right .plan-detail { padding: var(--s-2) var(--s-4) var(--s-6); max-width: 760px; }
.detail-head { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-1) calc(-1 * var(--s-2)) var(--s-2); }
.kvs { margin: var(--s-3) 0; }
.link-row { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-2) 0; }
.detail-sec { margin: var(--s-4) 0; } .detail-sec h3 { margin-bottom: var(--s-1); }
.detail-actions { margin-top: var(--s-5); }
.map-detail { display: flex; flex-direction: column; height: 100%; }
.map-top { flex: 0 0 42%; min-height: 220px; display: flex; }
.map-top .map-view { flex: 1; }
.detail-bottom { flex: 1; overflow: auto; border-top: 1px solid var(--line); }
.right-body.map-host { overflow: hidden; display: flex; }
.right-body:has(.map-detail) { overflow: hidden; }

/* ---------- map ---------- */
.map-view { display: flex; flex-direction: column; height: calc(100dvh - 210px - var(--safe-b)); min-height: 320px; }
body.wide .map-view { height: 100%; flex: 1; }
.map-filter { padding: var(--s-2) var(--s-3); overflow-x: auto; scrollbar-width: none; }
.map-filter .chips { flex-wrap: nowrap; }
.map-filter .chip { flex: none; }
.map-stage { position: relative; flex: 1; min-height: 0; }
.map-canvas { position: absolute; inset: 0; background: var(--surface-2); }
.map-fab { position: absolute; right: var(--s-3); bottom: var(--s-6); z-index: 500; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-3); display: grid; place-items: center; cursor: pointer; }
.map-msg { position: absolute; left: var(--s-3); right: 72px; bottom: var(--s-6); z-index: 500; pointer-events: none; }
.map-msg span { display: inline-block; background: var(--surface); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); box-shadow: var(--shadow-3); font-size: var(--fs-sm); }
.map-missing-box { position: absolute; top: var(--s-3); left: var(--s-3); right: var(--s-3); z-index: 500; display: flex; justify-content: center; pointer-events: none; }
.map-missing { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--s-4); border-radius: var(--r-pill); border: 1px solid var(--primary); background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; max-width: 100%; }
.map-missing .ic { width: 18px; height: 18px; color: var(--primary-text); flex: none; }
.map-missing strong { color: var(--primary-text); white-space: nowrap; }
.map-num span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--brand-base); font-weight: 800; font-size: 13px; border: 2px solid var(--brand-base); box-shadow: 0 1px 4px rgba(43, 43, 43, .45); }
.map-num.bed span { background: var(--n-800) !important; font-size: 14px; }
.seg-label { background: var(--surface); border: 0; box-shadow: var(--shadow-1); font-size: 11px; padding: 1px 6px; color: var(--text); border-radius: 6px; }
.map-pop { min-width: 180px; font-family: var(--font); }
.map-pop .link-row { margin-top: 6px; }
.map-pop .btn.small { min-height: 36px; padding: 0 var(--s-2); font-size: var(--fs-xs); }
.leaflet-container { font-family: var(--font); }
.leaflet-container a.leaflet-popup-close-button { width: 32px; height: 32px; font-size: 22px; line-height: 30px; }
.leaflet-bar a { color: var(--n-800); }

/* ---------- reservations, budget, money ---------- */
.res-card { cursor: pointer; }
.res-card h3 { display: flex; align-items: center; gap: var(--s-1); }
.res-card h3 .ic { width: 20px; height: 20px; color: var(--muted); }
.res-card .row-between { align-items: flex-start; }
.res-cost { font-weight: 800; margin-top: var(--s-2); font-variant-numeric: tabular-nums; }
.res-sec + .res-sec { margin-top: var(--s-2); }
.empty-line { padding: var(--s-2) 2px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.hero .bar { height: 10px; margin-top: var(--s-3); }
.bd-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--s-2); align-items: center; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.bd-row:last-child { border-bottom: 0; }
.bd-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; }
.bd-label .ic { width: 18px; height: 18px; color: var(--muted); }
.bd-bar { position: relative; display: flex; align-items: center; gap: 6px; }
.bd-bar > span { height: 8px; border-radius: var(--r-pill); background: var(--primary-muted); min-width: 2px; flex: none; }
.bd-bar.spent > span { background: var(--primary); }
.bd-bar small { white-space: nowrap; color: var(--muted); font-size: var(--fs-xs); }
.bd-bar.spent small { color: var(--text); }
.bd-group { margin: var(--s-3) 0; } .bd-group h4 { margin: 6px 0; }
/* 예상 vs 지출 (B-3): category rows (a button when there are expenses to show) and over/under */
.bd-row { grid-template-columns: 88px minmax(0, 1fr) 18px; }
button.bd-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; cursor: pointer; padding-left: 0; padding-right: 0; font: inherit; }
button.bd-row:last-child { border-bottom: 0; }
button.bd-row:hover { background: var(--surface-2); }
.bd-bars { display: block; min-width: 0; }
.bd-go { width: 18px; height: 18px; color: var(--muted); }
.bd-bar.unknown small { white-space: normal; }
.bd-diff { display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.bd-diff.over { color: var(--danger); }
.bd-row.over .bd-bar.spent > span { background: var(--danger); }
.verdict { font-weight: 700; } .verdict.over { color: var(--danger); }
.hero-grid .big { overflow-wrap: anywhere; }
.hero-link { margin-top: var(--s-2); }

/* money in the entered currency, won second (B-2) */
.tag.money { white-space: normal; flex-wrap: wrap; column-gap: var(--s-1); }
.tag.money .approx { font-weight: 500; }
.row-between.wrap { flex-wrap: wrap; }

/* missing rates (B-1): a gentle hint, rate rows, rate sheet */
.fx-hint { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-2) var(--s-3); margin: var(--s-2) 0; border-radius: var(--r-md); background: var(--primary-soft); color: var(--on-primary-soft); font-size: var(--fs-sm); font-weight: 600; }
.fx-hint .grow { flex: 1 1 160px; }
.fx-row { min-height: 56px; gap: var(--s-2); }
.fx-row > .ic { flex: none; width: 18px; height: 18px; color: var(--muted); }
button.fx-row .v { margin-left: auto; }
.fx-missing { display: inline-block; padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); background: var(--primary-soft); color: var(--on-primary-soft); font-weight: 700; font-size: var(--fs-sm); }
.rate-input { font-size: var(--fs-xl); font-weight: 800; flex: 1; min-width: 0; }
.rate-unit { font-weight: 700; color: var(--muted); }
.rate-preview { color: var(--muted); font-size: var(--fs-sm); min-height: 1.5em; font-variant-numeric: tabular-nums; }
.fx-preview .btn { margin-top: var(--s-1); }
.help-code { background: var(--surface-2); padding: var(--s-3); border-radius: var(--r-md); font-size: var(--fs-sm); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.filters { margin: var(--s-2) 0; display: flex; flex-direction: column; gap: var(--s-1); }
.filters .chips.small { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-top: 0; }
.filters .chip { flex: none; }
.small-select { width: auto; min-height: var(--tap); padding: 0 26px 0 var(--s-2); font-size: var(--fs-sm); }
.exp-group { margin: var(--s-4) 0; }
.exp-date { display: flex; justify-content: space-between; font-size: var(--fs-sm); font-weight: 700; color: var(--muted); padding: 0 2px var(--s-1); border-bottom: 1px solid var(--line); }
.exp-row { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-1); border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); min-height: 60px; }
.exp-row:hover { background: var(--surface-2); }
.exp-ic { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; flex: none; color: var(--primary-text); }
.exp-ic .ic { width: 18px; height: 18px; }
.exp-main { flex: 1; min-width: 0; }
.exp-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.exp-amt { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.exp-amt strong { font-weight: 800; }
.member-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 var(--s-3); }
.member-card .row { margin-bottom: var(--s-1); }
.member-card .avatar { margin-left: 0; }
.net { margin-top: var(--s-2); font-weight: 800; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface-2); }
.net.plus { color: var(--on-primary-soft); background: var(--primary-soft); }
.net.minus { color: var(--danger); background: var(--danger-soft); }
.transfer { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); min-height: var(--tap); }
.transfer:last-child { border-bottom: 0; }
.fund-line { font-weight: 800; margin-top: var(--s-2); }
.expense-form { max-width: 640px; margin: 0 auto; }
.amount-row { display: flex; gap: var(--s-2); align-items: center; margin: 6px 0; }
.amount-input { font-size: 28px; font-weight: 800; min-height: 60px; text-align: right; flex: 1; min-width: 0; }
.amount-row .cur-select { width: auto; max-width: 46%; min-height: 60px; }
.fx-preview { min-height: 1.4em; text-align: right; color: var(--muted); }
.fx-preview strong { color: var(--text); }
.budget-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: var(--s-2); align-items: center; }
.budget-row > :nth-child(4) { grid-column: 1 / 2; }
.budget-row > .icon-btn { justify-self: end; }
.budget-row .cur-select { width: 100%; max-width: none; }
.suggest { display: flex; flex-direction: column; }
.suggest-item { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: var(--s-2) var(--s-1); cursor: pointer; min-height: var(--tap); }
.suggest-item:hover { background: var(--surface-2); }

/* calendar */
.cal { border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px; background: var(--surface); }
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-title { display: flex; align-items: center; gap: var(--s-2); }
.cal-year { width: auto; min-height: var(--tap); padding: 0 26px 0 var(--s-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { text-align: center; font-size: var(--fs-xs); color: var(--muted); padding: var(--s-1) 0; font-weight: 600; }
.cal-wd.sun { color: var(--danger); } .cal-wd.sat { color: var(--primary-text); }
.cal-day { aspect-ratio: 1; min-height: 40px; max-height: 48px; border: 0; background: transparent; border-radius: var(--r-md); cursor: pointer; font-variant-numeric: tabular-nums; color: var(--text); }
.cal-day:hover { background: var(--surface-2); }
.cal-day.today { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.cal-day.in { background: var(--primary-soft); color: var(--on-primary-soft); border-radius: 0; }
.cal-day.start, .cal-day.end { background: var(--primary-fill); color: var(--on-primary); font-weight: 800; border-radius: var(--r-md); }
.cal-info { text-align: center; font-size: var(--fs-sm); margin: 6px 0 2px; }

/* checklist, docs, members */
.progress-line { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-line .bar { margin: 0; }
.check-items { display: flex; flex-direction: column; }
.check-item { display: flex; align-items: center; gap: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.check-row { display: flex; align-items: center; gap: var(--s-3); min-height: 48px; cursor: pointer; padding: var(--s-1) 2px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--primary-fill); flex: none; margin: 0; }
.check-item.done .check-row span { text-decoration: line-through; color: var(--muted); }
.check-list { display: flex; flex-direction: column; max-height: 45dvh; overflow: auto; }
.doc-list { margin-top: var(--s-3); }
.doc-row { display: flex; align-items: center; gap: var(--s-1); border-bottom: 1px solid var(--line); }
.doc-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-3); text-align: left; background: transparent; border: 0; padding: var(--s-3) 2px; cursor: pointer; min-height: var(--tap); }
.doc-ic { width: 28px; height: 28px; color: var(--primary); }
.upload-progress { margin: var(--s-2) 0; color: var(--primary-text); font-weight: 700; }
.member-row { display: flex; align-items: center; gap: var(--s-2); min-height: 52px; border-bottom: 1px solid var(--line); }
.member-row .avatar { margin-left: 0; width: 34px; height: 34px; font-size: 13px; background: var(--primary-soft); color: var(--on-primary-soft); }
.share-url { margin: var(--s-3) 0; }
.action-list { display: flex; flex-direction: column; }
.action-item { display: flex; align-items: center; gap: var(--s-4); min-height: 52px; padding: var(--s-2) var(--s-2); border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; border-radius: 0; color: var(--text); width: 100%; font-weight: 600; }
.action-item:last-child { border-bottom: 0; }
.action-item:hover { background: var(--surface-2); }
.action-item:disabled { opacity: .45; cursor: default; }
.action-item .ic { color: var(--muted); width: 22px; height: 22px; }
.action-item.danger, .action-item.danger .ic { color: var(--danger); }
.gal-day { margin-bottom: var(--s-4); } .gal-day h4 { margin-top: var(--s-2); }

/* now + settings */
.now-card { cursor: pointer; }
.now-card .row .ic { color: var(--primary); }
.now-trip a { font-weight: 800; text-decoration: none; }
.now-row { display: flex; align-items: center; gap: var(--s-3); min-height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; }
.now-row input { width: 22px; height: 22px; accent-color: var(--primary-fill); margin: 0; }
.now-row.done span { color: var(--muted); text-decoration: line-through; }
.now-time { width: 74px; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.set-sec .sec-title { margin-left: var(--s-1); }
.set-card { padding: 0 var(--s-4); }
.set-row { display: flex; align-items: center; gap: var(--s-3); min-height: 56px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; padding: var(--s-2) 0; flex-wrap: wrap; color: var(--text); }
div.set-row { cursor: default; }
.set-row:last-child, .set-card > .switch-row:last-child { border-bottom: 0; }
.set-card > .switch-row { border-bottom: 1px solid var(--line); }
.set-row > .ic { color: var(--muted); width: 20px; height: 20px; }
.set-row .seg { flex: none; }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .18s; }
.sheet.open .sheet-scrim { opacity: 1; }
.sheet-panel { position: relative; width: 100%; max-height: 92dvh; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .2s ease-out; padding-bottom: var(--safe-b); outline: none; box-shadow: var(--shadow-3); }
.sheet.open .sheet-panel { transform: none; }
.sheet-panel.full { height: 92dvh; }
.sheet-handle { width: 100%; height: 20px; flex: none; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-handle::before { content: ""; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: center; gap: var(--s-1); padding: 0 var(--s-2) var(--s-1) var(--s-5); flex: none; min-height: 48px; }
.sheet-title { flex: 1; font-size: var(--fs-lg); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow: auto; padding: var(--s-1) var(--s-5) var(--s-4); flex: 1; overscroll-behavior: contain; }
.sheet-foot { padding: var(--s-3) var(--s-5) var(--s-3); border-top: 1px solid var(--line); flex: none; }
.sheet-foot:empty { display: none; }
.sheet-foot .btn-row { margin: 0; }
.sheet.dialog .sheet-panel, .sheet.actions .sheet-panel { max-width: 520px; }
.sheet.actions .sheet-body { padding-left: var(--s-3); padding-right: var(--s-3); }
.dialog-msg { white-space: pre-wrap; margin: var(--s-1) 0 var(--s-2); }
body.wide .sheet { align-items: center; }
body.wide .sheet-panel { width: min(560px, 92vw); max-height: 88dvh; border-radius: var(--r-xl); transform: translateY(16px) scale(.98); opacity: 0; transition: transform .18s, opacity .18s; }
body.wide .sheet.open .sheet-panel { transform: none; opacity: 1; }
body.wide .sheet-handle { height: 12px; } body.wide .sheet-handle::before { display: none; }
body.wide .sheet-panel.full { width: min(980px, 94vw); height: 90dvh; }
.sheet.viewer .sheet-panel { background: #000; color: #fff; height: 100dvh; max-height: 100dvh; border-radius: 0; width: 100%; }
body.wide .sheet.viewer .sheet-panel { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
.sheet.viewer .sheet-head .icon-btn { color: #fff; }
.sheet.viewer .sheet-body { padding: 0; display: flex; }
.viewer { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.viewer-stage { flex: 1; display: grid; place-items: center; overflow: hidden; touch-action: none; min-height: 0; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.viewer-nav { position: absolute; top: 45%; width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; display: grid; place-items: center; cursor: pointer; }
.viewer-nav.prev { left: var(--s-2); } .viewer-nav.next { right: var(--s-2); }
.viewer-bar { padding: var(--s-2) var(--s-4) var(--s-4); background: rgba(0, 0, 0, .6); }
.viewer-bar .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.viewer-count { font-size: var(--fs-xs); opacity: .75; }
.viewer-cap { margin: var(--s-1) 0; }

/* toast */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + var(--s-3)); z-index: 2000; display: flex; justify-content: center; pointer-events: none; padding: 0 var(--s-3); }
body.wide #toast-root { bottom: var(--s-5); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s-3); max-width: 520px; width: 100%; background: var(--toast-bg); color: var(--toast-text); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); box-shadow: var(--shadow-3); transform: translateY(20px); opacity: 0; transition: transform .2s, opacity .2s; font-size: var(--fs-sm); min-height: 48px; }
.toast.show { transform: none; opacity: 1; }
.toast.error { background: var(--toast-error); }
.toast-action { border: 0; background: transparent; color: var(--toast-action); font-weight: 800; cursor: pointer; min-height: var(--tap); padding: 0 var(--s-2); margin: -10px -8px -10px auto; }

/* ---------- print page ---------- */
.print-page { max-width: 820px; margin: 0 auto; padding: 0 var(--s-4) 40px; }
.print-opts { position: sticky; top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); padding: var(--s-2) 0; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 5; }
.print-opts label { display: flex; align-items: center; gap: 6px; min-height: var(--tap); cursor: pointer; }
.print-opts input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary-fill); }
.print-head { padding: var(--s-4) 0 var(--s-2); border-bottom: 2px solid var(--text); }
.print-brand { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); margin-bottom: var(--s-1); }
.print-brand img { width: 16px; height: 16px; border-radius: 4px; }
.print-day { margin: var(--s-5) 0; }
.print-day h2 { font-size: var(--fs-md); border-bottom: 1px solid var(--line); padding-bottom: var(--s-1); margin-bottom: 6px; }
.print-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.print-table td, .print-table th { padding: 5px 6px; vertical-align: top; border-bottom: 1px solid var(--line); text-align: left; }
.print-table td.time { width: 90px; white-space: nowrap; }
.print-table td.amt, .print-table th:nth-child(4), .print-table th:nth-child(5) { text-align: right; white-space: nowrap; }
.print-table tr.tz td { text-align: center; color: var(--primary-text); font-weight: 700; font-size: var(--fs-xs); }
.print-table tr.move td { color: var(--muted); font-size: var(--fs-xs); }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root, :root[data-theme] { --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --line: #bbb; --primary-text: #000; --accent: #000; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .no-print, .bottom-nav, .rail, #toast-root, #overlay-root { display: none !important; }
  body.compact .main { padding: 0; }
  .print-page { max-width: none; padding: 0; }
  .print-day.break { break-before: page; }
  .print-table tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* small additions for the cleaned-up markup */
.trip-tags { margin: 0 0 var(--s-2); }
.map-num .ic { width: 15px; height: 15px; }
/* the stay-duration select had to share its row with a hidden "custom minutes" input and was cut off */
.input-row:has(> .input[hidden]) > select.input { flex: 1 1 auto; max-width: none; }
/* grey secondary text inside tinted boxes takes the box's own text colour (dark #C2C2C2 on #426376 was 3.6:1) */
.net .muted, .acc-banner .muted, .between-card .muted, .chip.on .muted, .cal-day.in .muted { color: inherit; }

/* ---------- plan form: location picker (P-1), time-order hint (P-4) ---------- */
.btn[hidden], .pick-area[hidden] { display: none !important; }  /* .btn sets display, which beats the hidden attribute */
.pick-btns { margin: 0; }
.pick-area { margin-top: var(--s-2); }
.pick-map { height: 240px; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); touch-action: none; }
@media (min-height: 760px) { .pick-map { height: 280px; } }
.pick-status { display: block; margin-top: var(--s-1); }
.leaflet-div-icon.pick-pin, .pick-pin { background: none; border: 0; }
.pick-pin span { display: block; width: 30px; height: 30px; margin: 0 auto; border-radius: 50% 50% 50% 0; background: var(--primary-fill); border: 3px solid var(--brand-base); transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(43, 43, 43, .45); }
.pick-pin span::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--brand-base); }
.pick-pin span { position: relative; }
.sort-hint { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-1) var(--s-3) var(--s-2); padding: var(--s-1) var(--s-1) var(--s-1) var(--s-3); border-radius: var(--r-md); background: var(--primary-soft); color: var(--on-primary-soft); font-size: var(--fs-sm); }
.sort-hint > .ic { width: 18px; height: 18px; flex: none; }
.sort-hint .btn.small { white-space: nowrap; }
