:root {
            --gov-navy: #7c1fd6;        /* primary purple */
            --gov-navy-dark: #5b18ab;   /* deep purple */
            --gov-navy-mid: #a537e6;    /* violet */
            --gov-gold: #d926c4;        /* magenta accent */
            --gov-gold-light: #f186e6;
            --gov-red: #ec4899;         /* pink accent */
            --gov-bg: #f6f2fd;
            --gov-border: #ece6f8;
            --gov-text: #2b2350;
            --gov-text-muted: #857f9e;
            --gov-white: #ffffff;
            --gov-row-alt: #faf7fe;
            --gov-surface: #ffffff;
            --gov-surface-2: #f7f3fd;
            /* ---- Applax vivid theme ---- */
            --brand-grad: linear-gradient(135deg,#7b2ff7 0%,#b621d6 100%);
            --brand-grad-soft: linear-gradient(135deg,#9d3cf5 0%,#7c1fd6 100%);
            --hero-grad: linear-gradient(120deg,#6a1fd0 0%,#8b1fd8 50%,#c31fc0 100%);
            --teal-grad: linear-gradient(135deg,#7b2ff7 0%,#c026d3 100%);
            --pink-grad: linear-gradient(135deg,#f65fb3 0%,#e11d8f 100%);
            --glass: rgba(255,255,255,0.94);
            --glass-2: rgba(255,255,255,0.9);
            --glass-brd: #efe9fa;
            --glass-shadow: 0 14px 40px rgba(96,40,180,0.12);
        }

        * { box-sizing: border-box; }
        body {
            font-family: 'Prompt', 'Sarabun', sans-serif;
            background: var(--gov-bg);
            color: var(--gov-text);
            font-size: 15px;
            line-height: 1.6;
        }

        /* ===== HEADER STRIPE ===== */
        .gov-top-stripe {
            background: linear-gradient(90deg, var(--gov-navy) 0%, var(--gov-navy-mid) 60%, var(--gov-gold) 100%);
            height: 3px;
            width: 100%;
        }

        /* ===== SPINNER ===== */
        .spinner {
            width: 2.5rem; height: 2.5rem;
            border: 3px solid #e2e8f0;
            border-top: 3px solid var(--gov-navy);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* ===== MODAL ===== */
        .modal { transition: opacity 0.2s ease; }
        body.modal-active { overflow: hidden; }

        /* ===== SCROLLBAR ===== */
        .hide-scroll::-webkit-scrollbar { height: 5px; }
        .hide-scroll::-webkit-scrollbar-thumb { background: #b0bac9; border-radius: 3px; }

        /* ===== HEADER ===== */
        .gov-header {
            background: var(--gov-navy);
            color: #fff;
            border-bottom: 1px solid rgba(184,151,60,0.4);
        }
        .gov-header h1 { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; }
        .gov-header .subtext { font-size: 0.78rem; color: rgba(255,255,255,0.55); margin-top: 1px; }
        .gov-header .user-badge {
            background: rgba(255,255,255,0.08);
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            padding: 4px 12px;
            font-size: 0.78rem;
            color: rgba(255,255,255,0.75);
        }
        .btn-logout {
            background: transparent;
            color: rgba(255,255,255,0.7);
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 4px;
            padding: 6px 14px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-family: 'Prompt', 'Sarabun', sans-serif;
        }
        .btn-logout:hover { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.35); }

        /* ===== NAV TABS ===== */
        .gov-nav {
            background: var(--gov-navy-dark);
            border-bottom: 1px solid rgba(255,255,255,0.07);
            overflow-x: auto;
            display: flex;
            position: sticky;
            top: 0;
            z-index: 30;
        }
        .gov-nav::-webkit-scrollbar { height: 0; }
        .gov-nav-btn {
            padding: 11px 18px;
            font-size: 0.82rem;
            font-weight: 600;
            color: rgba(255,255,255,0.5);
            border: none;
            background: none;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: color 0.15s, border-color 0.15s;
            white-space: nowrap;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            letter-spacing: 0.01em;
        }
        .gov-nav-btn:hover { color: rgba(255,255,255,0.85); }
        .gov-nav-btn.active { color: #fff; border-bottom-color: var(--gov-gold); }

        /* ===== CARDS ===== */
        .gov-card {
            background: var(--gov-surface);
            border: 1px solid var(--gov-border);
            border-radius: 6px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        }
        .gov-card-title {
            font-size: 0.85rem;
            font-weight: 700;
            color: var(--gov-navy);
            padding: 11px 16px;
            border-bottom: 1px solid var(--gov-border);
            background: var(--gov-surface-2);
            border-radius: 6px 6px 0 0;
            display: flex;
            align-items: center;
            gap: 8px;
            letter-spacing: 0.01em;
        }

        /* ===== DOC CARD ===== */
        .doc-card {
            background: var(--gov-surface);
            border: 1px solid var(--gov-border);
            border-left: 3px solid var(--gov-navy);
            border-radius: 5px;
            padding: 16px;
            transition: box-shadow 0.15s, border-left-color 0.15s;
        }
        .doc-card:hover { box-shadow: 0 3px 12px rgba(30,58,95,0.08); }
        .doc-card.internal { border-left-color: var(--gov-navy); }
        .doc-card.external { border-left-color: #3b6fd4; }
        .doc-card.order { border-left-color: var(--gov-red); }

        .badge {
            font-size: 0.72rem;
            font-weight: 600;
            padding: 2px 10px;
            border-radius: 3px;
            border: 1px solid;
            letter-spacing: 0.02em;
        }
        .badge-navy { background: #eef1f7; color: var(--gov-navy); border-color: #cdd5e8; }
        .badge-blue { background: #eff5ff; color: #2c55b5; border-color: #c2d4f8; }
        .badge-red  { background: #fef2f2; color: var(--gov-red); border-color: #f5c6cb; }
        .badge-green { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
        .badge-amber { background: #fff7e6; color: #b26a00; border-color: #f3d9a4; }

        /* ===== TABLE ===== */
        .gov-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
        .gov-table thead { background: var(--gov-surface-2); }
        .gov-table thead th {
            padding: 10px 12px;
            font-weight: 700;
            color: var(--gov-navy);
            border-bottom: 1px solid var(--gov-border);
            white-space: nowrap;
            text-align: left;
            font-size: 0.78rem;
            letter-spacing: 0.03em;
            text-transform: uppercase;
        }
        .gov-table tbody tr { border-bottom: 1px solid #edf0f5; transition: background 0.1s; }
        .gov-table tbody tr:nth-child(even) { background: var(--gov-row-alt); }
        .gov-table tbody tr:hover { background: #eef2fb; }
        .gov-table td { padding: 10px 12px; color: var(--gov-text); vertical-align: middle; }

        /* ===== FORM INPUTS ===== */
        .gov-label {
            display: block;
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--gov-text-muted);
            margin-bottom: 4px;
            letter-spacing: 0.02em;
        }
        .gov-input, .gov-select, .gov-textarea {
            width: 100%;
            border: 1px solid var(--gov-border);
            border-radius: 4px;
            padding: 8px 11px;
            font-size: 0.88rem;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            background: #fff;
            color: var(--gov-text);
            outline: none;
            transition: border-color 0.15s, box-shadow 0.15s;
        }
        .gov-input:focus, .gov-select:focus, .gov-textarea:focus {
            border-color: var(--gov-navy);
            box-shadow: 0 0 0 3px rgba(30,58,95,0.08);
        }
        .gov-textarea { resize: vertical; }

        /* ===== BUTTONS ===== */
        .btn-primary {
            background: var(--gov-navy);
            color: #fff;
            border: 1px solid var(--gov-navy);
            border-radius: 4px;
            padding: 8px 18px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            letter-spacing: 0.01em;
        }
        .btn-primary:hover { background: var(--gov-navy-mid); border-color: var(--gov-navy-mid); }
        .btn-secondary {
            background: #fff;
            color: var(--gov-navy);
            border: 1px solid var(--gov-border);
            border-radius: 4px;
            padding: 7px 15px;
            font-size: 0.83rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .btn-secondary:hover { background: var(--gov-surface-2); border-color: #c5ccd8; }
        .btn-warning {
            background: #92530a;
            color: #fff;
            border: 1px solid #92530a;
            border-radius: 4px;
            padding: 6px 13px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }
        .btn-warning:hover { background: #7a430a; }
        .btn-danger {
            background: #fff;
            color: var(--gov-red);
            border: 1px solid #e0b0b5;
            border-radius: 4px;
            padding: 6px 13px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }
        .btn-danger:hover { background: var(--gov-red); color: #fff; border-color: var(--gov-red); }
        .btn-sm {
            padding: 5px 10px;
            font-size: 0.77rem;
        }
        .btn-icon {
            background: none;
            border: 1px solid var(--gov-border);
            border-radius: 4px;
            padding: 4px 8px;
            cursor: pointer;
            color: var(--gov-text-muted);
            transition: all 0.12s;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.77rem;
        }
        .btn-icon:hover { background: var(--gov-surface-2); color: var(--gov-navy); border-color: #c5ccd8; }

        /* ===== PAGINATION ===== */
        .gov-page-btn {
            border: 1px solid var(--gov-border);
            background: #fff;
            color: var(--gov-navy);
            padding: 5px 12px;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.1s;
            font-family: 'Prompt', 'Sarabun', sans-serif;
        }
        .gov-page-btn:hover:not(:disabled) { background: var(--gov-surface-2); border-color: #c5ccd8; }
        .gov-page-btn:disabled { opacity: 0.35; cursor: default; }
        .gov-page-active {
            background: var(--gov-navy);
            color: #fff;
            border: 1px solid var(--gov-navy);
            border-radius: 4px;
            padding: 5px 11px;
            font-size: 0.8rem;
            font-weight: 700;
            font-family: 'Prompt', 'Sarabun', sans-serif;
        }

        /* ===== LOGIN PAGE ===== */
        .login-wrapper {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 24px;
        }
        .login-card {
            display: grid;
            grid-template-columns: 1.05fr 0.95fr;
            width: 100%;
            max-width: 880px;
            background: #fff;
            border-radius: 26px;
            overflow: hidden;
            box-shadow: 0 26px 70px rgba(40,10,110,0.18);
        }
        .login-visual {
            position: relative;
            padding: 36px 32px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            background: #edf8f1 url('../vibe_images/sarabun-hero.jpg') center 40% / cover no-repeat;
            color: #37284f;
        }
        .login-visual::after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(115deg, rgba(255,255,255,0.96) 0%, rgba(255,255,255,0.82) 42%, rgba(255,255,255,0.18) 100%);
        }
        .login-visual > * { position: relative; z-index: 1; }
        .login-visual h1 { font-size: 1.45rem; font-weight: 700; color: #37284f; margin-top: 12px; line-height: 1.3; }
        .login-visual p { color: #8a8298; font-size: 0.8rem; margin-top: 4px; }
        .login-points { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
        .login-points li { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: #5c5470; }
        .login-points i {
            width: 30px; height: 30px; flex: 0 0 auto;
            display: grid; place-items: center;
            border-radius: 10px;
            background: rgba(123,47,247,0.12);
            color: #7b2ff7;
            font-size: 0.8rem;
        }
        .login-form-side { padding: 38px 36px; display: flex; flex-direction: column; justify-content: center; }
        .login-logo {
            width: 52px; height: 52px;
            border-radius: 16px;
            background: var(--brand-grad);
            color: #fff;
            display: grid; place-items: center;
            font-size: 1.3rem;
            box-shadow: 0 8px 20px rgba(150,30,200,0.35);
            margin-bottom: 14px;
        }
        .login-form-side h2 { font-size: 1.15rem; font-weight: 700; color: #332650; margin-bottom: 18px; }
        .login-credit { color: #9a91aa; font-size: 0.74rem; margin-top: 18px; text-align: center; }
        @media (max-width: 820px) {
            .login-card { grid-template-columns: 1fr; max-width: 460px; }
            .login-visual { padding: 22px 24px; }
            .login-points { display: none; }
            .login-visual h1 { font-size: 1.15rem; margin-top: 8px; }
            .login-form-side { padding: 26px 24px; }
        }

        /* ===== SECTION HEADING ===== */
        .section-heading {
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--gov-navy);
            border-left: 3px solid var(--gov-gold);
            padding-left: 10px;
            margin-bottom: 16px;
        }

        /* ===== TOAST ===== */
        .gov-toast {
            position: fixed;
            top: 18px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 999;
            min-width: 240px;
            text-align: center;
            border-radius: 4px;
            padding: 9px 18px;
            font-weight: 600;
            font-size: 0.85rem;
            box-shadow: 0 4px 20px rgba(0,0,0,0.14);
        }

        /* ===== FILE UPLOAD ZONE ===== */
        .file-upload-zone {
            background: var(--gov-surface-2);
            border: 1.5px dashed var(--gov-border);
            border-radius: 5px;
            padding: 14px;
            transition: border-color 0.15s, background 0.15s;
        }
        .file-upload-zone:hover { border-color: var(--gov-navy); background: #f0f4fb; }
        .file-preview-wrap {
            margin-top: 10px;
            border: 1px solid var(--gov-border);
            border-radius: 5px;
            overflow: hidden;
            background: var(--gov-surface-2);
        }
        .file-preview-wrap img {
            display: block;
            max-width: 100%;
            max-height: 200px;
            object-fit: contain;
            margin: 0 auto;
        }
        .file-preview-info {
            padding: 8px 12px;
            font-size: 0.78rem;
            color: var(--gov-text-muted);
            display: flex;
            align-items: center;
            gap: 6px;
            border-top: 1px solid var(--gov-border);
            background: #fff;
        }
        .file-preview-pdf {
            padding: 16px;
            text-align: center;
            color: var(--gov-navy);
            font-size: 0.85rem;
        }
        .file-preview-pdf i { font-size: 2rem; display: block; margin-bottom: 6px; color: #cc3333; opacity: 0.8; }

        /* ===== PER-PAGE SELECTOR ===== */
        .per-page-wrap {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.8rem;
            color: var(--gov-text-muted);
            font-weight: 600;
        }
        .per-page-wrap select {
            border: 1px solid var(--gov-border);
            border-radius: 4px;
            padding: 4px 8px;
            font-size: 0.8rem;
            font-family: 'Prompt', 'Sarabun', sans-serif;
            background: #fff;
            color: var(--gov-text);
            cursor: pointer;
            outline: none;
        }
        .per-page-wrap select:focus { border-color: var(--gov-navy); }

        /* ===== MODAL ===== */
        .modal-box {
            background: #fff;
            border-radius: 6px;
            max-width: 900px;
            width: 95%;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 10px 40px rgba(0,0,0,0.25);
        }
        .modal-header {
            padding: 14px 20px;
            border-bottom: 1px solid var(--gov-border);
            background: #f0f3f8;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .modal-header h2 { font-size: 1rem; font-weight: 700; color: var(--gov-navy); }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 640px) {
            .gov-header { flex-wrap: wrap; gap: 8px; }
            .gov-header h1 { font-size: 0.92rem; }
            .doc-card { padding: 12px; }
            main { padding: 12px 10px; }
        }

        /* =====================================================
           APPLAX THEME — clean vivid purple (loaded last, wins)
        ===================================================== */
        body {
            background: #f4eefb;
            color: var(--gov-text);
            font-weight: 400;
        }
        body::before {
            content: "";
            position: fixed; inset: 0; z-index: -1; pointer-events: none;
            background:
                radial-gradient(closest-side at 95% 4%, rgba(180,33,214,0.10), transparent 55%),
                radial-gradient(closest-side at 3% 55%, rgba(123,47,247,0.08), transparent 50%);
        }
        h1, h2, h3, .gov-card-title, .section-heading, .btn-primary, .btn-warning, .gov-nav-btn { font-weight: 600; letter-spacing: 0; }

        /* ---- top stripe ---- */
        .gov-top-stripe { display: none; }

        /* ---- top utility bar ---- */
        .gov-topbar {
            background: var(--hero-grad);
            color: #fff;
        }
        .gov-topbar-inner {
            max-width: 1100px; margin: 0 auto;
            padding: 7px 18px;
            display: flex; justify-content: space-between; align-items: center; gap: 10px;
            font-size: 0.78rem;
        }
        .gov-topbar-left { color: rgba(255,255,255,0.9); display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .gov-topbar-logout {
            color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap;
            display: inline-flex; align-items: center; gap: 6px;
            padding: 3px 12px; border: 1px solid rgba(255,255,255,0.4); border-radius: 999px;
            transition: all .15s;
        }
        .gov-topbar-logout:hover { background: #fff; color: #7c1fd6; }

        /* ---- main header (white) ---- */
        .gov-header {
            background: #fff;
            border-bottom: 1px solid var(--gov-border);
            box-shadow: 0 4px 20px rgba(96,40,180,0.06);
            color: var(--gov-text);
            position: sticky; top: 0; z-index: 40;
        }
        .gov-header-inner {
            max-width: 1100px; margin: 0 auto;
            padding: 12px 18px;
            display: flex; align-items: center; justify-content: space-between; gap: 16px;
            flex-wrap: wrap;
        }
        .gov-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
        .gov-brand-logo {
            width: 46px; height: 46px; flex-shrink: 0;
            border-radius: 14px;
            background: var(--brand-grad);
            color: #fff; font-size: 1.25rem;
            display: flex; align-items: center; justify-content: center;
            box-shadow: 0 8px 18px rgba(150,30,200,0.32);
        }
        .gov-brand-name { font-size: 1.12rem; font-weight: 700; color: var(--gov-navy-dark); line-height: 1.25; }
        .gov-brand-sub { font-size: 0.76rem; color: var(--gov-text-muted); margin-top: 1px; }

        /* ---- nav (inside header) ---- */
        .gov-nav {
            background: transparent;
            border-bottom: none;
            box-shadow: none;
            padding: 0;
            gap: 8px;
            display: flex; flex-wrap: wrap;
            position: static;
            overflow: visible;
        }
        .gov-nav-btn {
            color: var(--gov-navy-dark);
            background: #faf6fe;
            border: 1px solid var(--glass-brd);
            border-radius: 999px;
            padding: 9px 18px;
        }
        .gov-nav-btn:hover { color: #7c1fd6; background: #f3e9fd; }
        .gov-nav-btn.active {
            color: #fff;
            background: var(--brand-grad);
            border: none;
            box-shadow: 0 8px 20px rgba(150,30,200,0.4);
        }

        /* ---- hero welcome card ---- */
        .hero-wrap { max-width: 1100px; margin: 18px auto 0; padding: 0 16px; }
        .hero-card {
            background: var(--hero-grad);
            border-radius: 24px;
            padding: 26px 28px;
            color: #fff;
            display: flex; align-items: center; justify-content: space-between; gap: 18px;
            position: relative; overflow: hidden;
            box-shadow: 0 18px 44px rgba(120,25,190,0.28);
        }
        .hero-card::before {
            content: ""; position: absolute; right: -40px; top: -60px;
            width: 240px; height: 240px; border-radius: 50%;
            background: radial-gradient(closest-side, rgba(255,255,255,0.18), transparent 70%);
        }
        .hero-text { position: relative; z-index: 1; min-width: 0; }
        .hero-chip {
            display: inline-flex; align-items: center; gap: 6px;
            background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
            padding: 4px 13px; border-radius: 999px; font-size: 0.76rem; font-weight: 500;
            margin-bottom: 10px;
        }
        .hero-title { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
        .hero-desc { font-size: 0.9rem; color: rgba(255,255,255,0.85); margin-top: 6px; }
        .hero-emblem {
            width: 78px; height: 78px; flex-shrink: 0; position: relative; z-index: 1;
            border-radius: 22px;
            background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.28);
            display: flex; align-items: center; justify-content: center;
            font-size: 2.2rem; color: #fff;
        }

        /* ---- mobile ---- */
        @media (max-width: 720px) {
            .gov-topbar-left { font-size: 0.72rem; }
            .gov-header-inner { padding: 10px 14px; gap: 10px; }
            .gov-brand-name { font-size: 1rem; }
            .gov-nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
            .gov-nav::-webkit-scrollbar { height: 0; }
            .gov-nav-btn { flex: 0 0 auto; padding: 8px 15px; font-size: 0.8rem; }
            .hero-card { padding: 20px; border-radius: 20px; }
            .hero-title { font-size: 1.32rem; }
            .hero-desc { font-size: 0.83rem; }
            .hero-emblem { width: 58px; height: 58px; font-size: 1.6rem; border-radius: 18px; }
            #dashboard-charts { grid-template-columns: 1fr !important; }
        }
        @media (max-width: 480px) {
            .gov-topbar-left { max-width: 60%; }
            .hero-emblem { display: none; }
        }

        /* ---- cards (clean white) ---- */
        .gov-card {
            background: #fff;
            border: 1px solid var(--glass-brd);
            border-radius: 24px;
            box-shadow: var(--glass-shadow);
            overflow: hidden;
        }
        .gov-card-title {
            background: #fff;
            border-bottom: 1px solid var(--gov-border);
            color: var(--gov-navy-dark);
            padding: 16px 20px;
            font-size: 0.95rem;
        }

        /* ---- doc card ---- */
        .doc-card {
            background: #fff;
            border: 1px solid var(--glass-brd);
            border-left: 5px solid #7b2ff7;
            border-radius: 20px;
            box-shadow: 0 10px 28px rgba(96,40,180,0.08);
            transition: box-shadow .18s, transform .18s;
        }
        .doc-card:hover { box-shadow: 0 16px 38px rgba(120,30,190,0.18); transform: translateY(-3px); }
        .doc-card.internal { border-left-color: #7b2ff7; }
        .doc-card.external { border-left-color: #c026d3; }
        .doc-card.order    { border-left-color: #ec4899; }

        /* ---- badges (pills) ---- */
        .badge { border-radius: 999px; border: none; padding: 4px 13px; font-weight: 500; }
        .badge-navy  { background: rgba(123,47,247,0.12); color: #7b2ff7; }
        .badge-blue  { background: rgba(192,38,211,0.12); color: #b21fc0; }
        .badge-red   { background: rgba(236,72,153,0.14); color: #d61f7c; }
        .badge-green { background: rgba(16,185,129,0.14); color: #0f8f63; }
        .badge-amber { background: rgba(245,158,11,0.16); color: #b26a00; }

        /* ---- table ---- */
        #table-container { background: #fff !important; border: 1px solid var(--glass-brd) !important; border-radius: 22px !important; box-shadow: var(--glass-shadow); }
        .gov-table thead { background: #faf6fe; }
        .gov-table thead th { color: var(--gov-navy-dark); border-bottom: 1px solid var(--gov-border); }
        .gov-table tbody tr { border-bottom: 1px solid #f1ebfa; }
        .gov-table tbody tr:nth-child(even) { background: #fbf9fe; }
        .gov-table tbody tr:hover { background: #f6eefe; }

        /* ---- inputs ---- */
        .gov-input, .gov-select, .gov-textarea, .per-page-wrap select {
            background: #faf8fe;
            border: 1px solid var(--gov-border);
            border-radius: 14px;
            padding: 11px 15px;
        }
        .gov-input:focus, .gov-select:focus, .gov-textarea:focus {
            border-color: #a537e6;
            background: #fff;
            box-shadow: 0 0 0 4px rgba(150,40,220,0.12);
        }

        /* ---- buttons ---- */
        .btn-primary {
            background: var(--brand-grad);
            border: none;
            border-radius: 999px;
            padding: 10px 22px;
            box-shadow: 0 8px 20px rgba(150,30,200,0.35);
        }
        .btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(150,30,200,0.45); transform: translateY(-1px); }
        .btn-secondary {
            background: #fff;
            color: var(--gov-navy-dark);
            border: 1px solid var(--glass-brd);
            border-radius: 999px;
        }
        .btn-secondary:hover { background: #faf6fe; border-color: #d8c6f5; color: #7c1fd6; }
        .btn-warning {
            background: var(--pink-grad);
            border: none;
            border-radius: 999px;
            box-shadow: 0 7px 18px rgba(225,29,143,0.35);
        }
        .btn-warning:hover { filter: brightness(1.06); transform: translateY(-1px); }
        .btn-danger {
            background: #fff;
            color: #e11d8f;
            border: 1px solid rgba(225,29,143,0.35);
            border-radius: 999px;
        }
        .btn-danger:hover { background: var(--pink-grad); color: #fff; border-color: transparent; }
        .btn-icon {
            background: #fff;
            border: 1px solid var(--glass-brd);
            border-radius: 999px;
            color: var(--gov-text-muted);
        }
        .btn-icon:hover { background: #faf6fe; color: #7c1fd6; border-color: #d8c6f5; }

        /* ---- pagination ---- */
        .gov-page-btn {
            background: #fff;
            border: 1px solid var(--glass-brd);
            border-radius: 12px;
            color: var(--gov-navy-dark);
        }
        .gov-page-btn:hover:not(:disabled) { background: #faf6fe; border-color: #d8c6f5; }
        .gov-page-active {
            background: var(--brand-grad);
            border: none;
            border-radius: 12px;
            box-shadow: 0 6px 16px rgba(150,30,200,0.4);
        }

        /* ---- cleanup modal (ล้างไฟล์ขยะ) ---- */
        .cleanup-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.8rem; color: var(--gov-text-muted); flex-wrap: wrap; }
        .cleanup-row {
            display: flex; align-items: center; gap: 10px;
            padding: 9px 12px;
            border: 1px solid var(--gov-border);
            border-radius: 12px;
            background: #faf8fe;
            cursor: pointer;
            font-size: 0.82rem;
            transition: background .12s, border-color .12s;
        }
        .cleanup-row:hover { background: #f6eefe; border-color: #d8c6f5; }
        .cleanup-row input { width: 15px; height: 15px; accent-color: var(--gov-navy); cursor: pointer; flex: 0 0 auto; }
        .cleanup-name { font-weight: 600; color: var(--gov-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .cleanup-meta { margin-left: auto; display: flex; gap: 10px; flex: 0 0 auto; color: var(--gov-text-muted); font-size: 0.74rem; white-space: nowrap; }
        #btn-cleanup-delete:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }

        /* ---- section heading ---- */
        .section-heading { border-left: 4px solid #c026d3; color: var(--gov-navy-dark); }

        /* ---- toast ---- */
        .gov-toast { border-radius: 14px; }

        /* ---- file upload zone ---- */
        .file-upload-zone {
            background: #faf6fe;
            border: 1.5px dashed #d0b6f2;
            border-radius: 16px;
        }
        .file-upload-zone:hover { border-color: #a537e6; background: #f6eefe; }
        .file-preview-wrap { border-radius: 14px; border-color: var(--gov-border); }

        /* ---- modal ---- */
        .modal-box {
            background: #fff;
            border: none;
            border-radius: 24px;
            box-shadow: 0 28px 70px rgba(40,10,110,0.4);
        }
        .modal-header {
            background: #faf6fe;
            border-bottom: 1px solid var(--gov-border);
        }

        /* ---- spinner ---- */
        .spinner { border-top-color: #7b2ff7; }

        /* ---- scrollbar ---- */
        .hide-scroll::-webkit-scrollbar-thumb { background: rgba(123,47,247,0.4); }

        .app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
        .app-sidebar {
            position: sticky; top: 0; height: 100vh; z-index: 45;
            display: flex; flex-direction: column; padding: 22px 16px 16px;
            background: rgba(255,255,255,.94); border-right: 1px solid #eee8f6;
            backdrop-filter: blur(18px);
        }
        .sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 20px; }
        .sidebar-logo { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--brand-grad); box-shadow: 0 8px 20px rgba(117,45,220,.25); font-size: 1.15rem; }
        .sidebar-brand strong { display: block; font-size: 1.15rem; line-height: 1.15; color: #332759; }
        .sidebar-brand small { color: #8c84a5; font-size: .61rem; letter-spacing: .16em; }
        .sidebar-profile { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 15px; background: #f8f4fd; border: 1px solid #eee7f7; }
        .profile-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #e8def7; color: #7640c5; flex: 0 0 auto; }
        .sidebar-profile small { display: block; color: #9189a6; font-size: .67rem; }
        .sidebar-profile strong { display: block; max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
        .sidebar-label { margin: 20px 10px 7px; color: #aaa2b9; font-size: .65rem; }
        .app-sidebar .gov-nav { display: flex; flex-direction: column; gap: 5px; width: 100%; }
        .app-sidebar .gov-nav-btn { width: 100%; justify-content: flex-start; padding: 11px 14px; background: transparent; border: 0; border-radius: 10px; color: #746c89; font-size: .78rem; box-shadow: none; }
        .app-sidebar .gov-nav-btn i { width: 18px; text-align: center; font-size: .9rem; }
        .app-sidebar .gov-nav-btn:hover { background: #f5effc; }
        .app-sidebar .gov-nav-btn.active { background: linear-gradient(100deg,#8738e5,#7128cc); color: #fff; box-shadow: 0 8px 18px rgba(113,40,204,.2); }
        .sidebar-bottom { margin-top: auto; padding-top: 18px; border-top: 1px solid #f0ebf5; }
        .sidebar-storage { margin: 0 6px 14px; padding: 12px; border-radius: 12px; background: #f4fbf8; color: #438572; font-size: .7rem; }
        .sidebar-logout { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; color: #888095; text-decoration: none; font-size: .77rem; border-radius: 10px; }
        .sidebar-logout:hover { background: #fff1f5; color: #d04c75; }
        .app-workspace { min-width: 0; }
        .workspace-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; max-width: 1680px; margin: 0 auto; padding: 24px 28px 18px; }
        .workspace-eyebrow { display: flex; align-items: center; gap: 7px; color: #6db4a4; font-size: .68rem; }
        .workspace-eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #58c7ad; box-shadow: 0 0 0 4px rgba(88,199,173,.12); }
        .workspace-welcome { margin-top: 5px; font-size: 1.55rem; line-height: 1.35; color: #332650; }
        .workspace-date { margin-top: 4px; color: #9a91aa; font-size: .72rem; }
        .workspace-actions { display: flex; align-items: center; gap: 12px; }
        .notification-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #d4a72c; box-shadow: 0 5px 16px rgba(57,37,91,.07); }
        .app-workspace main { max-width: 1680px !important; margin: 0 auto; padding: 0 28px 60px !important; }
        .hero-wrap { max-width: none; margin: 0 0 20px; padding: 0; }
        .hero-card { min-height: 208px; padding: 0; border-radius: 22px; background: #edf8f1 url('../vibe_images/sarabun-hero.jpg') center 35% / cover no-repeat; box-shadow: 0 12px 32px rgba(70,56,103,.08); color: #36284e; }
        .hero-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg,rgba(255,255,255,.96) 0%,rgba(255,255,255,.84) 29%,rgba(255,255,255,.12) 58%,transparent 75%); }
        .hero-card::before { display: none; }
        .hero-text { z-index: 2; width: 56%; padding: 24px 32px; }
        .hero-chip { margin-bottom: 16px; padding: 4px 12px; background: rgba(255,255,255,.75); border-color: rgba(255,255,255,.85); color: #7843bd; font-size: .68rem; }
        .hero-title { color: #37284f; font-size: 1.5rem; }
        .hero-desc { max-width: 420px; margin: 7px 0 16px; color: #8a8298; font-size: .76rem; }
        .hero-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
        .hero-buttons .btn-primary, .hero-buttons .btn-secondary { padding: 9px 18px; font-size: .75rem; box-shadow: none; }
        .hero-emblem { display: none; }
        #status-summary { gap: 14px !important; margin-bottom: 24px !important; }
        .summary-card { min-height: 120px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 18px; cursor: pointer; transition: transform .18s,box-shadow .18s; }
        .summary-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(65,43,95,.08); }
        .summary-label { font-size: .7rem; opacity: .8; }
        .summary-number { margin: 5px 0 1px; font-size: 1.85rem; line-height: 1; font-weight: 700; }
        .summary-note { font-size: .61rem; opacity: .65; }
        .summary-icon { width: 65px; height: 65px; display: grid; place-items: center; border-radius: 18px; background: rgba(255,255,255,.55); font-size: 1.6rem; }
        .summary-purple { color: #fff; background: linear-gradient(135deg,#a04af0,#7732d3); box-shadow: 0 10px 24px rgba(127,50,212,.18); }
        .summary-blue { color: #3c61ba; background: #edf4ff; }
        .summary-amber { color: #bb8127; background: #fff7df; }
        .summary-green { color: #268c72; background: #eaf9f1; }
        .summary-purple .summary-icon { background: rgba(255,255,255,.17); }
        .dashboard-section-title { margin: 0 0 12px; color: #3c3052; font-size: .94rem; font-weight: 700; }
        .search-panel { border-radius: 18px !important; box-shadow: none !important; }
        .doc-card { border-left-width: 1px; border-radius: 16px; box-shadow: 0 5px 18px rgba(67,45,94,.05); }
        .gov-card-title { font-size: .88rem; }
        .compression-hint { display: flex; gap: 7px; align-items: flex-start; margin-top: 9px; color: #877b9b; font-size: .7rem; line-height: 1.5; }
        .compression-hint i { margin-top: 3px; color: #8b4ad8; }
        /* ---- per-tab page header & fluid list grids ---- */
        .page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
        .page-header h2 { font-size: 1.32rem; font-weight: 700; color: #332650; }
        .page-header p { margin-top: 4px; color: #8c84a5; font-size: .78rem; }
        .page-header .btn-primary { flex-shrink: 0; }
        #list-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(400px,100%), 1fr)); gap: 14px; align-items: start; }
        #staff-list-container, #field-list-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px,100%), 1fr)); gap: 12px; align-items: start; }
        /* ---- modal helpers ---- */
        .modal-narrow { max-width: 640px; }
        .modal-close { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--gov-text-muted); display: flex; align-items: center; gap: 4px; font-family: 'Sarabun', sans-serif; }
        .modal-close:hover { color: var(--gov-navy); }
        /* ---- backup drive page ---- */
        .sortable:hover { color: var(--gov-navy); cursor: pointer; }
        .mini-spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(178,106,0,0.35); border-top-color: #b26a00; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
        .row-done { opacity: 0.72; }
        .bk-track { background: #ece6f8; border-radius: 999px; height: 14px; overflow: hidden; }
        .bk-fill { height: 100%; width: 0%; background: var(--brand-grad); border-radius: 999px; transition: width .3s ease; }
        .bk-link { color: var(--gov-navy); font-weight: 600; text-decoration: none; font-size: 0.78rem; margin-left: 6px; }
        .bk-link:hover { text-decoration: underline; }
        .bk-summary { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed #d9cbf5; font-size: 0.86rem; font-weight: 600; }
        @media (min-width: 1500px) { .app-shell { grid-template-columns: 250px minmax(0,1fr); } }
        @media (max-width: 980px) {
            .app-shell { grid-template-columns: 190px minmax(0,1fr); }
            .app-sidebar { padding-left: 10px; padding-right: 10px; }
            .sidebar-profile { padding: 9px; }
            .workspace-top,.app-workspace main { padding-left: 18px !important; padding-right: 18px !important; }
            .hero-text { width: 62%; }
        }
        @media (max-width: 720px) {
            .app-shell { display: block; }
            .app-sidebar { position: relative; height: auto; padding: 12px 14px 8px; border-right: 0; border-bottom: 1px solid #eee8f6; }
            .sidebar-brand { padding-bottom: 10px; }
            .sidebar-logo { width: 38px; height: 38px; }
            .sidebar-profile,.sidebar-label,.sidebar-bottom { display: none; }
            .app-sidebar .gov-nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
            .app-sidebar .gov-nav-btn { width: auto; flex: 0 0 auto; padding: 9px 12px; }
            .workspace-top { padding: 18px 14px 14px; align-items: flex-start; }
            .workspace-welcome { font-size: 1.2rem; }
            .workspace-actions .notification-btn { display: none; }
            .workspace-actions .btn-primary { padding: 8px 12px; font-size: .7rem; }
            .app-workspace main { padding: 0 14px 40px !important; }
            .hero-card { min-height: 280px; background-position: 62% center; }
            .hero-card::after { background: linear-gradient(90deg,rgba(255,255,255,.96),rgba(255,255,255,.72) 70%,rgba(255,255,255,.2)); }
            .hero-text { width: 82%; padding: 26px 22px; }
            .hero-title { font-size: 1.35rem; }
            #status-summary { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 10px !important; }
            .summary-card { min-height: 110px; padding: 15px; }
            .summary-icon { width: 44px; height: 44px; border-radius: 13px; font-size: 1.2rem; }
            .summary-number { font-size: 1.55rem; }
        }
        @media (max-width: 480px) {
            .workspace-actions { display: none; }
            .hero-text { width: 95%; }
            .summary-note { display: none; }
            .summary-card { min-height: 94px; }
            .summary-icon { width: 36px; height: 36px; }
            .doc-form > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
        }