/* Layout: calm top bar, one centred column, checklist is the main surface. Jade for progress, sand for what remains. */
:root {
  --bg: #f3f6f4; --surface: #ffffff; --ink: #22302b; --ink-soft: #55645d; --ink-faint: #74827b;
  --line: #dde5e1; --line-strong: #c5d1cb;
  --jade: #2e6f5d; --jade-deep: #1f5546; --jade-tint: #e5f0ec; --on-jade: #ffffff; --focus: #86b8a8; --sand: #e7e3d8;
  --done: #3a8a67; --done-bg: #e3f1ea; --progress: #3b6ea5; --progress-bg: #e5edf6;
  --waiting: #a9661b; --waiting-bg: #f7ecdc; --overdue: #b3433b; --overdue-bg: #f8e4e1; --idle: #66736d; --idle-bg: #eceeed;
  --internal: #6a4a86; --internal-bg: #efe7f5; --demo: #7a5f1e; --demo-bg: #f3ecd9; --note-bg: #f7faf9;
  --shadow: 0 20px 60px rgba(20, 40, 33, .25);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1a16; --surface: #17241f; --ink: #e6efe9; --ink-soft: #a9bbb2; --ink-faint: #889a90;
  --line: #263630; --line-strong: #36483f;
  --jade: #4aa88d; --jade-deep: #8fd0bb; --jade-tint: #1d3a31; --on-jade: #07130f; --focus: #4aa88d; --sand: #2b3a34;
  --done: #6cc9a0; --done-bg: #1c3a2e; --progress: #86b3e3; --progress-bg: #1c2f45;
  --waiting: #e0a85d; --waiting-bg: #3d2f1a; --overdue: #ee8f86; --overdue-bg: #43211e; --idle: #a2b0aa; --idle-bg: #25312c;
  --internal: #c9a9e6; --internal-bg: #2e2338; --demo: #e0c67a; --demo-bg: #3a3220; --note-bg: #1b2a24;
  --shadow: 0 20px 60px rgba(0, 0, 0, .55); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1a16; --surface: #17241f; --ink: #e6efe9; --ink-soft: #a9bbb2; --ink-faint: #889a90;
  --line: #263630; --line-strong: #36483f;
  --jade: #4aa88d; --jade-deep: #8fd0bb; --jade-tint: #1d3a31; --on-jade: #07130f; --focus: #4aa88d; --sand: #2b3a34;
  --done: #6cc9a0; --done-bg: #1c3a2e; --progress: #86b3e3; --progress-bg: #1c2f45;
  --waiting: #e0a85d; --waiting-bg: #3d2f1a; --overdue: #ee8f86; --overdue-bg: #43211e; --idle: #a2b0aa; --idle-bg: #25312c;
  --internal: #c9a9e6; --internal-bg: #2e2338; --demo: #e0c67a; --demo-bg: #3a3220; --note-bg: #1b2a24;
  --shadow: 0 20px 60px rgba(0, 0, 0, .55); color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0; text-wrap: balance; }
h1 { font-size: 1.8rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; } a { color: var(--jade-deep); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-soft); } .faint { color: var(--ink-faint); } .small { font-size: .875rem; } .nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; } .stack-lg > * + * { margin-top: 1.75rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1 1 0; min-width: 0; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.topbar-in { max-width: 1100px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.logo { width: 38px; height: 38px; flex: none; } .logo svg { width: 100%; height: 100%; display: block; }
.brand-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.nav { display: flex; gap: .2rem; } .nav button { font: inherit; font-weight: 500; background: none; border: 0; color: var(--ink-soft); padding: .45rem .8rem; border-radius: 8px; cursor: pointer; }
.nav button:hover { background: var(--bg); color: var(--ink); } .nav button[aria-current="page"] { background: var(--jade-tint); color: var(--jade-deep); }
.who { margin-left: auto; display: flex; align-items: center; gap: .6rem; } .who-name { text-align: right; line-height: 1.2; } .who-name b { display: block; } .who-name span { font-size: .8rem; color: var(--ink-faint); }
.bell { position: relative; } .count { position: absolute; top: -5px; right: -5px; background: var(--overdue); color: #fff; font-size: .7rem; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 6rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; } .page-head p { margin: .25rem 0 0; }
.crumbs { font-size: .875rem; margin-bottom: .5rem; } .crumbs button { font: inherit; background: none; border: 0; padding: 0; color: var(--ink-soft); cursor: pointer; } .crumbs button:hover { text-decoration: underline; }
.preview-bar { background: var(--demo-bg); color: var(--demo); padding: .55rem 16px; display: flex; gap: .8rem; justify-content: center; align-items: center; flex-wrap: wrap; font-weight: 600; font-size: .9rem; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: .5rem 1rem; border-radius: 8px; cursor: pointer; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn:hover { border-color: var(--jade); } .btn.primary { background: var(--jade); border-color: var(--jade); color: var(--on-jade); } .btn.primary:hover { filter: brightness(.92); }
.btn.danger { color: var(--overdue); border-color: var(--line-strong); } .btn.danger:hover { background: var(--overdue-bg); border-color: var(--overdue); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-soft); } .btn.quiet:hover { background: var(--bg); color: var(--ink); }
.btn.small { min-height: 34px; padding: .2rem .65rem; font-size: .875rem; } .btn.icon { padding: 0; width: 34px; min-height: 34px; } .btn[disabled] { opacity: .45; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
input, select, textarea { font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); min-height: 42px; }
textarea { min-height: 88px; resize: vertical; } input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); border-color: var(--jade); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--jade); }
select.inline { width: auto; min-height: 30px; padding: .1rem .4rem; font-size: .8rem; border-radius: 6px; }
.check-row { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; } .check-row input { margin-top: 2px; flex: none; }
.field + .field { margin-top: 1rem; } .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } .form-grid .full { grid-column: 1 / -1; }
.hint { font-size: .85rem; color: var(--ink-soft); margin-top: .25rem; } .error { background: var(--overdue-bg); color: var(--overdue); border-radius: 8px; padding: .6rem .8rem; margin-bottom: 1rem; font-weight: 500; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; } .toolbar input { flex: 2 1 220px; width: auto; } .toolbar select { flex: 1 1 150px; width: auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .9rem; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: .9rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.stat b { display: block; font-family: var(--serif); font-size: 2rem; line-height: 1.1; font-weight: 600; } .stat span { color: var(--ink-soft); font-size: .9rem; } .stat.warn b { color: var(--overdue); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; } .cols > * { min-width: 0; }
.badge { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }
.badge.done { background: var(--done-bg); color: var(--done); } .badge.progress { background: var(--progress-bg); color: var(--progress); } .badge.waiting { background: var(--waiting-bg); color: var(--waiting); }
.badge.overdue { background: var(--overdue-bg); color: var(--overdue); } .badge.jade { background: var(--jade-tint); color: var(--jade-deep); } .badge.demo { background: var(--demo-bg); color: var(--demo); } .badge.internal { background: var(--internal-bg); color: var(--internal); }

.progress { height: 12px; border-radius: 999px; background: var(--sand); overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--jade); border-radius: 999px; transition: width .4s ease; } .progress.sm { height: 8px; }
.progress-line { display: flex; align-items: center; gap: .75rem; } .progress-line .progress { flex: 1; min-width: 60px; } .progress-line b { min-width: 3rem; text-align: right; font-variant-numeric: tabular-nums; }
.big-progress { display: flex; align-items: baseline; gap: .6rem; margin: 1rem 0 .5rem; flex-wrap: wrap; } .big-progress b { font: 600 2.4rem/1 var(--serif); font-variant-numeric: tabular-nums; }

.tablewrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: .85rem; color: var(--ink-soft); font-weight: 600; padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
td { padding: .8rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; } tr.link { cursor: pointer; } tr.link:hover td { background: var(--bg); } tr:last-child td { border-bottom: 0; }

.task { display: flex; gap: .85rem; align-items: flex-start; padding: .85rem .5rem; border-bottom: 1px solid var(--line); } .task:last-child { border-bottom: 0; }
.check { flex: none; width: 34px; height: 34px; border-radius: 9px; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; color: #fff; margin-top: 1px; }
.check svg { width: 20px; height: 20px; opacity: 0; } .check:hover { border-color: var(--jade); } .check[aria-checked="true"] { background: var(--done); border-color: var(--done); } .check[aria-checked="true"] svg { opacity: 1; }
.check[aria-disabled="true"] { cursor: default; border-style: dashed; background: var(--bg); } .check[aria-disabled="true"][aria-checked="true"] { border-style: solid; background: var(--done); }
.task-main { flex: 1; min-width: 0; cursor: pointer; } .task-name { font-weight: 600; overflow-wrap: anywhere; } .task-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; align-items: center; }
.task.done .task-name { color: var(--ink-faint); text-decoration: line-through; } .done-line { font-size: .85rem; color: var(--ink-soft); margin-top: .3rem; }
.task-tools { display: flex; gap: .2rem; flex: none; } .task.big { padding: 1.1rem .6rem; } .task.big .check { width: 42px; height: 42px; } .task.big .check svg { width: 26px; height: 26px; } .task.big .task-name { font-size: 1.05rem; }
.task.late { background: linear-gradient(90deg, var(--overdue-bg), transparent 40%); border-radius: 8px; }
.stage-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; flex-wrap: wrap; } .stage-head h3 { flex: 1 1 180px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); } .seg button { font: inherit; font-weight: 600; background: none; border: 0; padding: .45rem .9rem; cursor: pointer; color: var(--ink-soft); min-height: 38px; } .seg button[aria-pressed="true"] { background: var(--jade-tint); color: var(--jade-deep); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; } .tabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: .7rem 1rem; cursor: pointer; color: var(--ink-soft); } .tabs button[aria-selected="true"] { color: var(--jade-deep); border-bottom-color: var(--jade); }
details.fold > summary { cursor: pointer; font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.next { background: var(--jade-tint); border-radius: 8px; padding: .8rem 1rem; display: flex; gap: .5rem 1rem; flex-wrap: wrap; align-items: center; } .next b { color: var(--jade-deep); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem 1.5rem; margin: 1rem 0; } .facts dt { font-size: .8rem; color: var(--ink-faint); } .facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.note-box { border-left: 3px solid var(--jade); background: var(--note-bg); padding: .7rem .9rem; border-radius: 0 8px 8px 0; margin-top: .8rem; white-space: pre-wrap; } .note-box.internal { border-left-color: var(--internal); background: var(--internal-bg); }
.note-box .label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: .2rem; }
.comment { padding: .7rem 0; border-bottom: 1px solid var(--line); } .comment:last-child { border: 0; } .comment .who-line { font-size: .85rem; color: var(--ink-soft); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; } .comment p { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment.internal { background: var(--internal-bg); padding: .7rem; border-radius: 8px; margin: .4rem 0; border: 0; }
.activity { list-style: none; margin: 0; padding: 0; } .activity li { padding: .7rem 0 .7rem 1.1rem; border-left: 2px solid var(--line); position: relative; margin-left: .3rem; } .activity li::before { content: ""; position: absolute; left: -6px; top: 1.05rem; width: 10px; height: 10px; border-radius: 50%; background: var(--jade); } .activity time { display: block; font-size: .82rem; color: var(--ink-faint); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-soft); } .empty b { display: block; font-family: var(--serif); font-size: 1.15rem; color: var(--ink); margin-bottom: .25rem; }
.banner { background: var(--jade-tint); border: 1px solid var(--line-strong); border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1.25rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.alert-list { list-style: none; margin: 0; padding: 0; } .alert-list li { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .6rem; justify-content: space-between; align-items: center; flex-wrap: wrap; } .alert-list li:last-child { border: 0; }
.link-btn { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; color: var(--jade-deep); cursor: pointer; text-align: left; } .link-btn:hover { text-decoration: underline; }
.gate { min-height: 70vh; display: grid; place-items: center; padding: 1.5rem 16px; } .gate .card { max-width: 440px; text-align: center; padding: 2rem; } .gate .logo { width: 64px; height: 64px; margin: 0 auto 1rem; }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); color: var(--ink); background: var(--surface); box-shadow: var(--shadow); } dialog::backdrop { background: rgba(10, 25, 19, .5); }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem .5rem; } .dlg-body { padding: .5rem 1.5rem 1.5rem; overflow: auto; max-height: calc(100vh - 8rem); }
.dlg-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.5rem; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .7rem 1.1rem; border-radius: 10px; z-index: 100; max-width: calc(100vw - 2rem); box-shadow: var(--shadow); }
.loading { padding: 3rem; text-align: center; color: var(--ink-faint); }
.steps { margin: 0; padding-left: 1.2rem; } .steps li { margin-bottom: .5rem; }
.bottom-nav { display: none; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } .stats .stat:last-child { grid-column: span 2; } .cols { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .topbar { position: static; } .nav { display: none; } .brand { flex: 1 1 100%; } .who { width: 100%; margin-left: 0; } .who-name { text-align: left; margin-right: auto; } .who-name span { display: none; }
  h1 { font-size: 1.5rem; } .form-grid { grid-template-columns: 1fr; } main { padding-bottom: 6.5rem; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottom-nav button { flex: 1; font: inherit; font-size: .8rem; font-weight: 600; background: none; border: 0; padding: .75rem .2rem; color: var(--ink-soft); } .bottom-nav button[aria-current="page"] { color: var(--jade-deep); background: var(--jade-tint); }
  table, thead, tbody, tr, td { display: block; } thead { display: none; } tr { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .75rem; }
  td { border: 0; padding: .3rem 0; display: flex; justify-content: space-between; gap: 1rem; align-items: center; text-align: right; } td::before { content: attr(data-label); font-size: .8rem; color: var(--ink-faint); font-weight: 600; text-align: left; flex: none; }
  td.first { font-weight: 600; display: block; text-align: left; font-size: 1.05rem; } td.first::before { content: none; } td .progress-line { width: 60%; }
  .task-tools { flex-direction: column; } dialog { width: 100vw; max-width: 100vw; max-height: 94vh; margin: auto 0 0; border-radius: 16px 16px 0 0; } .dlg-body { max-height: calc(94vh - 5rem); } .toast { bottom: 5.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.logo img { background: #fff; border-radius: 50%; filter: none; width: 100%; height: 100%; display: block; object-fit: contain; }
.topbar .logo { width: 46px; height: 46px; }
