:root {
  --bg: #f3f1ec; --card: #fffefb; --ink: #1c1c1a; --muted: #76736b; --line: #e0ddd5;
  --accent: #e2571a; --accent-ink: #fff; --ok: #2b7a3d; --err: #b3261e; --soft: #f7f5f0;
  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.45;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141413; --card: #1e1e1c; --ink: #edebe5; --muted: #9d9a91; --line: #34332f; --soft: #262624; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); min-height: 100vh; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; }
.brand { font-weight: 700; letter-spacing: .02em; font-size: .95rem; }
.langs { display: flex; gap: 2px; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.langs button { background: none; border: 0; color: var(--muted); font: inherit; font-size: .8rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; margin: 0; }
.langs button.active { background: var(--ink); color: var(--bg); }

.wrap { max-width: 560px; margin: 0 auto; padding: 4vh 16px 60px; display: flex; flex-direction: column; gap: 18px; }
.wrap.wide { max-width: 980px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.card.narrow { max-width: 420px; width: 100%; margin: 6vh auto 0; }
h1 { font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 1.1rem; margin: 0 0 14px; }
h3 { font-size: 1rem; margin: 0; display: flex; align-items: center; gap: 6px; }
.greet { padding: 8px 4px 0; }
.greet h1 { font-size: 2rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

label { display: block; font-size: .85rem; font-weight: 600; margin: 18px 0 6px; }
input[type=text], input[type=password] { width: 100%; font: inherit; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--soft); color: inherit; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: 0 0 auto; }

button, .button { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600;
  font-size: .92rem; border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; background: var(--card);
  color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
button:disabled { opacity: .4; cursor: default; }
button.primary, .button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.wide { width: 100%; margin-top: 20px; padding: 13px; font-size: 1rem; }
button.danger:not(:disabled) { color: var(--err); border-color: currentColor; }
button.link, a.link { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 400; text-decoration: underline; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; padding: 40px 16px;
  border: 2px dashed var(--line); border-radius: 12px; background: var(--soft); text-align: center; font-weight: 500;
  color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--ink); }
.dropicon { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center; }
.drop input { display: none; }

.queue, .files { list-style: none; padding: 0; margin: 10px 0 0; }
.qitem { padding: 10px 0; border-bottom: 1px solid var(--line); }
.qrow { display: flex; gap: 10px; align-items: baseline; font-size: .92rem; }
.qname { flex: 1; overflow-wrap: anywhere; }
.qstate { color: var(--muted); font-variant-numeric: tabular-nums; }
.qitem.done .qstate { color: var(--ok); }
.qitem.error .qstate { color: var(--err); }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); transition: width .2s; }
.qitem.done .bar > div { background: var(--ok); }

.files li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.files li:last-child { border-bottom: 0; }
.finfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fname { overflow-wrap: anywhere; color: inherit; font-weight: 500; }
.finfo .muted { font-size: .82rem; }
.pill { font-size: .75rem; font-weight: 600; color: var(--ok); border: 1px solid currentColor; border-radius: 999px; padding: 2px 8px; }

.status { min-height: 1.3em; font-size: .92rem; margin: 12px 0 0; }
.status.ok { color: var(--ok); } .status.err { color: var(--err); }

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row h2 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 6px; }
.sep { flex: 1; }
.group { margin-top: 24px; padding-top: 4px; }
.group + .group { border-top: 1px solid var(--line); padding-top: 18px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { border-radius: 999px; }
.tabs button.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.badge { background: var(--err); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 7px; margin-left: 6px; }
.switch { display: flex; gap: 14px; align-items: flex-start; margin: 16px 0 0; padding: 14px 16px; font-weight: 400;
  font-size: .92rem; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.slider { flex: 0 0 auto; width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative;
  transition: background .15s; margin-top: 2px; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
input.code { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.banner { margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line);
  border-left: 4px solid var(--ok); font-size: .92rem; }
#pinBack { margin-top: 10px; }
.check { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 500; }

.tablewrap { overflow-x: auto; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
tr.bad td:nth-child(2) { color: var(--err); font-weight: 600; }
tr.good td:nth-child(2) { color: var(--ok); }
.mono { font-family: ui-monospace, Menlo, monospace; }
.nowrap { white-space: nowrap; }
.agent { color: var(--muted); max-width: 280px; overflow-wrap: anywhere; }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.small-btn { padding: 5px 10px; font-size: .82rem; }
#clearAttempts { margin-top: 14px; }

@media (max-width: 520px) {
  .card { padding: 20px; }
  .greet h1 { font-size: 1.6rem; }
}
