/* v-db admin screens. Phone first (390 px), dark, system fonts, no external resources. */
:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2b303b;
  --text: #e7e9ee; --muted: #9ba3b1; --accent: #6aa7ff; --accent-ink: #07111f;
  --danger: #ff6b6b; --danger-ink: #1a0707; --ok: #5bd69a; --warn: #f2c14e;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .9rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* layout */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 72rem; margin: 0 auto; padding: .35rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; padding: .5rem .25rem; margin-right: .25rem; }
.nav { display: flex; flex-wrap: wrap; gap: .1rem .25rem; flex: 1; }
.nav a, .nav button.linklike { color: var(--muted); text-decoration: none; padding: .6rem .6rem; border-radius: 8px; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--panel2); }
.nav form { margin: 0; }
button.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.wrap { max-width: 72rem; margin: 0 auto; padding: 1rem 1rem 4rem; }
.narrow { max-width: 28rem; }
.mid { max-width: 44rem; }

/* cards, flashes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.card > :first-child, .card > h2, .card > h3 { margin-top: 0; }
.card h3:not(:first-of-type) { margin-top: 1rem; }
table.stack { margin-bottom: 1rem; }
.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.flash { border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; border: 1px solid var(--line); background: var(--panel2); }
.flash.ok { border-color: #1f6b4a; background: #10261d; }
.flash.error { border-color: #7a2a2a; background: #2a1414; }
.error-text { color: #ffb0b0; }
.warnbox { border: 1px solid #7a5c14; background: #261d08; border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }

/* forms */
label { display: block; font-weight: 600; margin: 0 0 .25rem; }
.field { margin: 0 0 1rem; }
.hint { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; min-height: 44px; }
.check input { width: 1.4rem; height: 1.4rem; margin-top: .15rem; flex: none; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.inline-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.inline-form .field { margin: 0; flex: 1 1 10rem; }

/* buttons: thumb-sized, full width on phones */
.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1.1rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { background: #262b36; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #8ab9ff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn.danger:hover { background: #ff8585; }
.btn.small { min-height: 40px; padding: .35rem .8rem; font-size: .9rem; }
.actions { display: flex; flex-direction: column; gap: .6rem; margin: 0 0 1rem; }
.actions form { margin: 0; display: contents; }
.actions .btn { width: 100%; }
b.btn { min-height: 0; padding: .05rem .5rem; font-weight: 600; font-size: .92em; display: inline; cursor: default; white-space: nowrap; border-radius: 6px; }

/* badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); background: var(--panel2); }
.badge.active { color: var(--ok); border-color: #1f6b4a; }
.badge.suspended { color: var(--warn); border-color: #7a5c14; }
.badge.revoked { color: var(--danger); border-color: #7a2a2a; }
.badge.boot { color: var(--warn); border-color: #7a5c14; }

/* tables: stacked cards on phones, real tables from 720 px */
table { width: 100%; border-collapse: collapse; }
table.stack thead { position: absolute; left: -9999px; }
table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
table.stack tr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .85rem; margin: 0 0 .75rem; }
table.stack td { padding: .3rem 0; border: 0; overflow-wrap: anywhere; }
table.stack td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
table.stack td.act { padding-top: .5rem; }
table.stack td.act .btn { width: 100%; }
.kv { display: block; }
.kv span { color: var(--muted); }

/* copy box + QR */
.copybox { display: flex; flex-direction: column; gap: .6rem; }
.copybox .mono, .secretbox { display: block; background: var(--bg); border: 1px dashed var(--accent); border-radius: 8px; padding: .75rem; overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.secretbox { margin: 0 0 1rem; }
.qr { background: #fff; padding: .5rem; border-radius: 8px; width: 15rem; max-width: 100%; margin: 0 0 1rem; }
.qr svg { display: block; width: 100%; height: auto; }

/* help */
.help h2 { margin-top: 1.5rem; }
.help ol, .help ul { padding-left: 1.3rem; margin: 0 0 1rem; }
.help li { margin: 0 0 .4rem; }
.helpnav { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.helpnav a { padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.helpnav a[aria-current="page"] { background: var(--panel2); color: var(--text); }

.pager { display: flex; justify-content: center; margin: 1rem 0; }
.row2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }

@media (min-width: 720px) {
  .wrap { padding-top: 1.75rem; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .row2 { grid-template-columns: 1fr 1fr; }
  .actions { flex-direction: row; flex-wrap: wrap; }
  .actions .btn { width: auto; }
  .btn { }
  table.stack thead { position: static; }
  table.stack { display: table; }
  table.stack tbody { display: table-row-group; }
  table.stack tr { display: table-row; background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
  table.stack thead tr { display: table-row; }
  table.stack td, table.stack th { display: table-cell; width: auto; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
  table.stack th { text-align: left; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
  table.stack td[data-label]::before { display: none; }
  table.stack td:first-child { white-space: nowrap; }
  table.stack td.act { padding-top: .6rem; white-space: nowrap; }
  table.stack td.act .btn { width: auto; }
  .kv { display: inline; margin-right: .75rem; }
  .card .kv { display: block; margin-right: 0; }
}

/* records */
form.card > .hint { margin: 0 0 1rem; }
@media (max-width: 719px) {
  table.stack td.n { display: inline-block; width: 32%; vertical-align: top; }
}
.badge.dec-approved { color: var(--ok); border-color: #1f6b4a; }
.badge.dec-denied { color: var(--danger); border-color: #7a2a2a; }
.badge.dec-flagged { color: var(--warn); border-color: #7a5c14; }
.badge.dec-hold { color: var(--accent); border-color: #2c4f85; }
.badge.dec-disqualified { color: var(--muted); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea { resize: vertical; }
.steps { list-style: none; padding: 0; margin: 0 0 1rem; }
.pager { align-items: center; gap: .75rem; }
.card .kv { margin: 0 0 .25rem; overflow-wrap: anywhere; }
