:root {
    color-scheme: dark;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #101512;
    color: #f2f5ef;
    --muted: #b2bfb4;
    --line: #36453b;
    --panel: #19221c;
    --input: #111914;
    --accent: #c7ebaa;
    --ink: #15250f;
    --danger: #ffbfb6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.55; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -.04em; }
h2 { font-size: 1.2rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.35; }
h4 { font-size: .9rem; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner, main { max-width: 82rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 3rem); }
.header-inner { min-height: 4.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .65rem; font-size: 1.12rem; font-weight: 700; }
.brand-mark { display: grid; place-items: center; inline-size: 1.75rem; block-size: 1.75rem; color: var(--ink); background: var(--accent); border-radius: .45rem; font-size: .85rem; }
.brand-label { color: var(--muted); font-size: .8rem; font-weight: 500; border-left: 1px solid var(--line); padding-left: .65rem; }
main { padding-block: clamp(1.5rem, 4vw, 3rem); }
.intro { margin-bottom: 1.65rem; }
.eyebrow { color: var(--accent); font-size: .72rem; letter-spacing: .13em; text-transform: uppercase; font-weight: 700; margin-bottom: .55rem; }
.description { color: var(--muted); margin-top: .45rem; max-width: 80ch; font-size: .9rem; }
.intro .description { margin-top: .7rem; }
.panel { border: 1px solid var(--line); background: var(--panel); padding: clamp(1rem, 2.5vw, 1.5rem); border-radius: .8rem; min-width: 0; }
#dashboard > .panel { margin-block: 1rem; }
.login-panel { max-width: 26rem; margin: 5vh auto; }
form { display: grid; gap: .8rem; margin-top: 1rem; }
form button[type="submit"] { justify-self: start; }
#token-form { grid-template-columns: minmax(12rem, 2fr) minmax(8rem, 1fr) minmax(8rem, 1fr) auto; align-items: end; gap: .65rem 1rem; }
#token-form .attempts { grid-column: 1 / -1; }
label { display: grid; gap: .28rem; font-size: .82rem; font-weight: 600; }
button, input, select { font: inherit; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; min-height: 2.55rem; padding: .45rem .65rem; color: inherit; border: 1px solid #506053; border-radius: .4rem; background: var(--input); font-size: .88rem; font-weight: 400; }
button { min-height: 2.55rem; padding: .42rem .9rem; background: var(--accent); color: var(--ink); border: 1px solid transparent; border-radius: .4rem; font-size: .88rem; font-weight: 650; cursor: pointer; }
button:hover { background: #dcf6c6; }
button.secondary { color: #e6eee4; background: transparent; border-color: #506053; }
button.secondary:hover { background: #27372b; }
button:disabled, input:disabled, select:disabled { opacity: .52; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.attempts, .helper, .empty { color: var(--muted); font-size: .8rem; }
.attempts { min-height: 1.3rem; font-variant-numeric: tabular-nums; }
.opus-note { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); max-width: 100ch; }
.feedback { border-inline-start: 2px solid var(--accent); padding: .35rem .7rem; font-size: .9rem; overflow-wrap: anywhere; }
.feedback[data-error="true"] { border-color: var(--danger); color: var(--danger); }
.code-panel { border-color: #7fa268; }
.code-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.code-actions input { flex: 1 1 17rem; font-family: ui-monospace, monospace; }
#copy-feedback { margin-top: .7rem; }
.section-heading, .dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.section-heading { margin-bottom: 1rem; }
.count { display: inline-block; color: var(--muted); font-size: .8rem; font-weight: 500; padding-inline: .5rem; }
.table-scroll { overflow-x: auto; }
.token-table { width: 100%; min-width: 46rem; border-collapse: collapse; text-align: left; }
.token-table thead th { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 550; font-size: .65rem; padding: .5rem .6rem; }
.token-table tbody th, .token-table td { border-top: 1px solid var(--line); padding: .7rem .6rem; vertical-align: middle; }
.token-table th:first-child { padding-left: 0; width: 40%; }
.token-table td:last-child { padding-right: 0; text-align: right; }
.token-table tbody tr:hover { background: #1d2a21; }
.token-table select { width: auto; min-width: 6rem; min-height: 2.25rem; padding: .35rem .5rem; font-size: .8rem; }
.token-table .row-type { min-width: 7rem; }
button.token-name { background: transparent; color: var(--accent); font-size: .86rem; text-align: left; padding: .3rem .25rem .3rem 0; overflow-wrap: anywhere; font-weight: 600; }
button.token-name:hover { text-decoration: underline; }
.badge { display: inline-block; padding: .15rem .5rem; font-size: .7rem; line-height: 1.55; border-radius: .3rem; background: #25362a; color: #d4e1d4; white-space: nowrap; }
.badge[data-state="active"] { background: #2c472c; color: #d9f7b9; }
.badge[data-state="disabled"], .badge[data-state="expired"] { background: #50302a; color: #ffd1c5; }
.toggle { display: flex; align-items: center; gap: .45rem; cursor: pointer; position: relative; width: fit-content; min-height: 2.5rem; font-size: .76rem; }
.toggle input { position: absolute; opacity: 0; width: 2rem; height: 1.2rem; margin: 0; }
.switch-track { width: 2rem; height: 1.15rem; border-radius: 1rem; background: #465349; position: relative; pointer-events: none; }
.switch-track::after { content: ''; position: absolute; top: .18rem; left: .18rem; width: .79rem; height: .79rem; border-radius: 50%; background: #f0f4ed; transition: transform .15s; }
.toggle input:checked + .switch-track { background: #89b76a; }
.toggle input:checked + .switch-track::after { transform: translateX(.85rem); background: #172411; }
.toggle input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.toggle input:disabled ~ span { opacity: .52; cursor: not-allowed; }
button.danger-quiet { background: transparent; color: var(--danger); border-color: #65453e; font-size: .8rem; }
button.danger-quiet:hover { background: #3c2824; }
button.danger { background: #f6b3a9; color: #321510; }
button.danger:hover { background: #ffd0c7; }
.audit-list, .installation-list { list-style: none; margin: .75rem 0 0; padding: 0; }
.audit-list li { display: flex; justify-content: space-between; gap: .3rem 1rem; flex-wrap: wrap; padding-block: .55rem; border-top: 1px solid var(--line); font-size: .8rem; overflow-wrap: anywhere; }
.audit-list strong { font-weight: 500; }
.detail { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; margin-top: .2rem; }
.empty { padding-block: .75rem; }
.table-hint { margin-bottom: .6rem; }
dialog { color: inherit; background: var(--panel); border: 1px solid #506053; border-radius: .9rem; padding: clamp(1.2rem, 4vw, 2rem); width: min(44rem, calc(100% - 2rem)); max-height: calc(100dvh - 3rem); overflow: auto; box-shadow: 0 1rem 5rem #0009; }
dialog::backdrop { background: #050b08bd; backdrop-filter: blur(3px); }
dialog h2 { font-size: 1.35rem; overflow-wrap: anywhere; }
.dialog-heading button { flex-shrink: 0; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.5rem; margin-block: 1.5rem; }
.detail-facts div { min-width: 0; }
.detail-facts dt, .installation-facts dt { color: var(--muted); font-size: .73rem; margin-bottom: .25rem; }
.detail-facts dd, .installation-facts dd { margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.detail-facts div:nth-child(3) { grid-column: 1 / -1; }
.installation-section { border-top: 1px solid var(--line); padding-top: 1rem; }
.installation-section .description { font-size: .8rem; }
.installation-list li { padding: 1rem; background: var(--input); border: 1px solid var(--line); border-radius: .5rem; margin-top: .75rem; }
.installation-id { display: block; color: var(--muted); font-size: .7rem; overflow-wrap: anywhere; margin-top: .25rem; }
.installation-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: .8rem 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .65rem; margin-top: 1.4rem; }
.offline-note { margin-top: 1rem; }
#delete-dialog { max-width: 32rem; }
#delete-dialog > .helper, #delete-feedback { margin-top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 48rem) {
    #token-form { grid-template-columns: 1fr 1fr; }
    #token-form > label:first-child { grid-column: 1 / -1; }
    #token-form button { grid-column: 1 / -1; }
}
@media (max-width: 29rem) {
    .brand-label { display: none; }
    .detail-facts, .installation-facts { grid-template-columns: 1fr; }
    .detail-facts div:nth-child(3) { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { .switch-track::after { transition: none; } }
