/* Design read: personal work tool, phone first. ENERGY 1 / RHYTHM 2 / MOTION 1.
   Palette from black-figure pottery: warm clay paper, black ink, one terracotta accent.
   Identity motif: the meander band under the header. Headings in Georgia: the archival voice of the channel. */
:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --ink: #1f1a17;
  --muted: #5c534c;
  --line: #e1d6c8;
  --accent: #a3401a;
  --accent-ink: #ffffff;
  --accent-soft: #f4e2d6;
  --ok: #2e6a39;
  --warn: #8a4b00;
  --danger: #a12a2a;
  --focus: #1f5fbf;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171310;
    --surface: #211b17;
    --ink: #f1e9e1;
    --muted: #b8ab9f;
    --line: #3b322b;
    --accent: #e3906a;
    --accent-ink: #1a120d;
    --accent-soft: #3a2519;
    --ok: #7fc48c;
    --warn: #e2b062;
    --danger: #f08b8b;
    --focus: #8ab4ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; margin-top: 1.75rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: .5rem; z-index: 10; background: var(--surface); padding: .5rem 1rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top::after {
  content: "";
  display: block;
  height: 8px;
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='8' viewBox='0 0 16 8'%3E%3Cpath d='M0 7h7V1H3v4h2' fill='none' stroke='%23c4673c' stroke-width='1.4'/%3E%3Cpath d='M8 7h7V1h-4v4h2' fill='none' stroke='%23c4673c' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
}
.top-in { max-width: 860px; margin: 0 auto; padding: .5rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
.brand { font-family: Georgia, serif; font-weight: 600; }
#nav { display: flex; flex-wrap: wrap; gap: .25rem; max-width: 100%; }
#nav a {
  color: var(--ink);
  text-decoration: none;
  padding: .5rem .6rem;
  border-radius: var(--radius);
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
#nav a:hover { background: var(--accent-soft); }
#nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }

main { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
main:focus { outline: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }

button, .btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: .5rem .9rem;
  min-height: 44px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
button:hover, .btn:hover { border-color: var(--ink); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.ghost:hover { color: var(--danger); border-color: var(--line); }
button.ghost.armed { color: var(--danger); border-color: var(--danger); }
td button.ghost { min-height: 36px; padding: .25rem .5rem; margin: -.3rem 0; }
details.tails > summary { cursor: pointer; list-style-position: outside; margin-left: 1.1rem; min-height: 44px; display: list-item; }
details.tails > summary h2 { display: inline; margin: 0; }
details.tails[open] > summary { margin-bottom: .5rem; }

label { display: block; font-size: .875rem; color: var(--muted); margin-bottom: .25rem; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .55rem .7rem;
  min-height: 44px;
  width: 100%;
}
textarea { min-height: 8rem; resize: vertical; }
.field { flex: 1 1 140px; min-width: 0; }
.field.narrow { flex: 0 1 110px; }
.inline-radio { display: flex; gap: 1rem; align-items: center; min-height: 44px; }
.inline-radio label { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink); margin: 0; font-size: 1rem; cursor: pointer; }
.inline-radio input { width: auto; min-height: 0; }

.daynav { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.phase { font-family: Georgia, serif; color: var(--accent); margin-bottom: .25rem; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: .5rem 0; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.progress.ok > span { background: var(--ok); }
.progress.warn > span { background: var(--warn); }

.group { margin-top: 1.25rem; }
.group-title { font-size: .875rem; font-weight: 600; color: var(--muted); margin: 0 0 .35rem; }
.task { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.task input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; margin: .1rem 0 0; accent-color: var(--accent); cursor: pointer; flex: none; }
.task .body { flex: 1; min-width: 0; }
.task .title { cursor: pointer; display: block; color: var(--ink); font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.task.done .title { color: var(--muted); text-decoration: line-through; }
.task .meta { font-size: .8125rem; color: var(--muted); }
.task details { margin-top: .25rem; font-size: .9rem; color: var(--muted); }
.task summary { cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; }
.claude { color: var(--ink); }
.tag { display: inline-block; font-size: .75rem; padding: 0 .4rem; border-radius: 4px; background: var(--accent-soft); color: var(--ink); }

.empty { padding: 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.error { color: var(--danger); }
.saved { color: var(--ok); font-size: .875rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.stat .num { font-family: Georgia, serif; font-size: 1.4rem; font-variant-numeric: lining-nums tabular-nums; }
.stat.lead { border-color: var(--accent); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.income { color: var(--ok); }
.expense { color: var(--danger); }

.note-entry { border-top: 1px solid var(--line); padding: .75rem 0; }
.note-entry pre { white-space: pre-wrap; font: inherit; margin: .25rem 0 0; overflow-wrap: anywhere; }
.reached { color: var(--ok); }

.plan-day { border-top: 1px solid var(--line); padding: .6rem 0; }
.plan-day ul { margin: .25rem 0 0; padding-left: 1.1rem; }

@media (min-width: 720px) {
  h1 { font-size: 1.9rem; }
  main { padding-top: 1.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
