/* ============================================================
   Thai Font
   ============================================================ */
@font-face {
    font-family: 'thsarabunnew';
    src: url('fonts/thsarabunnew-webfont.eot');
    src: url('fonts/thsarabunnew-webfont.eot?#iefix') format('embedded-opentype'),
    url('fonts/thsarabunnew-webfont.woff') format('woff'),
    url('fonts/thsarabunnew-webfont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* ============================================================
   DEPRECATED 2026-05-29 — superseded by FOUNDATION :root at bottom.
   Kept for backward compat until all legacy classes migrate to
   rssf-* foundation classes. See FOUNDATION block (~line 2874).
   ============================================================ */
:root {
    --primary:        #2563eb;
    --primary-dark:   #1d4ed8;
    --primary-light:  #eff6ff;
    --primary-mid:    #dbeafe;
    --success:        #16a34a;
    --success-light:  #f0fdf4;
    --warning:        #d97706;
    --warning-light:  #fffbeb;
    --danger:         #dc2626;
    --danger-light:   #fef2f2;
    --text-heading:   #1e293b;
    --text-body:      #475569;
    --text-muted:     #94a3b8;
    --border:         #e2e8f0;
    --bg-page:        #f8fafc;
    --bg-card:        #ffffff;
    --sidebar-w:      220px;
    --topbar-h:       52px;
}

/* ============================================================
   Base
   ============================================================ */
html, body {
    height: 100%;
    font-family: 'thsarabunnew', 'THSarabunNew', sans-serif;
    font-size: 16px;
    color: var(--text-body);
    background-color: var(--bg-page);
}

.thsarabunnew {
    font-family: 'THSarabunNew', sans-serif;
}

/* ============================================================
   Topbar
   ============================================================ */
.rssf-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1040;
    gap: 12px;
}

.rssf-topbar .topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
    white-space: nowrap;
}

.rssf-topbar .topbar-logo-img {
    width: 84px;
    height: 34px;
    object-fit: contain;
    flex: 0 0 auto;
}

.rssf-topbar .topbar-logo i {
    font-size: 20px;
}

.rssf-topbar .topbar-spacer {
    flex: 1;
}

.rssf-topbar .topbar-badge {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #fde68a;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rssf-topbar .topbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-body);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
    transition: background .15s;
}

.rssf-topbar .topbar-user:hover {
    background: var(--bg-page);
}

.rssf-topbar .topbar-avatar {
    width: 30px;
    height: 30px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 13px;
}

/* ============================================================
   Sidebar
   ============================================================ */
.rssf-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 1030;
    padding: 16px 0 24px;
}

.rssf-sidebar .sidebar-section {
    padding: 0 12px;
    margin-bottom: 4px;
}

.rssf-sidebar .sidebar-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 8px 8px 4px;
}

.rssf-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-body);
    text-decoration: none;
    transition: background .12s, color .12s;
    position: relative;
}

.rssf-sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.rssf-sidebar .nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.rssf-sidebar .nav-link:hover i {
    color: var(--primary);
}

.rssf-sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.rssf-sidebar .nav-link.active i {
    color: var(--primary);
}

.rssf-sidebar .nav-link .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
    line-height: 1.4;
}

.rssf-sidebar .sidebar-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 12px;
}

/* ============================================================
   Main Content Wrapper
   ============================================================ */
.rssf-main {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-h));
    background: var(--bg-page);
}

/* No sidebar (guest/public pages) — full bleed, no padding */
.rssf-main.no-sidebar {
    margin-left: 0;
    padding: 0;
}

/* Breadcrumb still needs horizontal inset when there's no sidebar padding */
.rssf-main.no-sidebar > .rssf-breadcrumb-bar {
    padding-left: 20px;
    padding-right: 20px;
}

/* ============================================================
   Page Title / Breadcrumb
   ============================================================ */
.rssf-page-header {
    margin-bottom: 20px;
}

.rssf-page-header .page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 4px;
}

.rssf-page-header .breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.rssf-page-header .breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.rssf-page-header .breadcrumb-item.active {
    color: var(--text-muted);
}

.rssf-breadcrumb-bar {
    max-width: 1180px;
    margin: 0 auto 18px;
}

.rssf-breadcrumb {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid rgba(37, 99, 235, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
    backdrop-filter: blur(8px);
}

.rssf-breadcrumb .breadcrumb-item {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.rssf-breadcrumb .breadcrumb-item + .breadcrumb-item {
    padding-left: 0;
}

.rssf-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: '\f054';
    font-family: 'Font Awesome 5 Pro';
    font-weight: 900;
    padding: 0 9px 0 6px;
    color: #cbd5e1;
    font-size: 9px;
    line-height: 1;
}

.rssf-breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2563eb;
    text-decoration: none;
    transition: color .15s, background .15s;
}

.rssf-breadcrumb a:hover {
    color: #0f766e;
}

.rssf-breadcrumb .breadcrumb-item:first-child a {
    min-width: 30px;
    height: 30px;
    justify-content: center;
    padding: 0 10px;
    border-radius: 999px;
    color: #1d4ed8;
    background: #eff6ff;
}

.rssf-breadcrumb .breadcrumb-item.active {
    max-width: 320px;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Cards
   ============================================================ */
.rssf-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

/* ============================================================
   Stat Cards (Dashboard)
   ============================================================ */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    transition: box-shadow .15s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger);  }

.stat-info .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1;
}

/* ============================================================
   Status Badges
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* ยื่นแบบคำขอแล้ว */
.status-badge.pending {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

/* อยู่ระหว่างการตรวจสอบเอกสาร */
.status-badge.review {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}



/* ขอเอกสารเพิ่มเติม */
.status-badge.warning {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

/* ยื่นแบบคำขอสำเร็จ */
.status-badge.success {
    background: #ffffff;
    color: #149605;
    border: 1px solid #149605;
}

/* อยู่ระหว่างการพิจารณาคุณสมบัติ */
.status-badge.qualification {
    background: #f3e8ff;
    color: #7c3aed;
    border: 1px solid #d8b4fe;
}

/* เห็นชอบคุณสมบัติ */
.status-badge.approved {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #7dd3fc;
}

/* อยู่ระหว่างการพิจารณาอนุมัติ */
.status-badge.approval {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

/* อนุมัติการขอรับจัดสรรเงิน */
.status-badge.completed {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-badge.default  { background: #f1f5f9;              color: var(--text-body); border: 1px solid var(--border); }

/* ============================================================
   Filter Tabs
   ============================================================ */
.filter-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-page);
    border-radius: 10px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-tab {
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-body);
    text-decoration: none;
    transition: background .12s, color .12s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-tab:hover {
    background: #fff;
    color: var(--text-heading);
    text-decoration: none;
}

.filter-tab.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.filter-tab .tab-count {
    background: var(--border);
    color: var(--text-muted);
    border-radius: 10px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
}

.filter-tab.active .tab-count {
    background: var(--primary-light);
    color: var(--primary);
}

/* ============================================================
   Table
   ============================================================ */
.rssf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rssf-table thead th {
    background: var(--bg-page);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.rssf-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

.rssf-table tbody tr:last-child {
    border-bottom: none;
}

.rssf-table tbody tr:hover {
    background: var(--primary-light);
}

.rssf-table td {
    padding: 12px 14px;
    color: var(--text-body);
    vertical-align: middle;
}

/* GridView sort icons — keep existing */
a.asc:after, a.desc:after {
    content: '';
    left: 3px;
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 4px 4px 2px 4px;
    background: transparent;
}

a.asc:after {
    border-bottom: solid 7px #212529;
    border-top-width: 0;
}

a.desc:after {
    border-top: solid 7px #212529;
    border-bottom-width: 0;
}

.grid-view th {
    white-space: nowrap;
}

/* ============================================================
   Landing Banner
   ============================================================ */
.rssf-banner {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 32px 0;
    line-height: 0;
}

.rssf-banner-link {
    display: block;
    cursor: pointer;
    border-radius: 12px;
    transition: opacity .15s, box-shadow .15s;
}

.rssf-banner-link:hover {
    opacity: .94;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .18);
}

.rssf-banner-link:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 4px;
}

.rssf-banner-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* Landing action bar (option B) */
.rssf-landing-actions {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 32px 8px;
}

.rssf-landing-actions .landing-actions-inner {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-landing-primary,
.btn-landing-secondary {
    flex: 1 1 220px;
    max-width: 360px;
    padding: 14px 28px;
    border-radius: 28px;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity .15s, transform .1s, box-shadow .15s;
}

.btn-landing-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(91, 33, 182, .35);
}

.btn-landing-primary:hover {
    color: #fff;
    opacity: .95;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(91, 33, 182, .4);
    text-decoration: none;
}

.btn-landing-secondary {
    background: #fff;
    color: var(--primary-dark);
    border: 2px solid var(--primary-mid);
}

.btn-landing-secondary:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    text-decoration: none;
}

@media (max-width: 767.98px) {
    .rssf-banner {
        padding: 16px 16px 0;
    }

    .rssf-landing-actions {
        padding: 16px 16px 4px;
    }

    .btn-landing-primary,
    .btn-landing-secondary {
        flex: 1 1 100%;
        max-width: none;
        font-size: 17px;
    }
}

/* ============================================================
   Landing Hero
   ============================================================ */
.rssf-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 72px 24px;
    text-align: center;
    color: #fff;
}

.rssf-hero .hero-badge {
    display: inline-block;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: rgba(255,255,255,.9);
    border-radius: 20px;
    padding: 4px 16px;
    font-size: 14px;
    margin-bottom: 16px;
}

.rssf-hero h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #fff;
}

.rssf-hero .hero-sub {
    font-size: 16px;
    color: rgba(255,255,255,.8);
    margin-bottom: 28px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.rssf-hero .hero-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-hero-primary {
    background: #fff;
    color: var(--primary);
    border: none;
    padding: 10px 28px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: opacity .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-hero-primary:hover {
    opacity: .9;
    color: var(--primary-dark);
    text-decoration: none;
}

.btn-hero-outline {
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    padding: 10px 28px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-hero-outline:hover {
    background: rgba(255,255,255,.2);
    color: #fff;
    text-decoration: none;
}

/* ============================================================
   Landing Info Cards
   ============================================================ */
.rssf-info-section {
    background: #fff;
    padding: 48px 24px;
}

.info-card {
    text-align: center;
    padding: 28px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    transition: box-shadow .15s;
}

.info-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.info-card .info-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.info-card h5 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 8px;
}

.info-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

/* ============================================================
   Landing Footer
   ============================================================ */
.rssf-landing-footer {
    background: var(--bg-page);
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================================
   Login Card
   ============================================================ */
.rssf-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, #f0f9ff 100%);
    padding: 24px;
}

.rssf-login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(37,99,235,.12);
    border: 1px solid var(--primary-mid);
}

.rssf-login-card .login-logo {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary);
    margin: 0 auto 14px;
}

.rssf-login-card .login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-heading);
    text-align: center;
    margin-bottom: 4px;
}

.rssf-login-card .login-sub {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 28px;
}

/* ============================================================
   Step Indicator
   ============================================================ */
.rssf-stepper {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    position: relative;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
    height: 2px;
    background: var(--border);
}

.step-item.done:not(:last-child)::after,
.step-item.active:not(:last-child)::after {
    background: var(--primary);
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.step-item.active .step-circle {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-item.done .step-circle {
    background: var(--success);
    color: #fff;
}

.step-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.step-item.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.step-item.done .step-label {
    color: var(--success);
}

/* ============================================================
   Progress Bars (Dashboard)
   ============================================================ */
.rssf-progress-list .progress-item {
    margin-bottom: 14px;
}

.rssf-progress-list .progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-body);
    margin-bottom: 5px;
}

.rssf-progress-list .progress-label span:last-child {
    font-weight: 600;
    color: var(--text-heading);
}

.rssf-progress-list .progress {
    height: 8px;
    border-radius: 4px;
    background: var(--border);
}

.rssf-progress-list .progress-bar {
    border-radius: 4px;
    transition: width .4s ease;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

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

/* ============================================================
   Form Helpers (keep existing)
   ============================================================ */
.not-set {
    color: #c55;
    font-style: italic;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: #999;
}

.error-summary {
    color: #a94442;
    background: #fff8c6;
    border: 2px solid yellow;
    padding: 10px 20px;
    margin: 0 0 15px 0;
}

.has-error .error-summary {
    border: 2px solid yellow;
    padding: 10px;
    background-color: #fff8c6;
}

.form-controlx {
    display: block;
    width: 100%;
    height: calc(2.25rem + 2px);
    padding-top: unset;
    padding-bottom: unset;
    padding-right: unset;
    padding-left: unset;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    box-shadow: inset 0 0 0 transparent;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

/* Kartik field range */
.kv-form-horizontal .kv-field-range {
    padding: 0 0.375rem;
}

/* ============================================================
   Form Sections (applicant form)
   ============================================================ */
.form-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--primary-light);
    border-bottom: 2px solid var(--primary-mid);
}

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

.form-section-header .section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-dark);
}

.form-section-body {
    padding: 24px;
}

.form-subsection {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.form-subsection:last-child {
    margin-bottom: 0;
}

.subsection-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.compare-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.compare-col {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.compare-col .compare-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compare-col .compare-label .badge-before {
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.compare-col .compare-label .badge-after {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.form-notice {
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #78350f;
    margin-bottom: 16px;
}

.form-note {
    font-size: 13px;
    color: var(--danger);
    font-weight: 600;
    margin-top: 4px;
}

/* ============================================================
   Utilities
   ============================================================ */
.text-primary-rssf { color: var(--primary) !important; }
.bg-primary-rssf   { background: var(--primary) !important; }

/* ============================================================
   View Detail Fields
   ============================================================ */
.view-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px 20px;
    margin-bottom: 12px;
}

.view-field .view-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 2px;
}

.view-field .view-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-heading);
    word-break: break-word;
}

.view-field .view-value.full {
    font-weight: 400;
    color: var(--text-body);
    line-height: 1.6;
}

.view-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    font-size: 13px;
    margin-bottom: 6px;
}

.view-row .vr-label {
    color: var(--text-muted);
    min-width: 140px;
}

.view-row .vr-val {
    font-weight: 600;
    color: var(--text-heading);
}

.view-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.view-submitted-banner {
    background: var(--warning-light);
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #78350f;
}

/* ============================================================
   Guest Applicant View
   ============================================================ */
.guest-view-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 20px 32px;
}

.guest-status-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5986 100%);
    color: #fff;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 22px;
    box-shadow: 0 4px 20px rgba(30,58,95,.22);
}

.gsc-icon {
    color: rgba(255,255,255,.55);
    flex-shrink: 0;
}

.gsc-body {
    flex: 1;
    min-width: 0;
}

.gsc-org {
    font-size: 11px;
    color: rgba(255,255,255,.65);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}

.gsc-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    word-break: break-word;
}

.gsc-ref {
    font-size: 12px;
    color: rgba(255,255,255,.75);
}

.gsc-status-col {
    text-align: center;
    flex-shrink: 0;
}

.gsc-status-label {
    font-size: 11px;
    color: rgba(255,255,255,.65);
    margin-bottom: 6px;
}

.gsc-badge {
    font-size: 13px !important;
    padding: 6px 16px !important;
}

.gsc-hint {
    font-size: 11px;
    color: rgba(255,255,255,.6);
    margin-top: 6px;
}

/* ============================================================
   Condition Selector (2.2 สภาพความพิการ)
   ============================================================ */
.cond-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cond-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
    font-size: 13.5px;
    color: var(--text-body);
    line-height: 1.4;
    user-select: none;
    width: 100%;
}

.cond-card:hover {
    border-color: var(--primary-mid);
    background: var(--primary-light);
}

.cond-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 26px;
    text-align: center;
}

/* Severe — red */
.cond-card.cond-severe  .cond-icon  { color: var(--danger); }
.btn-check:checked + .cond-card.cond-severe {
    border-color: var(--danger);
    background: var(--danger-light);
    color: #991b1b;
    font-weight: 600;
}

/* Moderate — amber */
.cond-card.cond-moderate .cond-icon { color: var(--warning); }
.btn-check:checked + .cond-card.cond-moderate {
    border-color: var(--warning);
    background: var(--warning-light);
    color: #92400e;
    font-weight: 600;
}

/* Mild — green */
.cond-card.cond-mild .cond-icon     { color: var(--success); }
.btn-check:checked + .cond-card.cond-mild {
    border-color: var(--success);
    background: var(--success-light);
    color: #065f46;
    font-weight: 600;
}

/* Duration inputs (2.3 ระยะเวลา) */
.duration-wrap {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.duration-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.duration-input {
    width: 88px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
}

.duration-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-body);
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .cond-selector {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Compact Mode — tighten global spacing
   ============================================================ */

/* Variables — DEPRECATED Compact Mode tokens (superseded by FOUNDATION) */
:root {
    --topbar-h:  44px;
    --sidebar-w: 200px;
}

/* Topbar */
.rssf-topbar { height: var(--topbar-h); padding: 0 16px; }
.rssf-topbar .topbar-logo { font-size: 14px; }
.rssf-topbar .topbar-logo i { font-size: 17px; }
.rssf-topbar .topbar-badge { font-size: 12px; padding: 2px 8px; }
.rssf-topbar .topbar-user { font-size: 13px; padding: 3px 8px; }
.rssf-topbar .topbar-avatar { width: 26px; height: 26px; font-size: 11px; }

/* Sidebar */
.rssf-sidebar { padding: 10px 0 16px; }
.rssf-sidebar .sidebar-label { font-size: 10px; padding: 4px 8px 2px; }
.rssf-sidebar .nav-link { padding: 6px 8px; font-size: 13px; gap: 7px; }
.rssf-sidebar .nav-link i { font-size: 13px; }
.rssf-sidebar .sidebar-divider { margin: 6px 12px; }
.rssf-sidebar .sidebar-section { padding: 0 8px; margin-bottom: 2px; }

/* Main content */
.rssf-main { padding: 16px; }

/* Page header */
.rssf-page-header { margin-bottom: 12px; }
.rssf-page-header .page-title { font-size: 18px; }
.rssf-page-header .breadcrumb { font-size: 12px; }

/* Cards */
.rssf-card { padding: 14px; border-radius: 10px; }

/* Stat cards */
.stat-card { padding: 12px 14px; gap: 12px; border-radius: 10px; }
.stat-icon { width: 38px; height: 38px; font-size: 16px; border-radius: 9px; }
.stat-info .stat-label { font-size: 12px; }
.stat-info .stat-value { font-size: 22px; }

/* Filter tabs */
.filter-tabs { padding: 3px; }
.filter-tab { padding: 4px 11px; font-size: 12px; }
.filter-tab .tab-count { font-size: 10px; }

/* Table */
.rssf-table thead th { padding: 8px 12px; font-size: 11px; }
.rssf-table td { padding: 9px 12px; font-size: 13px; }

/* Dashboard progress */
.rssf-progress-list .progress-item { margin-bottom: 10px; }
.rssf-progress-list .progress-label { font-size: 12px; margin-bottom: 3px; }
.rssf-progress-list .progress { height: 6px; }

/* Hero */
.rssf-hero { padding: 48px 24px; }
.rssf-hero h1 { font-size: 24px; margin-bottom: 8px; }
.rssf-hero .hero-badge { font-size: 12px; margin-bottom: 10px; }
.rssf-hero .hero-sub { font-size: 14px; margin-bottom: 20px; }

/* Info section */
.rssf-info-section { padding: 28px 24px; }
.info-card { padding: 18px 16px; border-radius: 10px; }
.info-card .info-icon { width: 44px; height: 44px; font-size: 18px; margin-bottom: 10px; }
.info-card h5 { font-size: 14px; margin-bottom: 6px; }
.info-card p { font-size: 13px; }

/* Stepper */
.rssf-stepper { margin-bottom: 16px; }
.step-circle { width: 26px; height: 26px; font-size: 11px; margin-bottom: 4px; }
.step-item:not(:last-child)::after { top: 13px; }
.step-item.active .step-circle { box-shadow: 0 0 0 3px var(--primary-light); }
.step-label { font-size: 10px; }

/* Form sections */
.form-section { margin-bottom: 12px; border-radius: 10px; }
.form-section-header { padding: 10px 16px; gap: 10px; }
.form-section-header .section-number { width: 24px; height: 24px; font-size: 11px; }
.form-section-header .section-title { font-size: 13px; }
.form-section-body { padding: 14px 16px; }

.form-subsection { padding: 10px 14px; margin-bottom: 10px; border-radius: 7px; }
.subsection-title { font-size: 12px; margin-bottom: 8px; padding-bottom: 6px; }

.compare-cols { gap: 10px; margin-bottom: 10px; }
.compare-col { padding: 12px; border-radius: 7px; }
.compare-col .compare-label { font-size: 12px; margin-bottom: 8px; }
.compare-col .compare-label .badge-before,
.compare-col .compare-label .badge-after { font-size: 10px; padding: 1px 6px; }

.form-notice { padding: 8px 12px; font-size: 12px; margin-bottom: 10px; border-radius: 7px; }
.form-note { font-size: 11px; }

/* Login */
.rssf-login-card { padding: 28px 28px; border-radius: 12px; }
.rssf-login-card .login-logo { width: 44px; height: 44px; font-size: 18px; margin-bottom: 10px; }
.rssf-login-card .login-title { font-size: 17px; }
.rssf-login-card .login-sub { font-size: 12px; margin-bottom: 20px; }

/* Global: tighter form labels and inputs */
.form-label { font-size: 13px; margin-bottom: 3px; }
.form-control { font-size: 13px; padding: 5px 10px; }
.form-control-sm { font-size: 12px; }
.btn-lg { font-size: 14px; padding: 8px 24px; }
.mb-4 { margin-bottom: 12px !important; }
.mb-3 { margin-bottom: 8px !important; }
.g-3 > * { --bs-gutter-y: 0.5rem; }
.g-3 { --bs-gutter-x: 0.5rem; --bs-gutter-y: 0.5rem; }

/* ============================================================
   Form Enhancement — Beautiful Form v2
   ============================================================ */

/* Section card — stronger shadow + blue tint border */
.form-section {
    box-shadow: 0 4px 16px rgba(37,99,235,.08), 0 1px 4px rgba(0,0,0,.05) !important;
    border-color: rgba(37,99,235,.2) !important;
}

/* Section header — gradient + left accent stripe */
.form-section-header {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border-left: 5px solid var(--primary) !important;
    border-bottom: 1px solid var(--primary-mid) !important;
}

.form-section-header .section-number {
    box-shadow: 0 3px 8px rgba(37,99,235,.4) !important;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

/* Subsection — left accent, light blue tint */
.form-subsection {
    border-left: 3px solid var(--primary-mid) !important;
    border-radius: 0 8px 8px 0 !important;
    background: #fafbff !important;
}

.subsection-title {
    color: var(--primary-dark) !important;
    border-bottom-color: var(--primary-mid) !important;
}

.subsection-title i {
    color: var(--primary) !important;
}

/* Compare col — amber (1st = before) */
.compare-cols > .compare-col:first-child {
    border-left: 4px solid #f59e0b !important;
    border-color: #fde68a !important;
    background: linear-gradient(160deg, #fffdf5 0%, #fffbeb 100%) !important;
}

/* Compare col — blue (2nd = after / requested) */
.compare-cols > .compare-col:last-child {
    border-left: 4px solid var(--primary) !important;
    border-color: var(--primary-mid) !important;
    background: linear-gradient(160deg, #f8faff 0%, #eff6ff 100%) !important;
}

/* Compare-col header label */
.compare-col .compare-label {
    font-weight: 700 !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(0,0,0,.07) !important;
    margin-bottom: 12px !important;
}

/* Form notice — left-stripe only (warning) */
.form-notice {
    border-left-width: 4px !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 4px !important;
    padding-left: 14px !important;
    background: linear-gradient(90deg, #fef9c3 0%, #fefce8 100%) !important;
}

/* Danger notice (applicant_panel) */
#applicant_panel .form-notice {
    border-left-color: var(--danger) !important;
    background: linear-gradient(90deg, #fef2f2 0%, #fff5f5 100%) !important;
}

/* Input focus ring — primary color */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12) !important;
}

.form-control {
    border-color: #d1d5db;
    transition: border-color .15s, box-shadow .15s;
}

/* Radio / checkbox — primary accent */
.form-check-input:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.form-check-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15) !important;
}

/* Stepper — wrap in a card */
.rssf-stepper {
    background: #fff !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    padding: 14px 24px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.05) !important;
}

/* Sticky submit action bar */
.form-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(37,99,235,.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    margin: 0 -1px;
    border-radius: 0 0 12px 12px;
}

/* ============================================================
   Applicant Registration Page
   ============================================================ */
.applicant-registration-page {
    --registration-accent: #0f766e;
    --registration-accent-soft: #ccfbf1;
    --registration-ink: #0f172a;
    max-width: 1180px;
    margin: 0 auto;
}

.registration-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 18px;
}

.registration-hero-content,
.registration-summary,
.registration-progress-panel {
    border: 1px solid rgba(15, 118, 110, .18);
    background: #fff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .08);
}

.registration-hero-content {
    display: flex;
    gap: 18px;
    min-height: 190px;
    border-radius: 18px;
    padding: 28px;
    overflow: hidden;
    position: relative;
    background:
        linear-gradient(135deg, rgba(239, 246, 255, .95) 0%, rgba(240, 253, 250, .96) 58%, #fff 100%);
}

.registration-hero-content::after {
    content: '';
    position: absolute;
    inset: auto -80px -110px auto;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: rgba(15, 118, 110, .08);
}

.registration-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--registration-accent) 100%);
    box-shadow: 0 12px 24px rgba(15, 118, 110, .24);
    font-size: 24px;
}

.registration-hero h1 {
    margin: 0 0 10px;
    color: var(--registration-ink);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.registration-hero p {
    max-width: 740px;
    margin: 0;
    color: #475569;
    font-size: 16px;
    line-height: 1.75;
}

.registration-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.registration-meta span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid rgba(37, 99, 235, .16);
    border-radius: 999px;
    color: #1e40af;
    background: rgba(239, 246, 255, .82);
    font-size: 13px;
    font-weight: 700;
}

.registration-meta i {
    color: var(--registration-accent);
}

.registration-summary {
    border-radius: 18px;
    padding: 22px;
}

.registration-summary .summary-title {
    color: var(--registration-ink);
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 14px;
}

.summary-item {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 10px;
    align-items: start;
    padding: 12px 0;
    border-top: 1px solid #e2e8f0;
}

.summary-item strong {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--registration-accent);
    background: var(--registration-accent-soft);
    font-size: 14px;
}

.summary-item span {
    color: #475569;
    font-size: 14px;
    line-height: 1.55;
}

.registration-progress-panel {
    border-radius: 16px;
    padding: 18px 22px 20px;
    margin-bottom: 18px;
}

.progress-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.progress-panel-head h2 {
    margin: 0 0 4px;
    color: var(--registration-ink);
    font-size: 20px;
    font-weight: 800;
}

.progress-panel-head p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

.progress-status {
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 800;
}

.applicant-registration-page .rssf-stepper {
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 12px !important;
    border-color: #dbeafe !important;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%) !important;
    padding: 16px 20px !important;
}

.applicant-registration-page .applicant-information-form {
    background: #fff;
    border: 1px solid rgba(37, 99, 235, .16);
    border-radius: 18px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.applicant-registration-page .applicant-information-form form {
    margin: 0;
}

.applicant-registration-page .form-section {
    margin: 18px;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(37, 99, 235, .08), 0 1px 4px rgba(15, 23, 42, .05) !important;
}

.applicant-registration-page .form-section-header {
    padding: 16px 20px;
    border-left-width: 6px !important;
}

.applicant-registration-page .form-section-header .section-number {
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.applicant-registration-page .form-section-header .section-title {
    font-size: 17px;
    line-height: 1.35;
}

.applicant-registration-page .form-section-body {
    padding: 22px;
}

.applicant-registration-page .form-subsection,
.applicant-registration-page .compare-col {
    border-radius: 12px !important;
}

.applicant-registration-page .form-subsection {
    padding: 18px;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
}

.applicant-registration-page .subsection-title {
    font-size: 15px;
    margin-bottom: 14px;
}

.applicant-registration-page .form-label,
.applicant-registration-page label.control-label {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.applicant-registration-page .form-control,
.applicant-registration-page .form-select,
.applicant-registration-page .select2-container--krajee-bs5 .select2-selection {
    min-height: 40px;
    border-radius: 10px;
    border-color: #cbd5e1;
    color: #1e293b;
    background-color: #fff;
}

.applicant-registration-page textarea.form-control {
    min-height: 110px;
}

.applicant-registration-page .form-control::placeholder {
    color: #94a3b8;
}

.applicant-registration-page .form-check {
    margin-bottom: 6px;
}

.applicant-registration-page .form-check-label {
    color: #475569;
    font-size: 14px;
}

.applicant-registration-page .file-input,
.applicant-registration-page .file-preview {
    border-radius: 12px;
}

.applicant-registration-page .osm-map-shell {
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}

.applicant-registration-page .osm-map-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.applicant-registration-page .osm-search-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.applicant-registration-page .osm-search-wrap i {
    position: absolute;
    top: 50%;
    left: 12px;
    z-index: 2;
    color: #64748b;
    transform: translateY(-50%);
}

.applicant-registration-page .osm-search-wrap .form-control {
    padding-left: 36px;
}

.applicant-registration-page .osm-residence-map {
    width: 100%;
    height: 420px;
    background: #e2e8f0;
}

.applicant-registration-page .osm-map-hint {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    background: #f8fafc;
    font-size: 13px;
    line-height: 1.5;
}

.applicant-registration-page .osm-map-hint i {
    color: #0f766e;
    margin-top: 2px;
}

.applicant-registration-page .form-action-bar {
    border-radius: 0;
    padding: 16px 24px;
}

.applicant-registration-page .form-action-bar .btn {
    border-radius: 12px;
    font-weight: 800;
}

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

    .registration-hero-content {
        min-height: auto;
    }

    .registration-summary {
        padding: 18px;
    }

    .progress-panel-head {
        flex-direction: column;
    }

    .progress-status {
        white-space: normal;
    }
}

@media (max-width: 767.98px) {
    .rssf-main {
        padding: 12px;
    }

    .rssf-topbar {
        padding: 0 10px;
        gap: 8px;
    }

    .rssf-topbar .topbar-logo span {
        display: none;
    }

    .rssf-topbar .topbar-logo-img {
        width: 72px;
        height: 28px;
    }

    .rssf-topbar .btn-sm {
        width: 34px;
        height: 30px;
        flex: 0 0 34px;
        padding: 0;
        font-size: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .rssf-topbar .btn-sm i {
        margin: 0 !important;
        font-size: 13px;
    }

    .registration-hero-content {
        flex-direction: column;
        padding: 22px;
        border-radius: 14px;
    }

    .registration-hero h1 {
        font-size: 24px;
    }

    .registration-hero p {
        font-size: 15px;
    }

    .registration-progress-panel,
    .applicant-registration-page .applicant-information-form {
        border-radius: 14px;
    }

    .applicant-registration-page .osm-map-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .applicant-registration-page .osm-residence-map {
        height: 340px;
    }

    .applicant-registration-page .rssf-stepper {
        align-items: flex-start;
        gap: 12px;
        padding: 14px !important;
    }

    .applicant-registration-page .step-item {
        flex: 0 0 88px;
    }

    .applicant-registration-page .step-label {
        white-space: normal;
        line-height: 1.25;
    }

    .applicant-registration-page .form-section {
        margin: 12px;
    }

    .applicant-registration-page .form-section-header,
    .applicant-registration-page .form-section-body,
    .applicant-registration-page .form-subsection {
        padding: 14px;
    }

    .applicant-registration-page .form-action-bar {
        position: static;
        flex-direction: column;
    }

    .applicant-registration-page .form-action-bar .btn {
        width: 100%;
    }
}

/* ============================================================
   Purple White Theme — DEPRECATED (superseded by FOUNDATION :root)
   ============================================================ */
:root {
    --primary:        #7c3aed;
    --primary-dark:   #5b21b6;
    --primary-light:  #f5f3ff;
    --primary-mid:    #ddd6fe;
    --bg-page:        #fbfaff;
}

.rssf-topbar {
    background: #fff;
    border-bottom-color: #ede9fe;
    box-shadow: 0 6px 22px rgba(91, 33, 182, .06);
}

.rssf-topbar .topbar-logo,
.rssf-topbar .topbar-logo:hover {
    color: var(--primary-dark);
}

.rssf-breadcrumb {
    border-color: rgba(124, 58, 237, .18);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 8px 22px rgba(91, 33, 182, .08);
}

.rssf-breadcrumb a {
    color: var(--primary);
}

.rssf-breadcrumb a:hover {
    color: var(--primary-dark);
}

.rssf-breadcrumb .breadcrumb-item:first-child a {
    color: var(--primary-dark);
    background: var(--primary-light);
}

.applicant-registration-page {
    --registration-accent: #7c3aed;
    --registration-accent-soft: #ede9fe;
    --registration-ink: #27114f;
}

.registration-hero-content,
.registration-summary,
.registration-progress-panel {
    border-color: rgba(124, 58, 237, .18);
    box-shadow: 0 14px 36px rgba(91, 33, 182, .08);
}

.registration-hero-content {
    background:
        linear-gradient(135deg, rgba(250, 245, 255, .96) 0%, rgba(245, 243, 255, .94) 58%, #fff 100%);
}

.registration-hero-content::after {
    background: rgba(124, 58, 237, .08);
}

.registration-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #5b21b6 100%);
    box-shadow: 0 12px 24px rgba(91, 33, 182, .24);
}

.registration-meta span,
.progress-status {
    border-color: #ddd6fe;
    color: var(--primary-dark);
    background: var(--primary-light);
}

.registration-meta i,
.applicant-registration-page .osm-map-hint i {
    color: var(--registration-accent);
}

.applicant-registration-page .rssf-stepper {
    border-color: #ddd6fe !important;
    background: linear-gradient(180deg, #fff 0%, #fbfaff 100%) !important;
}

.applicant-registration-page .applicant-information-form,
.applicant-registration-page .form-section {
    border-color: rgba(124, 58, 237, .18) !important;
    box-shadow: 0 12px 30px rgba(91, 33, 182, .08), 0 1px 4px rgba(15, 23, 42, .05) !important;
}

.applicant-registration-page .form-section-header {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%) !important;
    border-left-color: var(--primary) !important;
    border-bottom-color: #ddd6fe !important;
}

.applicant-registration-page .form-section-header .section-number,
.form-section-header .section-number,
.step-item.active .step-circle {
    background: linear-gradient(135deg, #8b5cf6 0%, #5b21b6 100%) !important;
    box-shadow: 0 4px 12px rgba(91, 33, 182, .28) !important;
}

.applicant-registration-page .form-section-header .section-title,
.applicant-registration-page .subsection-title,
.subsection-title {
    color: var(--primary-dark) !important;
}

.applicant-registration-page .form-subsection {
    border-left-color: #ddd6fe !important;
    background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%) !important;
}

.applicant-registration-page .form-control:focus,
.applicant-registration-page .form-select:focus,
.applicant-registration-page .select2-container--krajee-bs5.select2-container--focus .select2-selection {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .14) !important;
}

.applicant-registration-page .osm-map-shell {
    border-color: #ddd6fe;
}

.applicant-registration-page .osm-map-toolbar,
.applicant-registration-page .osm-map-hint {
    background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%);
    border-color: #ede9fe;
}

.form-action-bar {
    box-shadow: 0 -4px 20px rgba(91, 33, 182, .1);
}

/* ============================================================
   Site/index Redesign — Split Hero + Stats Strip
   ============================================================ */

/* Hero grid override */
.rssf-hero {
    padding: 56px 32px;
    text-align: left;
}

.rssf-hero .hero-inner {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 100%;
}

.rssf-hero::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(124, 58, 237, .25);
    pointer-events: none;
}

.rssf-hero::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: 20%;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(37, 99, 235, .18);
    pointer-events: none;
}

/* Hero badge override */
.rssf-hero .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    color: rgba(255, 255, 255, .9);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 18px;
}

/* Hero h1 override */
.rssf-hero h1 {
    font-size: 34px;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 14px;
}

/* Hero sub override */
.rssf-hero .hero-sub {
    font-size: 15px;
    color: rgba(255, 255, 255, .78);
    line-height: 1.7;
    margin-bottom: 28px;
    max-width: 480px;
    margin-left: 0;
    margin-right: 0;
}

/* Hero CTA override */
.rssf-hero .hero-cta {
    justify-content: flex-start;
}

/* Primary CTA button override */
.btn-hero-primary {
    background: #fff;
    color: #5b21b6;
    border: none;
    padding: 11px 28px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    transition: opacity .15s;
}

.btn-hero-primary:hover {
    opacity: .92;
    color: #5b21b6;
    text-decoration: none;
}

/* Outline CTA button override */
.btn-hero-outline {
    background: rgba(255, 255, 255, .1);
    border: 1.5px solid rgba(255, 255, 255, .35);
    color: #fff;
    padding: 11px 24px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .15s;
}

.btn-hero-outline:hover {
    background: rgba(255, 255, 255, .2);
    color: #fff;
    text-decoration: none;
}

/* ---- Illustration ---- */
.hero-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.illus-circle-outer {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    border: 1.5px solid rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.illus-circle-inner {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .09);
    border: 1.5px solid rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.illus-icon {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    box-shadow: 0 16px 40px rgba(91, 33, 182, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 36px;
}

.illus-badge {
    position: absolute;
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #1e1b4b;
    white-space: nowrap;
}

.illus-badge.b1 { top: 10px;    right: -16px; }
.illus-badge.b2 { bottom: 14px; left:  -16px; }

/* ---- Stats Strip ---- */
.rssf-stats-strip {
    background: #fff;
    border-bottom: 1px solid #ede9fe;
    padding: 0 32px;
}

.rssf-stats-strip .stats-inner {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.rssf-stats-strip .stat-item {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-right: 1px solid #f0eaff;
}

.rssf-stats-strip .stat-item:last-child {
    border-right: none;
}

.rssf-stats-strip .stat-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.rssf-stats-strip .stat-icon-box.purple { background: #f5f3ff; color: #7c3aed; }
.rssf-stats-strip .stat-icon-box.green  { background: #f0fdf4; color: #16a34a; }
.rssf-stats-strip .stat-icon-box.blue   { background: #eff6ff; color: #2563eb; }

.rssf-stats-strip .stat-num {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.rssf-stats-strip .stat-num.purple { color: #5b21b6; }
.rssf-stats-strip .stat-num.green  { color: #15803d; }
.rssf-stats-strip .stat-num.blue   { color: #1d4ed8; }

.rssf-stats-strip .stat-desc {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

/* ---- Info Cards (redesigned) ---- */
.rssf-info-section {
    padding: 48px 32px;
    background: #fbfaff;
}

.rssf-info-section .cards-grid {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.rssf-info-section .info-card {
    background: #fff;
    border: 1px solid #ede9fe;
    border-radius: 16px;
    padding: 28px 22px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(91, 33, 182, .06);
    position: relative;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}

.rssf-info-section .info-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #7c3aed, #2563eb);
    border-radius: 16px 16px 0 0;
}

.rssf-info-section .info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(91, 33, 182, .12);
}

.rssf-info-section .info-card .info-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #7c3aed;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .15);
}

.rssf-info-section .info-card h5 {
    font-size: 16px;
    font-weight: 800;
    color: #1e1b4b;
    margin-bottom: 8px;
}

.rssf-info-section .info-card p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.65;
    margin: 0;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #7c3aed;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    margin-top: 14px;
}

.card-link:hover {
    color: #5b21b6;
    text-decoration: none;
}

/* ---- About / เอกสารประกอบ (merged into index) ---- */
.rssf-about-section {
    padding: 40px 32px 48px;
    background: #fff;
    border-top: 1px solid #ede9fe;
}

.rssf-about-section .about-section-inner {
    max-width: 960px;
    margin: 0 auto;
}

.rssf-about-section .about-section-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e1b4b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rssf-about-section .about-section-title i {
    color: #7c3aed;
}

.rssf-about-section .about-card {
    background: #fbfaff;
    border: 1px solid #ede9fe;
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 20px;
}

.rssf-about-section .about-doc-list,
.rssf-about-section .about-notes-list {
    margin: 0;
    padding-left: 1.4rem;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-body);
}

.rssf-about-section .about-doc-list li,
.rssf-about-section .about-notes-list li {
    margin-bottom: 10px;
}

.rssf-about-section .about-doc-list li:last-child,
.rssf-about-section .about-notes-list li:last-child {
    margin-bottom: 0;
}

.rssf-about-section .about-notes-title {
    font-size: 18px;
    font-weight: 800;
    color: #1e1b4b;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rssf-about-section .about-notes-title i {
    color: var(--primary);
}

.rssf-about-section .about-notes-list ul {
    margin: 8px 0 0;
    padding-left: 1.2rem;
}

@media (max-width: 767.98px) {
    .rssf-about-section {
        padding: 28px 16px 36px;
    }

    .rssf-about-section .about-card {
        padding: 18px 16px;
    }

    .rssf-about-section .about-doc-list,
    .rssf-about-section .about-notes-list {
        font-size: 15px;
    }
}

/* ---- Landing Footer (dark) ---- */
.rssf-landing-footer {
    background: #1e1b4b;
    border-top: none;
    padding: 28px 32px;
    color: rgba(255, 255, 255, .65);
}

.rssf-landing-footer .footer-logo {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ---- Responsive ---- */
@media (max-width: 767.98px) {
    .rssf-hero { padding: 40px 20px; }

    .rssf-hero .hero-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .rssf-hero h1 { font-size: 26px; }

    .rssf-hero .hero-sub { font-size: 14px; }

    .hero-illustration { order: -1; }

    .illus-circle-outer { width: 180px; height: 180px; }
    .illus-circle-inner { width: 130px; height: 130px; }
    .illus-icon         { width: 70px;  height: 70px;  font-size: 28px; }

    .illus-badge.b1 { top: 4px;    right: 10px; }
    .illus-badge.b2 { bottom: 4px; left:  10px; }

    .rssf-stats-strip .stats-inner {
        grid-template-columns: 1fr;
    }

    .rssf-stats-strip .stat-item {
        border-right: none;
        border-bottom: 1px solid #f0eaff;
        padding: 14px 16px;
    }

    .rssf-stats-strip .stat-item:last-child {
        border-bottom: none;
    }

    .rssf-info-section { padding: 32px 16px; }

    .rssf-info-section .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Mobile — View Page (applicant/view, manager/view)
   ============================================================ */
@media (max-width: 767.98px) {

    /* Page header: stack title + buttons vertically */
    .rssf-page-header.d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    .rssf-page-header .page-title {
        font-size: 17px;
        line-height: 1.3;
    }

    /* Action buttons: horizontal scroll strip (no wrap) */
    .view-actions {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding-bottom: 4px;
        margin-bottom: 8px;
        scrollbar-width: none;           /* Firefox */
    }
    .view-actions::-webkit-scrollbar { display: none; } /* Chrome/Safari */
    .view-actions .btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    .view-submitted-banner {
        font-size: 12px;
        padding: 10px 12px;
    }

    /* Guest status card: stack vertically on mobile */
    .guest-view-wrap {
        padding: 12px 12px 24px;
    }
    .guest-status-card {
        flex-direction: column;
        text-align: center;
        gap: 14px;
        padding: 18px 16px;
    }
    .gsc-icon { display: none; }
    .gsc-ref { text-align: center; }

    /* Compare cols: single column */
    .compare-cols {
        grid-template-columns: 1fr !important;
    }

    /* view-group: remove span-2 override (inline style) */
    .view-group .view-field {
        grid-column: span 1 !important;
    }
    /* But full-text fields (.view-value.full) inside span-1 are fine */

    /* Form section body: tighter padding on mobile */
    .form-section-body {
        padding: 10px 12px;
    }
    .form-subsection {
        padding: 8px 10px;
        margin-bottom: 8px;
    }

    /* Section header text: smaller */
    .form-section-header .section-title {
        font-size: 12px;
    }

    /* Map: shorter height on mobile */
    #view-osm-map,
    #mgr-osm-map {
        height: 220px !important;
    }

    /* QR + map stacked: QR row reduce padding */
    .form-section-body.text-center img[alt="QR Code"] {
        width: 150px;
        height: 150px;
    }

    /* vr-label min-width looser on mobile */
    .view-row .vr-label {
        min-width: 100px;
        font-size: 11px;
    }
    .view-row .vr-val {
        font-size: 13px;
    }

    /* view-field labels/values */
    .view-field .view-label {
        font-size: 9px;
        letter-spacing: .4px;
    }
    .view-field .view-value {
        font-size: 13px;
    }

    /* Section 5 คำรับรอง: wrap ข้อความ */
    .form-section-body p {
        font-size: 12px;
        line-height: 1.6;
    }
    .form-section-body ol li {
        font-size: 12px;
    }
}

/* ============================================================
   ▼▼▼ FOUNDATION 2026-05-29 — NEW DESIGN SYSTEM ▼▼▼
   Overrides legacy :root blocks above.
   Reference: docs/superpowers/specs/2026-05-29-full-redesign-bug-fix-design.md §4.1
   ============================================================ */

:root {
  /* — Brand (Purple) — */
  --brand-50:  #f5f3ff;
  --brand-100: #ede9fe;
  --brand-200: #ddd6fe;
  --brand-400: #a78bfa;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --brand-700: #6d28d9;
  --brand-800: #5b21b6;
  --brand-900: #4c1d95;
  --brand-950: #1e1b4b;

  /* — Semantic — */
  --primary:      var(--brand-600);
  --primary-dark: var(--brand-800);
  --primary-light:var(--brand-50);
  --primary-mid:  var(--brand-100);
  --success:      #16a34a; --success-bg:#f0fdf4;
  --warning:      #d97706; --warning-bg:#fffbeb;
  --danger:       #dc2626; --danger-bg: #fef2f2;
  --info:         #0891b2; --info-bg:   #ecfeff;

  /* — Neutrals — */
  --text:        #1e293b;
  --text-heading:#1e293b;
  --text-body:   #475569;
  --text-muted:  #94a3b8;
  --border:      #e2e8f0;
  --border-soft: #f1f5f9;
  --bg-page:     #f8fafc;
  --bg-card:     #ffffff;

  /* — Layout — */
  --topbar-h:    56px;
  --sidebar-w:   240px;
  --bottomnav-h: 60px;
  --container-max: 1280px;

  /* — Spacing (4-based) — */
  --space-1:4px;  --space-2:8px;  --space-3:12px;
  --space-4:16px; --space-5:20px; --space-6:24px;
  --space-8:32px; --space-10:40px; --space-12:48px;

  /* — Radius — */
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-xl:20px;

  /* — Shadow — */
  --shadow-sm:0 1px 2px rgba(15,23,42,.05);
  --shadow:   0 4px 12px rgba(15,23,42,.08);
  --shadow-lg:0 12px 32px rgba(15,23,42,.12);
  --shadow-top:0 -4px 12px rgba(15,23,42,.08);

  /* — Type — */
  --font-base:'Sarabun','TH Sarabun New','thsarabunnew',system-ui,sans-serif;
  --fs-xs:12px; --fs-sm:13px; --fs-base:14px;
  --fs-md:15px; --fs-lg:17px; --fs-xl:20px; --fs-2xl:24px;

  /* — Touch — */
  --tap-min:44px;

  /* — Z-index scale — */
  --z-sidebar: 1030;
  --z-topbar:  1040;
  --z-drawer-overlay: 1050;
  --z-drawer:  1051;
  --z-bottomnav: 1045;
  --z-modal:   1060;
}

/* ============================================================
   FOUNDATION — Drawer (slide-out menu, mobile/tablet)
   ============================================================ */
.rssf-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: var(--z-drawer-overlay);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.rssf-drawer-overlay.open {
  opacity: 1; pointer-events: auto;
}

.rssf-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 280px; max-width: 85vw;
  background: var(--bg-card);
  z-index: var(--z-drawer);
  transform: translateX(-100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
.rssf-drawer.open { transform: translateX(0); }

.rssf-drawer-head {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--topbar-h);
}
.rssf-drawer-head-title {
  font-weight: 700; color: var(--text-heading);
  font-size: var(--fs-md);
}
.rssf-drawer-close {
  background: none; border: 0; width: 40px; height: 40px;
  border-radius: var(--r-md); color: var(--text-muted);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.rssf-drawer-close:hover { background: var(--bg-page); color: var(--text); }

.rssf-drawer-body { padding: var(--space-3) 0; flex: 1; }
.rssf-drawer-section { padding: var(--space-2) 0; }
.rssf-drawer-label {
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px;
}
.rssf-drawer-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  min-height: var(--tap-min);
  color: var(--text-body); text-decoration: none;
  font-size: var(--fs-base); font-weight: 500;
  position: relative;
}
.rssf-drawer-link:hover { background: var(--brand-50); color: var(--brand-700); }
.rssf-drawer-link.active {
  background: var(--brand-50); color: var(--brand-700);
  font-weight: 600;
}
.rssf-drawer-link.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--brand-600); border-radius: 0 3px 3px 0;
}
.rssf-drawer-link i { width: 20px; text-align: center; font-size: 16px; }
.rssf-drawer-link .badge {
  margin-left: auto;
  background: var(--danger); color: #fff;
  padding: 2px 8px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700;
}

/* ============================================================
   FOUNDATION — Bottom Nav (mobile only)
   ============================================================ */
.rssf-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-top);
  z-index: var(--z-bottomnav);
  display: none;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.rssf-bottomnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  color: var(--text-muted); text-decoration: none;
  font-size: var(--fs-xs); font-weight: 500;
  min-height: var(--tap-min);
  position: relative;
  background: none; border: 0;
  padding: 6px 4px;
}
.rssf-bottomnav-item:hover { color: var(--brand-700); }
.rssf-bottomnav-item.active { color: var(--brand-700); }
.rssf-bottomnav-item.active::before {
  content: ''; position: absolute; top: 0; left: 25%; right: 25%;
  height: 3px; background: var(--brand-600);
  border-radius: 0 0 3px 3px;
}
.rssf-bottomnav-item i {
  font-size: 18px; line-height: 1;
}
.rssf-bottomnav-badge {
  position: absolute; top: 6px; right: calc(50% - 16px);
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  min-width: 16px; text-align: center;
}

/* ============================================================
   FOUNDATION — Topbar hamburger
   ============================================================ */
.rssf-topbar-hamburger {
  display: none;
  background: none; border: 0;
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  color: var(--text);
  align-items: center; justify-content: center;
  cursor: pointer;
}
.rssf-topbar-hamburger:hover { background: var(--bg-page); }
.rssf-topbar-hamburger i { font-size: 18px; }

/* ============================================================
   FOUNDATION — Responsive layout shell
   ============================================================ */

/* Tablet + Mobile — show hamburger, hide sidebar, allow drawer */
@media (max-width: 991.98px) {
  .rssf-topbar-hamburger { display: inline-flex; }
  .rssf-sidebar { display: none !important; }
  .rssf-main, .rssf-content {
    margin-left: 0 !important;
  }
}

/* Mobile — show bottom nav, give content bottom padding */
@media (max-width: 767.98px) {
  :root { --topbar-h: 52px; }
  .rssf-bottomnav { display: flex; }
  .rssf-main, .rssf-content {
    padding-bottom: calc(var(--bottomnav-h) + 16px + env(safe-area-inset-bottom, 0)) !important;
  }
}

/* Desktop — hide drawer + bottom-nav, sidebar persistent */
@media (min-width: 992px) {
  .rssf-drawer, .rssf-drawer-overlay, .rssf-bottomnav {
    display: none !important;
  }
}

/* ============================================================
   FOUNDATION — Reusable Components
   ============================================================ */

/* — Page wrapper — */
.rssf-page {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
}
@media (max-width: 767.98px) {
  .rssf-page { padding: var(--space-4) var(--space-3); }
}

.rssf-page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.rssf-page-title {
  font-size: var(--fs-2xl); font-weight: 700;
  color: var(--text-heading); margin: 0;
  line-height: 1.3;
}
.rssf-page-subtitle {
  font-size: var(--fs-sm); color: var(--text-muted);
  margin: 4px 0 0;
}
.rssf-page-actions {
  display: flex; gap: var(--space-2); align-items: center;
  flex-wrap: wrap;
}

/* — Card — */
.rssf-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.rssf-card + .rssf-card { margin-top: var(--space-4); }
.rssf-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
}
.rssf-card-title {
  font-size: var(--fs-lg); font-weight: 700;
  color: var(--text-heading); margin: 0;
}

/* — Stat card (dashboard) — */
.rssf-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: var(--space-4);
}
.rssf-stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--brand-100); color: var(--brand-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.rssf-stat-icon--success { background: var(--success-bg); color: var(--success); }
.rssf-stat-icon--warning { background: var(--warning-bg); color: var(--warning); }
.rssf-stat-icon--info    { background: var(--info-bg);    color: var(--info); }
.rssf-stat-icon--danger  { background: var(--danger-bg);  color: var(--danger); }
.rssf-stat-body { min-width: 0; flex: 1; }
.rssf-stat-label {
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .3px; margin: 0;
}
.rssf-stat-value {
  font-size: var(--fs-2xl); font-weight: 700;
  color: var(--text-heading); margin: 2px 0 0;
  line-height: 1.1;
}

/* — Mobile list card (replaces table) — */
.rssf-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  display: block; text-decoration: none; color: inherit;
}
.rssf-list-card:hover { box-shadow: var(--shadow); }
.rssf-list-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); margin-bottom: var(--space-2);
}
.rssf-list-card-ref {
  font-size: var(--fs-xs); color: var(--text-muted);
}
.rssf-list-card-title {
  font-size: var(--fs-md); font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 var(--space-1);
}
.rssf-list-card-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  font-size: var(--fs-sm); color: var(--text-body);
  margin-top: var(--space-2);
}
.rssf-list-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.rssf-list-card-actions {
  display: flex; gap: var(--space-2);
  margin-top: var(--space-3); padding-top: var(--space-3);
  border-top: 1px solid var(--border-soft);
}
.rssf-list-card-actions .btn { flex: 1; min-height: var(--tap-min); }

/* — Status badge — */
.rssf-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-md);
  font-size: var(--fs-xs); font-weight: 600;
  white-space: nowrap; line-height: 1.4;
}
.rssf-status-badge i { font-size: 10px; }
.rssf-status-badge--applied  { background: var(--brand-50);   color: var(--brand-700); }
.rssf-status-badge--received { background: var(--info-bg);    color: var(--info); }
.rssf-status-badge--reviewing{ background: var(--warning-bg); color: var(--warning); }
.rssf-status-badge--closed   { background: var(--success-bg); color: var(--success); }
.rssf-status-badge--rejected { background: var(--danger-bg);  color: var(--danger); }

/* ยื่นแบบคำขอแล้ว */
.rssf-status-badge--pending {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

/* อยู่ระหว่างการตรวจสอบเอกสาร */
.rssf-status-badge--review {
    background: #fef3c7;
    color: #b45309;
    border-color: #fcd34d;
}

/* ขอเอกสารเพิ่มเติม */
.rssf-status-badge--warning {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* ยื่นแบบคำขอสำเร็จ */
.rssf-status-badge--submitted {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

/* อยู่ระหว่างการพิจารณาคุณสมบัติ */
.rssf-status-badge--qualification {
    background: #f3e8ff;
    color: #7c3aed;
    border-color: #d8b4fe;
}

/* เห็นชอบคุณสมบัติ */
.rssf-status-badge--qualified {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #7dd3fc;
}

/* อยู่ระหว่างการพิจารณาอนุมัติ */
.rssf-status-badge--approval {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

/* อนุมัติแล้ว */
.rssf-status-badge--completed {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}



/* — Empty state — */
.rssf-empty {
  text-align: center;
  padding: var(--space-12) var(--space-5);
  color: var(--text-muted);
}
.rssf-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: .4;
}
.rssf-empty-title {
  font-size: var(--fs-lg); font-weight: 600;
  color: var(--text); margin: 0 0 var(--space-2);
}
.rssf-empty-text {
  font-size: var(--fs-sm); margin: 0 0 var(--space-5);
}

/* — Skeleton — */
.rssf-skeleton {
  display: block;
  background: linear-gradient(90deg, var(--border-soft) 0%, var(--bg-page) 50%, var(--border-soft) 100%);
  background-size: 200% 100%;
  animation: rssf-skel 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes rssf-skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* — Filter chips — */
.rssf-chip-group {
  display: flex; gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.rssf-chip-group::-webkit-scrollbar { height: 4px; }
.rssf-chip-group::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.rssf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-body);
  font-size: var(--fs-sm); font-weight: 500;
  text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
  min-height: 36px;
  cursor: pointer;
}
.rssf-chip:hover { border-color: var(--brand-400); color: var(--brand-700); }
.rssf-chip.active {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
}
.rssf-chip-count {
  background: rgba(255,255,255,.25); padding: 1px 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
}
.rssf-chip:not(.active) .rssf-chip-count {
  background: var(--bg-page); color: var(--text-muted);
}

/* — Form section card — */
.rssf-form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: var(--space-5);
  overflow: hidden;
}
.rssf-form-section-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--brand-50);
  border-bottom: 1px solid var(--border-soft);
}
.rssf-form-section-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-600); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-base);
  flex-shrink: 0;
}
.rssf-form-section-title {
  font-size: var(--fs-md); font-weight: 700;
  color: var(--text-heading); margin: 0;
}
.rssf-form-section-body {
  padding: var(--space-5);
}
@media (max-width: 767.98px) {
  .rssf-form-section-body { padding: var(--space-4) var(--space-3); }
}

/* — Compare columns (before/after) — */
.rssf-compare-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (max-width: 767.98px) {
  .rssf-compare-cols { grid-template-columns: 1fr; }
}
.rssf-compare-col {
  background: var(--bg-page);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--space-4);
}
.rssf-compare-label {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: 700; color: var(--text-heading);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-3);
}
.rssf-badge-before {
  background: var(--warning-bg); color: var(--warning);
  padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 600;
}
.rssf-badge-after {
  background: var(--brand-100); color: var(--brand-700);
  padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 600;
}

/* — Sticky action bar (form submit, view actions) — */
.rssf-sticky-action {
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
  display: flex; gap: var(--space-3);
  z-index: 10;
  margin: var(--space-5) calc(-1 * var(--space-5)) 0;
}
@media (max-width: 767.98px) {
  .rssf-sticky-action {
    position: fixed;
    left: 0; right: 0;
    bottom: var(--bottomnav-h);
    margin: 0;
    box-shadow: var(--shadow-top);
    flex-direction: column;
  }
  .rssf-sticky-action .btn { width: 100%; min-height: var(--tap-min); }
}

/* — Mobile-only: ensure tap targets meet WCAG — */
@media (max-width: 767.98px) {
  .form-control, .form-select {
    min-height: var(--tap-min);
    font-size: var(--fs-base);
  }
  .btn { min-height: var(--tap-min); }
  .btn-sm { min-height: 36px; }
}

/* — Public layout (no sidebar offset) — */
.rssf-main--public {
  margin-left: 0 !important;
  padding-top: var(--topbar-h) !important;
  padding-left: 0;
  padding-right: 0;
}

/* — Topbar mobile tweaks — */
@media (max-width: 767.98px) {
  .topbar-logo-text { display: none; }
  .topbar-user-name { display: none; }
  .topbar-user-caret { display: none; }
  .topbar-badge-text { display: none; }
  .rssf-topbar { padding: 0 var(--space-3); gap: var(--space-2); }
}

/* — Desktop sidebar offset (override legacy hard-coded margin) — */
@media (min-width: 992px) {
  .rssf-main:not(.rssf-main--public),
  .rssf-content:not(.rssf-content--public) {
    margin-left: var(--sidebar-w);
  }
}

/* — Sidebar width parity (override legacy 220px to 240px) — */
.rssf-sidebar { width: var(--sidebar-w); }
