:root {
    --brand: #BF311A;
    --ink: #1f2328;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f7f7f8;
}

html, body {
    margin: 0;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

h1 { font-size: 1.5rem; }

/* ---- Loading splash ---- */
.auth-splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    color: var(--muted);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Login ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}

.login-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: 100%;
    margin: 0 auto 24px;
}

.login-title { margin: 0 0 4px; }
.login-subtitle { margin: 0 0 24px; color: var(--muted); }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--muted);
}

.form-control {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand);
}

.login-error {
    background: #fdecea;
    color: #a31515;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.login-button {
    width: 100%;
    padding: 11px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.login-button:disabled { opacity: 0.6; cursor: default; }

/* ---- Authenticated shell ---- */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.portal-brand { display: inline-flex; align-items: center; text-decoration: none; }
.portal-brand img { height: 26px; width: auto; display: block; }
.portal-header-right { display: flex; align-items: center; gap: 14px; }
.portal-user { color: var(--muted); font-size: 0.9rem; }
.portal-nav-link { color: var(--ink); text-decoration: none; font-size: 0.9rem; }
.portal-nav-link:hover { color: var(--brand); }

.portal-signout {
    background: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
}

.portal-main { padding: 24px 20px; max-width: 960px; }

.account-summary { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; }
.account-summary dt { color: var(--muted); }
.account-summary dd { margin: 0; }

/* ---- Profile ---- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-header h1 { margin: 0 0 2px; }
.profile-subtitle { margin: 0; color: var(--muted); font-size: 0.95rem; }

.profile-section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.profile-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.org-badge {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-active { background: #e6f4ea; color: #1a8a4a; }
.badge-inactive { background: #fdecea; color: #a31515; }

.profile-error {
    background: #fdecea;
    color: #a31515;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin: 0 0 12px;
}

/* ---- Blazor error UI ---- */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    background: #ffefc1;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.1);
}
