/* ==========================================================================
   IT Operations Platform — Refined Dark Theme
   Softer colors, cleaner navigation, professional feel
   ========================================================================== */

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
    /* Softer purple brand (less saturated) */
    --brand-50: #faf8ff;
    --brand-100: #f3f0ff;
    --brand-200: #e9e3ff;
    --brand-300: #d4c9ff;
    --brand-400: #b8a4f8;
    --brand-500: #9d7ef0;
    --brand-600: #8259e3;
    --brand-700: #6b44c9;
    --brand-800: #5736a3;
    --brand-900: #482d85;
    
    /* Accent */
    --accent-400: #6ee7b7;
    --accent-500: #34d399;
    --accent-600: #10b981;
    
    /* Warning */
    --warning-400: #fcd34d;
    --warning-500: #fbbf24;
    --warning-600: #f59e0b;
    
    /* Danger */
    --danger-400: #fca5a5;
    --danger-500: #f87171;
    --danger-600: #ef4444;
    
    /* Warmer dark neutrals (less harsh) */
    --bg-base: #13131a;
    --bg-sidebar: #1a1a24;
    --bg-card: #1e1e2a;
    --bg-card-hover: #252534;
    --bg-input: #16161f;
    --bg-elevated: #222230;
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f0f0f5;
    --text-secondary: #9d9db5;
    --text-muted: #6b6b80;
    
    /* Shadows (softer) */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    
    /* Sidebar width */
    --sidebar-width: 240px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--brand-400);
    text-decoration: none;
}

a:hover {
    color: var(--brand-300);
}

/* ==========================================================================
   App Layout (Sidebar + Main)
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-brand i {
    color: var(--brand-400);
    font-size: 1.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--brand-600);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--brand-600);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ==========================================================================
   Main Content Area
   NOTE: Only offset when using a sidebar layout.
   ========================================================================== */
.main-content {
    flex: 1;
    min-height: 100vh;
}

/* When a sidebar layout is used, offset the main content */
.app-layout .main-content {
    margin-left: var(--sidebar-width);
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg);
    flex: 1;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ==========================================================================
   Legacy Header (for pages without sidebar yet)
   ========================================================================== */
.header {
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-800) 100%);
    color: white;
    padding: var(--space-lg) var(--space-xl);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: var(--text-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--brand-500);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
}

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

.btn-small {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.card-body {
    padding: var(--space-lg);
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.stat-card:hover {
    border-color: var(--brand-500);
    transform: translateY(-2px);
}

.stat-card.active {
    background: var(--brand-600);
    border-color: var(--brand-500);
}

.stat-card.active .stat-label,
.stat-card.active .stat-value {
    color: white;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    margin-bottom: var(--space-md);
}

.stat-icon.open { background: var(--warning-500); }
.stat-icon.progress { background: #3b82f6; }
.stat-icon.resolved { background: var(--accent-500); }

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Ticket Filter Cards (legacy) */
.ticket-filter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.ticket-filter-card:hover {
    border-color: var(--brand-500);
}

.filter-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    background: var(--bg-card-hover);
}

.filter-btn.active {
    background: var(--brand-600);
}

.filter-btn.active .filter-info h3,
.filter-btn.active .filter-info p {
    color: white;
}

.filter-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.filter-icon.open { background: linear-gradient(135deg, #f97316, #ea580c); }
.filter-icon.progress { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.filter-icon.resolved { background: linear-gradient(135deg, var(--accent-500), var(--accent-600)); }

.filter-btn.active .filter-icon {
    background: rgba(255,255,255,0.2);
}

.filter-info h3 {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.filter-info p {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ==========================================================================
   Filters Bar
   ========================================================================== */
.filters {
    background: var(--bg-card);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    margin-bottom: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.filters select,
.filters input {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
}

.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--brand-500);
}

.filters input {
    flex: 1;
    min-width: 200px;
}

.filters select option {
    background: var(--bg-card);
}

/* ==========================================================================
   Tickets
   ========================================================================== */
.tickets-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.tickets-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.tickets-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.tickets-list {
    max-height: 600px;
    overflow-y: auto;
    padding: var(--space-md);
}

.ticket-item {
    display: flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.ticket-item:hover {
    border-color: var(--brand-500);
    transform: translateX(4px);
}

.ticket-item:last-child {
    margin-bottom: 0;
}

.ticket-priority-indicator {
    width: 4px;
    flex-shrink: 0;
}

.ticket-priority-indicator.priority-critical { background: var(--danger-500); }
.ticket-priority-indicator.priority-high { background: #f97316; }
.ticket-priority-indicator.priority-medium { background: var(--warning-500); }
.ticket-priority-indicator.priority-low { background: var(--accent-500); }

.ticket-content {
    flex: 1;
    padding: var(--space-md);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
    gap: var(--space-md);
}

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

.ticket-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-xs) 0;
    line-height: 1.4;
}

.ticket-id {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

.ticket-badges {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.ticket-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Badges */
.status-badge,
.priority-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.status-open {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning-400);
}

.status-badge.status-in-progress {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.status-badge.status-resolved {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-400);
}

.priority-badge.priority-low {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-400);
}

.priority-badge.priority-medium {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning-400);
}

.priority-badge.priority-high {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
}

.priority-badge.priority-critical {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger-400);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    overflow-y: auto;
}

.modal-content {
    background: var(--bg-card);
    margin: 4% auto;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-elevated);
}

.modal-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-header h2 i {
    color: var(--brand-400);
}

.close {
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

/* ==========================================================================
   Forms
   ========================================================================== */
form {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(157, 126, 240, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

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

.form-group select option {
    background: var(--bg-card);
}

.form-group small {
    display: block;
    margin-top: var(--space-xs);
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    margin: 0 calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg));
}

.form-footer {
    text-align: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--brand-400);
    font-weight: 600;
}

/* ==========================================================================
   Auth Styles
   ========================================================================== */
.auth-section {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.user-section {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.user-welcome {
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Welcome Screen
   ========================================================================== */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-xl);
    width: 100%;
}

.welcome-content {
    max-width: 420px;
    width: 100%;
    padding: var(--space-2xl);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-default);
    margin: 0 auto;
}

.welcome-icon {
    font-size: 3.5rem;
    color: var(--brand-400);
    margin-bottom: var(--space-lg);
}

.welcome-content h2 {
    font-size: var(--text-2xl);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-weight: 700;
}

.welcome-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    font-size: var(--text-base);
}

.welcome-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* ==========================================================================
   Org Chart
   ========================================================================== */
.org-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--space-lg);
    align-items: start;
}

@media (max-width: 1100px) {
    .org-layout {
        grid-template-columns: 1fr;
    }
}

.org-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.org-panel-header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.org-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
}

.org-subtitle {
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.org-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.org-search {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-input);
}

.org-search i {
    color: var(--text-muted);
}

.org-search input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.org-search input::placeholder {
    color: var(--text-muted);
}

/* Org Chart Filters */
.org-filters {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    flex-wrap: wrap;
}

.org-filters select {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-xs);
}

.org-filters select option {
    background: var(--bg-card);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.view-toggle button {
    padding: var(--space-xs) var(--space-sm);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-toggle button.active {
    background: var(--brand-600);
    color: white;
}

.view-toggle button:hover:not(.active) {
    color: var(--text-primary);
}

.org-results {
    max-height: 60vh;
    overflow: auto;
}

.org-result {
    width: 100%;
    border: none;
    background: transparent;
    padding: var(--space-md);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
    text-align: left;
}

.org-result:hover {
    background: var(--bg-card-hover);
}

.org-result-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.org-result-sub {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.org-result-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
}

.org-result-mgr {
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.org-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(157, 126, 240, 0.15);
    color: var(--brand-300);
    font-weight: 600;
    font-size: var(--text-xs);
}

.pill-muted {
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.org-profile {
    padding: var(--space-lg);
}

.org-profile-header {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    margin-bottom: var(--space-lg);
}

.org-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    background: var(--brand-600);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.org-profile-name {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.org-profile-sub {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-top: 2px;
}

.org-profile-tags {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-left: auto;
}

.org-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

@media (max-width: 600px) {
    .org-cards {
        grid-template-columns: 1fr;
    }
}

.org-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

@media (max-width: 600px) {
    .org-grid2 {
        grid-template-columns: 1fr;
    }
}

.org-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    background: var(--bg-elevated);
}

.org-card-warn {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.05);
}

.org-card-title {
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.org-card-title i {
    color: var(--brand-400);
}

.org-card-body {
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.org-kv {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
}

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

.org-muted {
    color: var(--text-muted);
    font-style: italic;
    font-size: var(--text-sm);
}

.org-chain {
    list-style: none;
    padding: 0;
    margin: 0;
}

.org-chain li {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.org-chain li:last-child {
    border-bottom: none;
}

.org-chain-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.org-chain-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.org-report-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.org-report {
    width: 100%;
    border: none;
    background: var(--bg-card);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-subtle);
}

.org-report:hover {
    border-color: var(--brand-500);
}

.org-report-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.org-report-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.org-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
}

.org-empty-icon {
    font-size: 2.5rem;
    color: var(--brand-500);
    opacity: 0.4;
    margin-bottom: var(--space-md);
}

.org-empty-text strong {
    display: block;
    color: var(--text-secondary);
    font-size: var(--text-base);
    margin-bottom: var(--space-xs);
}

.org-empty-text div {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.org-loading {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
}

/* ==========================================================================
   Org Chart Tree View
   ========================================================================== */
.org-tree {
    padding: var(--space-md);
}

.org-tree-node {
    margin-left: var(--space-lg);
    padding-left: var(--space-md);
    border-left: 2px solid var(--border-subtle);
}

.org-tree-node:first-child {
    margin-left: 0;
    border-left: none;
    padding-left: 0;
}

.org-tree-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-xs);
}

.org-tree-item:hover {
    background: var(--bg-card-hover);
}

.org-tree-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
    cursor: pointer;
}

.org-tree-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-600);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
}

.org-tree-info {
    flex: 1;
    min-width: 0;
}

.org-tree-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.org-tree-title {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-content {
    padding: var(--space-lg);
    overflow-y: auto;
}

.settings-section {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.settings-section h3 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.settings-section h3 i {
    color: var(--brand-400);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-item label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-item span {
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.api-key-field {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.api-key-field input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

/* ==========================================================================
   Loading
   ========================================================================== */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--brand-500);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.3;
    color: var(--brand-500);
}

.empty-state h3 {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-500);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    .auth-section,
    .user-section {
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .welcome-content {
        padding: var(--space-lg);
    }
    
    .org-profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .org-profile-tags {
        margin-left: 0;
        justify-content: center;
    }
}

/* ==========================================================================
   Admin & Setup
   ========================================================================== */
.setup-instructions {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
}

.setup-content h2 {
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.setup-content h2 i {
    color: var(--warning-500);
}

.setup-content ol {
    margin: var(--space-md) 0;
    padding-left: var(--space-xl);
    color: var(--text-secondary);
}

.setup-content li {
    margin-bottom: var(--space-sm);
}

.setup-content code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--brand-300);
}

/* ==========================================================================
   Ticket Details, Response, Admin sections (legacy)
   ========================================================================== */
.ticket-details {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.ticket-info {
    margin-bottom: var(--space-lg);
}

.info-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
}

.info-row .label {
    font-weight: 600;
    color: var(--text-muted);
}

.info-row.full-width {
    grid-template-columns: 1fr;
}

.assignment-section,
.status-section,
.response-section,
.responses-section {
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.assignment-section h3,
.status-section h3,
.response-section h3,
.responses-section h3 {
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    font-size: var(--text-base);
}

.response-item {
    background: var(--bg-card);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    border-left: 3px solid var(--brand-500);
}

.response-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.response-author {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.response-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.response-text {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.admin-content {
    padding: var(--space-lg);
    overflow-y: auto;
}

.admin-section {
    background: var(--bg-card);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.admin-section h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.admin-section h3 i {
    color: var(--brand-400);
}

.admin-info p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.admin-warning {
    padding: var(--space-md);
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid var(--warning-500);
    border-radius: var(--radius-sm);
    margin-top: var(--space-md);
    display: flex;
    gap: var(--space-sm);
}

.admin-warning i {
    color: var(--warning-500);
}

.admin-warning strong {
    color: var(--warning-400);
}

.settings-note {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid var(--warning-500);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    color: var(--warning-400);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Auth mode options */
.auth-mode-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.current-mode {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.current-mode label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.auth-mode-badge {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--text-sm);
}

.auth-mode-badge.password {
    background: var(--brand-600);
    color: white;
}

.auth-mode-badge.passwordless {
    background: var(--accent-500);
    color: white;
}

.auth-mode-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.auth-mode-option {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: var(--bg-elevated);
}

.auth-mode-option:hover {
    border-color: var(--brand-500);
}

.auth-mode-option input[type="radio"] {
    margin-right: var(--space-md);
    accent-color: var(--brand-500);
}

.auth-mode-option label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.option-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.option-header i {
    color: var(--brand-400);
}

.option-description {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-left: 2rem;
}

/* User stats */
.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.stat-icon.password-users {
    background: var(--brand-600);
}

.stat-icon.passwordless-users {
    background: var(--accent-500);
}

.stat-icon.total-users {
    background: #3b82f6;
}

.stat-content h4 {
    font-size: var(--text-2xl);
    margin: 0;
    color: var(--text-primary);
    font-weight: 700;
}

/* API docs */
.api-endpoint {
    margin-bottom: var(--space-sm);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-elevated);
}

.endpoint-header {
    background: var(--bg-card);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.method {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: white;
}

.method.get { background: var(--accent-500); }
.method.post { background: #3b82f6; }
.method.put { background: var(--warning-500); }

.url {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.description {
    color: var(--text-muted);
    flex: 1;
    font-size: var(--text-sm);
}

.endpoint-example {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    border-top: 1px solid var(--border-subtle);
}

.endpoint-example code {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--brand-300);
}

/* API Logs */
.api-logs-container {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.logs-header {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.api-logs-list {
    max-height: 250px;
    overflow-y: auto;
}

.api-log-item {
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
}

.api-log-item:last-child {
    border-bottom: none;
}

.log-header {
    padding: var(--space-sm) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-main {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.log-method {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: white;
}

.log-endpoint {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.log-time {
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.log-status {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
}

.log-status.success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-400);
}

.log-status.error {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger-400);
}

.loading-logs {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-muted);
}

/* ==========================================================================
   Returns Logistics
   ========================================================================== */
.returns-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

@media (max-width: 900px) {
    .returns-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .returns-stats {
        grid-template-columns: 1fr;
    }
}

.returns-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.returns-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.returns-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.returns-list {
    max-height: 600px;
    overflow-y: auto;
    padding: var(--space-md);
}

.returns-loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.return-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.return-card:hover {
    border-color: var(--brand-500);
    transform: translateX(4px);
}

.return-card:last-child {
    margin-bottom: 0;
}

.return-card-left {
    flex-shrink: 0;
}

.return-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--brand-400);
}

.return-card-main {
    flex: 1;
    min-width: 0;
}

.return-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.return-number {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.return-item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-base);
    margin-bottom: var(--space-xs);
}

.return-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.return-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.return-card-actions {
    flex-shrink: 0;
}

/* Return status badges */
.return-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.return-status.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning-400);
}

.return-status.status-approved {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.return-status.status-packaging {
    background: rgba(139, 92, 246, 0.15);
    color: var(--brand-400);
}

.return-status.status-transit {
    background: rgba(139, 92, 246, 0.15);
    color: var(--brand-400);
}

.return-status.status-received {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-400);
}

.return-status.status-processed {
    background: rgba(52, 211, 153, 0.2);
    color: var(--accent-400);
}

.return-status.status-cancelled {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger-400);
}

/* Return Detail Modal */
.return-detail {
    padding: var(--space-md);
}

.return-detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.return-detail-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.return-detail-info {
    flex: 1;
}

.return-number-large {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-xs);
}

.return-item-large {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.return-detail-status {
    flex-shrink: 0;
}

.return-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

@media (max-width: 700px) {
    .return-detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-card-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.detail-card-title i {
    color: var(--brand-400);
}

.detail-card-body {
    font-size: var(--text-sm);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.detail-row:last-child {
    border-bottom: none;
}

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

.shipping-address {
    line-height: 1.6;
    color: var(--text-primary);
}

.tracking-link {
    color: var(--brand-400);
    font-family: var(--font-mono);
}

/* Return timeline */
.return-timeline {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.timeline-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.timeline-title i {
    color: var(--brand-400);
}

.timeline-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
}

.timeline-steps::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--border-default);
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.timeline-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-default);
    margin-bottom: var(--space-sm);
}

.timeline-step.completed .timeline-marker {
    background: var(--accent-500);
    border-color: var(--accent-500);
}

.timeline-content {
    text-align: center;
}

.timeline-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

.timeline-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.return-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* Modal body for returns */
.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

/* ==========================================================================
   Light Mode Theme
   ========================================================================== */
[data-theme="light"] {
    --bg-base: #f8f9fc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f8;
    --bg-input: #f1f3f7;
    --bg-elevated: #ffffff;
    
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.15);
    
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #7a7a9a;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Remove background pattern in light mode */
[data-theme="light"] body::before {
    display: none;
}

/* Light mode header adjustments */
[data-theme="light"] .header {
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .user-welcome {
    background: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
}

/* Light mode cards */
[data-theme="light"] .stat-card,
[data-theme="light"] .ticket-item,
[data-theme="light"] .return-card,
[data-theme="light"] .org-result:hover {
    box-shadow: var(--shadow-sm);
}

/* Light mode modals */
[data-theme="light"] .modal {
    background: rgba(0, 0, 0, 0.3);
}

/* Light mode scrollbars */
[data-theme="light"]::-webkit-scrollbar-track {
    background: #f1f1f1;
}

[data-theme="light"]::-webkit-scrollbar-thumb {
    background: #c1c1c1;
}

/* ==========================================================================
   Theme Toggle Switch (obvious control)
   ========================================================================== */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--brand-500);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(157, 126, 240, 0.2);
    border-color: var(--brand-500);
}

.theme-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.theme-toggle-label i {
    font-size: 12px;
    opacity: 0.95;
}

/* switch track */
.theme-switch {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-default);
    flex-shrink: 0;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

/* switch knob */
.theme-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base), background var(--transition-fast);
}

/* icon inside knob */
.theme-switch i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: var(--bg-base);
    pointer-events: none;
    opacity: 0.95;
}

/* Dark mode default: label shows Dark, knob on right with moon */
:root .theme-toggle .label-light { display: none; }
:root .theme-toggle .label-dark { display: inline-flex; }

:root .theme-toggle .theme-switch::after { transform: translateX(20px); }
:root .theme-toggle .theme-switch .fa-moon { display: block; }
:root .theme-toggle .theme-switch .fa-sun { display: none; }

/* Light mode: label shows Light, knob on left with sun */
[data-theme="light"] .theme-toggle .label-light { display: inline-flex; }
[data-theme="light"] .theme-toggle .label-dark { display: none; }
[data-theme="light"] .theme-toggle-label { color: var(--text-primary); }

[data-theme="light"] .theme-toggle .theme-switch::after { transform: translateX(0); }
[data-theme="light"] .theme-toggle .theme-switch .fa-moon { display: none; }
[data-theme="light"] .theme-toggle .theme-switch .fa-sun { display: block; }

/* ==========================================================================
   Now Experience (Ticketing-only scope)
   ========================================================================== */
.now-experience {
    background: var(--bg-base);
}

.now-experience .now-shell {
    display: flex;
    min-height: 100vh;
}

.now-experience.unauthenticated .now-rail {
    display: none;
}

.now-experience.unauthenticated .now-workspace {
    margin-left: 0;
}

.now-experience .now-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
    z-index: 200;
}

.now-experience .now-rail-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}

.now-experience .now-rail-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(130, 89, 227, 0.2);
    color: var(--brand-400);
    font-size: 1rem;
}

.now-experience .now-rail-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.6px;
}

.now-experience .now-rail-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.now-experience .now-rail-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.now-experience .now-rail-item i {
    width: 18px;
    text-align: center;
}

.now-experience .now-rail-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.now-experience .now-rail-item.active {
    background: rgba(130, 89, 227, 0.18);
    color: var(--text-primary);
    border-color: rgba(130, 89, 227, 0.4);
}

.now-experience .now-workspace {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-xl);
    gap: var(--space-lg);
}

.now-experience .now-header {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: 0;
}

.now-experience .now-header-title h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin: 0;
}

.now-experience .now-header-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.now-experience .now-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.now-experience .now-metrics {
    max-width: none;
    margin: 0;
}

.now-experience .now-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.now-experience .now-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-lg);
}

.now-experience .now-pane {
    min-width: 0;
}

.now-experience .now-pane-detail {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.now-experience .now-detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.now-experience .now-detail-card h3,
.now-experience .now-detail-card h4 {
    margin-bottom: var(--space-sm);
}

.now-experience .now-detail-list {
    margin-left: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.now-experience .tickets-container {
    box-shadow: var(--shadow-sm);
}

.now-experience .ticket-item {
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.now-experience .ticket-item:hover {
    transform: translateY(-1px);
}

/* Ticket details as right-side record panel */
.now-experience .record-panel-modal {
    padding-right: 0;
}

.now-experience .record-panel-content {
    margin: 0;
    width: 520px;
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    position: fixed;
    right: 0;
    top: 0;
    overflow-y: auto;
}

.now-experience .record-panel-modal .modal-header {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    border-bottom: 1px solid var(--border-subtle);
}

@media (max-width: 1100px) {
    .now-experience .now-split {
        grid-template-columns: 1fr;
    }
    .now-experience .now-pane-detail {
        order: 2;
    }
}

@media (max-width: 900px) {
    .now-experience .now-rail {
        position: static;
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .now-experience .now-workspace {
        margin-left: 0;
    }
    .now-experience .now-rail-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

[data-theme="light"] .now-experience .now-rail {
    background: #f7f7fb;
    border-right: 1px solid #e5e7eb;
}

[data-theme="light"] .now-experience .now-rail-header,
[data-theme="light"] .now-experience .now-header,
[data-theme="light"] .now-experience .now-detail-card,
[data-theme="light"] .now-experience .now-toolbar,
[data-theme="light"] .now-experience .tickets-container {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .now-experience .now-rail-item {
    color: #4b5563;
}

[data-theme="light"] .now-experience .now-rail-item.active {
    background: rgba(130, 89, 227, 0.12);
    border-color: rgba(130, 89, 227, 0.3);
}

[data-theme="light"] .now-experience .now-header {
    color: var(--text-primary);
}

[data-theme="light"] .now-experience .now-header .now-header-subtitle {
    color: var(--text-muted);
}

/* Header styling: make it look like a deliberate switch, not another button */
.header .theme-toggle {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

.header .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.18);
}

.header .theme-toggle-label {
    color: rgba(255, 255, 255, 0.92);
}

.header .theme-switch {
    background: rgba(0, 0, 0, 0.18);
    border-color: rgba(255, 255, 255, 0.24);
}

[data-theme="light"] .header .theme-toggle {
    background: var(--bg-input);
    border-color: var(--border-default);
}

[data-theme="light"] .header .theme-toggle:hover {
    background: var(--bg-card-hover);
}

[data-theme="light"] .header .theme-toggle-label {
    color: var(--text-primary);
}

[data-theme="light"] .header .theme-switch {
    background: rgba(0, 0, 0, 0.08);
    border-color: var(--border-default);
}

