/* ============================================
   TemplateMo 3D Glassmorphism Dashboard
   Modified: Dark Purple & Gold Theme
============================================ */

/* ============================================
   IMPORT GOOGLE FONTS
============================================ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@100..900&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES
============================================ */
:root {
    /* Primary Colors - Dark Purple & Gold */
    --emerald: #3C0561;          /* ม่วงเข้มหลัก */
    --emerald-light: #7B2FBE;    /* ม่วงอ่อน */
    --gold: #D4AF37;             /* ทอง */
    --gold-light: #F0D060;       /* ทองอ่อน */
    --amber: #1F0033;            /* ม่วงเข้มจัด */
    --coral: #A855F7;            /* ม่วงอมชมพู */
    
    /* Accent Colors (ปรับให้เข้ากับม่วง) */
    --slate: #6D28D9;            /* ม่วงกลาง */
    
    /* Glass Colors */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.4);
    --glass-hover: rgba(255, 255, 255, 0.08);
    
    /* Background - Dark Purple */
    --bg-dark: #0a0510;
    --bg-gradient-1: #150620;
    --bg-gradient-2: #250a38;
    --bg-gradient-3: #35124a;
    
    /* Text */
    --text-primary: #f5f5f4;
    --text-secondary: rgba(245, 245, 244, 0.7);
    --text-muted: rgba(245, 245, 244, 0.4);
    
    /* Status Colors (ปรับให้เข้ากับม่วง) */
    --success: #22c55e;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    
    /* Spacing */
    --sidebar-width: 280px;
    --navbar-height: 70px;
    --border-radius: 20px;
    --card-padding: 24px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Light Mode - Purple Tint */
[data-theme="light"] {
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.8);
    
    --bg-dark: #f5f0f8;
    --bg-gradient-1: #ede0f5;
    --bg-gradient-2: #f5edfa;
    --bg-gradient-3: #faf5ff;
    
    --text-primary: #1a1a1a;
    --text-secondary: rgba(26, 26, 26, 0.7);
    --text-muted: rgba(26, 26, 26, 0.5);
}

[data-theme="light"] .orb {
    opacity: 0.12;
}

[data-theme="light"] .glass-card::before {
    background: linear-gradient(90deg, transparent, rgba(60, 5, 97, 0.08), transparent);
}

[data-theme="light"] .stat-value {
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
}

[data-theme="light"] .table-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .chart-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .activity-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
}

/* ============================================
   RESET & BASE STYLES
============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans Thai', 'Outfit', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    font-optical-sizing: auto;
    font-variation-settings: "wdth" 100;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   ANIMATED BACKGROUND
============================================ */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 50%, var(--bg-gradient-3) 100%);
}

.background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(123, 47, 190, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(212, 175, 55, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 50% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 50%);
}

/* Floating Orbs - Purple/Gold */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    z-index: -1;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--emerald-light);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: var(--gold);
    top: 60%;
    right: 10%;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--coral);
    bottom: 10%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.02); }
}

/* ============================================
   LAYOUT STRUCTURE
============================================ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 24px;
    z-index: 100;
    transition: all var(--transition-normal);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--emerald-light);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 30px;
}

.logo {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--emerald), var(--gold));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 8px 32px rgba(60, 5, 97, 0.4);
}

.logo-text {
    font-size: 22px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--emerald-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-section {
    margin-bottom: 25px;
    list-style: none;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 15px;
}

.nav-item {
    margin-bottom: 5px;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.nav-icon {
    width: 22px;
    height: 22px;
    opacity: 0.8;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--gold), var(--emerald-light));
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-profile:hover {
    background: var(--glass-hover);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--emerald), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   MAIN CONTENT
============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
}

/* ============================================
   TOP NAVBAR
============================================ */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 20px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    position: relative;
}

.search-input {
    width: 280px;
    padding: 12px 20px 12px 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Noto Sans Thai', 'Outfit', sans-serif;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 20px rgba(123, 47, 190, 0.3);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.nav-btn {
    width: 45px;
    height: 45px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.notification-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--coral);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--coral);
}

/* ============================================
   GLASS CARD BASE
============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: var(--card-padding);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.glass-card:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 25px 50px -12px var(--glass-shadow),
        0 0 40px rgba(123, 47, 190, 0.15);
}

.glass-card-3d {
    transition: transform 0.4s cubic-bezier(0.03, 0.98, 0.52, 0.99);
}

.glass-card-3d:hover {
    transform: rotateX(5deg) rotateY(-5deg) translateZ(10px);
}

/* ============================================
   STATS CARDS
============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    position: relative;
}

.stat-card-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: 'Noto Sans Thai', 'Space Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
}

.stat-change.positive {
    color: var(--success);
    background: rgba(34, 197, 94, 0.15);
}

.stat-change.negative {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.cyan {
    background: linear-gradient(135deg, rgba(123, 47, 190, 0.25), rgba(60, 5, 97, 0.1));
    box-shadow: 0 8px 32px rgba(123, 47, 190, 0.25);
}

.stat-icon.magenta {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.05));
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.2);
}

.stat-icon.purple {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.05));
    box-shadow: 0 8px 32px rgba(168, 85, 247, 0.2);
}

.stat-icon.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05));
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.2);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
}

.stat-sparkline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    opacity: 0.3;
}

/* ============================================
   CONTENT GRID
============================================ */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 30px;
}

/* ============================================
   CHART CARD
============================================ */
.chart-card {
    min-height: 380px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.service-person-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    padding: 13px 16px;
    border: 1px solid rgba(123, 47, 190, 0.28);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(123, 47, 190, 0.12), rgba(212, 175, 55, 0.08));
}

.service-person-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border: 2px solid rgba(216, 180, 254, 0.75);
    border-radius: 14px;
    background: linear-gradient(135deg, #8b5cf6, #4c1d95);
    color: #fff;
    font-size: 21px;
    font-weight: 700;
    box-shadow: 0 7px 18px rgba(124, 58, 237, 0.25);
}

.service-person-names {
    min-width: 0;
}

.service-person-thai-name,
.service-person-english-name {
    margin: 0;
    overflow-wrap: anywhere;
}

.service-person-thai-name {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
}

.service-person-english-name {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 14px;
}

[data-theme="light"] .service-person-identity {
    background: linear-gradient(135deg, rgba(123, 47, 190, 0.09), rgba(212, 175, 55, 0.08));
}

[data-theme="light"] .service-person-thai-name {
    color: #171717;
}

[data-theme="light"] .service-person-english-name {
    color: #64748b;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-btn {
    padding: 8px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: 'Noto Sans Thai', 'Outfit', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.card-btn:hover,
.card-btn.active {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
    color: var(--text-primary);
}

.chart-wrapper {
    overflow-x: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.chart-wrapper::-webkit-scrollbar {
    height: 8px;
}

.chart-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.chart-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, var(--emerald), var(--gold));
    border-radius: 4px;
}

.chart-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, var(--emerald-light), var(--gold-light));
}

.chart-container {
    height: 250px;
    position: relative;
    display: flex;
    min-width: 500px;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 0;
    padding-right: 12px;
    text-align: right;
}

.y-value {
    font-family: 'Noto Sans Thai', 'Space Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.chart-placeholder {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    padding: 20px 0;
    border-left: 1px solid var(--glass-border);
    padding-left: 12px;
}

.chart-bar-group {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, var(--emerald-light), var(--emerald));
    transition: all var(--transition-normal);
    position: relative;
    min-height: 10px;
}

.chart-bar.bar-emerald {
    background: linear-gradient(180deg, #9B59B6, #6D28D9);
}

.chart-bar.bar-gold {
    background: linear-gradient(180deg, #E8C84A, #D4AF37);
}

.chart-bar.bar-coral {
    background: linear-gradient(180deg, #C084FC, #A855F7);
}

.chart-bar.bar-teal {
    background: linear-gradient(180deg, #7B2FBE, #3C0561);
}

.chart-bar.bar-amber {
    background: linear-gradient(180deg, #F0D060, #D4AF37);
}

.chart-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2), transparent);
    border-radius: 8px 8px 0 0;
}

.chart-bar:hover {
    filter: brightness(1.15);
    transform: scaleY(1.02);
    transform-origin: bottom;
}

.chart-bar.bar-emerald:hover {
    box-shadow: 0 0 16px rgba(109, 40, 217, 0.4);
}

.chart-bar.bar-gold:hover {
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.chart-bar.bar-coral:hover {
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
}

.chart-bar.bar-teal:hover {
    box-shadow: 0 0 16px rgba(60, 5, 97, 0.4);
}

.chart-bar.bar-amber:hover {
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.chart-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   ACTIVITY FEED
============================================ */
.activity-card {
    max-height: 380px;
    display: flex;
    flex-direction: column;
}

.activity-list {
    flex: 1;
    overflow-y: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.activity-list::-webkit-scrollbar {
    width: 4px;
}

.activity-list::-webkit-scrollbar-track {
    background: transparent;
}

.activity-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--glass-border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   DATA TABLE
============================================ */
.table-card {
    grid-column: span 2;
}

.table-wrapper {
    overflow-x: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, var(--emerald), var(--gold));
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, var(--emerald-light), var(--gold-light));
}

.data-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px;
    text-align: left;
}

.data-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.data-table tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--glass-hover);
}

.data-table td {
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.table-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.table-user-info {
    display: flex;
    flex-direction: column;
}

.table-user-name {
    color: var(--text-primary);
    font-weight: 500;
}

.table-user-email {
    font-size: 12px;
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.status-badge.completed::before {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-badge.pending::before {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-badge.processing {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.status-badge.processing::before {
    background: var(--info);
    box-shadow: 0 0 8px var(--info);
}

.table-amount {
    font-family: 'Noto Sans Thai', 'Space Mono', monospace;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   PROGRESS BARS
============================================ */
.progress-card {
    padding: var(--card-padding);
}

.progress-item {
    margin-bottom: 24px;
}

.progress-item:last-child {
    margin-bottom: 0;
}

.progress-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.progress-total-label,
.progress-total-value {
    font-size: 15px;
    font-weight: 700;
}

.progress-total-value {
    font-family: 'Noto Sans Thai', 'Space Mono', monospace;
    color: var(--text-primary);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.progress-label {
    font-size: 14px;
    font-weight: 500;
}

.progress-department-link {
    color: var(--text-primary);
    text-decoration: none;
}

.progress-department-link:hover {
    color: var(--emerald-light);
    text-decoration: underline;
}

.progress-value {
    font-family: 'Noto Sans Thai', 'Space Mono', monospace;
    font-size: 14px;
    color: var(--text-secondary);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
}

.progress-fill.cyan {
    background: linear-gradient(90deg, var(--emerald-light), var(--emerald));
    box-shadow: 0 0 20px rgba(123, 47, 190, 0.4);
}

.progress-fill.magenta {
    background: linear-gradient(90deg, var(--gold-light), var(--gold));
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.progress-fill.purple {
    background: linear-gradient(90deg, var(--coral), var(--emerald-light));
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

/* ============================================
   BOTTOM GRID
============================================ */
.bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ============================================
   CALENDAR WIDGET
============================================ */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-nav-btn {
    width: 32px;
    height: 32px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.calendar-nav-btn svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.calendar-day-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 0;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-day:hover {
    background: var(--glass-hover);
}

.calendar-day.other-month {
    color: var(--text-muted);
}

.calendar-day.today {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(60, 5, 97, 0.4);
}

.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
}

/* ============================================
   DONUT CHART
============================================ */
.donut-container {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
}

.donut-chart {
    width: 140px;
    height: 140px;
    position: relative;
}

.donut-chart svg {
    transform: rotate(-90deg);
}

.donut-chart circle {
    fill: none;
    stroke-width: 20;
}

.donut-bg {
    stroke: rgba(255, 255, 255, 0.1);
}

.donut-segment {
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-value {
    font-family: 'Noto Sans Thai', 'Space Mono', monospace;
    font-size: 28px;
    font-weight: 700;
}

.donut-label {
    font-size: 12px;
    color: var(--text-muted);
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.legend-color.cyan { background: var(--emerald-light); }
.legend-color.magenta { background: var(--gold); }
.legend-color.purple { background: var(--coral); }

.staff-breakdown-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.staff-breakdown-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.staff-breakdown-academic {
    border-color: rgba(16, 185, 129, 0.28);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.06));
}

.staff-breakdown-support {
    border-color: rgba(212, 175, 55, 0.34);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.07));
}

.staff-breakdown-dot {
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.staff-breakdown-academic .staff-breakdown-dot {
    background: var(--emerald);
}

.staff-breakdown-support .staff-breakdown-dot {
    background: var(--gold);
}

.staff-breakdown-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.staff-breakdown-label {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.staff-breakdown-info strong {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.2;
}

.staff-breakdown-percent {
    margin-left: auto;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

[data-theme="light"] .staff-breakdown-academic {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(16, 185, 129, 0.04));
}

[data-theme="light"] .staff-breakdown-support {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.04));
}

@media (max-width: 560px) {
    .staff-breakdown-list {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   MOBILE MENU TOGGLE
============================================ */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--emerald), var(--gold));
    border: none;
    border-radius: 16px;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(60, 5, 97, 0.4);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    color: white;
}

/* ============================================
   LOGIN PAGE STYLES
============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--emerald), var(--gold));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 28px;
    margin: 0 auto 20px;
    box-shadow: 0 12px 40px rgba(60, 5, 97, 0.4);
}

.login-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 24px;
}

.new-person-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.new-person-form .form-group {
    min-width: 0;
    margin-bottom: 0;
}

.service-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.service-form .form-group {
    min-width: 0;
    margin-bottom: 0;
}

@media (min-width: 993px) {
    .service-file-field {
        grid-column: 3;
        grid-row: 1 / span 4;
        align-self: start;
    }

    .service-region-field {
        grid-column: 1 / 3;
        grid-row: 4;
    }

    .service-end-date-field {
        grid-column: 1;
    }

    .service-status-field {
        grid-column: 1 / 3;
        grid-row: 5;
    }
}

.recent-staff-card {
    margin-top: 0;
}

.recent-staff-search {
    position: relative;
    z-index: 2;
    margin-bottom: 20px;
}

.recent-staff-search > label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.recent-staff-search-box {
    position: relative;
}

.recent-staff-search-box input {
    width: 100%;
}

.recent-staff-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    display: none;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: #18252a;
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.3);
}

.recent-staff-search-results.open {
    display: block;
}

.recent-staff-search-result,
.recent-staff-search-empty {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 14px;
}

.recent-staff-search-result {
    color: #f1f5f9;
    text-decoration: none;
}

.recent-staff-search-result strong {
    color: #f1f5f9;
}

.recent-staff-search-result:hover {
    background: var(--glass-hover);
}

.recent-staff-search-result span,
.recent-staff-search-empty {
    color: #a8b5bb;
    font-size: 13px;
}

[data-theme="light"] .recent-staff-search-results {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .recent-staff-search-result,
[data-theme="light"] .recent-staff-search-result strong {
    color: #1f2937;
}

[data-theme="light"] .recent-staff-search-result span,
[data-theme="light"] .recent-staff-search-empty {
    color: #64748b;
}

.recent-staff-table-wrapper {
    overflow-x: auto;
}

.recent-staff-table {
    min-width: 760px;
}

.recent-staff-table th:last-child,
.recent-staff-table td:last-child {
    width: 1%;
    white-space: nowrap;
}

.recent-staff-new-row {
    background: rgba(16, 185, 129, 0.12);
}

.recent-staff-empty {
    margin: 0;
    color: var(--text-muted);
}

.person-detail-trigger {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--emerald-light);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.person-detail-trigger:hover {
    color: var(--emerald);
    text-decoration: underline;
}

.person-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
}

.person-detail-modal.open {
    display: flex;
}

.person-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.68);
}

.person-detail-dialog {
    position: relative;
    width: min(900px, 100%);
    max-height: none;
    overflow: visible;
    padding: 30px;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    background: #18252a;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    font-size: 16px;
}

.person-detail-header {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.person-detail-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    gap: 10px;
    max-width: calc(100% - 48px);
    text-align: center;
}

.person-detail-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    border: 2px solid rgba(216, 180, 254, 0.8);
    border-radius: 18px;
    background: linear-gradient(135deg, #8b5cf6, #4c1d95);
    color: #fff;
    font-size: 25px;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.35);
}

.person-detail-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
}

.person-detail-english {
    margin: -4px 0 2px;
    color: var(--text-muted);
    font-size: 15px;
}

.person-detail-department {
    display: inline-flex;
    max-width: 100%;
    overflow: hidden;
    padding: 4px 9px;
    border: 1px solid rgba(20, 184, 166, 0.45);
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.14);
    color: #0f766e;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-detail-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 34px;
    height: 34px;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.person-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.person-detail-sections {
    display: grid;
    gap: 20px;
}

.person-detail-section {
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.person-detail-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
}

.person-detail-section h3::before {
    width: 4px;
    height: 16px;
    border-radius: 999px;
    background: var(--emerald);
    content: '';
}

.person-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 3px 0;
}

.person-detail-item > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
}

.person-detail-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(139, 92, 246, 0.14);
    color: #8b5cf6;
}

.person-detail-icon svg {
    width: 17px;
    height: 17px;
}

.person-detail-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.person-detail-item strong {
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 400;
}

.person-detail-info-grid {
    display: grid;
    gap: 0;
}

.person-detail-info-grid .person-detail-item {
    display: grid;
    grid-template-columns: minmax(180px, 28%) minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 46px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.person-detail-info-grid .person-detail-item:last-child {
    border-bottom: 0;
}

.person-detail-info-grid .person-detail-item > .person-detail-icon {
    display: none;
}

.person-detail-info-grid .person-detail-item > div {
    display: contents;
}

.person-detail-info-grid .person-detail-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.person-detail-info-grid .person-detail-item strong {
    font-size: 15px;
}

[data-theme="light"] .person-detail-dialog {
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

[data-theme="light"] .person-detail-section {
    background: rgba(248, 250, 252, 0.78);
    box-shadow: 0 8px 20px rgba(123, 47, 190, 0.14);
}

[data-theme="light"] .person-detail-title,
[data-theme="light"] .person-detail-item strong {
    color: #171717;
}

[data-theme="light"] .person-detail-english,
[data-theme="light"] .person-detail-label {
    color: #64748b;
}

[data-theme="light"] .person-detail-section h3 {
    color: #252525;
}

[data-theme="light"] .person-detail-close {
    border-color: rgba(148, 163, 184, 0.35);
    color: #171717;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Noto Sans Thai', 'Outfit', sans-serif;
    font-size: 15px;
    transition: all var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 20px rgba(123, 47, 190, 0.3);
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--emerald);
}

.forgot-link {
    font-size: 14px;
    color: var(--emerald-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-link:hover {
    color: var(--gold);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: 'Noto Sans Thai', 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    color: white;
    box-shadow: 0 8px 24px rgba(60, 5, 97, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(60, 5, 97, 0.5);
}

.btn-secondary {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    font-size: 13px;
    color: var(--text-muted);
}

.social-login {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.social-btn {
    flex: 1;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.social-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.social-btn svg {
    width: 22px;
    height: 22px;
}

.login-footer {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--emerald-light);
    text-decoration: none;
}

.login-footer a:hover {
    color: var(--gold);
}

/* ============================================
   PAGE HEADER (for inner pages)
============================================ */
.page-header {
    margin-bottom: 30px;
}

.page-header .page-title {
    margin-bottom: 8px;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.page-breadcrumb a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.page-breadcrumb a:hover {
    color: var(--emerald-light);
}

.page-breadcrumb span {
    color: var(--text-muted);
}

/* ============================================
   FOOTER
============================================ */
.site-footer {
    text-align: center;
    padding: 20px;
    margin-left: var(--sidebar-width);
    color: var(--text-muted);
    font-size: 14px;
}

.site-footer a {
    color: var(--emerald-light);
    transition: color var(--transition-fast);
}

.site-footer a:hover {
    color: var(--gold);
}

.login-page .site-footer {
    margin-left: 0;
    position: relative;
    padding: 30px 20px;
    text-align: center;
    margin-top: 30px;
}

.theme-toggle-float {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 45px;
    height: 45px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all var(--transition-fast);
}

.theme-toggle-float:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.theme-toggle-float svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

/* ============================================
   SETTINGS PAGE
============================================ */
.settings-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 24px;
}

.settings-nav {
    list-style: none;
}

.settings-nav-item {
    margin-bottom: 8px;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: all var(--transition-fast);
}

.settings-nav-link:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.settings-nav-link.active {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.settings-nav-link svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.settings-nav-link.active svg,
.settings-nav-link:hover svg {
    opacity: 1;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-label-title {
    font-weight: 500;
    color: var(--text-primary);
}

.settings-label-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 26px;
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    border-color: var(--emerald);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: white;
}

.settings-select {
    padding: 10px 16px;
    background: rgba(19, 36, 25, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Noto Sans Thai', 'Outfit', sans-serif;
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237B2FBE' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.settings-select:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 15px rgba(123, 47, 190, 0.2);
}

.settings-select option {
    background: rgba(19, 36, 25, 0.98);
    color: var(--text-primary);
    padding: 10px;
}

[data-theme="light"] .settings-select {
    background-color: rgba(245, 240, 248, 0.95);
}

[data-theme="light"] .settings-select option {
    background: rgba(245, 240, 248, 0.98);
    color: #1a1a1a;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--emerald), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 36px;
    position: relative;
}

.profile-avatar-edit {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 32px;
    height: 32px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-avatar-edit:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.profile-avatar-edit svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.profile-info h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-info p {
    color: var(--text-muted);
    font-size: 14px;
}

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

.form-group-settings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-settings.full-width {
    grid-column: span 2;
}

.form-group-settings label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group-settings input,
.form-group-settings textarea {
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Noto Sans Thai', 'Outfit', sans-serif;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.form-group-settings input:focus,
.form-group-settings textarea:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 20px rgba(123, 47, 190, 0.2);
}

.form-group-settings textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
    animation: settingsFadeIn 0.3s ease;
}

@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE DESIGN
============================================ */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bottom-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    .table-card {
        grid-column: span 1;
    }
}

@media (max-width: 992px) {
    :root {
        --sidebar-width: 0px;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .bottom-grid {
        grid-template-columns: 1fr;
    }
    .site-footer {
        margin-left: 0;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .settings-nav-card {
        display: none;
    }
    .new-person-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .service-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .service-file-field,
    .service-region-field,
    .service-end-date-field,
    .service-status-field {
        grid-column: 1 / -1;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .navbar {
        flex-wrap: wrap;
    }
    .search-box {
        order: 3;
        width: 100%;
    }
    .search-input {
        width: 100%;
    }
    .page-title {
        font-size: 22px;
    }
    .donut-container {
        flex-direction: column;
    }
    .login-card {
        padding: 36px 24px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .new-person-form {
        grid-template-columns: 1fr;
    }
    .service-form {
        grid-template-columns: 1fr;
    }
    .person-detail-grid {
        grid-template-columns: 1fr;
    }
    .person-detail-info-grid .person-detail-item {
        grid-template-columns: minmax(110px, 34%) minmax(0, 1fr);
        gap: 10px;
    }
    .person-detail-dialog {
        padding: 24px 18px;
        border-radius: 20px;
    }
    .person-detail-section {
        padding: 14px;
    }
    .form-group-settings.full-width {
        grid-column: span 1;
    }
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 20px 15px;
    }
    .glass-card {
        padding: 18px;
    }
    .stat-value {
        font-size: 26px;
    }
    .data-table {
        font-size: 13px;
    }
    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }
    .social-login {
        flex-direction: column;
    }
}

/* ============================================
   ANIMATIONS
============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-card {
    animation: fadeInUp 0.6s ease-out backwards;
}

.stats-grid .glass-card:nth-child(1) { animation-delay: 0.1s; }
.stats-grid .glass-card:nth-child(2) { animation-delay: 0.2s; }
.stats-grid .glass-card:nth-child(3) { animation-delay: 0.3s; }
.stats-grid .glass-card:nth-child(4) { animation-delay: 0.4s; }

.content-grid .glass-card:nth-child(1) { animation-delay: 0.5s; }
.content-grid .glass-card:nth-child(2) { animation-delay: 0.6s; }
.content-grid .glass-card:nth-child(3) { animation-delay: 0.7s; }

.bottom-grid .glass-card:nth-child(1) { animation-delay: 0.8s; }
.bottom-grid .glass-card:nth-child(2) { animation-delay: 0.9s; }
.bottom-grid .glass-card:nth-child(3) { animation-delay: 1s; }

.login-card {
    animation: fadeInUp 0.6s ease-out;
}
