/* tokens:start (generated by design/build_tokens.py from design/tokens.json; do not edit) */
:root {
  --bg-canvas: #FFFFFF;
  --bg-surface: #F6F5F3;
  --bg-raised: #FFFFFF;
  --bg-sunken: #EEEDEA;
  --bg-inverse: #23211D;
  --text-primary: #23211D;
  --text-secondary: #675F53;
  --text-disabled: #9B9386;
  --text-on-inverse: #FFFFFF;
  --border-subtle: #E7E5E1;
  --border-strong: #96938E;
  --accent-default: #23211D;
  --accent-pressed: #45413A;
  --accent-subtle: #EEEDEA;
  --accent-on: #FFFFFF;
  --scope-personal-fg: #7E5A12;
  --scope-personal-bg: #EFE0BB;
  --scope-shared-fg: #3E5A7E;
  --scope-shared-bg: #DCE2EA;
  --status-review-fg: #9C4434;
  --status-review-bg: #F0DCD3;
  --status-saved-fg: #4A6647;
  --status-saved-bg: #DFE6D6;
  --status-error-fg: #982A22;
  --status-error-bg: #F2D8D2;
  --focus-ring: #3E5A7E;
  --patch-shared: #3E5A7E;
  --patch-shared-pale: #8FA3BC;
  --patch-personal: #D9A441;
  --patch-personal-pale: #EBD29A;
  --patch-attention: #B45E51;
  --patch-rest: #E6E3DD;
  --patch-saved: #5E7D5B;
  --patch-on-shared: #FFFFFF;
  --patch-on-shared-pale: #23211D;
  --patch-on-personal: #23211D;
  --patch-on-personal-pale: #23211D;
  --patch-on-attention: #FFFFFF;
  --patch-on-rest: #23211D;
  --seam-fabric: #23211D33;
  --seam-draft: #9C4434;
  --seam-saved: #23211D;
  --seam-current: #3E5A7E;
  --texture-weave: #00000000;
  --gap-tight: 4px;
  --gap-inside: 8px;
  --gap-related: 12px;
  --gap-between: 16px;
  --gap-section: 32px;
  --layout-margin: 20px;
  --layout-target: 44px;
  --radius-8: 8px;
  --radius-12: 12px;
  --radius-20: 20px;
  --radius-28: 28px;
  --radius-full: 999px;
  --text-xs: .75rem;
  --text-sm: .8125rem;
  --text-md: .9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.5rem;
  --text-4xl: 4.5rem;
}
:root[data-theme="dark"] {
  --bg-canvas: #1A1917;
  --bg-surface: #22201D;
  --bg-raised: #26241F;
  --bg-sunken: #2E2B26;
  --bg-inverse: #EDE7DA;
  --text-primary: #EDE7DA;
  --text-secondary: #A9A193;
  --text-disabled: #6B665E;
  --text-on-inverse: #1A1917;
  --border-subtle: #34312B;
  --border-strong: #6B665E;
  --accent-default: #EDE7DA;
  --accent-pressed: #C9C2B4;
  --accent-subtle: #2E2B26;
  --accent-on: #1A1917;
  --scope-personal-fg: #E0BC6E;
  --scope-personal-bg: #3A2E14;
  --scope-shared-fg: #9FB3CC;
  --scope-shared-bg: #232D3A;
  --status-review-fg: #E59C8C;
  --status-review-bg: #3A211B;
  --status-saved-fg: #A6C2A2;
  --status-saved-bg: #1F2A1D;
  --status-error-fg: #F0938A;
  --status-error-bg: #3A1714;
  --focus-ring: #9FB3CC;
  --patch-shared: #566E8C;
  --patch-shared-pale: #3E4E63;
  --patch-personal: #B88A35;
  --patch-personal-pale: #6E5A2E;
  --patch-attention: #9E5A4F;
  --patch-rest: #38342E;
  --patch-saved: #A6C2A2;
  --patch-on-shared: #F3EEE3;
  --patch-on-shared-pale: #EDE7DA;
  --patch-on-personal: #1A1917;
  --patch-on-personal-pale: #EDE7DA;
  --patch-on-attention: #F3EEE3;
  --patch-on-rest: #EDE7DA;
  --seam-fabric: #00000066;
  --seam-draft: #E59C8C;
  --seam-saved: #EDE7DA;
  --seam-current: #9FB3CC;
  --texture-weave: #FFFFFF04;
}
/* tokens:end */
/* Gothic A1 (SIL OFL 1.1), self-hosted subset: KS X 1001 Hangul + Latin. See /fonts/README.txt */
@font-face { font-family: "Gothic A1"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/GothicA1-Regular.woff2") format("woff2"); }
@font-face { font-family: "Gothic A1"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/GothicA1-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Gothic A1"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/GothicA1-ExtraBold.woff2") format("woff2"); }
/* 우리집 · 모시 조각보 v3 — component layer. Spacing only from 4/8/12/16/24/32/48/64; margin 20.
   Material: undyed ramie canvas, dyed patches, lines only where fabric meets; dashes only on unsaved drafts. */
:root {
  color-scheme: light;
  --font: "Gothic A1", "Apple SD Gothic Neo", "Pretendard", system-ui, -apple-system, "Noto Sans KR", "Malgun Gothic", sans-serif; /* self-hosted; rare syllables outside KS X 1001 fall back to the system face */
  --tab-h: 64px;
  --seam: 2px;
  --quilt-h: 10rem;
  /* stacking layers, lowest to highest */
  --layer-raised: 1; --layer-savebar: 4; --layer-nav: 5; --layer-toast: 6;
  /* structural widths of the tablet rail, desktop sidebar and record panel */
  --rail-w: 88px; --sidebar-w: 240px; --panel-w: 360px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--text-md); line-height: 1.47;
  color: var(--text-primary); background-color: var(--bg-canvas);
  background-image: repeating-linear-gradient(0deg, var(--texture-weave) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, var(--texture-weave) 0 1px, transparent 1px 4px);
  font-variant-numeric: tabular-nums; letter-spacing: -0.006em;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
/* Korean breaks between words (어절), never inside one; long unbroken strings still wrap */
h1, h2, h3, p, .strong, .caption, .label, .sub { word-break: keep-all; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 8px; }
svg.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 1rem; height: 1rem; }
svg.icon.xs { width: .875rem; height: .875rem; }

/* ---------- shell ---------- */
.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding-top: env(safe-area-inset-top); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 4px var(--layout-margin) 0; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: var(--text-lg); letter-spacing: -0.035em; text-decoration: none; min-height: 44px; }
.wordmark svg { width: 22px; height: 22px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; border: 0; background: none; font-weight: 600; font-size: var(--text-lg); cursor: pointer; }
.avatars { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; padding: 4px; border: 0; background: none; cursor: pointer; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; font-weight: 600; font-size: var(--text-sm); }
.avatar + .avatar { margin-left: 4px; }
.avatar.me { background: var(--patch-personal); color: var(--patch-on-personal); }
.avatar.other { background: var(--patch-shared-pale); color: var(--patch-on-shared-pale); }
main { padding: 0 0 calc(var(--tab-h) + 48px + env(safe-area-inset-bottom)); }
.pad { padding-inline: var(--layout-margin); }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; inset: auto 0 0; z-index: var(--layer-nav); background: var(--bg-canvas); border-top: 1px solid var(--border-subtle); padding-bottom: env(safe-area-inset-bottom); }
.tabbar ul { list-style: none; margin: 0 auto; padding: 0 12px; max-width: 480px; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-height: var(--tab-h); padding-bottom: 8px; text-decoration: none; color: var(--text-secondary); font-size: var(--text-xs); font-weight: 400; }
.tabbar a[aria-current="page"] { color: var(--text-primary); font-weight: 600; }
.tabbar a svg.icon { width: 24px; height: 24px; }
.tabbar .ai svg.mark { width: 32px; height: 32px; margin-top: -8px; transition: transform .2s var(--ease); }
.tabbar .ai:active svg.mark { transform: scale(.94); }

/* ---------- type ---------- */
.title { font-size: var(--text-3xl); line-height: 1.15; font-weight: 800; letter-spacing: -0.04em; }
.date { font-size: var(--text-3xl); line-height: 1.14; font-weight: 800; letter-spacing: -0.045em; }
.sub { color: var(--text-secondary); }
.label { font-size: var(--text-sm); line-height: 1.38; font-weight: 400; color: var(--text-secondary); }
.caption { font-size: var(--text-xs); line-height: 1.33; color: var(--text-secondary); }
.hero-amount { white-space: nowrap; font-size: var(--text-3xl); line-height: 1.1; font-weight: 800; letter-spacing: -0.05em; }
.legend { display: grid; gap: 4px; font-size: var(--text-sm); color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend i { width: 10px; height: 10px; background: var(--patch-rest); }
.legend i.shared { background: var(--patch-shared); }
.legend i.personal { background: var(--patch-personal); }
.legend i.attention { background: var(--patch-attention); }
.legend-row { display: flex; gap: 16px; margin-top: 12px; }
.avatar.outside { background: var(--patch-rest); color: var(--patch-on-rest); }
.topbar:empty { display: none; }
.amount { font-weight: 600; letter-spacing: -0.012em; white-space: nowrap; }
.strong { font-weight: 600; }
.lg { font-size: var(--text-lg); }

/* ---------- sections & rows ---------- */
.stack { display: grid; gap: 16px; }
.section { padding: 16px var(--layout-margin) 0; }
.section-head { flex-wrap: wrap; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.section-head a, .link { font-size: var(--text-sm); font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.rows { list-style: none; margin: 8px 0 0; padding: 0; }
.rows > li { border-top: 1px solid var(--border-subtle); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 0; text-align: left; background: none; border: 0; color: inherit; text-decoration: none; cursor: pointer; }
.row .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
/* selvage: a 3px dyed edge says whose row it is (the caption repeats it in words, never colour alone) */
.row.edge { position: relative; padding-left: 16px; }
.row.edge::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; background: var(--patch-rest); }
.row.edge.shared::before { background: var(--patch-shared); }
.row.edge.personal::before { background: var(--patch-personal); }
.when { min-width: 3.5rem; flex: none; display: grid; white-space: nowrap; }
.when b { font-size: var(--text-lg); font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.tile-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-sunken); flex: none; }

/* ---------- chips & badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.badge.review { background: var(--status-review-bg); color: var(--status-review-fg); }
.badge.saved { background: var(--status-saved-bg); color: var(--status-saved-fg); }
.badge.error { background: var(--status-error-bg); color: var(--status-error-fg); }
.saved-note { color: var(--status-saved-fg); display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); }
.dday { font-weight: 600; font-size: var(--text-sm); color: var(--status-review-fg); white-space: nowrap; }

/* ---------- segmented / filters ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-sunken); }
.seg button { min-height: 40px; border: 0; border-radius: 8px; background: none; font-weight: 600; color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.seg button[aria-pressed="true"] { background: var(--bg-raised); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
/* filters read as plain words; the chosen one carries the 쪽 seam, like the tab bar */
.pills button { min-height: 44px; padding: 0 4px; border: 0; border-radius: 0; background: none; color: var(--text-secondary); font-size: var(--text-md); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: inset 0 -2px 0 transparent; transition: color var(--dur-quick) linear, box-shadow var(--dur-quick) linear; }
.pills { gap: 16px; }
.pills button[aria-pressed="true"] { color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--seam-current); }

/* ---------- buttons ---------- */
.btn { min-height: 52px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-raised); font-weight: 600; font-size: var(--text-md); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent-default); border-color: var(--accent-default); color: var(--accent-on); }
.btn.primary:active { background: var(--accent-pressed); }
.btn.danger { background: var(--status-review-bg); border-color: transparent; color: var(--status-review-fg); }
.btn:disabled { background: var(--bg-sunken); border-color: transparent; color: var(--text-disabled); cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: .8; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn.small { min-height: 44px; font-size: var(--text-sm); }

/* ---------- patches, quilt, stitches ---------- */
.patch { position: relative; color: var(--text-primary); }
.patch.shared { background: var(--patch-shared); color: var(--patch-on-shared); }
.patch.shared.pale { background: var(--patch-shared-pale); color: var(--patch-on-shared-pale); }
.patch.personal { background: var(--patch-personal); color: var(--patch-on-personal); }
.patch.personal.pale { background: var(--patch-personal-pale); color: var(--patch-on-personal-pale); }
.patch.rest { background: var(--patch-rest); color: var(--patch-on-rest); }
.patch.attention { background: var(--patch-attention); color: var(--patch-on-attention); }
.quilt { display: grid; gap: var(--seam); background: var(--seam-fabric); height: var(--quilt-h); }
.quilt .col { display: grid; gap: var(--seam); min-width: 0; }
.quilt .patch { min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px 16px; }
.quilt .patch .label { color: inherit; } /* full ink: opacity would lower the measured contrast */
.quilt .patch .amount { font-size: var(--text-lg); font-weight: 800; letter-spacing: -0.02em; }
.quilt .patch.tiny { padding: 0; } /* true proportions: an unlabeled patch takes only its share */
.quilt .patch.tiny > * { display: none; }
.quilt .patch.line { justify-content: center; padding-block: 0; }
.quilt.empty .patch { background: none; border: 1.25px dashed var(--border-strong); }
.strip { display: flex; gap: 2px; height: 16px; border-radius: 6px; overflow: hidden; }
.strip span { display: block; min-width: 2px; }
.deadline { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 16px; padding: 16px 0 4px; border-top: 2px solid var(--patch-attention); text-decoration: none; }
.deadline .label { grid-column: 1 / -1; color: var(--status-review-fg); font-weight: 600; }
.deadline .count { font-size: var(--text-3xl); line-height: 1; font-weight: 800; letter-spacing: -0.045em; white-space: nowrap; }
.deadline .count small { font-size: var(--text-md); font-weight: 600; letter-spacing: -0.01em; margin-left: 4px; }
.deadline .icon { color: var(--text-secondary); }

/* ---------- draft fabric (unsaved) ---------- */
.fabric { position: relative; background: var(--bg-surface); border-radius: 12px; padding: 20px 20px 16px; display: grid; gap: 12px; }
.fabric.draft::before { content: ""; position: absolute; inset: 6px; border: 1.25px dashed var(--seam-draft); border-radius: 6px; pointer-events: none; }
/* Save = stitching: a solid seam is sewn over the basting, starting top-left (motion board row 3). */
.fabric.sewn::after { content: ""; position: absolute; inset: 6px; border: 1.5px solid var(--accent-default); border-radius: 6px; pointer-events: none; animation: sew var(--dur-stitch) var(--ease) both; }
@keyframes sew { from { clip-path: polygon(0 0, 0 0, 0 0); } 50% { clip-path: polygon(0 0, 200% 0, 0 200%); } to { clip-path: polygon(0 0, 400% 0, 0 400%); } }
.soft { background: var(--bg-canvas); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 16px; }

/* ---------- forms ---------- */
.field { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--border-subtle); }
.field:first-child { border-top: 0; }
.field > span { font-size: var(--text-sm); font-weight: 400; color: var(--text-secondary); }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 8px; text-align: right; font-weight: 600; }
.field textarea { text-align: left; font-weight: 400; resize: vertical; min-height: 64px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-subtle); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; box-shadow: inset 0 -2px 0 var(--focus-ring); background: var(--bg-raised); } /* craft-exception: web.focus-outline -- replaced by the 2px indigo focus seam on the same element */
.field input[aria-invalid="true"] { border-color: var(--status-error-fg); }
.field .ev { grid-column: 2; margin-top: -8px; padding-bottom: 8px; text-align: right; }
.amount-input { display: flex; align-items: baseline; gap: 4px; }
.amount-input input { white-space: nowrap; }
.amount-input .won { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.04em; }
.source { display: grid; gap: 4px; margin-bottom: 12px; }
.fabric > .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fabric > .meta .badge { flex: none; }
.amount-input input { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.04em; text-align: left; padding: 0; min-height: 48px; border: 0; background: none; width: 100%; }
.amount-input input:focus { outline: none; box-shadow: inset 0 -2px 0 var(--focus-ring); } /* craft-exception: web.focus-outline -- replaced by the 2px indigo focus seam on the same element */
.audience { display: flex; flex-wrap: wrap; gap: 8px; }
.audience label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-raised); font-weight: 600; cursor: pointer; }
.audience input { width: 18px; height: 18px; accent-color: var(--patch-shared); }
.audience label:has(input:checked) { border-color: var(--scope-shared-fg); color: var(--scope-shared-fg); background: var(--scope-shared-bg); }
.error-text { color: var(--status-error-fg); display: flex; gap: 8px; align-items: flex-start; font-size: var(--text-sm); }
.ok-text { color: var(--status-saved-fg); display: flex; gap: 8px; align-items: flex-start; font-size: var(--text-sm); }
.composer { display: grid; gap: 12px; transition: border-color var(--dur-quick) linear; }
.composer:focus-within { border-color: var(--seam-current); } /* focus is the indigo seam, not a default ring */
.composer textarea { width: 100%; min-height: 88px; border: 0; background: none; resize: none; font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.02em; padding: 0; }
.composer textarea:focus { outline: none; } /* craft-exception: web.focus-outline -- the composer card shows focus (.composer:focus-within) */
.composer .foot { display: flex; align-items: center; justify-content: space-between; }
.send { width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--accent-default); color: var(--accent-on); display: grid; place-items: center; cursor: pointer; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode { position: relative; display: grid; gap: 12px; padding: 16px; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--bg-canvas); cursor: pointer; min-height: 104px; align-content: start; transition: border-color var(--dur-quick) linear; }
.mode:hover { border-color: var(--border-strong); }
.mode input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mode:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- footer (save summary) ---------- */
.save-bar { position: sticky; bottom: 0; z-index: var(--layer-savebar); background: var(--bg-canvas); border-top: 1px solid var(--border-subtle); padding: 16px var(--layout-margin) calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 12px; margin-top: 24px; }
.save-bar .summary { display: flex; gap: 8px; font-size: var(--text-sm); align-items: flex-start; }

/* ---------- week strip ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); }
.day { display: grid; justify-items: center; gap: 8px; padding: 4px 0; border: 0; background: none; cursor: pointer; color: inherit; }
.day .num { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-weight: 600; }
/* chosen day = a quiet fill; today = the indigo seam under the number (the app's 'you are here' mark) */
.day[aria-pressed="true"] .num { background: var(--bg-surface); }
.day.today .num { font-weight: 800; box-shadow: inset 0 -2px 0 var(--seam-current); border-radius: 0; }
.day .dow { font-size: var(--text-xs); color: var(--text-secondary); }
.day.sun .dow, .day.sun:not(.today) .num { color: var(--status-review-fg); }
.marks { display: flex; gap: 3px; height: 8px; align-items: center; }
.mk { width: 7px; height: 7px; }
/* marks say whose (dye), and alerts in safflower; the legend under the week uses the same swatches */
.mk { background: var(--patch-personal); }
.mk.shared { background: var(--patch-shared); }
.mk.reminder { background: var(--patch-attention); }

/* ---------- detail ---------- */
details.record > summary { list-style: none; }
details.record > summary::-webkit-details-marker { display: none; }
.detail { display: grid; gap: 12px; padding: 0 0 16px 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-md); }
.kv span:first-child { color: var(--text-secondary); }
.thread { display: grid; gap: 0; }
.thread a { display: flex; align-items: center; gap: 12px; min-height: 52px; text-decoration: none; }
.thread .sq { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.thread .grow { flex: 1; min-width: 0; }
.thread .seam-line { width: 2px; height: 12px; margin-left: calc(16px - 1px); background: var(--seam-saved); } /* centred under the 32px link squares: half the square minus half the seam */
.locked .sq { border: 1.25px dashed var(--border-strong); }
.area-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--seam); background: var(--seam-fabric); }
.area-grid .patch { min-height: 76px; padding: 16px; display: grid; align-content: space-between; }
.switch { appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .2s var(--ease); margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 999px; background: var(--bg-raised); box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .2s var(--ease); }
.switch:checked { background: var(--seam-current); } /* sharing on = 공동, indigo */
.switch:checked::after { transform: translateX(20px); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: var(--layer-toast); width: min(calc(100% - 40px), 440px); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; min-height: 56px; border-radius: 12px; background: var(--bg-inverse); color: var(--text-on-inverse); font-size: var(--text-md); font-weight: 400; }
.toast button { min-width: 44px; min-height: 44px; border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; }
.toast .grow { flex: 1; }
.toast .toast-action { min-width: 0; padding: 0 8px; font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 4px; }
/* undo window: a line drains along the toast's bottom edge for 8s (transform only) */
.toast.timed { overflow: hidden; }
.toast.timed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor; opacity: .5; transform-origin: 0 50%; animation: drain 8s linear both; }
@keyframes drain { to { transform: scaleX(0); } }
.record-actions { display: flex; gap: 8px; margin-top: 12px; border-top: 1px solid var(--border-subtle); padding-top: 8px; }
.text-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--text-primary); font-weight: 600; cursor: pointer; border-radius: 8px; }
.text-btn.danger { color: var(--status-review-fg); }
.record-note { margin-top: 12px; }
.source-text mark { background: var(--patch-personal-pale); color: var(--patch-on-personal-pale); padding: 0 2px; }
.notice { margin: 12px var(--layout-margin) 0; padding: 12px 16px; border-radius: 12px; background: var(--status-error-bg); color: var(--status-error-fg); font-size: var(--text-md); display: flex; gap: 8px; }
.search { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 12px; background: var(--bg-surface); }
.search input { flex: 1; border: 0; background: none; min-height: 44px; }
.search input:focus { outline: none; } /* craft-exception: web.focus-outline -- the search box shows focus (.search:focus-within) */
.search:focus-within { box-shadow: inset 0 0 0 2px var(--focus-ring); }
.empty { padding: 24px 0; color: var(--text-secondary); }
/* ---------- motion (README · Motion): durations are tokens; only transform, opacity and clip-path move ---------- */
:root { --dur-quick: 120ms; --dur-base: 220ms; --dur-push: 280ms; --dur-stitch: 400ms; }
#screen { view-transition-name: screen; }
.topbar { view-transition-name: topbar; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; } /* tab bar and page chrome stay put (C9) */
::view-transition-group(screen), ::view-transition-group(topbar), ::view-transition-group(panel) { animation-duration: var(--dur-base); animation-timing-function: var(--ease); }
/* theme switch: the whole page cross-fades from light to dark (or back), nothing slides */
:root[data-nav="theme"]::view-transition-old(root) { animation: var(--dur-base) linear both fade-out; }
:root[data-nav="theme"]::view-transition-new(root) { animation: var(--dur-base) linear both fade-in; }
:root[data-nav="forward"]::view-transition-old(screen) { animation: var(--dur-base) var(--ease) both leave-left; }
:root[data-nav="forward"]::view-transition-new(screen) { animation: var(--dur-base) var(--ease) both enter-right; }
:root[data-nav="back"]::view-transition-old(screen) { animation: var(--dur-base) var(--ease) both leave-right; }
:root[data-nav="back"]::view-transition-new(screen) { animation: var(--dur-base) var(--ease) both enter-left; }
:root[data-nav="push"]::view-transition-old(screen) { animation: var(--dur-push) var(--ease) both recede; }
:root[data-nav="push"]::view-transition-new(screen) { animation: var(--dur-push) var(--ease) both slide-over; }
:root[data-nav="pop"]::view-transition-old(screen) { animation: var(--dur-push) var(--ease) both slide-off; z-index: var(--layer-raised); }
:root[data-nav="pop"]::view-transition-new(screen) { animation: var(--dur-push) var(--ease) both return; }
:root[data-nav="fade"]::view-transition-old(screen) { animation: var(--dur-quick) linear both fade-out; }
:root[data-nav="fade"]::view-transition-new(screen) { animation: var(--dur-quick) linear both fade-in; }
@keyframes leave-left { to { opacity: 0; transform: translateX(-8px); } }
@keyframes leave-right { to { opacity: 0; transform: translateX(8px); } }
@keyframes enter-right { from { opacity: 0; transform: translateX(8px); } }
@keyframes enter-left { from { opacity: 0; transform: translateX(-8px); } }
@keyframes recede { to { opacity: .55; transform: translateX(-24px); } }
@keyframes slide-over { from { transform: translateX(100%); } }
@keyframes slide-off { to { transform: translateX(100%); } }
@keyframes return { from { opacity: .55; transform: translateX(-24px); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
/* tab seam: a short indigo line glides under the current tab */
.tabbar ul { position: relative; }
.tabbar ul::before { content: ""; position: absolute; left: 12px; bottom: 2px; width: calc((100% - 24px) / 5); height: 2px; pointer-events: none;
  background: linear-gradient(var(--seam-current), var(--seam-current)) center / 24px 2px no-repeat;
  transform: translateX(calc(var(--tab-i, 0) * 100%)); transition: transform var(--dur-base) var(--ease), opacity var(--dur-quick) linear; }
.tabbar[data-tab="none"] ul::before { opacity: 0; }
/* quilt unfolds once per session, largest patch first */
.quilt.unfold .patch { animation: lay var(--dur-push) var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); transform-origin: 0 0; }
@keyframes lay { from { opacity: 0; transform: scale(.94); } }
/* loading: a calm pulse, never a shimmer sweep */
.skeleton { display: grid; gap: 12px; padding: 24px var(--layout-margin); }
.skeleton span { display: block; border-radius: 8px; background: var(--bg-sunken); animation: breathe 1.4s ease-in-out infinite alternate; }
.skeleton .sk-short { width: 40%; height: 14px; }
.skeleton .sk-num { width: 70%; height: 44px; }
.skeleton .sk-quilt { height: 10rem; border-radius: 12px; margin: 4px calc(-1 * var(--layout-margin)); }
.skeleton .sk-line { height: 52px; }
@keyframes breathe { to { opacity: .45; } }
/* reading a file: a running stitch travels along the tile edge until the draft is ready */
.mode.working { position: relative; overflow: hidden; cursor: progress; }
.mode.working::after { content: ""; position: absolute; left: -12px; right: 0; bottom: 8px; height: 2px; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--accent-default) 0 6px, transparent 6px 12px); animation: run-stitch .8s linear infinite; }
@keyframes run-stitch { to { transform: translateX(12px); } }
.send[aria-busy="true"] svg { animation: breathe .6s ease-in-out infinite alternate; }
/* ---------- layout · phone first; tablet rail ≥768; desktop sidebar + record panel ≥1100 ---------- */
.tabbar .nav-brand, .tabbar .nav-people, .panel { display: none; }
.home-head { padding-top: 8px; }
.home-head h1 { font-size: var(--text-md); font-weight: 600; line-height: 1.47; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.quilt-link { display: block; margin-top: 16px; text-decoration: none; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.theme-toggle[aria-pressed="true"] { color: var(--text-primary); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--text-secondary); cursor: pointer; }
.row[aria-current="true"] { background: var(--bg-surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.panel-title { font-size: var(--text-xl); line-height: 1.25; font-weight: 800; letter-spacing: -0.03em; margin-top: 8px; }
.panel-amount { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.04em; margin-top: 4px; }
.panel .detail { padding: 16px 0 0; }
@media (min-width: 768px) {
  :root { --quilt-h: 12rem; --layout-margin: 32px; }
  .tabbar { inset: 0 auto 0 0; width: var(--rail-w); display: flex; flex-direction: column; padding: 24px 0; border-top: 0; border-right: 1px solid var(--border-subtle); }
  .tabbar ul { grid-template-columns: 1fr; grid-auto-rows: 72px; max-width: none; margin: 0; padding: 0 8px; }
  .tabbar a { min-height: 72px; justify-content: center; padding-bottom: 0; }
  .tabbar ul::before { left: 0; top: 0; bottom: auto; width: 3px; height: 72px; background: var(--seam-current); transform: translateY(calc(var(--tab-i, 0) * 100%)); }
  .shell { max-width: none; margin-left: var(--rail-w); }
  .topbar, #screen { max-width: 760px; margin-inline: auto; }
  main { padding-bottom: 64px; }
  .toast { bottom: 24px; }
  .review-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px; align-items: start; }
  .review-layout .source { position: sticky; top: 16px; }
  body:has(> .tabbar[hidden]) .shell { margin-left: 0; } /* reviewing a draft: the page takes the whole width, centred */
}
@media (min-width: 1100px) {
  :root { --quilt-h: 15rem; --layout-margin: 40px; }
  .tabbar { width: var(--sidebar-w); padding: 32px 16px 24px; }
  .tabbar .nav-brand { display: inline-flex; flex-direction: row; justify-content: flex-start; padding: 0 12px; margin-bottom: 32px; color: var(--text-primary); font-size: var(--text-lg); font-weight: 800; }
  .tabbar ul { grid-auto-rows: 48px; padding: 0; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 12px; font-size: var(--text-md); }
  .tabbar a svg.icon { width: 20px; height: 20px; }
  .tabbar .ai svg.mark { width: 22px; height: 22px; margin-top: 0; }
  .tabbar ul::before { height: 48px; }
  .tabbar .nav-people { display: grid; gap: 4px; margin-top: auto; }
  .tabbar .nav-people .theme-toggle { margin-left: 4px; }
  .nav-person-list { display: grid; gap: 8px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: none; text-align: left; cursor: pointer; }
  .nav-person { display: flex; align-items: center; gap: 12px; font-weight: 600; }
  .nav-person .avatar { margin: 0; }
  .shell { margin-left: var(--sidebar-w); display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); grid-template-rows: auto 1fr; }
  .shell:has(> .panel[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .topbar { grid-column: 1; width: 100%; max-width: 880px; }
  .topbar:not(:has(.back)) { display: none; }
  #screen { grid-column: 1; grid-row: 2; width: 100%; max-width: 880px; padding-top: 32px; }
  .panel { display: block; grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 32px 24px 48px; border-left: 1px solid var(--border-subtle); view-transition-name: panel; }
  .hero-amount { font-size: var(--text-4xl); }
  .home-pair { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; padding: 0 var(--layout-margin); align-items: start; }
  .home-pair > .section { padding-inline: 0; }
  .home-recent { margin-top: 16px; }
  .deadline .count { font-size: var(--text-3xl); }
  .home-pair .deadline { grid-template-columns: 1fr; }
  .quilt-link { margin: 24px var(--layout-margin) 0; }
  .panel-head .label { font-size: var(--text-md); font-weight: 600; color: var(--text-primary); }
}

/* ---------- first load failed: say why, offer one action ---------- */
.boot-failed { display: grid; gap: 16px; justify-items: start; max-width: 32rem; padding: 24px var(--layout-margin) 48px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-title { font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.icon-btn:disabled { color: var(--text-disabled); cursor: not-allowed; }
.compare { margin-top: 4px; }
.day-title { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.02em; }
.boot-title { margin-top: 24px; font-size: var(--text-2xl); line-height: 1.3; font-weight: 800; letter-spacing: -0.03em; }
.boot-failed .btn { margin-top: 8px; }

/* ---------- welcome (first screen) · phone stacks intro → quilt band → who; desktop splits 50/50 ---------- */
.welcome { display: grid; }
.welcome-intro { padding: 8px var(--layout-margin) 0; }
.welcome-top { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.welcome-top .wordmark { min-height: 44px; }
.welcome-title { margin-top: 24px; font-size: var(--text-2xl); line-height: 1.22; font-weight: 800; letter-spacing: -0.04em; }
.welcome-sub { margin-top: 12px; max-width: 32em; }
.welcome-quilt { display: grid; grid-template-columns: 3fr 2fr; gap: var(--seam); background: var(--seam-fabric); height: 128px; margin-top: 32px; }
.welcome-quilt .col { display: grid; grid-template-rows: 5fr 3fr 2fr; gap: var(--seam); min-height: 0; }
.welcome-quilt .patch { display: flex; align-items: flex-end; min-height: 0; overflow: hidden; padding: 0 12px 6px; font-size: var(--text-xs); font-weight: 600; line-height: 1.2; }
.welcome-quilt .draft-patch { position: relative; background: var(--bg-canvas); color: var(--status-review-fg); }
.welcome-quilt .draft-patch::before { content: ""; position: absolute; inset: 4px; border: 1.25px dashed var(--seam-draft); border-radius: 4px; }
.welcome-quilt .draft-patch span { position: relative; }
.welcome-choose { padding: 32px var(--layout-margin) 48px; }
.welcome-choose .row .grow { gap: 2px; }
.welcome-note { margin-top: 16px; display: flex; align-items: center; gap: 4px; }
#screen:has(> .welcome) { padding: 0; }
@media (min-width: 768px) {
  #screen:has(> .welcome) { max-width: none; }
  .welcome { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100dvh; }
  .welcome-intro, .welcome-choose { grid-column: 1; width: 100%; max-width: 560px; justify-self: center; padding-inline: 48px; }
  .welcome-intro { padding-top: 40px; }
  .welcome-title { margin-top: 15vh; font-size: clamp(var(--text-2xl), 3.4vw, var(--text-3xl)); }
  .welcome-sub { font-size: var(--text-lg); }
  .welcome-choose { padding-top: 48px; }
  .welcome-quilt { grid-column: 2; grid-row: 1 / span 2; height: auto; margin: 0; position: sticky; top: 0; max-height: 100dvh; }
  .welcome-quilt .patch { padding: 20px 24px; font-size: var(--text-md); }
  .welcome-quilt .draft-patch::before { inset: 10px; border-width: 2px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
:root[data-theme="dark"] { color-scheme: dark; }
