:root {
  --bg: #f3f6f4; --card: #ffffff; --ink: #14201a; --muted: #5b6b63; --line: #dbe4de;
  --brand: #1f5c45; --brand-ink: #ffffff; --soft: #e8f3ec; --bad: #a3321f; --ok: #1f7a4d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1613; --card: #17211c; --ink: #e6efe9; --muted: #9aaba2; --line: #2a3a32;
    --brand: #3f9b74; --brand-ink: #06130d; --soft: #1d2d25; --bad: #f08a76; --ok: #6fd3a0;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 24px; margin: 14px 0 4px; }
h2 { font-size: 18px; margin: 0 0 4px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--soft); }
.tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--brand); }

input, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { resize: vertical; min-height: 180px; margin-top: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 0; }
label input { margin-top: 6px; font-weight: 400; }
input.code { font-size: 28px; letter-spacing: 10px; text-align: center; font-family: ui-monospace, Menlo, monospace; }

button, a.ghost { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer; background: var(--brand); color: var(--brand-ink); text-decoration: none; display: inline-block; }
button:disabled { opacity: .6; cursor: default; }
.ghost { background: transparent !important; color: var(--brand) !important; border: 1px solid var(--line) !important; }
.small { padding: 5px 10px !important; font-size: 13px !important; }
.link { background: none; color: var(--muted); padding: 8px 0; font-weight: 500; text-decoration: underline; }
form > button[type=submit]:not(.link) { width: 100%; margin-top: 18px; }

.error:empty { display: none; }
.error { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; font-size: 14px; }

body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.who button { padding: 7px 12px; }
.wrap { max-width: 900px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.panel > p.muted { margin: 0 0 12px; font-size: 14px; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; margin-top: 0; }
.msg { font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); }

.drop { display: grid; place-items: center; gap: 2px; text-align: center; border: 2px dashed var(--line); border-radius: 14px; padding: 34px 12px; cursor: pointer; font-weight: 400; margin: 0; }
.drop strong { font-size: 16px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop.over, .drop:hover, .drop:focus { border-color: var(--brand); background: var(--soft); outline: none; }

.queue, .list { list-style: none; margin: 12px 0 0; padding: 0; }
.queue li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.queue progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--brand); }
.queue .qstate { grid-column: 1 / -1; font-size: 13px; }
.queue li.done .qstate { color: var(--ok); } .queue li.fail .qstate { color: var(--bad); }
.qname, .fname { overflow-wrap: anywhere; }

.list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list li.muted { display: block; }
.fname { color: var(--ink); font-weight: 600; text-decoration: none; }
.fname:hover { text-decoration: underline; }
.meta { grid-column: 2; font-size: 13px; }
.acts { grid-column: 3; grid-row: 1 / span 2; display: flex; gap: 6px; }
.badge { grid-row: 1 / span 2; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 6px; background: var(--soft); color: var(--brand); min-width: 58px; text-align: center; }
@media (max-width: 560px) {
  .list li { grid-template-columns: 1fr; }
  .badge, .meta, .acts { grid-column: 1; grid-row: auto; justify-self: start; }
}
