:root {
  color-scheme: dark;
  --bg: #111216;
  --surface: #1b1d23;
  --border: #30333c;
  --text: #eff0f4;
  --muted: #a0a5b2;
  --accent: #ff6030;
  --ink: #25130d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: wait; }
button, input, textarea { outline-offset: 4px; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.app { max-width: 600px; min-height: 100svh; margin: auto; padding: calc(22px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; gap: 11px; align-items: center; }
.brand-mark { display: block; width: 40px; height: 40px; object-fit: contain; flex: none; }
.brand b { font-size: 19px; letter-spacing: .2px; font-weight: 650; line-height: 1.2; }
.brand-caption { display: block; color: var(--muted); font-size: 10px; letter-spacing: 2px; margin-top: 4px; }
.icon-button { display: grid; place-items: center; background: transparent; border: 1px solid var(--border); width: 44px; height: 44px; border-radius: 14px; font-size: 24px; color: #b9bfcc; }
.day-header { margin: 28px 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow { display: block; font-size: 11px; letter-spacing: 1px; color: var(--muted); margin: 0 0 7px; }
h1 { font-size: 32px; font-weight: 600; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.6px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.8; }
#day-summary { margin: 0; font-size: 12px; }
.date-actions { display: flex; gap: 6px; align-items: center; }
.small-button, .calendar-button { height: 44px; border: 1px solid var(--border); border-radius: 13px; background: #ffffff03; font-size: 12px; padding: 0 13px; display: grid; place-items: center; color: #c2c8d5; }
.calendar-button { position: relative; overflow: hidden; width: 44px; padding: 0; }
.calendar-button input { position: absolute; inset: 0; opacity: 0; min-width: 0; width: 100%; height: 100%; cursor: pointer; font-size: 16px; }
.calendar-button:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.calendar-button input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.week-navigation { display: flex; align-items: center; gap: 2px; padding: 7px 2px; border: 1px solid var(--border); background: #ffffff02; border-radius: 18px; }
.week-arrow { border: 0; background: none; color: var(--muted); font-size: 24px; width: 24px; height: 58px; padding: 0; flex: none; }
.week-strip { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; flex: 1; }
.day { border: 1px solid transparent; background: none; border-radius: 11px; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); min-width: 0; }
.day span { font-size: 10px; }
.day b { font-size: 16px; font-weight: 550; font-variant-numeric: tabular-nums; }
.day i { width: 3px; height: 3px; background: transparent; border-radius: 50%; }
.day.has-tasks i { background: var(--muted); }
.day.current:not(.selected) b { color: var(--accent); }
.day.selected { background: var(--accent); color: var(--ink); }
.day.selected.has-tasks i { background: var(--ink); }
.list-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 12px; }
.filter-toggle { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; color: var(--muted); font-size: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.filter-toggle input { appearance: none; width: 18px; height: 18px; flex: none; margin: 0; border: 1.5px solid #757e92; border-radius: 5px; display: grid; place-items: center; cursor: pointer; }
.filter-toggle input:checked { background: var(--accent); border-color: var(--accent); }
.filter-toggle input:checked::after { content: ''; width: 8px; height: 5px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-1px) rotate(-45deg); }
.filter-toggle:has(input:checked) { color: #ff997a; }
#list-count { font-size: 11px; padding-right: 2px; }
.task-list { display: flex; flex-direction: column; gap: 8px; min-height: 120px; flex: 1; }
.task-row { display: flex; gap: 10px; padding: 14px 8px 14px 12px; background: var(--surface); border: 1px solid #2b2e37; border-radius: 15px; align-items: flex-start; }
.task-row:focus-within { border-color: #b65b3f; }
.task-check { appearance: none; flex: none; width: 24px; height: 24px; border: 1.5px solid #757e92; border-radius: 8px; cursor: pointer; display: grid; place-items: center; background: none; margin: 1px 0 0; }
.task-check:checked { background: var(--accent); border-color: var(--accent); }
.task-check:checked:after { content: ''; width: 10px; height: 6px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-1px) rotate(-45deg); }
.task-content { flex: 1; min-width: 0; }
.task-title { display: block; background: transparent; resize: none; border: 0; color: var(--text); font-size: 16px; line-height: 25px; width: 100%; padding: 0; min-height: 25px; overflow: hidden; border-radius: 2px; }
.task-row.done { background: #181a1f; border-color: #282b32; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-row.daily { background: #281e1b; border-color: #483127; }
.task-row.daily.done { background: #211c1b; }
.task-row.daily .task-content::before { content: '↻'; color: var(--accent); margin-right: 5px; float: left; font-size: 16px; line-height: 25px; }
.task-row.daily .task-title { width: calc(100% - 24px); }
.daily-separator { height: 1px; margin: 8px 4px; background: var(--border); flex: none; }
.task-section-title { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .3px; margin: 7px 4px 3px; line-height: 18px; }
.task-title:focus { color: var(--text); text-decoration: none; outline: none; }
.task-date { font-size: 12px; line-height: 20px; color: var(--muted); border: 0; background: none; padding: 0; margin-top: 5px; max-width: 145px; min-height: 24px; color-scheme: dark; }
.task-date::-webkit-calendar-picker-indicator { opacity: .5; }
.task-defer { flex: none; border: 1px solid #76503f; background: #39271f; color: #ff997a; border-radius: 10px; min-width: 48px; height: 36px; padding: 0 5px; font-size: 11px; margin-top: -5px; }
.task-defer:hover { background: #4b2c21; }
.task-delete { flex: none; border: 0; background: none; color: #8991a3; font-size: 24px; width: 40px; height: 40px; padding: 0; margin-top: -7px; border-radius: 11px; }
.task-delete:hover { color: #f1ad9d; background: #f1ad9d0b; }
.empty { margin: auto; text-align: center; padding: 32px 10px; color: var(--muted); }
.empty span { display: grid; place-items: center; width: 48px; height: 48px; margin: auto; border: 1px solid #3e475b; border-radius: 16px; color: var(--accent); font-size: 25px; }
.empty p { color: #c6ccda; font-size: 14px; margin: 17px 0 8px; }
.empty small { font-size: 11px; }
.composer { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; background: #2c231f; border: 1px solid #79503d; border-radius: 18px; padding: 7px 7px 7px 16px; box-shadow: 0 8px 28px #0005, 0 0 0 6px var(--bg); margin: 0; }
.composer input { width: 100%; min-width: 0; flex: 1; background: none; color: var(--text); border: 0; font-size: 16px; padding: 10px 0; }
.composer input::placeholder { color: #b9aaa3; }
.composer input:focus { outline: none; }
.composer:focus-within { border-color: var(--accent); }
.composer button { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--accent); color: var(--ink); }
.composer #daily-toggle { width: 48px; height: 36px; color: var(--muted); background: transparent; font-size: 12px; border-radius: 9px; }
.composer #daily-toggle[aria-pressed=true] { color: #ff997a; background: #4a2a20; }
dialog { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 22px; width: calc(100% - 28px); max-width: 440px; padding: 22px; max-height: 85dvh; }
dialog::backdrop { background: #0009; backdrop-filter: blur(5px); }
.dialog-title { display: flex; align-items: center; justify-content: space-between; }
h2 { font-size: 23px; margin: 0; }
h3 { font-size: 14px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin: 18px 0 8px; }
dialog input { width: 100%; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; color: var(--text); font-size: 16px; }
.primary-button, .secondary-button { width: 100%; min-height: 44px; padding: 12px; border-radius: 12px; font-size: 13px; margin: 7px 0; border: 1px solid var(--border); }
.primary-button { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.secondary-button { background: var(--surface); }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.security-note { font-size: 11px; color: var(--muted); line-height: 1.8; }
#toast { position: fixed; bottom: calc(94px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; background: #f4e4dc; color: var(--ink); padding: 12px 18px; border-radius: 12px; font-size: 12px; z-index: 5; box-shadow: 0 5px 20px #0005; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (min-width: 700px) { .app { padding-top: 40px; padding-bottom: 26px; } .day-header { margin-top: 24px; } .task-list { min-height: 220px; } }
@media (max-width: 360px) { .app { padding-left: 14px; padding-right: 14px; } .week-arrow { width: 18px; } .week-strip { gap: 2px; } }
@media (prefers-reduced-motion: no-preference) { button { transition: background-color .15s, color .15s, border-color .15s; } }
