:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #5f6b7a; --line: #dde2e8;
  --accent: #1f5fbf; --accent-text: #fff; --ok: #1d7a46; --err: #b3261e; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2128; --text: #e7eaee; --muted: #b4bfcb; --line: #313741; --accent: #5b95ea; --accent-text: #0e1320; --ok: #4cc283; --err: #f2867f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 820px; margin: 0 auto; padding: 16px; }
.top { display: flex; justify-content: space-between; align-items: center; max-width: 820px; margin: 0 auto; padding: 12px 16px; }
.brand { font-size: 20px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.brand .clean { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 16px; }
.logout { display: inline; }
.navlink { color: var(--muted); }
select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-size: 14px; color: var(--muted); font-weight: 600; }
.readonly fieldset[disabled] { border: 0; padding: 0; margin: 0; min-width: 0; }
.readonly input:disabled, .readonly textarea:disabled { opacity: 1; color: var(--text); }
.top { gap: 12px; }
footer { max-width: 820px; margin: 24px auto; padding: 0 16px; color: var(--muted); font-size: 13px; }
h1 { font-size: 26px; margin: 8px 0 12px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 20px 0 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.narrow { max-width: 440px; margin: 40px auto; }
.small, .hint { color: var(--muted); font-size: 14px; font-weight: normal; }
.error { color: var(--err); }
.flash { background: color-mix(in srgb, var(--ok) 12%, transparent); border: 1px solid var(--ok); border-radius: var(--radius); padding: 10px 14px; }
.badge { display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.badge.ok { border-color: var(--ok); color: var(--ok); }
button, .button { display: inline-block; background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; color: var(--muted); padding: 0; font-weight: normal; text-decoration: underline; }
a { color: var(--accent); }
input[type=email], input[type=text], input[type=number], input:not([type]), textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input.num { width: 6.5em; }
input.mid { width: 12em; }
input.wide { width: 18em; max-width: 100%; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; margin: 8px 0; max-width: 34em; }
.field .val { display: flex; align-items: center; white-space: nowrap; }
.field.block { display: block; margin: 12px 0; max-width: none; }
.field.block span { display: block; margin-bottom: 4px; }
.field.block input { width: 100%; }
.q { border: 0; padding: 0; margin: 22px 0; min-width: 0; }
.opt input.wide { flex: 1 1 8em; min-width: 0; width: auto; }
.q legend { padding: 0; margin-bottom: 8px; }
.opt { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; }
.opt > input[type=checkbox], .opt > input[type=radio] { flex-shrink: 0; margin-top: 2px; }
.opt input.num, .opt input.wide { margin-top: -4px; }
.opt input[type=checkbox], .opt input[type=radio], .grid input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.steps { color: var(--muted); }
.scroll { overflow-x: auto; }
.grid { border-collapse: collapse; }
.grid { width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
.grid thead th { font-size: 14px; font-weight: 600; }
.grid tbody th { font-weight: normal; }
.grid td { white-space: nowrap; }
.grid td { text-align: center; }
.unit { color: var(--muted); margin-left: 4px; }
.actions { display: flex; gap: 12px; justify-content: flex-end; padding: 12px 0; }
.sticky { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); }
.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--accent); color: var(--accent); }
.drop input { display: block; margin: 0 auto 8px; }
#queue, .files { list-style: none; padding: 0; }
#queue li { padding: 8px 0; border-bottom: 1px solid var(--line); }
#queue progress { display: block; width: 100%; height: 8px; margin-top: 4px; }
#queue .meta { color: var(--muted); font-size: 14px; }
#queue li.ok .meta { color: var(--ok); }
#queue li.err .meta { color: var(--err); }
.files li { padding: 4px 0; }
@media (max-width: 560px) {
  .card { padding: 16px; }
  input.num { width: 5em; }
  .grid input.num { width: 4em; }
  .grid th, .grid td { padding: 6px 4px; }
  .actions { justify-content: stretch; }
  .actions button { flex: 1; }
}

input.copy { width: 100%; font-family: ui-monospace, monospace; font-size: 14px; margin: 4px 0 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }

.opt.inline { align-items: center; flex-wrap: wrap; }
.opt.inline > input[type=radio] { margin-top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.drop b { color: var(--accent); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid th input.wide { width: 100%; min-width: 6em; }
.sum { margin: 4px 0 0; }
.sum.warn { color: var(--err); }
.files li { display: flex; gap: 8px; align-items: baseline; }
.files li > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files li > button { flex-shrink: 0; }
.files button.link { font-size: 14px; }

.nowrap { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.grid thead th { white-space: normal; hyphens: manual; min-width: 6.5em; }
.opt-body { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
input[pattern]:not(:focus):invalid { border-color: var(--err); outline: 1px solid var(--err); }
.saved { align-self: center; margin-right: auto; color: var(--ok); font-weight: 600; }

.badge.warn { border-color: var(--err); color: var(--err); }
.flash.err { border-color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.docs li { flex-wrap: wrap; }
.docs li > a { font-weight: 600; }
form.inline { display: inline; }
.consent { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
