/* ==========================================================================
   OFFICE INVENTORY MANAGEMENT - PREMIUM MODERN STYLESHEET (VANILLA CSS)
   ========================================================================== */

/* --- Design Tokens / CSS Variables --- */
:root {
    /* Colors */
    --bg-gradient: radial-gradient(circle at top left, #0d1224, #070913);
    --bg-main: #070913;
    --card-bg: rgba(20, 25, 45, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-glow: rgba(0, 168, 255, 0.03);
    
    --primary: #2563eb;       /* Modern Blue */
    --primary-glow: rgba(37, 99, 235, 0.4);
    --secondary: #06b6d4;     /* Neon Cyan */
    --secondary-glow: rgba(6, 182, 212, 0.3);
    
    --success: #10b981;       /* Emerald */
    --danger: #ef4444;        /* Crimson */
    --warning: #f59e0b;       /* Amber */
    
    /* Text Colors */
    --text-main: #f3f4f6;     /* Off-White */
    --text-muted: #9ca3af;    /* Light Gray */
    --text-dark: #1f2937;     /* Dark Gray for lights/buttons */
    
    /* Categories Accent Colors */
    --cat-admin: #3b82f6;     /* บริหาร - Blue */
    --cat-disaster: #ef4444;  /* ป้องกันฯ - Red */
    --cat-municipal: #f59e0b; /* เทศกิจ - Orange */
    --cat-traffic: #10b981;   /* จราจร - Emerald */
    --cat-regis: #8b5cf6;     /* ทะเบียน - Purple */
    
    /* Fonts & Radii */
    --font-sans: 'Inter', 'Mitr', -apple-system, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --radius-circle: 50%;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* --- App Container Grid --- */
#app-container {
    width: 100vw;
    min-height: 100vh;
    position: relative;
}

/* Screen visibility classes */
.screen {
    opacity: 0;
    pointer-events: none;
    display: none;
    transition: opacity var(--transition-smooth);
    width: 100%;
    min-height: 100vh;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    display: flex;
}

/* ==========================================================================
   1. LOGIN SCREEN (PIN PAD)
   ========================================================================== */
#login-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: radial-gradient(circle at center, #111827 0%, #030712 100%);
}

.login-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

.login-logo {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo-img {
    width: 90px;
    height: 90px;
    margin-bottom: 16px;
    border-radius: var(--radius-circle);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.15);
    background-color: #ffffff;
    padding: 2px;
}

.login-logo h2 {
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #ffffff 0%, #7dd3fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 300;
}

/* PIN Display dots */
.pin-display-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.pin-dots {
    display: flex;
    gap: 16px;
}

.dot {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-circle);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-fast);
}

.dot.active {
    background-color: var(--secondary);
    border-color: var(--secondary);
    box-shadow: 0 0 12px var(--secondary-glow);
    transform: scale(1.2);
}

/* Numpad Layout */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 320px;
    margin: 0 auto 25px auto;
}

.num-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    font-size: 1.5rem;
    font-weight: 500;
    height: 68px;
    border-radius: var(--radius-circle);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.num-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.num-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(1px);
}

.num-btn.danger-btn {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

.num-btn.danger-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.num-btn.backspace-btn svg {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.num-btn.backspace-btn:hover svg {
    color: var(--text-main);
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 20px;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.error-msg.visible {
    opacity: 1;
    height: auto;
    margin-bottom: 20px;
    animation: shake 0.3s ease-in-out;
}

.login-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.login-hint code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--secondary);
    font-family: monospace;
}

/* ==========================================================================
   2. MAIN WORKSPACE LAYOUT
   ========================================================================== */
#main-workspace {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* --- Sidebar Navigation --- */
.sidebar {
    background: rgba(10, 15, 30, 0.85);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo-img {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-circle);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-color: #ffffff;
    padding: 1px;
}

.sidebar-brand span {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Sidebar User Info */
.user-profile-widget {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.01);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

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

#user-role-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.badge {
    align-self: flex-start;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(37, 99, 235, 0.3);
    margin-top: 2px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge.admin {
    background: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
    border-color: rgba(37, 99, 235, 0.4);
}
.badge.director {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
}
.badge.head {
    background: rgba(20, 184, 166, 0.2);
    color: #5eead4;
    border-color: rgba(20, 184, 166, 0.4);
}
.badge.staff {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.4);
}

/* Nav Menu */
.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-left: 10px;
    margin-bottom: 10px;
    opacity: 0.6;
}

.nav-item {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-fast);
    text-align: left;
    margin-bottom: 4px;
}

.nav-item svg {
    opacity: 0.7;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item:hover svg {
    transform: translateX(2px);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, rgba(6, 182, 212, 0.1) 100%);
    border-left: 3px solid var(--secondary);
    font-weight: 500;
}

.nav-item.active svg {
    color: var(--secondary);
    opacity: 1;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fff;
}

/* --- Main Content Panel --- */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.content-header {
    background: rgba(7, 9, 19, 0.4);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 9;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.content-header h1 {
    font-family: var(--font-sans);
    font-size: 1.3rem;
    font-weight: 500;
    color: #fff;
}

.datetime-widget {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
}

.content-body {
    padding: 30px;
    flex: 1;
}

/* --- Section Switcher Panels --- */
.panel-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.panel-section.active {
    display: block;
}

/* ==========================================================================
   3. COMPONENTS & CARDS STYLING
   ========================================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    margin-bottom: 30px;
}

/* Glass card glow decoration */
.card::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.2;
    pointer-events: none;
}

.card h3 {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 18px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.card-header-actions h3 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* --- Responsive Grid Layouts --- */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.grid-2col-30-70 {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

/* ==========================================================================
   4. FORMS AND INPUTS (PREMIUM LOOK)
   ========================================================================== */
.interactive-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    transition: all var(--transition-fast);
}

/* Fix dropdown options color on systems with light-theme browser dropdown wrappers */
select option {
    color: #111827;
    background-color: #ffffff;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.form-group input:focus,
.form-group select:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--secondary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.form-group-row {
    display: flex;
    gap: 15px;
}

.form-group-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Quantity input specific styling */
.input-qty-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-qty-container input {
    width: 100%;
    padding-right: 70px;
}

.unit-label {
    position: absolute;
    right: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
    background: rgba(255, 255, 255, 0.07);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.form-hint-info {
    font-size: 0.78rem;
    color: var(--secondary);
    margin-top: 2px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

/* --- Inline Filters Styling --- */
.filters-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.inline-select, 
.inline-input-search {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.inline-select:focus,
.inline-input-search:focus {
    border-color: var(--secondary);
    background: rgba(255, 255, 255, 0.08);
}

.inline-input-search.wide {
    min-width: 220px;
}

/* ==========================================================================
   5. BUTTONS
   ========================================================================== */
.btn {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #312e81 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-icon {
    padding: 8px 14px;
    font-size: 0.82rem;
}

/* Action icons inside tables */
.btn-table-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: all var(--transition-fast);
}

.btn-table-action:hover {
    background: rgba(255, 255, 255, 0.06);
}

.btn-table-action.edit-action:hover {
    color: var(--secondary);
}

.btn-table-action.delete-action:hover {
    color: var(--danger);
}

/* ==========================================================================
   6. TABLES AND DATA
   ========================================================================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

th {
    padding: 12px 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    font-weight: 300;
}

tr {
    transition: background-color var(--transition-fast);
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Table Category badging */
.tag-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
}

.tag-category.บริหาร {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.tag-category.ป้องกันบรรเทาสาธารณภัย {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.tag-category.เทศกิจ {
    background: rgba(245, 158, 11, 0.12);
    color: #fde047;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.tag-category.จราจร {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.tag-category.ทะเบียน {
    background: rgba(139, 92, 246, 0.12);
    color: #ddd6fe;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* History Transaction Type Badges */
.badge-txn-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-txn-type.in {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-txn-type.out {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.25);
}

/* Scrollbar customizations */
.table-container::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-container::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.table-container::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   7. HEAD DASHBOARD STAT CARDS & WIDGETS
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

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

.stat-icon.bg-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-icon.bg-red {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-icon.bg-green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-icon.bg-purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.45rem;
    font-weight: 600;
    margin: 2px 0;
    color: #fff;
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger) !important;
}

/* Low Stock table indicator */
.badge-status {
    padding: 2px 6px;
    font-size: 0.72rem;
    border-radius: 4px;
    font-weight: 500;
}

.badge-status.low {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-status.empty {
    background: rgba(220, 38, 38, 0.25);
    color: #ff8a8a;
    border: 1px solid var(--danger);
    font-weight: 600;
    animation: pulse 2s infinite;
}

/* --- SVG Graph Containers --- */
.chart-row {
    margin-bottom: 30px;
}

.chart-container {
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Custom CSS/SVG Graph styling */
.chart-donut {
    width: 180px;
    height: 180px;
}

.chart-donut-circle {
    fill: none;
    stroke-width: 22;
    transition: stroke-dasharray 0.5s ease;
}

.donut-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

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

/* Bar Chart styling */
.bar-chart-v {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    padding: 10px 0 20px 0;
}

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

.bar-box {
    width: 100%;
    background: linear-gradient(0deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 4px 4px 0 0;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.2);
    min-height: 4px;
    position: relative;
}

.bar-box:hover .bar-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -8px);
}

.bar-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translate(-50%, 0);
    background: #111827;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 5;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ==========================================================================
   8. TOAST NOTIFICATIONS
   ========================================================================== */
.toast {
    position: fixed;
    bottom: -80px;
    right: 30px;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.toast.visible {
    bottom: 30px;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

/* ==========================================================================
   9. RESPONSIVE MEDIA QUERIES (MOBILE DESIGN)
   ========================================================================== */
@media (max-width: 992px) {
    #main-workspace {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        transition: left var(--transition-smooth);
        height: 100vh;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .grid-2col {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .grid-2col-30-70 {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .content-body {
        padding: 15px;
    }
    
    .content-header {
        padding: 16px 20px;
    }
}

/* ==========================================================================
   10. ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   11. THEME TOGGLE & LIGHT MODE
   ========================================================================== */
.theme-toggle-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

.theme-toggle-btn-header {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle-btn-header:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

/* Light Theme Variables & Style Tweaks */
body.light-theme {
    --bg-gradient: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    --bg-main: #f3f4f6;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(0, 0, 0, 0.08);
    --card-glow: rgba(37, 99, 235, 0.02);
    
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.15);
    --secondary: #0891b2;
    --secondary-glow: rgba(8, 145, 178, 0.15);
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Text Colors */
    --text-main: #1f2937;     /* Dark Gray */
    --text-muted: #6b7280;    /* Medium Gray */
}

/* Special Light Theme Adjustments */
body.light-theme #login-screen {
    background: radial-gradient(circle at center, #f9fafb 0%, #e5e7eb 100%);
}

body.light-theme .login-card {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .login-logo h2 {
    background: linear-gradient(135deg, #1f2937 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .pin-dots .dot {
    background: rgba(0, 0, 0, 0.15);
}

body.light-theme .pin-dots .dot.active {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

body.light-theme .num-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

body.light-theme .num-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .sidebar {
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .sidebar-brand span {
    background: none;
    -webkit-text-fill-color: #1f2937;
    color: #1f2937;
}

body.light-theme .user-profile-widget {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .nav-item {
    color: #4b5563;
}

body.light-theme .nav-item:hover,
body.light-theme .nav-item.active {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}

body.light-theme .nav-section-title {
    color: #9ca3af;
}

body.light-theme .content-header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme table th {
    background: rgba(0, 0, 0, 0.03);
    color: #4b5563;
}

body.light-theme table tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme table tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: var(--text-main);
}

body.light-theme input:focus,
body.light-theme select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

body.light-theme .theme-toggle-btn,
body.light-theme .theme-toggle-btn-header {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-main);
}

body.light-theme .theme-toggle-btn:hover,
body.light-theme .theme-toggle-btn-header:hover {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

body.light-theme .badge-txn-type.in {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

body.light-theme .badge-txn-type.out {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

body.light-theme .content-header h1 {
    color: #1f2937;
}

body.light-theme .card h3 {
    color: #1f2937;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .stat-value {
    color: #1f2937;
}

body.light-theme .badge {
    background: rgba(37, 99, 235, 0.15);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.3);
}

body.light-theme .badge.admin {
    background: rgba(37, 99, 235, 0.15);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.3);
}

body.light-theme .badge.director {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.3);
}

body.light-theme .badge.head {
    background: rgba(20, 184, 166, 0.15);
    color: #0f766e;
    border-color: rgba(20, 184, 166, 0.3);
}

body.light-theme .badge.staff {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.3);
}

body.light-theme .badge-status.low {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.25);
}

body.light-theme .badge-status.empty {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.35);
}

body.light-theme .tag-category.บริหาร {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

body.light-theme .tag-category.ป้องกันบรรเทาสาธารณภัย {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

body.light-theme .tag-category.เทศกิจ {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

body.light-theme .tag-category.จราจร {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

body.light-theme .tag-category.ทะเบียน {
    background: rgba(139, 92, 246, 0.15);
    color: #6d28d9;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

body.light-theme .tag-subcategory {
    background: rgba(0, 0, 0, 0.03);
    color: #6b7280;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .chart-donut text {
    fill: #1f2937 !important;
}

body.light-theme .donut-legend {
    color: #4b5563;
}

body.light-theme .logout-btn {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

body.light-theme .logout-btn:hover {
    background: #dc2626;
    color: #ffffff;
}

/* ==========================================================================
   12. MOBILE SPECIFIC RESPONSIVE OVERRIDES
   ========================================================================== */
@media (max-width: 768px) {
    .form-group-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-group-row-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .login-card {
        padding: 24px 20px;
    }
    
    .num-btn {
        height: 55px;
        font-size: 1.2rem;
    }
    
    .pin-numpad {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    #login-screen {
        align-items: flex-start;
        padding: 10px;
        overflow-y: auto;
    }
    
    .login-card {
        margin-top: 10px;
        margin-bottom: 10px;
        padding: 20px 15px;
    }
}

/* ==========================================================================
   13. CHANGE PIN BUTTON & MODAL
   ========================================================================== */
.change-pin-btn {
    width: 100%;
    background: rgba(6, 182, 212, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.15);
    color: #8be9fd;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.change-pin-btn:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    color: #fff;
}

body.light-theme .change-pin-btn {
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: #0891b2;
}

body.light-theme .change-pin-btn:hover {
    background: #0891b2;
    color: #ffffff;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Content */
.modal-content {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease-out;
}

body.light-theme .modal-content {
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

body.light-theme .modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
}

body.light-theme .modal-header h3 {
    color: #1f2937;
}

/* Modal Close Button */
.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close-btn:hover {
    color: #fff;
}

body.light-theme .modal-close-btn:hover {
    color: #1f2937;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


