
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css');
:root {
  /* Dark foundation */
  --bg-deep:#080d14; --surface:#111827; --surface-2:#1a2537; --surface-3:#243044;
  --border:#1e293b; --border-bright:#334155;
  /* --text-muted lands on every surface from --bg-deep to --surface-3; the old
     #64748b only reached 2.79 against the lightest of them. */
  --text:#f1f5f9; --text-muted:#94a3b8; --text-dim:#334155;
  /* Semantic */
  --accent:#38bdf8; --accent-glow:rgba(56,189,248,0.12);
  --on-accent:#080d14;
  --success:#34d399; --warn:#fbbf24; --danger:#f87171; --info:#818cf8;
  /* Legacy aliases (기존 코드 호환) */
  --slate-50:#f8fafc; --slate-100:#f1f5f9; --slate-200:#e2e8f0;
  --slate-300:#cbd5e1; --slate-400:#94a3b8; --slate-500:#64748b;
  --slate-700:#334155; --slate-900:#0f172a;
  --blue-50:#eff6ff; --blue-500:#3b82f6; --sky-400:#38bdf8;
  --green-50:#f0fdf4; --green-500:#22c55e; --green-600:#16a34a;
  --amber-50:#fffbeb; --amber-400:#fbbf24; --amber-500:#f59e0b;
  --red-50:#fef2f2; --red-500:#ef4444;
  /* Group accent colors */
  --group-1:#38bdf8; --group-2:#818cf8; --group-3:#34d399; --group-4:#fb923c; --group-5:#f472b6;
  /* Typography */
  --text-xs:0.72rem; --text-sm:0.82rem; --text-base:0.9rem; --text-md:1rem;
  --fw-medium:500; --fw-semibold:600; --fw-bold:700; --fw-extrabold:800;
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px;
  --radius-sm:6px; --radius-md:10px; --radius-lg:14px; --radius-xl:18px; --radius-full:9999px;
  --shadow-sm:0 1px 4px rgba(0,0,0,0.4);
  --shadow-md:0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:0 8px 32px rgba(0,0,0,0.6);
  --btn-h-sm:28px; --btn-h-base:32px; --btn-h-lg:40px;
  --notepad-header:var(--surface-2); --notepad-line:var(--border);
}
/* Light theme — activated by data-theme="light" on <html> (toggle, localStorage) */
:root[data-theme="light"] {
  /* Guide v2, direction A "Deep Sky" — accent only on buttons/links/active
     tabs/badges, never body text. Status colors are a separate axis. */
  --bg-deep:#F6F7F9; --surface:#FFFFFF; --surface-2:#EFF1F4; --surface-3:#E6EAF0;
  --border:#E2E6EC; --border-bright:#CBD5E1;
  --text:#1B2330; --text-muted:#5F6B7A; --text-dim:#98A2B0;
  --accent:#0269A6; --accent-glow:rgba(2,105,166,0.10);
  --on-accent:#FFFFFF;
  --success:#177E42; --warn:#B45309; --danger:#D33A3A; --info:#4F46E5;
  /* Group accents keep their hue but darken — the dark-theme values wash out
     on white (Deal Desk vendor chips, home category bars). */
  --group-1:#0369A1; --group-2:#4F46E5; --group-3:#177E42; --group-4:#C2410C; --group-5:#BE185D;
  --slate-50:#111827; --slate-100:#1C2430; --slate-200:#334155;
  --slate-300:#475569; --slate-400:#66707E; --slate-500:#5A6472;
  --slate-700:#CBD5E1;
  --shadow-sm:0 1px 4px rgba(28,36,48,0.08);
  --shadow-md:0 4px 16px rgba(28,36,48,0.10);
  --shadow-lg:0 8px 32px rgba(28,36,48,0.14);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Reserve the scrollbar gutter so short views (0-item filters etc.) don't
   shift the layout sideways when the vertical scrollbar disappears. */
html { scrollbar-gutter: stable; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
body { font-family: 'Pretendard Variable', Pretendard, -apple-system, system-ui, sans-serif; background: var(--bg-deep); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }

/* Nav */
nav { background: rgba(15,23,42,0.92); backdrop-filter: blur(12px); padding: 13px 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid rgba(255,255,255,0.07); }
/* The bar stays dark in both themes, so the palette inside it does too — under
   the light theme the text tokens darken and disappear into their own bar
   (.nav-user fell to 2.42). Scoped overrides, not new global values. */
/* :not(.app-tabs) — the Momentum tab bar is also a <nav>, but its desktop
   form sits on --surface and has to follow the theme, not this override. */
nav:not(.app-tabs) { --text:#f1f5f9; --text-muted:#94a3b8; --slate-400:#94a3b8; --slate-500:#94a3b8; }
nav a { color: var(--slate-400); text-decoration: none; font-size: 0.875rem; transition: color 0.15s; }
nav a:hover { color: white; }
.nav-brand { color: white; font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-user { color: var(--slate-500); font-size: 0.82rem; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-user a { color: var(--slate-400); padding: 5px 11px; border-radius: 8px; background: rgba(255,255,255,0.05); transition: 0.2s; }
.nav-user a:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-back { color: var(--slate-400); font-size: 0.82rem; text-decoration: none; display: flex; align-items: center; gap: 4px; }
.nav-back:hover { color: white; }

/* Layout */
.container { max-width: 880px; margin: 0 auto; padding: 44px 24px 80px; }
h1 { font-size: 1.75rem; color: var(--text); margin-bottom: 6px; font-weight: 800; letter-spacing: -0.03em; }

/* Dashboard widget */
.dashboard { background: var(--slate-900); background-image: radial-gradient(at 0% 0%, rgba(56,189,248,0.15) 0, transparent 50%), radial-gradient(at 100% 100%, rgba(59,130,246,0.15) 0, transparent 50%); border-radius: var(--radius-xl); padding: 36px 40px; margin-bottom: 48px; color: white; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,0.05); }
.dashboard-greeting h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.03em; }
.dashboard-greeting p { color: var(--slate-400); font-size: 0.95rem; font-weight: 500; }
.dashboard-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-card { background: rgba(255,255,255,0.04); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-lg); padding: 16px 24px; text-align: center; min-width: 100px; transition: 0.2s; }
.stat-card:hover { transform: translateY(-3px); background: rgba(255,255,255,0.07); }
.stat-card .stat-num { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-card .stat-label { font-size: 0.7rem; color: var(--slate-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-card.highlight .stat-num { color: var(--sky-400); text-shadow: 0 0 20px rgba(56,189,248,0.3); }

/* App entry card */
.app-entry-card { display:flex; align-items:center; gap:20px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-xl); padding:24px 28px; text-decoration:none; color:var(--text); transition:all .25s; margin-bottom:32px; position:relative; overflow:hidden; }
.app-entry-card::before { content:""; position:absolute; top:0; left:0; right:0; height:3px; background:linear-gradient(90deg,var(--accent),var(--info)); }
.app-entry-card:hover { box-shadow:var(--shadow-lg); transform:translateY(-3px); border-color:var(--accent); }
.app-entry-icon { font-size:2.5rem; filter:drop-shadow(0 2px 6px rgba(0,0,0,0.1)); }
.app-entry-text { flex:1; }
.app-entry-name { font-size:1.1rem; font-weight:800; color:var(--text); margin-bottom:4px; letter-spacing:-.02em; }
.app-entry-tabs { font-size:0.8rem; color:var(--slate-400); font-weight:500; }
.app-entry-arrow { font-size:1.4rem; color:var(--slate-400); transition:.2s; }
.app-entry-card:hover .app-entry-arrow { color:var(--accent); transform:translateX(4px); }
@media(max-width:600px) { .app-entry-card { padding:18px 20px; gap:14px; } .app-entry-icon { font-size:2rem; } }

/* Category */
.category-section { margin-bottom: 40px; }
.category-title { display:flex; align-items:center; gap:8px; font-size:var(--text-sm); font-weight:var(--fw-bold); color:var(--text); text-transform:none; letter-spacing:.01em; margin-bottom:14px; padding-left:2px; }
.category-title::before { content:""; width:4px; height:1em; border-radius:var(--radius-full); background:var(--slate-500); flex-shrink:0; }
details.bucket-section summary { cursor:pointer; list-style:none; }
details.bucket-section summary::-webkit-details-marker { display:none; }
details.bucket-section:not([open]) .category-title { color:var(--text-muted); }
details.bucket-section .bucket-hint { font-size:var(--text-xs); font-weight:var(--fw-medium); color:var(--text-muted); }
details.bucket-section[open] .service-grid { margin-top:14px; }
.cat-c1::before { background:var(--group-1); }
.cat-c2::before { background:var(--group-2); }
.cat-c3::before { background:var(--group-3); }
.cat-c4::before { background:var(--group-4); }
.cat-c5::before { background:var(--group-5); }

/* Wayfinder cards */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 14px; }
.service-card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: all 0.25s cubic-bezier(0.4,0,0.2,1); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.service-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); opacity: 0; transition: 0.2s; }
.service-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--accent); }
.service-card:hover::before { opacity: 1; }
.service-icon { font-size: 2rem; margin-bottom: 14px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.service-name { font-weight: 700; font-size: 0.95rem; color: var(--text); margin-bottom: 5px; }
.service-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* Todo */
.add-form { display: flex; gap: 8px; margin-bottom: 20px; }
.add-form input { flex: 1; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; outline: none; }
.add-form input:focus { border-color: #0ea5e9; }
.add-form button { padding: 10px 18px; background: #0ea5e9; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 0.95rem; }
.stats { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stats span { background: white; padding: 5px 12px; border-radius: 20px; border: 1px solid #e2e8f0; font-size: 0.85rem; color: #64748b; }
.stats .done-c { color: #16a34a; }
/* .todo-list is still worn by the notepad body; the row rules that used to go
   with it (.todo-item/.tid/.title/.date/.actions) had no wearer left — the
   notepad markup names its own — and were pre-dark-theme anyway. */
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.btn {
  display:inline-flex; align-items:center; justify-content:center;
  height:var(--btn-h-base); padding:0 12px; border:none;
  border-radius:var(--radius-sm); font-size:var(--text-sm);
  font-weight:var(--fw-semibold); cursor:pointer;
  transition:background 0.15s,opacity 0.15s,transform 0.1s,color 0.15s,border-color 0.15s;
  white-space:nowrap; text-decoration:none; flex-shrink:0;
}
.btn-sm { height:var(--btn-h-sm); padding:0 8px; font-size:var(--text-xs); }
.btn-lg { height:var(--btn-h-lg); padding:0 20px; font-size:var(--text-base); font-weight:var(--fw-bold); }
.btn-primary   { background:var(--accent); color:var(--on-accent); font-weight:700; }
.btn-secondary { background:var(--surface-2); color:var(--text); border:1px solid var(--border); }
.btn-ghost     { background:transparent; color:var(--text-muted); border:1px solid var(--border); }
.btn-success   { background:rgba(52,211,153,0.12); color:var(--success); border:1px solid rgba(52,211,153,0.3); }
/* A destructive action has to read as destructive without being hovered —
   there is no hover on touch, and muted grey reads as disabled. */
.btn-danger    { background:transparent; color:var(--danger); }
.btn-accent    { background:var(--accent); color:var(--on-accent); font-weight:700; }
.btn-warn      { background:rgba(251,191,36,0.12); color:var(--warn); border:1px solid rgba(251,191,36,0.3); }
.btn-primary:hover   { opacity:0.88; transform:translateY(-1px); box-shadow:0 4px 12px rgba(56,189,248,0.3); }
.btn-secondary:hover { border-color:var(--accent); color:var(--accent); }
.btn-ghost:hover     { border-color:var(--accent); color:var(--accent); background:var(--accent-glow); }
.btn-success:hover   { background:var(--success); color:var(--on-accent); border-color:transparent; }
.btn-danger:hover    { color:var(--danger); background:rgba(248,113,113,0.12); }
.btn-accent:hover    { opacity:0.88; transform:translateY(-1px); box-shadow:0 4px 12px rgba(56,189,248,0.3); }
@media (max-width:600px) {
  .btn { height:40px; padding:0 14px; }
  .btn-sm { height:36px; padding:0 10px; }
  .btn-lg { height:48px; }
}
.empty { text-align: center; color: var(--text-muted); padding: 48px 0; }

/* Tap ergonomics (all viewports — harmless on desktop) */
a, button, select, label, input[type=checkbox], input[type=radio] { touch-action: manipulation; }
.btn:active { transform: scale(0.97); }

/* Progress — for work that runs long enough that a still screen reads as broken.
   A receipt PDF takes ~0.7s per receipt, so a hundred of them is over a minute
   of nothing happening. Indeterminate by design: most of our slow work cannot
   report a percentage honestly, and a fake bar is worse than none. */
.wf-progress { position:fixed; left:0; right:0; top:0; z-index:10000; height:3px;
  background:var(--surface-3); overflow:hidden; display:none; }
.wf-progress.is-on { display:block; }
.wf-progress::after { content:""; position:absolute; inset:0 auto 0 0; width:40%;
  background:linear-gradient(90deg,transparent,var(--accent),transparent);
  animation:wf-progress-slide 1.1s ease-in-out infinite; }
@keyframes wf-progress-slide { 0% { left:-40%; } 100% { left:100%; } }
.wf-progress-note { position:fixed; left:50%; translate:-50% 0; top:16px; z-index:10000;
  display:none; align-items:center; gap:10px; max-width:min(92vw,420px);
  padding:10px 16px; background:var(--surface); color:var(--text);
  border:1px solid var(--border-bright); border-radius:var(--radius-full);
  box-shadow:var(--shadow-lg); font-size:var(--text-sm); font-weight:var(--fw-semibold); }
.wf-progress-note.is-on { display:flex; }
.wf-spinner { width:14px; height:14px; flex-shrink:0; border-radius:50%;
  border:2px solid var(--border-bright); border-top-color:var(--accent);
  animation:wf-spin .7s linear infinite; }
@keyframes wf-spin { to { transform:rotate(360deg); } }
/* A button that kicked off long work says so and stops taking second clicks. */
.btn.is-busy { pointer-events:none; opacity:.72; }
.btn.is-busy::before { content:""; width:13px; height:13px; margin-right:7px;
  border-radius:50%; border:2px solid currentColor; border-top-color:transparent;
  animation:wf-spin .7s linear infinite; }
@media (prefers-reduced-motion:reduce) {
  .wf-progress::after, .wf-spinner, .btn.is-busy::before { animation:none; }
  .wf-progress::after { left:0; width:100%; opacity:.5; }
}

/* Floating "back to Wayfinder" pill, injected into every app page (server.py).
   Tokens, not fixed colors — a dark pill on a light page was the whole bug. */
.wf-back { position:fixed; left:16px; bottom:16px; z-index:9999; display:inline-flex;
  align-items:center; gap:6px; padding:8px 14px; background:var(--surface);
  color:var(--text-muted); border:1px solid var(--border-bright);
  border-radius:var(--radius-full); font-size:var(--text-xs); font-weight:var(--fw-semibold);
  text-decoration:none; backdrop-filter:blur(6px); box-shadow:var(--shadow-md); }
.wf-back:hover { color:var(--accent); border-color:var(--accent); }
/* Same corner problem as .wf-back: inline styles could not be moved out of the
   way of the tab bar, so the toggle is a class now too. */
.wf-theme-btn { position:fixed; right:16px; bottom:16px; z-index:9999; width:40px; height:40px;
  border-radius:50%; border:1px solid var(--border-bright); cursor:pointer;
  background:var(--surface); color:var(--text); font-size:1.02rem; line-height:1;
  box-shadow:var(--shadow-md); }
.wf-theme-btn:hover { border-color:var(--accent); }
@media (max-width: 768px) { .wf-back { min-height:44px; padding:8px 16px; } }

/* Mobile guardrails — docs/mobile_ux_guideline.md. 768px = standard mobile breakpoint.
   16px input floor kills iOS focus auto-zoom; min-width beats any width:Npx on
   undersized checkboxes without touching per-component CSS. */
@media (max-width: 768px) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]),
  select, textarea { font-size: 16px !important; min-height: 44px; }
  input[type=checkbox], input[type=radio] { min-width: 20px; min-height: 20px; }
  .nav-brand { font-size: 0.95rem; }
}

/* Mobile responsive */
@media (max-width: 600px) {
  .container { padding: 24px 16px calc(60px + env(safe-area-inset-bottom, 0px)); }
  nav { padding: 10px 16px; }
  .nav-user { gap: 6px; }
  .nav-user a { padding: 8px 12px; min-height: 44px; display: inline-flex; align-items: center; }
  .dashboard { padding: 24px 20px; flex-direction: column; gap: 16px; }
  .dashboard-greeting h2 { font-size: 1.25rem; }
  .service-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .service-card { padding: 16px; }
  .service-icon { font-size: 1.5rem; margin-bottom: 8px; }
  .service-name { font-size: 0.85rem; }
  .service-desc { display: none; }
  .add-form { flex-direction: column; }
  .add-form input, .add-form button { width: 100%; }
  .add-form input { font-size: 1rem; min-height: 44px; }
  .add-form button { min-height: 44px; font-size: 1rem; }
  .todo-item { flex-wrap: wrap; padding: 12px 14px; }
  .actions { width: 100%; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; gap: 6px; }
  .btn { padding: 10px 14px; font-size: 0.85rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .stat-card { padding: 12px 16px; min-width: 80px; }
  .stat-card .stat-num { font-size: 1.6rem; }
  h1 { font-size: 1.4rem; }
}
@media (max-width: 400px) {
  .service-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-stats { gap: 8px; }
}

/* === Adaptive Today Hub (dashboard) === */
.wf-stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px}
.wf-stat{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:20px 18px;box-shadow:var(--shadow-sm)}
.wf-stat-value{font-size:2.2rem;font-weight:800;letter-spacing:-.03em;line-height:1;color:var(--text)}
.wf-stat-sub{font-size:1rem;font-weight:500;color:var(--text-muted);margin-left:2px}
.wf-stat-label{font-size:.78rem;color:var(--text-muted);font-weight:600;margin-top:8px;text-transform:uppercase;letter-spacing:.05em}
.wf-today-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.wf-today-title{font-size:1rem;font-weight:800;color:var(--text)}
.wf-today-list{display:flex;flex-direction:column;gap:8px}
.wf-today-item{display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius-md);transition:.15s;margin:0}
.wf-today-item:hover{border-color:var(--accent);background:var(--surface-3)}
.wf-today-item.wf-done{opacity:.5}
.wf-today-text{flex:1;font-size:.92rem;font-weight:600;color:var(--text);text-align:left}
.wf-today-item.wf-done .wf-today-text{text-decoration:line-through;color:var(--text-muted)}
.wf-check{width:26px;height:26px;flex-shrink:0;border-radius:50%;border:2px solid var(--border);background:transparent;cursor:pointer;color:var(--on-accent);font-size:.85rem;font-weight:800;display:flex;align-items:center;justify-content:center;transition:.15s;padding:0;position:relative}
/* The circle stays 26px; the tap area is extended to 44 with a pseudo
   element so rows keep their spacing. */
.wf-check::after{content:'';position:absolute;top:50%;left:50%;translate:-50% -50%;width:max(100%,44px);height:max(100%,44px);border-radius:50%}
.wf-check:hover{border-color:var(--accent)}
.wf-check--on{background:linear-gradient(135deg,var(--accent),var(--info));border-color:transparent}
.wf-streak-chip{font-size:.72rem;color:var(--warn);font-weight:700;white-space:nowrap;background:rgba(251,191,36,.1);padding:2px 8px;border-radius:var(--radius-full);border:1px solid rgba(251,191,36,.3)}
.wf-next-cta{display:flex;align-items:center;gap:10px;margin-top:14px;padding:12px 14px;border:1px dashed var(--border);border-radius:var(--radius-md);color:var(--text-muted);font-size:.86rem}
.wf-home-empty{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.wf-empty-card{padding:28px 24px;text-align:center}
.wf-empty-icon{font-size:2.4rem;margin-bottom:10px}
.wf-empty-title{font-size:1rem;font-weight:800;color:var(--text);margin-bottom:14px}
.wf-empty-form{display:flex;flex-direction:column;gap:10px}
.wf-empty-input{padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface-2);color:var(--text);font-size:.9rem}
.wf-empty-input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}
@media(max-width:600px){
  .wf-stat-grid{grid-template-columns:1fr 1fr;gap:10px}
  .wf-stat{padding:14px 12px}.wf-stat-value{font-size:1.7rem}
  .wf-home-empty{grid-template-columns:1fr}
}

/* === Shared components (2026-07-28) ==========================================
   Promoted out of cardconv so apps stop re-inventing them. Demos and the rules
   that go with each one live on /design §3. The mobile guardrails above already
   cover type size and tap targets — these only add shape. */

/* Form controls — recessed on --bg-deep inside a --surface container */
.wf-field{display:flex;flex-direction:column;gap:4px;min-width:0}
.wf-label{font-size:var(--text-xs);font-weight:var(--fw-bold);letter-spacing:.06em;
  text-transform:uppercase;color:var(--text-muted)}
.wf-input{background:var(--bg-deep);border:1px solid var(--border);border-radius:var(--radius-md);
  color:var(--text);padding:8px 10px;font-size:var(--text-sm);font-family:inherit;width:100%}
.wf-input:focus{outline:none;border-color:var(--accent)}
.wf-input:disabled{color:var(--text-dim);background:var(--surface-2)}
/* Money and any other column that has to line up between rows. */
.wf-input.wf-num{text-align:right;font-variant-numeric:tabular-nums}
.wf-checkbox{display:inline-flex;align-items:center;gap:6px;font-size:var(--text-sm);
  color:var(--text-muted);cursor:pointer}

/* Empty state — self-sufficient on its own, transparent when a card wraps it */
.wf-empty-card:not(.notepad-card){background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-lg)}
.wf-empty-sub{font-size:var(--text-sm);color:var(--text-muted);margin:-6px 0 14px}
.wf-empty-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}

/* Modal — states the consequence; the destructive action is never the default */
/* The scrim stays dark in both themes — a light scrim doesn't read as "the
   page behind is inert", which is the one job a scrim has. */
.wf-modal-backdrop{position:fixed;inset:0;z-index:300;background:rgba(8,13,20,.6);
  display:flex;align-items:center;justify-content:center;padding:20px}
.wf-modal{background:var(--surface);border:1px solid var(--border-bright);
  border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);padding:18px 20px;
  width:100%;max-width:440px;max-height:85vh;overflow-y:auto}
.wf-modal-title{font-size:var(--text-base);font-weight:var(--fw-bold);margin:0 0 8px}
.wf-modal-body{font-size:var(--text-sm);color:var(--text-muted);line-height:1.6;margin:0 0 16px}
.wf-modal-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap}

/* Bottom sheet — what an anchored popover becomes on a narrow viewport */
.wf-sheet{position:fixed;left:0;right:0;bottom:0;z-index:250;background:var(--surface);
  border-top:1px solid var(--border-bright);border-radius:var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow:var(--shadow-lg);padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));
  max-height:80vh;overflow-y:auto}
.wf-sheet-title{font-size:var(--text-base);font-weight:var(--fw-bold);margin-bottom:12px}

/* Transactional table that becomes cards on mobile — every td needs data-label */
.wf-cardtable{width:100%;border-collapse:collapse;font-size:var(--text-sm)}
.wf-cardtable th{text-align:left;font-size:var(--text-xs);font-weight:var(--fw-bold);
  letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);
  padding:8px 10px;border-bottom:1px solid var(--border)}
.wf-cardtable td{padding:9px 10px;border-bottom:1px solid var(--border)}

@media (max-width: 768px){
  /* A modal at phone width is a bottom sheet — same rule as every popover. */
  .wf-modal-backdrop{align-items:flex-end;padding:0}
  .wf-modal{max-width:none;border-radius:var(--radius-xl) var(--radius-xl) 0 0;
    border-left:0;border-right:0;border-bottom:0;
    padding-bottom:calc(18px + env(safe-area-inset-bottom,0px))}
  .wf-modal-actions .btn{flex:1}
  /* Rows become cards: the header goes away and each cell labels itself. */
  .wf-cardtable thead{display:none}
  .wf-cardtable tr{display:block;background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius-lg);padding:10px 12px;margin-bottom:10px}
  .wf-cardtable td{display:flex;justify-content:space-between;align-items:center;gap:12px;
    padding:5px 0;border:0}
  .wf-cardtable td::before{content:attr(data-label);font-size:var(--text-xs);
    font-weight:var(--fw-bold);letter-spacing:.06em;text-transform:uppercase;
    color:var(--text-muted);flex-shrink:0}
  .wf-cardtable td[data-label=""]::before{content:none}
}
