:root {
  --ink: #1d2433;
  --quiet: #5f6b7a;
  --line: #d9dee5;
  --panel: #ffffff;
  --page: #f4f6f8;
  --accent: #1f5f99;
  --accent-ink: #ffffff;
  --good: #2e7d4f;
  --wait: #9a6b00;
  --bad: #b3261e;
  --code: #f0f2f5;
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--page); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0.4rem 0 0.8rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.8rem; }
h2.inline { display: inline; }
h3 { font-size: 1rem; margin: 0 0 0.4rem; }
code, .code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

.bar { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1.5rem; background: var(--ink); color: #fff; }
.bar a.brand { color: #fff; text-decoration: none; font-weight: 600; }
.bar nav { display: flex; gap: 1rem; align-items: center; }
.bar .link { color: #cfd8e3; }
main { max-width: 1180px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.3rem; margin: 1rem 0; }
.narrow { max-width: 360px; margin: 3rem auto; }
.quiet { color: var(--quiet); }
.small { font-size: 0.85rem; }
.crumbs { margin: 0; color: var(--quiet); }

.flash { padding: 0.6rem 0.9rem; border-radius: 6px; border: 1px solid var(--line); background: #eef4fb; }
.flash.error { background: #fbeeee; border-color: #efc7c4; }
.flash.warning { background: #fff7e6; border-color: #f0d9a8; }

form.stack, .stack { display: flex; flex-direction: column; gap: 0.7rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; }
.grow { flex: 1; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 800px) { .columns { grid-template-columns: 1fr; } }
form.inline { display: inline; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 500; }
label.check { flex-direction: row; align-items: baseline; gap: 0.5rem; font-weight: 400; }
label.check input[type=checkbox] { flex: none; }
label.inline { flex-direction: row; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-weight: 500; }
input, select, textarea { font: inherit; padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); }
input[type=file] { padding: 0.25rem; }
input.short { width: 7rem; }
input.tiny { width: 5.5rem; }
input:disabled, select:disabled { background: var(--code); color: var(--quiet); cursor: not-allowed; }
textarea.code { width: 100%; background: var(--code); }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 0.8rem 1rem; }
legend { font-weight: 600; padding: 0 0.3rem; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1.5rem; }
.settings .wide { grid-column: 1 / -1; }

button, .button { font: inherit; padding: 0.4rem 0.9rem; border-radius: 5px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button.link { border: none; background: none; padding: 0; color: var(--accent); }
button.link.danger { color: var(--bad); }
.quiet-button { border: none; background: none; color: var(--quiet); }

.title-form { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
input.title { font-size: 1.5rem; font-weight: 600; border-color: transparent; background: transparent; padding: 0.2rem 0.3rem; flex: 1; }
input.title:hover, input.title:focus { border-color: var(--line); background: #fff; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-weight: 600; font-size: 0.85rem; color: var(--quiet); }
td.actions { white-space: nowrap; }
td.actions > * { margin-right: 0.6rem; }
.tag { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #e6eef7; color: var(--accent); }
.status { font-size: 0.8rem; font-weight: 600; }
.status.done { color: var(--good); }
.status.queued, .status.running { color: var(--wait); }
.status.failed { color: var(--bad); }

table.pins { border-collapse: collapse; margin-bottom: 0.4rem; }
table.pins th { padding: 0.2rem 0.4rem; text-align: left; font-size: 0.85rem; font-weight: 600; color: var(--quiet); }
table.pins td { padding: 0.15rem 0.3rem; }
table.pins:not(:has(tbody tr)) thead { display: none; }

.meter { height: 8px; background: var(--code); border-radius: 4px; overflow: hidden; margin: 0.6rem 0; }
.meter-fill { height: 100%; width: 3%; background: var(--accent); transition: width 0.6s; }
pre.log { background: var(--code); padding: 0.6rem 0.8rem; border-radius: 5px; max-height: 16rem; overflow: auto; white-space: pre-wrap; margin: 0; }

.report-head { display: flex; justify-content: space-between; align-items: center; }
.downloads { display: flex; gap: 0.5rem; }
article.document { overflow-x: auto; }
article.document table { border-collapse: collapse; margin: 0.8rem 0 1.2rem; font-size: 0.88rem; }
article.document th, article.document td { padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
article.document thead th { border-bottom: 2px solid var(--ink); }
article.document h1 { font-size: 1.4rem; }
article.document h2 { font-size: 1.15rem; margin-top: 1.6rem; }

.grid { margin-top: 1rem; }
.grid-tabs { display: flex; gap: 0.3rem; margin-bottom: 0.5rem; }
.grid-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.grid-tools { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.grid-scroll { overflow: auto; max-height: 34rem; border: 1px solid var(--line); border-radius: 6px; }
.grid table { border-collapse: collapse; font-size: 0.83rem; }
.grid th { position: sticky; top: 0; background: #eef1f5; font-weight: 600; padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.grid td { border-bottom: 1px solid #edf0f3; padding: 0; }
.grid td input { border: none; border-radius: 0; padding: 0.25rem 0.4rem; background: transparent; }
.grid td input:focus { background: #fffbe6; outline: 1px solid var(--accent); }
.grid td input.changed { background: #fff3c4; }
.grid tr.removed td input { text-decoration: line-through; color: var(--quiet); }
.grid-message { font-size: 0.85rem; }
.grid-message.error { color: var(--bad); }
.danger-zone { border-style: dashed; }
details > summary { cursor: pointer; }
