:root {
  --ink: #1c1915;
  --muted: #6b645b;
  --line: #e4dcd0;
  --paper: #f6f1e8;
  --card: #fffdf8;
  --pine: #1f4d3a;
  --pine-soft: #e7f2eb;
  --clay: #9a3412;
  --clay-soft: #f8ebe3;
  --gold: #8a6a2f;
  --gold-soft: #f8f1dc;
  --shadow: 0 10px 30px rgba(48, 36, 22, 0.08);
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Iowan Old Style", serif;
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--pine); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 19px; }
p { line-height: 1.5; margin: 0 0 10px; }
code { font-family: Consolas, monospace; font-size: 0.95em; background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 5px; }
.boot { padding: 40px; color: var(--muted); }

.app { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.side { background: #17261e; color: #f6f1e8; padding: 22px 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand strong { display: block; font-family: var(--serif); font-size: 26px; }
.brand span { color: #c8d5cc; font-size: 12px; }
nav.menu { display: flex; flex-direction: column; gap: 4px; }
nav.menu button { text-align: left; background: transparent; color: #f6f1e8; border: 0; border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; }
nav.menu button.active, nav.menu button:hover { background: rgba(255,255,255,0.09); }
.side .me { margin-top: auto; font-size: 13px; color: #c8d5cc; display: flex; flex-direction: column; gap: 6px; }
.side .me button { background: transparent; color: #f6f1e8; border: 1px solid rgba(255,255,255,0.25); border-radius: 8px; padding: 6px 10px; align-self: flex-start; }
.main { padding: 22px 24px 90px; max-width: 1100px; width: 100%; }
.top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.top p { color: var(--muted); max-width: 640px; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat, .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.stat { padding: 12px 14px; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
.card { padding: 14px; }
.card.tap { cursor: pointer; }
.card.tap:hover { border-color: #cdbfae; }
.meta { color: var(--muted); font-size: 14px; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 12px; background: var(--gold-soft); color: var(--gold); white-space: nowrap; }
.pill.pine { background: var(--pine-soft); color: var(--pine); }
.pill.clay { background: var(--clay-soft); color: var(--clay); }
.pill.ink { background: #ece6dc; color: var(--ink); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.btn, .btn-ghost, .btn-danger { border-radius: 10px; padding: 10px 14px; border: 1px solid transparent; min-height: 40px; }
.btn { background: var(--pine); color: white; }
.btn:disabled, .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-danger { background: transparent; color: var(--clay); border-color: #f0d2c6; }
.small { padding: 6px 10px; min-height: 32px; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 11px 12px; width: 100%; font-size: 16px; }
textarea { min-height: 80px; resize: vertical; }
.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.span-2 { grid-column: span 2; }
.banner { background: var(--clay-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.banner.pine { background: var(--pine-soft); }
.banner strong { display: block; margin-bottom: 2px; }
.task { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.task:first-child { border-top: 0; }
.task input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--pine); }
.task small { display: block; color: var(--muted); white-space: pre-wrap; margin-top: 4px; line-height: 1.45; }
.task.locked { opacity: 0.5; }
.task.done strong { text-decoration: line-through; color: var(--muted); }
.progress { height: 8px; background: #efe7dc; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress span { display: block; height: 100%; background: var(--pine); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.tabs button { white-space: nowrap; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; }
.tabs button.active { background: var(--pine); color: white; border-color: var(--pine); }
.phase { margin-top: 14px; }
.phase h3 { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.idea { padding: 10px 0; border-top: 1px solid var(--line); }
.idea code { font-size: 15px; }
.idea a { margin-right: 10px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.steps li { line-height: 1.5; }
.steps .pill { margin-right: 6px; vertical-align: middle; }
.notice { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 14px); transform: translateX(-50%); background: var(--ink); color: white; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 50; box-shadow: var(--shadow); max-width: 92vw; }
.notice.error { background: var(--clay); }
.badge { background: var(--clay); color: white; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.login { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.login .card { padding: 22px; }
.auth-wrap { grid-column: 1 / -1; }
.empty { color: var(--muted); padding: 10px 0; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 10px 0; }
.days div { text-align: center; border-radius: 10px; padding: 8px 4px; font-size: 13px; background: #efe7dc; }
.days div.now { background: var(--pine); color: white; }
.days div.done { background: var(--pine-soft); color: var(--pine); }
.days div.lock { opacity: 0.5; }
.notif { padding: 10px 0; border-top: 1px solid var(--line); }
.notif.unread { background: linear-gradient(90deg, var(--gold-soft), transparent); margin: 0 -14px; padding: 10px 14px; }
.notif small { color: var(--muted); display: block; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.bottom-nav { display: none; }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 14px calc(var(--nav-h) + 20px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  h1 { font-size: 26px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); background: #17261e; padding-bottom: env(safe-area-inset-bottom); z-index: 40; }
  .bottom-nav button { background: transparent; border: 0; color: #c8d5cc; font-size: 11px; display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; position: relative; }
  .bottom-nav button.active { color: white; }
  .bottom-nav button .ico { font-size: 20px; line-height: 1; }
  .bottom-nav .badge { position: absolute; top: 8px; right: 18%; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
}

@media print {
  .side, .bottom-nav, .top button, .notice { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
  body { background: white; }
}
