:root {
  color-scheme: light;
  --bg: #f6f0e6;
  --paper: #fffaf2;
  --paper-strong: #fffdf8;
  --ink: #2f2f2d;
  --muted: #8c8378;
  --line: #e3d8c8;
  --sage: #a7bfa3;
  --blue: #b7c9d6;
  --rose: #d9b8b4;
  --apricot: #e8b98f;
  --shadow: 0 18px 48px rgba(72, 55, 38, .16);
  font-family: Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100dvh; background: radial-gradient(circle at 10% 0%, #fff7ec 0, transparent 34%), var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; min-height: 44px; border-radius: 16px; padding: 0 16px; background: var(--ink); color: #fffaf2; font-weight: 700; cursor: pointer; }
button.secondary { background: #ebe1d2; color: var(--ink); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(183, 201, 214, .9); outline-offset: 2px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-strong); color: var(--ink); padding: 12px 13px; }
textarea { resize: vertical; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.error, .status-box { border-radius: 16px; padding: 12px 14px; background: #f4d9cf; color: #7b3e2d; font-size: 13px; }
.status-box.ok { background: #dfe9d9; color: #425b3d; }

.login-screen { display: grid; place-items: center; padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom)); }
.login-shell { width: min(430px, 100%); }
.login-card { display: grid; gap: 16px; padding: 26px; border: 1px solid var(--line); border-radius: 30px; background: rgba(255, 250, 242, .9); box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; line-height: .96; letter-spacing: -.04em; }
.login-lead { color: var(--muted); line-height: 1.45; }

.app-screen { padding: max(14px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom)); overflow-x: hidden; }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 8px 0 10px; backdrop-filter: blur(16px); }
.app-header h1 { margin-top: 2px; font-size: 24px; line-height: 1; letter-spacing: -.035em; }
.round-btn { min-width: 76px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 22px rgba(72, 55, 38, .08); }

.date-pager { position: sticky; top: 62px; z-index: 19; display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; margin-bottom: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 250, 242, .82); backdrop-filter: blur(16px); text-align: center; }
.date-pager button { padding: 0; border-radius: 14px; background: #ebe1d2; color: var(--ink); font-size: 24px; }

.task-shell { display: grid; gap: 10px; }
.quickbar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.quickbar button { padding: 0 10px; }
.task-list { overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: rgba(255, 250, 242, .72); }
.task-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; min-height: 58px; padding: 8px 10px; border-bottom: 1px solid rgba(227, 216, 200, .72); }
.task-row:last-child { border-bottom: 0; }
.task-row.done { color: #9a9288; background: rgba(167, 191, 163, .12); }
.task-row.cancelled { opacity: .58; }
.task-row-main { min-width: 0; }
.task-title { display: block; overflow: hidden; color: inherit; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.task-row.done .task-title { text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: #7f9c79; }
.task-meta { display: flex; gap: 6px; align-items: center; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.person-chip { max-width: 104px; overflow: hidden; border-radius: 999px; padding: 2px 7px; background: rgba(183, 201, 214, .5); color: #465b67; text-overflow: ellipsis; }
.date-meta { font-variant-numeric: tabular-nums; }
.deadline-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--apricot); }
.check-btn { display: grid; place-items: center; width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; border: 1.5px solid #b8aa99; border-radius: 50%; background: transparent; color: transparent; }
.task-row.done .check-btn { border-color: var(--sage); background: var(--sage); color: #fff; }
.empty-state { display: grid; gap: 8px; padding: 28px 20px; border: 1px dashed #d7c8b5; border-radius: 24px; background: rgba(255, 250, 242, .58); }
.empty-state h2 { font-size: 20px; letter-spacing: -.03em; }
.empty-state p:last-child { color: var(--muted); }

.edge-swipe-zone { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; height: max(24px, env(safe-area-inset-bottom)); touch-action: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(47, 47, 45, .18); backdrop-filter: blur(3px); }
.bottom-sheet { position: fixed; z-index: 80; left: 0; right: 0; bottom: 0; max-height: min(86dvh, 720px); overflow: auto; padding: 8px 14px max(18px, env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--paper); box-shadow: var(--shadow); }
.sheet-handle { width: 44px; height: 5px; margin: 4px auto 14px; border-radius: 999px; background: #d5c7b6; }
.sheet-content { display: grid; gap: 13px; max-width: 680px; margin: 0 auto; }
.sheet-content h2 { font-size: 23px; letter-spacing: -.035em; }
.sheet-content h3 { margin-top: 8px; font-size: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 4px; }
.compact-form { display: grid; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 253, 248, .72); }
.logout-link { display: grid; place-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; font-weight: 800; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; padding: 16px 12px max(16px, env(safe-area-inset-bottom)); background: rgba(47, 47, 45, .22); backdrop-filter: blur(4px); }
.modal-card { position: relative; display: grid; gap: 12px; width: min(520px, 100%); max-height: 88dvh; overflow: auto; padding: 22px; border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.modal-card form { display: grid; gap: 12px; }
.modal-close { justify-self: end; min-height: 36px; padding: 0 12px; background: #ebe1d2; color: var(--ink); }

@media (min-width: 760px) {
  .app-screen { width: min(760px, 100%); margin: 0 auto; }
  .task-row { min-height: 54px; }
  .modal { place-items: center; }
}

@media (max-width: 370px) {
  .quickbar { grid-template-columns: 1fr 1fr; }
  .quickbar .ghost { grid-column: 1 / -1; }
  .two-col { grid-template-columns: 1fr; }
}
