:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1f2433;
  --muted: #6b7080;
  --line: #e6e2d8;
  --accent: #d9483b;
  --both: #1f2433;
  --sumin: #3a6fd8;
  --sumin-soft: #e7eefc;
  --oseong: #e07a22;
  --oseong-soft: #fdeedd;
  --ok: #2f9e5b;
  --warn-soft: #fff4d6;
  --meet-soft: #e3f3e7;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161d;
    --card: #1e212b;
    --ink: #eceae4;
    --muted: #9a9eab;
    --line: #2c303c;
    --sumin-soft: #1d2a45;
    --oseong-soft: #3a2a1b;
    --warn-soft: #3a3320;
    --meet-soft: #1c3324;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 640px; margin: 0 auto; }
.eyebrow { font-size: 12px; color: var(--muted); }
.dday { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.me { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.me button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.me button.on[data-me="수민"] { background: var(--sumin); color: #fff; }
.me button.on[data-me="오성"] { background: var(--oseong); color: #fff; }

main { max-width: 640px; margin: 0 auto; padding: 14px 16px; }
h2 { font-size: 17px; margin: 22px 0 10px; letter-spacing: -.01em; }
h2:first-child { margin-top: 4px; }
h2 .count { color: var(--muted); font-weight: 500; font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stack > * + * { margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.banner { border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.banner.meet { background: var(--meet-soft); font-weight: 600; }
.banner.warn { background: var(--warn-soft); }
.banner + .banner { margin-top: 8px; }

.hero { background: var(--ink); color: var(--bg); border-radius: var(--radius); padding: 16px; }
.hero .label { font-size: 12px; opacity: .7; }
.hero .big { font-size: 20px; font-weight: 800; margin: 2px 0; }
.hero .next { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.18); font-size: 14px; }

/* tasks */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; }
.task + .task { border-top: 1px solid var(--line); }
.check {
  flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line);
  background: none; display: grid; place-items: center; margin-top: 1px;
}
.task.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .t-what { text-decoration: line-through; color: var(--muted); }
.t-what { font-weight: 600; }
.t-meta { font-size: 12px; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--ink); margin-right: 4px; }
.pill.sumin { background: var(--sumin-soft); color: var(--sumin); }
.pill.oseong { background: var(--oseong-soft); color: var(--oseong); }
.pill.due-soon { background: var(--accent); color: #fff; }
.list { padding: 0; overflow: hidden; }

/* decisions */
.decision { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 12px 14px; }
.decision .d-topic { font-weight: 700; }
.decision .d-status { font-size: 12px; margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }

/* day timeline */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.today::after { content: " · 오늘"; color: var(--accent); }
.filter { display: flex; gap: 6px; margin: 10px 0; }
.filter .chip { font-weight: 500; }

.tl { list-style: none; margin: 12px 0 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl .time { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; padding-top: 1px; }
.tl .what { font-weight: 600; }
.tl .where { font-size: 13px; color: var(--muted); }
.tl .note { font-size: 13px; margin-top: 3px; }
.tl li.sumin .body { border-left: 3px solid var(--sumin); padding-left: 8px; }
.tl li.oseong .body { border-left: 3px solid var(--oseong); padding-left: 8px; }
.tl li.now { background: var(--warn-soft); margin: 0 -10px; padding: 10px; border-radius: 10px; }
.tl li.past { opacity: .5; }
.tl li.section { display: block; padding: 0; border: 0; }
.tl li.section button { width: 100%; text-align: left; border: 0; background: var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0 2px; font-size: 13px; font-weight: 700; }
.tl li.hidden { display: none; }

/* money */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > div { height: 100%; background: var(--ok); }
.bar.over > div { background: var(--accent); }

form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
form.grid .full { grid-column: 1 / -1; }
label.f { display: block; font-size: 12px; color: var(--muted); }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 3px;
}
textarea { min-height: 70px; resize: vertical; }
.btn { border: 0; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px; font-weight: 700; width: 100%; }
.btn.ghost { background: none; color: var(--muted); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; }

.row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; align-items: center; }
.row + .row { border-top: 1px solid var(--line); }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.x { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 0 4px; }

details.card > summary { cursor: pointer; font-weight: 700; list-style: none; }
details.card > summary::after { content: "펼치기"; float: right; font-size: 12px; color: var(--muted); font-weight: 500; }
details.card[open] > summary::after { content: "접기"; }
details.card[open] > summary { margin-bottom: 8px; }

.booking .b-name { font-weight: 700; }
.booking .b-no { font-family: ui-monospace, Menlo, monospace; font-weight: 700; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 2px 8px; display: inline-block; margin-top: 4px; }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; background: none; padding: 14px 0 12px; font-size: 14px; font-weight: 600; color: var(--muted); }
.tabs button.on { color: var(--ink); box-shadow: inset 0 3px 0 var(--accent); }

/* dialog */
.sheet {
  border: 0; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  width: 100%; max-width: 640px; margin: auto auto 0; max-height: 88vh; overflow-y: auto;
  background: var(--card); color: var(--ink);
}
.sheet::backdrop { background: rgba(0,0,0,.45); }
.sheet h3 { margin: 0 0 6px; font-size: 18px; }
.sheet .opts { white-space: pre-line; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.sheet .rec { font-size: 13px; margin-top: 8px; }
.sheet .actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 14px; }
.mine { outline: 2px solid currentColor; outline-offset: 1px; }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-size: 13px; z-index: 20;
}
.empty { text-align: center; padding: 18px; color: var(--muted); }
.err { background: var(--warn-soft); border-radius: var(--radius); padding: 12px 14px; }

/* 지출: 구분 segmented control */
.pill.shared { background: var(--ink); color: var(--bg); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; font-size: 12px; font-weight: 600; color: var(--ink); padding: 9px 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
