:root {
  --navy: #0b1220;
  --navy-2: #1a2540;
  --ink: #18202f;
  --muted: #5d6779;
  --line: #dfe3ea;
  --paper: #f7f5f0;
  --card: #ffffff;
  --amber: #f0b45a;
  --amber-ink: #7a4b06;
  --ok: #1d7a4c;
  --bad: #b3261e;
  --info: #2457a6;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #f6f2ea;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .02em; color: inherit; text-decoration: none; }
.brand span { color: var(--amber); }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.tab, .link {
  font: inherit; color: #cfd6e4; background: none; border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer;
}
.tab:hover, .link:hover { color: #fff; }
.tab[aria-current="page"] { color: var(--navy); background: var(--amber); font-weight: 600; }
.who { margin-left: 16px; color: #9aa6bd; font-size: 14px; }

main { max-width: 1040px; margin: 0 auto; padding: 32px 24px 64px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 18px; margin: 36px 0 12px; }
.lede { color: var(--muted); margin: 0 0 24px; max-width: 60ch; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.auth { max-width: 420px; margin: 48px auto 0; }

label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #c3c9d4; border-radius: 8px; background: #fff;
}
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 10px 18px;
  border: 1px solid var(--navy); background: var(--navy); color: #fff;
}
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 14px; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #c3c9d4; }
.btn.ghost:hover { background: #f1f3f7; }
.btn.danger { background: #fff; color: var(--bad); border-color: #e3b7b3; }
.btn.danger:hover { background: #fdf1f0; }
.form-actions { margin-top: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.textlink { font: inherit; background: none; border: 0; padding: 0; color: var(--info); text-decoration: underline; cursor: pointer; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.drop {
  display: block; text-align: center; padding: 44px 24px; cursor: pointer;
  border: 2px dashed #b9c0cd; border-radius: var(--radius); background: #fff;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--amber); background: #fffaf0; }
.drop strong { display: block; font-size: 18px; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.progress { height: 8px; background: #e6e9ef; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .2s; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.title { font-weight: 600; min-width: 140px; max-width: 340px; overflow-wrap: break-word; }
td.title small { display: block; font-weight: 400; color: var(--bad); }
td.actions { white-space: nowrap; text-align: right; }
td.actions > * { margin-left: 6px; }
tr.batch td { background: #fff8ea; font-size: 14px; font-weight: 600; color: var(--amber-ink); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.chip.queued { background: #eef1f6; color: #465066; }
.chip.processing { background: #fff3da; color: var(--amber-ink); }
.chip.completed { background: #e3f4ea; color: var(--ok); }
.chip.failed { background: #fbe9e7; color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }

.error { color: var(--bad); font-size: 14px; margin: 12px 0 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(92vw, 560px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.bad { background: var(--bad); }

@media (max-width: 640px) {
  main { padding: 24px 16px 48px; }
  .who { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
