:root {
  --bg: #f6f3ee;
  --surface: #fffdfa;
  --surface-2: #efeae2;
  --ink: #23211d;
  --muted: #6d675d;
  --line: #e1dbd0;
  --accent: #2f6f62;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe6;
  --warm: #a2531f;
  --warm-soft: #f6e5d8;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191816;
    --surface: #24221f;
    --surface-2: #2e2b27;
    --ink: #f0ece4;
    --muted: #a69f93;
    --line: #38342f;
    --accent: #6fbfae;
    --accent-ink: #10231f;
    --accent-soft: #23403a;
    --warm: #e6a26e;
    --warm-soft: #4a3222;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }

button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

a { color: var(--accent); }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 18px) 16px calc(var(--safe-bottom) + 158px);
}

h1 { font-size: 27px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 26px 0 8px; }
.sub { color: var(--muted); margin: 0; }
.plan { margin: 10px 0 0; color: var(--ink); }
.small { font-size: 14px; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.stack { display: grid; gap: 8px; }

.now {
  margin-top: 18px;
  background: var(--accent-soft);
  border-color: transparent;
  padding: 16px;
}
.now .label { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.now .what { font-size: 21px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.now .meta { color: var(--muted); margin: 4px 0 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.quiet { background: transparent; color: var(--muted); font-weight: 500; }
.btn.full { width: 100%; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: 0.5; }

.item {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.item.plain { grid-template-columns: 1fr; }
.item .time { color: var(--muted); font-size: 15px; padding-top: 1px; font-variant-numeric: tabular-nums; }
.item .text { min-width: 0; overflow-wrap: anywhere; }
.item .meta { font-size: 14px; color: var(--muted); }
.item.done .text > span:first-child { text-decoration: line-through; color: var(--muted); }
.item.event { background: transparent; border-style: dashed; }

.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  margin-left: 6px;
  vertical-align: 1px;
}
.tag.important { background: var(--warm-soft); color: var(--warm); }

.empty { padding: 26px 8px; text-align: center; color: var(--muted); }

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 10px 0 var(--safe-bottom);
}
.dock-inner { max-width: 560px; margin: 0 auto; padding: 0 16px; }

.capture { display: flex; gap: 8px; }
.capture input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.capture .btn { padding: 10px 14px; }

nav { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 6px; }
nav button {
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}
nav button[aria-current="page"] { color: var(--accent); font-weight: 600; }
.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: var(--accent);
  color: var(--accent-ink);
}

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea, .field select, .input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 45%);
}
.sheet-body {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(var(--safe-bottom) + 18px);
}
.sheet-body h3 { font-size: 22px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -0.01em; }
.sheet-body .stack { margin-top: 16px; }

.login {
  max-width: 380px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 90px) 16px 40px;
}
.error { color: var(--warm); font-size: 15px; min-height: 22px; margin: 6px 0; }

.support {
  background: var(--warm-soft);
  border: 0;
  padding: 18px;
}
.support strong { display: block; font-size: 19px; margin-bottom: 4px; }

.code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  background: var(--surface-2);
  padding: 10px;
  border-radius: 8px;
  user-select: all;
  -webkit-user-select: all;
}
ol.steps { margin: 8px 0; padding-left: 20px; }
ol.steps li { margin-bottom: 4px; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 132px);
  z-index: 20;
  max-width: 528px;
  margin: 0 auto;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
}
