/* Orvian stylesheet.
   Loaded AFTER MudBlazor's CSS (see App.razor) so these rules win ties. */

/* Instrument Sans, self-hosted (SIL OFL, see fonts/OFL-InstrumentSans.txt). Hotlinking Google Fonts
   would send every visitor's IP address to Google. */
@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/instrument-sans-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --orvian-font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --orvian-bg: #f6f5f1;
    --orvian-surface: #ffffff;
    --orvian-border: #e3e1da;
    --orvian-border-strong: #c9c6bc;
    --orvian-text: #19211f;
    --orvian-text-muted: #596462;
    --orvian-accent: #0f766e;            /* teal: handover complete */
    --orvian-accent-hover: #0a5a54;
    --orvian-accent-pale: #d5f5ee;
    --orvian-danger: #b91c1c;
    --orvian-danger-pale: #fee2e2;
    --orvian-warning: #b45309;
    --orvian-warning-pale: #fef3c7;
    --orvian-info: #1e40af;
    --orvian-info-pale: #dbeafe;
    --orvian-radius: 8px;
    --orvian-radius-lg: 12px;
    --orvian-shadow: 0 1px 2px rgba(25, 33, 31, 0.05), 0 2px 8px rgba(25, 33, 31, 0.05);
    --orvian-shadow-pop: 0 4px 6px rgba(25, 33, 31, 0.06), 0 12px 28px rgba(25, 33, 31, 0.12);

    /* MudBlazor components (Home page) pick up the same face. */
    --mud-typography-default-family: var(--orvian-font);
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    font-family: var(--orvian-font);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    color: var(--orvian-text);
    background: var(--orvian-bg);
}

h1, h2, h3, h4 { font-family: var(--orvian-font); font-weight: 600; margin: 0 0 0.5em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 2rem; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; letter-spacing: -0.01em; margin-top: 2.25rem; }
h3 { font-size: 1.05rem; }
h1:focus { outline: none; }

p { margin: 0 0 0.75rem; }

a { color: var(--orvian-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }

/* Browser surfaces — the parts we didn't draw still carry the palette. */
::selection {
    background: var(--orvian-accent-pale);
    color: var(--orvian-accent-hover);
}
:focus-visible {
    outline: 2px solid var(--orvian-accent);
    outline-offset: 2px;
    border-radius: 3px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
    outline-offset: 1px;
}
html {
    scrollbar-color: var(--orvian-border-strong) transparent;
    accent-color: var(--orvian-accent);
    caret-color: var(--orvian-accent);
}
/* WebKit scrollbars — unobtrusive, palette-aware. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--orvian-border-strong);
    border: 2px solid var(--orvian-bg);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--orvian-text-muted); }

/* Tabular numerals in data tables keep columns aligned without a per-td class. */
table.orvian-table td { font-variant-numeric: tabular-nums; }

code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
    background: #f1efe9;
    padding: 0.08em 0.35em;
    border-radius: 3px;
}

/* Nav */
nav.orvian-nav {
    background: var(--orvian-surface);
    border-bottom: 1px solid var(--orvian-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    align-items: center;
    /* Line the bar up with the page content, also when the page is centred on a very wide screen. */
    padding: 0.75rem max(var(--orvian-gutter), calc((100% - var(--orvian-page-max)) / 2 + var(--orvian-gutter)));
}
nav.orvian-nav a { color: var(--orvian-text); font-weight: 500; }
nav.orvian-nav .orvian-nav-brand { font-weight: 700; margin-right: 0.5rem; letter-spacing: 0.005em; font-kerning: normal; text-rendering: geometricPrecision; }
nav.orvian-nav .orvian-spacer { flex: 1; }
nav.orvian-nav .orvian-user { color: var(--orvian-text-muted); font-size: 0.92rem; }

/* Page width: fluid up to a cap that still reads well on a 27"+ monitor. The gutter grows with the
   screen. Prose pages (help, privacy) opt back into a narrow column with .orvian-prose-page. */
:root {
    --orvian-page-max: 1760px;
    --orvian-gutter: clamp(1rem, 3vw, 3rem);
}
main.orvian-main {
    max-width: var(--orvian-page-max);
    margin: 0 auto;
    padding: 1.5rem var(--orvian-gutter);
}
/* Long running text keeps a comfortable line length however wide the page is. */
.orvian-measure { max-width: 75ch; }

/* Cards */
.orvian-card {
    background: var(--orvian-surface);
    border: 1px solid var(--orvian-border);
    border-radius: var(--orvian-radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--orvian-shadow);
}

/* Prose inside a card (help page and similar): readable measure, even rhythm,
   indented lists, and no doubled-up space at the card's bottom edge. */
.orvian-card { padding: 1.5rem 1.75rem; }
.orvian-card > :first-child { margin-top: 0; }
.orvian-card > :last-child { margin-bottom: 0; }
.orvian-card h2 { margin: 0 0 0.6rem; }
.orvian-card p { max-width: 70ch; margin: 0 0 0.9rem; line-height: 1.55; }
.orvian-card ol, .orvian-card ul { max-width: 70ch; margin: 0 0 0.9rem; padding-left: 1.4rem; }
.orvian-card li { margin: 0 0 0.35rem; line-height: 1.55; }
.orvian-card li:last-child { margin-bottom: 0; }

.orvian-prose-page { max-width: 46rem; }
.orvian-footer { max-width: var(--orvian-page-max); margin: 0 auto; padding: 0 var(--orvian-gutter) 2rem; font-size: 0.875rem; }
.orvian-footer a { color: var(--orvian-text-muted); }

/* Buttons.
   Plain buttons and .orvian-btn are the quiet default. A form's own submit button is the
   primary action (filled). `:where()` keeps that default beatable by any class, and
   `button:where(...)` keeps specificity equal to MudBlazor's `button` reset so source order wins. */
button, .orvian-btn {
    appearance: none;
    cursor: pointer;
    font: inherit;
    font-weight: 550;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border-radius: var(--orvian-radius);
    border: 1px solid var(--orvian-border-strong);
    background: var(--orvian-surface);
    color: var(--orvian-text);
    line-height: 1.25;
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
button:hover, .orvian-btn:hover { background: #f1efe8; text-decoration: none; border-color: #b4b1a6; }
button:active, .orvian-btn:active { background: #e9e6dd; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

button:where([type=submit]), .orvian-btn-primary {
    background: var(--orvian-accent);
    border-color: var(--orvian-accent);
    color: #fff;
}
button:where([type=submit]):hover, .orvian-btn-primary:hover {
    background: var(--orvian-accent-hover);
    border-color: var(--orvian-accent-hover);
}
/* Secondary action inside a form that would otherwise default to a filled submit
   (row actions in admin tables, and similar). */
button.orvian-btn-secondary {
    background: var(--orvian-surface);
    color: var(--orvian-text);
    border-color: var(--orvian-border-strong);
    padding: 0.35rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
}
button.orvian-btn-secondary:hover { background: #f1efe8; border-color: #b4b1a6; }

/* Destructive button: the one place a red control is right. */
.orvian-btn-danger,
button.orvian-btn-danger {
    background: var(--orvian-surface);
    color: var(--orvian-danger);
    border-color: var(--orvian-danger-pale);
}
.orvian-btn-danger:hover,
button.orvian-btn-danger:hover {
    background: var(--orvian-danger-pale);
    border-color: var(--orvian-danger);
    color: var(--orvian-danger);
}

.orvian-link-btn,
button.orvian-link-btn {
    background: none;
    border: none;
    color: var(--orvian-accent);
    cursor: pointer;
    padding: 0;
    font: inherit;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}
.orvian-link-btn:hover,
button.orvian-link-btn:hover {
    background: none;
    color: var(--orvian-accent-hover);
}

/* Forms.
   Blazor's <InputText> renders a bare <input> with no type= attribute, so an
   `input[type=text]` selector never matches it — inputs render as invisible
   browser-default boxes. Match :not([type]) explicitly so every text-shaped
   input picks up the design-system chrome. */
input:where(
    :not([type]),
    [type=text],
    [type=email],
    [type=password],
    [type=search],
    [type=url],
    [type=tel],
    [type=number],
    [type=date],
    [type=datetime-local]
),
select, textarea {
    font: inherit;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--orvian-border-strong);
    border-radius: var(--orvian-radius);
    background: var(--orvian-surface);
    color: var(--orvian-text);
    min-width: min(18rem, 100%);
}
textarea { min-height: 7rem; }
label {
    font-weight: 500;
    display: inline-block;
    margin-bottom: 0.3rem;
}

.validation-message { color: var(--orvian-danger); font-size: 0.9rem; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--orvian-accent); }
.invalid { outline: 1px solid var(--orvian-danger); }

/* Tables */
table.orvian-table {
    border-collapse: collapse;
    width: 100%;
    background: var(--orvian-surface);
    border: 1px solid var(--orvian-border);
    border-radius: var(--orvian-radius);
    overflow: hidden;
    box-shadow: var(--orvian-shadow);
}
table.orvian-table th, table.orvian-table td {
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--orvian-border);
    vertical-align: top;
}
table.orvian-table th {
    background: #fafaf7;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--orvian-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
table.orvian-table tr:last-child td { border-bottom: none; }
table.orvian-table tr:hover td { background: #faf8f3; }
table.orvian-table .orvian-num,
.orvian-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Notices */
.orvian-notice {
    padding: 0.65rem 0.9rem;
    border-radius: var(--orvian-radius);
    border: 1px solid;
    margin-bottom: 1rem;
}
.orvian-notice-info { background: var(--orvian-info-pale); border-color: var(--orvian-info); color: var(--orvian-info); }
.orvian-notice-ok { background: var(--orvian-accent-pale); border-color: var(--orvian-accent); color: var(--orvian-accent-hover); }
.orvian-notice-warn { background: var(--orvian-warning-pale); border-color: var(--orvian-warning); color: var(--orvian-warning); }
.orvian-notice-error { background: var(--orvian-danger-pale); border-color: var(--orvian-danger); color: var(--orvian-danger); }

/* Status pills */
.orvian-status { padding: 0.1rem 0.5rem; border-radius: 1rem; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; }
.orvian-status-draft { background: #e5e5e0; color: #525252; }
.orvian-status-active { background: var(--orvian-info-pale); color: var(--orvian-info); }
.orvian-status-handedover { background: var(--orvian-accent-pale); color: var(--orvian-accent-hover); }

/* Visually-hidden — a11y label for inputs whose placeholder carries the role. */
.orvian-visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Library hero — the search IS the page, so compose around it. */
.orvian-library-hero {
    max-width: 52rem;
    margin-bottom: 1.25rem;
}
.orvian-library-hero h1 {
    margin-bottom: 0.35rem;
    letter-spacing: -0.015em;
}
.orvian-library-lede {
    color: var(--orvian-text-muted);
    margin-bottom: 1.1rem;
    max-width: 42rem;
}
.orvian-library-meta {
    color: var(--orvian-text-muted);
    font-size: 0.9rem;
    margin: 0.85rem 0 0;
}
.orvian-library-empty {
    color: var(--orvian-text-muted);
    padding: 1.5rem;
    background: var(--orvian-surface);
    border: 1px dashed var(--orvian-border-strong);
    border-radius: var(--orvian-radius);
    text-align: center;
}

/* Unified search pill — input and submit share one chrome instead of standing
   awkwardly beside each other. Focus-within tints the whole pill with the
   accent, so the UI reacts to focus as a single component. */
.orvian-search-row {
    display: flex;
    gap: 0.35rem;
    align-items: stretch;
    background: var(--orvian-surface);
    border: 1px solid var(--orvian-border-strong);
    border-radius: 999px;
    padding: 0.3rem 0.3rem 0.3rem 1rem;
    box-shadow: var(--orvian-shadow);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.orvian-search-row:focus-within {
    border-color: var(--orvian-accent);
    box-shadow: 0 0 0 3px var(--orvian-accent-pale);
}
.orvian-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0.55rem 0.5rem;
    font-size: 1.05rem;
    color: var(--orvian-text);
    outline: none;
}
.orvian-search-input:focus,
.orvian-search-input:focus-visible {
    outline: none;
    box-shadow: none;
}
.orvian-search-input::placeholder {
    color: var(--orvian-text-muted);
}
.orvian-search-row button[type=submit] {
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    flex: 0 0 auto;
}

/* Traffic-light retrieval status.
   A horizontal gradient bar fades from the status colour on the left into
   the surrounding background near the text, so the text stays on a neutral
   contrast ground while the colour is still immediately legible on the left
   edge. A solid 4px stripe on the far left guarantees the signal survives
   even for colour-blind viewers who rely on position + the text label. */
.orvian-traffic {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem 0.25rem 1.1rem;
    min-width: 11rem;
    border-radius: 3px;
    position: relative;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--orvian-text);
    background:
        linear-gradient(to right, var(--traffic-fill, transparent) 0%, transparent 65%);
}
.orvian-traffic::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--traffic-stripe, transparent);
}
.orvian-traffic-ok {
    --traffic-fill: rgba(22, 163, 74, 0.35);     /* green */
    --traffic-stripe: #16a34a;
}
.orvian-traffic-needs-review {
    --traffic-fill: rgba(234, 179, 8, 0.4);      /* amber */
    --traffic-stripe: #ca8a04;
}
.orvian-traffic-missing {
    --traffic-fill: rgba(220, 38, 38, 0.3);      /* red */
    --traffic-stripe: #dc2626;
}
.orvian-traffic-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
    background: var(--traffic-stripe);
}

/* Blazor error */
.blazor-error-boundary {
    background: var(--orvian-danger);
    padding: 1rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

#blazor-error-ui {
    background: var(--orvian-warning);
    color: white;
    padding: 0.5rem 1rem;
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}
#blazor-error-ui.open { display: block; }
#blazor-error-ui .reload { color: white; text-decoration: underline; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }


/* ---- Page structure --------------------------------------------------------------------- */
.orvian-muted { color: var(--orvian-text-muted); }
.orvian-nowrap { white-space: nowrap; }
.orvian-row-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.5rem 0.75rem; white-space: nowrap; }
.orvian-row-actions form { margin: 0; }
.orvian-stack { display: grid; gap: 0.5rem; }
.orvian-inline-form { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.5rem; margin: 0; }
.orvian-inline-form input, .orvian-inline-form select { min-width: 0; width: 9.5rem; padding: 0.35rem 0.55rem; font-size: 0.9rem; }
button.orvian-btn-danger { padding: 0.35rem 0.7rem; font-size: 0.9rem; font-weight: 500; }
.orvian-block { display: block; }
.orvian-mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.orvian-wide { width: 100%; max-width: 48rem; }
.orvian-check { display: inline-flex; gap: 0.5rem; align-items: center; font-weight: 450; }
.orvian-back { margin: 0 0 0.75rem; font-size: 0.92rem; }

.orvian-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 0.5rem;
}
.orvian-page-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; min-width: 0; }
.orvian-page-title h1 { margin: 0; overflow-wrap: anywhere; }
.orvian-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

/* Facts about the project: quiet, scannable, no bold-colon paragraphs. */
.orvian-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.75rem 2rem;
    margin: 0.5rem 0 1.5rem;
    padding: 0;
}
.orvian-facts div { min-width: 0; }
.orvian-facts dt { font-size: 0.85rem; color: var(--orvian-text-muted); }
.orvian-facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* One clear next step per project state. */
.orvian-next {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--orvian-surface);
    border: 1px solid var(--orvian-border);
    border-radius: var(--orvian-radius-lg);
    box-shadow: var(--orvian-shadow);
}
.orvian-next > div { display: grid; gap: 0.2rem; min-width: 0; flex: 1 1 18rem; }
.orvian-next form { margin: 0; }
.orvian-next-busy { background: var(--orvian-accent-pale); border-color: #9fe0d2; }
.orvian-next-done { background: transparent; box-shadow: none; }
.orvian-next small { color: var(--orvian-text-muted); }

progress {
    appearance: none;
    width: 100%;
    height: 0.5rem;
    margin: 0.35rem 0 0.15rem;
    border: none;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 118, 110, 0.18);
    accent-color: var(--orvian-accent);
}
progress::-webkit-progress-bar { background: rgba(15, 118, 110, 0.18); }
progress::-webkit-progress-value { background: var(--orvian-accent); border-radius: 999px; transition: width 400ms ease; }
progress::-moz-progress-bar { background: var(--orvian-accent); border-radius: 999px; }

/* Overflow menu: <details>, so it works without JavaScript. */
.orvian-menu { position: relative; }
.orvian-menu > summary { list-style: none; user-select: none; }
.orvian-menu > summary::-webkit-details-marker { display: none; }
.orvian-menu > summary::after {
    content: "";
    width: 0.45rem; height: 0.45rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.12rem) rotate(45deg);
}
.orvian-menu[open] > summary { background: #f1efe8; border-color: #b4b1a6; }
.orvian-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 20;
    min-width: 15rem;
    padding: 0.35rem;
    background: var(--orvian-surface);
    border: 1px solid var(--orvian-border);
    border-radius: var(--orvian-radius-lg);
    box-shadow: var(--orvian-shadow-pop);
}
.orvian-menu-panel form { margin: 0; }
button.orvian-menu-item {
    width: 100%;
    justify-content: flex-start;
    border: none;
    background: transparent;
    color: var(--orvian-text);
    padding: 0.55rem 0.7rem;
    font-weight: 500;
    border-radius: 6px;
}
button.orvian-menu-item:hover { background: #f1efe8; }
button.orvian-menu-item-danger { color: var(--orvian-danger); }
button.orvian-menu-item-danger:hover { background: var(--orvian-danger-pale); }

/* Collapsible forms. */
.orvian-section { margin-top: 1.25rem; border-top: 1px solid var(--orvian-border); padding-top: 0.25rem; }
.orvian-section > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
}
.orvian-section > summary::-webkit-details-marker { display: none; }
.orvian-section > summary h2 { margin: 1rem 0 0.75rem; }
.orvian-section > summary::after {
    content: "";
    width: 0.5rem; height: 0.5rem;
    border-right: 2px solid var(--orvian-text-muted);
    border-bottom: 2px solid var(--orvian-text-muted);
    transform: rotate(45deg);
    transition: transform 150ms ease;
}
.orvian-section[open] > summary::after { transform: rotate(-135deg); }

/* Traffic-light legend. */
.orvian-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    color: var(--orvian-text-muted);
}
.orvian-legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.orvian-dot-ok { background: #16a34a; }
.orvian-dot-review { background: #ca8a04; }
.orvian-dot-missing { background: #dc2626; }

/* Notices sit closer to their content than a paragraph would. */
.orvian-notice ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

@media (max-width: 640px) {
    nav.orvian-nav { padding: 0.6rem 1rem; gap: 0.35rem 1rem; }
    nav.orvian-nav .orvian-spacer { flex-basis: 100%; height: 0; }
    nav.orvian-nav .orvian-user { display: none; }
    main.orvian-main { padding: 1rem; }  /* small screens: fixed gutter */
    h1 { font-size: 1.6rem; }
    .orvian-actions { width: 100%; }
    .orvian-menu-panel { right: auto; left: 0; }
    table.orvian-table { display: block; overflow-x: auto; }
}

/* ---- Admin: AI provider settings ---------------------------------------------------- */
.orvian-text-muted { color: var(--orvian-text-muted); }

.orvian-ai-switch { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.orvian-ai-switch > div { flex: 1 1 24rem; }

.orvian-provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.75rem; }
.orvian-provider {
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
    padding: 1rem; background: var(--orvian-surface);
    border: 1px solid var(--orvian-border); border-radius: var(--orvian-radius-lg);
    color: inherit; text-decoration: none; box-shadow: var(--orvian-shadow);
}
a.orvian-provider:hover { border-color: var(--orvian-border-strong); }
.orvian-provider.is-selected { border-color: var(--orvian-accent); box-shadow: 0 0 0 2px var(--orvian-accent-pale), var(--orvian-shadow); }
.orvian-provider.is-soon { opacity: 0.6; box-shadow: none; }
.orvian-provider-logo { width: 32px; height: 32px; margin-bottom: 0.25rem; }
.orvian-provider-initial {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; background: var(--orvian-border); color: var(--orvian-text-muted);
    font-weight: 700; font-size: 1.1rem;
}
.orvian-provider-name { font-weight: 600; }
.orvian-provider-tag { font-size: 0.85rem; color: var(--orvian-text-muted); }

.orvian-pill { display: inline-block; margin-top: 0.35rem; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.orvian-pill-ok { background: var(--orvian-accent-pale); color: var(--orvian-accent-hover); }
.orvian-pill-info { background: var(--orvian-info-pale); color: var(--orvian-info); }
.orvian-pill-warn { background: var(--orvian-warning-pale); color: var(--orvian-warning); }
.orvian-pill-muted { background: var(--orvian-border); color: var(--orvian-text-muted); }

.orvian-fieldset { border: 1px solid var(--orvian-border); border-radius: var(--orvian-radius); padding: 0.75rem 1rem 0.25rem; margin: 0 0 1rem; max-width: 36rem; }
.orvian-fieldset legend { padding: 0 0.4rem; font-weight: 600; }

.orvian-ai-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.25rem 0 1rem; }
.orvian-ai-actions form { margin: 0; }

/* ---- Project page: click an article to see its FDV documents ------------------------- */
.orvian-article-docs { display: none; }
.orvian-article:has(details[open]) .orvian-article-docs { display: table-row; }
.orvian-article-row { position: relative; cursor: pointer; }
.orvian-article-row:hover { background: color-mix(in srgb, var(--orvian-accent-pale) 35%, transparent); }
.orvian-row-toggle summary {
    display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; list-style: none;
}
.orvian-row-toggle summary::-webkit-details-marker { display: none; }
.orvian-row-toggle summary::before {
    content: ""; width: 0.45rem; height: 0.45rem; flex: none;
    border-right: 2px solid var(--orvian-text-muted); border-bottom: 2px solid var(--orvian-text-muted);
    transform: rotate(-45deg);
}
.orvian-row-toggle[open] summary::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: no-preference) {
    .orvian-row-toggle summary::before { transition: transform 0.15s ease; }
}
/* The whole row is the click target. */
.orvian-row-toggle summary::after { content: ""; position: absolute; inset: 0; }
.orvian-row-toggle summary:focus-visible { outline: none; }
.orvian-article-row:has(summary:focus-visible) { outline: 2px solid var(--orvian-accent); outline-offset: -2px; }
.orvian-article-docs td { background: var(--orvian-bg); padding: 0.6rem 1rem 0.9rem 2.4rem; }
.orvian-article-doclist { margin: 0; padding-left: 1.1rem; }
.orvian-article-doclist li { margin: 0.2rem 0; }

/* ---- Article pictures ---------------------------------------------------------------- */
.orvian-thumb-col { width: 3.25rem; padding-right: 0; }
.orvian-thumb { display: block; width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--orvian-border); background: var(--orvian-surface); }
.orvian-article-detail { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.orvian-article-picture { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; flex: 0 0 auto; max-width: 11rem; }
.orvian-article-picture img { width: 160px; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--orvian-border); background: var(--orvian-surface); }
.orvian-article-picture form { margin: 0; }
.orvian-article-docs-list { flex: 1 1 18rem; min-width: 0; }
.orvian-article-docs td { padding-left: 1rem; }

/* ---- Removing and undoing ------------------------------------------------------------ */
.orvian-undo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.orvian-undo form { margin: 0; }
.orvian-danger-link { color: var(--orvian-danger); }

/* ---- Dropping PDFs and small inline actions ------------------------------------------ */
.orvian-dropzone {
    display: block; width: 100%; max-width: 40rem; box-sizing: border-box; cursor: pointer;
    padding: 2rem 1rem; border: 2px dashed var(--orvian-border-strong); border-radius: var(--orvian-radius-lg);
    background: var(--orvian-surface); color: var(--orvian-text-muted); font: inherit;
}
.orvian-dropzone:hover, .orvian-dropzone:focus-visible { border-color: var(--orvian-accent); background: var(--orvian-accent-pale); outline: none; }
.orvian-dropzone::file-selector-button {
    margin-right: 1rem; padding: 0.45rem 0.9rem; border: 1px solid var(--orvian-border-strong);
    border-radius: var(--orvian-radius); background: var(--orvian-surface); color: var(--orvian-text); font: inherit; font-weight: 550; cursor: pointer;
}
.orvian-inline-form { display: inline; margin: 0 0 0 0.6rem; }
.orvian-row-actions { display: flex; gap: 1.25rem; margin-top: 0.6rem; }
.orvian-row-actions .orvian-inline-form { margin: 0; }
