:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #d1d5db;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card: #1e293b;
        --text: #f1f5f9;
        --muted: #94a3b8;
        --border: #334155;
        --accent: #3b82f6;
        --accent-hover: #60a5fa;
        --danger: #fca5a5;
        --danger-bg: #450a0a;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.brand { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.brand .tagline { font-weight: 400; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.locale-switch { display: flex; gap: 2px; margin: 0; flex-shrink: 0; }
.locale-switch button { width: auto; margin: 0; padding: 2px 8px; font-size: 13px; font-weight: 500; background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.locale-switch button:hover { color: inherit; }
.locale-switch button.active { color: inherit; border-color: currentColor; cursor: default; }
h1 { margin: 0 0 24px; font-size: 22px; line-height: 1.3; }
p { margin: 0 0 16px; }
.muted { color: var(--muted); font-size: 14px; }

label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }

input[type=text], input[type=password] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    font: inherit;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

button {
    width: 100%;
    padding: 10px 16px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

button:hover { background: var(--accent-hover); }

button.link {
    width: auto;
    padding: 0;
    color: var(--accent);
    background: none;
    font-weight: 400;
}

.identity {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.identity a { color: var(--accent); text-decoration: none; flex-shrink: 0; }

.error {
    margin-bottom: 16px;
    padding: 10px 12px;
    color: var(--danger);
    background: var(--danger-bg);
    border-radius: 8px;
    font-size: 14px;
}

.actions { margin-top: 16px; text-align: center; }

.center { text-align: center; }

a.button {
    display: block;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
}

a.button:hover { background: var(--accent-hover); }

.match-code {
    margin: 8px 0 20px;
    font: 700 44px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .2em;
    text-align: center;
}

.qr {
    width: 220px;
    max-width: 100%;
    margin: 0 auto 8px;
    padding: 8px;
    background: #fff;
    border-radius: 8px;
}

.qr svg { display: block; width: 100%; height: auto; }

.status { margin: 16px 0 4px; font-weight: 600; text-align: center; }
.is-confirmed .status { color: #15803d; }
.is-failed .status { color: var(--danger); }

.retry { margin-top: 16px; }

.codes {
    margin: 0 0 16px;
    padding: 8px 16px;
    list-style: none;
    counter-reset: code;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* Numbers are part of each row: list markers outside the box overlapped
   neighbouring codes in a multi-column layout. */
.codes li {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    counter-increment: code;
}

.codes li::before {
    content: counter(code) ".";
    min-width: 3ch;
    text-align: right;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.codes code { font: 600 16px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }

.card.wide { max-width: 640px; }

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

.notice {
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.section {
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.section h2 { margin: 0 0 8px; font-size: 17px; }
.section p { margin-bottom: 12px; }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 20px; font-size: 14px; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }

button.danger { background: #b91c1c; }
button.danger:hover { background: #991b1b; }
button:disabled { opacity: .5; cursor: not-allowed; }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.row:last-of-type { border-bottom: 0; }
.row-main { min-width: 0; overflow-wrap: anywhere; }
.small { font-size: 13px; }

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: #15803d;
    border-radius: 999px;
}

button.small-button {
    width: auto;
    padding: 6px 12px;
    font-size: 13px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--border);
    white-space: nowrap;
}

button.small-button:hover { background: var(--danger-bg); }

label.choice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 400;
    cursor: pointer;
}

label.choice input { margin-top: 4px; }

/* Phones and tablets: no QR code (it is for scanning from a computer), a hint to remember the code instead. */
.touch-only { display: none; }
@media (pointer: coarse) {
    .touch-only { display: block; }
    .desktop-only { display: none; }
}

details.install { margin: 12px 0; font-size: 14px; }
details.install summary { cursor: pointer; color: var(--accent); }
details.install ol { padding-left: 20px; line-height: 1.5; }
details.install code { font-size: 13px; background: var(--bg-subtle, rgba(127,127,127,.12)); padding: 1px 4px; border-radius: 4px; }
