/* Supreme One Platform Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #1e40af;
    --secondary-red: #dc2626;
    --dark-gray: #1f2937;
    --light-gray: #f3f4f6;
    --white: #ffffff;
    --success-green: #10b981;
    --warning-yellow: #f59e0b;
    --text-dark: #111827;
    --text-light: #6b7280;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header Styles */
.header {
    background: var(--white);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-section {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--dark-gray);
}

.logo-icon {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-red));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.logo-icon::after {
    content: 'S1';
}

.nav-tabs {
    display: flex;
    gap: 1rem;
}

.nav-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.3s;
    font-size: 1rem;
}

.nav-tab:hover {
    background: var(--light-gray);
}

.nav-tab.active {
    background: var(--primary-blue);
    color: white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Section Styles */
section {
    display: none;
}

section.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Dashboard Styles */
.welcome-section {
    margin-bottom: 2rem;
}

.welcome-section h1 {
    font-size: 2.5rem;
    color: var(--dark-gray);
}

.motto {
    color: var(--secondary-red);
    font-size: 1.2rem;
    font-style: italic;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--dark-gray);
}


/* Performance Stats */
.performance-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.stat {
    text-align: center;
    padding: 0.5rem;
    background: var(--light-gray);
    border-radius: 0.5rem;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-blue);
}

/* Buttons */
.btn-primary {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--text-dark);
    border: 1px solid #d1d5db;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-danger {
    background: var(--secondary-red);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Input Fields */
.input-field {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.dropdown {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    background: var(--light-gray);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

tr:hover {
    background: #f9fafb;
}

/* Chat Widget */
.ai-chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-red));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: all 0.3s;
    z-index: 1000;
}

.ai-chat-widget:hover {
    transform: scale(1.1);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary-blue);
    font-size: 1.2rem;
}

.ai-chat-box {
    position: fixed;
    bottom: 100px;
    right: 2rem;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 999;
}

.ai-chat-box.open {
    display: flex;
    animation: slideUp 0.3s;
}

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

.chat-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-red));
    color: white;
    padding: 1rem;
    border-radius: 1rem 1rem 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

.modal-large {
    max-width: 900px;
}

/* Recording Indicator */
.recording-indicator {
    width: 12px;
    height: 12px;
    background: var(--secondary-red);
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Volume Meter */
.volume-meter {
    height: 10px;
    background: var(--light-gray);
    border-radius: 5px;
    overflow: hidden;
    margin: 1rem 0;
}

.volume-level {
    height: 100%;
    background: var(--success-green);
    width: 0;
    transition: width 0.1s;
}

/* Real-time Feedback */
.real-time-feedback {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.real-time-feedback h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
}

/* =====================================================
   PWA & MOBILE STYLES
   ===================================================== */

/* Safe area for notched devices */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* PWA Standalone mode adjustments */
body.pwa-standalone {
    padding-top: calc(env(safe-area-inset-top) + 20px);
}

body.pwa-standalone .header {
    padding-top: calc(1rem + env(safe-area-inset-top));
}

/* Mobile Quick Upload Floating Button */
.mobile-upload-fab {
    display: none;
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-red));
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    cursor: pointer;
    z-index: 900;
    transition: transform 0.3s, box-shadow 0.3s;
}

.mobile-upload-fab:active {
    transform: scale(0.95);
}

.mobile-upload-fab::before {
    content: '+';
    font-size: 2rem;
    color: white;
    font-weight: 300;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    z-index: 1000;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--text-light);
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.2s;
}

.mobile-nav-item.active {
    color: var(--primary-blue);
}

.mobile-nav-item .nav-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Mobile Receipt Upload Modal */
.mobile-upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 2000;
    flex-direction: column;
}

.mobile-upload-modal.open {
    display: flex;
}

.mobile-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top));
    background: var(--primary-blue);
    color: white;
}

.mobile-upload-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-upload-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.camera-capture-area {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 3/4;
    background: var(--light-gray);
    border-radius: 1rem;
    border: 3px dashed var(--primary-blue);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.camera-capture-area:active {
    background: #e0e7ff;
    border-style: solid;
}

.camera-capture-area .camera-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.camera-capture-area .camera-text {
    font-size: 1.2rem;
    color: var(--text-dark);
    text-align: center;
}

.camera-capture-area .camera-subtext {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.mobile-upload-options {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
    max-width: 400px;
}

.upload-option-btn {
    flex: 1;
    padding: 1rem;
    border-radius: 0.75rem;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.upload-option-btn.camera-btn {
    background: var(--primary-blue);
    color: white;
}

.upload-option-btn.gallery-btn {
    background: var(--light-gray);
    color: var(--text-dark);
    border: 1px solid #d1d5db;
}

.upload-option-btn:active {
    transform: scale(0.98);
}

/* Receipt Preview */
.receipt-preview-container {
    width: 100%;
    max-width: 400px;
    display: none;
}

.receipt-preview-container.has-image {
    display: block;
}

.receipt-preview-image {
    width: 100%;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.receipt-preview-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.receipt-preview-actions button {
    flex: 1;
}

/* Offline Indicator */
.offline-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--warning-yellow);
    color: var(--text-dark);
    text-align: center;
    padding: 0.5rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top));
    font-size: 0.9rem;
    z-index: 3000;
}

.offline-indicator.visible {
    display: block;
}

/* Install PWA Banner */
#pwa-install-banner {
    display: none;
    position: fixed;
    bottom: calc(100px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-blue);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    z-index: 800;
    align-items: center;
    gap: 0.75rem;
    max-width: 90%;
}

#pwa-install-banner span {
    white-space: nowrap;
}

#pwa-install-btn {
    background: white;
    color: var(--primary-blue);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

#pwa-install-btn:hover {
    background: #f0f0f0;
}

#pwa-dismiss-btn {
    background: transparent;
    color: white;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.8;
    line-height: 1;
}

#pwa-dismiss-btn:hover {
    opacity: 1;
}

/* Responsive Design - Tablets and below */
@media (max-width: 768px) {
    /* Header - Complete mobile redesign */
    .header {
        flex-wrap: wrap;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .logo-section {
        flex: 1;
        min-width: 0;
    }

    .logo {
        font-size: 1rem;
    }

    .logo img {
        width: 32px !important;
        height: 32px !important;
        margin-right: 8px !important;
    }

    .logo > div {
        min-width: 0;
    }

    .logo > div > div:first-child {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .logo > div > div:last-child {
        font-size: 0.6rem !important;
    }

    /* Hide desktop nav */
    .nav-tabs {
        display: none !important;
        visibility: hidden !important;
    }

    /* User menu - compact */
    .user-menu {
        gap: 0.5rem;
    }

    .user-menu #user-name {
        display: none !important;
    }

    .user-menu .btn-secondary {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Hide company selector on mobile */
    #company-selector-container {
        display: none !important;
    }

    /* Show mobile nav */
    .mobile-bottom-nav {
        display: block !important;
        visibility: visible !important;
    }

    .mobile-upload-fab {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Main content */
    .main-container {
        padding: 0.75rem;
        margin: 0 auto;
        padding-bottom: 100px;
        max-width: 100%;
    }

    /* Dashboard */
    .welcome-section {
        margin-bottom: 1rem;
    }

    .welcome-section h1 {
        font-size: 1.5rem;
    }

    .motto {
        font-size: 0.9rem;
    }

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

    /* Dashboard cards */
    .dashboard-card {
        padding: 1rem;
        border-radius: 0.75rem;
    }

    .dashboard-card[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .performance-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem;
    }

    .stat {
        padding: 0.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    /* Quick actions bar */
    div[style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    div[style*="flex-wrap: wrap"] button,
    div[style*="flex-wrap: wrap"] .btn-primary,
    div[style*="flex-wrap: wrap"] .btn-secondary {
        width: 100% !important;
        min-width: unset !important;
        flex: unset !important;
    }

    /* Tables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Hide AI chat widget */
    .ai-chat-widget {
        display: none !important;
    }

    .ai-chat-box {
        width: 100%;
        right: 0;
        bottom: 0;
        height: 100%;
        border-radius: 0;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 1rem;
        max-height: 85vh;
        overflow-y: auto;
        border-radius: 0.75rem;
    }

    .modal-large {
        max-width: 95%;
    }

    /* Form inputs - larger touch targets, prevent zoom */
    .input-field,
    .dropdown,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
        padding: 0.875rem;
        border-radius: 0.5rem;
    }

    /* Buttons - larger touch targets */
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    button {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Receipts section adjustments */
    #receipts .dashboard-card {
        padding: 0.75rem;
    }

    /* Settings section */
    #settings .dashboard-card {
        margin-bottom: 0.75rem;
    }
}

/* Small phones (iPhone SE, etc.) */
@media (max-width: 375px) {
    .header {
        padding: 0.5rem;
    }

    .logo img {
        width: 28px !important;
        height: 28px !important;
    }

    .logo > div > div:first-child {
        font-size: 0.8rem;
    }

    .welcome-section h1 {
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .main-container {
        padding: 0.5rem;
        padding-bottom: 100px;
    }

    .dashboard-card {
        padding: 0.75rem;
    }

    .mobile-nav-item {
        padding: 0.5rem 0.5rem;
        font-size: 0.65rem;
    }

    .mobile-nav-item .nav-icon {
        font-size: 1.25rem;
    }
}

/* Landscape phone */
@media (max-width: 768px) and (orientation: landscape) {
    .main-container {
        padding-bottom: 80px;
    }

    .mobile-bottom-nav {
        padding: 0.25rem 0;
    }

    .mobile-nav-item {
        flex-direction: row;
        gap: 0.25rem;
    }

    .mobile-nav-item .nav-icon {
        font-size: 1.25rem;
        margin-bottom: 0;
    }
}

/* =====================================================
   EXECUTIVE DASHBOARD STYLES
   ===================================================== */

/* Executive Header */
.executive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.executive-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Executive KPI Cards */
.executive-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.executive-kpi-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid;
}

.executive-kpi-card.revenue {
    border-left-color: #2563eb;
}

.executive-kpi-card.expenses {
    border-left-color: #ef4444;
}

.executive-kpi-card.profit {
    border-left-color: #10b981;
}

.executive-kpi-card.companies {
    border-left-color: #8b5cf6;
}

.kpi-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.kpi-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.kpi-change.positive {
    color: #10b981;
}

.kpi-change.negative {
    color: #ef4444;
}

/* Executive Performance Card */
.executive-performance-card {
    margin-bottom: 2rem;
}

.executive-performance-card .card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.executive-table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

.executive-table {
    width: 100%;
    border-collapse: collapse;
}

.executive-table th,
.executive-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.executive-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
}

.executive-table tbody tr:hover {
    background: #f9fafb;
}

.executive-table .consolidated-row {
    background: #f3f4f6;
    font-weight: 600;
}

.executive-table .consolidated-row td {
    border-bottom: none;
}

.company-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.company-type-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    font-weight: 600;
}

.company-type-badge.parent {
    background: #dbeafe;
    color: #1e40af;
}

.company-type-badge.subsidiary {
    background: #d1fae5;
    color: #065f46;
}

.company-type-badge.division {
    background: #fef3c7;
    color: #92400e;
}

.company-type-badge.branch {
    background: #ede9fe;
    color: #5b21b6;
}

.margin-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.margin-badge.excellent {
    background: #d1fae5;
    color: #065f46;
}

.margin-badge.good {
    background: #dbeafe;
    color: #1e40af;
}

.margin-badge.fair {
    background: #fef3c7;
    color: #92400e;
}

.margin-badge.poor {
    background: #fee2e2;
    color: #991b1b;
}

.positive {
    color: #10b981;
}

.negative {
    color: #ef4444;
}

/* Executive Charts */
.executive-charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.executive-chart-card,
.executive-trends-card {
    margin-bottom: 2rem;
}

.executive-chart-card .chart-container,
.executive-trends-card .chart-container {
    height: 300px;
    position: relative;
}

/* Executive Insights */
.executive-insights-card {
    margin-bottom: 2rem;
}

.insights-list {
    margin-top: 1rem;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    background: #f9fafb;
}

.insight-item.success {
    background: #d1fae5;
}

.insight-item.warning {
    background: #fef3c7;
}

.insight-item.info {
    background: #dbeafe;
}

.insight-icon {
    font-size: 1.25rem;
}

.insight-text {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.5;
}

.insight-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Comparison Modal */
.comparison-controls {
    padding: 1rem 0;
}

.comparison-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.comparison-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
}

.comparison-checkbox-label:hover {
    background: #e5e7eb;
}

.comparison-checkbox-label input {
    width: 18px;
    height: 18px;
}

.comparison-chart-container {
    height: 350px;
    margin-bottom: 2rem;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.comparison-table th {
    background: #f9fafb;
    font-weight: 600;
}

/* Drilldown Modal */
.drilldown-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.drilldown-kpi {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.drilldown-kpi-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.drilldown-kpi-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.drilldown-sections {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.drilldown-section h4 {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.drilldown-trend {
    margin-bottom: 2rem;
}

.drilldown-trend h4 {
    margin-bottom: 0.75rem;
}

.drilldown-transactions h4 {
    margin-bottom: 0.75rem;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
}

.simple-table th,
.simple-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.simple-table th {
    text-align: left;
    font-weight: 600;
    background: #f9fafb;
}

/* Large Modal */
.large-modal {
    max-width: 900px;
    width: 95%;
}

.large-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Button Link */
.btn-link {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
}

.btn-link:hover {
    color: #1e3a8a;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Executive Dashboard Responsive */
@media (max-width: 1024px) {
    .executive-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .executive-charts-row {
        grid-template-columns: 1fr;
    }

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

    .drilldown-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .executive-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .executive-kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .drilldown-summary {
        grid-template-columns: 1fr;
    }

    .comparison-chart-container {
        height: 250px;
    }
}

/* ==========================================
   SARAH WIDGET STYLES
   ========================================== */

.sarah-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Minimized state */
.sarah-widget-minimized {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    transition: all 0.3s ease;
}

.sarah-widget-minimized:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(30, 64, 175, 0.5);
}

.sarah-widget.minimized .sarah-widget-expanded {
    display: none;
}

.sarah-widget:not(.minimized) .sarah-widget-minimized {
    display: none;
}

.sarah-widget-icon svg {
    fill: currentColor;
}

.sarah-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc2626;
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.sarah-widget-label {
    font-weight: 500;
    font-size: 14px;
}

/* Expanded state */
.sarah-widget-expanded {
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.sarah-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
}

.sarah-widget-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.sarah-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.sarah-widget-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
}

.sarah-widget-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sarah-widget-minimize svg {
    display: block;
}

/* Widget body */
.sarah-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sarah-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
}

.sarah-welcome {
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

.sarah-welcome p {
    font-size: 14px;
}

/* Chat messages */
.sarah-message {
    margin-bottom: 12px;
    max-width: 85%;
}

.sarah-message-user {
    margin-left: auto;
}

.sarah-message-sarah {
    margin-right: auto;
}

.sarah-message-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.sarah-message-user .sarah-message-content {
    background: #1e40af;
    color: white;
    border-bottom-right-radius: 4px;
}

.sarah-message-sarah .sarah-message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sarah-message.loading .sarah-message-content {
    background: white;
    color: #6b7280;
}

.sarah-message.loading .sarah-message-content::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.sarah-action-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: #e0e7ff;
    color: #1e40af;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.sarah-action-link:hover {
    background: #c7d2fe;
}

.sarah-response-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.sarah-inline-suggestion {
    padding: 6px 10px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.sarah-inline-suggestion:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* Suggestions area */
.sarah-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.sarah-suggestion-chip {
    padding: 8px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.sarah-suggestion-chip:hover {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #1e40af;
}

/* Confirmation dialog */
.sarah-confirmation {
    padding: 16px;
    background: #fef3c7;
    border-top: 1px solid #fcd34d;
}

.sarah-confirmation-content p {
    font-size: 14px;
    color: #92400e;
    margin-bottom: 12px;
}

.sarah-confirmation-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.sarah-confirmation-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sarah-confirmation-actions .btn-cancel {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
}

.sarah-confirmation-actions .btn-cancel:hover {
    background: #f3f4f6;
}

.sarah-confirmation-actions .btn-confirm {
    background: #1e40af;
    border: none;
    color: white;
}

.sarah-confirmation-actions .btn-confirm:hover {
    background: #1e3a8a;
}

/* Widget footer */
.sarah-widget-footer {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.sarah-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

#sarah-query-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#sarah-query-input:focus {
    border-color: #3b82f6;
}

#sarah-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1e40af;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#sarah-send-btn:hover {
    background: #1e3a8a;
}

#sarah-send-btn svg {
    fill: currentColor;
}

.sarah-quick-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.sarah-quick-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sarah-quick-action:hover {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #1e40af;
}

.sarah-quick-action svg {
    fill: currentColor;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .sarah-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .sarah-widget-expanded {
        width: 100%;
        height: 70vh;
        border-radius: 16px 16px 0 0;
    }

    .sarah-widget-minimized {
        padding: 10px 16px;
    }

    .sarah-widget-label {
        display: none;
    }
}
