/* ============================================================================
   KYNTHAR SHARED STYLES - Enterprise Neutral Theme
   Apple-inspired Professional Design System
   ============================================================================ */

/* ============================================================================
   CSS CUSTOM PROPERTIES (Variables)
   Support for Light/Dark themes
   ============================================================================ */

:root {
    /* Enterprise Neutral Palette - Apple Inspired */
    /* Primary colors are neutral, accent is used sparingly */

    /* Neutrals - The foundation */
    --color-black: #1d1d1f;
    --color-gray-900: #1d1d1f;
    --color-gray-800: #333336;
    --color-gray-700: #48484a;
    --color-gray-600: #636366;
    --color-gray-500: #86868b;
    --color-gray-400: #aeaeb2;
    --color-gray-300: #c7c7cc;
    --color-gray-200: #d2d2d7;
    --color-gray-100: #e8e8ed;
    --color-gray-50: #f5f5f7;
    --color-white: #ffffff;

    /* Brand Teal - Kynthar signature color */
    --color-accent: #0d9488;
    --color-accent-hover: #14b8a6;
    --color-accent-pale: #ccfbf1;

    /* Semantic Colors - Light Mode */
    --bg-primary: #f5f5f7;
    --bg-surface: #ffffff;
    --bg-secondary: #fbfbfd;
    --bg-elevated: #ffffff;
    --bg-hover: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #aeaeb2;
    --border-color: #d2d2d7;
    --border-subtle: #e8e8ed;
    --border-focus: #0d9488;

    /* Brand Colors - Teal primary */
    --brand-primary: #0d9488;
    --brand-primary-hover: #14b8a6;
    --brand-secondary: #06b6d4;
    --brand-dark: #115e59;
    --link-color: #0d9488;
    --chart-bar-color: #1d1d1f;

    /* Status Colors - Semantic */
    --status-success-bg: #e8f8ef;
    --status-success-text: #1d7d42;
    --status-success-icon: #34c759;
    --status-warning-bg: #fff8e6;
    --status-warning-text: #9a6700;
    --status-warning-icon: #ff9500;
    --status-error-bg: #ffefef;
    --status-error-text: #c41e3a;
    --status-error-icon: #ff3b30;
    --status-info-bg: #f0fdfa;
    --status-info-text: #115e59;
    --status-info-icon: #0d9488;

    /* Shadows - Subtle, professional */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 2px 8px 0 rgb(0 0 0 / 0.08);
    --shadow-lg: 0 4px 16px 0 rgb(0 0 0 / 0.1);
    --shadow-xl: 0 8px 32px 0 rgb(0 0 0 / 0.12);

    /* Spacing Scale */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Border Radius - Slightly softer */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Legacy compatibility */
    --color-navy: #1d1d1f;
    --color-blue-medium: #0d9488;
    --color-blue-light: #14b8a6;
    --color-blue-pale: #ccfbf1;
    --primary: #0d9488;
}

/* Dark Mode Theme - True dark, minimal */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-surface: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-elevated: #3a3a3c;
    --bg-hover: #2c2c2e;
    --text-primary: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #6e6e73;
    --border-color: #3a3a3c;
    --border-subtle: #2c2c2e;
    --border-focus: #2dd4bf;

    --brand-primary: #2dd4bf;
    --brand-primary-hover: #5eead4;
    --brand-secondary: #22d3ee;
    --link-color: #2dd4bf;
    --chart-bar-color: #f5f5f7;

    --status-success-bg: #0d3318;
    --status-success-text: #30d158;
    --status-success-icon: #30d158;
    --status-warning-bg: #3d2800;
    --status-warning-text: #ffd60a;
    --status-warning-icon: #ff9f0a;
    --status-error-bg: #3d0a0a;
    --status-error-text: #ff453a;
    --status-error-icon: #ff453a;
    --status-info-bg: #042f2e;
    --status-info-text: #5eead4;
    --status-info-icon: #2dd4bf;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 2px 8px 0 rgb(0 0 0 / 0.5);
    --shadow-lg: 0 4px 16px 0 rgb(0 0 0 / 0.6);
    --shadow-xl: 0 8px 32px 0 rgb(0 0 0 / 0.7);

    --color-blue-pale: rgba(45, 212, 191, 0.15);
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 14px;
    min-height: 100vh;
    transition: background-color var(--transition-base), color var(--transition-base);
    font-feature-settings: 'cv11' 1; /* Manrope alternative stylistic set */
    letter-spacing: -0.01em; /* Slight tightening for modern feel */
}

/* Monospace for data values */
.mono, .data-value, .doc-id, .amount, code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-feature-settings: 'tnum' 1; /* Tabular numbers */
}

/* ============================================================================
   TYPOGRAPHY SCALE
   ============================================================================ */

h1 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.015em;
}

h3 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.01em;
}

p {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-secondary);
}

.text-small {
    font-size: 12px;
    color: var(--text-secondary);
}

.text-xs {
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

/* ============================================================================
   LAYOUT COMPONENTS
   ============================================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--spacing-xl);
    }
}

/* ============================================================================
   UNIFIED HEADER - Enterprise Neutral Style
   ============================================================================ */

.app-header {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    gap: var(--spacing-lg);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.header-logo img {
    display: none;
}

.header-logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.header-nav {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

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

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

/* Dark Mode Toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}

.theme-toggle #themeIcon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 0;
}

.theme-toggle #themeIcon svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* ============================================================================
   RESPONSIVE MOBILE NAVIGATION
   ============================================================================ */

/* Mobile: Hide navigation, show it in a mobile-friendly way */
@media (max-width: 768px) {
    .app-header .container {
        padding: 0 var(--spacing-sm);
    }

    .header-content {
        flex-wrap: wrap;
        padding: var(--spacing-xs) 0;
    }

    .header-logo {
        font-size: 18px;
    }

    .header-logo-text {
        font-size: 22px !important;
    }

    .header-nav {
        order: 3;
        flex-basis: 100%;
        justify-content: flex-start;
        gap: 6px;
        margin-top: var(--spacing-xs);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .header-actions {
        gap: 4px;
    }

    .header-actions .btn {
        padding: 6px 10px;
        font-size: 13px;
    }

    .theme-toggle {
        width: 34px;
        height: 34px;
    }

    /* Hide logout text, show icon only */
    .header-actions .btn-secondary:last-child {
        font-size: 0;
        padding: 6px 8px;
    }

    .header-actions .btn-secondary:last-child::before {
        content: "→";
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .header-actions .btn-secondary:first-of-type::before {
        content: "⚙️";
        margin-right: 0;
    }

    .header-actions .btn-secondary:first-of-type {
        font-size: 0;
        padding: 8px;
        min-width: 38px;
    }

    .header-actions .btn-secondary:first-of-type::before {
        font-size: 18px;
    }

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

/* Tablet and up: nav follows logo, actions on right */
@media (min-width: 769px) {
    .header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header-logo {
        flex-shrink: 0;
    }

    .header-nav {
        flex: 1;
        display: flex;
        justify-content: flex-start;
        margin-left: var(--spacing-xl);
    }

    .header-actions {
        flex-shrink: 0;
    }
}

/* ============================================================================
   BUTTONS - Enterprise Clean Style
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--text-primary);
    color: var(--bg-surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-gray-700);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-hover);
    border-color: var(--text-tertiary);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--text-tertiary);
    background-color: var(--bg-hover);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

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

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
}

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

.card-interactive {
    cursor: pointer;
}

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

/* ============================================================================
   FORMS
   ============================================================================ */

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

label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

/* Option elements for dropdowns */
option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.badge-warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.badge-error {
    background-color: var(--status-error-bg);
    color: var(--status-error-text);
}

.badge-info {
    background-color: var(--status-info-bg);
    color: var(--status-info-text);
}

/* ============================================================================
   TABLES
   ============================================================================ */

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

thead {
    background-color: var(--bg-primary);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

tr:hover {
    background-color: var(--bg-primary);
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--spacing-md);
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-surface);
    border-radius: var(--radius-xl);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

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

.modal-body {
    padding: var(--spacing-lg);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: var(--spacing-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

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

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

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

.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }

/* ============================================================================
   RESPONSIVE GRID
   ============================================================================ */

.grid {
    display: grid;
    gap: var(--spacing-md);
}

@media (min-width: 640px) {
    .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.loading-spinner {
    border: 3px solid var(--border-color);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

.skeleton {
    background: linear-gradient(90deg, var(--bg-primary) 25%, var(--border-color) 50%, var(--bg-primary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================
   FOCUS STYLES (Accessibility)
   ============================================================================ */

*:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* ============================================================================
   MOBILE-FIRST RESPONSIVE UTILITIES
   ============================================================================ */

/* Container sizing */
@media (max-width: 640px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .main-content,
    .admin-container,
    .upload-container {
        margin: var(--spacing-lg) auto;
        padding: 0 var(--spacing-sm);
    }

    /* Typography adjustments */
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }

    /* Card stacking */
    .card {
        padding: var(--spacing-md);
    }

    /* Form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Tablet (641px - 1023px) */
@media (min-width: 641px) and (max-width: 1023px) {
    .container {
        padding: 0 var(--spacing-md);
    }

    h1 {
        font-size: 28px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        padding: 0 var(--spacing-xl);
    }
}

/* Utility Classes */
.hide-mobile {
    display: none;
}

@media (min-width: 769px) {
    .hide-mobile {
        display: block;
    }

    .hide-desktop {
        display: none;
    }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================================================
   DASHBOARD LAYOUT
   ============================================================================ */

.dashboard-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
    background: var(--bg-primary);
}

.dashboard-layout.sidebar-collapsed {
    grid-template-columns: 70px 1fr;
}

/* Sidebar */
.dashboard-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: all var(--transition-base);
}

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

.sidebar-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-primary);
    text-decoration: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md) 0;
}

.sidebar-section {
    margin-bottom: var(--spacing-lg);
}

.sidebar-section-title {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--text-primary);
}

.sidebar-link-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-link-text {
    flex: 1;
}

/* Collapsed sidebar */
.sidebar-collapsed .sidebar-logo,
.sidebar-collapsed .sidebar-section-title,
.sidebar-collapsed .sidebar-link-text {
    display: none;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: var(--spacing-sm);
}

/* Dashboard Main Area */
.dashboard-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.dashboard-topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.dashboard-search {
    flex: 1;
    max-width: 500px;
}

.dashboard-search input {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.dashboard-search input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-surface);
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-button {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.profile-button:hover {
    background: var(--bg-primary);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.profile-menu.active {
    display: block;
}

.profile-menu-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.profile-menu-name {
    font-weight: 600;
    color: var(--text-primary);
}

.profile-menu-email {
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.profile-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-xs) 0;
}

/* Dashboard Content */
.dashboard-content {
    flex: 1;
    padding: var(--spacing-xl);
}

/* Stats Grid - Clean, minimal */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.stat-card {
    background: var(--bg-surface);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    position: relative;
}

.stat-card:hover {
    border-color: var(--text-tertiary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1;
    font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.stat-change {
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--status-success-text);
}

.stat-change.negative {
    color: var(--status-error-text);
}

/* Compact Filter Bar */
.compact-filter-bar {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    align-items: center;
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 50px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

/* Hide keyboard shortcut hint when input is focused */
.search-box input:focus + .search-shortcut-hint {
    opacity: 0;
}

.search-box input:focus {
    outline: none;
    border-color: var(--text-tertiary);
    box-shadow: none;
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.filter-dropdown-wrapper {
    position: relative;
}

.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.filter-toggle-btn:hover {
    border-color: var(--text-tertiary);
    background: var(--bg-hover);
}

.filter-toggle-btn.active {
    border-color: var(--text-primary);
    background: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .filter-toggle-btn.active {
    background: var(--bg-secondary);
}

.filter-toggle-btn svg {
    flex-shrink: 0;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--text-primary);
    color: var(--bg-surface);
    font-size: 11px;
    font-weight: 600;
}

.filter-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 280px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
}

.filter-popover.open {
    display: block;
}

.filter-popover-content {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-row input,
.filter-row select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.filter-row input:focus,
.filter-row select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.filter-row input::placeholder {
    color: var(--text-tertiary);
}

.filter-popover-footer {
    padding: var(--spacing-sm) var(--spacing-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-text {
    background: none;
    border: none;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: background var(--transition-base);
}

.btn-text:hover {
    background: var(--bg-secondary);
}

@media (max-width: 768px) {
    .compact-filter-bar {
        display: none;
    }
}

/* Data Table - Clean, minimal */
.data-table-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

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

.data-table thead {
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.data-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-fast);
    background: transparent;
    white-space: nowrap;
}

.data-table th:hover {
    color: var(--text-secondary);
}

.data-table th.sortable::after {
    content: ' ↕';
    opacity: 0.3;
    font-size: 9px;
}

.data-table th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

.data-table th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

.data-table tbody tr {
    height: 40px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    cursor: pointer;
    position: relative;
}

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

.data-table tbody tr:hover {
    background: var(--bg-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 1;
}

.data-table tbody tr.expanded {
    background: var(--bg-secondary);
}

/* Staggered row reveal animation */
@keyframes rowReveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.data-table tbody tr.row-animate {
    animation: rowReveal 0.3s ease forwards;
    opacity: 0;
}

.data-table td {
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Truncate long file names in second column (after checkbox) */
.data-table td:nth-child(2) {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Vendor name column - allow reasonable truncation */
.data-table td:nth-child(3) {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1200px) {
    .data-table td:nth-child(2) {
        max-width: 200px;
    }
    .data-table td:nth-child(3) {
        max-width: 140px;
    }
}

@media (max-width: 768px) {
    .data-table td:nth-child(2),
    .data-table td:nth-child(3) {
        max-width: 100%;
    }
}

/* Table Pagination - Minimal right-aligned */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 70px 10px 0;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-tertiary);
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-nav button:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Accordion Details Row - Smooth expansion */
.accordion-details {
    display: none;
}

.accordion-details.active {
    display: table-row;
    background: var(--bg-primary);
}

.accordion-details td {
    padding: 0;
    background: var(--bg-primary);
}

/* Smooth content reveal animation */
@keyframes accordionReveal {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accordion-details.active .accordion-content {
    animation: accordionReveal 0.3s ease forwards;
}

.accordion-content {
    padding: var(--spacing-xl) var(--spacing-xl) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Only apply background to detail-section within accordion-content, not globally */
.accordion-content .detail-section {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: var(--spacing-md);
}

.detail-sections {
    display: grid;
    gap: var(--spacing-lg);
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.chat-toggle:hover {
    background: var(--brand-primary-hover);
    transform: scale(1.1);
}

.chat-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
}

.chat-panel.active {
    display: flex;
}

.chat-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
}

.chat-messages {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
}

.chat-input-container {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.chat-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.chat-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* Mobile Responsive - Dashboard */
@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 250px;
        transform: translateX(-100%);
        z-index: 1000;
    }

    .dashboard-sidebar.mobile-open {
        transform: translateX(0);
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

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

    .dashboard-topbar {
        padding: var(--spacing-md);
    }

    .dashboard-search {
        max-width: none;
    }

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

    .chat-panel {
        width: calc(100vw - 32px);
        height: 400px;
        right: 16px;
        bottom: 70px;
    }

    .data-table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }
}

/* ============================================================================
   TOOLTIPS
   Premium hover tooltips for explaining technical terms
   ============================================================================ */

.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--color-gray-900);
    color: white;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
    pointer-events: none;
}

/* Tooltip that anchors to the right edge (for elements near right side of screen) */
.tooltip-right::after {
    left: auto;
    right: 0;
    transform: none;
}

.tooltip-right::before {
    left: auto;
    right: 12px;
    transform: none;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-gray-900);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Multi-line tooltips */
.tooltip-multiline::after {
    white-space: normal;
    width: 240px;
    text-align: left;
}

/* Tooltip positioned below */
.tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 8px);
}

.tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: var(--color-gray-900);
}

/* Dark mode tooltip adjustments */
[data-theme="dark"] .tooltip::after {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .tooltip::before {
    border-top-color: var(--bg-elevated);
}

[data-theme="dark"] .tooltip-bottom::before {
    border-top-color: transparent;
    border-bottom-color: var(--bg-elevated);
}

/* ============================================================================
   SKELETON LOADERS
   Premium shimmer effect for loading states
   ============================================================================ */

.skeleton-loader {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton variants */
.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text-lg {
    height: 20px;
    margin-bottom: 12px;
}

.skeleton-title {
    height: 28px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-badge {
    height: 24px;
    width: 80px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    padding: var(--spacing-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.skeleton-cell {
    height: 16px;
    flex: 1;
}

.skeleton-cell-sm {
    height: 16px;
    width: 60px;
}

.skeleton-cell-md {
    height: 16px;
    width: 120px;
}

/* ============================================================================
   EMPTY STATES
   Professional illustrated empty states
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.empty-state-icon svg {
    width: 40px;
    height: 40px;
    stroke-width: 1.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-state-description {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 320px;
    margin: 0 auto var(--spacing-lg);
    line-height: 1.5;
}

.empty-state-action {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.empty-state-action:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-2px);
}

/* ============================================================================
   INFO HINTS
   Subtle inline help text
   ============================================================================ */

.info-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: var(--spacing-sm);
}

.info-hint svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.info-hint-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: 6px;
}

.info-hint-inline svg {
    width: 12px;
    height: 12px;
}

/* ============================================================================
   FLOATING AI ASSISTANT BUTTON
   ============================================================================ */

.ai-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
}

.ai-fab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--text-primary);
    color: var(--bg-surface);
    border: none;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-fab-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.ai-fab-btn:active {
    transform: scale(0.98);
}

.ai-fab-btn svg {
    width: 24px;
    height: 24px;
}

/* Tooltip on hover */
.ai-fab-btn::before {
    content: 'Ask AI';
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary);
    color: var(--bg-surface);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.ai-fab-btn:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Hide on AI search page since we're already there */
.page-aisearch .ai-fab {
    display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .ai-fab {
        bottom: 16px;
        right: 16px;
    }

    .ai-fab-btn {
        width: 48px;
        height: 48px;
    }

    .ai-fab-btn svg {
        width: 20px;
        height: 20px;
    }

    .ai-fab-btn::before {
        display: none;
    }
}

/* ============================================================================
   DOCUMENT SECTIONS (Carton Details, Serial Numbers, etc.)
   Collapsible accordion sections for structured document data
   ============================================================================ */

.document-sections-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.section-group {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.section-group:hover {
    border-color: var(--text-tertiary);
}

.section-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast);
}

.section-header:hover {
    background: var(--bg-hover);
}

.section-header:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: -2px;
}

.section-header-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.section-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: transform var(--transition-base);
}

.section-content {
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.section-data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.section-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.section-data-table thead {
    background: var(--bg-primary);
}

.section-data-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

.section-data-table td {
    padding: 10px 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

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

.section-data-table tbody tr:hover {
    background: var(--bg-hover);
}

/* Numeric values right-aligned and monospaced */
.section-data-table td[data-type="currency"],
.section-data-table td[data-type="quantity"] {
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* Mobile: Card stack layout for sections */
@media (max-width: 768px) {
    .section-data-table-wrapper {
        overflow-x: visible;
    }

    .section-data-table {
        display: block;
    }

    .section-data-table thead {
        display: none;
    }

    .section-data-table tbody {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .section-data-table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-primary);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        padding: var(--spacing-sm);
    }

    .section-data-table tbody tr:hover {
        background: var(--bg-primary);
    }

    .section-data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 6px 8px;
        border-bottom: 1px solid var(--border-subtle);
        white-space: normal;
        word-break: break-word;
    }

    .section-data-table td:last-child {
        border-bottom: none;
    }

    /* Show column name as label on mobile */
    .section-data-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        margin-right: var(--spacing-sm);
    }
}

/* Print styles for sections */
@media print {
    .section-group {
        break-inside: avoid;
        border: 1px solid #ddd;
        margin-bottom: 12px;
    }

    .section-header {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .section-chevron {
        display: none;
    }

    .section-content {
        display: block !important;
    }

    .section-data-table th,
    .section-data-table td {
        padding: 6px 8px;
        font-size: 10px;
        border: 1px solid #ddd;
    }

    .section-data-table thead {
        background: #eee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================================
   CONTENT DENSITY LEVELS
   ============================================================================ */

.data-table.compact tbody td {
    height: 32px;
    padding: 4px 12px;
    font-size: 12px;
}

.data-table.comfortable tbody td {
    height: 56px;
    padding: 16px 14px;
}

/* ============================================================================
   SORTABLE TABLE HEADERS
   ============================================================================ */

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.data-table th.sortable::after {
    content: ' ↕';
    opacity: 0.3;
    font-size: 10px;
    margin-left: 4px;
}

.data-table th.sortable.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

.data-table th.sortable.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

/* ============================================================================
   BULK ACTIONS BAR
   ============================================================================ */

.bulk-actions-bar {
    display: none;
    position: sticky;
    bottom: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    gap: 12px;
    align-items: center;
    z-index: 20;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.bulk-actions-bar.active {
    display: flex;
}

.bulk-actions-bar .selected-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: auto;
}

.bulk-actions-bar .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================================================
   ENHANCED EMPTY STATES
   ============================================================================ */

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

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--text-tertiary);
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.empty-state-description {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 300px;
    margin-bottom: var(--spacing-lg);
}

.empty-state-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================================
   ROW SELECTION
   ============================================================================ */

.data-table .select-cell {
    width: 40px;
    text-align: center;
    padding: 0 8px;
}

.data-table .select-cell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand-primary);
}

.data-table tbody tr.selected {
    background: var(--color-blue-pale);
}

.data-table tbody tr.selected:hover {
    background: var(--color-blue-pale);
}

/* ============================================================================
   USAGE BADGE (Header)
   ============================================================================ */

.usage-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--status-success-bg);
    color: var(--status-success-text);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.usage-badge:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.usage-badge.warning {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.usage-badge.danger {
    background: var(--status-error-bg);
    color: var(--status-error-text);
    animation: pulse-danger 2s ease-in-out infinite;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

.usage-badge-text {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .usage-badge {
        display: none;
    }
}
