:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --line: #e3e6eb;
  --primary: #1f5fbf;
  --primary-text: #ffffff;
  --ok-bg: #e7f6ec; --ok-text: #135c2e;
  --warn-bg: #fff4dc; --warn-text: #7a4b00;
  --err-bg: #fdecec; --err-text: #8a1c1c;
  --pill-deleted: #fdecec; --pill-deactivated: #fff4dc; --pill-restored: #e7f6ec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --card: #1a2029; --text: #e6e9ee; --muted: #9aa4b2; --line: #2b3340;
    --primary: #4b8ef0; --primary-text: #0b1220;
    --ok-bg: #133022; --ok-text: #9be2b5;
    --warn-bg: #3a2c0b; --warn-text: #f3cf7a;
    --err-bg: #3a1616; --err-text: #f5a3a3;
    --pill-deleted: #3a1616; --pill-deactivated: #3a2c0b; --pill-restored: #133022;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
}
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 20px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.top-actions form { margin: 0; }
.lang { color: var(--primary); text-decoration: none; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.card h2 { margin-top: 0; font-size: 18px; }
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { cursor: progress; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.filters label, .code-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; min-width: 0;
}
.code-form input#code { font-size: 22px; letter-spacing: 6px; text-align: center; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.filters .row { margin-top: 0; }
.bar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bar .btn { margin-inline-start: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.pill.deleted { background: var(--pill-deleted); }
.pill.deactivated { background: var(--pill-deactivated); }
.pill.restored { background: var(--pill-restored); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.warn { background: var(--warn-bg); color: var(--warn-text); }
.flash.error { background: var(--err-bg); color: var(--err-text); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
@media (max-width: 600px) {
  main { padding: 12px 16px; }
  .top { padding: 12px 16px; }
}
