:root {
  --paper: #F3F5F7;
  --surface: #FFFFFF;
  --ink: #172033;
  --muted: #5B6675;
  --line: #D9DEE6;
  --accent: #2247D6;
  --accent-ink: #FFFFFF;
  --accepted: #2C7A4B;
  --review: #B7791F;
  --claimed: #6B7FB3;
  --open: #CBD3DE;
  --danger: #B3261E;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --radius: 6px;
  --maxw: 1080px;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.5; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; line-height: 1.15; }
h1 { font-size: 2.6rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.75em; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow: auto; max-height: 520px; white-space: pre-wrap; word-break: break-word; }
:focus-visible { outline: 3px solid #9FB3F5; outline-offset: 2px; }

.top { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding: 20px 24px; max-width: var(--maxw); width: 100%; margin: 0 auto; }
.wordmark { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.nav { display: flex; gap: 22px; align-items: baseline; flex-wrap: wrap; }
.nav a { color: var(--ink); }
.nav a.active { color: var(--accent); }
#nav-user { display: inline-flex; gap: 14px; }
.page { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 8px 24px 64px; }
.foot { max-width: var(--maxw); margin: 0 auto; padding: 24px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); width: 100%; }

/* hero */
.hero { padding: 36px 0 28px; max-width: 760px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.hero p { font-size: 1.15rem; color: var(--muted); margin-top: 14px; max-width: 62ch; }
.hero-stats { display: flex; gap: 32px; margin-top: 22px; color: var(--muted); font-size: 0.95rem; }
.hero-stats b { color: var(--ink); font-size: 1.4rem; font-family: var(--serif); font-weight: 500; margin-right: 6px; }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0 22px; }
.filters input[type=search] { flex: 1 1 260px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; color: var(--ink); cursor: pointer; }
.chip.on { border-color: var(--accent); color: var(--accent); }

/* project rows */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 1fr 260px; gap: 28px; padding: 22px 0; border-top: 1px solid var(--line); align-items: center; }
.row:last-child { border-bottom: 1px solid var(--line); }
.row h2 a { color: var(--ink); }
.row .meta { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.row .summary { margin: 6px 0 0; max-width: 64ch; }

/* the raise bar: one segment per task, colored by state */
.raise { display: flex; flex-direction: column; gap: 8px; }
.bar { display: flex; height: 14px; width: 100%; gap: 2px; background: transparent; }
.bar span { display: block; height: 100%; min-width: 2px; }
.bar .s-accepted { background: var(--accepted); }
.bar .s-submitted { background: var(--review); }
.bar .s-claimed { background: var(--claimed); }
.bar .s-open { background: var(--open); }
.bar .s-empty { background: var(--open); opacity: 0.5; flex: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.legend .l-accepted i { background: var(--accepted); }
.legend .l-submitted i { background: var(--review); }
.legend .l-claimed i { background: var(--claimed); }
.legend .l-open i { background: var(--open); }
.bar.big { height: 22px; }

/* project page */
.proj-head { padding: 24px 0 8px; display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: start; }
.proj-head .meta { color: var(--muted); margin-top: 4px; }
.proj-body { display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: start; }
.section { margin-top: 32px; }
.section > h2 { margin-bottom: 12px; }
.prose { max-width: 68ch; white-space: pre-wrap; }
.side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.panel h3 { margin-bottom: 8px; }
.panel .small { color: var(--muted); font-size: 0.9rem; }
.cmd { margin: 8px 0; }
.cmd-body { position: relative; }
.cmd pre { margin: 0; padding-right: 76px; font-size: 0.85em; }
.cmd-body .btn { position: absolute; top: 8px; right: 8px; }
.os-tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.os-tabs button { font: inherit; font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.os-tabs button.on { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 8px 0 0; }
.steps li { position: relative; padding-left: 30px; margin: 10px 0; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; justify-content: center; }
details.opts summary { cursor: pointer; font-weight: 600; margin: 18px 0 8px; }

.milestone { margin-top: 18px; }
.milestone h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.milestone h3 .count { color: var(--muted); font-family: var(--sans); font-size: 0.9rem; font-weight: 400; }
.task { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: start; }
.task .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 7px; }
.dot.open { background: var(--open); } .dot.claimed { background: var(--claimed); } .dot.submitted { background: var(--review); } .dot.accepted { background: var(--accepted); } .dot.closed { background: var(--line); }
.task .who { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.task .title { cursor: pointer; }
.task .title:hover { color: var(--accent); }
.task.blocked .title { color: var(--muted); }

.contribs { display: flex; flex-direction: column; gap: 6px; }
.contribs div { display: flex; justify-content: space-between; gap: 12px; font-size: 0.95rem; }
.contribs .n { color: var(--muted); }

.activity { display: flex; flex-direction: column; gap: 10px; }
.activity .item { display: grid; grid-template-columns: 90px 1fr; gap: 12px; font-size: 0.95rem; }
.activity .when { color: var(--muted); }
.status { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; vertical-align: 1px; }
.status.pending, .status.submitted { background: #F6E9CF; color: #7A5210; }
.status.accepted { background: #DDF0E3; color: #1F5E38; }
.status.rejected, .status.closed { background: #EEE; color: #555; }
.status.claimed { background: #E1E6F5; color: #3C4E86; }
.status.open { background: #EEF1F5; color: #4B5563; }
.status.active { background: #DDF0E3; color: #1F5E38; }
.status.paused { background: #EEE; color: #555; }

/* forms */
label { display: block; font-weight: 600; margin: 14px 0 4px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
.btn { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.good { background: var(--accepted); border-color: var(--accepted); }
.btn.bad { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 5px 11px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.form { max-width: 680px; }
.form.wide { max-width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.err { color: var(--danger); margin-top: 10px; }
.ok { color: var(--accepted); margin-top: 10px; }
.note { background: #FBF4E4; border: 1px solid #EED9A6; border-radius: var(--radius); padding: 12px 14px; margin: 14px 0; max-width: 72ch; }
.empty { color: var(--muted); padding: 20px 0; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(23,32,51,0.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 10; }
.modal { background: var(--surface); border-radius: 12px; padding: 24px; width: min(920px, 100%); max-height: calc(100vh - 80px); overflow: auto; }
.modal h2 { margin-bottom: 8px; }
.modal .close { float: right; }

/* dashboard */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.token { user-select: all; word-break: break-all; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; }
.range output { min-width: 80px; text-align: right; font-weight: 600; }

@media (max-width: 800px) {
  .row, .proj-head, .proj-body { grid-template-columns: 1fr; gap: 14px; }
  .side { position: static; }
  .two { grid-template-columns: 1fr; }
  .top { flex-direction: column; gap: 8px; }
  html { font-size: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .bar span { transition: flex-basis 300ms ease; }
}
