/**
 * ============================================================
 * KIH Cost Control & Monitoring — Design System
 * ============================================================
 * Theme: Blue-White + Purple/Red/Orange accents
 * Font: Kanit (Google Fonts)
 * Fully responsive (mobile-first)
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    /* Primary Colors */
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --primary-bg: #E3F2FD;

    /* Accent Colors */
    --purple: #4A2C6D;
    --red: #D32F2F;
    --orange: #F57C00;
    --green: #2E7D32;
    --teal: #00796B;

    /* Neutral Colors */
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    /* Sidebar */
    --sidebar-bg: linear-gradient(180deg, #0D47A1 0%, #1A237E 50%, #4A2C6D 100%);
    --sidebar-width: 270px;
    --sidebar-collapsed: 0px;

    /* Layout */
    --topbar-height: 60px;
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
    color: var(--gray-800);
    background: var(--gray-100);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0D47A1 0%, #1565C0 30%, #4A2C6D 70%, #1A237E 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    top: -200px;
    right: -100px;
    animation: floatBubble 15s ease-in-out infinite;
}

.login-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.02);
    bottom: -150px;
    left: -100px;
    animation: floatBubble 20s ease-in-out infinite reverse;
}

@keyframes floatBubble {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.05); }
}

.login-container {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.6s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 25px rgba(21,101,192,0.3);
}

.login-logo i {
    font-size: 36px;
    color: var(--white);
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 5px;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--gray-600);
    font-weight: 300;
}

.login-company {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 16px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.form-group label i {
    margin-right: 6px;
    color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-family: 'Kanit', sans-serif;
    font-size: 0.95rem;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.1);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: var(--transition-fast);
}

.password-toggle:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-family: 'Kanit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #0a3d8f);
}

.btn-success {
    background: linear-gradient(135deg, var(--green), #1B5E20);
    color: var(--white);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red), #B71C1C);
    color: var(--white);
}

.btn-warning {
    background: linear-gradient(135deg, var(--orange), #E65100);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: var(--border-radius-sm);
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
    border-radius: 12px;
    margin-top: 10px;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* ==================== MAIN APP LAYOUT ==================== */
.main-app {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 30px 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    backdrop-filter: blur(10px);
}

.sidebar-logo i {
    font-size: 24px;
    color: var(--white);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.sidebar-header p {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 300;
}

/* Sidebar Menu */
.sidebar-menu {
    flex: 1;
    padding: 12px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 400;
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.menu-item.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    border-left-color: var(--white);
    font-weight: 500;
}

.menu-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.menu-parent {
    justify-content: flex-start;
}

.menu-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: var(--transition);
}

.menu-group.open .menu-arrow {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.menu-group.open .submenu {
    max-height: 200px;
}

.menu-child {
    padding-left: 55px;
    font-size: 0.85rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.user-info i {
    font-size: 1.5rem;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--border-radius-sm);
    color: rgba(255,255,255,0.9);
    font-family: 'Kanit', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-logout:hover {
    background: rgba(211,47,47,0.3);
    border-color: rgba(211,47,47,0.5);
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* Top Bar */
.topbar {
    height: var(--topbar-height);
    background: var(--white);
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.hamburger:hover {
    background: var(--gray-100);
}

.page-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-date {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 300;
}

/* App Content Area */
.app-content {
    padding: 24px;
    min-height: calc(100vh - var(--topbar-height));
}

/* ==================== CARDS ==================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-summary {
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    flex-shrink: 0;
}

.card-icon.blue { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.card-icon.purple { background: linear-gradient(135deg, var(--purple), #311B52); }
.card-icon.green { background: linear-gradient(135deg, var(--green), #1B5E20); }
.card-icon.orange { background: linear-gradient(135deg, var(--orange), #E65100); }
.card-icon.red { background: linear-gradient(135deg, var(--red), #B71C1C); }
.card-icon.teal { background: linear-gradient(135deg, var(--teal), #004D40); }

.card-info h3 {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.card-info .card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.card-info .card-unit {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--gray-500);
}

/* ==================== CHARTS ==================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-card h3 i {
    color: var(--primary);
}

.chart-container {
    position: relative;
    height: 300px;
}

/* ==================== TABLE ==================== */
.table-wrapper {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 8px 16px 8px 36px;
    border: 2px solid var(--gray-200);
    border-radius: 20px;
    font-family: 'Kanit', sans-serif;
    font-size: 0.85rem;
    width: 200px;
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
    width: 260px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.85rem;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

thead th {
    background: var(--gray-50);
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

tbody tr {
    transition: var(--transition-fast);
}

tbody tr:hover {
    background: var(--primary-bg);
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-footer {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--gray-200);
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Action Buttons in Table */
.action-btns {
    display: flex;
    gap: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.btn-icon.edit {
    background: var(--primary-bg);
    color: var(--primary);
}

.btn-icon.edit:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-icon.delete {
    background: #FFEBEE;
    color: var(--red);
}

.btn-icon.delete:hover {
    background: var(--red);
    color: var(--white);
}

.btn-icon.view {
    background: #E8F5E9;
    color: var(--green);
}

.btn-icon.view:hover {
    background: var(--green);
    color: var(--white);
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-blue {
    background: var(--primary-bg);
    color: var(--primary);
}

.badge-green {
    background: #E8F5E9;
    color: var(--green);
}

.badge-orange {
    background: #FFF3E0;
    color: var(--orange);
}

.badge-red {
    background: #FFEBEE;
    color: var(--red);
}

.badge-purple {
    background: #F3E5F5;
    color: var(--purple);
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ==================== MODAL ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.3s ease;
}

.modal-lg {
    max-width: 900px;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--red);
    color: var(--white);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* ==================== INLINE TABLE EDIT (Quotation Items) ==================== */
.inline-table {
    width: 100%;
    border-collapse: collapse;
}

.inline-table th {
    background: var(--primary-bg);
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-align: center;
    border: 1px solid var(--gray-200);
}

.inline-table td {
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    vertical-align: middle;
}

.inline-table input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-family: 'Kanit', sans-serif;
    font-size: 0.85rem;
    text-align: right;
    transition: var(--transition-fast);
    outline: none;
}

.inline-table input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(21,101,192,0.1);
}

.inline-table input.text-left {
    text-align: left;
}

.inline-table .row-number {
    text-align: center;
    font-weight: 500;
    color: var(--gray-500);
    width: 50px;
}

.inline-table .col-action {
    width: 50px;
    text-align: center;
}

.btn-remove-row {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #FFEBEE;
    color: var(--red);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.btn-remove-row:hover {
    background: var(--red);
    color: var(--white);
}

.inline-total-row td {
    background: var(--gray-50);
    font-weight: 600;
    padding: 10px 12px;
}

/* ==================== FILE UPLOAD ==================== */
.file-upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
}

.file-upload-area i {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.file-upload-area p {
    font-size: 0.85rem;
}

.file-upload-area .file-limit {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.file-list {
    margin-top: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: var(--border-radius-sm);
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.file-item i {
    color: var(--primary);
}

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    color: var(--gray-500);
    font-size: 0.8rem;
}

.file-item .file-remove {
    color: var(--red);
    cursor: pointer;
    padding: 2px 6px;
}

.file-item .file-remove:hover {
    background: #FFEBEE;
    border-radius: 4px;
}

/* ==================== SKELETON LOADING ==================== */
.skeleton-wrapper {
    padding: 0;
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--border-radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-title {
    width: 30%;
    height: 28px;
    margin-bottom: 20px;
}

.skeleton-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.skeleton-card {
    height: 100px;
}

.skeleton-table {
    height: 300px;
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* ==================== REPORT STATUS TABLE ==================== */
.status-check {
    color: var(--green);
    font-size: 1.2rem;
}

.status-cross {
    color: var(--gray-300);
    font-size: 1.2rem;
}

/* ==================== FILTER BAR ==================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
}

.filter-bar input,
.filter-bar select {
    padding: 8px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-family: 'Kanit', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--primary);
}

/* ==================== UTILITIES ==================== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-primary { color: var(--primary); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-warning { color: var(--orange); }
.text-muted { color: var(--gray-500); }
.fw-bold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    /* Sidebar: hidden by default on mobile */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: block;
    }

    /* Top bar */
    .page-title {
        font-size: 1rem;
    }

    .topbar-date {
        display: none;
    }

    /* Content */
    .app-content {
        padding: 16px;
    }

    /* Cards */
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card {
        padding: 16px;
    }

    .card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        border-radius: 12px;
    }

    .card-info .card-value {
        font-size: 1.4rem;
    }

    /* Chart */
    .chart-container {
        height: 220px;
    }

    /* Table */
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box input {
        width: 100%;
    }

    .search-box input:focus {
        width: 100%;
    }

    /* Modal */
    .modal {
        border-radius: 12px;
        margin: 10px;
        max-height: 85vh;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Filter */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    /* Skeleton */
    .skeleton-row {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Login */
    .login-container {
        padding: 35px 24px;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card-summary {
        flex-direction: column;
        text-align: center;
    }

    .skeleton-row {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .table-actions {
        width: 100%;
    }

    .table-actions .btn {
        flex: 1;
    }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* SweetAlert2 custom */
.swal2-popup {
    font-family: 'Kanit', sans-serif !important;
    border-radius: 16px !important;
}
