:root {
    --glass-bg: linear-gradient(145deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.12) 100%);
    --glass-border: rgba(255,255,255,0.35);
    --glass-border-top: rgba(255,255,255,0.65);
    --glass-shadow:
        0 1px 2px  rgba(0,0,0,0.10),
        0 4px 10px rgba(0,0,0,0.16),
        0 12px 32px rgba(0,0,0,0.26),
        0 40px 80px rgba(0,0,0,0.36);
    --glass-inset:
        inset 0 1.5px 0 rgba(255,255,255,0.78),
        inset 1px 0 0  rgba(255,255,255,0.16),
        inset -1px 0 0 rgba(255,255,255,0.06),
        inset 0 -1px 0 rgba(255,255,255,0.06);
    --accent:  #38bdf8;
    --accent2: #34d399;
    --radius-lg: 20px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --blur-lg: blur(48px) saturate(2) brightness(1.1);
    --blur-md: blur(28px) saturate(1.8);
    --blur-sm: blur(16px) saturate(1.6);
}

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

body {
    font-family: 'Sarabun', sans-serif;
    background: linear-gradient(135deg, #04111f 0%, #071e3d 35%, #0a2a52 65%, #082d5c 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 24px 16px;
    color: #1e293b;
}

/* Static subtle glow accents (no animation) */
body::before {
    content: '';
    position: fixed;
    width: 600px; height: 600px;
    top: -200px; left: -120px;
    background: radial-gradient(circle at 42% 42%,
        rgba(29,78,216,0.25) 0%,
        rgba(30,58,138,0.12) 52%,
        transparent 74%);
    filter: blur(80px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    width: 500px; height: 500px;
    bottom: -120px; right: -80px;
    background: radial-gradient(circle at 58% 58%,
        rgba(8,145,178,0.20) 0%,
        rgba(14,116,144,0.10) 52%,
        transparent 74%);
    filter: blur(70px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* ===== GLASS SYSTEM ===== */
.glass {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-lg);
    -webkit-backdrop-filter: var(--blur-lg);
    border: 1px solid var(--glass-border);
    border-top-color: var(--glass-border-top);
    box-shadow: var(--glass-shadow), var(--glass-inset);
    border-radius: var(--radius-lg);
}
.glass::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, transparent 50%);
    pointer-events: none;
}

.glass-sm {
    background: linear-gradient(145deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.10) 100%);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border: 1px solid rgba(255,255,255,0.18);
    border-top-color: rgba(255,255,255,0.45);
    box-shadow:
        0 2px 8px rgba(0,0,0,0.10),
        inset 0 1px 0 rgba(255,255,255,0.50);
    border-radius: var(--radius-sm);
}

.glass-btn {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.10) 100%);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border: 1px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.65);
    box-shadow:
        0 1px 2px  rgba(0,0,0,0.08),
        0 4px 12px rgba(0,0,0,0.14),
        inset 0 1.5px 0 rgba(255,255,255,0.52);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Sarabun', sans-serif;
    font-weight: 600;
}
.glass-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, transparent 50%);
    pointer-events: none;
}
.glass-btn:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.30) 0%, rgba(255,255,255,0.16) 100%);
    border-top-color: rgba(255,255,255,0.75);
    box-shadow:
        0 2px 6px  rgba(0,0,0,0.10),
        0 8px 24px rgba(0,0,0,0.18),
        inset 0 1.5px 0 rgba(255,255,255,0.65);
    transform: translateY(-2px);
}
.glass-btn:active {
    transform: translateY(0px) scale(0.98);
    box-shadow:
        0 1px 3px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.40);
}

.glass-input {
    background: rgba(255,255,255,0.14);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border: 1px solid rgba(255,255,255,0.20);
    border-top-color: rgba(255,255,255,0.40);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    color: #0f172a;
    width: 100%;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.glass-input::placeholder { color: rgba(255,255,255,0.50); }
.glass-input:focus {
    outline: none;
    background: rgba(255,255,255,0.26);
    border-color: rgba(255,255,255,0.45);
    border-top-color: rgba(255,255,255,0.70);
    box-shadow:
        inset 0 1px 2px rgba(0,0,0,0.04),
        0 0 0 3px rgba(255,255,255,0.14);
}

/* ===== LAYOUT ===== */
.container { max-width: 1100px; margin: 0 auto; }

header { text-align: center; margin-bottom: 32px; }
header h1 {
    font-family: 'Kanit', sans-serif;
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 1px 0  rgba(255,255,255,0.25),
        0 2px 12px rgba(0,0,0,0.30),
        0 8px 32px rgba(0,0,0,0.20);
    letter-spacing: 0.5px;
}
header p {
    color: rgba(255,255,255,0.68);
    margin-top: 6px;
    font-size: 15px;
    text-shadow: 0 1px 6px rgba(0,0,0,0.20);
}

.main-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 768px) {
    .main-grid { grid-template-columns: 1fr; }
}

/* ===== LEFT PANEL ===== */
.left-panel { padding: 24px; }
.panel-title {
    font-family: 'Kanit', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: rgba(255,255,255,0.95);
    border-bottom: 1px solid rgba(255,255,255,0.28);
    padding-bottom: 12px;
    margin-bottom: 18px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    background: linear-gradient(145deg, rgba(56,189,248,0.90), rgba(14,165,233,0.75));
    border: 1px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.65);
    box-shadow: 0 2px 8px rgba(14,165,233,0.40), inset 0 1px 0 rgba(255,255,255,0.45);
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin-right: 8px;
}

/* Drop zone */
.drop-zone {
    border: 1.5px dashed rgba(255,255,255,0.35);
    border-radius: var(--radius-md);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.28s ease;
    background: rgba(255,255,255,0.06);
}
.drop-zone:hover, .drop-zone.dragover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.75);
    border-style: solid;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.30), 0 4px 16px rgba(0,0,0,0.10);
}
.drop-icon { font-size: 36px; margin-bottom: 8px; }
.drop-zone p { font-size: 13px; color: rgba(255,255,255,0.85); font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.drop-zone small { font-size: 11px; color: rgba(255,255,255,0.62); }

.format-hint {
    background: rgba(255,255,255,0.22);
    border: 1px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.55);
    border-radius: 10px;
    padding: 8px 10px;
    margin-top: 10px;
    font-size: 11px;
    color: rgba(255,255,255,0.88);
    line-height: 1.6;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.40);
}
.format-hint strong { display: block; margin-bottom: 4px; }

.divider {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    margin: 14px 0;
    position: relative;
}
.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.30));
}
.divider::before { left: 0; }
.divider::after { right: 0; transform: scaleX(-1); }

/* Staff preview */
.staff-preview-box {
    background: rgba(255,255,255,0.88);
    border-radius: var(--radius-sm);
    max-height: 180px;
    overflow-y: auto;
    padding: 8px;
    margin-top: 8px;
    border: 1px solid rgba(255,255,255,0.60);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

/* History Area */
.history-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.62) 100%);
    border: 1px solid rgba(255,255,255,0.45);
    border-top-color: rgba(255,255,255,0.75);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 8px;
    transition: all 0.20s ease;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.80);
}
.history-card:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.96) 0%, rgba(255,255,255,0.88) 100%);
    transform: translateY(-1px) scale(1.015);
    border-top-color: rgba(255,255,255,1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,1);
}
.history-card .meta { font-size: 10px; color: #64748b; margin-bottom: 4px; }
.history-card .title { font-size: 12px; font-weight: 700; color: #1e293b; line-height: 1.3; }

.freq-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    margin-right: 4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.60);
}
.freq-day  { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.freq-night{ background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }

.staff-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(226,232,240,0.80);
}
.staff-item:last-child { border-bottom: none; }
.staff-name { font-size: 12px; font-weight: 600; color: #1e293b; }
.staff-sub  { font-size: 10px; color: #64748b; }
.badge-m { background: #dbeafe; color: #1d4ed8; padding: 2px 7px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.badge-f { background: #fce7f3; color: #be185d; padding: 2px 7px; border-radius: 20px; font-size: 10px; font-weight: 700; }

/* Demo data button */
.demo-btn { width: 100%; padding: 9px; font-size: 13px; color: #0f172a; margin-top: 10px; }

/* ===== RIGHT PANEL ===== */
.right-panel-wrap { display: flex; flex-direction: column; gap: 20px; }
.right-panel { padding: 24px; }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}
@media (max-width: 600px) { .settings-grid { grid-template-columns: 1fr; } }

label.field-label {
    display: block;
    font-size: 13px;
    font-weight: 800 !important;
    color: #ffffff !important;
    margin-bottom: 6px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.50), 0 0 12px rgba(0,0,0,0.20);
    letter-spacing: 0.2px;
}

.gen-btn {
    background: linear-gradient(145deg, rgba(52,211,153,0.82) 0%, rgba(16,185,129,0.70) 100%);
    border: 1px solid rgba(255,255,255,0.30);
    border-top-color: rgba(255,255,255,0.60);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: 'Kanit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    padding: 10px;
    width: 100%;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 1px 4px rgba(0,0,0,0.20);
    box-shadow:
        0 4px 14px rgba(16,185,129,0.30),
        0 12px 28px rgba(16,185,129,0.18),
        inset 0 1.5px 0 rgba(255,255,255,0.50);
    height: 42px;
}
.gen-btn:hover {
    background: linear-gradient(145deg, rgba(52,211,153,0.96) 0%, rgba(16,185,129,0.88) 100%);
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(16,185,129,0.38),
        0 16px 40px rgba(16,185,129,0.22),
        inset 0 1.5px 0 rgba(255,255,255,0.60);
}

.rules-box {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.20);
    border-top-color: rgba(255,255,255,0.40);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 12.5px;
    color: rgba(255,255,255,0.85);
    line-height: 1.7;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.rules-box strong { font-weight: 700; color: #fff; }
.rules-box ul { margin-left: 18px; }

/* ===== TABLE AREA ===== */
.table-wrap {
    background: rgba(255,255,255,0.90);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-md);
    overflow-x: auto;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
    background: linear-gradient(180deg, #1e3a5f 0%, #152d4a 100%);
    padding: 12px 10px;
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #ffffff;
    border-bottom: 2px solid #0f2240;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.30);
}
thead th:first-child { border-top-left-radius: 8px; }
thead th:last-child  { border-top-right-radius: 8px; }
tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(226,232,240,0.80);
    color: #1e293b;
    vertical-align: middle;
}
tbody tr:hover { background: rgba(56,189,248,0.07) !important; }

.row-weekend-day   td { background: rgba(254,243,199,0.65); }
.row-weekend-night td { background: rgba(254,215,170,0.45); }
.row-weekday       td { background: rgba(219,234,254,0.38); }

.shift-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.60);
}
.shift-day          { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.shift-night        { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.shift-weekday-night{ background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }

.sign-cell { text-align: center; min-width: 80px; border-bottom: 1px solid #94a3b8; height: 32px; }

/* Paginator */
.glass-btn:disabled { opacity: 0.45; pointer-events: none; }
.page-hidden { display: none; }

/* Toast */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; }
.toast {
    background: linear-gradient(145deg, rgba(10,20,40,0.92) 0%, rgba(15,23,42,0.96) 100%);
    backdrop-filter: blur(32px) saturate(2);
    -webkit-backdrop-filter: blur(32px) saturate(2);
    color: #fff;
    padding: 11px 18px;
    border-radius: 12px;
    margin-top: 8px;
    font-size: 13px;
    font-family: 'Sarabun', sans-serif;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255,255,255,0.12);
    border-top-color: rgba(255,255,255,0.28);
    border-left: 4px solid #38bdf8;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.22),
        0 12px 32px rgba(0,0,0,0.16),
        inset 0 1px 0 rgba(255,255,255,0.14);
    min-width: 220px;
}
.toast.error { border-left-color: #f87171; }
.toast.show  { transform: translateX(0); opacity: 1; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: linear-gradient(160deg, rgba(248,250,255,0.97) 0%, rgba(241,245,255,0.96) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255,255,255,0.90);
    border-top-color: rgba(255,255,255,1);
    border-radius: 24px;
    padding: 32px 28px;
    width: 100%;
    max-width: 390px;
    box-shadow:
        0 8px 24px  rgba(0,0,0,0.14),
        0 32px 80px rgba(0,0,0,0.28),
        inset 0 1.5px 0 rgba(255,255,255,1);
    position: relative;
}
.modal-box h3 {
    font-family: 'Kanit', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    letter-spacing: -0.2px;
}
.modal-box label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 5px;
    margin-top: 14px;
}
.modal-box label:first-of-type { margin-top: 0; }
.modal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    color: #0f172a;
    background: rgba(248,250,255,0.80);
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.modal-input:focus {
    outline: none;
    border-color: #38bdf8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(56,189,248,0.18), inset 0 1px 2px rgba(0,0,0,0.03);
}
.modal-error { font-size: 12px; color: #ef4444; margin-top: 8px; min-height: 18px; font-weight: 500; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.btn-primary {
    flex: 1;
    padding: 11px;
    background: linear-gradient(145deg, #0ea5e9, #0369a1);
    border: 1px solid rgba(255,255,255,0.20);
    border-top-color: rgba(255,255,255,0.40);
    color: #fff;
    border-radius: 10px;
    font-family: 'Kanit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.20s ease;
    box-shadow: 0 4px 14px rgba(3,105,161,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
    text-shadow: 0 1px 2px rgba(0,0,0,0.20);
}
.btn-primary:hover {
    background: linear-gradient(145deg, #38bdf8, #0ea5e9);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(14,165,233,0.42), inset 0 1px 0 rgba(255,255,255,0.30);
}
.btn-secondary {
    padding: 11px 18px;
    background: rgba(241,245,249,0.90);
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}
.btn-secondary:hover { background: #e2e8f0; }

/* ===== ROLE SELECTION PAGE ===== */
.role-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
}
.role-card {
    width: 100%;
    max-width: 420px;
    padding: 52px 40px;
    text-align: center;
}
.role-card h1 {
    font-family: 'Kanit', sans-serif;
    font-size: 30px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    text-shadow:
        0 1px 0 rgba(255,255,255,0.20),
        0 2px 12px rgba(0,0,0,0.32),
        0 8px 28px rgba(0,0,0,0.22);
    letter-spacing: -0.3px;
}
.role-card p {
    color: rgba(255,255,255,0.65);
    font-size: 14px;
    margin-bottom: 44px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.20);
}
.role-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 20px 18px;
    border-radius: var(--radius-md);
    font-family: 'Kanit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 14px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.role-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.28) 0%, transparent 52%);
    pointer-events: none;
}
.role-btn-admin {
    background: linear-gradient(145deg, rgba(56,189,248,0.38) 0%, rgba(14,165,233,0.22) 100%);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.65);
    box-shadow:
        0 1px 2px  rgba(0,0,0,0.10),
        0 4px 12px rgba(14,165,233,0.20),
        0 12px 32px rgba(14,165,233,0.14),
        0 28px 48px rgba(0,0,0,0.22),
        inset 0 1.5px 0 rgba(255,255,255,0.55);
}
.role-btn-admin:hover {
    background: linear-gradient(145deg, rgba(56,189,248,0.55) 0%, rgba(14,165,233,0.38) 100%);
    border-top-color: rgba(255,255,255,0.80);
    transform: translateY(-3px);
    box-shadow:
        0 2px 4px  rgba(0,0,0,0.12),
        0 8px 20px rgba(14,165,233,0.30),
        0 20px 48px rgba(14,165,233,0.20),
        0 40px 72px rgba(0,0,0,0.28),
        inset 0 1.5px 0 rgba(255,255,255,0.65);
}
.role-btn-staff {
    background: linear-gradient(145deg, rgba(52,211,153,0.36) 0%, rgba(16,185,129,0.20) 100%);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.65);
    box-shadow:
        0 1px 2px  rgba(0,0,0,0.10),
        0 4px 12px rgba(16,185,129,0.18),
        0 12px 32px rgba(16,185,129,0.12),
        0 28px 48px rgba(0,0,0,0.22),
        inset 0 1.5px 0 rgba(255,255,255,0.52);
}
.role-btn-staff:hover {
    background: linear-gradient(145deg, rgba(52,211,153,0.52) 0%, rgba(16,185,129,0.36) 100%);
    border-top-color: rgba(255,255,255,0.78);
    transform: translateY(-3px);
    box-shadow:
        0 2px 4px  rgba(0,0,0,0.12),
        0 8px 20px rgba(16,185,129,0.28),
        0 20px 48px rgba(16,185,129,0.16),
        0 40px 72px rgba(0,0,0,0.28),
        inset 0 1.5px 0 rgba(255,255,255,0.62);
}
.role-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px; height: 28px;
}

/* ===== STAFF PAGE ===== */
.staff-page-wrap { max-width: 700px; margin: 0 auto; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.80);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 20px;
    transition: color 0.18s ease;
    text-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.back-link:hover { color: #fff; }
.staff-search-box { padding: 28px; margin-bottom: 20px; }
.staff-search-title {
    font-family: 'Kanit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.18), 0 2px 10px rgba(0,0,0,0.22);
}
.staff-search-sub { color: rgba(255,255,255,0.65); font-size: 13px; margin-bottom: 20px; }
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (max-width: 500px) { .summary-cards { grid-template-columns: 1fr; } }
.summary-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.10) 100%);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border: 1px solid rgba(255,255,255,0.18);
    border-top-color: rgba(255,255,255,0.50);
    border-radius: var(--radius-md);
    padding: 18px 12px;
    text-align: center;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.12),
        0 12px 32px rgba(0,0,0,0.10),
        inset 0 1.5px 0 rgba(255,255,255,0.55);
}
.summary-card .s-num {
    font-family: 'Kanit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.22);
}
.summary-card .s-label { font-size: 11px; color: rgba(255,255,255,0.72); margin-top: 6px; font-weight: 600; }
.no-schedule-msg {
    text-align: center;
    padding: 48px 20px;
    color: rgba(255,255,255,0.65);
    font-size: 14px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.no-schedule-msg .icon { font-size: 44px; margin-bottom: 14px; }

/* ===== FIXED NAV (admin) ===== */
.fixed-back-btn {
    position: fixed;
    top: 16px; left: 16px;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: linear-gradient(145deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.10) 100%);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border: 1px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.65);
    border-radius: 12px;
    color: #fff;
    font-family: 'Sarabun', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.20);
    box-shadow: 0 4px 16px rgba(0,0,0,0.20), inset 0 1px 0 rgba(255,255,255,0.40);
    transition: all 0.20s ease;
}
.fixed-back-btn:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.16) 100%);
    border-top-color: rgba(255,255,255,0.80);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.52);
}

.hamburger-btn {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    background: linear-gradient(145deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.10) 100%);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border: 1px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.65);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.20), inset 0 1px 0 rgba(255,255,255,0.40);
    transition: all 0.20s ease;
}
.hamburger-btn:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.16) 100%);
    border-top-color: rgba(255,255,255,0.80);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.52);
}

.hamburger-menu {
    position: fixed;
    top: 68px; right: 16px;
    z-index: 199;
    min-width: 210px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    border-radius: 16px;
}
.hamburger-menu.open { display: flex; }

.hamburger-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #fff;
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.16s ease, border-color 0.16s ease;
}
.hamburger-item:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.22);
}

.btn-clear-danger {
    padding: 4px 10px;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.30);
    border-radius: 8px;
    color: #ef4444;
    font-family: 'Sarabun', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}
.btn-clear-danger:hover {
    background: rgba(239,68,68,0.20);
    border-color: rgba(239,68,68,0.50);
}

/* ===== PRINT STYLES ===== */
@media print {
    @page {
        size: A4 portrait;
        margin: 0.7in 15mm 1.5cm 15mm !important;
    }

    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    body {
        background: #fff !important;
        animation: none !important;
        padding: 0 !important;
        font-family: 'Sarabun', sans-serif;
        color: #000;
    }

    body::before, body::after, .container::before { display: none !important; }

    .no-print { display: none !important; }

    header { display: none !important; }
    .left-panel, #settings-panel { display: none !important; }
    .main-grid { display: block !important; }
    .right-panel-wrap { display: block !important; }
    #result-panel {
        display: block !important;
        background: none !important;
        box-shadow: none !important;
        border: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }

    .print-header-area {
        display: block !important;
        text-align: center;
        margin-bottom: 10px;
    }
    .print-header-area h2 {
        font-family: 'Kanit', sans-serif;
        font-size: 18pt;
        font-weight: 700;
        color: #000;
    }
    .print-header-area p { font-size: 11pt; color: #333; }

    .result-topbar { display: none !important; }

    .table-wrap {
        background: #fff !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 9pt !important;
        page-break-inside: auto;
    }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; }

    thead th {
        background: #e8edf5 !important;
        border: 1px solid #000 !important;
        padding: 4px 2px !important;
        font-size: 9pt !important;
        color: #000 !important;
        font-weight: 700 !important;
    }
    tbody td {
        border: 1px solid #555 !important;
        padding: 2px 4px !important;
        font-size: 8.5pt !important;
        color: #000 !important;
        line-height: 1.1 !important;
    }

    .row-weekend-day td   { background: #fffbe6 !important; }
    .row-weekend-night td { background: #fff3e0 !important; }
    .row-weekday td       { background: #f0f4ff !important; }

    .shift-badge { border: 1px solid #888 !important; }
    .shift-day          { background: #fffde7 !important; color: #5a3000 !important; }
    .shift-night        { background: #ede9fe !important; color: #3730a3 !important; }
    .shift-weekday-night{ background: #ede9fe !important; color: #5b21b6 !important; }

    .page-hidden { display: table-row !important; }
    .sign-cell { height: 26px !important; }
}

/* ===== SHIFT CONFIG ===== */
.shift-config-section { margin-top:16px; }
.shift-config-section .field-label { color:#1e3a5f; margin-bottom:6px; }
.shift-config-row { display:flex; gap:8px; align-items:center; margin-bottom:10px; }
.shift-config-row input[type=number] {
    width:60px; padding:6px 8px; text-align:center;
    background:rgba(255,255,255,0.22); border:1px solid rgba(255,255,255,0.35);
    border-radius:8px; font-family:'Sarabun',sans-serif; font-size:14px; font-weight:700; color:#fff;
    text-shadow:0 1px 2px rgba(0,0,0,0.15);
}
.shift-config-row input[type=number]:focus {
    outline:none; background:rgba(255,255,255,0.32);
    border-color:rgba(255,255,255,0.60); box-shadow:0 0 0 2px rgba(56,189,248,0.25);
}
.shift-config-row input[type=number]::placeholder { color: rgba(255,255,255,0.45); }
.shift-tag-container { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.shift-tag {
    display:inline-flex; align-items:center; gap:4px;
    padding:4px 10px; border-radius:20px; font-size:11px; font-weight:600;
    background:rgba(56,189,248,0.18); color:#0ea5e9;
    border:1px solid rgba(56,189,248,0.30);
}
.shift-tag .remove-tag {
    cursor:pointer; font-size:13px; line-height:1; opacity:0.7;
    transition:opacity 0.15s;
}
.shift-tag .remove-tag:hover { opacity:1; color:#ef4444; }
.add-shift-row { display:flex; gap:6px; margin-top:8px; }
.add-shift-row input {
    flex:1; padding:5px 10px; font-size:12px;
    background:rgba(255,255,255,0.18); border:1px solid rgba(255,255,255,0.28);
    border-radius:8px; font-family:'Sarabun',sans-serif; color:#fff;
}
.add-shift-row input:focus {
    outline:none; background:rgba(255,255,255,0.28);
    border-color:rgba(255,255,255,0.55);
}
.add-shift-row input::placeholder { color: rgba(255,255,255,0.42); }
.add-shift-btn {
    padding:5px 12px; font-size:12px; font-weight:600; cursor:pointer;
    background:rgba(52,211,153,0.25); color:#10b981;
    border:1px solid rgba(52,211,153,0.35); border-radius:8px;
    transition:all 0.18s;
}
.add-shift-btn:hover { background:rgba(52,211,153,0.40); }

/* ===== SWAP BUTTON ===== */
.swap-btn {
    padding:3px 8px; font-size:11px; cursor:pointer;
    background:rgba(251,191,36,0.15); color:#d97706;
    border:1px solid rgba(251,191,36,0.30); border-radius:6px;
    font-family:'Sarabun',sans-serif; font-weight:600;
    transition:all 0.18s;
}
.swap-btn:hover {
    background:rgba(251,191,36,0.30); transform:translateY(-1px);
    box-shadow:0 2px 8px rgba(251,191,36,0.2);
}

/* ===== SWAP MODAL ===== */
.swap-modal-box {
    background:linear-gradient(160deg,rgba(248,250,255,0.97) 0%,rgba(241,245,255,0.96) 100%);
    backdrop-filter:blur(40px); border:1px solid rgba(255,255,255,0.90);
    border-radius:24px; padding:28px 24px; width:100%; max-width:520px;
    box-shadow:0 8px 24px rgba(0,0,0,0.14),0 32px 80px rgba(0,0,0,0.28);
    position:relative; max-height:80vh; overflow-y:auto;
}
.swap-modal-box h3 {
    font-family:'Kanit',sans-serif; font-size:18px; font-weight:700;
    color:#0f172a; margin-bottom:16px;
}
.swap-row-preview {
    background:rgba(241,245,249,0.9); border:1px solid #e2e8f0;
    border-radius:10px; padding:10px 14px; margin-bottom:12px; font-size:12px;
}
.swap-row-preview .label { font-weight:700; color:#334155; font-size:11px; margin-bottom:4px; }
.swap-target-list { max-height:200px; overflow-y:auto; }
.swap-target-item {
    display:flex; justify-content:space-between; align-items:center;
    padding:8px 12px; border-bottom:1px solid #f1f5f9; cursor:pointer;
    transition:background 0.12s; font-size:12px;
}
.swap-target-item:hover { background:rgba(56,189,248,0.08); }
.swap-target-item.selected { background:rgba(56,189,248,0.15); border-left:3px solid #0ea5e9; }
.balance-warning {
    margin-top:12px; padding:8px 12px; border-radius:8px;
    background:rgba(251,191,36,0.12); border:1px solid rgba(251,191,36,0.3);
    font-size:11px; color:#92400e;
}

/* ===== BUDDY SYSTEM ===== */
.buddy-section { margin-top:24px; padding-top:16px; border-top:1px dashed rgba(255,255,255,0.4); }
.buddy-pair-card {
    display:flex; align-items:center; gap:8px;
    padding:8px 10px; margin-bottom:6px; border-radius:8px;
    background:rgba(168,85,247,0.10); border:1px solid rgba(168,85,247,0.25);
}
.buddy-pair-card .buddy-icon { font-size:16px; }
.buddy-pair-card .buddy-names { flex:1; font-size:12px; font-weight:700; color:#fff; text-shadow:0 1px 2px rgba(0,0,0,0.2); }
.buddy-pair-card .buddy-remove {
    cursor:pointer; font-size:14px; color:#94a3b8;
    transition:color 0.15s;
}
.buddy-pair-card .buddy-remove:hover { color:#ef4444; }
.buddy-select-row { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.buddy-select-row select {
    flex:1; min-width:100px; padding:5px 8px; font-size:11.5px;
    background:rgba(255,255,255,0.18); border:1px solid rgba(255,255,255,0.28);
    border-radius:8px; font-family:'Sarabun',sans-serif; color:#fff;
}
.buddy-select-row select option { color: #0f172a; background: #fff; }
.buddy-select-row select:focus {
    outline:none; background:rgba(255,255,255,0.28);
    border-color:rgba(255,255,255,0.55);
}
.buddy-add-btn {
    padding:5px 12px; font-size:11.5px; font-weight:600; cursor:pointer;
    background:rgba(168,85,247,0.20); color:#7c3aed;
    border:1px solid rgba(168,85,247,0.30); border-radius:8px;
    transition:all 0.18s; white-space:nowrap;
}
.buddy-add-btn:hover { background:rgba(168,85,247,0.35); }

/* ===== QUICK RANDOM BUTTON ===== */
.quick-random-btn {
    background:linear-gradient(145deg,rgba(251,191,36,0.75) 0%,rgba(245,158,11,0.65) 100%);
    border:1px solid rgba(255,255,255,0.30); border-top-color:rgba(255,255,255,0.55);
    border-radius:var(--radius-sm); color:#fff;
    font-family:'Kanit',sans-serif; font-size:14px; font-weight:600;
    padding:8px 14px; width:100%; cursor:pointer; margin-top:8px;
    transition:all 0.22s cubic-bezier(0.34,1.56,0.64,1);
    text-shadow:0 1px 3px rgba(0,0,0,0.20);
    box-shadow:0 4px 14px rgba(245,158,11,0.25),inset 0 1.5px 0 rgba(255,255,255,0.45);
}
.quick-random-btn:hover {
    background:linear-gradient(145deg,rgba(251,191,36,0.92) 0%,rgba(245,158,11,0.82) 100%);
    transform:translateY(-2px);
    box-shadow:0 6px 20px rgba(245,158,11,0.35),inset 0 1.5px 0 rgba(255,255,255,0.55);
}
