.patient-portal-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem;
}

.portal-narrow {
    max-width: 720px;
}

.portal-loading-shell {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-header-card,
.portal-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.portal-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portal-header-card h2,
.portal-card h4,
.portal-card h5 {
    margin: 0 0 .35rem 0;
}

.portal-eyebrow {
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: .25rem;
}

.portal-muted {
    color: #64748b;
    font-size: .9rem;
}

.portal-warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.portal-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .85rem;
    margin-bottom: .85rem;
}

.portal-form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-form-grid label,
.portal-textarea-field label,
.portal-generated-link label {
    display: block;
    font-weight: 600;
    margin-bottom: .25rem;
    color: #334155;
}

.portal-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.portal-grid-actions {
    display: flex;
    gap: .35rem;
}

.portal-check-row {
    display: flex;
    align-items: center;
    min-height: 38px;
}

.portal-check-list {
    display: grid;
    gap: .5rem;
    margin: 1rem 0;
}

.portal-check-list.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-accordion {
    margin-top: 1rem;
}

.portal-consent-box {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    border-radius: 8px;
    padding: .85rem;
    margin-bottom: 1rem;
    color: #1e3a8a;
}

.portal-error-list {
    margin-top: 1rem;
    padding: .75rem;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
}

.portal-generated-link {
    margin-top: 1rem;
}

.portal-review-box {
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.portal-review-box pre {
    background: #0f172a;
    color: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    max-height: 380px;
    overflow: auto;
    white-space: pre-wrap;
}

.portal-message-list {
    margin-top: 1rem;
    display: grid;
    gap: .75rem;
}

.portal-message {
    border-radius: 10px;
    padding: .75rem;
    border: 1px solid #e5e7eb;
}

.portal-message.staff {
    background: #f8fafc;
}

.portal-message.patient {
    background: #f0fdf4;
}

.portal-message-meta {
    font-size: .8rem;
    color: #64748b;
    margin-bottom: .25rem;
}

@media (max-width: 768px) {
    .portal-form-grid.two,
    .portal-check-list.compact {
        grid-template-columns: 1fr;
    }

    .portal-actions {
        justify-content: stretch;
        flex-direction: column;
    }
}
