/**
 * Business Panel - Main Stylesheet
 * Modern, Mobile-First, Professional Admin UI
 */

/* ============================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */
:root {
    /* Primary Colors */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Gray Scale */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic Colors */
    --success-50: #ecfdf5;
    --success-500: #10b981;
    --success-600: #059669;
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Background & Surface */
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-sidebar: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Border */
    --border-color: #e2e8f0;
    --border-radius-sm: 6px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ============================================
   DARK MODE THEME
   ============================================ */
body.dark-mode {
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #334155;
    --bg-sidebar: linear-gradient(180deg, #0f172a 0%, #020617 100%);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --border-color: #334155;

    --gray-50: #1e293b;
    --gray-100: #334155;
    --gray-200: #475569;
    --gray-700: #cbd5e1;
    --gray-800: #e2e8f0;
    --gray-900: #f1f5f9;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);

    /* Dark mode semantic colors */
    --success-50: #064e3b;
    --warning-50: #78350f;
    --danger-50: #7f1d1d;
    --info-50: #1e3a8a;
}

/* Dark mode specific overrides */
body.dark-mode .card {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

body.dark-mode .page-header {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

body.dark-mode .table th {
    background: var(--bg-surface-elevated);
}

body.dark-mode .table td {
    border-color: var(--border-color);
}

body.dark-mode .form-input,
body.dark-mode .form-select,
body.dark-mode .form-textarea {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .form-input:focus,
body.dark-mode .form-select:focus {
    border-color: var(--primary-500);
}

body.dark-mode .stat-card {
    background: var(--bg-surface);
}

body.dark-mode .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .tabs .tab-btn {
    color: var(--text-secondary);
}

body.dark-mode .tabs .tab-btn.active {
    color: var(--primary-400);
    border-color: var(--primary-400);
}

body.dark-mode .btn {
    border-color: var(--border-color);
}

body.dark-mode .btn-ghost {
    color: var(--text-secondary);
}

body.dark-mode .btn-ghost:hover {
    background: var(--bg-surface-elevated);
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 20px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--gray-100);
}

body.dark-mode .theme-toggle:hover {
    background: var(--bg-surface-elevated);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    transition: var(--transition);
}

body.dark-mode .theme-toggle .icon-sun {
    display: inline;
}

body.dark-mode .theme-toggle .icon-moon {
    display: none;
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: inline;
}

/* ============================================
   BASE RESET & TYPOGRAPHY
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-body);
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.875rem;
}

p {
    margin-bottom: var(--space-4);
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.page-content {
    flex: 1;
    padding: var(--space-6);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition);
}

.sidebar-collapsed .sidebar-title {
    opacity: 0;
    pointer-events: none;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    margin-bottom: var(--space-4);
}

.nav-section-title {
    padding: var(--space-2) var(--space-5);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    white-space: nowrap;
}

.sidebar-collapsed .nav-section-title {
    opacity: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: var(--gray-300);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--text-inverse);
    background: rgba(99, 102, 241, 0.2);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary-500);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    opacity: 1;
    transition: opacity var(--transition);
}

.sidebar-collapsed .nav-text {
    opacity: 0;
    pointer-events: none;
}

.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-500);
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.sidebar-collapsed .user-info {
    display: none;
}

/* Sidebar Credit */
.sidebar-credit {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    color: var(--gray-400);
    text-align: center;
    letter-spacing: 0.02em;
}

.sidebar-collapsed .sidebar-credit {
    display: none;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* ============================================
   HEADER
   ============================================ */
.page-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-date-filter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
}

/* Stat Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-surface);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: var(--info-50);
    color: var(--info-600);
}

.stat-icon.green {
    background: var(--success-50);
    color: var(--success-600);
}

.stat-icon.orange {
    background: var(--warning-50);
    color: var(--warning-600);
}

.stat-icon.red {
    background: var(--danger-50);
    color: var(--danger-600);
}

.stat-icon.purple {
    background: var(--primary-50);
    color: var(--primary-600);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-change {
    font-size: 0.75rem;
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.stat-change.positive {
    color: var(--success-600);
}

.stat-change.negative {
    color: var(--danger-600);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: 0.8125rem;
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-600);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-700);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success-600);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-500);
}

.btn-danger {
    background: var(--danger-600);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-500);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-500);
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger-500);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-50);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger-500);
    margin-top: var(--space-1);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--primary-600);
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-label {
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* Switch Toggle */
.form-switch {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.switch-toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.switch-toggle input:checked+.switch-slider {
    background: var(--primary-600);
}

.switch-toggle input:checked+.switch-slider::before {
    transform: translateX(20px);
}

/* Input Group */
.input-group {
    display: flex;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-100);
    border: 1px solid var(--border-color);
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--gray-50);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--border-radius-full);
}

.status-badge.pending {
    background: var(--warning-50);
    color: var(--warning-600);
}

.status-badge.processing {
    background: var(--info-50);
    color: var(--info-600);
}

.status-badge.completed {
    background: var(--success-50);
    color: var(--success-600);
}

.status-badge.cancelled {
    background: var(--danger-50);
    color: var(--danger-600);
}

.status-badge.draft {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-badge.publish {
    background: var(--success-50);
    color: var(--success-600);
}

/* ============================================
   ACCORDION
   ============================================ */
.accordion {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--border-color);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    background: var(--gray-50);
    border: none;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    transition: background var(--transition-fast);
}

.accordion-header:hover {
    background: var(--gray-100);
}

.accordion-icon {
    width: 20px;
    height: 20px;
    transition: transform var(--transition);
}

.accordion-item.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-body {
    padding: var(--space-5);
    display: none;
}

.accordion-item.open .accordion-body {
    display: block;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    min-width: 300px;
    max-width: 400px;
    padding: var(--space-4);
    background: var(--bg-surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-600);
}

.toast.error .toast-icon {
    color: var(--danger-600);
}

.toast.warning .toast-icon {
    color: var(--warning-600);
}

.toast.info .toast-icon {
    color: var(--info-600);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.toast-close {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    cursor: pointer;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: var(--space-4);
}

.loading-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* Page Loading */
.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
    position: relative;
    height: 300px;
}

.chart-container canvas {
    max-height: 100%;
}

/* ============================================
   DATE FILTERS
   ============================================ */
.date-filters {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
    padding: var(--space-4);
    background: var(--bg-surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.date-filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.date-filter-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.date-filter-group input[type="date"] {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.date-filter-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Quick Filter Buttons Active State */
.date-filters [data-filter-quick] {
    transition: all var(--transition-fast);
}

.date-filters [data-filter-quick].active {
    background: var(--primary-600);
    color: white;
}

.date-filters [data-filter-quick]:hover:not(.active) {
    background: var(--gray-200);
}

/* Site Name Display */
.site-name-badge {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: var(--space-2);
    padding: var(--space-1) var(--space-2);
    background: var(--gray-100);
    border-radius: var(--border-radius);
}

/* ============================================
   PRODUCT BLOCKS (BULK CREATION)
   ============================================ */
.product-blocks {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.product-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.product-block-header {
    padding: var(--space-4) var(--space-5);
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-block-title {
    font-size: 0.9375rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.product-block-number {
    width: 28px;
    height: 28px;
    background: var(--primary-600);
    color: white;
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
}

.product-block-body {
    padding: var(--space-5);
}

.product-block-actions {
    display: flex;
    gap: var(--space-2);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
}

/* ============================================
   DATE FILTERS
   ============================================ */
.date-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--space-6);
}

.date-filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.date-filter-group label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.date-filter-group input[type="date"],
.date-filter-group select {
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.pagination-btn.active {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.auth-header {
    padding: var(--space-8) var(--space-8) var(--space-6);
    text-align: center;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto var(--space-5);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.auth-body {
    padding: 0 var(--space-8) var(--space-8);
}

.auth-footer {
    padding: var(--space-4) var(--space-8);
    background: var(--gray-50);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.otp-input-group {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    margin: var(--space-6) 0;
}

.otp-input {
    width: 50px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: var(--space-4);
    }

    .page-header {
        padding: var(--space-3) var(--space-4);
    }

    .page-title {
        font-size: 1.125rem;
    }

    .stat-cards {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .date-filters {
        flex-direction: column;
    }

    .header-date-filter {
        display: none;
    }

    .toast-container {
        top: auto;
        bottom: var(--space-4);
        right: var(--space-4);
        left: var(--space-4);
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .chart-container {
        height: 250px;
    }

    .auth-card {
        border-radius: var(--border-radius-lg);
    }

    .auth-header,
    .auth-body {
        padding-left: var(--space-5);
        padding-right: var(--space-5);
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success-600);
}

.text-danger {
    color: var(--danger-600);
}

.text-warning {
    color: var(--warning-600);
}

.mt-0 {
    margin-top: 0;
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.d-flex {
    display: flex;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.w-full {
    width: 100%;
}

.cursor-pointer {
    cursor: pointer;
}

/* Low Stock Highlight */
.low-stock {
    background-color: var(--danger-50) !important;
}

.low-stock td {
    color: var(--danger-600);
}

/* Rich Text Editor */
.rich-editor {
    min-height: 200px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.rich-editor-toolbar {
    padding: var(--space-2) var(--space-3);
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.rich-editor-toolbar button {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.rich-editor-toolbar button:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.rich-editor-toolbar button.active {
    background: var(--primary-100);
    color: var(--primary-600);
}

.rich-editor-content {
    padding: var(--space-4);
    min-height: 150px;
    outline: none;
}

/* Image Upload */
.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.image-upload-area:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
}

.image-upload-area.dragover {
    border-color: var(--primary-500);
    background: var(--primary-100);
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger-500);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--border-radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* Tabs */
.tabs {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.tab-btn {
    padding: var(--space-3) var(--space-1);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Variation Pills */
.variation-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.variation-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--gray-100);
    border-radius: var(--border-radius-full);
    font-size: 0.8125rem;
}

.variation-pill .remove {
    cursor: pointer;
    color: var(--text-muted);
}

.variation-pill .remove:hover {
    color: var(--danger-500);
}

/* Notification Bell */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-bell:hover {
    background: var(--gray-100);
}

.notification-bell svg {
    color: var(--gray-600);
}

.notification-bell.has-new svg {
    color: var(--primary);
    animation: bellRing 0.5s ease-in-out;
}

@keyframes bellRing {

    0%,
    100% {
        transform: rotate(0);
    }

    20%,
    60% {
        transform: rotate(-15deg);
    }

    40%,
    80% {
        transform: rotate(15deg);
    }
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1000;
    display: none;
}

.notification-dropdown.active {
    display: block;
}

.notification-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item .order-id {
    font-weight: 600;
    color: var(--primary);
}

.notification-item .order-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.notification-item .order-time {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.notification-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
}

/* Order Toast Notification */
.order-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: white;
    padding: 16px 20px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInUp 0.3s ease;
    max-width: 350px;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.order-toast .toast-icon {
    font-size: 24px;
}

.order-toast .toast-content h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.order-toast .toast-content p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.order-toast .toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    font-size: 16px;
}

.order-toast .toast-close:hover {
    opacity: 1;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .order-edit-container {
        grid-template-columns: 1fr !important;
    }

    .order-sidebar {
        order: -1;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {

    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
    }

    .sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    /* Main content full width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Page header mobile */
    .page-header {
        padding: 12px 16px;
    }

    .page-title {
        font-size: 18px;
    }

    /* Stats grid single column */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* Date filters stack vertically */
    .date-filters {
        padding: 12px;
    }

    .date-filters form {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .date-filter-group {
        width: 100%;
    }

    .date-filter-group input,
    .date-filter-group select {
        width: 100%;
    }

    .date-filters .btn {
        width: 100%;
    }

    /* Cards */
    .card {
        border-radius: 8px;
        margin: 0 -8px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Tables responsive */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px;
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
        white-space: nowrap;
    }

    /* Order edit mobile */
    .order-meta {
        grid-template-columns: 1fr !important;
    }

    .address-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .items-table {
        font-size: 11px;
    }

    .items-table .product-info {
        flex-direction: column;
        gap: 4px;
    }

    .items-table .product-thumb {
        width: 32px;
        height: 32px;
    }

    /* Notification dropdown mobile */
    .notification-dropdown {
        position: fixed;
        top: 60px;
        left: 16px;
        right: 16px;
        width: auto;
    }

    /* Pagination mobile */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .pagination-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Customer summary mobile */
    .customer-summary {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    /* Customers table specific */
    .customers-table {
        min-width: 900px;
    }

    /* Inventory table */
    .inventory-table {
        min-width: 800px;
    }

    .inventory-table input {
        min-width: 60px;
        font-size: 11px;
        padding: 4px 6px;
    }

    /* Headers with notification */
    .header-right {
        gap: 8px;
    }

    .notification-bell {
        padding: 6px;
        font-size: 1.1rem;
    }

    .btn-ghost {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Order toast mobile */
    .order-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
}

/* Small mobile (max-width: 480px) */
@media (max-width: 480px) {
    .page-content {
        padding: 12px;
    }

    .page-title {
        font-size: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    /* Hide less important columns on very small screens */
    .table .hide-mobile {
        display: none;
    }

    /* Compact buttons */
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Order edit mobile compact */
    .order-section-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .order-section-body {
        padding: 16px;
    }

    .sidebar-card-header {
        padding: 12px;
    }

    .sidebar-card-body {
        padding: 12px;
    }

    /* Back link */
    .back-link {
        font-size: 12px;
        margin-bottom: 12px;
    }
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #fff;
    font-size: 16px;
    min-width: 36px;
    min-height: 36px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Show moon by default (light mode), hide sun */
.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: inline;
}

/* In dark mode: show sun, hide moon */
body.dark-mode .theme-toggle .icon-sun {
    display: inline;
}

body.dark-mode .theme-toggle .icon-moon {
    display: none;
}

/* Sidebar Footer Styles */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.sidebar-credit {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    text-align: center;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   DARK MODE STYLES
   ============================================ */

/* Dark mode - Override CSS Variables */
body.dark-mode {
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Dark Mode - Body and Main Content */
body.dark-mode {
    background-color: #0f172a;
    color: #f1f5f9;
}

body.dark-mode .main-content {
    background-color: #0f172a;
}

/* Dark Mode - Cards */
body.dark-mode .card,
body.dark-mode .stat-card {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .card-header {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .card-title {
    color: #f1f5f9;
}

body.dark-mode .card-body {
    color: #e2e8f0;
}

/* Dark Mode - Page Header */
body.dark-mode .page-header {
    background-color: #1e293b;
    border-color: #334155;
}

body.dark-mode .page-title {
    color: #f1f5f9;
}

/* Dark Mode - Text and Labels */
body.dark-mode,
body.dark-mode p,
body.dark-mode span,
body.dark-mode div,
body.dark-mode label {
    color: #e2e8f0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #f1f5f9;
}

body.dark-mode .text-muted,
body.dark-mode small {
    color: #94a3b8 !important;
}

/* Dark Mode - Forms */
body.dark-mode .form-input,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
body.dark-mode input[type="date"],
body.dark-mode input[type="search"],
body.dark-mode select,
body.dark-mode textarea {
    background-color: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

body.dark-mode .form-input::placeholder,
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #94a3b8;
}

body.dark-mode .form-input:focus,
body.dark-mode .form-control:focus,
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
    border-color: #6366f1;
    background-color: #1e293b;
    color: #f1f5f9;
}

body.dark-mode .form-label {
    color: #e2e8f0;
}

body.dark-mode .form-hint {
    color: #94a3b8;
}

/* Dark Mode - Tables */
body.dark-mode table {
    color: #e2e8f0;
}

body.dark-mode th {
    background-color: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark-mode td {
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode tr:hover {
    background-color: #334155;
}

body.dark-mode tbody tr:nth-child(even) {
    background-color: rgba(51, 65, 85, 0.3);
}

/* Dark Mode - Buttons */
body.dark-mode .btn-secondary,
body.dark-mode .btn-ghost {
    background-color: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark-mode .btn-secondary:hover,
body.dark-mode .btn-ghost:hover {
    background-color: #475569;
}

/* Dark Mode - Tabs */
body.dark-mode .tabs {
    background-color: #1e293b;
    border-color: #334155;
}

body.dark-mode .tab-btn {
    color: #94a3b8;
}

body.dark-mode .tab-btn.active {
    background-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .tab-content {
    background-color: #1e293b;
}

/* Dark Mode - Sidebar (already dark, but ensure consistency) */
body.dark-mode .sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

/* Dark Mode - Badges and Status */
body.dark-mode .badge {
    color: #f1f5f9;
}

/* Dark Mode - Alerts */
body.dark-mode .alert {
    border-color: #475569;
}

/* Dark Mode - Stat Cards */
body.dark-mode .stat-value {
    color: #f1f5f9;
}

body.dark-mode .stat-label {
    color: #94a3b8;
}

body.dark-mode .stat-change {
    color: #94a3b8;
}

/* Dark Mode - Links */
body.dark-mode a {
    color: #818cf8;
}

body.dark-mode a:hover {
    color: #a5b4fc;
}

/* Dark Mode - Modal/Dialog */
body.dark-mode .modal-content {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .modal-header {
    border-color: #334155;
}

body.dark-mode .modal-footer {
    border-color: #334155;
}

/* Dark Mode - Dropdown */
body.dark-mode .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
}

body.dark-mode .dropdown-item {
    color: #e2e8f0;
}

body.dark-mode .dropdown-item:hover {
    background-color: #334155;
}

/* Dark Mode - Scrollbar */
body.dark-mode ::-webkit-scrollbar {
    background: #1e293b;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Dark Mode - Code and Pre */
body.dark-mode code,
body.dark-mode pre {
    background-color: #334155;
    color: #e2e8f0;
}

/* Dark Mode - Invoice/Order Sections */
body.dark-mode .order-section,
body.dark-mode .invoice-section {
    background-color: #1e293b;
    border-color: #334155;
}

body.dark-mode .order-section-header {
    background-color: #334155;
    color: #f1f5f9;
}

/* Dark Mode - Theme Toggle Icon */
body.dark-mode .theme-toggle {
    color: #f1f5f9;
}

/* Dark Mode - Filters and Search */
body.dark-mode .filter-card,
body.dark-mode .search-box {
    background-color: #1e293b;
    border-color: #334155;
}

/* Dark Mode - Summary/Info Boxes */
body.dark-mode .info-box,
body.dark-mode .summary-box {
    background-color: #334155;
    color: #e2e8f0;
}

/* Dark Mode - Profit/Loss indicators */
body.dark-mode .profit {
    color: #4ade80;
}

body.dark-mode .loss {
    color: #f87171;
}

/* Dark Mode - Chart backgrounds */
body.dark-mode canvas {
    background-color: transparent;
}

/* Dark Mode - Inline styles override (for elements with inline bg) */
body.dark-mode [style*="background: #f"] {
    background-color: #334155 !important;
}

body.dark-mode [style*="background-color: #f"] {
    background-color: #334155 !important;
}

body.dark-mode [style*="background: white"],
body.dark-mode [style*="background-color: white"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background-color: #fff"] {
    background-color: #1e293b !important;
}

body.dark-mode [style*="color: #333"],
body.dark-mode [style*="color: #1"],
body.dark-mode [style*="color: #2"] {
    color: #e2e8f0 !important;
}

/* Dark Mode - License card backgrounds */
body.dark-mode [style*="background: linear-gradient(135deg, #f3f4f6"],
body.dark-mode [style*="background: linear-gradient(135deg, #e5e7eb"] {
    background: linear-gradient(135deg, #334155, #475569) !important;
}

/* ============================================
   RESPONSIVE GRID CLASSES
   ============================================ */

/* Base responsive grid - auto-fit columns */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* 1:1 grid (2 equal columns) */
.responsive-grid-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* 2:1 grid */
.responsive-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* 1:2 grid */
.responsive-grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-top: 24px;
    margin-bottom: 24px;
}

/* Responsive flex */
.responsive-flex {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.responsive-flex>label,
.responsive-flex>div {
    flex: 1;
}

/* Source selector for WhatsApp/Email */
.source-selector>label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    flex: 1;
}

/* Invoice details row */
.invoice-details-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

/* Invoice item row */
.invoice-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* Mobile: Stack all grids */
@media screen and (max-width: 768px) {

    .responsive-grid,
    .responsive-grid-1-1,
    .responsive-grid-2-1,
    .responsive-grid-1-2,
    .invoice-details-row {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    .responsive-grid>*,
    .responsive-grid-1-1>*,
    .responsive-grid-2-1>*,
    .responsive-grid-1-2>*,
    .invoice-details-row>* {
        margin-bottom: 16px !important;
        width: 100% !important;
    }

    .responsive-flex,
    .source-selector {
        flex-direction: column !important;
    }

    .responsive-flex>label,
    .responsive-flex>div,
    .source-selector>label {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    /* Invoice items - stack vertically on mobile */
    .invoice-item-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 12px !important;
        background: #f8fafc !important;
        border-radius: 8px !important;
        margin-bottom: 16px !important;
    }

    .invoice-item-row input {
        width: 100% !important;
    }

    .invoice-item-row .btn {
        width: 100% !important;
        margin-top: 8px !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablet and Below (≤1024px) */
@media screen and (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    .dashboard-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: var(--space-4);
    }
}

/* Mobile Devices (≤768px) */
@media screen and (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    /* Sidebar - Hidden by default on mobile */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left var(--transition);
        width: 280px;
    }

    .sidebar.active {
        left: 0;
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main Content - Full width on mobile */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Header Adjustments */
    .page-header {
        padding: var(--space-3) var(--space-4);
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .page-header h2 {
        font-size: 1.25rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Menu Toggle Button */
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: var(--primary-500);
        color: white;
        border-radius: var(--border-radius);
        cursor: pointer;
        font-size: 1.25rem;
    }

    /* Page Content */
    .page-content {
        padding: var(--space-3);
    }

    /* Stat Cards - 2 columns, then 1 */
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .stat-card {
        padding: var(--space-3);
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Cards */
    .card {
        border-radius: var(--border-radius);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
        padding: var(--space-3);
    }

    .card-header .btn {
        width: 100%;
    }

    .card-body {
        padding: var(--space-3);
    }

    /* Tables - Horizontal Scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 calc(var(--space-3) * -1);
        padding: 0 var(--space-3);
    }

    .table {
        min-width: 600px;
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: var(--space-2) var(--space-3);
        white-space: nowrap;
    }

    /* Forms */
    .form-group {
        margin-bottom: var(--space-3);
    }

    .form-label {
        font-size: 0.875rem;
    }

    .form-control,
    .form-select,
    .form-input {
        padding: var(--space-3);
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    /* Form Grid - Stack vertically */
    .form-row,
    .form-grid,
    [style*="display: grid"][style*="grid-template-columns"] {
        display: block !important;
    }

    .form-row>*,
    .form-grid>* {
        margin-bottom: var(--space-3);
    }

    /* Buttons */
    .btn {
        padding: var(--space-3) var(--space-4);
        font-size: 0.875rem;
        min-height: 44px;
        /* Touch-friendly */
    }

    .btn-sm {
        padding: var(--space-2) var(--space-3);
        min-height: 36px;
    }

    .btn-group {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    /* Date Filters */
    .date-filters {
        flex-direction: column;
        gap: var(--space-3);
        padding: var(--space-3);
    }

    .date-filter-group {
        width: 100%;
    }

    .date-filter-group input {
        width: 100%;
    }

    .date-filters .btn {
        width: 100%;
    }

    /* Quick Filter Buttons - Grid */
    .date-filters [data-filter-quick] {
        flex: 1;
        min-width: 80px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: var(--space-3);
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-3);
    }

    /* Tabs */
    .tab-buttons {
        flex-wrap: wrap;
        gap: var(--space-2);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-2);
    }

    .tab-btn {
        flex-shrink: 0;
        padding: var(--space-2) var(--space-3);
        font-size: 0.875rem;
        white-space: nowrap;
    }

    /* Settings Page Tabs */
    .settings-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: var(--space-2);
    }

    .settings-tabs .tab-btn {
        display: inline-block;
    }

    /* Invoice & Shipping Label Layout */
    .invoice-layout,
    .label-layout {
        padding: var(--space-3);
    }

    .invoice-header,
    .label-header {
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }

    .bill-section {
        flex-direction: column;
        gap: var(--space-4);
    }

    .bill-block {
        text-align: left !important;
    }

    /* Profit & Loss Summary */
    .summary-cards,
    .profit-loss-summary {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    /* Charts */
    .chart-container {
        height: 250px !important;
        min-height: 200px;
    }

    /* Order Details */
    .order-details-grid {
        grid-template-columns: 1fr;
    }

    .order-section {
        padding: var(--space-3);
    }

    /* Customer Grid */
    .customer-grid,
    .products-grid {
        grid-template-columns: 1fr;
    }

    /* Action Buttons in Tables */
    .action-buttons {
        flex-direction: column;
        gap: var(--space-2);
    }

    .action-buttons .btn {
        width: 100%;
    }

    /* Dropdown Menus */
    .dropdown-menu {
        position: fixed !important;
        left: var(--space-3) !important;
        right: var(--space-3) !important;
        width: auto !important;
        max-width: none !important;
    }

    /* Empty States */
    .empty-state {
        padding: var(--space-6);
    }

    .empty-state-icon {
        font-size: 3rem;
    }

    /* Product Info in Tables */
    .product-info {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .product-thumb {
        width: 40px;
        height: 40px;
    }

    /* WhatsApp & Email Marketing Cards */
    .marketing-grid {
        grid-template-columns: 1fr;
    }

    /* Switch Toggle */
    .form-switch {
        flex-wrap: wrap;
    }

    /* Notifications */
    .notification-dropdown {
        position: fixed;
        left: var(--space-3);
        right: var(--space-3);
        width: auto;
    }

    /* Auth Pages */
    .auth-card {
        margin: var(--space-3);
        padding: var(--space-4);
    }

    .auth-title {
        font-size: 1.5rem;
    }

    /* Breadcrumbs */
    .breadcrumb {
        font-size: 0.75rem;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Status Badges */
    .status-badge {
        font-size: 0.75rem;
        padding: var(--space-1) var(--space-2);
    }

    /* Alert/Info Boxes */
    .alert {
        padding: var(--space-3);
        font-size: 0.875rem;
    }

    /* Analytics Cards */
    .analytics-card {
        padding: var(--space-3);
    }

    /* Order Totals */
    .order-totals {
        padding: var(--space-3) !important;
    }

    .order-totals-row {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    /* GST Settings Grid */
    .gst-slabs-grid {
        grid-template-columns: 1fr;
    }

    /* License Cards */
    .license-card {
        padding: var(--space-4);
    }

    /* Mobile App Section */
    .mobile-app-grid {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile Devices (≤480px) */
@media screen and (max-width: 480px) {

    /* Even smaller adjustments */
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .page-header h2 {
        font-size: 1.125rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.125rem;
    }

    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: 0.8125rem;
    }

    /* Full width buttons */
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    /* Table adjustments */
    .table {
        font-size: 0.75rem;
    }

    .table th,
    .table td {
        padding: var(--space-1) var(--space-2);
    }

    /* Chart smaller */
    .chart-container {
        height: 200px !important;
    }

    /* Tabs scrollable */
    .tab-buttons {
        justify-content: flex-start;
    }

    /* Invoice/Label smaller text */
    .invoice-layout,
    .label-layout {
        font-size: 0.75rem;
    }

    /* Hide less important columns on very small screens */
    .hide-mobile {
        display: none !important;
    }
}

/* Landscape Mode Adjustments */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        max-height: 85vh;
    }

    .chart-container {
        height: 180px !important;
    }
}

/* Touch Device Improvements */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }

    .form-control,
    .form-select,
    .form-input {
        min-height: 44px;
    }

    .tab-btn {
        min-height: 44px;
    }

    /* Remove hover effects */
    .btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
    }

    /* Better scrolling */
    .table-wrapper,
    .tab-buttons {
        scrollbar-width: thin;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .header,
    .page-header,
    .menu-toggle,
    .btn,
    .date-filters {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        width: 100% !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Utility Classes for Mobile */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media screen and (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .text-center-mobile {
        text-align: center;
    }

    .w-full-mobile {
        width: 100% !important;
    }

    .stack-mobile {
        flex-direction: column !important;
    }

    .gap-sm-mobile {
        gap: var(--space-2) !important;
    }
}

/* ============================================
   PAGE-SPECIFIC MOBILE FIXES
   ============================================ */

@media screen and (max-width: 768px) {

    /* ===== PROFIT & LOSS PAGE ===== */
    /* Force columns to stack */
    .profit-loss-grid,
    .expense-grid,
    [style*="display: grid"][style*="grid-template-columns: 1fr 2fr"],
    [style*="display: grid"][style*="grid-template-columns: 1fr 1fr"],
    [style*="display: grid"][style*="repeat(2"],
    [style*="grid-template-columns: repeat"] {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    .profit-loss-grid>*,
    .expense-grid>* {
        margin-bottom: var(--space-4) !important;
    }

    /* Add Expense & Expense History cards */
    .card[style*="display: grid"] {
        display: block !important;
    }

    /* ===== WHATSAPP INTEGRATION PAGE ===== */
    .whatsapp-grid,
    .whatsapp-layout,
    [class*="whatsapp"] [style*="display: grid"],
    [class*="whatsapp"] [style*="grid-template-columns"] {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    /* WhatsApp settings section */
    .whatsapp-settings,
    .whatsapp-form {
        width: 100% !important;
        padding: var(--space-3) !important;
    }

    /* Recipient selection grid */
    .recipient-grid,
    [style*="display: grid"][style*="150px"] {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--space-3) !important;
    }

    .recipient-grid>*,
    .source-option {
        width: 100% !important;
    }

    /* ===== EMAIL MARKETING PAGE ===== */
    .email-marketing-grid,
    .campaign-grid,
    [style*="display: grid"][style*="300px"],
    [style*="display: grid"][style*="350px"],
    [style*="display: grid"][style*="400px"] {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    .email-marketing-grid>*,
    .campaign-grid>* {
        width: 100% !important;
        margin-bottom: var(--space-4) !important;
    }

    /* Create Campaign and Send Test Email sections */
    .campaign-form,
    .test-email-form,
    [class*="campaign"] .card,
    [class*="email"] .card {
        width: 100% !important;
    }

    /* Templates section */
    .templates-grid {
        grid-template-columns: 1fr !important;
    }

    /* ===== SETTINGS PAGE ===== */
    /* Settings tabs - horizontal scroll */
    .settings-tabs,
    .tab-nav,
    [class*="tabs"] {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: var(--space-2) !important;
        gap: var(--space-1) !important;
        scrollbar-width: none !important;
    }

    .settings-tabs::-webkit-scrollbar,
    .tab-nav::-webkit-scrollbar {
        display: none !important;
    }

    .settings-tabs .tab-btn,
    .tab-nav .tab-btn,
    .tab-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: var(--space-2) var(--space-3) !important;
        font-size: 0.8rem !important;
        min-width: auto !important;
    }

    /* Settings form grids */
    .settings-grid,
    [id="general"] [style*="display: grid"],
    [id="business"] [style*="display: grid"],
    [id="woocommerce"] [style*="display: grid"],
    [id="email"] [style*="display: grid"],
    [id="security"] [style*="display: grid"],
    [id="gst"] [style*="display: grid"],
    [id="license"] [style*="display: grid"],
    [id="mobile-app"] [style*="display: grid"] {
        display: block !important;
    }

    /* Settings form inputs */
    .tab-content .form-group {
        margin-bottom: var(--space-4) !important;
    }

    .tab-content input,
    .tab-content select,
    .tab-content textarea {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ===== CREATE INVOICE PAGE ===== */
    /* Invoice items row - stack vertically */
    .invoice-item-row,
    .item-row,
    [class*="invoice"] [style*="display: flex"][style*="gap"],
    [class*="invoice"] [style*="display: grid"] {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--space-2) !important;
        margin-bottom: var(--space-3) !important;
    }

    .invoice-item-row input,
    .item-row input,
    [class*="invoice-item"] input {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Item name, qty, price inputs */
    [placeholder*="Item name"],
    [placeholder*="item name"],
    [name*="item_name"],
    [name*="quantity"],
    [name*="price"] {
        width: 100% !important;
        margin-bottom: var(--space-2) !important;
    }

    /* Invoice totals section */
    .invoice-totals,
    .totals-section {
        width: 100% !important;
    }

    .invoice-totals [style*="display: flex"],
    .totals-row {
        flex-wrap: wrap !important;
        justify-content: space-between !important;
    }

    /* ===== SHIPPING LABELS PAGE ===== */
    .shipping-form,
    .label-form,
    [class*="shipping"] [style*="display: grid"],
    [class*="label"] [style*="display: grid"] {
        display: block !important;
    }

    .shipping-form .form-group,
    .label-form .form-group {
        width: 100% !important;
        margin-bottom: var(--space-3) !important;
    }

    /* Address sections */
    .address-section,
    .from-address,
    .to-address {
        width: 100% !important;
        margin-bottom: var(--space-4) !important;
    }

    /* ===== GENERAL OVERRIDES FOR INLINE STYLES ===== */
    /* Override inline grid styles */
    [style*="display: grid"] {
        display: block !important;
    }

    /* Override inline flex with multiple children */
    [style*="display: flex"][style*="gap"]:not(.btn):not(.form-switch):not(.stat-icon) {
        flex-direction: column !important;
    }

    /* Full width for form elements */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Card body padding */
    .card-body {
        padding: var(--space-3) !important;
    }

    /* Modal full width */
    .modal-content,
    .modal-dialog {
        width: 95% !important;
        max-width: 100% !important;
        margin: var(--space-3) auto !important;
    }

    /* Tables responsive */
    table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Button full width on mobile */
    .btn-primary,
    .btn-success,
    button[type="submit"] {
        width: 100% !important;
        margin-top: var(--space-3) !important;
    }

    /* Two-column layouts to single */
    [style*="1fr 1fr"],
    [style*="1fr 2fr"],
    [style*="2fr 1fr"],
    [style*="minmax(300px"],
    [style*="minmax(250px"],
    [style*="minmax(200px"] {
        display: block !important;
    }
}

/* Extra small devices */
@media screen and (max-width: 480px) {

    /* Even smaller tabs */
    .tab-btn {
        padding: var(--space-1) var(--space-2) !important;
        font-size: 0.75rem !important;
    }

    /* Smaller page title */
    .page-header h1,
    .page-header h2,
    .page-title {
        font-size: 1rem !important;
    }

    /* Compact cards */
    .card {
        margin-bottom: var(--space-3) !important;
    }

    .card-header {
        padding: var(--space-2) var(--space-3) !important;
    }

    .card-body {
        padding: var(--space-2) !important;
    }

    /* Smaller font for form labels */
    .form-label {
        font-size: 0.8rem !important;
    }
}

/* ============================================
   MOBILE SIDEBAR TOGGLE FIX
   ============================================ */

/* Mobile: Hide sidebar by default, show on toggle */
@media screen and (max-width: 768px) {

    /* Hide sidebar off-screen on mobile */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 260px !important;
        height: 100vh !important;
        height: 100dvh !important;
        transform: translateX(-100%);
        z-index: 9999 !important;
        transition: transform 0.3s ease !important;
        background: var(--bg-sidebar) !important;
        overflow-y: auto !important;
    }

    /* When sidebar-open is on body, show sidebar */
    body.sidebar-open .sidebar {
        transform: translateX(0) !important;
    }

    /* Show overlay when sidebar is open */
    .sidebar-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 9998 !important;
        display: none;
    }

    body.sidebar-open .sidebar-overlay {
        display: block !important;
    }

    /* Main content takes full width on mobile */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Ensure sidebar toggle is visible and touch-friendly */
    .sidebar-toggle {
        display: flex !important;
        min-width: 48px !important;
        min-height: 48px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        cursor: pointer !important;
    }

    .sidebar-toggle svg,
    .sidebar-toggle * {
        pointer-events: none !important;
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden !important;
    }
}