/* ============================================================
   Online Billing System - Main Stylesheet
   ============================================================ */

:root {
    --primary: #1a237e;
    --primary-light: #534bae;
    --primary-dark: #000051;
    --secondary: #00897b;
    --secondary-light: #4ebaaa;
    --secondary-dark: #005b4f;
    --accent: #ff6f00;
    --bg: #f0f2f8;
    --bg-card: #ffffff;
    --text: #212121;
    --text-light: #757575;
    --text-white: #ffffff;
    --border: #e3e6ef;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #f57f17;
    --info: #1565c0;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 6px;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

/* Animated App Background */
.app-container {
    position: relative;
    min-height: 100vh;
}
.app-container::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 10% 20%, rgba(26, 35, 126, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(0, 137, 123, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 111, 0, 0.02) 0%, transparent 60%);
    animation: bgPulse 20s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}
@keyframes bgPulse {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0.6; transform: scale(1); }
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 400px;
    max-width: 90vw;
}

.login-container .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-container .logo h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 5px;
}

.login-container .logo p {
    color: var(--text-light);
    font-size: 13px;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.btn:hover::after {
    transform: translateX(100%);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-white);
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(26, 35, 126, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    color: var(--text-white);
}

.btn-secondary:hover {
    box-shadow: 0 4px 15px rgba(0, 137, 123, 0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #e53935);
    color: var(--text-white);
}

.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(198, 40, 40, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #43a047);
    color: var(--text-white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* App Layout */
.app-layout,
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a237e 0%, #0d1452 40%, #0a1035 100%);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: var(--header-height);
}

.sidebar-header h2 {
    font-size: 18px;
    white-space: nowrap;
}

.sidebar-header .toggle-btn {
    background: none;
    border: none;
    color: var(--text-white);
    cursor: pointer;
    font-size: 20px;
    margin-left: auto;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-family: inherit;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
    padding-left: 24px;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-white);
    border-left: 3px solid var(--accent);
    box-shadow: inset 0 0 20px rgba(255, 111, 0, 0.05);
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-item .label {
    white-space: nowrap;
}

.collapsed .nav-item .label,
.collapsed .nav-section-title,
.collapsed .sidebar-header h2 {
    display: none;
}

/* Main Content */
.main-content,
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: var(--transition);
    min-width: 0;
    position: relative;
    z-index: 1;
}

.collapsed + .main-content,
.sidebar.collapsed ~ .main-content,
.collapsed + .main-area,
.sidebar.collapsed ~ .main-area {
    margin-left: 60px;
}

/* Header */
.app-header,
.header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1,
.header-left h2 {
    font-size: 20px;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 13px;
}

.breadcrumb span::after {
    content: '/';
    margin-left: 8px;
}

.breadcrumb span:last-child::after {
    content: '';
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.company-selector {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fff;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.user-info:hover {
    background: var(--bg);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.user-details .name {
    font-weight: 600;
    font-size: 13px;
}

.user-details .role {
    font-size: 11px;
    color: var(--text-light);
}

/* Page Content */
.page-content,
.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 16px;
    color: var(--primary);
}

.card-body {
    overflow-x: auto;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.3s;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-info h4 {
    font-size: 24px;
    font-weight: 700;
}

.stat-info p {
    color: var(--text-light);
    font-size: 13px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.data-table th {
    background: linear-gradient(180deg, #f8f9fc, #f0f2f8);
    font-weight: 600;
    color: var(--text);
    position: sticky;
    top: 0;
    z-index: 1;
    letter-spacing: 0.3px;
}

.data-table tr:hover {
    background: rgba(26, 35, 126, 0.04);
    transition: background 0.2s;
}

.data-table .amount {
    text-align: right;
    font-family: 'Consolas', 'Courier New', monospace;
}

.data-table .actions {
    display: flex;
    gap: 6px;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success {
    background: rgba(46, 125, 50, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(198, 40, 40, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 127, 23, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(21, 101, 192, 0.1);
    color: var(--info);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    width: 600px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(-20px) scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}

.search-box input {
    border: none;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    min-width: 200px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fff;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    font-family: inherit;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Alert / Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: var(--text-white);
    font-size: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    backdrop-filter: blur(10px);
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

.toast-info {
    background: var(--info);
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Page content fade-in */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content > *,
.content > * {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.content > *:nth-child(1) { animation-delay: 0.05s; }
.content > *:nth-child(2) { animation-delay: 0.1s; }
.content > *:nth-child(3) { animation-delay: 0.15s; }
.content > *:nth-child(4) { animation-delay: 0.2s; }
.content > *:nth-child(5) { animation-delay: 0.25s; }
.content > *:nth-child(6) { animation-delay: 0.3s; }

/* Dashboard Charts Area */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-placeholder {
    height: 250px;
    background: linear-gradient(135deg, #f8f9fc 0%, #e8ecf4 50%, #f0f2f8 100%);
    background-size: 200% 200%;
    animation: shimmer 3s ease infinite;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    border: 1px dashed var(--border);
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    font-family: inherit;
    font-size: 13px;
}

.quick-action:hover {
    border-color: var(--primary);
    background: rgba(26, 35, 126, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.quick-action .qa-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(26, 35, 126, 0.1);
    color: var(--primary);
}

/* Print Styles */
@media print {
    .sidebar,
    .app-header,
    .header,
    .toolbar,
    .btn {
        display: none !important;
    }

    .main-content,
    .main-area {
        margin-left: 0 !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    color: var(--text);
    transition: var(--transition);
    display: none;
    line-height: 1;
}
.sidebar-toggle:hover {
    background: var(--bg);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-datetime {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

/* ===== RESPONSIVE: Tablet ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 60px;
    }

    .sidebar .nav-text,
    .sidebar .nav-section-title,
    .sidebar-header h2,
    .sidebar-header small,
    .sidebar .label {
        display: none;
    }

    .main-content,
    .main-area {
        margin-left: 60px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .form-row-3 {
        grid-template-columns: 1fr 1fr;
    }

    .header-datetime {
        display: none;
    }
}

/* ===== RESPONSIVE: Mobile ===== */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
    }

    .sidebar.active .nav-text,
    .sidebar.active .nav-section-title,
    .sidebar.active h2,
    .sidebar.active small {
        display: block;
    }

    .sidebar.active ~ .sidebar-overlay {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content,
    .main-area {
        margin-left: 0;
    }

    .header {
        padding: 0 12px;
    }

    .page-content,
    .content {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        flex-wrap: wrap;
    }

    .search-box input {
        min-width: 120px;
    }

    .header-right {
        gap: 8px;
    }

    .header-datetime {
        display: none;
    }

    .user-menu .btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .user-menu #currentUserName {
        display: none;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
        font-size: 13px;
        padding: 8px 14px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .modal {
        width: 95vw;
        max-height: 90vh;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ===== RESPONSIVE: Small mobile ===== */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 14px;
    }

    .card {
        padding: 14px;
    }

    .page-content,
    .content {
        padding: 12px;
    }

    .header-left h2 {
        font-size: 15px;
    }
}

/* Utility Classes */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-muted {
    color: var(--text-light);
}

.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; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Focus ring for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
    animation: fadeInUp 0.5s ease forwards;
}

/* Smooth transitions for interactive elements */
a, button, input, select, textarea {
    transition: var(--transition);
}

/* Stat icon color improvements */
.stat-icon.blue {
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.1), rgba(21, 101, 192, 0.05));
    color: var(--info);
}

.stat-icon.green {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.1), rgba(46, 125, 50, 0.05));
    color: var(--success);
}

.stat-icon.orange {
    background: linear-gradient(135deg, rgba(255, 111, 0, 0.1), rgba(255, 111, 0, 0.05));
    color: var(--accent);
}

.stat-icon.red {
    background: linear-gradient(135deg, rgba(198, 40, 40, 0.1), rgba(198, 40, 40, 0.05));
    color: var(--danger);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Ledger tree */
.ledger-tree {
    list-style: none;
}

.ledger-tree li {
    padding: 6px 0;
}

.ledger-tree .group {
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.ledger-tree .group:hover {
    background: var(--bg);
}

.ledger-tree .children {
    padding-left: 24px;
    list-style: none;
}

/* Voucher Entry */
.voucher-entry-row {
    display: grid;
    grid-template-columns: 3fr 2fr 1fr 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.voucher-entry-row input,
.voucher-entry-row select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* Summary boxes */
.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.summary-box {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.summary-box .label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.summary-box .value {
    font-size: 20px;
    font-weight: 700;
}

/* Payslip styles */
.payslip {
    border: 1px solid var(--border);
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.payslip-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary);
}

.payslip-header h2 {
    color: var(--primary);
}

.payslip-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.payslip-details .item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.payslip-table {
    width: 100%;
    margin-bottom: 16px;
}

.payslip-table td {
    padding: 6px 12px;
    border: 1px solid var(--border);
}

/* Reconciliation */
.recon-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.recon-column h4 {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
