/* ==========================================================================
   CLASSROOM TREASURER POS SYSTEM - CLEAN FLAT DESIGN
   Sidebar: Deep Navy Blue (#0A1128)
   Main Content: Crisp Pure White (#FFFFFF & #F8FAFC)
   Typography: Kanit (Light 300 / Regular 400) & Fira Code
   Buttons: Solid Single Colors (No Gradients, No Glows)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600&family=Fira+Code:wght@400;500;600;700&display=swap');

:root {
    /* Sidebar Deep Navy Colors */
    --sidebar-bg: #0A1128;
    --sidebar-surface: #0F172A;
    --sidebar-border: rgba(255, 255, 255, 0.12);
    --sidebar-text: #FFFFFF;
    --sidebar-text-muted: #94A3B8;

    /* Main Content Pure White & Light Slate Colors */
    --content-bg: #FFFFFF;
    --content-surface: #F8FAFC;
    --content-card-bg: #FFFFFF;
    --content-border: #E2E8F0;
    --content-text-main: #0F172A;
    --content-text-muted: #64748B;
    --content-text-dim: #94A3B8;

    /* Solid Action Colors (Flat, No Gradients, No Glows) */
    --btn-primary: #1E3A8A;
    --btn-primary-hover: #1E40AF;
    
    --btn-success: #059669;
    --btn-success-hover: #047857;
    
    --btn-danger: #DC2626;
    --btn-danger-hover: #B91C1C;
    
    --btn-warning: #D97706;
    --btn-warning-hover: #B45309;

    --btn-outline-border: #CBD5E1;
    --btn-outline-text: #334155;
    --btn-outline-hover: #F1F5F9;

    /* Status Badges */
    --badge-success-bg: #DCFCE7;
    --badge-success-text: #15803D;
    
    --badge-pending-bg: #FEF3C7;
    --badge-pending-text: #B45309;

    --badge-danger-bg: #FEE2E2;
    --badge-danger-text: #B91C1C;

    --badge-navy-bg: #DBEAFE;
    --badge-navy-text: #1E40AF;

    /* Radius & Transitions */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    --transition: all 0.15s ease-in-out;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

/* Kanit Light 300 Default Font */
body {
    font-family: 'Kanit', sans-serif;
    font-weight: 300;
    background-color: var(--content-bg);
    color: var(--content-text-main);
    min-height: 100vh;
    display: flex;
    line-height: 1.5;
}

/* ==========================================
   LAYOUT STRUCTURE (NAVY SIDEBAR & WHITE RIGHT)
   ========================================== */
#app {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Left Sidebar: Deep Navy Blue (Compact 215px Width) */
.sidebar {
    width: 215px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--sidebar-border);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-badge {
    width: 32px;
    height: 32px;
    background: var(--btn-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #FFFFFF;
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 0.92rem;
    font-weight: 500;
    color: #FFFFFF;
}

.logo-text p {
    font-size: 0.68rem;
    color: #34D399;
    font-weight: 300;
}

.btn-sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: var(--sidebar-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px;
}

.nav-menu {
    flex: 1;
    padding: 8px 6px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    color: var(--sidebar-text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 300;
    transition: var(--transition);
    border: none;
    user-select: none;
    min-height: 36px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
}

.nav-item.active {
    background: var(--btn-primary);
    color: #FFFFFF;
    font-weight: 400;
}

.nav-icon {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-sub-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 18px;
    margin-top: 2px;
    margin-bottom: 4px;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    color: var(--sidebar-text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 400;
    transition: var(--transition);
    user-select: none;
}

.nav-sub-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
}

.nav-sub-item.active {
    background: rgba(37, 99, 235, 0.2);
    color: #38BDF8;
    font-weight: 500;
    border-left: 3px solid #38BDF8;
}

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--sidebar-border);
    background: #070D1E;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--btn-primary);
    color: #FFFFFF;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-details h4 {
    font-size: 0.78rem;
    font-weight: 400;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details span {
    font-size: 0.68rem;
    color: var(--sidebar-text-muted);
}

.btn-logout {
    background: transparent;
    border: none;
    color: #F87171;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

/* Right Main Content Area: Compact & Scaled */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--content-bg);
    color: var(--content-text-main);
    min-width: 0;
    width: 100%;
}

.top-header {
    min-height: 48px;
    padding: 6px 16px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--content-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    gap: 10px;
}

.mobile-menu-toggle {
    display: none;
    background: #F1F5F9;
    border: 1px solid var(--content-border);
    color: var(--content-text-main);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.page-title {
    font-size: 0.98rem;
    font-weight: 500;
    color: var(--content-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.content-body {
    padding: 14px 16px;
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    background: #F8FAFC;
    min-height: calc(100vh - 48px);
    overflow-x: hidden;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

/* ==========================================
   CARDS & GRIDS (COMPACT & PROPORTIONAL)
   ========================================== */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.card {
    background: #FFFFFF;
    border: 1px solid var(--content-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    transition: var(--transition);
    width: 100%;
    color: var(--content-text-main);
}

.card h3, .card h4 {
    color: var(--content-text-main);
    font-weight: 500;
}

.card-white {
    background: #FFFFFF;
    color: #0F172A;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Compact Colored Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    gap: 10px;
    min-width: 0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.stat-card-emerald {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: #FFFFFF;
}

.stat-card-blue {
    background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%);
    color: #FFFFFF;
}

.stat-card-rose {
    background: linear-gradient(135deg, #991B1B 0%, #E11D48 100%);
    color: #FFFFFF;
}

.stat-card-purple {
    background: linear-gradient(135deg, #5B21B6 0%, #8B5CF6 100%);
    color: #FFFFFF;
}

.stat-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #FFFFFF;
    flex-shrink: 0;
}

.stat-info {
    overflow: hidden;
    min-width: 0;
}

.stat-info h3 {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 400;
    margin-bottom: 2px;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-info .stat-value {
    font-family: 'Fira Code', 'Kanit', monospace;
    font-size: 1.35rem;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.15;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================
   BUTTONS (COMPACT & CLEAN)
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 400;
    font-family: 'Kanit', sans-serif;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    min-height: 34px;
    box-shadow: none !important;
    text-shadow: none !important;
}

.btn-primary {
    background: var(--btn-primary);
    color: #FFFFFF;
}
.btn-primary:hover {
    background: var(--btn-primary-hover);
}

.btn-success {
    background: var(--btn-success);
    color: #FFFFFF;
}
.btn-success:hover {
    background: var(--btn-success-hover);
}

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

.btn-warning {
    background: var(--btn-warning);
    color: #FFFFFF;
}
.btn-warning:hover {
    background: var(--btn-warning-hover);
}

.btn-outline {
    background: #FFFFFF;
    border: 1px solid var(--btn-outline-border);
    color: var(--btn-outline-text);
}
.btn-outline:hover {
    background: var(--btn-outline-hover);
}

/* ==========================================
   TABLES & FORM CONTROLS (NO OVERFLOW-X FIT)
   ========================================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--content-border);
    margin-top: 8px;
    background: #FFFFFF;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 0;
    table-layout: auto;
}

th {
    background: #F1F5F9;
    color: var(--content-text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 8px 10px;
    border-bottom: 1px solid var(--content-border);
    white-space: nowrap;
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--content-border);
    font-size: 0.82rem;
    color: var(--content-text-main);
    vertical-align: middle;
}

tr:hover {
    background: #F8FAFC;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 400;
    white-space: nowrap;
}

.badge-success { background: var(--badge-success-bg); color: var(--badge-success-text); border: 1px solid #A7F3D0; }
.badge-pending { background: var(--badge-pending-bg); color: var(--badge-pending-text); border: 1px solid #FDE68A; }
.badge-danger { background: var(--badge-danger-bg); color: var(--badge-danger-text); border: 1px solid #FECACA; }
.badge-navy { background: var(--badge-navy-bg); color: var(--badge-navy-text); border: 1px solid #BFDBFE; }

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

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--content-text-muted);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 6px 10px;
    background: #FFFFFF;
    border: 1px solid var(--content-border);
    border-radius: var(--radius-sm);
    color: var(--content-text-main);
    font-size: 0.84rem;
    font-family: 'Kanit', sans-serif;
    font-weight: 300;
    transition: var(--transition);
    min-height: 36px;
}

.form-control:focus {
    outline: none;
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.1);
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    padding: 16px;
}

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

.modal-box {
    background: #FFFFFF;
    color: var(--content-text-main);
    border: 1px solid var(--content-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(15px);
    transition: var(--transition);
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--content-border);
}

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--content-text-main);
    font-weight: 500;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--content-text-muted);
    font-size: 1.4rem;
    cursor: pointer;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 90vw;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: #FFFFFF;
    color: var(--content-text-main);
    border: 1px solid var(--content-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
}

/* ==========================================
   SPLIT SCREEN AUTH (MATCHING REFERENCE EXACTLY)
   ========================================== */
.auth-outer-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F1F5F9;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000;
}

.auth-split-wrapper {
    width: 90%;
    max-width: 900px;
    height: 75vh;
    min-height: 500px;
    display: flex;
    overflow: hidden;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #CBD5E1;
}

.auth-hero-side {
    width: 50%;
    height: 100%;
    background: #0A1128;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* === CAROUSEL SYSTEM === */
.auth-carousel {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 0.8s ease, transform 0.8s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.carousel-slide.active {
    opacity: 1;
    transform: scale(1);
}

.carousel-slide img.carousel-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.carousel-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10,17,40,0.3) 0%, rgba(10,17,40,0.7) 100%);
}

.carousel-content-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
    max-width: 420px;
}

.carousel-dots {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

.carousel-dot.active {
    background: #38BDF8;
    width: 24px;
    border-radius: 4px;
}


.hero-overlay-text {
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 18px 22px;
    border-radius: var(--radius-md);
    border: 1px solid #E2E8F0;
}

.hero-overlay-text h3 {
    font-size: 1.05rem;
    color: var(--navy-dark);
    font-weight: 500;
}

.hero-overlay-text p {
    font-size: 0.82rem;
    color: #64748B;
    margin-top: 4px;
}

.auth-form-side {
    width: 50%;
    height: 100%;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    overflow-y: auto;
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
}

.auth-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-header-brand .brand-icon {
    font-size: 1.7rem;
    color: var(--navy-dark);
}

.auth-header-brand .brand-name {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--navy-dark);
}

.auth-main-headline {
    font-size: 1.6rem;
    font-weight: 600;
    color: #0F172A;
    margin-bottom: 28px;
}

.clean-label {
    display: block;
    font-size: 0.92rem;
    font-weight: 400;
    color: #0F172A;
    margin-bottom: 6px;
}

.clean-input {
    width: 100%;
    height: 46px;
    padding: 10px 14px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-sm);
    color: #0F172A;
    font-size: 0.92rem;
    font-family: 'Kanit', sans-serif;
    font-weight: 300;
    transition: var(--transition);
}

.clean-input:focus {
    outline: none;
    border-color: var(--navy-dark);
    box-shadow: 0 0 0 2px rgba(0, 33, 71, 0.1);
}

.auth-error-box {
    margin-bottom: 18px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #DC2626;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-clean-navy {
    width: 100%;
    height: 46px;
    background: #0A1128;
    color: #FFFFFF !important;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Kanit', sans-serif;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.btn-clean-navy:hover {
    background: #1E3A8A;
}

.btn-green {
    background: var(--btn-success);
}
.btn-green:hover {
    background: var(--btn-success-hover);
}

.auth-switch-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.88rem;
    color: #64748B;
}

.auth-switch-link a {
    color: var(--navy-dark);
    font-weight: 500;
    text-decoration: none;
    margin-left: 4px;
}

.auth-admin-hint {
    margin-top: 20px;
    padding: 10px;
    background: #F8FAFC;
    border-radius: var(--radius-sm);
    border: 1px dashed #CBD5E1;
    font-size: 0.8rem;
    color: #64748B;
    text-align: center;
}

/* Responsive Breakpoints & Clean Layout Fixes */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1023px) {
    .auth-hero-side {
        display: none;
    }
    .auth-form-side {
        width: 100%;
    }
    .sidebar {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open {
        display: block;
    }
    .btn-sidebar-close {
        display: block;
    }
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 900px) {
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .formal-doc-preview {
        height: auto !important;
    }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }
    .content-body {
        padding: 12px;
    }
    .stat-card {
        padding: 12px 14px;
    }
    .stat-card .stat-info .stat-value {
        font-size: 1.2rem;
    }
    .stat-card .stat-icon-wrapper {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    .page-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .content-body {
        padding: 8px;
    }
    .stat-card .stat-info .stat-value {
        font-size: 1.05rem;
    }
    .card {
        padding: 12px;
    }
    .table-container {
        font-size: 0.8rem;
    }
    th, td {
        padding: 6px 8px;
    }
    .btn {
        padding: 6px 10px;
        font-size: 0.82rem;
    }
}


/* ==========================================
   RIGHT-EDGE DOCKED FULL-HEIGHT AI CHAT PANEL
   ========================================== */
.ai-edge-tab-trigger {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 998;
    background: #0F172A;
    color: #38BDF8;
    border: 1px solid #1E293B;
    border-right: none;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: -2px 0 10px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    user-select: none;
}

.ai-edge-tab-trigger:hover {
    background: #1E293B;
    color: #FFFFFF;
}

.ai-edge-tab-trigger span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.78rem;
    letter-spacing: 1px;
    font-weight: 400;
}

.ai-chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 100vw;
    height: 100vh;
    background: #FFFFFF;
    border-left: 1px solid #CBD5E1;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-drawer.open {
    transform: translateX(0);
}

.ai-drawer-header {
    padding: 12px 16px;
    background: #0F172A;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1E293B;
    min-height: 48px;
}

.ai-drawer-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 500;
}

.ai-btn-clear, .ai-btn-close {
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.ai-btn-close {
    font-size: 1.3rem;
    line-height: 1;
}

.ai-btn-clear:hover, .ai-btn-close:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

.ai-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #F8FAFC;
}

.ai-msg-user {
    background: #1E3A8A;
    color: #FFFFFF;
    padding: 8px 12px;
    border-radius: 10px;
    border-bottom-right-radius: 2px;
    align-self: flex-end;
    max-width: 85%;
    font-size: 0.84rem;
    line-height: 1.45;
    word-break: break-word;
}

.ai-msg-bot {
    background: #FFFFFF;
    color: #0F172A;
    padding: 10px 12px;
    border-radius: 10px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    max-width: 90%;
    border: 1px solid #E2E8F0;
    font-size: 0.84rem;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    word-break: break-word;
}

.ai-drawer-footer {
    padding: 8px 10px;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    display: flex;
    gap: 6px;
}
