/* ==========================================================================
   NFHOTEL HOTEL — DESIGN SYSTEM
   --------------------------------------------------------------------------
   One source for everything visual. The classes below are the contract from UI-Spec.md
   section 3: markup may only use names that exist here.

   No external fonts, no CDNs, no icon packs — the site must work
   offline. Bootstrap is deliberately not loaded: its .row collides with
   the spec's .row, and everything visual must come from the tokens below.

   Order: tokens → reset → layout → typography → surfaces → buttons →
   form → data → status → feedback → public → admin → responsive.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */

:root {
    /* Farver */
    --ink: #14171f;
    --ink-soft: #575d6b;
    --line: #dfe1e8;
    --paper: #ffffff;
    --sand: #f4f5f8;
    --navy: #16233f;
    --navy-deep: #0d1628;
    --brass: #b8860f;
    --gold: #f2b134;
    --ok: #2f6b4f;
    --warn: #8a6d1f;
    --danger: #8f3a34;

    /* Form */
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(20, 23, 31, .06), 0 8px 24px rgba(20, 23, 31, .07);
    --maxw: 1140px;

    /* Rhythm — 4px grid */
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s6: 24px;
    --s8: 32px;
    --s12: 48px;
    --s16: 64px;

    /* Typography. System fonts only. Headings in serif — it is a hotel. */
    --font-serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    /* Focus ring. Used where the outline is replaced by a ring with better contrast. */
    --focus: 0 0 0 2px var(--paper), 0 0 0 4px var(--navy);
    --focus-on-dark: 0 0 0 2px var(--navy-deep), 0 0 0 4px #cddcd2;

    /* Width of the admin side menu. One place, so shell and menu do not drift apart. */
    --nav-w: 240px;
}


/* --------------------------------------------------------------------------
   2. RESET AND BASE
   -------------------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--sand);
    /* The page must never scroll horizontally — wide tables scroll in .table-wrap. */
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink);
    margin: 0 0 var(--s3);
    letter-spacing: -.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.185rem; }
h4 { font-size: 1rem; }

p {
    margin: 0 0 var(--s3);
}

p:last-child {
    margin-bottom: 0;
}

ul, ol {
    margin: 0 0 var(--s3);
    padding-left: var(--s6);
}

a {
    color: var(--navy);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--navy-deep);
}

img {
    max-width: 100%;
    height: auto;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: var(--s6) 0;
}

code {
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: .9em;
    background: var(--sand);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
}

/* Focus is never invisible. If the outline is removed somewhere, it is replaced by --focus. */
:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

/* h1 gets programmatic focus from FocusOnNavigate — it must not draw a ring. */
h1:focus,
h1:focus-visible {
    outline: none;
}

/* Skip link to content. Visible as soon as it gets focus. */
.skip-link {
    position: absolute;
    left: var(--s4);
    top: -100px;
    z-index: 100;
    background: var(--paper);
    color: var(--navy);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: var(--s2) var(--s3);
    box-shadow: var(--shadow);
    transition: top .12s ease-out;
}

.skip-link:focus {
    top: var(--s4);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}


/* --------------------------------------------------------------------------
   3. LAYOUT
   -------------------------------------------------------------------------- */

.page {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: var(--s8) var(--s6) var(--s16);
}

.page-narrow {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: var(--s8) var(--s6) var(--s16);
}

/* Vertical rhythm. Sets spacing between siblings without margin collapse. */
.stack > * + * { margin-top: var(--s4); }
.stack-sm > * + * { margin-top: var(--s2); }
.stack-lg > * + * { margin-top: var(--s8); }

.row {
    display: flex;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s4);
    flex-wrap: wrap;
}

.grid-2,
.grid-3,
.grid-auto {
    display: grid;
    gap: var(--s6);
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }


/* --------------------------------------------------------------------------
   4. TYPOGRAPHY
   -------------------------------------------------------------------------- */

.display {
    font-family: var(--font-serif);
    font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.25rem);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -.02em;
    margin: 0;
}

.title {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    line-height: 1.2;
    font-weight: 600;
    margin: 0;
}

.subtitle {
    font-family: var(--font-serif);
    font-size: 1.185rem;
    line-height: 1.3;
    font-weight: 600;
    margin: 0;
}

.lede {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--ink-soft);
    max-width: 62ch;
    margin: 0;
}

.muted {
    color: var(--ink-soft);
}

.eyebrow {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #8a6510;
    margin: 0 0 var(--s2);
}

/* Tabular figures, so dates and amounts line up under each other. */
.numeric {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* In tables numbers are right-aligned (UI-Spec section 3). A date column that
   would rather be left-aligned gets .numeric-start and keeps the tabular figures. */
.table td.numeric,
.table th.numeric {
    text-align: right;
}

.table td.numeric-start,
.table th.numeric-start {
    text-align: left;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}


/* --------------------------------------------------------------------------
   5. SURFACES
   -------------------------------------------------------------------------- */

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-pad {
    padding: var(--s6);
}

.card-hover {
    transition: transform .15s ease-out, box-shadow .15s ease-out, border-color .15s ease-out;
}

.card-hover:hover {
    transform: translateY(-2px);
    border-color: #d3cec2;
    box-shadow: 0 2px 4px rgba(28, 31, 29, .08), 0 14px 32px rgba(28, 31, 29, .10);
}

.card-hover:focus-within {
    border-color: var(--navy);
}

/* Flatter than .card — for work surfaces in admin where shadows become noise. */
.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--s4) var(--s6);
}

.divider {
    height: 1px;
    background: var(--line);
    border: 0;
    margin: var(--s6) 0;
}


/* --------------------------------------------------------------------------
   6. BUTTONS
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 10px var(--s4);
    min-height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .12s ease-out, border-color .12s ease-out, color .12s ease-out;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.btn-primary {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--paper);
}

.btn-primary:hover {
    background: var(--navy-deep);
    border-color: var(--navy-deep);
    color: var(--paper);
}

.btn-secondary {
    background: var(--paper);
    border-color: var(--line);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--sand);
    border-color: #cfcabd;
    color: var(--ink);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--navy);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.btn-ghost:hover {
    background: rgba(47, 71, 57, .07);
    color: var(--navy-deep);
}

.btn-danger {
    background: var(--paper);
    border-color: #dcbcb8;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--paper);
}

.btn-sm {
    font-size: .8125rem;
    padding: 5px var(--s3);
    min-height: 30px;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Disabled must LOOK disabled, not just be so. */
.btn:disabled,
.btn[aria-disabled="true"] {
    background: #eceae4;
    border-color: var(--line);
    color: #8c908b;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    text-decoration: none;
}


/* --------------------------------------------------------------------------
   7. FORM
   -------------------------------------------------------------------------- */

.field {
    display: block;
    margin: 0;
}

.field + .field {
    margin-top: var(--s4);
}

.field-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--s1);
}

.field-required {
    color: var(--danger);
    margin-left: 2px;
}

.field-input,
.field-select {
    display: block;
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid #b9b4a7;
    border-radius: var(--radius-sm);
    padding: 9px var(--s3);
    min-height: 40px;
}

/* Own arrow, so the select does not inherit the look of the system. A file of this site, not a data: URI, so the
   Content Security Policy keeps img-src 'self' (MIL-033); it works offline all the same. */
.field-select {
    appearance: none;
    padding-right: var(--s8);
    background-image: url("select-arrow.svg");
    background-repeat: no-repeat;
    background-position: right var(--s3) center;
    background-size: 12px 8px;
}

.field-input::placeholder {
    color: #767b76;
}

.field-input:focus,
.field-select:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(47, 71, 57, .22);
}

.field-input:disabled,
.field-select:disabled {
    background: #f1efea;
    color: #767b76;
    cursor: not-allowed;
}

.field-hint {
    display: block;
    font-size: .8125rem;
    color: var(--ink-soft);
    margin-top: var(--s1);
}

.field-error {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--danger);
    margin-top: var(--s1);
}

/* The field itself knows that it is wrong, so the marking does not depend on markup order. */
.field:has(.field-error) .field-input,
.field:has(.field-error) .field-select,
.field-input[aria-invalid="true"],
.field-select[aria-invalid="true"] {
    border-color: var(--danger);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s4);
    align-items: start;
}

.field-row .field + .field {
    margin-top: 0;
}

/* Blazor's own validation classes are kept in the same language as .field-error. */
.invalid,
.field-input.invalid,
.field-select.invalid {
    border-color: var(--danger);
}

.valid.modified:not([type=checkbox]) {
    border-color: var(--ok);
}

.validation-message {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--danger);
    margin-top: var(--s1);
}


/* --------------------------------------------------------------------------
   8. DATA
   -------------------------------------------------------------------------- */

/* Wide tables scroll in their own container — never the whole page. */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.table-wrap .table {
    border: 0;
    border-radius: 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: .9375rem;
}

.table caption {
    caption-side: top;
    text-align: left;
    padding: var(--s3) var(--s4);
    color: var(--ink-soft);
    font-size: .875rem;
}

.table th {
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    background: var(--sand);
    padding: var(--s3) var(--s4);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: var(--s3) var(--s4);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

/* Zebra stripes. Light enough not to compete with badges. */
.table tbody tr:nth-child(even) {
    background: #fbfaf7;
}

.table tbody tr:hover {
    background: #f3f1ec;
}

.table-compact {
    font-size: .875rem;
}

.table-compact th,
.table-compact td {
    padding: var(--s2) var(--s3);
}

/* The action column: right-aligned, buttons in a row, never wrapped. */
.table-actions {
    text-align: right;
    white-space: nowrap;
}

.table-actions > * + * {
    margin-left: var(--s2);
}

/* Sticky header in admin, where the tables are long enough for it to pay off. */
.admin-main .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}


/* --------------------------------------------------------------------------
   9. STATUS
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* The dot carries no meaning alone — the text always stands next to it,
   so colour is never the only carrier of information. */
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

/* Booking */
.badge-pending    { background: #fbf3e0; border-color: #ead9b0; color: #6d5518; }
.badge-confirmed  { background: #e7eee9; border-color: #c3d3c8; color: #22352a; }
.badge-checkedin  { background: #e2efe8; border-color: #b6d3c4; color: #245740; }
.badge-checkedout { background: #eeece7; border-color: #d9d5cc; color: #4d534f; }
.badge-cancelled  { background: #f7e7e5; border-color: #e3c2be; color: #7a302b; }

/* Rooms and cleaning */
.badge-clean      { background: #e2efe8; border-color: #b6d3c4; color: #245740; }
.badge-cleaning   { background: #fbf3e0; border-color: #ead9b0; color: #6d5518; }
.badge-service    { background: #f4ecdd; border-color: #e0cda6; color: #6b5019; }
.badge-blocked    { background: #ddd9d2; border-color: #c1bbb0; color: #383c39; }


/* --------------------------------------------------------------------------
   10. FEEDBACK
   -------------------------------------------------------------------------- */

.alert {
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    padding: var(--s3) var(--s4);
    font-size: .9375rem;
    background: var(--paper);
    color: var(--ink);
}

.alert > *:last-child {
    margin-bottom: 0;
}

.alert ul {
    padding-left: var(--s4);
    margin-bottom: 0;
}

.alert-error {
    background: #fbf1f0;
    border-color: #e3c2be;
    border-left-color: var(--danger);
    color: #6f2c27;
}

.alert-ok {
    background: #eef5f1;
    border-color: #bcd6c8;
    border-left-color: var(--ok);
    color: #24543f;
}

.alert-info {
    background: #f4f2ec;
    border-color: #ddd8cc;
    border-left-color: var(--brass);
    color: #464b46;
}

/* Empty state: icon space, heading, explanation, and room for an action. */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--s2);
    padding: var(--s12) var(--s6);
    background: var(--paper);
    border: 1px dashed #cdc7ba;
    border-radius: var(--radius);
}

.empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sand);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: var(--s1);
}

.empty-title {
    font-family: var(--font-serif);
    font-size: 1.185rem;
    font-weight: 600;
    margin: 0;
}

.empty-text {
    color: var(--ink-soft);
    max-width: 46ch;
    margin: 0;
}

/* Loading: placeholders that have the shape of the page, not a spinner in the middle of the screen. */
.skeleton {
    display: block;
    width: 100%;
    height: 14px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #eeece6 0%, #f6f4ef 50%, #eeece6 100%);
    background-size: 200% 100%;
    animation: skeleton-sweep 1.3s linear infinite;
}

/* Uneven widths, so the placeholders look like text and not a barcode pattern. */
.skeleton:nth-child(3n + 2) { width: 82%; }
.skeleton:nth-child(3n + 3) { width: 64%; }

@keyframes skeleton-sweep {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}


/* --------------------------------------------------------------------------
   11. PUBLIC
   -------------------------------------------------------------------------- */

.site-header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.site-header > .row-between {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: var(--s3) var(--s6);
}

.site-brand {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -.01em;
}

.site-brand:hover {
    color: var(--navy-deep);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--s4);
}

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink-soft);
    font-size: .875rem;
}

.site-footer > .row-between {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: var(--s6);
}

.hero {
    /* The night sky over the river in Phnom Penh — hinted at, not copied from their photo. */
    background:
        radial-gradient(90% 120% at 78% 8%, rgba(242, 177, 52, .16) 0%, transparent 55%),
        radial-gradient(120% 130% at 12% 0%, #2c3f68 0%, var(--navy) 46%, var(--navy-deep) 100%);
    color: #e9edf5;
    border-bottom: 3px solid var(--gold);
}

.hero-body {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: var(--s16) var(--s6);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s4);
}

.hero .display,
.hero h1,
.hero h2 {
    color: var(--paper);
}

.hero .lede {
    color: #c8d0e0;
}

.hero .eyebrow {
    color: var(--gold);
}

.hero .btn-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: #1a1405;
}

.hero .btn-primary:hover {
    background: #ffc55a;
    border-color: #ffc55a;
    color: #1a1405;
}

.hero .btn-primary:focus-visible {
    box-shadow: var(--focus-on-dark);
}

.hero .btn-secondary {
    background: transparent;
    border-color: rgba(255, 255, 255, .55);
    color: var(--paper);
}

.hero .btn-secondary:hover {
    background: rgba(255, 255, 255, .12);
    border-color: var(--paper);
    color: var(--paper);
}

.hero .btn-secondary:focus-visible {
    box-shadow: var(--focus-on-dark);
}

/* Room cards on the public page. */
.roomcard {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Image space without images — a calm surface in the colours of the house rather than an empty hole. */
.roomcard-media {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #e9e5db 0%, #f3f0e8 45%, #e2ded2 100%);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    font-family: var(--font-serif);
    font-size: 1.125rem;
}

.roomcard > *:not(.roomcard-media) {
    padding: var(--s4) var(--s6);
}

.roomcard > *:not(.roomcard-media) + *:not(.roomcard-media) {
    padding-top: 0;
}

/* Trinvisning i bookingflowet. */
.steps {
    display: flex;
    align-items: center;
    gap: var(--s2);
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    counter-reset: step;
}

.step {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px var(--s3);
    counter-increment: step;
}

.step::before {
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--sand);
    border: 1px solid var(--line);
    font-size: .75rem;
    color: var(--ink-soft);
}

.step-active {
    color: var(--paper);
    background: var(--navy);
    border-color: var(--navy);
}

.step-active::before {
    background: var(--navy-deep);
    border-color: var(--navy-deep);
    color: var(--paper);
}

.step-done {
    color: #24543f;
    border-color: #b6d3c4;
    background: #eef5f1;
}

.step-done::before {
    content: "\2713";
    background: var(--ok);
    border-color: var(--ok);
    color: var(--paper);
}


/* --------------------------------------------------------------------------
   12. ADMIN
   -------------------------------------------------------------------------- */

.admin-shell {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    min-height: 100vh;
    background: var(--sand);
}

.admin-nav {
    background: var(--navy);
    color: #dde5df;
    padding: var(--s6) var(--s3);
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
}

.admin-nav-brand {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--paper);
    text-decoration: none;
    padding: 0 var(--s3);
    margin-bottom: var(--s6);
}

.admin-nav-brand span {
    display: block;
    font-family: var(--font-sans);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #b9c8be;
}

.admin-nav-brand:focus-visible {
    outline: none;
    box-shadow: var(--focus-on-dark);
    border-radius: var(--radius-sm);
}

.admin-nav-link {
    display: block;
    padding: var(--s2) var(--s3);
    border-radius: var(--radius-sm);
    color: #dde5df;
    text-decoration: none;
    font-size: .9375rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.admin-nav-link:hover {
    background: var(--navy-deep);
    color: var(--paper);
}

.admin-nav-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-on-dark);
}

/* NavLink sets .active on the current item. */
.admin-nav-link.active {
    background: var(--navy-deep);
    color: var(--paper);
    font-weight: 700;
    border-left-color: var(--brass);
}

.admin-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: var(--s2) var(--s6);
}

/* Discreet band: access control is missing. Must be readable, not overlooked. */
.admin-notice {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-size: .8125rem;
    color: #6b5019;
    background: #f7f1e2;
    border: 1px solid #e0cda6;
    border-radius: var(--radius-sm);
    padding: 6px var(--s3);
}

.admin-main > .page,
.admin-main > .page-narrow {
    padding: var(--s6);
    flex: 1 1 auto;
    max-width: none;
}

/* Page header with title and actions. Used by PageHeader. */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s4);
    flex-wrap: wrap;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--s2);
    flex-wrap: wrap;
}

/* Key figures on the dashboard. */
.stat {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--s4) var(--s6);
    box-shadow: var(--shadow);
}

.stat-value {
    display: block;
    font-family: var(--font-serif);
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.stat-label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-top: var(--s1);
}


/* --------------------------------------------------------------------------
   13. BLAZOR'S ERROR BAND
   -------------------------------------------------------------------------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--danger);
    color: var(--paper);
    padding: var(--s3) var(--s6);
    box-shadow: 0 -2px 12px rgba(28, 31, 29, .2);
}

#blazor-error-ui a,
#blazor-error-ui .dismiss {
    color: var(--paper);
    margin-left: var(--s3);
    cursor: pointer;
    text-decoration: underline;
}

.blazor-error-boundary {
    background: var(--danger);
    color: var(--paper);
    border-radius: var(--radius-sm);
    padding: var(--s3) var(--s4);
}

.blazor-error-boundary::after {
    content: "Something went wrong.";
}


/* --------------------------------------------------------------------------
   14. RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
    /* The side menu collapses to a horizontal band at the top. Deliberately without JavaScript
       and without hidden state: a drawer in Blazor Server would stay
       open after navigation, because the DOM survives the page change. */
    .admin-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-nav {
        position: static;
        max-height: none;
        flex-direction: row;
        align-items: center;
        gap: var(--s2);
        overflow-x: auto;
        padding: var(--s3) var(--s4);
    }

    .admin-nav-brand {
        margin-bottom: 0;
        padding-left: 0;
        white-space: nowrap;
    }

    .admin-nav-brand span {
        display: none;
    }

    .admin-nav-link {
        white-space: nowrap;
        border-left: 0;
        border-bottom: 3px solid transparent;
    }

    .admin-nav-link.active {
        border-left-color: transparent;
        border-bottom-color: var(--brass);
    }

    .admin-main .table thead th {
        position: static;
    }
}

@media (max-width: 780px) {
    .grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 620px) {
    .page,
    .page-narrow {
        padding: var(--s6) var(--s4) var(--s12);
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-body {
        padding: var(--s12) var(--s4);
    }

    .site-header > .row-between,
    .site-footer > .row-between {
        padding: var(--s3) var(--s4);
    }

    .admin-main > .page,
    .admin-main > .page-narrow {
        padding: var(--s4);
    }

    .card-pad,
    .stat,
    .panel {
        padding: var(--s4);
    }
}

@media print {
    .site-header,
    .site-footer,
    .admin-nav,
    .admin-header,
    .page-header-actions {
        display: none;
    }

    body {
        background: var(--paper);
    }
}

/* The signed-in user at the foot of the side menu (ADR-0005). */
.admin-nav-user {
    margin-top: auto;
    padding: var(--s4) var(--s2) 0;
    display: grid;
    gap: var(--s2);
}

.admin-nav-user p {
    margin: 0;
    font-weight: 600;
    color: #fff;
}

.admin-nav-user p span {
    display: block;
    font-weight: 400;
    font-size: 0.85em;
    opacity: 0.8;
}

.admin-nav-user .btn {
    color: #dde5df;
    border-color: #dde5df;
    justify-self: start;
}

/* Benchmark runs (ADR-0013): the answer of a model is shown as it came, wrapped, never cut. */
.answer-text {
  max-height: 24rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Start of a benchmark run (MIL-020): a checkbox with its label, and a legend that only screen readers need. */
.check {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.visually-hidden,
.visually-hidden-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Analysis view of a benchmark run (MIL-020): grouped bar charts drawn as SVG, outcome cells and answer cards. */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: var(--s6);
}

.chart {
  margin: 0;
}

.chart-title {
  font-weight: 600;
  margin-bottom: var(--s2);
}

.chart-legend {
  display: flex;
  gap: var(--s4);
  list-style: none;
  margin: 0 0 var(--s2);
  padding: 0;
  color: var(--ink-soft);
  font-size: .875rem;
}

.chart-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: var(--s1);
  border-radius: 2px;
  vertical-align: -1px;
}

.chart-svg {
  width: 100%;
  height: auto;
  max-width: 640px;
}

.chart-label,
.chart-value,
.chart-axis-title {
  font-size: 12px;
  fill: var(--ink);
}

.chart-axis-title,
.chart-missing {
  fill: var(--ink-soft);
}

.chart-axis {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-series-0 { fill: #b5523b; background: #b5523b; }
.chart-series-1 { fill: #2f6a9e; background: #2f6a9e; }
.chart-series-2 { fill: #6b7280; background: #6b7280; }

.outcome-pass { background: #e2efe8; color: #245740; }
.outcome-fail { background: #f7e7e5; color: #7a302b; }

.compare-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--s4);
  align-items: start;
}

.answer-card ul {
  margin: var(--s1) 0 0;
  padding-left: var(--s6);
}

/* Installed models (MIL-020): the Delete buttons and the Add model button have one width, in a row that wraps on a phone. */
.model-row,
.add-model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}

.model-row > .model-name,
.add-model-row > .field-input {
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.btn-fixed {
  flex: 0 0 9rem;
  width: 9rem;
  justify-content: center;
  text-align: center;
}

/* The reconnect dialog (Components/Shared/ReconnectModal.razor, MIL-033). Blazor sets one class on it; each class
   shows the dialog with its own text, and the reload link once the connection cannot come back. */
.reconnect {
    display: none;
}

.reconnect.components-reconnect-show,
.reconnect.components-reconnect-failed,
.reconnect.components-reconnect-rejected {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    background: rgba(13, 22, 40, .45);
}

.reconnect-box {
    max-width: 360px;
    padding: var(--s6);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
    color: var(--ink);
    font-family: var(--font-sans);
    text-align: center;
}

.reconnect-text,
.reconnect-reload {
    display: none;
}

.components-reconnect-show .reconnect-text-show,
.components-reconnect-failed .reconnect-text-failed,
.components-reconnect-rejected .reconnect-text-rejected,
.components-reconnect-failed .reconnect-reload,
.components-reconnect-rejected .reconnect-reload {
    display: block;
}

.reconnect-reload {
    margin-top: var(--s3);
    color: var(--navy);
    font-weight: 600;
}
