:root {
  --ink: #1f2226;
  --muted: #6a7077;
  --line: #e4e2dc;
  --page: #faf9f6;
  --card: #ffffff;
  --accent: #0f6b62;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0ee;
  --bad: #a3321f;
  --bad-soft: #fbece8;
  --warn-soft: #fbf3dc;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 64px; }
a { color: var(--accent); }
h1, h2, .mark { font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; margin: 28px 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.crumb { margin: 20px 0 0; font-size: 0.9rem; color: var(--muted); }

/* top bar */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 20px; min-height: 56px; flex-wrap: wrap; }
.mark { font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.mark span { color: var(--accent); }
nav { display: flex; gap: 4px; flex: 1; }
nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav a:hover { background: var(--accent-soft); }
.bar form { margin: 0; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 8px; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack > .card, form.stack .card { margin-bottom: 4px; }
label { font-size: 0.9rem; font-weight: 600; margin-top: 10px; display: block; }
label.check { font-weight: 400; font-size: 1rem; display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; }
label.check.off { color: var(--muted); }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; min-height: 44px; border: 1px solid #cfccc3; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .switch input:focus-visible + span {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px 10px; margin: 12px 0 0; background: #fcfcfa; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 6px; }
.ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.field-err { color: var(--bad); font-size: 0.85rem; display: block; margin-top: 4px; }

.btn { display: inline-block; font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  padding: 11px 20px; min-height: 44px; border-radius: 8px; cursor: pointer; text-decoration: none; margin-top: 14px; align-self: flex-start; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 12px; min-height: 36px; margin-top: 0; font-size: 0.9rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { margin-top: 4px; }

/* cards, lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; }
.card h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list { list-style: none; padding: 0; margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.row { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 12px; align-items: center; padding: 12px 16px; color: inherit; text-decoration: none; }
.row:hover { background: #f6f5f1; }
.row .id { font-weight: 600; font-variant-numeric: tabular-nums; }
.row .when { color: var(--muted); font-size: 0.85rem; text-align: right; }
.row .styles { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.row .styles i { font-style: normal; font-size: 0.8rem; background: #f0eee8; border-radius: 99px; padding: 1px 10px; }
.row .err { grid-column: 1 / -1; color: var(--bad); font-size: 0.85rem; }
.reels { list-style: none; margin: 0; padding: 0; }
.reels li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.reels li:first-child { border-top: 0; }
.reels .v { min-width: 130px; font-weight: 600; }
.reels details, .reels p { flex-basis: 100%; margin: 0; }
details summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; padding: 6px 0; }
details ul { margin: 4px 0 8px; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }

.badge { font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: #eceae4; color: #4a4f55; text-transform: capitalize; }
.s-done { background: var(--accent-soft); color: var(--accent); }
.s-rendering, .s-review, .s-queued { background: var(--warn-soft); color: #7a5a00; }
.s-failed, .s-blocked, .s-rejected { background: var(--bad-soft); color: var(--bad); }
.chip { font-family: system-ui, sans-serif; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }

.msg { border-radius: 8px; padding: 10px 14px; margin: 14px 0; background: #f0eee8; }
.msg.ok { background: var(--accent-soft); color: #0b4f48; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: #6b4f00; }

/* settings widgets */
.style .head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.style .head h2 { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 28px; }
.switch span { width: 46px; height: 26px; border-radius: 99px; background: #c9c6bd; position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch b { font-weight: 600; font-size: 0.9rem; min-width: 26px; }
.dial { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; }
.dial input[type=range] { width: 100%; accent-color: var(--accent); min-height: 44px; }
.dial output { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3ch; }
.hist-h { margin-top: 36px; }
.hist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; }
.hist li.live { background: #f3f9f8; }
.hist form { margin: 0; }

/* verdict segmented control */
.seg { display: flex; gap: 8px; margin: 4px 0 6px; }
.seg label { margin: 0; flex: 1; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; text-align: center; padding: 10px 0; border: 1px solid #cfccc3; border-radius: 8px; cursor: pointer; font-weight: 600; background: #fff; min-height: 44px; }
.seg input:checked + span { color: #fff; border-color: transparent; }
.seg-keep input:checked + span { background: var(--accent); }
.seg-fix input:checked + span { background: #b7791f; }
.seg-drop input:checked + span { background: var(--bad); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* login */
.login { max-width: 340px; margin: 14vh auto 0; }
.login h1 { text-align: center; margin-bottom: 24px; }
.login h1 span { color: var(--accent); }
.login .btn { align-self: stretch; text-align: center; }

@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  .bar { gap: 6px 12px; padding-top: 8px; padding-bottom: 6px; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .row { grid-template-columns: 1fr auto; }
  .row .when { grid-column: 1 / -1; text-align: left; }
  .dial { grid-template-columns: 1fr 1fr; }
  .dial input { grid-column: 1 / -1; grid-row: 2; }
  .dial output { grid-column: 2; grid-row: 1; justify-self: end; }
}
