.portal-card {
    max-width: 980px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Make the portal sign-in visible above the fold */
body[data-page="portal"] .hero {
    min-height: 100vh;
    padding: 8.5rem 0 4rem 0;
    justify-content: flex-start;
}

body[data-page="portal"] .hero-background {
    display: none;
}

.portal-card--hero {
    max-width: 520px;
    margin-top: 2rem;
}

/* After login: collapse hero so dashboard sits higher */
body.portal-authenticated[data-page="portal"] .hero {
    min-height: 32vh;
    padding: 7.5rem 0 2rem 0;
}

body.portal-authenticated[data-page="portal"] .portal-card--hero {
    display: none;
}

body.portal-authenticated[data-page="portal"] .value-cards {
    padding-top: 2.5rem;
}

/* Fix outline buttons on light portal surfaces (global btn-outline assumes dark backgrounds) */
body[data-page="portal"] .btn-outline {
    color: #6d28d9;
    border-color: #8b5cf6;
}

body[data-page="portal"] .btn-outline:hover {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.25);
}

.portal-title {
    text-align: center;
    margin: 0 0 1.25rem 0;
    color: #1e293b;
}

.portal-muted {
    text-align: center;
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.95rem;
}

.portal-alert {
    max-width: 980px;
    margin: 0 auto 1rem auto;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 500;
}

.portal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.portal-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

.portal-field input,
.portal-field textarea,
.portal-field select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
}

.portal-field textarea {
    resize: vertical;
}

.portal-header {
    max-width: 980px;
    margin: 0 auto 1rem auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.portal-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.portal-tabs {
    max-width: 980px;
    margin: 0 auto 1rem auto;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.portal-tab {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.portal-tab.is-active {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.08);
    color: #6d28d9;
}

.portal-panel {
    max-width: 980px;
    margin: 0 auto;
}

.portal-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.portal-panel-header h3 {
    margin: 0;
    color: #1e293b;
}

.portal-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.portal-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.portal-item h4 {
    margin: 0 0 0.25rem 0;
    color: #0f172a;
}

.portal-item p {
    margin: 0.25rem 0 0 0;
    color: #475569;
}

.portal-meta {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 0.35rem;
}

.portal-search {
    display: grid;
    grid-template-columns: 1fr max-content;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.portal-search textarea {
    min-width: 260px;
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    resize: vertical;
}

.portal-checkbox {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .portal-search {
        grid-template-columns: 1fr;
    }
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.portal-hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1rem 0;
}

@media (min-width: 900px) {
    .portal-grid {
        grid-template-columns: 1fr 1fr;
    }
}
