html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100vh;
    transition: left 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar .nav-link {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-radius: 0;
    transition: background-color 0.2s;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left: 3px solid #0d6efd;
}

.sidebar-header {
    font-size: 1.1rem;
}

/* Page content */
#page-content {
    margin-left: 250px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Sidebar toggle (desktop) */
.sidebar.desktop-hidden {
    left: -250px !important;
}

.sidebar.desktop-hidden ~ #page-content {
    margin-left: 0 !important;
}

/* Cards */
.card-dashboard {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.card-dashboard:hover {
    transform: translateY(-2px);
}

.card-dashboard .card-body {
    padding: 1.25rem;
}

.card-dashboard .card-icon {
    font-size: 2rem;
    opacity: 0.7;
}

/* Status badges */
.badge-draft { background-color: #6c757d; }
.badge-submitted { background-color: #0d6efd; }
.badge-pending { background-color: #ffc107; color: #000; }
.badge-approved { background-color: #198754; }
.badge-processing { background-color: #0dcaf0; color: #000; }
.badge-completed { background-color: #198754; }
.badge-voided { background-color: #dc3545; }
.badge-cancelled { background-color: #dc3545; }

/* Table styles */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: none;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Search bar */
.search-box {
    max-width: 300px;
}

/* Login page */
.login-card {
    max-width: 420px;
    margin: 100px auto;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* ===== Mobile Responsive (< 768px) ===== */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed !important;
        left: -260px;
        top: 0;
        z-index: 1050;
        width: 260px !important;
        height: 100vh !important;
        transition: left 0.3s ease;
    }
    .sidebar.show {
        left: 0;
    }
    #page-content {
        margin-left: 0 !important;
    }
    .top-navbar {
        height: 50px;
    }
    .top-navbar .navbar-text.tenant-name-text {
        display: none !important;
    }
    .breadcrumb-bar {
        padding: 0.35rem 0.75rem;
    }
    .breadcrumb-bar .breadcrumb {
        font-size: 0.75rem;
    }
    .breadcrumb-bar .breadcrumb-item:not(.active) {
        display: none;
    }
    main.content-area {
        padding: 0.75rem;
        overflow-x: hidden;
    }
    .d-mobile-none {
        display: none !important;
    }
    .d-mobile-only {
        display: block !important;
    }
    .table-responsive-mobile th:nth-child(n+5),
    .table-responsive-mobile td:nth-child(n+5) {
        display: none;
    }
    .kpi-card {
        margin-bottom: 0.5rem;
    }
    .kpi-value {
        font-size: 1.5rem !important;
    }
    .kpi-label {
        font-size: 0.75rem !important;
    }
    #ai-cs-widget {
        bottom: 12px !important;
        right: 12px !important;
    }
    #ai-cs-toggle {
        padding: 8px 12px;
        border-radius: 24px;
    }
    #ai-cs-toggle span:last-child {
        display: none;
    }
    #ai-cs-panel {
        width: calc(100vw - 24px) !important;
        max-width: 380px;
        right: 0;
        bottom: 55px;
    }
    .search-box {
        max-width: 100%;
    }
}

/* Form sections */
.form-section {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.form-section h6 {
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* Pagination */
.pagination .page-link {
    font-size: 0.85rem;
}

/* Print */
@media print {
    .sidebar, .navbar, .breadcrumb, .btn {
        display: none !important;
    }
    #page-content {
        margin-left: 0 !important;
    }
}
