:root {
  color-scheme: light;
  --canvas: #f7f8fa;
  --surface: #fff;
  --text: #18202d;
  --muted: #526075;
  --line: #e1e6ee;
  --accent: #2b51ba;
  --accent-dark: #21429e;
  --accent-soft: #ebf1ff;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; min-height: 100vh; background: var(--canvas); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #6386ef; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 1.15rem; line-height: 1.3; }
.muted { color: var(--muted); }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .admin-nav-inner, .dashboard { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.topbar-inner { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand, .account { display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 670; }
.brand-icon, .empty-icon { display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.brand-icon { width: 35px; height: 35px; border-radius: 10px; }
.account { font-size: .875rem; }
.secondary, .primary { border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; background: var(--surface); color: var(--text); font-weight: 600; }
.secondary:hover { background: var(--canvas); }
.primary { color: #fff; border-color: var(--accent); background: var(--accent); padding: 10px 16px; }
.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.admin-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-nav-inner { display: flex; gap: 24px; }
.admin-nav a { border-bottom: 2px solid transparent; padding: 12px 0 10px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.admin-nav a:hover { color: var(--text); }
.admin-nav a[aria-current="page"] { border-color: var(--accent); color: var(--accent-dark); }

.dashboard { padding-block: clamp(30px, 6vw, 65px); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading p, .login-card > p { margin-top: 8px; }
.count { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; color: var(--muted); font-size: .875rem; }
.count strong { color: var(--text); font-variant-numeric: tabular-nums; }
.registry, .login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 6px #1c2b4610; }
.registry { overflow: hidden; }
.registry :focus-visible { outline-offset: -2px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 20px; vertical-align: top; }
th { background: #fbfcfe; color: var(--muted); font-size: .85rem; font-weight: 650; }
th small { margin-inline-start: 4px; font-size: .72rem; font-weight: 550; }
td { border-top: 1px solid var(--line); font-size: .9rem; }
td:first-child { white-space: nowrap; width: 20%; }
td:nth-child(2) { width: 25%; }
time { font-variant-numeric: tabular-nums; }
code { font: .86rem/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }
.table-footer { border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; font-size: .875rem; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pagination > * { display: grid; min-width: 32px; min-height: 32px; padding-inline: 5px; place-items: center; border-radius: 7px; }
.pagination a:hover { background: var(--canvas); }
.pagination .current { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.pagination .ellipsis { color: var(--muted); }

.empty-state { padding: 66px 20px; text-align: center; }
.empty-icon { width: 48px; height: 48px; border-radius: 13px; margin: 0 auto 16px; }
.empty-state p { margin-top: 6px; }

.login-main { display: grid; justify-items: center; padding: clamp(38px, 8vw, 100px) 20px 38px; }
.login-card { width: min(100%, 410px); padding: clamp(22px, 5vw, 34px); }
.login-card h1 { font-size: 1.85rem; }
.login-card form { display: grid; margin-top: 25px; }
.login-card label { font-size: .9rem; font-weight: 630; margin-bottom: 5px; }
.login-card input:not([type="hidden"]) { width: 100%; min-height: 42px; margin-bottom: 16px; padding: 8px 11px; border: 1px solid #cbd4e1; border-radius: 8px; color: var(--text); }
.login-card button { margin-top: 4px; }
.form-error { color: #9c2828; background: #fef1f1; border-radius: 8px; padding: 9px 11px; margin-bottom: 16px; font-size: .9rem; }
.form-success { color: #245f43; background: #eaf6ee; border-radius: 8px; padding: 9px 11px; font-size: .9rem; }
.token-settings { display: grid; gap: 16px; max-width: 670px; }
.token-settings .form-error { margin: 0; }
.token-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: clamp(16px, 4vw, 24px); }
.token-panel > p { margin-top: 7px; }
.token-panel form, .token-panel details { margin-top: 16px; }
.token-panel summary { width: fit-content; cursor: pointer; font-size: .875rem; }
.token-value { display: block; background: var(--canvas); border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; padding: 10px 12px; user-select: all; }
.confirm-token { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: .9rem; }
.confirm-token input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

@media (max-width: 680px) {
  .topbar-inner, .admin-nav-inner, .dashboard { width: calc(100% - 32px); }
  .topbar-inner { min-height: 60px; }
  .account-name { display: none; }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 18px; }
  th, td { padding: 12px; }
  td:first-child { white-space: normal; }
  .table-footer { padding-inline: 12px; }
}

@media (max-width: 460px) {
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { padding: 13px 14px; }
  tbody tr + tr { border-top: 1px solid var(--line); }
  td, td:first-child, td:nth-child(2) { padding: 3px 0; width: auto; border: 0; }
  td::before { display: block; content: attr(data-label); color: var(--muted); font-size: .79rem; }
}
