:root {
  --bg: #f6f3ee; --card: #fffdf9; --ink: #1f1d2b; --muted: #6b6878; --line: #e6e0d6;
  --accent: #5b4bdb; --accent-soft: #ece9ff; --good: #1f8a5b; --good-soft: #e3f4ea;
  --warn: #b7791f; --bad: #c0392b; --bad-soft: #fbe9e7;
  --low: #2f9e8f; --med: #d69e2e; --high: #d0574a;
  --radius: 14px; --shadow: 0 1px 2px rgba(31,29,43,.06), 0 4px 16px rgba(31,29,43,.05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

.top { display: flex; gap: 16px; align-items: center; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; gap: 10px; align-items: center; min-width: 210px; }
.logo { font-size: 28px; color: var(--accent); }
.brand-name { font-weight: 700; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 13px; }
.capture { flex: 1; }
.capture input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.capture input:focus { outline: 2px solid var(--accent); background: #fff; }
.icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 40px; height: 40px; font-size: 18px; }

.tabs { display: flex; gap: 4px; padding: 10px 24px 0; max-width: 1100px; margin: 0 auto; }
.tabs button { border: none; background: none; padding: 10px 16px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }
.badge:empty { display: none; }

main { max-width: 1100px; margin: 0 auto; padding: 0 24px 80px; }
.tab { display: none; }
.tab.active { display: block; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin: 16px 0; }
.card h2 { margin: 0 0 4px; font-size: 20px; }
.card h3 { margin: 18px 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.hero .goal { font-size: 22px; font-weight: 700; margin: 4px 0; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--accent-soft) 0); }
.ring span { background: var(--card); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }

.bar { height: 8px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.task { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--muted); background: #fff; display: grid; place-items: center; font-size: 15px; color: #fff; padding: 0; }
.task.done .check, .check.on { background: var(--good); border-color: var(--good); }
.milestone .check { border-radius: 50%; }
.title { cursor: pointer; font-weight: 500; }
.title:hover { color: var(--accent); }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.tag.low { background: #e0f3f0; color: var(--low); } .tag.med { background: #fbf1dc; color: #9a6b12; } .tag.high { background: #fae3e0; color: var(--high); }
.tag.engine { background: var(--accent-soft); color: var(--accent); }
.tag.notes { background: #fff3c4; color: #7a5b00; }
.star { border: none; background: none; font-size: 20px; color: #c9c3b8; padding: 4px; }
.star.on { color: #e0a800; }
.focus-slot { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; color: var(--muted); text-align: center; margin: 6px 0; }
.focus .task { background: #fffaf0; border-radius: 12px; border: 1px solid #f3e3bd; margin: 6px 0; padding: 12px; }

details.month { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px 0; }
details.month > summary { list-style: none; padding: 16px 20px; cursor: pointer; display: grid; grid-template-columns: 1fr 200px auto; gap: 16px; align-items: center; }
details.month > summary::-webkit-details-marker { display: none; }
details.month .inner { padding: 0 20px 16px; }
.sprint-head { margin: 14px 0 4px; padding: 10px 12px; background: var(--accent-soft); border-radius: 10px; }
.sprint-head b { color: var(--accent); }
.current-pill { background: var(--accent); color: #fff; font-size: 12px; border-radius: 999px; padding: 2px 8px; margin-left: 6px; }

.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; background: transparent; }
.add-row input:focus { border-style: solid; outline: 2px solid var(--accent); background: #fff; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 14px; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn:disabled { opacity: .5; cursor: wait; }

.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(480px, 100vw); background: var(--card); box-shadow: -8px 0 32px rgba(0,0,0,.12); transform: translateX(105%); transition: transform .25s; z-index: 20; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-inner { padding: 22px; }
.scrim { position: fixed; inset: 0; background: rgba(31,29,43,.25); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 15; }
.scrim.open { opacity: 1; pointer-events: auto; }
.field { display: grid; gap: 4px; margin: 12px 0; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note { background: #fffaf0; border: 1px solid #f3e3bd; border-radius: 10px; padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; }
.note .when { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.note button { border: none; background: none; color: var(--muted); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 80px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; opacity: 0; transition: all .25s; z-index: 30; max-width: 90vw; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--bad); }
.burst { position: fixed; pointer-events: none; font-size: 22px; z-index: 40; animation: burst .9s ease-out forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; } }

table.names { width: 100%; border-collapse: collapse; font-size: 14px; }
table.names th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 2px solid var(--line); position: sticky; top: 68px; background: var(--card); cursor: pointer; }
table.names td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.names tr.pass td:nth-child(2) { font-weight: 700; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.status.pass { background: var(--good-soft); color: var(--good); }
.status.fail { background: var(--bad-soft); color: var(--bad); }
.dom { font-size: 12px; display: block; }
.dom.free { color: var(--good); } .dom.taken { color: var(--muted); text-decoration: line-through; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 220px; }
.empty { text-align: center; padding: 30px; color: var(--muted); }
.streak { font-size: 12px; color: var(--warn); font-weight: 600; }
@media (max-width: 700px) { .top { flex-wrap: wrap; } details.month > summary { grid-template-columns: 1fr; } .grid2 { grid-template-columns: 1fr; } }
table.names tr.vetoed td { opacity: .55; }
table.names tr.vetoed td.actions { opacity: 1; }
td.actions { display: flex; gap: 6px; flex-direction: column; align-items: stretch; }
.btn.small { padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); }
.login-card .brand { margin-bottom: 8px; min-width: 0; }
.login-card .btn { width: 100%; margin-top: 4px; }
.login-error { color: var(--bad); min-height: 1.4em; margin: 10px 0 0; font-size: 14px; }
