:root {
    --portal-navy: #183153;
    --portal-blue: #2563a6;
    --portal-mint: #0f9f8f;
    --portal-gold: #d99b2b;
    --portal-ink: #172033;
    --portal-muted: #667085;
    --portal-bg: #f5f7fb;
    --portal-border: #d9e1ec;
}

body {
    margin: 0;
    background: var(--portal-bg);
    color: var(--portal-ink);
    font-family: "Sarabun", "Segoe UI", Tahoma, sans-serif;
}

.portal-login {
    background: linear-gradient(135deg, #183153 0%, #2563a6 52%, #0f9f8f 100%);
}

.login-card {
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
}

.portal-kicker {
    display: inline-block;
    color: var(--portal-mint);
    font-weight: 700;
    margin-bottom: 8px;
}

.login-card h1,
.topbar h1,
.profile-band h2,
.panel h2,
.panel h3,
.section-title {
    letter-spacing: 0;
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 700;
}

.login-note {
    border-top: 1px solid var(--portal-border);
    color: var(--portal-muted);
    font-size: .9rem;
    margin-top: 24px;
    padding-top: 16px;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--portal-navy);
    color: #fff;
    padding: 22px 18px;
}

.brand {
    align-items: center;
    color: #fff;
    display: flex;
    font-weight: 700;
    gap: 10px;
    margin-bottom: 28px;
    text-decoration: none;
}

.brand-mark {
    background: var(--portal-gold);
    border-radius: 6px;
    color: #121212;
    display: inline-grid;
    font-size: .82rem;
    height: 36px;
    place-items: center;
    width: 48px;
}

.sidebar .nav-link {
    align-items: center;
    border-radius: 6px;
    color: rgba(255, 255, 255, .78);
    display: flex;
    gap: 10px;
    min-height: 42px;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.main-pane {
    min-width: 0;
}

.topbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    justify-content: space-between;
    min-height: 86px;
    padding: 18px 28px;
}

.topbar h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.content {
    padding: 28px;
}

.user-chip {
    color: var(--portal-muted);
    font-size: .95rem;
}

.profile-band {
    background: linear-gradient(135deg, var(--portal-blue), var(--portal-mint));
    border-radius: 8px;
    color: #fff;
    padding: 28px;
}

.profile-photo {
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 4px solid rgba(255, 255, 255, .65);
    border-radius: 8px;
    height: 128px;
    object-fit: cover;
    width: 128px;
}

.profile-photo.small {
    height: 92px;
    width: 92px;
}

.current-photo-preview {
    text-align: center;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
}

.quick-actions,
.service-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
}

.action-card,
.service-card,
.panel {
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
}

.action-card {
    align-items: center;
    color: var(--portal-ink);
    display: flex;
    font-weight: 700;
    gap: 12px;
    min-height: 72px;
    padding: 16px;
    text-decoration: none;
}

.action-card i,
.service-card i {
    color: var(--portal-blue);
    font-size: 1.35rem;
}

.panel {
    padding: 22px;
}

.panel h3,
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.data-list {
    margin: 0;
}

.data-list div {
    border-bottom: 1px solid var(--portal-border);
    display: grid;
    gap: 12px;
    grid-template-columns: 150px 1fr;
    padding: 10px 0;
}

.data-list div:last-child {
    border-bottom: 0;
}

.data-list dt {
    color: var(--portal-muted);
    font-weight: 600;
}

.data-list dd {
    margin: 0;
}

.policy-grid {
    display: grid;
    gap: 10px 12px;
    grid-template-columns: 120px 1fr;
}

.service-card {
    color: var(--portal-ink);
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 18px;
    text-decoration: none;
}

.service-card span {
    color: var(--portal-muted);
}

.service-card.disabled {
    opacity: .62;
}

@media (max-width: 991.98px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .quick-actions,
    .service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .content {
        padding: 18px;
    }

    .quick-actions,
    .service-grid,
    .data-list div,
    .policy-grid {
        grid-template-columns: 1fr;
    }
}

.profile-score {
    align-items: center;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 8px;
    display: grid;
    min-width: 120px;
    padding: 14px;
    text-align: center;
}

.profile-score span {
    font-size: 1.6rem;
    font-weight: 700;
}

.profile-score small {
    color: rgba(255, 255, 255, .76);
}

.section-heading {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-heading h2,
.section-heading h3 {
    margin-bottom: 4px;
}

.field-state,
.status-pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: .78rem;
    font-weight: 700;
    margin-left: 6px;
    padding: 3px 8px;
    white-space: nowrap;
}

.field-state.editable {
    background: #e6f7ef;
    color: #0f7a4f;
}

.field-state.readonly {
    background: #eef2f6;
    color: #475467;
}

.field-state.request {
    background: #fff4d6;
    color: #946200;
}

.status-pill {
    background: #eef2f6;
    color: #475467;
}

.status-pending {
    background: #fff4d6;
    color: #946200;
}

.status-approved {
    background: #e6f7ef;
    color: #0f7a4f;
}

.status-rejected {
    background: #fde8e8;
    color: #b42318;
}

.status-cancelled {
    background: #f2f4f7;
    color: #667085;
}

.form-stack {
    display: grid;
    gap: 20px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rich-editor {
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    overflow: hidden;
}

.rich-editor-toolbar {
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
}

.rich-editor-toolbar .btn {
    align-items: center;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    min-width: 34px;
    padding: 0 8px;
}

.rich-editor-divider {
    align-self: stretch;
    background: var(--portal-border);
    display: inline-block;
    margin: 2px 4px;
    width: 1px;
}

.rich-editor-surface {
    background: #fff;
    min-height: 220px;
    outline: 0;
    padding: 14px 16px;
}

.rich-editor-surface:focus {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 166, .2);
}

.profile-rich-content {
    color: var(--portal-ink);
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.profile-rich-content > :last-child {
    margin-bottom: 0;
}

.profile-rich-content h3,
.profile-rich-content h4 {
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 8px;
}

.profile-rich-content h3 {
    font-size: 1.08rem;
}

.profile-rich-content h4 {
    font-size: 1rem;
}

.profile-rich-content p,
.profile-rich-content ul,
.profile-rich-content ol {
    margin: 0 0 10px;
}

.profile-rich-content ul,
.profile-rich-content ol {
    padding-left: 1.25rem;
}

.profile-rich-content a {
    color: var(--portal-blue);
    font-weight: 700;
}

.education-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.education-item,
.request-mini-list > div {
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    padding: 14px;
}

.education-item span,
.education-item small {
    color: var(--portal-muted);
}

.request-mini-list {
    display: grid;
    gap: 10px;
}

.empty-state {
    align-items: center;
    border: 1px dashed var(--portal-border);
    border-radius: 8px;
    color: var(--portal-muted);
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 34px;
}

.empty-state i {
    color: var(--portal-blue);
    font-size: 2rem;
}

.profile-progress {
    height: 10px;
}

.completeness-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.completeness-details summary {
    align-items: center;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    color: var(--portal-blue);
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    gap: 8px;
    padding: 8px 12px;
}

.completeness-details[open] summary {
    margin-bottom: 12px;
}

.completeness-grid h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.completeness-list {
    display: grid;
    gap: 8px;
}

.completeness-item {
    align-items: center;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: auto 1fr auto;
    padding: 10px 12px;
}

.completeness-item small {
    color: var(--portal-muted);
    display: block;
    margin-top: 2px;
}

.completeness-mark {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-weight: 700;
    height: 26px;
    justify-content: center;
    width: 26px;
}

.completeness-item.complete .completeness-mark {
    background: #e6f7ef;
    color: #0f7a4f;
}

.completeness-item.missing .completeness-mark {
    background: #fff4d6;
    color: #946200;
}

.completeness-item.optional {
    opacity: .86;
}

.optional-completeness summary {
    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 991.98px) {
    .education-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .completeness-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .education-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        flex-direction: column;
    }
}
