/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--font-body);
    color: var(--color-ink);
    background: var(--color-canvas);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
a { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: 0; }

/* ---------- boot splash (shown until Blazor mounts) ---------- */
.boot {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--color-ink-muted);
    background: var(--color-canvas);
}
.boot-mark {
    width: 26px; height: 26px;
    border-radius: var(--radius-sm);
    background: var(--color-red);
    animation: pulse 1.4s ease-in-out infinite;
}
.boot-label {
    font-weight: 700;
    letter-spacing: .12em;
    font-size: 0.85rem;
    text-transform: uppercase;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}

::selection { background: rgba(230,57,70,.22); color: var(--color-ink); }

/* ---------- form fields (shared across TextField/SelectField/TextAreaField) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.field__req { color: var(--color-red); margin-left: 4px; }
.field__input {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: 0 12px;
    height: var(--control-h);
    font-size: var(--text-sm);
    color: var(--color-ink);
    font-family: var(--font-body);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.field__input::placeholder { color: var(--color-ink-faint); }
.field__input:focus {
    outline: none;
    border-color: var(--color-red);
    box-shadow: var(--focus-red);
}
.field__input:disabled { background: var(--color-surface-sunken); color: var(--color-ink-muted); }
.field__input.is-invalid { border-color: var(--color-red); }
.field__hint { font-size: var(--text-xs); color: var(--color-ink-muted); }
.field__error { font-size: var(--text-xs); color: var(--color-red-deep); font-weight: 600; }

.field__textarea {
    min-height: 96px;
    height: auto;
    padding: 10px 12px;
    resize: vertical;
    line-height: var(--leading-normal);
}

.field__select-wrap { position: relative; }
.field__select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-surface);
    padding-right: 36px;
    cursor: pointer;
    width: 100%;
}
.field__select-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-ink-muted);
    pointer-events: none;
    display: flex;
}

/* ---------- sidebar (global, not scoped: NavLink renders a child component
   whose <a> doesn't receive Blazor's scoped-CSS attribute) ---------- */
.sb {
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: var(--space-5) 0 var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-height: 100vh;
    position: sticky;
    top: 0;
}
.sb__brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--space-5); }
.sb__brandmark { width: 22px; height: 22px; border-radius: var(--radius-sm); background: var(--color-red); flex-shrink: 0; }
.sb__brandname { font-family: var(--font-display); font-weight: 800; font-size: var(--text-md); letter-spacing: -.01em; color: var(--color-ink); }
.sb__nav { display: flex; flex-direction: column; }
.sb__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px var(--space-5);
    color: var(--color-ink-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 600;
}
.sb__item:hover { color: var(--color-ink); background: var(--color-surface-alt); }
.sb__icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sb__label { letter-spacing: .005em; }
.sb__bar { position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; background: var(--color-red); opacity: 0; transition: opacity var(--transition-fast); }
.sb__item.active { color: var(--color-red); }
.sb__item.active .sb__bar { opacity: 1; }
.sb__profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-fast);
    min-width: 0;
}
.sb__profile:hover, .sb__profile.active { background: var(--color-surface-alt); }
.sb__profile-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb__profile-name { font-weight: 700; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb__profile-role { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--color-ink-muted); font-weight: 700; }
.sb__profile-chevron { margin-left: auto; color: var(--color-ink-faint); flex-shrink: 0; }

/* ---------- utility helpers ---------- */
.u-row { display: flex; align-items: center; gap: var(--space-3); }
.u-grow { flex: 1; }
.u-mono { font-family: var(--font-mono); }
.u-muted { color: var(--color-ink-muted); }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- blazor-managed error banner ---------- */
#blazor-error-ui {
    background: var(--color-charcoal);
    color: var(--color-ink-on-dark);
    padding: 12px 24px;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: none;
    z-index: 100;
    border-top: 3px solid var(--color-red);
    font-size: var(--text-sm);
}
#blazor-error-ui.show { display: flex; align-items: center; gap: 14px; }
#blazor-error-ui a { color: var(--color-red-bright); font-weight: 600; }
#blazor-error-ui .dismiss { margin-left: auto; cursor: pointer; opacity: .7; }
