:root {
    --primary: #be000b;
    --primary-container: #e6211e;
    --secondary: #7c5800;
    --secondary-container: #feb700;
    --surface: #fcf9f8;
    --surface-low: #f6f3f2;
    --surface-highest: #e5e2e1;
    --on-surface: #241d1c;
    --on-primary: #fff7f6;
    --outline-variant: #9a918d;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(circle at 10% 0%, #fff4f3 0%, var(--surface) 45%, #f0eceb 100%);
    color: var(--on-surface);
    font-family: "Manrope", "Segoe UI", sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
}

p {
    margin: 0;
}

a {
    color: inherit;
}

.portal-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.2rem 1rem 3rem;
}

.portal-header {
    display: grid;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.2rem;
}

.portal-brand h1 {
    font-size: clamp(1.7rem, 3vw, 2.7rem);
    letter-spacing: -0.02em;
}

.brand-pill {
    display: inline-block;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    font-family: "Work Sans", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: #2f1f00;
    background: var(--secondary-container);
}

.portal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.portal-link {
    text-decoration: none;
    padding: 0.52rem 0.9rem;
    border-radius: 999px;
    background: var(--surface-low);
    color: var(--on-surface);
    font-family: "Work Sans", sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    transition: transform 120ms ease, background 120ms ease;
}

.portal-link.active {
    background: linear-gradient(145deg, var(--primary), var(--primary-container));
    color: var(--on-primary);
}

.portal-link:hover {
    transform: translateY(-1px);
}

.portal-main {
    display: grid;
    gap: 1.2rem;
}

.hero-panel,
.surface-card,
.flow-card {
    border: 0;
    border-radius: 1rem 0.5rem 0.5rem 0.5rem;
    background: var(--surface-low);
    padding: 1.1rem;
}

.hero-panel {
    display: grid;
    gap: 0.8rem;
    background: linear-gradient(145deg, #2a1617 0%, #3f1f22 55%, #5d2427 100%);
    color: #fff7f6;
    box-shadow: 0 30px 70px rgba(36, 15, 16, 0.14);
}

.hero-panel h1 {
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    line-height: 1.07;
}

.hero-kicker {
    font-family: "Work Sans", sans-serif;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: #ffba20;
    text-transform: uppercase;
}

.hero-copy {
    line-height: 1.6;
    max-width: 72ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.btn-primary,
.btn-secondary {
    border: 0;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.62rem 1rem;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    transition: transform 120ms ease, opacity 120ms ease;
}

.btn-primary {
    background: linear-gradient(145deg, var(--primary), var(--primary-container));
    color: var(--on-primary);
}

.btn-secondary {
    background: var(--secondary-container);
    color: #2f1f00;
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-1px);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.grid-panels {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.surface-card {
    display: grid;
    gap: 0.5rem;
}

.surface-card h2 {
    font-size: 1.25rem;
}

.inline-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.flow-card {
    display: grid;
    gap: 1rem;
    background: var(--surface-highest);
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: flex-end;
}

.form-grid {
    display: grid;
    gap: 0.8rem;
}

.form-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-field {
    display: grid;
    gap: 0.35rem;
}

.form-field.compact {
    max-width: 220px;
}

.form-field label {
    font-family: "Work Sans", sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-field.full-width {
    grid-column: 1 / -1;
}

.input-shell {
    min-height: 44px;
    border: 0;
    border-radius: 0.8rem 0.45rem 0.45rem 0.45rem;
    background: var(--surface);
    color: var(--on-surface);
    padding: 0.65rem 0.8rem;
    font-family: "Manrope", sans-serif;
    width: 100%;
}

.input-shell:focus {
    outline: 2px solid rgba(230, 33, 30, 0.35);
}

.file-shell {
    padding: 0.52rem;
}

.label-meta {
    color: #5e5652;
    font-family: "Work Sans", sans-serif;
    font-size: 0.78rem;
}

.status-message {
    border-radius: 0.8rem;
    padding: 0.75rem;
    font-family: "Work Sans", sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
}

.status-success {
    background: #dcefd7;
    color: #294d26;
}

.status-error {
    background: #ffe0dd;
    color: #7f1512;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.metric-tile {
    border-radius: 0.95rem 0.45rem 0.45rem 0.45rem;
    background: var(--surface);
    padding: 0.8rem;
    display: grid;
    gap: 0.4rem;
}

.metric-tile strong {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.35rem;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 0.9rem;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.62rem 0.72rem;
    font-size: 0.9rem;
    vertical-align: top;
}

.data-table th {
    font-family: "Work Sans", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.72rem;
    color: #5e5652;
    background: #f1edeb;
}

.data-table tbody tr:nth-child(even) {
    background: #faf8f7;
}

.valid.modified:not([type=checkbox]) {
    outline: 2px solid #26b050;
}

.invalid {
    outline: 2px solid #be000b;
}

.validation-message {
    color: #7f1512;
    font-size: 0.8rem;
    font-family: "Work Sans", sans-serif;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #ffefdd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    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%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 700;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

@media (max-width: 720px) {
    .portal-shell {
        padding: 0.9rem 0.75rem 2.4rem;
    }

    .hero-panel,
    .surface-card,
    .flow-card {
        padding: 0.9rem;
    }

    .data-table th,
    .data-table td {
        min-width: 125px;
    }
}