/* =========================================================
   ระบบยื่นใบลาออนไลน์ โรงเรียนอนุบาลเลย — ANLS Smart HR v3.0
   Bento Grid & Glassmorphism UI Design System
   ========================================================= */
:root {
    --brand: #2563eb;
    --primary: #2563eb;
    --primary-600: #1d4ed8;
    --primary-700: #1e40af;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --accent: #f59e0b;

    --success: #16a34a;  --success-50: #dcfce7;
    --danger: #dc2626;   --danger-50: #fee2e2;
    --warning: #d97706;  --warning-50: #fef3c7;
    --info: #0284c7;     --info-50: #e0f2fe;
    --purple: #7c3aed;   --purple-50: #f3e8ff;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;
    --border: #e2e8f0;

    --radius: 20px;
    --radius-sm: 12px;
    --shadow-sm: 0 2px 10px -2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .03);
    --shadow: 0 12px 28px -6px rgba(15, 23, 42, .08), 0 4px 10px -2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 24px 48px -12px rgba(30, 58, 138, .28);
    --sidebar-w: 280px;
    --font: 'K2D', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.04) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(124, 58, 237, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
    line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
img { max-width: 100%; }
::selection { background: var(--primary-100); color: var(--primary-700); }

/* ---------- Layout (Bento & Modern Dark Indigo Sidebar) ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
    display: flex; flex-direction: column; padding: 20px 16px;
    background:
        radial-gradient(120% 50% at 0% 0%, rgba(59, 130, 246, .20) 0%, transparent 55%),
        radial-gradient(100% 50% at 100% 100%, rgba(124, 58, 237, .18) 0%, transparent 55%),
        linear-gradient(180deg, #0f172a 0%, #172554 60%, #1e1b4b 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
    color: #e2e8f0; transition: width .3s var(--ease), padding .3s var(--ease), transform .35s var(--ease);
}
.brand {
    display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 6px;
}

/* ---------- Desktop Sidebar Collapse Mode ---------- */
@media (min-width: 1025px) {
    body.sidebar-collapsed {
        --sidebar-w: 82px;
    }
    body.sidebar-collapsed .sidebar {
        width: 82px;
        padding: 18px 10px;
    }
    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .nav-section,
    body.sidebar-collapsed .nav-link span,
    body.sidebar-collapsed .nav-badge,
    body.sidebar-collapsed .sidebar-bot-card,
    body.sidebar-collapsed .sidebar-user span:last-child {
        display: none !important;
    }
    body.sidebar-collapsed .brand {
        justify-content: center;
        padding: 4px 0 16px;
    }
    body.sidebar-collapsed .nav-link {
        justify-content: center;
        padding: 12px;
    }
    body.sidebar-collapsed .sidebar-user {
        justify-content: center;
        padding: 8px;
    }
    body.sidebar-collapsed .main {
        margin-left: 82px;
    }
}
.brand-logo {
    width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
    background: linear-gradient(135deg, #3b82f6, #2563eb); color: #ffffff;
    box-shadow: 0 8px 20px -6px rgba(37, 99, 235, .65);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.06rem; font-weight: 700; color: #ffffff; letter-spacing: -0.01em; }
.brand-text small { color: #93c5fd; font-size: .78rem; font-weight: 500; }

.nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section {
    font-size: .70rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #64748b; margin: 16px 12px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; margin-bottom: 3px;
    color: #cbd5e1; font-weight: 500; font-size: 0.94rem; position: relative;
    transition: background .2s, transform .2s, color .2s, box-shadow .2s;
}
.nav-link i { font-size: 1.15rem; width: 22px; text-align: center; opacity: .9; transition: transform .2s; }
.nav-link:hover { background: rgba(255, 255, 255, .08); transform: translateX(3px); color: #fff; }
.nav-link:hover i { transform: scale(1.08); }
.nav-link.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff; font-weight: 600;
    box-shadow: 0 6px 18px -4px rgba(37, 99, 235, .55), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.nav-link.active::before {
    content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0;
    background: #93c5fd;
}
.nav-badge {
    margin-left: auto; background: #ef4444; color: #ffffff; font-size: .73rem; font-weight: 700;
    min-width: 24px; height: 22px; border-radius: 999px; display: grid; place-items: center; padding: 0 8px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, .45);
    animation: pulse 2s infinite;
}

/* Sidebar Bot Status Widget (from AI UI Redesign) */
.sidebar-bot-card {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    padding: 11px 13px;
    margin: 8px 0 10px;
    font-size: 0.76rem;
    line-height: 1.45;
    backdrop-filter: blur(8px);
}
.sidebar-bot-card .bot-title {
    color: #38bdf8;
    font-weight: 700;
    font-size: 0.80rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}
.sidebar-bot-card .bot-sub {
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-bot-card .bot-ok {
    color: #4ade80;
    font-weight: 600;
}

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; display: grid; gap: 4px; }
.sidebar-user {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
    background: rgba(15, 23, 42, 0.55); border: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff; transition: background .2s, border-color .2s;
}
.sidebar-user:hover, .sidebar-user.active { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.15); }
.sidebar-user span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sidebar-user strong { font-size: .90rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { color: #4ade80; font-size: .75rem; font-weight: 500; }
.nav-link.logout { color: #fca5a5; padding: 8px 14px; font-size: 0.88rem; }
.nav-link.logout:hover { background: rgba(239, 68, 68, 0.15); color: #fecaca; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    padding: 12px 28px; background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, .85);
    box-shadow: 0 2px 14px -4px rgba(15, 23, 42, .04);
}
.topbar-title { font-weight: 700; font-size: 1.12rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-quick-btns { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; }
.topbar-btn-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px;
    font-size: 0.82rem; font-weight: 600; transition: all .2s var(--ease); white-space: nowrap;
}
.topbar-btn-pill:hover { transform: translateY(-1px); }
.topbar-btn-cal { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.topbar-btn-cal:hover { background: #dbeafe; }
.topbar-btn-leave { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; box-shadow: 0 4px 10px -2px rgba(37,99,235,.4); }
.topbar-btn-leave:hover { box-shadow: 0 6px 14px -2px rgba(37,99,235,.55); color: #fff; }

.content { padding: 24px 28px 44px; width: 100%; max-width: 100%; flex: 1; }
.footer { padding: 18px 28px 26px; color: var(--text-3); font-size: .85rem; }

.menu-toggle { display: inline-grid; cursor: pointer; }
.sidebar-overlay { display: none; }

/* ---------- Common ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
    background: #f8fafc; border: 1px solid var(--border); font-size: .83rem; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.chip-primary { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); font-weight: 600; }
.icon-btn {
    width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2); font-size: 1.15rem; cursor: pointer; position: relative; transition: all .2s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary-100); background: var(--primary-50); transform: translateY(-1px); }
.icon-btn.has-dot::after {
    content: ''; position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%;
    background: var(--danger); box-shadow: 0 0 0 2px #fff; animation: pulse 2s infinite;
}

.page-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-bottom: 22px; background: #ffffff; padding: 18px 22px; border-radius: 20px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.page-header h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.page-header p { margin: 4px 0 0; color: var(--text-2); font-size: 0.9rem; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.muted { color: var(--text-2); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }
.fw-600 { font-weight: 600; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 20px; }
.d-flex { display: flex; } .align-center { align-items: center; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.justify-between { justify-content: space-between; } .flex-wrap { flex-wrap: wrap; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Bento Grid ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 370px; align-items: start; }
.grid-main > * { min-width: 0; max-width: 100%; }

/* ---------- Admin Control Panel Action Cards ---------- */
.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.admin-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    text-decoration: none;
    transition: all .22s var(--ease);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.admin-action-card::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%; height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity .2s;
}
.admin-action-card:hover {
    transform: translateY(-3px);
    border-color: #93c5fd;
    box-shadow: 0 12px 24px -6px rgba(37, 99, 235, .18);
    background: #f8fafc;
}
.admin-action-card:hover::before { opacity: 1; }
.admin-action-card i {
    font-size: 26px;
    margin-bottom: 8px;
    display: inline-block;
    transition: transform .2s;
}
.admin-action-card:hover i {
    transform: scale(1.15);
}
.admin-action-card strong {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 3px;
    color: var(--text);
}
.admin-action-card small {
    font-size: 0.78rem;
    color: var(--text-2);
    line-height: 1.3;
    font-weight: 400;
}
@media (max-width: 1024px) {
    .admin-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 540px) {
    .admin-card-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Bento Card ---------- */
.card {
    background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); animation: fadeUp .45s var(--ease) both;
    transition: box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card:hover {
    box-shadow: 0 8px 26px -6px rgba(15, 23, 42, .07);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 22px; border-bottom: 1px solid #f1f5f9;
}
.card-header h2, .card-header h3 { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 10px; color: var(--text); }
.card-header h2 i, .card-header h3 i {
    color: var(--primary); background: var(--primary-50); width: 34px; height: 34px;
    border-radius: 10px; display: inline-grid; place-items: center; font-size: 1.05rem;
}
.card-body { padding: 20px 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: #f8fafc; border-radius: 0 0 var(--radius) var(--radius); }
.grid > .card:nth-child(2) { animation-delay: .04s; }
.grid > .card:nth-child(3) { animation-delay: .08s; }
.grid > .card:nth-child(4) { animation-delay: .12s; }
.sticky { position: sticky; top: 84px; }

/* ---------- Bento Hero Banner ---------- */
.hero {
    position: relative; overflow: hidden; border-radius: 24px; padding: 26px 32px; color: #fff; margin-bottom: 20px;
    background:
        radial-gradient(60% 120% at 95% 0%, rgba(56, 189, 248, .35) 0%, transparent 55%),
        radial-gradient(50% 100% at 10% 100%, rgba(124, 58, 237, .35) 0%, transparent 60%),
        linear-gradient(125deg, #0f172a 0%, #1e3a8a 52%, #2563eb 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-lg); animation: fadeUp .45s var(--ease) both;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.hero::after {
    content: ''; position: absolute; right: -50px; bottom: -70px; width: 240px; height: 240px; border-radius: 50%;
    border: 36px solid rgba(255,255,255,.06); pointer-events: none;
}
.hero h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.01em; }
.hero p { margin: 6px 0 0; color: #bfdbfe; font-size: 0.95rem; }
.hero .btn { position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px;
    font-family: inherit; font-size: .94rem; font-weight: 600; border: 1px solid transparent; cursor: pointer;
    transition: transform .15s var(--ease), box-shadow .2s, background .2s, color .2s, border-color .2s; white-space: nowrap; line-height: 1.3;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn i { font-size: 1.1em; }
.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff; box-shadow: 0 8px 18px -6px rgba(37, 99, 235, .6);
}
.btn-primary:hover { box-shadow: 0 12px 24px -6px rgba(37, 99, 235, .75); color: #fff; }
.btn-outline-primary { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.btn-outline-primary:hover { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.btn-outline-secondary { background: #f8fafc; color: #334155; border-color: #cbd5e1; }
.btn-outline-secondary:hover { background: #f1f5f9; border-color: #94a3b8; color: #0f172a; }
.btn-outline-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-outline-danger:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-light:hover { border-color: #cbd5e1; background: #f8fafc; color: var(--primary); }
.btn-success { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; box-shadow: 0 8px 18px -8px rgba(22, 163, 74, .65); }
.btn-danger { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; box-shadow: 0 8px 18px -8px rgba(220, 38, 38, .65); }
.btn-soft-danger { background: var(--danger-50); color: var(--danger); }
.btn-soft { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }
.btn-white { background: #fff; color: #1e3a8a; box-shadow: 0 10px 24px -10px rgba(0,0,0,.35); }
.btn-white:hover { background: #f8fafc; color: #1d4ed8; }
.btn-lg { padding: 13px 22px; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: 6px 12px; font-size: .84rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; margin-bottom: 7px; font-size: .95rem; }
.form-label .req { color: var(--danger); }
.form-control {
    width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: #fff;
    font-family: inherit; font-size: 1rem; color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.6 4.6a.5.5 0 0 1 .7 0L8 10.3l5.7-5.7a.5.5 0 0 1 .7.7l-6 6a.5.5 0 0 1-.7 0l-6-6a.5.5 0 0 1 0-.7z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.form-control-sm { padding: 8px 11px; font-size: .92rem; border-radius: 10px; }
.form-hint { font-size: .84rem; color: var(--text-2); margin-top: 6px; }
.form-hint.thai-preview { color: var(--primary-700); font-weight: 500; min-height: 1.3em; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 1.1rem; }
.input-icon > .form-control { padding-left: 44px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.section-title { display: flex; align-items: center; gap: 12px; font-size: 1.08rem; font-weight: 600; margin: 0 0 16px; }
.step-no {
    width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: .95rem;
    background: var(--primary-50); color: var(--primary);
}
.form-section + .form-section { border-top: 1px dashed var(--border); padding-top: 24px; margin-top: 8px; }

/* Leave type radio cards */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.type-option { position: relative; cursor: pointer; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option .box {
    display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 14px; border: 2px solid var(--border);
    background: #fff; transition: all .2s var(--ease); height: 100%;
}
.type-option .box i { font-size: 1.5rem; color: var(--c); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 12%, #fff); }
.type-option .box strong { font-size: .98rem; line-height: 1.35; }
.type-option .box small { color: var(--text-2); font-size: .82rem; }
.type-option:hover .box { border-color: color-mix(in srgb, var(--c) 45%, #fff); transform: translateY(-2px); }
.type-option input:checked + .box {
    border-color: var(--c); background: color-mix(in srgb, var(--c) 6%, #fff);
    box-shadow: 0 10px 24px -14px var(--c);
}
.type-option input:checked + .box::after {
    content: '\F26A'; font-family: 'bootstrap-icons'; position: absolute; top: 12px; right: 12px; color: var(--c); font-size: 1.3rem;
}
.type-option input:focus-visible + .box { outline: 3px solid var(--primary-100); }
.type-option.disabled { opacity: .5; pointer-events: none; }

/* Segmented control */
.segmented { display: inline-flex; background: #f1f5f9; padding: 4px; border-radius: 12px; gap: 4px; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { display: none; }
.segmented span { display: block; padding: 8px 16px; border-radius: 9px; font-weight: 500; color: var(--text-2); transition: all .2s; }
.segmented input:checked + span { background: #fff; color: var(--primary-700); box-shadow: var(--shadow-sm); }
.segmented.is-disabled { opacity: .5; pointer-events: none; }

/* Upload */
.dropzone {
    display: flex; align-items: center; gap: 16px; padding: 18px; border: 2px dashed var(--border); border-radius: 14px;
    cursor: pointer; transition: all .2s; background: #fafbfe;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-50); }
.dropzone i { font-size: 2rem; color: var(--primary); }
.dropzone input { display: none; }

/* Summary box */
.summary-days { text-align: center; padding: 22px; border-radius: 16px; background: linear-gradient(135deg, var(--primary-50), #f5f3ff); margin-bottom: 18px; }
.summary-days .num { font-size: 3rem; font-weight: 700; line-height: 1; color: var(--primary); }
.summary-days .unit { font-weight: 500; color: var(--text-2); }
.summary-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.summary-list li { display: flex; justify-content: space-between; gap: 10px; font-size: .93rem; }
.summary-list li span:first-child { color: var(--text-2); }
.summary-list li span:last-child { font-weight: 600; text-align: right; }

/* ---------- Bento Stat cards ---------- */
.stat {
    padding: 20px 22px; display: flex; align-items: center; gap: 16px;
    position: relative; overflow: hidden;
    transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.stat::before {
    content: ''; position: absolute; top: 0; left: 20px; width: 72px; height: 4px;
    border-radius: 0 0 4px 4px; background: var(--primary);
}
.grid > .stat:nth-child(1)::before { background: #2563eb; }
.grid > .stat:nth-child(2)::before { background: #16a34a; }
.grid > .stat:nth-child(3)::before { background: #0284c7; }
.grid > .stat:nth-child(4)::before { background: #dc2626; }
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #cbd5e1; }
.stat-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; color: var(--text); }
.stat-label { color: var(--text-2); font-size: .88rem; font-weight: 500; margin-top: 2px; }
.bg-primary-soft { background: var(--primary-50); color: var(--primary); }
.bg-success-soft { background: var(--success-50); color: var(--success); }
.bg-warning-soft { background: var(--warning-50); color: var(--warning); }
.bg-danger-soft { background: var(--danger-50); color: var(--danger); }
.bg-info-soft { background: var(--info-50); color: var(--info); }
.bg-purple-soft { background: var(--purple-50); color: var(--purple); }

/* Quota */
.quota-list { display: grid; gap: 16px; }
.quota-item { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center; }
.quota-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); flex-shrink: 0; }
.quota-top { margin-bottom: 6px; }
.quota-top strong { font-weight: 600; font-size: .95rem; line-height: 1.35; color: var(--text); display: block; }
.progress { height: 9px; border-radius: 99px; background: #eef1f6; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; background: var(--c); border-radius: 99px; transform-origin: left; animation: grow 1s var(--ease) both; }
.progress > span.pending { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--c) 45%, #fff) 0 6px, color-mix(in srgb, var(--c) 25%, #fff) 6px 12px); border-radius: 0 99px 99px 0; }

/* ---------- Badges ---------- */
.badge-status {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: .84rem; font-weight: 600; white-space: nowrap;
}
.st-pending { background: var(--warning-50); color: #b45309; box-shadow: inset 0 0 0 1px #fde68a; }
.st-approved { background: var(--success-50); color: var(--success); box-shadow: inset 0 0 0 1px #a7f3d0; }
.st-rejected { background: var(--danger-50); color: var(--danger); box-shadow: inset 0 0 0 1px #fecaca; }
.st-cancelled { background: #f1f5f9; color: #64748b; box-shadow: inset 0 0 0 1px #e2e8f0; }
.type-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 8px; font-size: .86rem; font-weight: 500;
    color: color-mix(in srgb, var(--c) 80%, #000); background: color-mix(in srgb, var(--c) 11%, #fff); white-space: nowrap;
}
.badge { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: .78rem; font-weight: 600; background: #f1f5f9; color: var(--text-2); }
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-amber { background: #fef3c7; color: #92400e; }

.avatar {
    --h: 240; width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; flex-shrink: 0;
    font-weight: 700; font-size: 1.05rem; color: hsl(var(--h) 60% 30%); background: hsl(var(--h) 80% 90%);
}
.sidebar .avatar { color: #1e1b4b; background: hsl(var(--h) 85% 85%); }
.avatar.lg { width: 72px; height: 72px; font-size: 1.8rem; border-radius: 20px; }
.avatar.sm { width: 32px; height: 32px; font-size: .9rem; border-radius: 10px; }

/* ---------- Tables ---------- */
.table-wrap, .table-responsive {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    border-radius: inherit;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.table-wrap::-webkit-scrollbar {
    height: 6px;
}
.table-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 99px;
}
.table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}
.table-wrap::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th {
    text-align: left; font-weight: 600; color: var(--text-2); font-size: .83rem; padding: 12px 16px; background: #f8fafc;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid #f1f4f9; vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #fafbff; }
.table tr:last-child td { border-bottom: 0; }
.table .person { display: flex; align-items: center; gap: 12px; }
.table .person strong { display: block; font-weight: 600; }
.table .person small { color: var(--text-2); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-sm td, .table-sm th { padding: 9px 12px; }

/* ---------- Alerts ---------- */
.alert {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px; margin-bottom: 18px;
    font-weight: 500; animation: slideDown .4s var(--ease) both;
}
.alert i { font-size: 1.25rem; }
.alert-success { background: var(--success-50); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-50); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--info-50); color: #075985; border: 1px solid #bae6fd; }
.alert-warning { background: var(--warning-50); color: #92400e; border: 1px solid #fde68a; }
.alert-close { margin-left: auto; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: inherit; opacity: .6; line-height: 1; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty i { font-size: 3rem; color: var(--primary-100); display: block; margin-bottom: 10px; }
.empty h3 { color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

/* ---------- Tabs / Filters ---------- */
.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 1px;
}
.tabs::-webkit-scrollbar {
    height: 0px;
    display: none;
}
.tab { padding: 12px 18px; font-weight: 600; color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-color: var(--primary); }
.tab .count { background: var(--primary-50); color: var(--primary); border-radius: 99px; font-size: .78rem; padding: 1px 9px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .form-group { margin: 0; min-width: 170px; }

/* ---------- List items ---------- */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid #f1f4f9; color: inherit; transition: background .15s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #fafbff; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta strong { display: block; font-weight: 600; }
.list-item .meta small { color: var(--text-2); }

/* ---------- Approval cards ---------- */
.approval-card { padding: 22px; display: grid; gap: 16px; transition: box-shadow .25s; }
.approval-card:hover { box-shadow: var(--shadow); }
.approval-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.approval-head .who { flex: 1; min-width: 180px; }
.approval-head .who strong { display: block; font-size: 1.05rem; }
.approval-head .who small { color: var(--text-2); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; background: #f8fafc; border-radius: 14px; padding: 16px; }
.info-grid .lbl { font-size: .8rem; color: var(--text-2); display: block; }
.info-grid .val { font-weight: 600; }
.reason-box { padding: 14px 16px; border-left: 4px solid var(--primary-100); background: #fcfcff; border-radius: 0 12px 12px 0; color: var(--text); }
.approval-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Detail */
.detail-list { display: grid; grid-template-columns: 180px 1fr; gap: 14px 20px; margin: 0; }
.detail-list dt { color: var(--text-2); }
.detail-list dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 22px 40px; }
.timeline li::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; color: #fff; background: var(--text-3); }
.timeline .dot.ok { background: var(--success); }
.timeline .dot.no { background: var(--danger); }
.timeline .dot.wait { background: var(--accent); }
.timeline .dot.info { background: var(--primary); }
.timeline strong { display: block; }
.timeline small { color: var(--text-2); }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-head { padding: 10px; text-align: center; font-weight: 600; font-size: .85rem; color: var(--text-2); background: #f8fafc; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 116px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fff; display: flex; flex-direction: column; gap: 4px; }
.cal-day.other { background: #fafbfd; }
.cal-day.other .cal-num { color: var(--text-3); }
.cal-day.weekend { background: #fbfbfe; }
.cal-day.holiday { background: #fff7ed; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .9rem; }
.cal-holiday { font-size: .72rem; color: #c2410c; font-weight: 500; line-height: 1.3; }
.cal-ev {
    font-size: .76rem; padding: 3px 7px; border-radius: 6px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: color-mix(in srgb, var(--c) 80%, #000); background: color-mix(in srgb, var(--c) 13%, #fff); border-left: 3px solid var(--c);
}
.cal-ev.pending { opacity: .7; border-left-style: dashed; }
.cal-more { font-size: .75rem; color: var(--text-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); display: inline-block; }

/* ---------- Charts ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 220px; padding-top: 20px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar { width: 100%; max-width: 44px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, #818cf8, var(--primary)); position: relative; min-height: 4px; transform-origin: bottom; animation: growY .9s var(--ease) both; }
.bar:hover { filter: brightness(1.1); }
.bar span { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: .78rem; font-weight: 600; color: var(--text-2); }
.bar-col small { font-size: .78rem; color: var(--text-2); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); }
.modal.open { display: flex; animation: fadeIn .2s both; }
.modal-dialog { background: #fff; border-radius: 22px; padding: 28px; width: 100%; max-width: 520px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.35); animation: pop .3s var(--ease) both; }
.modal-sm { max-width: 400px; text-align: center; }
.modal-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 2rem; background: var(--primary-50); color: var(--primary); }
.modal-title { font-size: 1.15rem; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal-sm .modal-actions { justify-content: center; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-visual {
    position: relative; overflow: hidden; padding: 48px; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
    background:
        radial-gradient(60% 50% at 100% 0%, rgba(251, 191, 36, .35) 0%, transparent 60%),
        radial-gradient(60% 60% at 0% 100%, rgba(236, 72, 153, .3) 0%, transparent 60%),
        linear-gradient(140deg, #1e1b4b 0%, #3730a3 50%, #6d28d9 100%);
}
.login-visual .illus { width: 100%; max-width: 520px; margin: 24px auto; border-radius: 28px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); animation: float 6s ease-in-out infinite; }
.login-visual h2 { font-size: 2rem; font-weight: 700; }
.login-visual p { color: #c7d2fe; margin: 8px 0 0; font-size: 1.05rem; }
.login-feats { display: flex; gap: 12px; flex-wrap: wrap; }
.login-feats span { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); padding: 8px 14px; border-radius: 999px; font-size: .9rem; display: inline-flex; gap: 8px; align-items: center; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 420px; animation: fadeUp .6s var(--ease) both; }
.login-card h1 { font-size: 1.8rem; font-weight: 700; margin: 18px 0 6px; }
.demo-box { margin-top: 26px; padding: 16px; border-radius: 14px; background: #fff; border: 1px dashed var(--border); }
.demo-box .demo-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.demo-btn { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fafbfe; cursor: pointer; font-family: inherit; transition: all .2s; }
.demo-btn:hover { border-color: var(--primary); background: var(--primary-50); }
.demo-btn strong { display: block; font-size: .88rem; }
.demo-btn small { color: var(--text-2); font-size: .78rem; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 1.15rem; color: var(--text-3); cursor: pointer; padding: 6px; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .5); } 50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.sidebar-close { display: none; background: rgba(255,255,255,.1); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 10px; font-size: 1.1rem; cursor: pointer; place-items: center; transition: background .2s; }
.sidebar-close:hover { background: rgba(255,255,255,.2); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Responsive (Mobile & iPad / Tablet) ---------- */
/* ---------- Responsive (Mobile, Tablet, iPad & Laptop) ---------- */
@media (max-width: 1280px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: 1fr; }
    .sticky { position: static; }
    .admin-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .sidebar { position: fixed; z-index: 1000; transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,.35); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 990; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); }
    .sidebar-close { display: grid; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-grid; z-index: 50; }
    .topbar { padding: 12px 20px; }
    .content { padding: 20px 20px 32px; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .topbar .chip:not(.chip-primary) { display: none; }
    .cal { font-size: 0.85rem; }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }
    .page-header h1 {
        font-size: 1.4rem;
    }
    .page-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .page-actions .btn {
        flex: 1 1 calc(50% - 4px);
    }
    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .filters .form-group {
        width: 100%;
        min-width: 0 !important;
    }
    .filters .btn,
    .filters a.btn {
        width: 100%;
        text-align: center;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .approval-head {
        align-items: flex-start;
    }
    .approval-actions {
        display: flex;
        width: 100%;
        gap: 8px;
        flex-wrap: wrap;
    }
    .approval-actions .btn {
        flex: 1 1 calc(50% - 4px);
    }
    .approval-actions a.btn-light {
        flex: 1 1 100%;
    }
    .table {
        min-width: 600px;
    }
    .modal {
        padding: 12px;
    }
    .modal-dialog {
        padding: 22px 18px;
        max-height: 92vh;
        overflow-y: auto;
    }
    .card-header {
        padding: 14px 18px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .card-body {
        padding: 18px 16px;
    }
}

@media (max-width: 640px) {
    .content { padding: 16px 14px 28px; }
    .topbar { padding: 10px 14px; }
    .topbar-title {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.98rem;
    }
    .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
    .admin-card-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .admin-action-card { padding: 14px 10px; border-radius: 14px; }
    .admin-action-card i { font-size: 22px; margin-bottom: 6px; }
    .admin-action-card strong { font-size: 0.88rem; }
    .admin-action-card small { font-size: 0.72rem; }
    .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
    .stat-icon { width: 44px; height: 44px; font-size: 1.25rem; border-radius: 12px; }
    .stat-value { font-size: 1.45rem; }
    .hero { padding: 20px; }
    .hero h1 { font-size: 1.28rem; }
    .page-header h1 { font-size: 1.25rem; }
    .card-header h2, .card-header h3 { font-size: 1rem; }
    .detail-list { grid-template-columns: 1fr; gap: 2px; }
    .detail-list dd { margin-bottom: 10px; }
    .cal-day { min-height: 70px; padding: 4px; }
    .cal-ev { font-size: 0; padding: 0; height: 6px; border-left-width: 0; background: var(--c); }
    .cal-holiday { display: none; }
    .topbar .chip-primary { display: none; }
    .demo-box .demo-list { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
    .btn { padding: 9px 16px; font-size: 0.92rem; }
    .tab { padding: 10px 14px; font-size: 0.88rem; }
    .type-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 420px) {
    .content { padding: 12px 10px 24px; }
    .topbar-title { max-width: 140px; }
    .info-grid { grid-template-columns: 1fr; gap: 8px; }
    .approval-actions .btn { flex: 1 1 100%; }
    .btn-lg { padding: 12px 18px; font-size: 0.95rem; }
    .modal-dialog { padding: 18px 14px; }
    .admin-card-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* =========================================================
   Smooth Loaders & SweetAlert2 Custom Styling
   ========================================================= */

/* ---------- 1. Minimalist Top Progress Bar & Skeleton Loading (Big-Platform Style) ---------- */
.page-loader {
    position: fixed;
    top: 64px;
    left: var(--sidebar-w);
    right: 0;
    bottom: 0;
    z-index: 25;
    background: var(--bg);
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: all;
}

.page-loader.page-loader-minimal {
    top: 0;
    left: 0;
    bottom: auto;
    height: 4px;
    background: transparent;
    pointer-events: none;
}
.page-loader.page-loader-minimal .sk-workspace {
    display: none !important;
}
body.sidebar-collapsed .page-loader:not(.page-loader-minimal) {
    left: 82px;
}

.page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Slim Top Progress Bar (YouTube / GitHub / Linear style) */
.nprogress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 999999;
    background: linear-gradient(90deg, #2563eb 0%, #38bdf8 50%, #2563eb 100%);
    background-size: 200% 100%;
    animation: nprogressSlide 1s linear infinite;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.65);
}

@keyframes nprogressSlide {
    0% { background-position: 200% 0; }
    100% { background-position: 0% 0; }
}

/* Subtle Top-Right Status Pill */
.page-loader-pill {
    position: fixed;
    top: 14px;
    right: 24px;
    z-index: 999999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.80rem;
    font-weight: 600;
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.pill-spinner {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #38bdf8;
    animation: spinLoader 0.65s linear infinite;
}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}

/* Skeleton Workspace Layout */
.sk-workspace {
    padding: 24px 28px 44px;
    width: 100%;
    max-width: 100%;
}

.sk-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.sk-box {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skShimmer 1.35s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.sk-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 22px 26px;
}

.sk-row { display: flex; align-items: center; gap: 10px; }
.sk-col { display: flex; flex-direction: column; }

.sk-w-20 { width: 20%; }
.sk-w-35 { width: 35%; }
.sk-w-40 { width: 40%; }
.sk-w-45 { width: 45%; }
.sk-w-50 { width: 50%; }
.sk-w-60 { width: 60%; }
.sk-w-65 { width: 65%; }
.sk-w-70 { width: 70%; }
.sk-w-80 { width: 80%; }
.sk-w-100 { width: 100%; }

.sk-h-8  { height: 8px; }
.sk-h-10 { height: 10px; }
.sk-h-12 { height: 12px; }
.sk-h-14 { height: 14px; }
.sk-h-18 { height: 18px; }
.sk-h-24 { height: 24px; }
.sk-h-28 { height: 28px; }

.sk-btn { width: 130px; height: 40px; border-radius: 12px; }
.sk-icon { width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0; }
.sk-icon-sm { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
.sk-avatar { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
.sk-pill { width: 92px; height: 26px; border-radius: 99px; flex-shrink: 0; }
.sk-action { width: 68px; height: 30px; border-radius: 8px; flex-shrink: 0; }

.sk-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.sk-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sk-grid-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.sk-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.sk-table-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid #f8fafc;
}
.sk-table-row:last-child { border-bottom: 0; }

.sk-quota-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 1280px) {
    .sk-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sk-grid-main { grid-template-columns: 1fr; }
    .sk-hide-md { display: none; }
}
@media (max-width: 1024px) {
    .page-loader { left: 0; top: 60px; }
    .sk-workspace { padding: 18px 20px; }
}
@media (max-width: 640px) {
    .sk-workspace { padding: 14px; }
    .sk-header-bar .sk-row { display: none; }
    .sk-hide-sm { display: none; }
    .sk-grid-4 { gap: 10px; }
    .sk-stat-card { padding: 14px; }
}

/* ---------- 2. Button Spinner & Loading State ---------- */
.btn {
    position: relative;
}

.btn.is-loading {
    pointer-events: none !important;
    cursor: wait !important;
    opacity: 0.85 !important;
    position: relative;
}

.btn.is-loading > *:not(.btn-spinner) {
    visibility: hidden;
    opacity: 0;
}

.btn-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.18rem;
    height: 1.18rem;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spinLoader 0.65s linear infinite;
}

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

.btn-light.is-loading .btn-spinner,
.btn-soft.is-loading .btn-spinner,
.btn-outline.is-loading .btn-spinner {
    border-color: rgba(2, 132, 199, 0.25);
    border-top-color: var(--primary);
}

.btn-soft-danger.is-loading .btn-spinner {
    border-color: rgba(220, 38, 38, 0.25);
    border-top-color: var(--danger);
}

/* ---------- 3. SweetAlert2 Custom Styling ---------- */
.swal2-container:not(.swal2-backdrop-hide) {
    z-index: 100000 !important;
}

/* ใส่เบลอเฉพาะ Modal Pop-up ปกติเท่านั้น หากเป็น Toast ต้องไม่ทำให้หน้าจอเบลอเด็ดขาด */
body:not(.swal2-toast-shown) .swal2-container.swal2-backdrop-show {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.swal2-toast-shown .swal2-container {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: transparent !important;
    pointer-events: none;
}
body.swal2-toast-shown .swal2-toast {
    pointer-events: auto;
}

.swal2-popup {
    font-family: var(--font) !important;
    border-radius: 22px !important;
    padding: 24px 20px !important;
    box-shadow: 0 24px 50px -12px rgba(15, 23, 42, 0.28) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
}

.swal2-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    padding-top: 8px !important;
}

.swal2-html-container {
    font-size: 0.95rem !important;
    color: var(--text-2) !important;
    line-height: 1.6 !important;
    margin: 12px 14px 0 !important;
}

.swal2-actions {
    margin-top: 22px !important;
    gap: 10px !important;
}

.swal2-actions .swal2-styled {
    border-radius: 12px !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    padding: 10px 22px !important;
    transition: all 0.2s var(--ease) !important;
    box-shadow: none !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%) !important;
    color: #fff !important;
    border: none !important;
}

.swal2-confirm:hover {
    box-shadow: 0 6px 16px -4px rgba(2, 132, 199, 0.45) !important;
    transform: translateY(-1px);
}

.swal2-cancel {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}

.swal2-cancel:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
}

/* SweetAlert2 Toast */
.swal2-toast {
    box-shadow: 0 12px 30px -6px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    border-radius: 14px !important;
    padding: 12px 18px !important;
    background: #ffffff !important;
}

.swal2-toast .swal2-title {
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    padding: 0 !important;
    color: var(--text) !important;
}

/* =========================================================
   4. Bento Bot Control Widget & Mobile Bottom Navigation
   ========================================================= */
.bento-bot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bento-bot-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.bento-bot-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.bento-bot-pill {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    flex-shrink: 0;
}
.bento-bot-desc {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}
.bento-tg-bar {
    margin-top: 12px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.bento-tg-bar strong {
    display: block;
    font-size: 0.84rem;
    color: #38bdf8;
}
.bento-tg-bar small {
    display: block;
    font-size: 0.76rem;
    color: #cbd5e1;
    margin-top: 2px;
}

/* Mobile Floating Bottom Navigation Bar (from Mobile UI Redesign) */
.mobile-bottom-nav {
    display: none;
}
@media (max-width: 768px) {
    .topbar-quick-btns {
        display: none !important;
    }
    body {
        padding-bottom: 76px;
    }
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 10px;
        z-index: 950;
        background: rgba(15, 23, 42, 0.94);
        backdrop-filter: saturate(180%) blur(16px);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 22px;
        padding: 6px 8px;
        box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.45);
        justify-content: space-around;
        align-items: center;
    }
    .mobile-bottom-nav a,
    .mobile-bottom-nav button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 4px;
        color: #94a3b8;
        font-size: 0.70rem;
        font-weight: 600;
        text-decoration: none;
        background: none;
        border: none;
        border-radius: 14px;
        cursor: pointer;
        font-family: inherit;
        transition: all 0.2s;
    }
    .mobile-bottom-nav a i,
    .mobile-bottom-nav button i {
        font-size: 1.15rem;
        line-height: 1;
    }
    .mobile-bottom-nav a.active {
        color: #38bdf8;
        background: rgba(56, 189, 248, 0.12);
    }
    .mobile-bottom-nav a.nav-cta-center {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        color: #ffffff;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
        padding: 7px 6px;
    }
}


