/* =====================================================================
   Linea Administration: base and components.
   Tokens, themes and text sizes come from the linea-theme package (Linea.Theme,
   _content/Linea.Theme/linea-theme.css), linked before this file in App.razor: the same themes
   as the Linea Web UI. The base rules below are copied from the web UI's app.css so both sites
   look alike; the administration parts follow at the end.
   ===================================================================== */
/* Component tweaks for the high-contrast theme. */
[data-theme="contrast"] .card, [data-theme="contrast"] .panel { border-width: 2px; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5rem; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 1rem; top: -3rem; z-index: 100;
    background: var(--accent); color: var(--accent-contrast);
    padding: .6rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Forms & buttons ---------- */
input[type="text"], input[type="search"], input[type="email"], input[type="password"], select {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .6rem .8rem;
    min-height: 2.75rem;
    width: 100%;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font: inherit; font-weight: 600;
    min-height: 2.75rem; padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 2.75rem; height: 2.75rem;
    border-radius: 999px;
    color: var(--text-muted);
    cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.form-stack { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field-inline { display: flex; align-items: center; gap: .6rem; }
.field-inline label { font-weight: 500; }
.validation-message { color: var(--danger); font-size: .875rem; }
.validation-summary { color: var(--danger); margin: 0; padding-inline-start: 1.2rem; }
.validation-summary:empty { display: none; }
input.invalid { border-color: var(--danger); }

.search-bar { display: flex; gap: .5rem; max-width: 40rem; }
.search-bar-large input { min-height: 3.25rem; font-size: 1.05rem; padding-inline: 1rem; }
.search-bar-large .btn { min-height: 3.25rem; padding-inline: 1.5rem; }

/* ---------- Menus (native <details>, no JS required) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
    position: absolute; right: 0; top: calc(100% + .5rem); z-index: 30;
    width: min(20rem, calc(100vw - 2rem));
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
}
.menu-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 .5rem; font-weight: 600; }
.menu-panel .menu-label:not(:first-of-type) { margin-top: 1rem; }
.menu-strong { font-weight: 600; margin: 0; }
.language-form { display: grid; gap: .4rem; justify-items: start; }
.language-form select { max-width: 100%; }
.language-form-compact { margin: 1rem 0 .5rem; padding-top: .75rem; border-top: 1px solid var(--border); justify-items: stretch; }
.language-form-compact .menu-label { margin: 0; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.choice-row { display: flex; gap: .4rem; }
.choice-stack { display: grid; gap: .4rem; }
/* Colour vision switches (DisplayChoices): a track and knob, on when aria-checked. */
.vision-choice { gap: .6rem; }
.switch-track { position: relative; flex: none; width: 2.1rem; height: 1.2rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); transition: background .15s var(--ease); }
.switch-track::after { content: ""; position: absolute; top: .1rem; left: .12rem; width: .9rem; height: .9rem; border-radius: 50%; background: var(--text-muted); transition: transform .15s var(--ease), background .15s var(--ease); }
.vision-choice[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.vision-choice[aria-checked="true"] .switch-track { background: var(--accent); border-color: var(--accent); }
.vision-choice[aria-checked="true"] .switch-track::after { transform: translateX(.88rem); background: var(--accent-contrast); }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
.choice {
    display: flex; align-items: center; gap: .5rem;
    font: inherit; font-size: .9rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .5rem .6rem; min-height: 2.75rem; cursor: pointer; text-align: start;
}
.choice:hover { background: var(--surface-2); }
.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.swatch { width: 1.1rem; height: 1.1rem; border-radius: 999px; border: 1px solid rgb(0 0 0 / .2); flex: none; }
.theme-choice[data-swatch="system"] .swatch { background: linear-gradient(135deg, #f7f6f3 50%, #121316 50%); }
.theme-choice[data-swatch="light"] .swatch { background: #f7f6f3; }
.theme-choice[data-swatch="dark"] .swatch { background: #1b1d22; }
.theme-choice[data-swatch="parchment"] .swatch { background: #eadfc6; }
.theme-choice[data-swatch="contrast"] .swatch { background: linear-gradient(135deg, #000 50%, #ffe600 50%); }
.size-choice { justify-content: center; flex: 1; font-family: var(--font-display); font-weight: 600; }
.size-normal { font-size: .95rem; }
.size-large { font-size: 1.15rem; }
.size-x-large { font-size: 1.35rem; }

.user-chip {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .25rem .75rem .25rem .25rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); cursor: pointer;
    min-height: 2.75rem;
}
.user-chip:hover { background: var(--surface-2); }
.user-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
@media (max-width: 520px) { .user-name { display: none; } .user-chip { padding: .25rem; } }

.culture-form { display: flex; align-items: center; gap: .5rem; }
.culture-form select { width: auto; min-height: 2.25rem; padding-block: .3rem; }

/* ---------- Avatar ---------- */
.avatar {
    --avatar-hue: 220;
    display: inline-grid; place-items: center; flex: none;
    border-radius: 999px; object-fit: cover;
    font-family: var(--font-display); font-weight: 600;
    color: hsl(var(--avatar-hue) 45% 22%);
    background: linear-gradient(145deg, hsl(var(--avatar-hue) 70% 86%), hsl(calc(var(--avatar-hue) + 30) 60% 74%));
}
[data-theme="dark"] .avatar, [data-theme="contrast"] .avatar {
    color: hsl(var(--avatar-hue) 70% 90%);
    background: linear-gradient(145deg, hsl(var(--avatar-hue) 35% 30%), hsl(calc(var(--avatar-hue) + 30) 35% 22%));
}
@media (prefers-color-scheme: dark) {
    [data-theme="system"] .avatar {
        color: hsl(var(--avatar-hue) 70% 90%);
        background: linear-gradient(145deg, hsl(var(--avatar-hue) 35% 30%), hsl(calc(var(--avatar-hue) + 30) 35% 22%));
    }
}
.avatar-small { width: 2.1rem; height: 2.1rem; font-size: .85rem; }
.avatar-medium { width: 3rem; height: 3rem; font-size: 1.05rem; }
.avatar-large { width: clamp(5.5rem, 4rem + 5vw, 8rem); height: clamp(5.5rem, 4rem + 5vw, 8rem); font-size: clamp(1.8rem, 1.2rem + 2vw, 2.8rem); box-shadow: var(--shadow); }
.page-header { margin-bottom: 1.75rem; }
.page-header .lead { max-width: 44rem; }
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 .4rem; }
.lead { font-size: 1.15rem; color: var(--text-muted); }
.breadcrumb { display: flex; gap: .5rem; font-size: .9rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--text-muted); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .9rem; }
.section-title { font-size: 1.35rem; display: flex; align-items: center; gap: .6rem; }
.count {
    font-family: var(--font-body); font-size: .8rem; font-weight: 700;
    background: var(--surface-2); color: var(--text-muted);
    padding: .05rem .55rem; border-radius: 999px;
}
.plain-list { list-style: none; padding: 0; margin: 0; }
.home-hero { padding: 2.5rem 0 2.75rem; max-width: 50rem; }
.home-hero h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.6rem); }
.home-section { margin-top: 2.5rem; }
.prose { max-width: 46rem; font-size: 1.075rem; margin-bottom: 2rem; }
.updated { margin-top: 2.5rem; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; }

/* ---------- Status ---------- */
.status {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: 1rem 1.1rem; border-radius: var(--radius);
    background: var(--surface); border: 1px dashed var(--border); color: var(--text-muted);
    margin-bottom: 1rem;
}
.status-error { border: 1px solid var(--danger); background: var(--danger-soft); color: var(--text); }
.status-error strong { color: var(--danger); }
.spinner {
    width: 1.1rem; height: 1.1rem; border-radius: 999px;
    border: 2px solid var(--border); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.panel-title { font-family: var(--font-body); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: .75rem; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; margin: 0; }
.facts dt { color: var(--text-muted); font-size: .9rem; }
.facts dd { margin: 0; font-weight: 500; font-size: .95rem; }

/* =====================================================================
   Account
   ===================================================================== */
.auth-card {
    max-width: 28rem; margin: 2rem auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
    padding: 2rem; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.9rem; }
.auth-alt { margin: 1.25rem 0 0; text-align: center; color: var(--text-muted); }
.divider { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); margin: 1.5rem 0; font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
/* ---------- Blazor framework UI ---------- */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 1000;
    background: var(--danger-soft); color: var(--text); border: 1px solid var(--danger);
    padding: .75rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow);
    align-items: center; gap: 1rem;
}
#blazor-error-ui .dismiss { background: none; border: 0; font-size: 1.25rem; cursor: pointer; color: inherit; }
.blazor-error-boundary { background: var(--danger-soft); padding: 1rem; border-radius: var(--radius-sm); color: var(--text); }
.status-success { border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); color: var(--text); }
.panel h2 { margin-top: 0; font-size: 1.2rem; }
.button-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* =====================================================================
   Administration
   ===================================================================== */
textarea {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .6rem .8rem; width: 100%; min-height: 5rem; resize: vertical;
}
textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type="radio"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, var(--text)); }
.btn-small { min-height: 2.1rem; padding: .3rem .75rem; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; line-height: 1.1; margin: 0; }
.stat-label { color: var(--text-muted); font-size: .85rem; margin: .25rem 0 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { text-align: start; padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.num, .data-table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.data-table .chosen { background: var(--accent-soft); }
.data-table label { display: flex; gap: .45rem; align-items: flex-start; cursor: pointer; }
.id { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }

.steps { display: grid; gap: 1.5rem; }
.step-title { display: flex; align-items: center; gap: .6rem; font-size: 1.2rem; margin: 0 0 .75rem; }
.step-number {
    display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 999px;
    background: var(--accent); color: var(--accent-contrast); font-size: .9rem; font-family: var(--font-body);
}
.result-list { list-style: none; padding: 0; margin: .75rem 0 0; display: grid; gap: .4rem; }
.result-list li { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
    padding: .5rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.result-list .role { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.role-survivor { color: var(--accent); }
.role-duplicate { color: var(--danger); }
.choice-list { display: grid; gap: .6rem; margin: 0 0 1rem; }

/* Person merge: two boxes side by side (stacked on a phone), then one fieldset per field with both values. */
.person-merge-sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.person-merge-box { border: 1px solid var(--border); border-radius: .5rem; padding: 1rem; }
.person-merge-box h3 { margin: 0 0 .25rem; }
.person-merge-pick { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.person-merge-fields { display: grid; gap: .5rem; }
.person-merge-head, .person-merge-field { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr 2fr; gap: .75rem; align-items: start; }
.person-merge-head { font-weight: 600; padding: 0 .75rem; }
.person-merge-field { border: 1px solid var(--border); border-radius: .5rem; padding: .6rem .75rem; margin: 0; }
.person-merge-field legend { float: left; width: 100%; padding: 0; font-weight: 600; grid-column: 1; }
.person-merge-side, .person-merge-neither { display: flex; gap: .5rem; align-items: flex-start; cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.person-merge-neither { grid-column: 2 / -1; font-size: .9rem; }
.person-merge-warning { border-left: 4px solid var(--danger); padding: .5rem .75rem; background: var(--surface-2); }
.person-merge-outcome { margin: .5rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: .05rem .55rem; font-size: .9rem; }
@media (max-width: 640px) {
  .person-merge-head { display: none; }
  .person-merge-field { grid-template-columns: 1fr; }
  .person-merge-neither { grid-column: 1; }
}
.choice-list label { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.choice-list .muted { display: block; font-size: .9rem; }
.dashboard-links { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.brand-tag { color: var(--text-muted); font-weight: 500; }

/* ---------- The user menu, Settings and the user pages (from the Linea web UI's app.css) ---------- */
.menu-links { display: grid; margin: .75rem 0; border-block: 1px solid var(--border); padding-block: .5rem; }
.menu-link { padding: .45rem .25rem; color: var(--text); text-decoration: none; border-radius: calc(var(--radius) / 2); }
.menu-link:hover, .menu-link:focus-visible { background: var(--surface-2); }
.settings-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); align-items: start; margin-top: 1.25rem; }
.avatar-settings { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.avatar-settings .avatar-large { width: 6rem; height: 6rem; object-fit: cover; }
.avatar-settings form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
img.avatar { object-fit: cover; }
input[type="file"] { font: inherit; max-width: 100%; }
.field-error { color: var(--danger); }
.form-panel { max-width: 34rem; }
.user-header { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.user-header h1 { margin-bottom: .25rem; }
.user-cell { display: flex; gap: .75rem; align-items: center; }
.badge { display: inline-block; margin-inline-start: .35rem; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); vertical-align: middle; }
.badge-accent { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.badge-danger { border-color: var(--danger); background: var(--danger-soft); color: var(--text); }
.disabled-reason { white-space: pre-wrap; }

/* The picture crop dialog (wwwroot/js/image-crop.js) */
.crop-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.25rem; max-width: min(56rem, calc(100vw - 2rem)); box-shadow: var(--shadow); }
.crop-dialog::backdrop { background: rgb(0 0 0 / .6); }
.crop-dialog h2 { margin-top: 0; font-size: 1.2rem; }
.crop-stage { position: relative; display: flex; justify-content: center; margin: .75rem 0; user-select: none; touch-action: none; }
.crop-stage img { display: block; max-width: min(52rem, calc(100vw - 4.5rem)); max-height: 65vh; }
.crop-frame { position: absolute; box-sizing: border-box; border: 2px solid #fff; outline: 1px solid rgb(0 0 0 / .5); box-shadow: 0 0 0 100vmax rgb(0 0 0 / .45); cursor: move; }
.crop-frame:focus-visible { outline: 3px solid var(--focus); }
.crop-handle { position: absolute; width: 14px; height: 14px; background: #fff; border: 1px solid rgb(0 0 0 / .6); }
.crop-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-square { display: inline-flex; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.crop-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Roles and History ---------- */
.role-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .5rem; }
.role-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.story-role-form { border-top: 1px solid var(--border); padding-top: .75rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.inline-form label { display: grid; gap: .25rem; font-weight: 600; font-size: .9rem; }
.field-row { display: flex; gap: .75rem; flex-wrap: wrap; }
/* The attribution editor: the item template in a code font, and the preview of a sample item's credit. */
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.attribution-preview { margin: .5rem 0 0; padding: .7rem .9rem; border-left: 3px solid var(--accent); background: var(--surface-2); }
.history-values { margin-top: .5rem; font-size: .85rem; }
.history-values dd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

/* Two-step sign-in set up for a user (user page): the QR code, the key and the recovery codes. */
.two-step-qr { width: 13rem; max-width: 100%; padding: .75rem; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.two-step-qr svg { display: block; width: 100%; height: auto; }
.two-step-secret { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .4rem 1rem; padding-left: 1.5rem; font-size: 1.05rem; }

/* ---------- Theme editor (Components/Pages/Theme): controls on the left, the web site in a frame on the right ---------- */
.page-header-compact { margin-bottom: 1rem; }
.page-header-compact .lead { margin-bottom: 0; }
.theme-editor { display: grid; grid-template-columns: minmax(19rem, 25rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.theme-editor[hidden] { display: none; }
.theme-controls { position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow-y: auto; padding: 1rem; }
.theme-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: -.25rem 0 1rem; }
.theme-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: .5rem .6rem; color: var(--text-muted); font: inherit; font-weight: 600; cursor: pointer; }
.theme-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.theme-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-status { grid-template-columns: max-content 1fr; font-size: .9rem; }
.theme-previewing { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.theme-choice-row { display: flex; flex-wrap: wrap; gap: .4rem; border: 0; padding: 0; margin: 0; }
.theme-choice-row legend { font-weight: 600; margin-bottom: .4rem; }
.theme-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: .9rem; }
.theme-pill input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pill.active { border-color: var(--accent); background: var(--accent-soft); }
.theme-pill:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-pill-swatch { width: .95rem; height: .95rem; border-radius: 50%; border: 3px solid; }
.colour-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .75rem .75rem; margin: 0; display: grid; gap: .5rem; }
.colour-group legend { font-weight: 600; padding: 0 .3rem; }
.colour-field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; font-size: .92rem; }
.colour-field.is-changed label::after { content: " •"; color: var(--accent); font-weight: 700; }
.colour-inputs { display: flex; align-items: center; gap: .35rem; }
.colour-inputs input[type="color"] { min-height: 0; flex: none; width: 2.2rem; height: 1.9rem; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
.colour-inputs .colour-hex { width: 5.8rem; min-height: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; padding: .25rem .4rem; }
.contrast-checks h3 { font-size: 1rem; margin: .25rem 0 .5rem; }
.contrast-check { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; font-size: .88rem; padding: .2rem 0; }
.contrast-sample { display: inline-grid; place-items: center; width: 2.2rem; height: 1.6rem; border-radius: 6px; border: 1px solid var(--border); font-weight: 700; }
.contrast-check.fail { color: var(--danger); }
.theme-preview { padding: .75rem; min-width: 0; }
.theme-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; }
.theme-toolbar select, .theme-toolbar input { width: auto; min-height: 0; padding-block: .3rem; }
.theme-toolbar input[type="text"] { flex: 1 1 12rem; min-width: 8rem; }
.theme-widths { display: inline-flex; gap: .25rem; }
.theme-frame-wrap { background: var(--surface-2); border-radius: var(--radius-sm); padding: .5rem; display: flex; justify-content: center; overflow: auto; }
.theme-frame { display: block; width: 100%; height: max(32rem, calc(100vh - 15rem)); border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.theme-frame-tablet { width: 820px; max-width: none; flex: none; }
.theme-frame-phone { width: 390px; max-width: none; flex: none; }
.skin-list { display: grid; gap: .25rem; }
.skin-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; text-align: left; background: none; border: 1px solid transparent; border-radius: var(--radius-sm); padding: .4rem .5rem; color: var(--text); font: inherit; cursor: pointer; }
.skin-row:hover, .skin-row:focus-visible { background: var(--surface-2); border-color: var(--border); }
.skin-swatch { width: 1rem; height: 1rem; border-radius: 4px; border: 1px solid var(--border); }
.skin-name code { color: var(--text-muted); }
.version-list { display: grid; gap: .5rem; }
.version-row { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .5rem 0; border-bottom: 1px solid var(--border); }
@media (max-width: 64rem) {
    .theme-editor { grid-template-columns: 1fr; }
    .theme-controls { position: static; max-height: none; }
    .theme-frame { height: 36rem; }
}
.btn-link { background: none; border: 0; padding: .25rem .1rem; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.btn-link:disabled { color: var(--text-muted); cursor: default; text-decoration: none; }
.btn-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The editor needs the room: its page is wider than the others. */
.site-main.container:has(.theme-editor) { width: min(100% - 2rem, 120rem); }

/* .avatar sets display, which would override the hidden attribute: the initials stood beside a picture that loaded. */
.avatar[hidden] { display: none; }

/* Monitoring: Grafana panels served by this site (Components/Pages/Monitoring.razor). */
.monitoring-range { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.25rem; }
.monitoring-dashboard { margin-bottom: 2rem; }
.monitoring-dashboard-head { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; justify-content: space-between; }
.monitoring-dashboard-head h2 { margin: 0; }
.monitoring-summary { display: block; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: .75rem; }

/* Theme editor: named themes (Components/Pages/Theme/ThemeEditor.razor). */
.named-themes { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .9rem; margin: .75rem 0 1rem; }
.named-themes > summary { cursor: pointer; font-weight: 600; }
.named-themes[open] > summary { margin-bottom: .6rem; }

/* Import reviews: a match's (or a work's) identifier, linked to its page (new tab), each on its own line below it. */
a.import-lookup { display: block; width: fit-content; margin: .1rem 0 0 .75rem; overflow-wrap: anywhere; }
a.import-lookup::after { content: " ↗"; }
