/* ==========================================
   BONNIE PRO — Modern UI
   ========================================== */

/* Google Font - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: rgba(99, 102, 241, 0.08);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger-color: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning-color: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info-color: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.1);
    --light-color: #f8fafc;
    --dark-color: #0f172a;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(99, 102, 241, 0.2);
    --border-color: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    background-color: #f1f5f9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 44px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    color: var(--dark-color);
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--secondary-color);
    font-size: 14px;
}

.login-form {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    margin: 5px 0;
    font-size: 13px;
    color: var(--secondary-color);
}

/* ==========================================
   LAYOUT
   ========================================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    width: 264px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

/* Slim scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.sidebar-header p {
    font-size: 13px;
    margin-bottom: 8px;
    color: #94a3b8;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav li.nav-section {
    padding: 20px 20px 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #475569;
    font-weight: 600;
    margin-top: 4px;
}

.sidebar-nav a {
    display: block;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 400;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background-color: var(--sidebar-hover);
    color: #f1f5f9;
}

.sidebar-nav li.active a {
    background: var(--sidebar-active);
    color: var(--primary-light);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

/* Quick Access Buttons */
.sidebar-nav li.nav-quick-access {
    display: flex;
    gap: 8px;
    padding: 16px 14px 8px;
    margin: 0;
}

.sidebar-nav li.nav-quick-access .quick-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: #94a3b8;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: var(--transition);
    text-align: center;
}

.sidebar-nav li.nav-quick-access .quick-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
    transform: translateY(-1px);
    padding-left: 4px;
}

.sidebar-nav li.nav-quick-access .quick-btn.active {
    background: var(--sidebar-active);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

.sidebar-nav li.nav-quick-access .quick-btn svg {
    opacity: 0.7;
}

.sidebar-nav li.nav-quick-access .quick-btn:hover svg,
.sidebar-nav li.nav-quick-access .quick-btn.active svg {
    opacity: 1;
}

/* Collapsible Navigation Groups */
.sidebar-nav .nav-group {
    margin: 0;
}

.sidebar-nav .nav-group-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    font-weight: 500;
    font-size: 13.5px;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-group-toggle:hover {
    background-color: var(--sidebar-hover);
    color: #f1f5f9;
}

.sidebar-nav .nav-group-toggle .chevron {
    transition: transform 0.3s ease;
    opacity: 0.4;
}

.sidebar-nav .nav-group.expanded .nav-group-toggle .chevron {
    transform: rotate(180deg);
}

.sidebar-nav .nav-group.expanded .nav-group-toggle {
    color: #f1f5f9;
}

.sidebar-nav .nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.15);
}

.sidebar-nav .nav-group-items li a {
    padding-left: 38px;
    font-size: 13px;
    color: #94a3b8;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-group-items li a:hover {
    color: #f1f5f9;
    padding-left: 38px;
    background-color: rgba(255, 255, 255, 0.04);
}

.sidebar-nav .nav-group-items li.active a {
    background: var(--sidebar-active);
    color: var(--primary-light);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    flex: 1;
    margin-left: 264px;
    padding: 28px 32px;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    animation: pageEnter 0.3s ease-out;
}

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

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 0;
    border-bottom: none;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
    letter-spacing: -0.5px;
}

.page-actions {
    display: flex;
    gap: 10px;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-color);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    background-color: var(--light-color);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ==========================================
   FORMS
   ========================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #475569;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--dark-color);
    background: white;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.col-md-6 {
    flex: 0 0 50%;
}

.col-md-4 {
    flex: 0 0 33.333%;
}

.col-md-3 {
    flex: 0 0 25%;
}

.form-actions {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 6.646a.5.5 0 0 1 .708 0L8 9.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.5;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background-color: white;
    color: #475569;
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--light-color);
    border-color: #cbd5e1;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #0891b2;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-block {
    display: block;
    width: 100%;
}

/* ==========================================
   TABLES
   ========================================== */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background-color: var(--light-color);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid var(--border-color);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13.5px;
    color: #334155;
}

.table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f1f5f9;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .actions {
    white-space: nowrap;
}

.table .actions .btn {
    margin-right: 4px;
}

/* ==========================================
   BADGES
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 50px;
    text-transform: capitalize;
    letter-spacing: 0.2px;
}

.badge-admin {
    background-color: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-manager {
    background-color: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.badge-staff {
    background-color: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.badge-active {
    background-color: var(--success-bg);
    color: #059669;
}

.badge-inactive {
    background-color: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.badge-paid {
    background-color: var(--success-bg);
    color: #059669;
}

.badge-unpaid {
    background-color: var(--danger-bg);
    color: #dc2626;
}

.badge-partial {
    background-color: var(--warning-bg);
    color: #b45309;
}

.badge-pending {
    background-color: var(--warning-bg);
    color: #b45309;
}

.badge-confirmed {
    background-color: var(--success-bg);
    color: #059669;
}

.badge-cancelled {
    background-color: var(--danger-bg);
    color: #dc2626;
}

.badge-pending_approval {
    background-color: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.badge-rejected {
    background-color: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.badge-available {
    background-color: var(--success-bg);
    color: #059669;
}

.badge-sold {
    background-color: var(--danger-bg);
    color: #dc2626;
}

.badge-reserved {
    background-color: var(--warning-bg);
    color: #b45309;
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
    padding: 14px 20px;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
    border: 1px solid;
    border-left: 4px solid;
    font-size: 13.5px;
    font-weight: 500;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

.alert-success {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    border-left-color: var(--success-color);
    color: #065f46;
}

.alert-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    border-left-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    border-left-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: var(--primary-color);
    color: #1e40af;
}

/* ==========================================
   PAGINATION
   ========================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.pagination a {
    padding: 8px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.pagination a:hover {
    background-color: var(--primary-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==========================================
   SEARCH FORM / FILTERS
   ========================================== */
.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-form .form-control {
    flex: 1;
    max-width: 400px;
}

/* ==========================================
   DASHBOARD STATS
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 12px;
    color: var(--secondary-color);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    letter-spacing: -0.5px;
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

/* ==========================================
   MODAL
   ========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
}

.modal-body {
    padding: 24px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--secondary-color);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--light-color);
    color: var(--dark-color);
}

/* ==========================================
   UTILITIES
   ========================================== */
.text-center {
    text-align: center;
}

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

.text-muted {
    color: var(--secondary-color);
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Required field indicator */
.required {
    color: var(--danger-color);
}

/* ==========================================
   TABS (used in project view, etc.)
   ========================================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    gap: 0;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: var(--secondary-color);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* ==========================================
   PROJECT CARDS
   ========================================== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.project-card-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.project-card-header a {
    text-decoration: none;
    color: inherit;
}

.project-card-header a:hover .project-card-name {
    color: var(--primary-color);
}

.project-card-number {
    font-size: 11px;
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.project-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 6px;
    transition: color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-card-client {
    font-size: 13px;
    color: var(--secondary-color);
}

.project-card-body {
    padding: 16px 20px;
    flex: 1;
}

.project-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 12.5px;
    color: var(--secondary-color);
}

.project-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-card-financials {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.project-financial-item {
    padding: 10px 12px;
    background: var(--light-color);
    border-radius: var(--radius-sm);
}

.project-financial-item .label {
    font-size: 11px;
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.project-financial-item .value {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark-color);
}

.project-financial-item .value.profit-positive {
    color: var(--success-color);
}

.project-financial-item .value.profit-negative {
    color: var(--danger-color);
}

.project-card-footer {
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--light-color);
}

.project-card-footer .badge {
    font-size: 11px;
}

/* ==========================================
   RESPONSIVE DESIGN
   Excludes: POS Module (remains desktop only)
   ========================================== */

/* Hide mobile elements by default (desktop) */
.mobile-menu-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* Tablet and Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .sidebar {
        width: 264px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1001;
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 10px 14px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(4px);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 72px 16px 24px;
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .page-actions {
        width: 100%;
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
        text-align: center;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        width: 100% !important;
        margin-right: 0 !important;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px;
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 10px 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
    }

    .card {
        margin-bottom: 16px;
    }

    .card-header,
    .card-body {
        padding: 16px;
    }

    .filter-section {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        margin-bottom: 10px;
    }

    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .tab {
        white-space: nowrap;
    }

    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .action-buttons .btn-sm {
        width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .hide-mobile {
        display: none;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .main-content {
        padding: 64px 12px 16px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-control {
        font-size: 14px;
        padding: 10px 12px;
    }

    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .modal-content {
        width: 98%;
        padding: 16px;
    }

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

    .stat-card .stat-value {
        font-size: 24px;
    }
}

/* ==========================================
   POS MODULE — DESKTOP ONLY
   ========================================== */
.pos-page,
.pos-container,
body.pos-view {
    min-width: 1024px !important;
    overflow-x: auto !important;
}

@media (max-width: 768px) {
    .pos-page .sidebar,
    .pos-page .main-content,
    .pos-container {
        transform: none !important;
        width: auto !important;
        margin-left: 264px !important;
    }

    .pos-page .mobile-menu-toggle {
        display: none !important;
    }

    .pos-mobile-warning {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: var(--warning-color);
        color: #000;
        padding: 10px;
        text-align: center;
        z-index: 9999;
        font-size: 13px;
        font-weight: 600;
    }
}

/* Laptop screens (max-width: 1440px) */
@media (max-width: 1440px) {
    .main-content {
        padding: 20px 16px;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-actions {
        gap: 4px;
    }

    .page-actions .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Landscape mode optimization for tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .form-group {
        flex: 1 1 calc(50% - 10px);
    }
}

/* ==========================================
   BONNIE AI CHAT WIDGET
   ========================================== */

#bonnie-chat {
    position: fixed;
    z-index: 9999;
    --primary-color: #dc2626;
    --primary-dark: #b91c1c;
    --primary-light: #ef4444;
}

/* Toggle button */
#bonnie-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    color: #fff;
    border: 3px solid var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.35);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    padding: 0;
    overflow: hidden;
}

#bonnie-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(220, 38, 38, 0.5);
}

#bonnie-toggle.active {
    background: var(--dark-color);
    border-color: var(--dark-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Chat panel */
#bonnie-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 400px;
    height: 540px;
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

#bonnie-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
#bonnie-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    flex-shrink: 0;
}

#bonnie-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#bonnie-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

#bonnie-name {
    font-weight: 600;
    font-size: 15px;
}

#bonnie-status {
    font-size: 11px;
    opacity: 0.8;
}

#bonnie-header-actions {
    display: flex;
    gap: 4px;
}

#bonnie-header-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#bonnie-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* History panel */
#bonnie-history {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 5;
    flex-direction: column;
}

#bonnie-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
}

#bonnie-history-header button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 4px;
    border-radius: 4px;
}

#bonnie-history-header button:hover {
    background: var(--light-color);
}

#bonnie-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.bonnie-history-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    margin-bottom: 2px;
}

.bonnie-history-item:hover {
    background: var(--light-color);
}

.bonnie-history-item.active {
    background: var(--primary-bg);
}

.bonnie-history-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

.bonnie-history-meta {
    font-size: 11px;
    color: var(--secondary-color);
    margin-top: 2px;
}

.bonnie-history-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 2px 6px;
    border-radius: 4px;
}

.bonnie-history-item:hover .bonnie-history-delete {
    opacity: 1;
}

.bonnie-history-delete:hover {
    color: var(--danger-color);
    background: var(--danger-bg);
}

/* Messages area */
#bonnie-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.bonnie-msg {
    display: flex;
    gap: 8px;
    max-width: 92%;
    animation: bonnieFadeIn 0.3s ease;
}

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

.bonnie-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bonnie-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.bonnie-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.bonnie-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
}

.bonnie-msg-assistant .bonnie-msg-bubble {
    background: var(--light-color);
    color: var(--dark-color);
    border-bottom-left-radius: 4px;
}

.bonnie-msg-user .bonnie-msg-bubble {
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bonnie-msg-bubble p {
    margin: 0 0 8px 0;
}

.bonnie-msg-bubble p:last-child {
    margin-bottom: 0;
}

.bonnie-msg-bubble strong {
    font-weight: 600;
}

.bonnie-msg-bubble code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.bonnie-msg-bubble ul, .bonnie-msg-bubble ol {
    margin: 4px 0;
    padding-left: 18px;
}

.bonnie-msg-bubble li {
    margin-bottom: 2px;
}

/* Typing indicator */
.bonnie-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 14px 18px !important;
}

.bonnie-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--secondary-color);
    animation: bonnieTypingDot 1.4s infinite ease-in-out;
}

.bonnie-typing span:nth-child(2) { animation-delay: 0.2s; }
.bonnie-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bonnieTypingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input area */
#bonnie-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: #fff;
    flex-shrink: 0;
}

#bonnie-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    resize: none;
    outline: none;
    overflow: hidden;
    max-height: 100px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

#bonnie-input:focus {
    border-color: var(--primary-color);
}

#bonnie-input::placeholder {
    color: #94a3b8;
}

#bonnie-send {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

#bonnie-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

#bonnie-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Attach button */
#bonnie-attach {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: none;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s;
}

#bonnie-attach:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Camera button */
#bonnie-camera {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: none;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s;
}

#bonnie-camera:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Mic button */
#bonnie-mic {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: none;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

#bonnie-mic:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

#bonnie-mic.recording {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    animation: bonnie-pulse 1.5s ease-in-out infinite;
}

@keyframes bonnie-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Image preview bar */
#bonnie-image-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

#bonnie-image-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#bonnie-image-preview button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger-color);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#bonnie-image-preview button:hover {
    background: #b91c1c;
}

/* Chat image thumbnails */
.bonnie-chat-image {
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    object-fit: cover;
    transition: opacity 0.2s;
}

.bonnie-chat-image:hover {
    opacity: 0.85;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #bonnie-panel {
        left: 8px;
        right: 8px;
        bottom: 80px;
        width: auto;
        height: calc(100vh - 120px);
        max-height: 600px;
    }

    #bonnie-toggle {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
}
