:root {
    --color-primary: #1a1a5e;
    --color-primary-dark: #12124a;
    --color-accent: #e31e24;
    --color-accent-dark: #c4191f;
    --color-bg: #f5f6fa;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-muted: #64748b;
    --color-border: #d8dce8;
    --color-success: #16a34a;
    --shadow-sm: 0 2px 8px rgba(26, 26, 94, 0.06);
    --shadow: 0 8px 32px rgba(26, 26, 94, 0.1);
    --radius: 14px;
    --radius-sm: 10px;
    --header-height: 72px;
    --touch-min: 44px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

body.nav-open {
    overflow: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
}

/* Header */
.site-header {
    background: var(--color-primary);
    border-bottom: 3px solid var(--color-accent);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    gap: 1rem;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    min-width: 0;
    flex: 1;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 3px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.logo-title {
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    line-height: 1.25;
}

.logo-subtitle {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.3;
}

.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: var(--touch-min);
    height: var(--touch-min);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 10px;
    flex-shrink: 0;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-primary);
    padding: 1.5rem 1rem 2rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    overflow-y: auto;
    z-index: 150;
}

.site-nav.is-open {
    display: flex;
}

.site-nav a,
.site-nav .btn-link {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
}

.site-nav a:hover,
.site-nav a:active {
    background: rgba(255, 255, 255, 0.1);
}

.site-nav .nav-cta {
    background: var(--color-accent);
    justify-content: center;
    font-weight: 600;
}

.site-nav .nav-cta:hover {
    background: var(--color-accent-dark);
}

.site-nav .nav-cta-btn {
    justify-content: center;
    width: 100%;
}

.logout-form {
    display: block;
}

.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

@media (min-width: 768px) {
    .logo-mark {
        width: 48px;
        height: 48px;
        padding: 4px;
        border-radius: 11px;
    }

    .logo-title {
        font-size: 0.95rem;
    }

    .logo-subtitle {
        font-size: 0.78rem;
    }

    @media (min-width: 900px) {
        .logo-title {
            font-size: 1rem;
        }

        .logo-subtitle {
            font-size: 0.8rem;
        }
    }

    .nav-toggle {
        display: none;
    }

    .site-nav {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        padding: 0;
        background: transparent;
        gap: 0.5rem;
        overflow: visible;
        width: auto;
    }

    .site-nav a,
    .site-nav .btn-link {
        padding: 0.5rem 0.75rem;
        min-height: auto;
        font-size: 0.9rem;
        width: auto;
    }

    .site-nav a:hover {
        background: transparent;
        opacity: 0.85;
    }

    .site-nav .nav-cta {
        padding: 0.5rem 1rem;
    }

    .site-nav .nav-cta-btn {
        width: auto;
    }

    .btn-link {
        width: auto;
        text-align: center;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #fff;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    min-height: var(--touch-min);
    transition: background 0.2s, transform 0.15s;
    font-family: inherit;
    line-height: 1.2;
}

.btn:active {
    transform: scale(0.98);
}

.btn:hover {
    background: var(--color-primary-dark);
}

.btn-accent {
    background: var(--color-accent);
}

.btn-accent:hover {
    background: var(--color-accent-dark);
}

.btn-small {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn-full {
    width: 100%;
}

.btn.is-loading {
    position: relative;
    cursor: wait;
    opacity: 0.92;
}

.btn.is-loading .btn-label {
    visibility: hidden;
}

.btn-spinner {
    display: none;
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

.btn.is-loading .btn-spinner {
    display: block;
}

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

/* Toast notifications */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 0.75rem);
    right: 1rem;
    left: 1rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 400px;
    margin-left: auto;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(26, 26, 94, 0.15);
    font-size: 0.9rem;
    line-height: 1.45;
    animation: toast-in 0.25s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-message {
    flex: 1;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    color: inherit;
}

.toast-close:hover {
    opacity: 1;
}

.toast.toast-hide {
    opacity: 0;
    transform: translateX(12px);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.toast-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.toast-info,
.toast-warning {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.toast-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

main {
    flex: 1;
}

/* Hero */
.hero {
    padding: 2rem 0 3rem;
    background: linear-gradient(180deg, #fff 0%, var(--color-bg) 100%);
}

.hero-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

.hero-logo-wrap {
    display: inline-block;
    margin-bottom: 1rem;
}

.hero-logo {
    width: auto;
    height: 110px;
    max-width: 100%;
    object-fit: contain;
}

.eyebrow {
    color: var(--color-accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.hero h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.lead {
    font-size: 1rem;
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hero-actions .btn {
    width: 100%;
}

.hero-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-accent);
}

.hero-card h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.program-list {
    padding-left: 1.25rem;
}

.program-list li {
    padding: 0.4rem 0;
    color: var(--color-text);
    font-size: 0.95rem;
}

/* Features */
.features {
    padding: 2rem 0 3rem;
}

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

.features-grid article {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-accent);
    box-shadow: var(--shadow-sm);
}

.features-grid h3 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.features-grid p {
    color: var(--color-muted);
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .hero {
        padding: 3rem 0 4rem;
    }

    .hero-inner {
        grid-template-columns: 1.1fr 0.9fr;
        gap: 3rem;
        align-items: center;
    }

    .hero-logo {
        height: 130px;
    }

    .hero-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .hero-actions .btn {
        width: auto;
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Page header */
.page-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    padding: 2rem 0;
    border-bottom: 3px solid var(--color-accent);
}

.page-header h1 {
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin-bottom: 0.35rem;
}

.page-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Forms */
.form-section,
.auth-section,
.dashboard-section,
.success-section {
    padding: 1.5rem 0 2.5rem;
}

.auth-section {
    display: flex;
    justify-content: center;
    flex: 1;
    padding: 2rem 0 3rem;
}

.auth-section > .container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.auth-card,
.application-form,
.dashboard-card,
.success-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
    width: 100%;
}

.auth-card {
    max-width: 440px;
}

.auth-card-wide {
    max-width: 720px;
}

.register-form {
    gap: 0;
}

.register-section {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.register-section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.register-section-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.register-form .btn-full {
    margin-top: 0.25rem;
}

.page-header-auth {
    text-align: center;
}

.page-header-auth h1 {
    margin-bottom: 0.35rem;
}

.page-header-auth p {
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-form .btn-full {
    margin-top: 0.35rem;
}

.auth-card h1,
.success-card h1 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    font-size: clamp(1.35rem, 4vw, 1.75rem);
}

.auth-subtitle {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--color-primary);
    font-weight: 600;
}

.register-fieldset,
.form-section-block {
    border: none;
    margin-bottom: 1.5rem;
}

.register-fieldset legend,
legend {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    width: 100%;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

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

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: var(--touch-min);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input[type="file"] {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    background: #f8f9fc;
    border-style: dashed;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 26, 94, 0.12);
}

.help-text {
    font-size: 0.8rem;
    color: var(--color-muted);
    line-height: 1.4;
}

.help-text-success {
    color: #166534;
}

.errorlist {
    list-style: none;
    color: #b91c1c;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    padding: 0.65rem 0.85rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
}

.errorlist li + li {
    margin-top: 0.3rem;
}

.form-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.form-actions {
    padding-top: 0.5rem;
}

.form-actions .btn {
    width: 100%;
}

.profile-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.value {
    font-weight: 600;
    color: var(--color-text);
    word-break: break-word;
}

.declaration-group {
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.5;
}

.checkbox-label input {
    margin-top: 0.2rem;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .form-section,
    .auth-section,
    .dashboard-section,
    .success-section {
        padding: 2.5rem 0 4rem;
    }

    .auth-card,
    .application-form,
    .dashboard-card,
    .success-card {
        padding: 2rem 2.25rem;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .profile-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-actions .btn {
        width: auto;
    }
}

/* Dashboard */
.status-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-eligible {
    background: #dcfce7;
    color: #166534;
}

.badge-not_eligible {
    background: #fee2e2;
    color: #991b1b;
}

.badge-table {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.2;
}

.badge-table::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-pending.badge-table {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-pending.badge-table::before {
    background: #f59e0b;
}

.badge-eligible.badge-table {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-eligible.badge-table::before {
    background: #22c55e;
}

.badge-not_eligible.badge-table {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-not_eligible.badge-table::before {
    background: #ef4444;
}

.staff-table-modern .col-status {
    text-align: center;
}

.staff-table-modern .col-status .badge-table {
    min-width: 0;
    max-width: 100%;
    justify-content: center;
    font-size: 0.72rem;
    padding: 0.2rem 0.4rem;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
}

.empty-state h2 {
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--color-muted);
    margin-bottom: 1.25rem;
}

.dashboard-actions,
.success-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-actions .btn,
.success-actions .btn {
    width: 100%;
}

@media (min-width: 768px) {
    .status-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .dashboard-actions,
    .success-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .dashboard-actions .btn,
    .success-actions .btn {
        width: auto;
    }
}

/* Success */
.success-section {
    display: flex;
    justify-content: center;
}

.success-card {
    max-width: 560px;
    text-align: center;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: #dcfce7;
    color: var(--color-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1.25rem;
}

.application-number-box {
    background: var(--color-bg);
    border: 2px dashed var(--color-primary);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin: 1.25rem 0;
}

.application-number-box .number {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.04em;
    word-break: break-all;
}

.success-note {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Footer */
.site-footer {
    background: var(--color-primary-dark);
    color: rgba(255, 255, 255, 0.85);
    padding: 2rem 0 1.5rem;
    border-top: 3px solid var(--color-accent);
    margin-top: auto;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.logo-mark-footer {
    width: 64px;
    height: 64px;
    padding: 5px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.footer-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.footer-title {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.footer-location {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: 0.08em;
    margin-top: 0.15rem;
}

.footer-copy,
.footer-ict {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    max-width: 520px;
}

.footer-ict a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.footer-ict a:hover {
    color: var(--color-accent);
}

@media (min-width: 768px) {
    .footer-brand {
        flex-direction: row;
        gap: 1rem;
    }

    .logo-mark-footer {
        width: 72px;
        height: 72px;
    }
}

/* Staff portal */
.staff-section {
    padding: 1.5rem 0 2.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-pending .stat-value { color: #92400e; }
.stat-eligible .stat-value { color: #166534; }
.stat-rejected .stat-value { color: #991b1b; }

.staff-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.staff-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.staff-export-btn {
    text-align: center;
}

.staff-table-wrap {
    overflow: hidden;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.staff-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.staff-table-modern {
    min-width: 0;
}

.staff-table th,
.staff-table td {
    padding: 0.65rem 0.45rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    overflow: hidden;
}

.staff-table-modern col.col-application_number {
    width: 3.25rem;
}

.staff-table-modern col.col-name {
    width: 16%;
}

.staff-table-modern col.col-program {
    width: 32%;
}

.staff-table-modern col.col-category {
    width: 11%;
}

.staff-table-modern col.col-status {
    width: 12%;
}

.staff-table-modern col.col-submitted {
    width: 9%;
}

.staff-table-modern col.col-action {
    width: 11%;
}

.staff-table-modern .col-application_number {
    text-align: left;
    white-space: nowrap;
    padding-right: 0.2rem;
}

.staff-table-modern .col-application_number .app-code-short {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.15rem 0.3rem;
    font-variant-numeric: tabular-nums;
}

.staff-table-modern th.col-application_number .sort-link {
    justify-content: flex-start;
}

.staff-table-modern .col-name {
    padding-left: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.staff-table-modern .col-program {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.staff-table-modern .col-category {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.staff-table-modern .col-status {
    text-align: center;
}

.staff-table-modern .col-submitted {
    white-space: nowrap;
    font-size: 0.8rem;
}

.staff-table-modern .col-action {
    text-align: center;
    white-space: nowrap;
}

.staff-table-modern .col-action .btn {
    min-width: 0;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
    font-size: 0.8rem;
}

.staff-table th {
    background: var(--color-bg);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.staff-table tbody tr:hover {
    background: #fafbfe;
}

.table-muted {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.staff-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.section-heading {
    color: var(--color-primary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

.document-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.document-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .staff-toolbar {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .staff-filters {
        grid-template-columns: 2fr 1fr 1fr auto;
        flex: 1;
    }

    .staff-export-btn {
        white-space: nowrap;
    }

    .staff-detail-grid {
        grid-template-columns: 1.4fr 1fr;
        align-items: start;
    }
}

@media (max-width: 767px) {
    .staff-section {
        padding: 1rem 0 2rem;
    }

    .staff-toolbar {
        margin-bottom: 1rem;
    }

    .staff-filters .btn,
    .staff-export-btn {
        width: 100%;
    }

    .page-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }

    .staff-review-layout {
        gap: 1rem;
    }

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

    .doc-card {
        flex-wrap: wrap;
    }

    .doc-card .btn-small {
        width: 100%;
        margin-top: 0.35rem;
    }
}

/* Modern dashboards & review UI */
.page-header-compact {
    padding: 1.5rem 0;
}

.page-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-link {
    display: inline-block;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    color: #fff;
}

.review-page-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.65rem;
    line-height: 1.3;
}

.review-page-sep {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 400;
}

.review-page-title .app-code-light {
    font-size: 0.45em;
    font-weight: 600;
}

.app-code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.9rem;
    background: var(--color-bg);
    color: var(--color-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

.app-code-light {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.badge-lg {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}

.app-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
    border-left: 5px solid var(--color-primary);
}

.app-status-banner.badge-eligible {
    border-left-color: var(--color-success);
}

.app-status-banner.badge-pending {
    border-left-color: #f59e0b;
}

.app-status-banner.badge-not_eligible {
    border-left-color: var(--color-accent);
}

.app-status-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.25rem;
}

.app-status-number {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 700;
    color: var(--color-primary);
}

.review-message-card {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}

.review-message-title {
    font-size: 0.8rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.review-message-body {
    color: var(--color-text);
    line-height: 1.6;
    white-space: pre-wrap;
}

.app-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.app-info-card {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    padding: 0.15rem 0;
    max-width: 100%;
}

.sort-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sort-link:hover {
    color: var(--color-primary);
}

.sort-link.is-active {
    color: var(--color-primary);
}

.sort-arrows {
    display: inline-flex;
    flex-direction: column;
    line-height: 0.65;
    gap: 1px;
    margin-left: 0.1rem;
}

.sort-arrow {
    font-size: 0.55rem;
    color: #b8c0d4;
    transition: color 0.15s;
}

.sort-link:hover .sort-arrow {
    color: #94a3b8;
}

.sort-arrow.is-active {
    color: var(--color-accent);
}

.staff-table-modern th {
    background: #f0f2f8;
    vertical-align: middle;
}

.staff-table-modern th.col-application_number {
    text-align: left;
}

.staff-table-modern th.col-status,
.staff-table-modern th.col-action {
    text-align: center;
}

.staff-table-modern th .sort-link {
    width: 100%;
}

.staff-table-modern th.col-status .sort-link,
.staff-table-modern th.col-action .sort-link {
    justify-content: center;
}

.staff-review-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    align-items: start;
}

.staff-review-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.review-card {
    margin-bottom: 0;
}

.detail-grid-modern {
    gap: 1rem;
}

.detail-item {
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}

.detail-item-full {
    grid-column: 1 / -1;
}

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

.doc-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.doc-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.doc-card-info {
    flex: 1;
    min-width: 0;
}

.doc-card-info strong {
    display: block;
    color: var(--color-primary);
    font-size: 0.95rem;
}

.doc-card-info span {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.staff-review-sidebar {
    position: static;
}

.review-decision-card {
    border-top: 4px solid var(--color-accent);
}

.review-hint {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.review-form .btn-full {
    margin-top: 0.5rem;
}

body.modal-open {
    overflow: hidden;
}

.doc-modal[hidden] {
    display: none !important;
}

.doc-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.doc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 18, 74, 0.65);
    backdrop-filter: blur(4px);
}

.doc-modal-panel {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    width: min(900px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.doc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-primary);
    color: #fff;
}

.doc-modal-header h3 {
    font-size: 1rem;
}

.doc-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.doc-modal-body {
    padding: 1rem;
    overflow: auto;
    flex: 1;
    background: #f8f9fc;
    min-height: 300px;
}

.doc-frame {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: var(--radius-sm);
    background: #fff;
}

.doc-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.doc-modal-error {
    text-align: center;
    color: var(--color-accent);
    padding: 2rem 1rem;
    margin: 0;
}

.doc-modal-footer {
    display: flex;
    justify-content: center;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--color-border);
    background: #fff;
}

.doc-modal-footer .btn {
    min-width: 12rem;
}

@media (min-width: 768px) {
    .app-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .doc-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .staff-review-layout {
        grid-template-columns: 1.5fr 1fr;
    }

    .staff-review-sidebar {
        position: sticky;
        top: calc(var(--header-height) + 1rem);
    }
}

@media (min-width: 1024px) {
    .app-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.review-modal[hidden] {
    display: none !important;
}

.review-modal {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.review-modal-panel {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    width: min(1100px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.review-modal-content {
    padding: 1.25rem 1.5rem 1.5rem;
    overflow: auto;
    flex: 1;
    background: #f8f9fc;
}

.review-modal-loading,
.review-modal-error {
    text-align: center;
    color: var(--color-muted);
    padding: 2rem 1rem;
}

.review-modal-error {
    color: var(--color-accent);
}

.review-modal-header-inline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.review-modal-header-inline h2 {
    font-size: 1.35rem;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.review-modal-body-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.review-modal-subheading {
    font-size: 0.95rem;
    color: var(--color-primary);
    margin-bottom: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.review-modal-form-wrap {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: 1.15rem;
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-accent);
}

.review-locked-note {
    color: var(--color-muted);
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.app-info-card .label {
    display: block;
    margin-bottom: 0.25rem;
}

.app-info-card .value {
    font-weight: 600;
    color: var(--color-primary);
}

@media (min-width: 900px) {
    .review-modal-body-grid {
        grid-template-columns: 1.4fr 1fr;
        align-items: start;
    }
}
