/* ==========================================================================
   Technical Reports — portal design system
   Tokens → base → layout primitives → fitting MudBlazor to them. The controls
   (buttons, fields, tables, dialogs, snackbars) are MudBlazor components themed
   in Ui/PortalTheme.cs; component-specific layout lives in *.razor.css.
   ========================================================================== */

:root {
    color-scheme: light;

    --font-ui: "Roboto", "Helvetica", "Arial", sans-serif; /* MudBlazor default typography */
    --font-doc: var(--font-ui);
    --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;

    --bg: #f2f2f2;
    --surface: #ffffff;
    --surface-muted: #f7f7f7;
    --surface-sunken: #eaeaea;
    --border: #dddddd;
    --border-strong: #cccccc;
    --divider: #eaeaea;

    --text: #333333;
    --text-2: #4d4d4d;
    --text-3: #696969;
    --text-inverse: #ffffff;

    --primary: #001eff;
    --primary-hover: #0018cc;
    --primary-soft: #e6e9ff;
    --focus: #001eff;

    --nav-bg: #001eff;
    --nav-text: #e6e9ff;
    --nav-text-strong: #ffffff;
    --nav-active: #0018cc;
    --nav-divider: #2a45ff;

    /* Status tones: fg / bg / border */
    --neutral-fg: #475263;  --neutral-bg: #eff1f4;  --neutral-bd: #d8dde4;
    --info-fg: #001eff;     --info-bg: #e6e9ff;     --info-bd: #b3bcff;
    --review-fg: #0e5f6a;   --review-bg: #e6f3f4;   --review-bd: #bcdfe2;
    --warning-fg: #86560a;  --warning-bg: #fbf4e3;  --warning-bd: #ecd7a4;
    --success-fg: #1c6a43;  --success-bg: #e8f4ed;  --success-bd: #bfdecb;
    --danger-fg: #a3322c;   --danger-bg: #fbeceb;   --danger-bd: #efc3c0;

    --radius: 4px;
    --radius-sm: 3px;
    --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-pop: 0 8px 24px rgba(16, 24, 40, .14), 0 1px 3px rgba(16, 24, 40, .08);

    --nav-width: 224px;
    --topbar-height: 48px;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

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

html, body { margin: 0; }

body {
    font: 14px/1.45 var(--font-ui);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
h1:focus { outline: none; }

code, .mono { font-family: var(--font-mono); font-size: 12.5px; }

.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;
}

.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Page structure ────────────────────────────────────────────────────── */

.page { padding: 20px 28px 48px; max-width: 1480px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-header-text { min-width: 0; }
.page-header .subtitle { color: var(--text-2); margin-top: 3px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex: none; }

.breadcrumb.mud-breadcrumbs { padding: 0; margin-bottom: 8px; font-size: 12.5px; }

/* Cards used as panels: a header row over a divider, a muted footer. */
.mud-card .panel-header { padding: 11px 16px; border-bottom: 1px solid var(--divider); }
.panel-header h2 { font-size: 14px; }
.panel-header .panel-subtitle { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.mud-card .panel-footer { padding: 10px 16px; border-top: 1px solid var(--divider); background: var(--surface-muted); }

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ── MudBlazor fitting ──────────────────────────────────────────────────── */

.callout-title { font-weight: 600; }

/* Status chips sit in table cells and headers without their default margin. */
.status-chip.mud-chip { margin: 0; }
.status-chip .status-chip-busy { width: 12px !important; height: 12px !important; margin-right: 6px; flex: none; }

/* Tables */
.mud-table .cell-primary { font-weight: 500; color: var(--text); }
.cell-secondary { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.mud-table .col-actions { text-align: right; white-space: nowrap; width: 1%; }
.mud-table .col-actions > * + * { margin-left: 6px; }
.table-empty { padding: 40px 16px; text-align: center; color: var(--text-2); }
.table-empty .mud-icon-root { color: var(--text-3); margin-bottom: 8px; }
.table-meta { font-size: 12.5px; color: var(--text-3); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.filter-bar .filter-search { flex: 1 1 260px; max-width: 360px; margin: 0; }
.filter-bar .filter-select { flex: 0 0 220px; margin: 0; }

/* ── Blazor framework UI ───────────────────────────────────────────────── */

#blazor-error-ui {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    padding: 10px 20px; background: #fff7df; border-top: 1px solid var(--warning-bd); color: var(--text);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 16px; top: 9px; }

/* Shown in index.html while the WebAssembly runtime downloads. */
.loading-progress { position: absolute; display: block; width: 6rem; height: 6rem; inset: 20vh 0 auto 0; margin: 0 auto; }
.loading-progress circle { fill: none; stroke: var(--border); stroke-width: .5rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child {
    stroke: var(--primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * .8), 500%;
    transition: stroke-dasharray .05s ease-in-out;
}
.loading-progress-text { position: absolute; inset: calc(20vh + 2.4rem) 0 auto 0; text-align: center; font: 500 13px var(--font-ui); color: var(--text-2); }
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }
