/* MyFlags Operations Platform - 2026 Modern Airy UI */
/* Design Philosophy: Quiet chrome, typography-driven hierarchy, color for state only */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;550;600;700&display=swap');

:root {
    /* Neutral palette - minimal, sophisticated */
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #E5E5E5;
    --gray-300: #D4D4D4;
    --gray-400: #A3A3A3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    
    /* Accent - only for interactive/state */
    --accent: #2563EB;
    --accent-light: #EFF6FF;
    --accent-hover: #1D4ED8;
    
    /* Status colors - semantic only */
    --success: #16A34A;
    --success-bg: #F0FDF4;
    --warning: #CA8A04;
    --warning-bg: #FEFCE8;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --info: #0891B2;
    --info-bg: #ECFEFF;
    
    /* Layout */
    --sidebar-width: 200px;
    --content-max: 1200px;
    
    /* Typography scale */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-lg: 1rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.375rem;
    --text-3xl: 1.75rem;
    
    /* 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;
}

/* Reset & Base */
*, *::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: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    font-size: var(--text-base);
    letter-spacing: -0.011em;
}

a { color: inherit; text-decoration: none; }

/* ==================== LAYOUT ==================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR - Clean & Light ==================== */
.sidebar {
    width: 56px;
    background: white;
    border-right: 1px solid var(--gray-200);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: width 0.2s ease;
}

.sidebar:hover {
    width: var(--sidebar-width);
    box-shadow: 4px 0 16px rgba(0,0,0,0.08);
}

.sidebar:hover .sidebar-brand span,
.sidebar:hover .nav-section-title,
.sidebar:hover .nav-item span:not(.nav-item-icon),
.sidebar:hover .user-info,
.sidebar:hover .dropdown-arrow,
.sidebar:hover .nav-agent-info,
.sidebar:hover .nav-agent-badge { opacity: 1; visibility: visible; }

.sidebar-brand span,
.nav-section-title,
.nav-item span:not(.nav-item-icon),
.user-info,
.dropdown-arrow,
.nav-agent-info,
.nav-agent-badge { opacity: 0; visibility: hidden; transition: opacity 0.15s ease, visibility 0.15s ease; white-space: nowrap; }

.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-brand {
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.sidebar-brand img {
    height: 28px;
    width: auto;
    border-radius: 6px;
}

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3);
    margin: var(--space-2) var(--space-2);
    background: var(--gray-50);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.sidebar-user:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #818CF8 0%, #6366F1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar svg {
    stroke: white;
    width: 16px;
    height: 16px;
}

.user-info { flex: 1; min-width: 0; }
.user-name { 
    font-weight: 550; 
    font-size: var(--text-xs); 
    color: var(--gray-900); 
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role { 
    font-size: 10px; 
    color: var(--gray-500); 
    text-transform: capitalize; 
}

/* Sidebar Navigation */
.sidebar-nav { 
    padding: var(--space-2) var(--space-2); 
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.nav-section { margin-bottom: var(--space-4); }

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    padding: var(--space-2) var(--space-3) var(--space-1);
    font-weight: 500;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 10px;
    color: var(--gray-600);
    border-radius: 6px;
    margin-bottom: 2px;
    font-size: var(--text-xs);
    font-weight: 450;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.nav-item:hover .nav-item-icon svg {
    stroke: var(--gray-900);
}

.nav-item.active {
    background: linear-gradient(135deg, #818CF8 0%, #6366F1 100%);
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.nav-item.active .nav-item-icon svg {
    stroke: white;
}

.nav-item-icon { 
    width: 18px; 
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item-icon svg {
    stroke: var(--gray-500);
    transition: stroke 0.15s ease;
    width: 16px;
    height: 16px;
}

.nav-item.logout {
    color: var(--gray-400);
    margin-top: var(--space-4);
}

.nav-item.logout svg {
    stroke: var(--gray-400);
}

.nav-item.logout:hover { 
    color: var(--danger); 
    background: var(--danger-bg);
}

.nav-item.logout:hover svg {
    stroke: var(--danger);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: 56px;
    min-height: 100vh;
    background: var(--gray-50);
}

.container {
    padding: var(--space-8) var(--space-10);
    max-width: var(--content-max);
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
}

.page-header h1 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.025em;
}

.header-actions { display: flex; gap: var(--space-3); }

/* ==================== BUTTONS - Subtle & Clean ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.btn-success:hover { background: #15803D; }

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover { background: #B91C1C; }

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border-color: transparent;
}
.btn-ghost:hover { 
    background: var(--gray-100); 
    color: var(--gray-900);
}

.btn-sm { padding: 6px var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-5); font-size: var(--text-base); }

/* ==================== CARDS - Minimal borders, no heavy shadows ==================== */
.card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin-bottom: var(--space-5);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-body { padding: var(--space-5); }

.card-footer {
    padding: var(--space-4) var(--space-5);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* ==================== STAT CARDS - Clean metrics ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: var(--space-5);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    background: var(--gray-100);
}

.stat-icon.bg-primary { background: var(--accent-light); }
.stat-icon.bg-success { background: var(--success-bg); }
.stat-icon.bg-warning { background: var(--warning-bg); }
.stat-icon.bg-danger { background: var(--danger-bg); }
.stat-icon.bg-info { background: var(--info-bg); }

.stat-content { flex: 1; }
.stat-value { 
    font-size: var(--text-2xl); 
    font-weight: 700; 
    color: var(--gray-900); 
    line-height: 1.2; 
    letter-spacing: -0.02em;
}
.stat-label { 
    font-size: var(--text-sm); 
    color: var(--gray-500); 
    margin-top: var(--space-1); 
}
.stat-link { 
    font-size: var(--text-xs); 
    color: var(--accent); 
    margin-top: var(--space-2); 
    display: inline-block; 
    font-weight: 500;
}
.stat-link:hover { text-decoration: underline; }

/* ==================== TABLES - Clean data display ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--text-sm);
    color: var(--gray-700);
}

.data-table th.text-center,
.data-table td.text-center { text-align: center; }

.data-table tbody tr {
    transition: background 0.1s ease;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.empty-message {
    text-align: center;
    color: var(--gray-400);
    padding: var(--space-10) !important;
    font-size: var(--text-sm);
}

/* ==================== BADGES - Semantic colors only ==================== */
.badge, .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.badge-pending, .status-pending { 
    background: var(--warning-bg); 
    color: var(--warning); 
}
.badge-success, .badge-shipped, .badge-paid, .badge-delivered,
.status-shipped, .status-delivered, .status-paid, .status-rpa_approved, .status-ready_to_ship,
.status-submitted, .status-won { 
    background: var(--success-bg); 
    color: var(--success); 
}
.badge-danger, .badge-overdue, .status-overdue, .status-none, .status-lost { 
    background: var(--danger-bg); 
    color: var(--danger); 
}
.badge-info, .badge-in-transit, .status-in-transit, .status-rpa_pending, 
.status-asn_pending, .status-sent { 
    background: var(--info-bg); 
    color: var(--info); 
}
.badge-default, .status-default { 
    background: var(--gray-100); 
    color: var(--gray-600); 
}

/* ==================== FORMS - Clean & Spacious ==================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: span 2; }

.form-group label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: var(--text-sm);
    transition: all 0.15s ease;
    background: white;
    font-family: inherit;
    color: var(--gray-800);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--gray-400); }

.form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--gray-100);
}

/* ==================== ALERTS ==================== */
.alert {
    padding: var(--space-4);
    border-radius: 10px;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
}

.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error, .alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* ==================== DASHBOARD TABS ==================== */
.dashboard-tabs {
    display: inline-flex;
    gap: 2px;
    margin-bottom: var(--space-6);
    background: var(--gray-100);
    padding: 4px;
    border-radius: 10px;
}

.dashboard-tab {
    padding: var(--space-2) var(--space-4);
    border-radius: 8px;
    color: var(--gray-600);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: all 0.15s ease;
}

.dashboard-tab:hover {
    color: var(--gray-900);
}

.dashboard-tab.active {
    background: white;
    color: var(--gray-900);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.action-card {
    background: white;
    border-radius: 12px;
    padding: var(--space-5);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all 0.2s ease;
}

.action-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.action-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    background: var(--gray-100);
}

.action-card:hover .action-card-icon {
    background: white;
}

.action-card-content h3 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.action-card-content p {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* ==================== FILTERS ==================== */
.filters-bar {
    background: white;
    padding: var(--space-4);
    border-radius: 10px;
    margin-bottom: var(--space-5);
    display: flex;
    gap: var(--space-4);
    align-items: center;
    border: 1px solid var(--gray-200);
}

.filter-group { display: flex; align-items: center; gap: var(--space-2); }
.filter-group label { 
    font-size: var(--text-sm); 
    color: var(--gray-500); 
    font-weight: 500; 
}
.filter-group select, .filter-group input {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: var(--text-sm);
}
.search-input { min-width: 220px; }

/* ==================== DETAIL VIEWS ==================== */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-5);
}

.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-item .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    font-weight: 500;
}
.detail-item .value { 
    font-size: var(--text-base); 
    color: var(--gray-900); 
    font-weight: 500; 
}

/* ==================== RPA CALCULATOR ==================== */
.rpa-calculator {
    background: var(--accent-light);
    border-radius: 12px;
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    border: 1px solid #DBEAFE;
}

.rpa-calculator h4 {
    font-size: var(--text-sm);
    color: var(--accent);
    margin-bottom: var(--space-4);
    font-weight: 600;
}

.rpa-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-3);
}

.rpa-item {
    background: white;
    padding: var(--space-4);
    border-radius: 8px;
    text-align: center;
}

.rpa-label { 
    font-size: 10px; 
    color: var(--gray-500); 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    font-weight: 500; 
}
.rpa-value { 
    font-size: var(--text-xl); 
    font-weight: 700; 
    color: var(--accent); 
    margin-top: 4px;
}

.danger-zone { border-color: #FECACA; }
.danger-zone .card-header { background: var(--danger-bg); }

/* ==================== UTILITIES ==================== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }

.customer-logo { height: 24px; width: auto; vertical-align: middle; margin-right: var(--space-2); }
.customer-logo-sm { height: 18px; width: auto; vertical-align: middle; }

.navbar { display: none; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .sidebar { 
        width: 56px;
    }
    .sidebar:hover { width: var(--sidebar-width); }
    .main-content { margin-left: 56px; }
    .container { padding: var(--space-5); }
}

@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: span 1; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: var(--space-4); align-items: flex-start; }
    .container { padding: var(--space-4); }
}

/* ==================== FLOATING ASSISTANT WIDGET ==================== */
.assistant-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}

.assistant-toggle {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #818CF8 0%, #6366F1 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.assistant-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.assistant-icon { display: flex; }
.assistant-icon svg { stroke: white; }
.assistant-close { display: none; }
.assistant-close svg { stroke: white; }
.assistant-widget.open .assistant-icon { display: none; }
.assistant-widget.open .assistant-close { display: flex; }

.assistant-panel {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.assistant-widget.open .assistant-panel {
    display: flex;
    animation: panelSlideUp 0.25s ease;
}

@keyframes panelSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.assistant-header {
    background: linear-gradient(135deg, #818CF8 0%, #6366F1 100%);
    color: white;
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.assistant-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.assistant-title svg {
    stroke: white;
}

.assistant-minimize {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.assistant-minimize:hover { background: rgba(255,255,255,0.3); }

.assistant-messages {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
    background: var(--gray-50);
}

.assistant-welcome {
    text-align: center;
    padding: var(--space-10) var(--space-5);
}

.assistant-avatar-large {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.assistant-welcome h4 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--gray-900);
}

.assistant-welcome p {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* Quick Actions in Chat */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-4);
    justify-content: center;
}

.quick-action-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-action-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Chat Action Buttons in Responses */
.chat-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}

.chat-action-btn {
    padding: 4px 10px;
    font-size: 0.7rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease;
}

.chat-action-btn:hover {
    background: var(--accent);
    color: white;
}

.chat-link {
    color: var(--accent);
    text-decoration: underline;
}

.bullet {
    color: var(--accent);
    margin-right: 2px;
}

.assistant-msg {
    margin-bottom: var(--space-4);
    display: flex;
    gap: var(--space-2);
}

.assistant-msg.user { flex-direction: row-reverse; }

.assistant-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    flex-shrink: 0;
    border: 1px solid var(--gray-200);
}

.assistant-msg.user .assistant-msg-avatar {
    background: var(--accent);
    border: none;
}

.assistant-msg-bubble {
    max-width: 75%;
    padding: var(--space-3) var(--space-4);
    border-radius: 14px;
    background: white;
    font-size: var(--text-sm);
    line-height: 1.5;
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
}

.assistant-msg.user .assistant-msg-bubble {
    background: var(--accent);
    color: white;
    border: none;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 4px;
}

.assistant-typing {
    display: flex;
    gap: 4px;
    padding: var(--space-3) var(--space-4);
    align-items: center;
}

.assistant-typing span {
    width: 6px;
    height: 6px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.assistant-typing span:nth-child(1) { animation-delay: 0s; }
.assistant-typing span:nth-child(2) { animation-delay: 0.2s; }
.assistant-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}

.assistant-input-area {
    padding: var(--space-4);
    background: white;
    border-top: 1px solid var(--gray-100);
}

.assistant-input-area form {
    display: flex;
    gap: var(--space-2);
    background: var(--gray-50);
    border-radius: 12px;
    padding: 6px 6px 6px var(--space-4);
    align-items: center;
    border: 1px solid var(--gray-200);
    transition: all 0.15s ease;
}

.assistant-input-area form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.assistant-input-area input {
    flex: 1;
    padding: var(--space-2) 0;
    border: none;
    background: transparent;
    font-size: var(--text-sm);
    outline: none;
    font-family: inherit;
}

.assistant-input-area button {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.assistant-input-area button:hover {
    background: var(--accent-hover);
}

@media (max-width: 480px) {
    .assistant-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        right: -12px;
    }
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    padding: var(--space-5);
}

.login-card {
    background: white;
    padding: var(--space-10);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--gray-200);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo img {
    height: 48px;
    margin-bottom: var(--space-3);
}

.login-logo h1 {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--gray-900);
}

.login-form .form-group { margin-bottom: var(--space-4); }
.login-form .btn { 
    width: 100%; 
    margin-top: var(--space-4); 
    padding: var(--space-3); 
}

/* ==================== AGENT PAGE STYLES ==================== */
.agent-hero {
    background: white;
    border-radius: 16px;
    padding: var(--space-8);
    margin-bottom: var(--space-6);
    border: 1px solid var(--gray-200);
    text-align: center;
}

.agent-hero h2 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-3);
}

.agent-hero p {
    color: var(--gray-500);
    font-size: var(--text-base);
    max-width: 500px;
    margin: 0 auto;
}

.agent-chat-container {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
    height: 600px;
    display: flex;
    flex-direction: column;
}

.agent-messages {
    flex: 1;
    padding: var(--space-5);
    overflow-y: auto;
    background: var(--gray-50);
}

.agent-input-area {
    padding: var(--space-5);
    background: white;
    border-top: 1px solid var(--gray-100);
}

.agent-input-area form {
    display: flex;
    gap: var(--space-3);
}

.agent-input-area input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    font-size: var(--text-base);
}

.agent-input-area input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}


/* ==================== CUSTOMER BADGES ==================== */
.customer-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.customer-ct { background: #FEE2E2; color: #B91C1C; }
.customer-rona { background: #DBEAFE; color: #1D4ED8; }
.customer-gregg { background: #D1FAE5; color: #047857; }
.customer-gdl { background: #FEF3C7; color: #B45309; }
.customer-lowes { background: #E0E7FF; color: #4338CA; }
.customer-homedepot { background: #FFEDD5; color: #C2410C; }
.customer-walmart { background: #DBEAFE; color: #1E40AF; }
.customer-costco { background: #FEE2E2; color: #991B1B; }
.customer-other { background: var(--gray-100); color: var(--gray-600); }

/* CT Logo Badge (when image is missing) */
.ct-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 6px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* User Dropdown Styles */
.sidebar-user .dropdown-arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.sidebar-user.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    left: var(--space-3);
    right: var(--space-3);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 200;
    overflow: hidden;
}

.sidebar-user.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--gray-700);
    transition: background 0.1s;
}

.user-dropdown a:hover {
    background: var(--gray-50);
}

.user-dropdown a.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.user-dropdown a.active svg {
    stroke: var(--accent);
}

.dropdown-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    padding: var(--space-2) var(--space-4);
    font-weight: 500;
}

.user-dropdown a.logout-link {
    color: var(--danger);
    border-top: 1px solid var(--gray-100);
}

.user-dropdown a.logout-link:hover {
    background: var(--danger-bg);
}


/* ==================== AGENT SIDEBAR NAVIGATION ==================== */
.nav-item-agent {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 10px;
    color: var(--gray-600);
    border-radius: 6px;
    margin-bottom: 2px;
    font-size: var(--text-xs);
    font-weight: 450;
    transition: all 0.15s ease;
    position: relative;
}

.nav-item-agent:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.nav-item-agent.active {
    background: linear-gradient(135deg, #818CF8 0%, #6366F1 100%);
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.nav-item-agent.active .nav-agent-name,
.nav-item-agent.active .nav-agent-desc {
    color: white;
}

.nav-item-agent .nav-item-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item-agent .nav-item-icon svg {
    width: 24px;
    height: 24px;
}

.nav-agent-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.nav-agent-name {
    font-weight: 550;
    font-size: var(--text-xs);
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-agent-desc {
    font-size: 10px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item-agent:hover .nav-agent-name {
    color: var(--gray-900);
}

.nav-agent-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--gray-200);
    color: var(--gray-600);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

/* Agent icon background colors */
.agent-icon-sam {
    background: linear-gradient(135deg, #F472B6 0%, #EC4899 100%) !important;
}

.agent-icon-spencer {
    background: linear-gradient(135deg, #818CF8 0%, #4F46E5 100%) !important;
}

.agent-icon-tom {
    background: linear-gradient(135deg, #34D399 0%, #10B981 100%) !important;
}

.agent-icon-rachel {
    background: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%) !important;
}

/* Responsive - hide agent details on small sidebar */
@media (max-width: 1024px) {
    .nav-item-agent .nav-agent-info,
    .nav-item-agent .nav-agent-badge {
        display: none;
    }
    .nav-item-agent {
        justify-content: center;
        padding: var(--space-2);
    }
    .nav-item-agent .nav-item-icon {
        width: 28px;
        height: 28px;
    }
}

/* ==================== GLOBAL BACK BUTTON (new classes; .btn untouched) ==================== */
.mf-back-row {
    margin-bottom: var(--space-3);
}
.mf-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px;
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background 150ms ease-out;
    cursor: pointer;
}
.mf-back-btn:hover {
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
}
.mf-back-btn:active {
    transform: translateY(1px);
}
.mf-back-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
@media print {
    .mf-back-row { display: none !important; }
}
