:root {
    color-scheme: dark;

    --bg: #0b0e13;
    --surface: #11151c;
    --raised: #181d27;
    --line: #222936;
    --line-strong: #343e50;
    --text: #e8ebf1;
    --dim: #a8b0bd;
    --faint: #838d9e;

    --accent: #c5ee4f;
    --accent-ink: #141a05;
    --good: #3fd08f;
    --bad: #f4707b;

    --sans:
        ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        sans-serif;
    --mono:
        ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono",
        monospace;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    --radius: 10px;
    --radius-small: 6px;
    --control: 36px;
}

@media (pointer: coarse) {
    :root {
        --control: 44px;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.45;
}

h1,
p,
ol {
    margin: 0;
}

ol {
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-small);
}

[hidden] {
    display: none !important;
}

.auth {
    display: grid;
    min-height: 100dvh;
    align-content: center;
    justify-items: center;
    gap: var(--space-5);
    padding: var(--space-5) var(--space-4);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand:hover {
    color: inherit;
}

.brand-mark {
    display: grid;
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 800;
    place-items: center;
}

.panel {
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.panel-body {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-5);
}

h1 {
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.stack {
    display: grid;
    gap: var(--space-4);
}

.lead {
    color: var(--dim);
}

.field {
    display: grid;
    gap: var(--space-1);
}

.field > span {
    color: var(--dim);
    font-size: 12px;
    font-weight: 600;
}

.field small {
    color: var(--faint);
    font-size: 12px;
}

.field input {
    height: var(--control);
    min-width: 0;
    padding: 0 var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--bg);
}

.field input:focus-visible {
    outline-offset: 0;
    border-color: var(--accent);
}

.check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.btn {
    display: inline-flex;
    height: var(--control);
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--raised);
    color: var(--text);
    font-size: 13px;
    font-weight: 550;
    white-space: nowrap;
}

.btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.btn:hover:not(:disabled) {
    border-color: var(--faint);
    color: var(--text);
}

.btn-primary {
    border-color: transparent;
    background: var(--accent);
    color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
    border-color: transparent;
    background: color-mix(in srgb, var(--accent) 88%, white);
    color: var(--accent-ink);
}

.btn-block {
    width: 100%;
}

.notice,
.form-error {
    padding: var(--space-2) var(--space-3);
    border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--tone) 10%, transparent);
    color: var(--tone);
}

.notice {
    --tone: var(--good);
}

.form-error {
    --tone: var(--bad);
}

.qr {
    display: grid;
    justify-items: center;
}

.qr svg {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-small);
}

.secret {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    font-family: var(--mono);
    font-size: 13px;
    overflow-wrap: anywhere;
    user-select: all;
}

.field input.code-input {
    font-family: var(--mono);
    font-size: 18px;
    letter-spacing: 0.2em;
}

.rows {
    display: grid;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    list-style: none;
}

.rows li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3);
}

.rows li + li {
    border-top: 1px solid var(--line);
}

.row-name {
    flex: 1 1 auto;
    font-weight: 600;
}

.row-state {
    color: var(--dim);
}

.row-actions {
    display: flex;
    gap: var(--space-3);
    color: var(--dim);
}

.row-actions a {
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.aside {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    color: var(--dim);
}

.aside a {
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    font-family: var(--mono);
    font-size: 13px;
    user-select: all;
}

@media (pointer: coarse) {
    .field input {
        font-size: 16px;
    }
}
