/* ============================================================================
   PRINTLOGIC.AI - UNIVERSAL STYLES
   ============================================================================
   Works across: Browser, Outlook Add-in, Chrome Extension
   ============================================================================ */

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */
:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --surface: #ffffff;
    --text: #333333;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --info-bg: #f0f4ff;
    --bg-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow: rgba(102, 126, 234, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Variables */
body.dark-mode {
    --surface: #1a1a1a;
    --text: #f0f0f0;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-muted: #777777;
    --border: #333333;
    --info-bg: #2d2d2d;
    background: #121212;
}

/* ============================================================================
   CSS RESET - Element Defaults
   ============================================================================
   IMPORTANT: These resets ensure elements have minimal default styling.
   Components that want styled appearance must use explicit classes.
   This prevents cascade issues like buttons inheriting width: 100%.
   ============================================================================ */

/* Button Reset - removes default styling, components opt-in via classes */
button {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    outline: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Form Element Reset - minimal styling, components opt-in via classes */
input,
textarea,
select {
    font: inherit;
    color: inherit;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px;
    margin: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Image Reset - prevent overflow issues */
img,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================================================
   BROWSER TOOLBAR (Persistent Header - Browser Only)
   ============================================================================ */
.browser-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e0e0e0;
}

.browser-toolbar.hidden {
    display: none;
}

.toolbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    padding: 0 24px;
    box-sizing: border-box;
}

/* Toolbar Left - Logo and Brand */
.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.toolbar-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.toolbar-brand {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    letter-spacing: 0.5px;
}

/* Toolbar Center - Navigation */
.toolbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-link {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-link:hover {
    background: var(--primary);
    color: #ffffff;
}

.toolbar-link.active {
    background: var(--primary);
    color: #ffffff;
}

.toolbar-link.hidden {
    display: none;
}

/* Toolbar Right - Actions and User */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.toolbar-icon-btn {
    background: transparent;
    border: 1px solid #ddd;
    color: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.toolbar-icon-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.toolbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 12px;
    border-left: 1px solid #e0e0e0;
}

#toolbarUserName {
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbar-logout-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-logout-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

/* Body adjustment when toolbar is visible */
body.has-toolbar {
    padding-top: 56px;
}

body.has-toolbar .container {
    margin-top: 10px;
}

/* Dark mode toolbar adjustments */
body.dark-mode .browser-toolbar {
    background: #1a1a2e;
    border-bottom-color: #333;
}

body.dark-mode .toolbar-brand {
    color: #ffffff;
}

body.dark-mode .toolbar-link {
    border-color: var(--primary);
    color: var(--primary);
}

body.dark-mode .toolbar-user {
    border-left-color: #444;
}

body.dark-mode #toolbarUserName {
    color: #ffffff;
}

/* Responsive toolbar */
@media (max-width: 900px) {
    .toolbar-content {
        padding: 0 12px;
    }

    .toolbar-brand {
        display: none;
    }

    .toolbar-link {
        padding: 8px 10px;
        font-size: 13px;
    }

    #toolbarUserName {
        display: none;
    }

    .toolbar-user {
        border-left: none;
        padding-left: 0;
    }
}

@media (max-width: 600px) {
    .toolbar-nav {
        gap: 2px;
    }

    .toolbar-link {
        padding: 8px;
        font-size: 12px;
    }

    .toolbar-icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .toolbar-logout-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    background: var(--bg-grad);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease;
    display: flex;
    flex-direction: column;
}

.container {
    background: var(--surface);
    margin: 10px auto;
    border-radius: 12px;
    padding: 16px;
    min-height: calc(100vh - 20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    position: relative;
    transition: background 0.3s;
    max-width: 1200px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1 0 auto;
}

/* ============================================================================
   GLOBAL USER DISPLAY
   ============================================================================ */
.global-user-display {
    background: var(--info-bg);
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.global-user-display::before {
    content: "👤";
    font-size: 12px;
    flex-shrink: 0;
}

#globalUserName {
    font-weight: 500;
    flex-shrink: 0;
}

/* Super Admin Tenant Switcher */
.tenant-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.tenant-switcher-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

#tenantSelect {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    min-width: 150px;
    cursor: pointer;
}

#tenantSelect:focus {
    outline: none;
    border-color: var(--primary);
}

.clear-tenant-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    font-size: 14px;
    line-height: 1;
    border-radius: 4px;
}

.clear-tenant-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text);
}

/* Viewing Tenant Banner */
.viewing-tenant-banner {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: #744210;
    padding: 8px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.viewing-tenant-banner::before {
    content: "👁️";
    margin-right: 8px;
}

#viewingTenantName {
    flex: 1;
}

.clear-view-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: #744210;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.clear-view-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Dark mode adjustments for tenant switcher */
body.dark-mode .viewing-tenant-banner {
    background: linear-gradient(135deg, #c05621 0%, #9c4221 100%);
    color: #feebc8;
}

body.dark-mode .clear-view-btn {
    color: #feebc8;
}

body.dark-mode .clear-tenant-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Super Admin Role Preview Switcher */
.role-preview-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.role-preview-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

#rolePreviewSelect {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    min-width: 130px;
    cursor: pointer;
}

#rolePreviewSelect:focus {
    outline: none;
    border-color: var(--primary);
}

/* Role Preview Banner */
.role-preview-banner {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    color: #322659;
    padding: 8px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.role-preview-banner::before {
    content: "🎭";
    margin-right: 8px;
}

#rolePreviewName {
    flex: 1;
}

/* Dark mode adjustments for role preview */
body.dark-mode .role-preview-banner {
    background: linear-gradient(135deg, #6b46c1 0%, #553c9a 100%);
    color: #e9d8fd;
}

body.dark-mode .role-preview-banner .clear-view-btn {
    color: #e9d8fd;
}

/* Global Logout Button (next to role switcher) */
.global-logout-btn {
    margin-left: auto;
    padding: 4px 10px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.global-logout-btn:hover {
    background: var(--info-bg);
    color: var(--text);
    border-color: var(--text-secondary);
}

.global-logout-btn:active {
    transform: scale(0.98);
}

/* User display field on forms (Submitting as) */
.submitting-as-display .user-display-field {
    background: var(--info-bg);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    border: 1px solid var(--border);
}

/* Job custom input (hidden by default, shown when Custom selected) */
.job-custom-input {
    display: none;
    margin-top: 8px;
}

.job-custom-input.visible {
    display: block;
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header.home-header {
    justify-content: flex-end;
}

.page-header#subPageHeader {
    display: none;
}

.nav-left {
    display: flex;
    gap: 10px;
}

.nav-tools {
    display: flex;
    gap: 10px;
}

.icon-btn,
.back-icon,
.menu-toggle {
    background: var(--surface);
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.icon-btn:hover,
.back-icon:hover,
.menu-toggle:hover {
    background: var(--primary);
    color: white;
}

.logout-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.logout-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.back-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ============================================================================
   LOGO & BRANDING
   ============================================================================ */
.page-logo-container {
    text-align: center;
    margin-bottom: 16px;
}

.page-logo-container img {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    object-fit: contain;
}

.page-logo-container h1 {
    color: var(--primary);
    margin: 0;
    font-size: 22px;
}

.page-logo {
    text-align: center;
    margin-bottom: 20px;
}

.page-logo img {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    object-fit: contain;
}

.page-logo h1 {
    font-size: 20px;
    color: var(--primary);
    margin: 0;
    padding-bottom: 10px;
}

/* ============================================================================
   BUTTONS - Action Button Styles (Opt-in via .menu-button class)
   ============================================================================
   NOTE: Generic <button> elements now have reset styles (see CSS RESET section).
   Use .menu-button class for the gradient action button appearance.
   ============================================================================ */
.menu-button {
    background: var(--bg-grad);
    color: white;
    border: 2px solid transparent;
    padding: 10px 16px;
    border-radius: 8px;
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    text-align: center;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
}

.menu-button:hover {
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.menu-button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    max-width: 900px;
    margin: 0 auto;
}

.menu-button-grid .menu-button {
    margin-bottom: 0;
}

/* Subpage button - extends menu-button styling with centered 50% width */
.subpage-button {
    background: var(--bg-grad);
    color: white;
    border: 2px solid transparent;
    padding: 10px 16px;
    border-radius: 8px;
    width: 50%;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    margin-left: auto;
    margin-right: auto;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    text-align: center;
    box-sizing: border-box;
}

.subpage-button:hover {
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

/* ============================================================================
   DROPDOWN MENU
   ============================================================================ */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 20px;
    top: 65px;
    background: var(--surface);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 1000;
    min-width: 220px;
    border: 1px solid var(--border);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}

.dropdown-item:hover {
    background: var(--info-bg);
    color: var(--primary);
}

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

.submenu {
    display: none;
    background: rgba(0, 0, 0, 0.03);
    border-top: 1px solid var(--border);
}

.submenu.show {
    display: block;
}

.submenu .dropdown-item {
    padding-left: 40px;
    font-size: 13px;
}

/* ============================================================================
   PAGES & VISIBILITY
   ============================================================================ */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ============================================================================
   FORMS
   ============================================================================ */
.info-box {
    background: var(--info-bg);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    margin-bottom: 20px;
    font-size: 13px;
}

/* ============================================================================
   FORM ELEMENTS - Styled Form Inputs (scoped to form containers)
   ============================================================================
   NOTE: Generic form elements have reset styles (see CSS RESET section).
   These styles apply to inputs within .form-group or form containers.
   ============================================================================ */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

/* Styled form inputs - scoped to form containers */
.form-group input,
.form-group textarea,
.form-group select,
form input,
form textarea,
form select,
.form-styled input,
.form-styled textarea,
.form-styled select {
    width: 100%;
    padding: 12px;
    margin: 5px 0 15px 0;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
form input:focus,
form textarea:focus,
form select:focus {
    outline: none;
    border-color: var(--primary);
}

.select-wrapper {
    position: relative;
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    width: 20px;
    height: 20px;
}

/* ============================================================================
   CHAT INTERFACE
   ============================================================================ */
.chat-container {
    height: 300px;
    background: var(--info-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    padding: 10px;
    border-radius: 8px;
    max-width: 85%;
    font-size: 13px;
}

.chat-msg.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
}

.chat-msg.assistant {
    background: var(--surface);
    align-self: flex-start;
    border: 1px solid var(--border);
}

.chat-msg.thinking {
    background: var(--surface);
    align-self: flex-start;
    border: 1px solid var(--border);
    font-style: italic;
    color: #888;
}

.chat-msg.thinking::after {
    content: '...';
    animation: thinking 1.5s infinite;
}

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

/* Admin Pearl Chat (Home Page) */
.admin-pearl-chat {
    display: none;
    max-width: 450px;
    margin: 30px auto 0;
    padding: 15px;
    background: var(--info-bg);
    border-radius: 8px;
    border: 2px solid var(--primary);
}

.admin-pearl-chat h3 {
    color: var(--primary);
    margin: 0 0 10px 0;
    font-size: 16px;
}

.admin-pearl-chat .chat-container {
    height: 150px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-pearl-chat textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
    font-size: 13px;
    margin-bottom: 8px;
    resize: vertical;
    min-height: 50px;
}

.admin-pearl-chat button {
    width: auto;
    padding: 10px 24px;
    margin: 0;
    font-size: 14px;
}

/* ============================================================================
   STATUS MESSAGES
   ============================================================================ */
.status {
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    display: none;
    font-size: 13px;
}

.status.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

/* ============================================================================
   PRICING RESULTS
   ============================================================================ */
.pricing-results {
    margin-top: 20px;
    padding: 15px;
    background: var(--info-bg);
    border-radius: 8px;
    display: none;
}

.pricing-results.show {
    display: block;
}

.pricing-item {
    padding: 12px;
    margin-bottom: 12px;
    background: var(--surface);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.pricing-item h4 {
    margin: 0 0 8px 0;
    color: var(--primary);
}

.pricing-item p {
    margin: 4px 0;
    font-size: 14px;
}

/* ============================================================================
   POLICY CONTENT
   ============================================================================ */
.policy-content {
    line-height: 1.8;
    font-size: 14px;
}

.policy-content h3 {
    color: var(--primary);
    margin-top: 25px;
    margin-bottom: 10px;
}

.policy-content ul {
    margin-left: 20px;
}

.policy-content p strong {
    color: var(--secondary);
}

.policy-content a {
    color: var(--primary);
    text-decoration: none;
}

.policy-content a:hover {
    text-decoration: underline;
}

/* ============================================================================
   FILE UPLOAD
   ============================================================================ */
#fileList {
    margin-top: -5px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
    padding-left: 5px;
}

#fileList ul {
    margin-top: 5px;
    padding-left: 20px;
}

#fileList li {
    margin-bottom: 4px;
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.footer {
    margin-top: auto;
    padding-top: 40px;
    text-align: center;
    font-size: 11px;
    border-top: 1px solid var(--border);
    padding-bottom: 20px;
    color: #888;
    flex-shrink: 0;
}

.footer img {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.footer-links {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    margin: 0 5px;
    cursor: pointer;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet & Desktop */
@media (min-width: 768px) {
    .menu-button-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small Tablet */
@media (max-width: 767px) and (min-width: 480px) {
    .menu-button-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 479px) {
    .menu-button-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    .subpage-button {
        width: 100%;
    }
}

/* Chrome Extension Sidebar - Compact Mode */
@media (max-width: 400px) {
    .page-logo-container img {
        width: 80px;
        height: 80px;
    }
    
    .page-logo-container h1 {
        font-size: 20px;
    }
    
    .icon-btn,
    .back-icon,
    .menu-toggle {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .menu-button {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .page-header,
    .nav-tools,
    .nav-left,
    .dropdown-menu,
    .footer,
    .menu-button,
    .no-print {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
    
    body {
        background: white;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

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

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

.text-error {
    color: #dc3545;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }

/* ============================================================================
   COMPACT MODE
   ============================================================================ */
body.compact-mode .page-logo-container img {
    width: 48px;
    height: 48px;
}

body.compact-mode .page-logo-container h1 {
    font-size: 18px;
}

body.compact-mode .page-logo-container {
    margin-bottom: 12px;
}

body.compact-mode .chat-container {
    height: 250px;
}

body.compact-mode .info-box {
    padding: 10px;
    margin-bottom: 15px;
}

body.compact-mode input,
body.compact-mode textarea,
body.compact-mode select {
    padding: 10px;
    margin: 4px 0 12px 0;
}

/* ============================================================================
   LABEL PREVIEW
   ============================================================================ */
.label-preview-container {
    background: var(--info-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.label-preview-container:empty {
    display: none;
}

#labelPreviewSection {
    display: none;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

#labelPreviewSection h3 {
    font-family: 'Sora', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 15px;
}

#printLabelsBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Compact mode adjustments for label preview */
body.compact-mode .label-preview-container {
    max-height: 350px;
    padding: 15px;
}

/* ============================================================================
   ADDITIONAL BUTTON STYLES
   ============================================================================ */

/* Add Context Button Styling */
.add-context-btn {
    background: var(--surface) !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
}

.add-context-btn:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* Secondary Button Styling */
.secondary-btn {
    background: var(--surface) !important;
    color: var(--text-secondary) !important;
    border: 2px solid var(--border) !important;
}

.secondary-btn:hover {
    background: var(--border) !important;
    color: var(--text-primary) !important;
}

/* File Upload Input Styling */
input[type="file"] {
    border: none !important;
    padding: 10px 0 !important;
}

/* ============================================================================
   LOADING STATES (Phase 4 - UX Alignment)
   ============================================================================ */

/* Update Available Banner (Phase 10) */
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary) 0%, #2c5282 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 10001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.update-banner span {
    font-weight: 500;
    font-size: 14px;
}

.update-banner button {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s, transform 0.1s;
}

.update-banner button:first-of-type {
    background: white;
    color: var(--primary);
}

.update-banner button:first-of-type:hover {
    background: #f0f0f0;
    transform: scale(1.02);
}

.update-banner button:last-of-type {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.update-banner button:last-of-type:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Page Loading Overlay */
.pl-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.pl-loading-content {
    background: var(--surface);
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pl-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: pl-spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

.pl-loading-message {
    color: var(--text);
    font-size: 14px;
    margin: 0;
}

/* Inline Spinner */
.pl-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: pl-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

.pl-spinner-small {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: pl-spin 0.7s linear infinite;
}

/* Button Loading State */
.pl-btn-loading {
    opacity: 0.8;
    cursor: wait !important;
    pointer-events: none;
}

.pl-btn-loading .pl-spinner {
    margin-right: 8px;
}

/* Field Loading Indicator */
.pl-field-loading {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    color: var(--primary);
    margin-left: 10px;
    margin-top: 5px;
}

/* Skeleton Loading */
.pl-skeleton-container {
    padding: 10px 0;
}

.pl-skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, var(--border) 25%, var(--info-bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: pl-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

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

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

/* ============================================================================
   TOAST NOTIFICATIONS (Phase 4 - UX Alignment)
   ============================================================================ */

/* Notification Container */
.pl-notification-container {
    position: fixed;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.pl-notification-top-right {
    top: 20px;
    right: 20px;
}

.pl-notification-top-left {
    top: 20px;
    left: 20px;
}

.pl-notification-bottom-right {
    bottom: 20px;
    right: 20px;
}

.pl-notification-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toast Base */
.pl-toast {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 100%;
}

.pl-toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.pl-toast-hiding {
    transform: translateX(120%);
    opacity: 0;
}

/* Toast Types */
.pl-toast-success {
    background: #10b981;
    color: white;
}

.pl-toast-error {
    background: #ef4444;
    color: white;
}

.pl-toast-warning {
    background: #f59e0b;
    color: white;
}

.pl-toast-info {
    background: var(--primary);
    color: white;
}

.pl-toast-loading {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Toast Elements */
.pl-toast-icon {
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.pl-toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.pl-toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin: -4px -4px -4px 12px;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: auto;
    line-height: 1;
}

.pl-toast-close:hover {
    opacity: 1;
    background: none;
    transform: none;
    box-shadow: none;
}

/* ============================================================================
   HEALTH INDICATOR (Phase 6 - Observability)
   ============================================================================ */

.pl-health-indicator {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    cursor: help;
}

.pl-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.pl-health-green {
    color: #10b981;
}

.pl-health-yellow {
    color: #f59e0b;
}

.pl-health-red {
    color: #ef4444;
}

.pl-health-gray {
    color: #9ca3af;
}

/* ============================================================================
   FOCUS INDICATORS (Phase 8 - Accessibility)
   ============================================================================ */

/* Visible focus ring for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Enhanced focus for buttons */
button:focus-visible,
.menu-button:focus-visible,
.icon-btn:focus-visible,
.back-icon:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

/* Enhanced focus for form elements */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Focus for links */
a:focus-visible,
.footer-links a:focus-visible,
.dropdown-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to main content link (for screen readers) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    z-index: 10002;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* ============================================================================
   PREFERENCES SECTION STYLES
   ============================================================================ */

.preferences-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.preferences-section:last-of-type {
    border-bottom: none;
}

.preferences-header {
    color: var(--primary);
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: 600;
}

.preferences-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.preferences-actions .subpage-button {
    flex: 1;
    min-width: 150px;
}

/* Form hint text */
.form-hint {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

body.dark-mode .form-hint {
    color: #999;
}

/* ============================================================================
   NETWORK STATUS INDICATOR (PWA/OFFLINE)
   ============================================================================ */
.pl-network-indicator {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pl-network-indicator.pl-online {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #28a745;
}

.pl-network-indicator.pl-offline {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

.pl-network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pl-pulse 2s ease-in-out infinite;
}

.pl-online .pl-network-dot {
    background: #28a745;
}

.pl-offline .pl-network-dot {
    background: #dc3545;
    animation: pl-blink 1s ease-in-out infinite;
}

.pl-offline-text {
    font-weight: 600;
}

.pl-queue-count {
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
}

@keyframes pl-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

@keyframes pl-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Dark mode adjustments */
body.dark-mode .pl-network-indicator.pl-online {
    background: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.4);
}

body.dark-mode .pl-network-indicator.pl-offline {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
}

/* Hide indicator when online (show only offline state) */
.pl-network-indicator.pl-online {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.pl-network-indicator.pl-offline {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* ============================================================================
   PHASE 6: MODAL STYLES
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--bg-primary, #ffffff);
    padding: 24px;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary, #333);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary, #333);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.modal-actions .menu-button {
    flex: 1;
    min-width: 120px;
}

.modal-actions .menu-button.secondary {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-primary, #333);
}

.modal-actions .menu-button.secondary:hover {
    background: var(--bg-hover, #e8e8e8);
}

/* Status Messages in Modals */
.status-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.status-message:empty {
    display: none;
}

.status-message.status-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.status-message.status-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.status-message.status-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Dark mode modal styles */
body.dark-mode .modal-content {
    background: var(--bg-primary);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.dark-mode .modal-header {
    border-bottom-color: var(--border-color);
}

body.dark-mode .status-message.status-info {
    background: rgba(33, 150, 243, 0.15);
    border-color: rgba(33, 150, 243, 0.3);
}

body.dark-mode .status-message.status-success {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

body.dark-mode .status-message.status-error {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.3);
}

/* ============================================================================
   PHASE 6: USER MANAGEMENT STYLES
   ============================================================================ */

.user-management,
.tenant-management {
    width: 100%;
}

.user-management-header,
.tenant-management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.user-management-header h3,
.tenant-management-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.user-list,
.tenant-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item,
.tenant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    flex-wrap: wrap;
    gap: 12px;
}

.user-item.inactive,
.tenant-item.inactive {
    opacity: 0.6;
    background: var(--bg-muted, #f0f0f0);
}

.user-info,
.tenant-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.user-info strong,
.tenant-info strong {
    font-size: 14px;
    color: var(--text-primary);
}

.user-email,
.tenant-domain {
    font-size: 12px;
    color: var(--text-secondary, #666);
    word-break: break-all;
}

.user-role {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.badge-super_admin {
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: white;
}

.badge-local_admin {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
}

.badge-user {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    color: white;
}

.tenant-status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.tenant-status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.user-actions,
.tenant-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: var(--bg-secondary, #e9ecef);
    color: var(--text-primary, #333);
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--bg-hover, #dee2e6);
}

.btn-small.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.btn-small.btn-danger:hover {
    background: #fecaca;
}

.btn-small.btn-success {
    background: #dcfce7;
    color: #166534;
}

.btn-small.btn-success:hover {
    background: #bbf7d0;
}

/* Admin sections visibility */
.admin-section,
.super-admin-section {
    display: none;
}

.admin-section.visible,
.super-admin-section.visible {
    display: block;
}

/* ============================================================================
   PHASE 6: SETUP WIZARD STYLES
   ============================================================================ */

.wizard-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px;
}

.wizard-logo {
    text-align: center;
    margin-bottom: 32px;
}

.wizard-logo-img {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}

.wizard-logo h1 {
    font-size: 24px;
    color: var(--primary, #1e3a5f);
    margin: 0;
}

.wizard-content {
    background: var(--bg-primary, #ffffff);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.wizard-step {
    margin-bottom: 24px;
}

.wizard-step h2 {
    font-size: 20px;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.wizard-step h3 {
    font-size: 16px;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.wizard-step p {
    color: var(--text-secondary, #666);
    margin: 0;
    line-height: 1.5;
}

.wizard-divider {
    height: 1px;
    background: var(--border-color, #e0e0e0);
    margin: 24px 0;
}

.wizard-section {
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 8px;
}

.wizard-section h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
}

.wizard-button {
    width: 100%;
    margin-top: 24px;
    padding: 14px 24px;
    font-size: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* Employee list in wizard */
.employee-list {
    margin: 12px 0;
}

.employee-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.employee-row .form-input {
    flex: 1;
    min-width: 0;
}

.employee-row .btn-small {
    flex-shrink: 0;
}

/* Settings preview in wizard */
.settings-preview {
    margin: 12px 0;
    padding-left: 20px;
}

.settings-preview li {
    margin: 6px 0;
    color: var(--text-secondary);
}

/* Instruction list */
.instruction-list {
    margin: 16px 0;
    padding-left: 24px;
}

.instruction-list li {
    margin: 10px 0;
    line-height: 1.6;
}

.instruction-list ul {
    margin: 8px 0;
    padding-left: 20px;
}

.instruction-list code {
    background: var(--bg-secondary, #f0f0f0);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

/* Info box variants */
.info-box.success {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.info-box.warning {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.info-box.error {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* Loading text */
.loading-text {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Dark mode wizard adjustments */
body.dark-mode .wizard-content {
    background: var(--bg-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .wizard-section {
    background: var(--bg-secondary);
}

body.dark-mode .instruction-list code {
    background: var(--bg-secondary);
}

body.dark-mode .info-box.success {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

body.dark-mode .info-box.warning {
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.3);
}

body.dark-mode .user-item,
body.dark-mode .tenant-item {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .btn-small {
    background: var(--bg-secondary);
}

body.dark-mode .btn-small:hover {
    background: var(--bg-hover);
}

body.dark-mode .btn-small.btn-danger {
    background: rgba(239, 68, 68, 0.2);
}

body.dark-mode .btn-small.btn-success {
    background: rgba(34, 197, 94, 0.2);
}

/* ============================================================================
   ESTIMATE WIZARD STYLES
   ============================================================================ */

/* Wizard Progress Bar */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    padding: 16px 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.progress-step .step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border-color, #e0e0e0);
    color: var(--text-secondary, #666);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
}

.progress-step.completed .step-number {
    background: var(--success, #4CAF50);
    color: white;
}

.progress-step.active .step-number {
    background: var(--primary, #1e3a5f);
    color: white;
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.2);
}

.progress-step .step-label {
    font-size: 12px;
    color: var(--text-secondary, #666);
    font-weight: 500;
}

.progress-step.active .step-label,
.progress-step.completed .step-label {
    color: var(--text-primary, #333);
}

.progress-connector {
    height: 3px;
    width: 50px;
    background: var(--border-color, #e0e0e0);
    margin: 0 8px 20px 8px;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.progress-connector.completed {
    background: var(--success, #4CAF50);
}

/* Wizard Step Content */
.wizard-step-content {
    padding: 0 8px;
}

.wizard-step-content h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.wizard-step-content .step-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.wizard-step-content h4 {
    margin: 16px 0 12px 0;
    color: var(--text-primary);
    font-size: 1rem;
}

/* Form row with columns */
.wizard-step-content .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.wizard-step-content .form-col {
    flex: 1;
}

.wizard-step-content .form-col-small {
    flex: 0 0 100px;
}

/* Form divider */
.form-divider {
    height: 1px;
    background: var(--border-color, #e0e0e0);
    margin: 20px 0;
}

/* Checkbox styling */
.checkbox-group {
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Address Verification */
.verify-address-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.verify-status {
    font-size: 0.9rem;
}

.verify-status.loading {
    color: var(--primary, #1e3a5f);
}

.verify-status.success {
    color: var(--success, #4CAF50);
}

.verify-status.warning {
    color: var(--warning, #f39c12);
}

.verify-status.error {
    color: var(--danger, #e74c3c);
}

/* Address Comparison Cards */
.address-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

.address-card {
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary, #fff);
}

.address-card:hover {
    border-color: var(--primary, #1e3a5f);
}

.address-card.selected {
    border-color: var(--primary, #1e3a5f);
    background: rgba(30, 58, 95, 0.05);
}

.address-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.address-card .card-header .label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.address-card .card-header input[type="radio"] {
    width: 18px;
    height: 18px;
}

.address-card .badge.verified {
    background: var(--success, #4CAF50);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.address-card .card-body {
    font-size: 0.9rem;
    line-height: 1.5;
}

.address-card .card-body p {
    margin: 0;
}

.address-card .corrections {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color, #e0e0e0);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Spec Builder Grid */
.spec-builder-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.spec-option-group {
    margin-bottom: 0;
}

.spec-option-group label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    font-size: 0.9rem;
}

.finishing-group {
    grid-column: 1 / -1;
    margin-top: 8px;
}

.finishing-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.finishing-checkboxes .checkbox-label {
    font-weight: normal;
    font-size: 0.9rem;
    padding: 6px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 4px;
    background: var(--bg-secondary, #f5f5f5);
    transition: all 0.2s ease;
}

.finishing-checkboxes .checkbox-label:hover {
    border-color: var(--primary, #1e3a5f);
}

.finishing-checkboxes .checkbox-label:has(input:checked) {
    background: rgba(30, 58, 95, 0.1);
    border-color: var(--primary, #1e3a5f);
}

/* Wizard Review Page */
.wizard-review .review-section {
    background: var(--bg-secondary, #f5f5f5);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.wizard-review .review-section h4 {
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wizard-review .review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wizard-review .review-details,
.wizard-review .review-specs {
    font-size: 0.9rem;
    line-height: 1.7;
}

.wizard-review .review-details div,
.wizard-review .review-specs div {
    margin-bottom: 4px;
}

/* Wizard Actions */
.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.wizard-actions .btn {
    min-width: 140px;
}

/* Dark mode adjustments for estimate wizard */
body.dark-mode .address-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .address-card.selected {
    background: rgba(30, 58, 95, 0.2);
}

body.dark-mode .wizard-review .review-section {
    background: var(--bg-secondary);
}

body.dark-mode .finishing-checkboxes .checkbox-label {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .finishing-checkboxes .checkbox-label:has(input:checked) {
    background: rgba(30, 58, 95, 0.3);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .wizard-progress {
        flex-wrap: wrap;
        gap: 8px;
    }

    .progress-connector {
        display: none;
    }

    .address-comparison {
        grid-template-columns: 1fr;
    }

    .spec-builder-grid {
        grid-template-columns: 1fr;
    }

    .wizard-review .review-grid {
        grid-template-columns: 1fr;
    }

    .wizard-actions {
        flex-direction: column;
    }

    .wizard-actions .btn {
        width: 100%;
    }
}

/* ============================================================================
   ANALYTICS DASHBOARD STYLES (Phase 7)
   ============================================================================ */

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary, #f5f5f5);
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color, #e0e0e0);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: bold;
    color: var(--primary, #1e3a5f);
    line-height: 1.2;
}

.stat-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Dashboard Sections */
.dashboard-section {
    margin-bottom: 2rem;
    background: var(--bg-primary, #ffffff);
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #f5f5f5);
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.data-table th {
    background: var(--bg-secondary, #f5f5f5);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

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

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

/* Details code in tables */
.details-code {
    font-size: 0.75rem;
    background: var(--bg-secondary, #f5f5f5);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

/* Activity Feed */
.activity-feed {
    padding: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

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

.activity-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.activity-text strong {
    color: var(--primary, #1e3a5f);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* No data message */
.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Error text */
.error-text {
    text-align: center;
    padding: 1rem;
    color: #dc2626;
    background: #fee2e2;
    border-radius: 6px;
    margin: 1rem;
}

/* Dashboard loading state */
.dashboard-section.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Audit Details Modal */
.detail-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.detail-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-row span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.details-json {
    background: var(--bg-secondary, #f5f5f5);
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 200px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
    margin: 0;
}

/* Release Notes Modal */
.release-notes-modal {
    max-width: 500px;
}

.release-notes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.release-notes-list li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.release-notes-list li:last-child {
    border-bottom: none;
}

.release-notes-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: bold;
}

.release-notes-list strong {
    color: var(--primary, #1e3a5f);
}

/* Dashboard Error */
.dashboard-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.dashboard-error p {
    color: #991b1b;
    margin: 0 0 0.75rem 0;
}

/* Dark Mode Dashboard Styles */
body.dark-mode .stat-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .stat-value {
    color: var(--primary);
}

body.dark-mode .section-header {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .data-table th {
    background: var(--bg-secondary);
}

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

body.dark-mode .details-code {
    background: var(--bg-secondary);
}

body.dark-mode .activity-item {
    border-color: var(--border-color);
}

body.dark-mode .details-json {
    background: var(--bg-secondary);
}

body.dark-mode .dashboard-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

body.dark-mode .dashboard-error p {
    color: #fca5a5;
}

body.dark-mode .error-text {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
}

/* Responsive Dashboard */
@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

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

    .stat-card h3 {
        font-size: 0.75rem;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    .section-header {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .activity-text {
        font-size: 0.85rem;
    }
}

/* ============================================================================
   ANALYTICS FILTER BAR (Phase 8)
   ============================================================================ */

.analytics-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.analytics-filter-bar label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.analytics-filter-bar select {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color, #e0e0e0);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    margin: 0;
    min-width: 140px;
}

/* Analytics Grid Layout */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.analytics-card {
    margin-bottom: 0;
}

/* ============================================================================
   FEATURE USAGE CHART STYLES (Phase 8)
   ============================================================================ */

.feature-usage-chart {
    padding: 1rem;
}

.usage-period {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.usage-label {
    min-width: 140px;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.usage-bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 24px;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.usage-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--primary, #667eea) 0%, var(--secondary, #764ba2) 100%);
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.3s ease;
}

.usage-count {
    position: absolute;
    right: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    z-index: 1;
}

/* Feature Usage Toggle in Section Header */
.feature-usage-toggle {
    display: flex;
    align-items: center;
}

.feature-usage-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.feature-usage-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

/* Dark mode feature usage styles */
body.dark-mode .usage-bar-container {
    background: var(--bg-secondary);
}

body.dark-mode .usage-count {
    color: var(--text-muted);
}

/* Responsive feature usage */
@media (max-width: 600px) {
    .usage-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .usage-label {
        min-width: auto;
        font-size: 0.8rem;
    }

    .usage-bar-container {
        height: 20px;
    }

    .feature-usage-toggle {
        margin-top: 0.5rem;
    }
}

/* ============================================================================
   USER ACTIVITY MATRIX STYLES (Phase 8)
   ============================================================================ */

.matrix-container {
    overflow-x: auto;
    padding: 1rem;
}

.matrix-table {
    font-size: 0.8rem;
}

.matrix-table th {
    font-size: 0.7rem;
    padding: 0.5rem;
    text-align: center;
    min-width: 60px;
    white-space: nowrap;
}

.matrix-user {
    font-weight: 500;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.matrix-cell {
    text-align: center;
    font-size: 0.75rem;
    padding: 0.4rem;
    transition: background 0.2s ease;
}

/* ============================================================================
   WEBHOOK ANALYTICS STYLES (Phase 8)
   ============================================================================ */

.webhook-analytics {
    padding: 1rem;
}

.webhook-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.webhook-summary-stat {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
}

.webhook-summary-stat .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.webhook-summary-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.webhook-breakdown h4 {
    font-size: 0.85rem;
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
}

.webhook-stat-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

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

.webhook-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.webhook-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 1rem;
    min-width: 30px;
    text-align: right;
}

.webhook-rate {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 45px;
    text-align: center;
}

.status-good {
    background: #dcfce7;
    color: #166534;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-bad {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================================================
   LABELS ANALYTICS STYLES (Phase 8)
   ============================================================================ */

.labels-analytics {
    padding: 1rem;
}

.labels-summary {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.label-stat {
    flex: 1;
    min-width: 70px;
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
}

.label-stat .stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.label-stat .stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.labels-details {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.labels-column {
    flex: 1;
    min-width: 120px;
}

.labels-column h4 {
    font-size: 0.85rem;
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
}

.label-user-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

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

.label-count {
    font-weight: 600;
    color: var(--primary);
}

/* Daily Chart */
.daily-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 80px;
    padding-top: 0.5rem;
}

.daily-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.daily-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.daily-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================================================
   DELIVERY ANALYTICS STYLES (Phase 8)
   ============================================================================ */

.delivery-analytics {
    padding: 1rem;
}

.delivery-analytics.placeholder {
    text-align: center;
    padding: 2rem 1rem;
}

.placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.delivery-analytics.placeholder p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.placeholder-hint {
    font-size: 0.8rem;
    font-style: italic;
}

.delivery-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.delivery-stat {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
}

.delivery-stat .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.delivery-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.delivery-breakdown h4 {
    font-size: 0.85rem;
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
}

.delivery-type-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

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

.delivery-count {
    font-weight: 600;
    color: var(--primary);
}

/* Dark mode for extended analytics */
body.dark-mode .webhook-summary-stat,
body.dark-mode .label-stat,
body.dark-mode .delivery-stat {
    background: var(--bg-secondary);
}

body.dark-mode .status-good {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

body.dark-mode .status-warning {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

body.dark-mode .status-bad {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .analytics-filter-bar {
    background: var(--bg-secondary);
}

/* Responsive analytics */
@media (max-width: 600px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .webhook-summary,
    .labels-summary,
    .delivery-summary {
        flex-direction: column;
    }

    .labels-details {
        flex-direction: column;
    }

    .daily-chart {
        height: 60px;
    }

    .matrix-table th,
    .matrix-table td {
        padding: 0.3rem;
        font-size: 0.7rem;
    }
}

/* ============================================================================
   KEYBOARD SHORTCUTS STYLES (Phase 9)
   ============================================================================ */

.keyboard-shortcuts-modal .modal-content {
    max-width: 500px;
}

.shortcuts-section {
    margin-bottom: 1.5rem;
}

.shortcuts-section h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #eee);
}

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

.shortcut-keys {
    display: flex;
    gap: 0.25rem;
}

.shortcut-keys kbd {
    background: var(--bg-secondary, #f0f0f0);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-family: monospace;
    font-size: 0.85rem;
    min-width: 1.5rem;
    text-align: center;
}

.shortcut-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.shortcuts-tip {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #eee);
}

/* ============================================================================
   OFFLINE QUEUE UI STYLES (Phase 9)
   ============================================================================ */

.offline-queue-indicator {
    position: fixed;
    top: 12px;
    right: 60px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--warning-bg, #fef3c7);
    color: var(--warning-text, #92400e);
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s ease;
}

.offline-queue-indicator:hover {
    transform: scale(1.05);
}

.offline-queue-indicator .queue-icon {
    font-size: 1rem;
}

.offline-queue-indicator .queue-count {
    font-weight: 600;
}

.offline-queue-modal .modal-content {
    max-width: 500px;
}

.queue-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.queue-summary {
    font-weight: 600;
    color: var(--text-primary);
}

.offline-badge {
    background: var(--error-bg, #fee2e2);
    color: var(--error-text, #991b1b);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.queue-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.queue-item {
    background: var(--bg-secondary, #f9f9f9);
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid var(--warning, #f59e0b);
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.queue-item-type {
    font-weight: 600;
    color: var(--text-primary);
}

.queue-item-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.queue-item-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.queue-item-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-queue-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.queue-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.offline-queue-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 9999;
    animation: slideUp 0.3s ease;
}

.offline-queue-toast.toast-success {
    background: #10b981;
    color: white;
}

.offline-queue-toast.toast-error {
    background: #ef4444;
    color: white;
}

.offline-queue-toast.toast-info {
    background: var(--primary);
    color: white;
}

.offline-queue-toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

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

@keyframes fadeOut {
    to { opacity: 0; }
}

/* ============================================================================
   SUBMISSIONS HISTORY STYLES (Phase 9)
   ============================================================================ */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    padding: 1rem;
    background: var(--bg-secondary, #f9f9f9);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg-card, white);
    color: var(--text-primary);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

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

.history-table th,
.history-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #eee);
}

.history-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.history-table tr.clickable-row {
    cursor: pointer;
    transition: background 0.2s ease;
}

.history-table tr.clickable-row:hover {
    background: var(--bg-secondary, #f9f9f9);
}

.date-cell {
    font-size: 0.85rem;
    white-space: nowrap;
}

.type-cell {
    font-weight: 500;
}

.details-cell {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-completed,
.status-badge.status-sent,
.status-badge.status-resolved {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-pending,
.status-badge.status-retrying {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.status-failed,
.status-badge.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.empty-history {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.history-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.load-more-container {
    text-align: center;
    padding: 1rem;
}

/* ============================================================================
   EMAIL PREVIEW STYLES (Phase 9)
   ============================================================================ */

.preview-email-btn {
    margin-right: 0.5rem;
}

.email-preview-modal .modal-content {
    max-width: 700px;
}

.email-preview-container {
    max-height: 60vh;
    overflow-y: auto;
}

.email-header-section {
    background: var(--bg-secondary, #f9f9f9);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.email-field {
    display: flex;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color, #eee);
}

.email-field:last-child {
    border-bottom: none;
}

.email-field label {
    font-weight: 600;
    width: 80px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.email-subject {
    font-weight: 600;
    color: var(--text-primary);
}

.email-body-section {
    margin-bottom: 1rem;
}

.email-body-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.email-body-preview {
    background: white;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.preview-attachments h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

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

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary, #f9f9f9);
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.attachment-icon {
    font-size: 1.1rem;
}

.attachment-name {
    flex: 1;
    font-weight: 500;
}

.attachment-size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.no-attachments {
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================================================
   SCHEDULED SUBMISSIONS STYLES (Phase 9)
   ============================================================================ */

.schedule-submission-section {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-secondary, #f9f9f9);
    border-radius: 8px;
}

.schedule-inputs {
    margin-top: 0.75rem;
    display: flex;
    gap: 1rem;
}

.schedule-inputs .form-group {
    flex: 1;
    margin-bottom: 0;
}

.scheduled-modal .modal-content {
    max-width: 500px;
}

.scheduled-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.scheduled-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary, #f9f9f9);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.scheduled-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.scheduled-type {
    font-weight: 600;
    color: var(--text-primary);
}

.scheduled-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.empty-scheduled {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.scheduled-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================================================
   WEBHOOK RETRY DASHBOARD STYLES (Phase 9)
   ============================================================================ */

.failures-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.failures-count {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

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

.failures-table th,
.failures-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #eee);
}

.failures-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.failure-row.status-retrying {
    background: var(--warning-bg, #fef3c7);
}

.webhook-cell {
    font-weight: 500;
}

.error-cell {
    color: var(--error, #dc2626);
    font-size: 0.85rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.retries-cell {
    text-align: center;
}

.actions-cell {
    white-space: nowrap;
}

.empty-failures {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.failures-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.failure-details-modal .modal-content {
    max-width: 600px;
}

.detail-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #eee);
}

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

.detail-row label {
    font-weight: 600;
    width: 120px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.error-message {
    color: var(--error, #dc2626);
}

.request-data {
    background: var(--bg-secondary, #f5f5f5);
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
    width: 100%;
}

.submission-id {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================================================
   BULK IMPORT STYLES (Phase 9)
   ============================================================================ */

.bulk-import-section {
    margin-top: 1.5rem;
}

.bulk-import-container {
    padding: 0;
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.bulk-preview {
    margin-top: 1rem;
}

.preview-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.preview-stat {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
}

.preview-stat.valid {
    background: #dcfce7;
    color: #166534;
}

.preview-stat.invalid {
    background: #fee2e2;
    color: #991b1b;
}

.validation-errors {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.validation-errors h4 {
    color: #991b1b;
    margin: 0 0 0.5rem 0;
}

.error-list {
    margin: 0;
    padding-left: 1.25rem;
}

.error-item {
    margin-bottom: 0.25rem;
    color: #991b1b;
}

.preview-table-container {
    margin-bottom: 1rem;
}

.preview-table-container h4 {
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.preview-table th,
.preview-table td {
    padding: 0.5rem;
    text-align: left;
    border: 1px solid var(--border-color, #ddd);
}

.preview-table th {
    background: var(--bg-secondary, #f5f5f5);
    font-weight: 600;
}

.preview-table .valid-row {
    background: #f0fdf4;
}

.preview-table .invalid-row {
    background: #fef2f2;
}

.status-ok {
    color: #166534;
    font-weight: 600;
}

.status-error {
    color: #991b1b;
    font-weight: 600;
}

.more-rows {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.5rem;
}

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

.import-report {
    background: var(--bg-secondary, #f9f9f9);
    padding: 1.5rem;
    border-radius: 8px;
}

.import-report h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.report-summary {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.report-stat {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.report-stat.success {
    background: #dcfce7;
    color: #166534;
}

.report-stat.skipped {
    background: #fef3c7;
    color: #92400e;
}

.report-stat.failed {
    background: #fee2e2;
    color: #991b1b;
}

.report-section {
    margin-bottom: 1rem;
}

.report-section h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.report-section ul {
    margin: 0;
    padding-left: 1.25rem;
}

.report-section.error-section {
    color: #991b1b;
}

/* ============================================================================
   BUTTON VARIANTS (Phase 9)
   ============================================================================ */

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--primary-dark, #2563eb);
}

.btn-secondary {
    background: var(--bg-secondary, #e5e5e5);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color, #d4d4d4);
}

.btn-link {
    background: none;
    color: var(--primary);
    padding: 0.25rem;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-link.btn-danger {
    color: var(--error, #dc2626);
}

/* ============================================================================
   DARK MODE FOR PHASE 9 COMPONENTS
   ============================================================================ */

body.dark-mode .keyboard-shortcuts-modal .shortcut-keys kbd {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.dark-mode .offline-queue-indicator {
    background: var(--warning-bg);
}

body.dark-mode .queue-item,
body.dark-mode .scheduled-item {
    background: var(--bg-card);
}

body.dark-mode .filter-bar {
    background: var(--bg-card);
}

body.dark-mode .email-body-preview {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .preview-table th {
    background: var(--bg-card);
}

body.dark-mode .import-report {
    background: var(--bg-card);
}

body.dark-mode .request-data {
    background: var(--bg-card);
}

/* ============================================================================
   RESPONSIVE STYLES FOR PHASE 9 COMPONENTS
   ============================================================================ */

@media (max-width: 600px) {
    .offline-queue-indicator {
        right: 50px;
        padding: 0.25rem 0.5rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-actions {
        margin-left: 0;
        justify-content: flex-end;
    }

    .history-table th:nth-child(3),
    .history-table td:nth-child(3) {
        display: none;
    }

    .failures-table th:nth-child(2),
    .failures-table td:nth-child(2),
    .failures-table th:nth-child(3),
    .failures-table td:nth-child(3) {
        display: none;
    }

    .schedule-inputs {
        flex-direction: column;
    }

    .email-preview-container {
        max-height: 50vh;
    }

    .preview-table {
        font-size: 0.75rem;
    }
}

/* ============================================================================
   DELIVERY MANAGER STYLES (v2.1.1)
   ============================================================================ */

.delivery-conditional-fields {
    animation: fadeIn 0.2s ease;
}

.delivery-conditional-fields.hidden {
    display: none;
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-col {
    flex: 1;
}

.form-col label {
    display: block;
    margin-bottom: 0.25rem;
}

/* Tracking Results */
.tracking-results {
    background: var(--info-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.tracking-results.hidden {
    display: none;
}

.tracking-info h4 {
    margin: 0 0 0.75rem 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.tracking-info p {
    margin: 0.5rem 0;
}

.tracking-info strong {
    color: var(--text-primary);
}

.tracking-events {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.tracking-events h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tracking-events ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tracking-events li {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
}

.tracking-events li:last-child {
    border-bottom: none;
}

.tracking-events .event-date {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Status info variant (for helpful messages) */
.status.info,
.status-message.status-info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

body.dark-mode .status.info,
body.dark-mode .status-message.status-info {
    background: #1e3a5f;
    color: #93c5fd;
}

body.dark-mode .tracking-results {
    background: var(--bg-card);
    border-color: var(--border);
}

body.dark-mode .tracking-events {
    border-top-color: var(--border);
}

body.dark-mode .tracking-events li {
    border-bottom-color: var(--border);
}

/* ============================================================================
   ACCESSIBILITY IMPROVEMENTS (v2.1.1)
   ============================================================================ */

/* Focus styles for all interactive elements */
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 9999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary: #0000ff;
        --border: #000000;
    }

    button, input, select, textarea {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Animation keyframe for fadeIn */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   RESPONSIVE STYLES FOR DELIVERY MANAGER
   ============================================================================ */

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-col {
        margin-bottom: 1rem;
    }

    .tracking-info h4 {
        font-size: 1rem;
    }

    .tracking-events li {
        font-size: 0.85rem;
    }
}

/* ============================================================================
   SIDEBAR NAVIGATION SYSTEM
   ============================================================================ */

/* Container with sidebars - maintains purple border all around */
.container.has-sidebars {
    margin-left: 15px;
    margin-right: 15px;
    max-width: none;
    width: auto;
    transition: margin 0.3s ease;
}

.container.sidebar-left-open {
    margin-left: calc(260px + 15px);
}

.container.sidebar-left-collapsed {
    margin-left: calc(60px + 15px);
}

.container.sidebar-right-open {
    margin-right: calc(280px + 15px);
}

/* Sidebar Base */
.sidebar {
    position: fixed;
    top: 0;
    height: 100vh;
    background: var(--surface);
    border: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Left Sidebar */
.sidebar-left {
    left: 0;
    width: 260px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-left.collapsed {
    width: 60px;
}

.sidebar-left.collapsed .nav-label,
.sidebar-left.collapsed .nav-arrow,
.sidebar-left.collapsed .pin-label,
.sidebar-left.collapsed .nav-category-items {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

/* Ensure icons remain visible and centered when collapsed */
.sidebar-left.collapsed .nav-icon {
    opacity: 1;
    visibility: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When collapsed: hide logo image, show text vertically */
.sidebar-left.collapsed .sidebar-logo-img {
    display: none;
}

.sidebar-left.collapsed .sidebar-brand {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 12px;
    opacity: 1;
    visibility: visible;
    width: auto;
}

.sidebar-left.collapsed .sidebar-header {
    justify-content: center;
    padding: 12px 8px;
    flex-direction: column;
}

.sidebar-left.collapsed .sidebar-logo {
    justify-content: center;
}

.sidebar-left.collapsed .nav-category-header {
    justify-content: center;
    padding: 12px;
}

.sidebar-left.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar-left.collapsed .sidebar-pin-btn {
    justify-content: center;
    padding: 12px;
}

/* Right Sidebar */
.sidebar-right {
    right: -280px;
    width: 280px;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-right.open {
    right: 0;
}

/* Right Sidebar Trigger - White background with purple gear icon */
.sidebar-trigger-right {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 80px;
    background: white;
    border: 2px solid white;
    border-right: none;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
}

.sidebar-trigger-right:hover {
    width: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary);
}

.sidebar-trigger-right .trigger-icon {
    color: var(--primary);
    font-size: 18px;
}

.sidebar-trigger-right.hidden {
    display: none;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
}

/* Sidebar Toggle Area (below header) */
.sidebar-toggle-area {
    padding: 8px 16px;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-toggle-area .sidebar-toggle-btn {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 8px 16px;
    border-radius: 6px;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar-toggle-area .sidebar-toggle-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--primary);
}

.sidebar-left.collapsed .sidebar-toggle-area {
    padding: 8px;
}

.sidebar-left.collapsed .sidebar-toggle-area .sidebar-toggle-btn {
    padding: 8px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.sidebar-logo img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    margin-right: 10px;
}

.sidebar-brand {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-toggle-btn,
.sidebar-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover,
.sidebar-close-btn:hover {
    background: var(--info-bg);
    color: var(--primary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Nav Item */
.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

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

.sidebar-nav .nav-item.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, transparent 100%);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.sidebar-nav .nav-item .nav-icon {
    width: 28px;
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-item .nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
}

.nav-home {
    margin-bottom: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* Nav Category */
.nav-category {
    margin-bottom: 4px;
}

.nav-category-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

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

.nav-category-header .nav-icon {
    width: 28px;
    font-size: 14px;
    text-align: center;
    flex-shrink: 0;
}

.nav-category-header .nav-label {
    flex: 1;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.nav-category-header .nav-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease, opacity 0.3s ease;
}

.nav-category-items {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
}

.nav-category.collapsed .nav-category-items {
    max-height: 0;
    opacity: 0;
}

.nav-category-items .nav-item {
    padding-left: 44px;
    font-size: 14px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-pin-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    padding: 10px 12px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.sidebar-pin-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.sidebar-pin-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.sidebar-pin-btn.active:hover {
    background: var(--secondary);
    border-color: var(--secondary);
}

.sidebar-pin-btn .pin-icon {
    font-size: 14px;
}

.sidebar-pin-btn .pin-label {
    transition: opacity 0.3s ease;
}

/* Right Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.right-sidebar-section {
    margin-bottom: 20px;
}

.right-sidebar-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

/* User Card */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--info-bg);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

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

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--info-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: var(--surface);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.quick-action-btn .action-icon {
    font-size: 20px;
}

.quick-action-btn .action-label {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Sync Status */
.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--info-bg);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.sync-status .sync-icon {
    color: #22c55e;
}

.sync-status .sync-icon.pending {
    color: #f59e0b;
}

/* Sidebar Settings */
.sidebar-settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.setting-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Logout Button */
.sidebar-logout-section {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.logout-btn-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: none;
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-btn-sidebar:hover {
    background: #ef4444;
    color: white;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Dark Mode for Sidebars */
body.dark-mode .sidebar {
    background: #1a1a1a;
    border-color: #333;
}

body.dark-mode .sidebar-trigger-right {
    background: #2a2a2a;
    border-color: #444;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .sidebar-trigger-right .trigger-icon {
    color: var(--primary);
}

body.dark-mode .sidebar-nav .nav-item:hover,
body.dark-mode .nav-category-header:hover {
    background: #2a2a2a;
}

body.dark-mode .sidebar-nav .nav-item.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.2) 0%, transparent 100%);
}

body.dark-mode .user-card,
body.dark-mode .quick-action-btn,
body.dark-mode .sync-status {
    background: #2a2a2a;
}

body.dark-mode .quick-action-btn:hover {
    background: #333;
}

/* Responsive Sidebars */
@media (max-width: 1024px) {
    .container.sidebar-left-open {
        margin-left: calc(60px + 15px);
    }

    .sidebar-left {
        width: 60px;
    }

    .sidebar-left.open {
        width: 260px;
    }

    .sidebar-left .nav-label,
    .sidebar-left .nav-arrow,
    .sidebar-left .pin-label,
    .sidebar-left .nav-category-items {
        opacity: 0;
        visibility: hidden;
    }

    .sidebar-left.open .nav-label,
    .sidebar-left.open .nav-arrow,
    .sidebar-left.open .pin-label,
    .sidebar-left.open .nav-category-items {
        opacity: 1;
        visibility: visible;
    }

    /* Show sidebar brand text when collapsed on tablet */
    .sidebar-left .sidebar-brand {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        transform: rotate(180deg);
        font-size: 12px;
    }

    .sidebar-left.open .sidebar-brand {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .container.has-sidebars,
    .container.sidebar-left-open,
    .container.sidebar-left-collapsed,
    .container.sidebar-right-open {
        margin-left: 10px;
        margin-right: 10px;
    }

    .sidebar-left {
        left: -260px;
        width: 260px;
    }

    .sidebar-left.open {
        left: 0;
    }

    .sidebar-right {
        right: -280px;
    }

    .sidebar-right.open {
        right: 0;
    }

    .sidebar-trigger-right {
        display: flex;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    /* Global logout button on mobile */
    .global-logout-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Hide role/tenant switchers on very small screens to save space */
    .global-user-display {
        flex-wrap: wrap;
    }
}

/* Adjust browser toolbar when sidebars are present */
body.has-sidebars .browser-toolbar {
    left: 260px;
    transition: left 0.3s ease;
}

body.has-sidebars.sidebar-collapsed .browser-toolbar {
    left: 60px;
}

@media (max-width: 768px) {
    body.has-sidebars .browser-toolbar {
        left: 0;
    }
}

/* ============================================================================
   DATABASE MIGRATIONS UI
   ============================================================================ */

/* Migrations Layout */
.migrations-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Migration Input Section */
.migrations-input-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.migrations-input-section h3 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.migrations-input-section .info-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.migrations-input-section .info-text a {
    color: var(--primary);
    text-decoration: underline;
}

/* Migration JSON Input */
.migration-json-input {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--info-bg);
    color: var(--text-primary);
    resize: vertical;
    box-sizing: border-box;
}

body.dark-mode .migration-json-input {
    background: #2a2a2a;
    border-color: #444;
}

/* Validation Messages */
.validation-errors,
.validation-success {
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
}

.validation-errors {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
}

body.dark-mode .validation-errors {
    background: #3a2020;
    border-color: #c53030;
    color: #feb2b2;
}

.validation-success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #276749;
}

body.dark-mode .validation-success {
    background: #203a20;
    border-color: #276749;
    color: #9ae6b4;
}

.validation-success .success-icon {
    margin-right: 8px;
    font-weight: bold;
}

.error-item {
    margin: 4px 0;
}

/* Migration Actions */
.migration-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.migration-actions .btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.migration-actions .btn-danger:hover {
    background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%);
}

/* Preview Section */
.migrations-preview-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.migrations-preview-section h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
}

.preview-card {
    background: var(--info-bg);
    border-radius: 8px;
    padding: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.preview-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.preview-field {
    margin-bottom: 16px;
}

.preview-field label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-field p {
    margin: 0;
    color: var(--text-primary);
}

.sql-preview {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.test-list {
    margin: 0;
    padding-left: 20px;
}

.test-list li {
    margin: 6px 0;
}

.test-list code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

body.dark-mode .test-list code {
    background: rgba(255,255,255,0.1);
}

.preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Risk Badges */
.risk-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.risk-badge.risk-low {
    background: #c6f6d5;
    color: #22543d;
}

.risk-badge.risk-medium {
    background: #fefcbf;
    color: #744210;
}

.risk-badge.risk-high {
    background: #fed7d7;
    color: #822727;
}

body.dark-mode .risk-badge.risk-low {
    background: #22543d;
    color: #c6f6d5;
}

body.dark-mode .risk-badge.risk-medium {
    background: #744210;
    color: #fefcbf;
}

body.dark-mode .risk-badge.risk-high {
    background: #822727;
    color: #fed7d7;
}

/* Result Section */
.migrations-result-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.migrations-result-section h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
}

.result-card {
    border-radius: 8px;
    padding: 16px;
}

.result-card.success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
}

.result-card.error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
}

body.dark-mode .result-card.success {
    background: #203a20;
    border-color: #276749;
}

body.dark-mode .result-card.error {
    background: #3a2020;
    border-color: #c53030;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.result-icon {
    font-size: 24px;
}

.result-card.success .result-icon {
    color: #22543d;
}

.result-card.error .result-icon {
    color: #c53030;
}

.result-header h4 {
    margin: 0;
}

.dry-run-badge {
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.result-message {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.result-stat {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.result-stat label {
    font-weight: 600;
    color: var(--text-secondary);
}

.result-error {
    margin-top: 12px;
}

.result-error label {
    display: block;
    font-weight: 600;
    color: #c53030;
    margin-bottom: 6px;
}

.result-error pre {
    background: #1e1e1e;
    color: #f87171;
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    overflow-x: auto;
}

.result-details {
    margin-top: 16px;
}

.result-details summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
}

.result-details pre {
    background: var(--info-bg);
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    overflow-x: auto;
    margin-top: 8px;
}

/* History Section */
.migrations-history-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.migrations-history-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.migrations-history-section h3 {
    margin: 0;
    color: var(--text-primary);
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.status-success {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.status-failed,
.status-badge.status-error {
    background: #fed7d7;
    color: #822727;
}

body.dark-mode .status-badge.status-success {
    background: #22543d;
    color: #c6f6d5;
}

body.dark-mode .status-badge.status-failed,
body.dark-mode .status-badge.status-error {
    background: #822727;
    color: #fed7d7;
}

/* Migration History Modal */
.migration-history-modal {
    max-width: 700px;
}

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

.history-detail {
    margin-bottom: 16px;
}

.history-detail.full-width {
    width: 100%;
}

.history-detail label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error-preview {
    background: #1e1e1e;
    color: #f87171;
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Migration Prompt Modal */
.migration-prompt-modal {
    max-width: 700px;
}

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

.prompt-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.prompt-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.prompt-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.prompt-section p {
    margin: 0 0 12px 0;
    color: var(--text-secondary);
}

.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Warning Info Box */
.info-box.warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

body.dark-mode .info-box.warning {
    background: #3a3520;
    border-color: #92400e;
    color: #fcd34d;
}

/* ============================================================================
   PRINTLOGIC PRODUCTION MODULES - PHASE 10
   ============================================================================ */

/* --------------------------------------------------------------------------
   FILE INTAKE & ROUTING STYLES
   -------------------------------------------------------------------------- */
.file-intake-container {
    padding: 20px;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--info-bg);
    margin-bottom: 20px;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.drop-zone.dragover {
    transform: scale(1.02);
}

.drop-zone-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.drop-zone-text {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drop-zone-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.intake-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.source-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.source-card.active {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.source-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.source-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.source-status {
    font-size: 12px;
    color: var(--text-muted);
}

.file-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.file-preview-icon {
    font-size: 24px;
}

.file-preview-info {
    flex: 1;
}

.file-preview-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-preview-size {
    font-size: 12px;
    color: var(--text-muted);
}

.file-preview-remove {
    color: #dc3545;
    cursor: pointer;
    padding: 4px 8px;
}

/* --------------------------------------------------------------------------
   PROOFING WORKFLOW STYLES
   -------------------------------------------------------------------------- */
.proofing-container {
    padding: 20px;
}

.proofs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.proof-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

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

.proof-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--info-bg);
}

.proof-details {
    padding: 16px;
}

.proof-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.proof-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.proof-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.proof-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.proof-status.approved {
    background: #d1fae5;
    color: #065f46;
}

.proof-status.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.proof-status.changes_requested {
    background: #e0e7ff;
    color: #3730a3;
}

.preflight-results {
    background: var(--info-bg);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.preflight-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.preflight-icon {
    font-size: 16px;
}

.preflight-icon.pass { color: #10b981; }
.preflight-icon.warning { color: #f59e0b; }
.preflight-icon.fail { color: #ef4444; }

.annotation-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.annotation-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

/* --------------------------------------------------------------------------
   AI SCHEDULING STYLES
   -------------------------------------------------------------------------- */
.scheduling-container {
    padding: 20px;
}

.schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.schedule-view-tabs {
    display: flex;
    gap: 8px;
}

.schedule-view-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
}

.schedule-view-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.schedule-day {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 150px;
    padding: 12px;
}

.schedule-day-header {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.schedule-day.today {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.schedule-entry {
    background: var(--bg-grad);
    color: white;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 6px;
    cursor: grab;
}

.schedule-entry:active {
    cursor: grabbing;
}

.schedule-entry.priority-rush {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.schedule-entry.priority-normal {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.schedule-entry.priority-low {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.schedule-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.timeline-time {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
}

.timeline-bar {
    flex: 1;
    height: 30px;
    background: var(--bg-grad);
    border-radius: 6px;
    position: relative;
}

.ai-optimization-panel {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

body.dark-mode .ai-optimization-panel {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-color: rgba(102, 126, 234, 0.4);
}

.ai-optimization-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-icon {
    font-size: 24px;
}

.optimization-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.optimization-metric {
    text-align: center;
    padding: 16px;
    background: var(--surface);
    border-radius: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   EQUIPMENT INTEGRATION STYLES
   -------------------------------------------------------------------------- */
.equipment-container {
    padding: 20px;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.equipment-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.equipment-card-header {
    padding: 16px;
    background: var(--info-bg);
    display: flex;
    align-items: center;
    gap: 12px;
}

.equipment-icon {
    font-size: 32px;
}

.equipment-info {
    flex: 1;
}

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

.equipment-type {
    font-size: 12px;
    color: var(--text-muted);
}

.equipment-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.equipment-status-indicator.online {
    background: #10b981;
}

.equipment-status-indicator.offline {
    background: #6b7280;
    animation: none;
}

.equipment-status-indicator.error {
    background: #ef4444;
}

.equipment-status-indicator.warning {
    background: #f59e0b;
}

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

.equipment-metrics {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.equipment-metric {
    text-align: center;
}

.equipment-metric-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.equipment-metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.equipment-actions {
    padding: 12px 16px;
    background: var(--info-bg);
    display: flex;
    gap: 8px;
}

.alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fef3c7;
    color: #92400e;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.alert-badge.critical {
    background: #fee2e2;
    color: #991b1b;
}

/* --------------------------------------------------------------------------
   ESTIMATING & INVOICING STYLES
   -------------------------------------------------------------------------- */
.estimating-container {
    padding: 20px;
}

.estimate-form {
    max-width: 800px;
    margin: 0 auto;
}

.line-items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.line-items-table th,
.line-items-table td {
    padding: 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.line-items-table th {
    background: var(--info-bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.line-items-table input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-primary);
}

.line-items-table .amount-cell {
    text-align: right;
    font-weight: 600;
}

.estimate-totals {
    background: var(--info-bg);
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}

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

.total-row:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

.ai-estimate-panel {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

body.dark-mode .ai-estimate-panel {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: rgba(16, 185, 129, 0.4);
}

.quickbooks-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--info-bg);
    border-radius: 8px;
    font-size: 14px;
}

.quickbooks-status.connected {
    background: #d1fae5;
    color: #065f46;
}

.quickbooks-status.disconnected {
    background: #fee2e2;
    color: #991b1b;
}

/* --------------------------------------------------------------------------
   INVENTORY & PURCHASING STYLES
   -------------------------------------------------------------------------- */
.inventory-container {
    padding: 20px;
}

.inventory-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.inventory-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.inventory-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.inventory-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

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

.inventory-table th,
.inventory-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.inventory-table th {
    background: var(--info-bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.inventory-table tr:hover {
    background: var(--info-bg);
}

.stock-level {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.stock-level.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.stock-level.low-stock {
    background: #fef3c7;
    color: #92400e;
}

.stock-level.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

.po-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.po-status.draft { background: #e5e7eb; color: #374151; }
.po-status.sent { background: #dbeafe; color: #1e40af; }
.po-status.confirmed { background: #d1fae5; color: #065f46; }
.po-status.received { background: #f3e8ff; color: #7c3aed; }

/* --------------------------------------------------------------------------
   CLIENT PORTAL STYLES
   -------------------------------------------------------------------------- */
.client-portal-container {
    padding: 20px;
}

.portal-access-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.portal-access-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
}

.portal-customer-info {
    flex: 1;
}

.portal-customer-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.portal-customer-email {
    font-size: 12px;
    color: var(--text-muted);
}

.portal-access-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.portal-access-status.active {
    background: #d1fae5;
    color: #065f46;
}

.portal-access-status.expired {
    background: #fee2e2;
    color: #991b1b;
}

.magic-link-box {
    background: var(--info-bg);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.magic-link-url {
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
    background: var(--surface);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   MAIL PROCESSING STYLES
   -------------------------------------------------------------------------- */
.mail-processing-container {
    padding: 20px;
}

.mail-jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.mail-job-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.mail-job-header {
    padding: 16px;
    background: var(--info-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mail-job-title {
    font-weight: 600;
    color: var(--text-primary);
}

.mail-job-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.mail-job-body {
    padding: 16px;
}

.mail-stats-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.cass-ncoa-status {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.cass-badge,
.ncoa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.cass-badge.complete { background: #d1fae5; color: #065f46; }
.cass-badge.pending { background: #fef3c7; color: #92400e; }
.ncoa-badge.complete { background: #dbeafe; color: #1e40af; }
.ncoa-badge.pending { background: #e5e7eb; color: #374151; }

/* --------------------------------------------------------------------------
   IMPOSITION & GANG RUN OPTIMIZER STYLES
   -------------------------------------------------------------------------- */
.imposition-container {
    padding: 20px;
}

.gang-run-batches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.gang-batch-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.gang-batch-header {
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.gang-batch-title {
    font-weight: 600;
    font-size: 16px;
}

.gang-batch-meta {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

.gang-batch-jobs {
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.gang-job-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--info-bg);
    border-radius: 6px;
    margin-bottom: 8px;
}

.gang-job-color {
    width: 8px;
    height: 40px;
    border-radius: 4px;
}

.gang-job-info {
    flex: 1;
}

.gang-job-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

.gang-job-specs {
    font-size: 11px;
    color: var(--text-muted);
}

.imposition-preview {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imposition-sheet {
    background: white;
    border: 2px solid #333;
    padding: 10px;
    display: grid;
    gap: 4px;
}

.imposition-cell {
    background: var(--info-bg);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    min-width: 40px;
    min-height: 30px;
}

.optimization-savings {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 24px;
}

.savings-value {
    font-size: 36px;
    font-weight: 700;
}

.savings-label {
    font-size: 14px;
    opacity: 0.9;
}

/* --------------------------------------------------------------------------
   CRM INTEGRATION STYLES
   -------------------------------------------------------------------------- */
.crm-container {
    padding: 20px;
}

.connections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.crm-connection-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

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

.crm-connection-card.syncing {
    border-color: var(--primary);
}

.connection-header {
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.connection-icon {
    flex-shrink: 0;
}

.connection-info {
    flex: 1;
}

.connection-info h3 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 16px;
}

.provider-badge {
    display: inline-block;
    background: var(--info-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-right: 8px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.connected { background: #d1fae5; color: #065f46; }
.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.error { background: #fee2e2; color: #991b1b; }
.status-badge.disconnected { background: #e5e7eb; color: #374151; }
.status-badge.success { background: #d1fae5; color: #065f46; }

.connection-details {
    padding: 0 16px 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.detail-item label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.detail-item span {
    font-size: 13px;
    color: var(--text-primary);
}

.connection-footer {
    padding: 12px 16px;
    background: var(--info-bg);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.connection-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.crm-overview {
    margin-bottom: 24px;
}

.overview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

.mappings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.mapping-group {
    margin-bottom: 24px;
}

.mapping-group h3 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 14px;
    text-transform: uppercase;
}

.sync-direction {
    font-size: 16px;
    color: var(--primary);
    text-align: center;
}

.auth-options {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-oauth {
    background: var(--bg-grad);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-oauth:hover {
    opacity: 0.9;
}

.or-divider {
    color: var(--text-muted);
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   SHARED MODULE STYLES
   -------------------------------------------------------------------------- */
.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.module-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.module-actions {
    display: flex;
    gap: 12px;
}

.tab-navigation {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.tab-button {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.tab-button.active {
    color: var(--primary);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 20px;
}

.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

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

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

/* Modal Sizes */
.modal-lg {
    max-width: 700px;
}

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

/* Button Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* ============================================================================
   PRODUCTION OPERATIONS DASHBOARD STYLES (Phase 11)
   ============================================================================ */

/* Dashboard Layout */
.production-dashboard,
.csr-accountability-dashboard,
.analytics-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Dashboard Headers */
.dashboard-header,
.csr-header,
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-header h2,
.csr-header h2,
.analytics-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--text-primary);
}

.dashboard-subtitle,
.csr-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.dashboard-controls,
.csr-controls,
.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Summary Cards Grid */
.summary-cards,
.csr-summary-cards,
.kpi-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card,
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.summary-card:hover,
.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.summary-card.warning,
.kpi-card.warning {
    border-left: 4px solid #f59e0b;
}

.summary-card.good,
.summary-card.success,
.kpi-card.success {
    border-left: 4px solid #10b981;
}

.summary-card.danger,
.kpi-card.danger {
    border-left: 4px solid #ef4444;
}

.card-icon,
.kpi-icon {
    font-size: 32px;
    opacity: 0.8;
}

.card-content,
.kpi-content {
    flex: 1;
}

.card-value,
.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.card-label,
.kpi-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.kpi-target {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Trend Indicators */
.trend {
    font-size: 14px;
    margin-left: 8px;
}

.trend.up,
.trend-up {
    color: #10b981;
}

.trend.down,
.trend-down {
    color: #ef4444;
}

.trend.stable,
.trend-stable {
    color: var(--text-muted);
}

/* Filter Bar */
.dashboard-filters,
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--info-bg);
    border-radius: 8px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Job Cards Grid */
.job-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.job-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.job-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.job-card.P1 {
    border-left: 4px solid #ef4444;
}

.job-card.P2 {
    border-left: 4px solid #f59e0b;
}

.job-card.P3 {
    border-left: 4px solid #6366f1;
}

.job-card.P4 {
    border-left: 4px solid #9ca3af;
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.job-invoice {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.priority-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-badge.P1 {
    background: #fef2f2;
    color: #dc2626;
}

.priority-badge.P2 {
    background: #fffbeb;
    color: #d97706;
}

.priority-badge.P3 {
    background: #eef2ff;
    color: #4f46e5;
}

.priority-badge.P4 {
    background: #f3f4f6;
    color: #6b7280;
}

.job-card-body {
    margin-bottom: 16px;
}

.job-card-body p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.job-card-body strong {
    color: var(--text-primary);
}

.stall-reason {
    background: var(--info-bg);
    padding: 10px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 13px;
}

.job-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Job Table Styles */
.job-table,
.csr-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.job-table th,
.job-table td,
.csr-table th,
.csr-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.job-table th,
.csr-table th {
    background: var(--info-bg);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.job-table th.sortable,
.csr-table th.sortable {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.job-table th.sortable:hover,
.csr-table th.sortable:hover {
    background: rgba(102, 126, 234, 0.1);
}

.job-table tbody tr:hover,
.csr-table tbody tr:hover {
    background: var(--info-bg);
}

.job-table tbody tr.row-critical,
.csr-table tbody tr.row-critical {
    background: #fef2f2;
}

.job-table tbody tr.row-warning,
.csr-table tbody tr.row-warning {
    background: #fffbeb;
}

/* Score Styling */
.score-cell {
    font-weight: 600;
}

.score-cell.excellent,
.excellent {
    color: #10b981;
}

.score-cell.good,
.good {
    color: #3b82f6;
}

.score-cell.needs-improvement,
.needs-improvement {
    color: #f59e0b;
}

.score-cell.critical,
.critical {
    color: #ef4444;
}

/* Status Dots */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.dot-excellent {
    background: #10b981;
}

.dot-good {
    background: #3b82f6;
}

.dot-warning {
    background: #f59e0b;
}

.dot-critical {
    background: #ef4444;
}

/* CSR Leaderboard */
.csr-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .csr-sections {
        grid-template-columns: 1fr;
    }
}

.csr-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.csr-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--info-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.rank-1 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.rank-2 {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: white;
}

.rank-3 {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: white;
}

.rank-4,
.rank-5 {
    background: var(--border);
    color: var(--text-secondary);
}

.csr-info {
    flex: 1;
}

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

.csr-stats {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.csr-score {
    font-size: 18px;
    font-weight: 700;
}

/* Attention List */
.attention-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.attention-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #fef2f2;
    border-radius: 8px;
    border-left: 3px solid #ef4444;
}

.csr-issue {
    font-size: 12px;
    color: #dc2626;
    margin-top: 2px;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
}

.no-data.all-good {
    color: #10b981;
    font-style: normal;
}

/* Simple Chart Styles */
.simple-chart,
.simple-trend-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 150px;
    padding: 20px 0;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.chart-label {
    width: 60px;
    font-size: 12px;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.chart-bar-container {
    flex: 1;
    height: 24px;
    background: var(--info-bg);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    min-width: 40px;
    transition: width 0.3s ease;
}

.chart-bar.excellent {
    background: linear-gradient(90deg, #10b981, #059669);
}

.chart-bar.good {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.chart-bar.needs-improvement {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.chart-bar.critical {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.legend-item {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.legend-item.excellent {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.legend-item.good {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.legend-item.needs-improvement {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.legend-item.critical {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Trend Bar Chart */
.trend-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.trend-bar {
    width: 100%;
    max-width: 40px;
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4px;
    min-height: 20px;
    transition: height 0.3s ease;
}

.trend-value {
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.trend-label {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Financial Section */
.financial-section {
    margin-bottom: 24px;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.financial-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.financial-card h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.financial-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.financial-sublabel {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.financial-card.warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.financial-card.alert {
    border-color: #ef4444;
    background: #fef2f2;
}

.financial-alert {
    font-size: 12px;
    color: #dc2626;
    margin-top: 8px;
    font-weight: 500;
}

/* Priority Breakdown */
.priority-breakdown {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.priority-breakdown h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.priority-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.priority-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.priority-label {
    width: 30px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.priority-bar-container {
    flex: 1;
    height: 20px;
    background: var(--info-bg);
    border-radius: 4px;
    overflow: hidden;
}

.priority-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.priority-value {
    width: 80px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Donut Chart */
.priority-donut {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    justify-content: center;
}

.donut-chart {
    width: 180px;
    height: 180px;
}

.donut-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-hole {
    width: 100px;
    height: 100px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-total {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 8px;
}

.legend-label {
    font-size: 13px;
    color: var(--text-primary);
    margin-right: 12px;
}

.legend-value {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Bottleneck Analysis */
.bottleneck-section,
.reasons-section,
.comparison-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.bottleneck-section h3,
.reasons-section h3,
.comparison-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.bottleneck-table {
    overflow-x: auto;
}

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

.bottleneck-table th,
.bottleneck-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.bottleneck-table th {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bottleneck-critical {
    background: #fef2f2;
}

.bottleneck-warning {
    background: #fffbeb;
}

.score-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-fill {
    height: 8px;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.score-fill.critical {
    background: #ef4444;
}

.score-fill.warning {
    background: #f59e0b;
}

.score-fill.normal {
    background: #10b981;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.critical {
    background: #fef2f2;
    color: #dc2626;
}

.status-badge.warning {
    background: #fffbeb;
    color: #d97706;
}

.status-badge.normal {
    background: #ecfdf5;
    color: #059669;
}

/* Stall Reasons Chart */
.reasons-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reason-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reason-label {
    width: 150px;
    font-size: 13px;
    color: var(--text-primary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.reason-bar-container {
    flex: 1;
    height: 24px;
    background: var(--info-bg);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.reason-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.reason-count {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Period Comparison */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.comparison-card {
    background: var(--info-bg);
    border-radius: 8px;
    padding: 16px;
}

.comparison-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.comparison-values {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.current-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.change {
    font-size: 14px;
    font-weight: 600;
}

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

.change.negative {
    color: #ef4444;
}

.comparison-previous {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Action Tracking Styles */
.action-tracking-panel {
    padding: 16px;
}

.action-tracking-panel.compact {
    padding: 12px;
}

.quick-actions {
    margin-bottom: 20px;
}

.quick-actions h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: var(--info-bg);
    border-color: var(--primary);
}

.btn-action .icon {
    font-size: 16px;
}

/* Action Timeline */
.action-timeline h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

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

.timeline-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.timeline-marker.call-out,
.timeline-marker.call-in {
    background: #dbeafe;
    color: #2563eb;
}

.timeline-marker.call-missed {
    background: #fef2f2;
    color: #dc2626;
}

.timeline-marker.email-out,
.timeline-marker.email-in {
    background: #fef3c7;
    color: #d97706;
}

.timeline-marker.note {
    background: #f3f4f6;
    color: #6b7280;
}

.timeline-marker.status {
    background: #ecfdf5;
    color: #059669;
}

.timeline-marker.escalation {
    background: #fef2f2;
    color: #dc2626;
}

.timeline-content {
    flex: 1;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.action-type {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.action-time {
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-body .contact {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.timeline-body .notes {
    font-size: 13px;
    color: var(--text-primary);
    margin: 4px 0;
    line-height: 1.5;
}

.timeline-body .duration {
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.follow-up-badge {
    font-size: 10px;
    padding: 2px 8px;
    background: #fef3c7;
    color: #d97706;
    border-radius: 4px;
    font-weight: 500;
}

/* Add Note Section */
.add-note-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.add-note-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.add-note-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
}

.note-options {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.note-options label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Action Modal Styles */
.action-modal {
    max-width: 500px;
}

.action-modal .form-group {
    margin-bottom: 16px;
}

.action-modal label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.action-modal input,
.action-modal select,
.action-modal textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.action-modal input:focus,
.action-modal select:focus,
.action-modal textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Action Badge */
.action-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.action-badge.call_outbound,
.action-badge.call_inbound {
    background: #dbeafe;
    color: #1e40af;
}

.action-badge.call_missed {
    background: #fef2f2;
    color: #dc2626;
}

.action-badge.email_sent,
.action-badge.email_received {
    background: #fef3c7;
    color: #92400e;
}

.action-badge.note_added {
    background: #f3f4f6;
    color: #374151;
}

.action-badge.status_change {
    background: #ecfdf5;
    color: #065f46;
}

.action-badge.escalation {
    background: #fef2f2;
    color: #dc2626;
}

/* History Table */
.action-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.action-history-table th,
.action-history-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.action-history-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}

.action-history-table .notes-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.more-records {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* History Chart */
.history-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100px;
    padding: 10px 0;
}

.history-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.history-bar {
    width: 100%;
    max-width: 30px;
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

.history-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* Detail Grid */
.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.detail-item {
    background: var(--info-bg);
    padding: 16px;
    border-radius: 8px;
}

.detail-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* CSR Detail Modal */
.csr-detail-modal {
    max-width: 700px;
}

/* Charts Section */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.chart-container h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    padding: 0 8px;
}

/* Trends Section */
.csr-trends-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.csr-trends-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

/* Full CSR Table Container */
.csr-full-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.table-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.table-filters {
    display: flex;
    gap: 12px;
}

.csr-name-cell {
    display: flex;
    align-items: center;
}

.warning {
    color: #d97706;
}

/* Last Refresh */
.last-refresh {
    font-size: 12px;
    color: var(--text-muted);
}

/* Refresh Icon Animation */
.refresh-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

#refreshCSRBtn:hover .refresh-icon,
#refreshAnalyticsBtn:hover .refresh-icon,
#refreshDashboardBtn:hover .refresh-icon {
    transform: rotate(180deg);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .dashboard-header,
    .csr-header,
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-controls,
    .csr-controls,
    .header-controls {
        width: 100%;
        justify-content: flex-start;
    }

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

    .job-cards-grid {
        grid-template-columns: 1fr;
    }

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

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

    .priority-donut {
        flex-direction: column;
    }

    .leaderboard-item {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .summary-cards,
    .csr-summary-cards,
    .kpi-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   SVG ICON SYSTEM
   ============================================================================ */

/* Base icon styling */
.icon,
svg.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Icon inside buttons and nav items */
button .icon,
.nav-icon .icon,
.action-icon .icon,
.btn .icon {
    margin-right: 4px;
}

/* Nav icon containers */
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
}

/* Sidebar specific icon styling */
.sidebar .nav-icon .icon {
    width: 18px;
    height: 18px;
}

.sidebar .nav-category-header .nav-icon .icon {
    width: 20px;
    height: 20px;
}

/* Arrow icons in nav */
.nav-arrow {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
}

.nav-arrow .icon {
    width: 14px;
    height: 14px;
}

/* Toggle icons */
.toggle-icon,
.pin-icon,
.trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Quick action buttons */
.quick-action-btn .action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Icon fallback for missing icons */
.icon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 16px;
    color: var(--primary);
}

/* Icon colors in dark mode */
body.dark-mode .icon {
    opacity: 0.9;
}

/* Ensure icons don't break layout */
.icon svg {
    display: block;
}

/* Icon button specific styles */
.toolbar-icon-btn .icon {
    width: 18px;
    height: 18px;
}

/* Logout button icon alignment */
.global-logout-btn .icon {
    margin-right: 6px;
}

/* Settings toggle icons */
.setting-toggle .icon {
    margin-right: 4px;
    vertical-align: text-bottom;
}

/* ============================================================================
   DELIVERY MANAGEMENT MODULE STYLES
   ============================================================================ */

/* Delivery Filter Tabs */
.delivery-filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    background: var(--info-bg);
    border-radius: 8px;
    overflow-x: auto;
}

.delivery-filter-tab {
    flex: 1;
    min-width: 70px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.delivery-filter-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.delivery-filter-tab.active {
    background: var(--primary);
    color: #ffffff;
}

/* Delivery Search Bar */
.delivery-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    position: relative;
}

.delivery-search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
}

.delivery-search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.delivery-sync-badge {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #F59E0B;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Delivery List Container */
.delivery-list-container {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-bottom: 80px;
}

.delivery-list-container.pulling::before {
    content: "Release to refresh...";
    display: block;
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Delivery Cards */
.delivery-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.delivery-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.delivery-card:active {
    transform: scale(0.98);
}

.delivery-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.delivery-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.delivery-order-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

.delivery-card-body {
    margin-bottom: 8px;
}

.delivery-customer {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.delivery-address {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.delivery-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.delivery-validated-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #10B981;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Delivery Empty State */
.delivery-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.delivery-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.delivery-empty-state p {
    margin-bottom: 16px;
}

/* Floating Action Button */
.delivery-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    border: none;
    background: var(--bg-grad);
    color: white;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 100;
}

.delivery-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px var(--shadow);
}

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

/* Delivery Detail View */
.delivery-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
}

.delivery-detail-section {
    margin-bottom: 20px;
}

.delivery-detail-section h3 {
    font-size: 18px;
    margin: 0 0 8px 0;
    color: var(--text);
}

.delivery-detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
}

.delivery-detail-address {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    background: var(--info-bg);
    border-radius: 6px;
    margin-bottom: 8px;
}

.delivery-detail-address:hover {
    background: rgba(102, 126, 234, 0.15);
}

.verified-badge {
    display: inline-block;
    background: #10B981;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.delivery-detail-phone,
.delivery-detail-email {
    font-size: 14px;
    color: var(--primary);
    cursor: pointer;
    padding: 4px 0;
}

.delivery-instructions {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: 6px;
    padding: 12px;
}

.delivery-instructions h4 {
    color: #92400E;
}

.delivery-instructions p {
    color: #78350F;
    margin: 0;
}

body.dark-mode .delivery-instructions {
    background: #422006;
    border-color: #B45309;
}

body.dark-mode .delivery-instructions h4,
body.dark-mode .delivery-instructions p {
    color: #FDE68A;
}

/* Package List */
.package-count-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 24px;
    font-weight: 700;
}

.package-count-display .scanned-count {
    color: #10B981;
}

.package-count-display .count-divider {
    color: var(--text-muted);
}

.package-count-display .total-count {
    color: var(--text-secondary);
}

.package-count-display .count-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 8px;
}

.package-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--info-bg);
    border-radius: 6px;
    margin-bottom: 6px;
}

.package-item.scanned {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10B981;
}

.package-barcode {
    font-family: monospace;
    font-size: 13px;
}

.package-status {
    font-size: 16px;
}

/* Delivery Action Buttons */
.delivery-action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

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

.btn-verify {
    border-color: #10B981;
    color: #10B981;
}

.btn-verify:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* Complete/Fail Buttons */
.delivery-complete-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.btn-complete {
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delivered {
    background: #10B981;
    color: white;
}

.btn-delivered:hover {
    background: #059669;
}

.btn-failed {
    background: #EF4444;
    color: white;
}

.btn-failed:hover {
    background: #DC2626;
}

/* Event History */
.delivery-history {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

.event-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.event-type {
    color: var(--text);
    font-weight: 500;
}

.event-time {
    color: var(--text-muted);
}

.no-history {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 16px;
}

/* Delivery Dialogs */
.delivery-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delivery-dialog.hidden {
    display: none;
}

.dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.dialog-content {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.dialog-content h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.dialog-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 16px;
    box-sizing: border-box;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: #5567d9;
}

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

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

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

/* Failure Reasons */
.failure-reasons {
    margin-bottom: 16px;
}

.failure-reason-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.failure-reason-option:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.failure-reason-option input[type="radio"] {
    width: 18px;
    height: 18px;
}

/* ============================================================================
   CARRIER RATE SELECTION
   ============================================================================ */

.carrier-rate-dialog {
    max-width: 500px;
}

.carrier-rate-options {
    margin-bottom: 16px;
    max-height: 350px;
    overflow-y: auto;
}

.carrier-rate-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
}

.carrier-rate-option:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.carrier-rate-option.recommended {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.08);
}

.carrier-rate-option input[type="radio"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.carrier-rate-content {
    flex: 1;
    position: relative;
}

.rate-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

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

.carrier-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.service-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.delivery-estimate {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.rate-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

/* Arbitrage Info */
.arbitrage-info {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

.arbitrage-savings {
    display: flex;
    align-items: center;
    gap: 8px;
}

.arbitrage-savings::before {
    content: "";
    font-size: 16px;
}

/* Selected Rate Display */
.selected-rate-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 10px;
}

.selected-rate-display .no-rate {
    color: var(--text-muted);
    font-style: italic;
}

.selected-rate-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.selected-rate-info .carrier {
    font-weight: 600;
    color: var(--text-primary);
}

.selected-rate-info .service {
    color: var(--text-secondary);
    font-size: 13px;
}

.selected-rate-info .price {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
}

.selected-rate-info .arbitrage-badge {
    background: #10B981;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* ============================================================
   SHIPPING RATES PAGE
   ============================================================ */

/* Tab Navigation */
.shipping-tabs {
    display: flex;
    gap: 0;
    margin: 20px 0;
    border-bottom: 2px solid var(--border);
}

.shipping-tabs .tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.shipping-tabs .tab-btn:hover {
    color: var(--text-primary);
}

.shipping-tabs .tab-btn.active {
    color: var(--primary);
}

.shipping-tabs .tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Recommendation Cards */
.rate-recommendations {
    margin: 20px 0;
}

.recommendation-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.recommendation-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.recommendation-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.recommendation-card.cheapest {
    border-color: #10B981;
}

.recommendation-card.fastest {
    border-color: #3B82F6;
}

.rec-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.recommendation-card.cheapest .rec-badge {
    background: #10B981;
    color: white;
}

.recommendation-card.fastest .rec-badge {
    background: #3B82F6;
    color: white;
}

.rec-carrier {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.rec-service {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0;
}

.rec-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0;
}

.rec-transit {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Tier Summary */
.tier-summary {
    margin: 24px 0;
}

.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.tier-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

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

.tier-count {
    font-size: 11px;
    color: var(--text-muted);
}

.tier-best {
    margin-bottom: 12px;
}

.tier-carrier {
    font-weight: 500;
    font-size: 13px;
}

.tier-service {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 2px 0;
}

.tier-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 8px 0;
}

.tier-transit {
    font-size: 11px;
    color: var(--text-muted);
}

/* Carrier Summary */
.carrier-summary {
    margin: 24px 0;
}

.carrier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.carrier-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.carrier-logo {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 6px;
}

.carrier-logo.carrier-fedex {
    color: #4D148C;
    background: rgba(77, 20, 140, 0.1);
}

.carrier-logo.carrier-ups {
    color: #351C15;
    background: rgba(255, 182, 18, 0.2);
}

.carrier-logo.carrier-usps {
    color: #004B87;
    background: rgba(0, 75, 135, 0.1);
}

.carrier-best {
    margin-bottom: 12px;
}

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

.carrier-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin: 8px 0;
}

.carrier-transit {
    font-size: 11px;
    color: var(--text-muted);
}

/* Rate Filters */
.rate-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 20px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.tier-filter-btn,
.carrier-filter-btn {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tier-filter-btn:hover,
.carrier-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tier-filter-btn.active,
.carrier-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Rates Table */
.all-rates-table {
    margin: 20px 0;
}

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

.rates-table th,
.rates-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.rates-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
}

.rates-table tr:hover {
    background: var(--bg-secondary);
}

.carrier-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.carrier-badge.carrier-fedex {
    background: rgba(77, 20, 140, 0.1);
    color: #4D148C;
}

.carrier-badge.carrier-ups {
    background: rgba(255, 182, 18, 0.2);
    color: #351C15;
}

.carrier-badge.carrier-usps {
    background: rgba(0, 75, 135, 0.1);
    color: #004B87;
}

.service-name {
    font-weight: 500;
}

.service-tier {
    font-size: 11px;
    color: var(--text-muted);
}

.rate-price {
    font-weight: 600;
    color: var(--primary);
}

.arbitrage-hint {
    font-size: 10px;
    color: #10B981;
}

.rate-row.arbitrage-available {
    background: rgba(16, 185, 129, 0.05);
}

/* No Rates */
.no-rates {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Label Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary, #ffffff);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border, #e0e0e0);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.label-summary {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.label-rate-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.label-carrier {
    font-weight: 600;
}

.label-service {
    color: var(--text-secondary);
}

.label-price {
    font-weight: 700;
    color: var(--primary);
}

.label-transit {
    font-size: 12px;
    color: var(--text-muted);
}

/* Label Result */
.label-result-card {
    background: var(--bg-secondary);
    border: 2px solid #10B981;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.label-success-icon {
    width: 60px;
    height: 60px;
    background: #10B981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 16px;
}

.label-tracking {
    margin: 16px 0;
}

.tracking-number {
    font-family: monospace;
    font-size: 18px;
    font-weight: 600;
    background: var(--bg-primary);
    padding: 8px 16px;
    border-radius: 4px;
    margin: 0 8px;
}

.label-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Tracking Result */
.tracking-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tracking-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tracking-status.status-delivered {
    background: #10B981;
    color: white;
}

.tracking-status.status-in-transit {
    background: #3B82F6;
    color: white;
}

.tracking-status.status-pending {
    background: #F59E0B;
    color: white;
}

.tracking-carrier {
    font-weight: 600;
}

.tracking-eta {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.tracking-events {
    margin-top: 16px;
}

.tracking-events h4 {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.tracking-event {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.tracking-event:last-child {
    border-bottom: none;
}

.event-date {
    font-size: 12px;
    color: var(--text-muted);
}

.event-status {
    font-weight: 500;
}

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

.tracking-link {
    margin-top: 16px;
    text-align: center;
}

.tracking-error {
    text-align: center;
    padding: 20px;
}

.tracking-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

/* Form Section inside modals */
.form-section {
    margin-bottom: 24px;
}

.form-section h4 {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .recommendation-cards {
        grid-template-columns: 1fr;
    }

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

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

    .rates-table {
        font-size: 13px;
    }

    .rates-table th,
    .rates-table td {
        padding: 8px;
    }

    .tracking-event {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* Form Section Divider */
.form-section-divider {
    display: flex;
    align-items: center;
    margin: 20px 0 16px 0;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-section-divider::before,
.form-section-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.form-section-divider span {
    padding: 0 12px;
}

/* Small button variant */
.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Scanner Container */
.scanner-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.scanner-header h3 {
    margin: 0;
    font-size: 18px;
}

.scanner-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
}

.scanner-viewfinder {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.scanner-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-viewfinder canvas {
    display: none;
}

.scan-region-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-region {
    width: 70%;
    max-width: 300px;
    aspect-ratio: 4/3;
    border: 3px solid rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    background: transparent;
    transition: border-color 0.3s ease;
}

.scan-region.success {
    border-color: #10B981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* html5-qrcode scan success flash */
.scanner-viewfinder.scan-success {
    animation: scanSuccessFlash 0.5s ease;
}

@keyframes scanSuccessFlash {
    0% { box-shadow: inset 0 0 0 3px #10B981; }
    50% { box-shadow: inset 0 0 30px 5px rgba(16, 185, 129, 0.3); }
    100% { box-shadow: none; }
}

.scan-line {
    position: absolute;
    left: 15%;
    right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { top: 30%; }
    50% { top: 70%; }
}

.scanner-controls {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    background: rgba(0, 0, 0, 0.8);
}

.scanner-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scanner-btn:hover,
.scanner-btn.active {
    background: rgba(255, 255, 255, 0.2);
}

.scanner-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
}

.scanner-history {
    padding: 16px;
    background: rgba(0, 0, 0, 0.9);
    max-height: 150px;
    overflow-y: auto;
}

.scanner-history h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
}

#scanHistoryList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-bottom: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.history-format {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.history-time {
    color: rgba(255, 255, 255, 0.5);
}

.no-history {
    color: rgba(255, 255, 255, 0.4);
}

.scanner-manual-entry {
    padding: 16px;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    gap: 8px;
}

.scanner-manual-entry input {
    flex: 1;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
}

/* Signature Capture */
.signature-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-modal {
    background: var(--surface);
    border-radius: 12px;
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

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

.signature-header h3 {
    margin: 0;
}

.signature-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.signature-canvas-wrapper {
    position: relative;
    background: white;
    touch-action: none;
}

#signatureCanvas {
    width: 100%;
    height: 200px;
    display: block;
    cursor: crosshair;
}

.signature-guide-text {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: #999;
    font-size: 12px;
    pointer-events: none;
}

.signature-name-input {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.signature-name-input label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.signature-name-input input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
}

.signature-controls {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.signature-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.signature-btn:hover {
    background: var(--info-bg);
}

.signature-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.signature-btn.primary:hover {
    background: #5567d9;
}

/* Photo Capture */
.photo-capture-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 2000;
}

.photo-capture-modal {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.photo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.photo-header h3 {
    margin: 0;
}

.photo-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
}

.photo-viewfinder {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.photo-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-overlay-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
}

.overlay-timestamp {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.overlay-address {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    max-width: 200px;
}

.photo-guide-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    max-width: 400px;
    aspect-ratio: 4/3;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    pointer-events: none;
}

.photo-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.photo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.photo-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
}

.photo-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.photo-btn:hover,
.photo-btn.active {
    background: rgba(255, 255, 255, 0.2);
}

.photo-btn.capture {
    width: 70px;
    height: 70px;
    border-radius: 35px;
    font-size: 28px;
    background: white;
    color: #333;
    border: 4px solid var(--primary);
}

.photo-btn.capture:hover {
    background: #f0f0f0;
}

.photo-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
}

.photo-settings {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.9);
}

.photo-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

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

/* Address Validation Indicators */
.address-valid {
    border-color: #10B981 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310B981' stroke-width='2'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

.address-invalid {
    border-color: #EF4444 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23EF4444' stroke-width='2'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

.address-checking {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23F59E0B' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

/* Address Suggestions Dropdown */
.address-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-header {
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.suggestion-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}

.suggestion-item:hover {
    background: var(--info-bg);
}

/* Delivery Loading State */
.delivery-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* ============================================================================
   GPS DRIVER TRACKING DASHBOARD
   ============================================================================ */

.gps-dashboard {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 500px;
}

.gps-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.gps-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.gps-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gps-stat .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.gps-stat .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.gps-actions {
    display: flex;
    gap: 8px;
}

.gps-main-content {
    display: flex;
    flex: 1;
    gap: 16px;
    min-height: 0;
}

/* Driver List Sidebar */
.gps-driver-list {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

.driver-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.driver-list-header h4 {
    margin: 0;
    font-size: 15px;
}

.driver-list-header select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
}

.driver-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.driver-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: var(--bg-primary);
    border: 2px solid transparent;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.driver-card.selected {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.08);
}

.driver-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.driver-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.driver-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.driver-card-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Map Container */
.gps-map-container {
    flex: 1;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    min-width: 0;
}

.gps-map {
    width: 100%;
    height: 100%;
    background: #e0e0e0;
}

.map-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.map-placeholder p {
    margin: 8px 0;
}

.map-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 20px 30px;
    border-radius: 8px;
    text-align: center;
}

/* Driver Markers */
.driver-marker {
    background: transparent;
}

.driver-marker-inner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.driver-arrow {
    color: white;
    font-size: 14px;
    margin-top: -2px;
}

/* Driver Detail Panel */
.driver-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100vh;
    background: var(--surface);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.driver-detail-panel.hidden {
    transform: translateX(100%);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-header h4 {
    margin: 0;
    flex: 1;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h5 {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

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

.detail-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.detail-value.status-active { color: #10B981; }
.detail-value.status-idle { color: #F59E0B; }
.detail-value.status-stale { color: #9CA3AF; }
.detail-value.status-offline { color: #EF4444; }

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Delivery Mini Cards */
.delivery-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid var(--border);
}

.delivery-mini-card.status-pending { border-left-color: #9CA3AF; }
.delivery-mini-card.status-in_transit { border-left-color: #3B82F6; }
.delivery-mini-card.status-out_for_delivery { border-left-color: #F59E0B; }
.delivery-mini-card.status-delivered { border-left-color: #10B981; }
.delivery-mini-card.status-failed { border-left-color: #EF4444; }

.delivery-seq {
    width: 24px;
    height: 24px;
    background: var(--info-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

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

.delivery-customer {
    display: block;
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delivery-address {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delivery-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.delivery-status-badge.pending { background: #E5E7EB; color: #374151; }
.delivery-status-badge.in_transit { background: #DBEAFE; color: #1D4ED8; }
.delivery-status-badge.out_for_delivery { background: #FEF3C7; color: #B45309; }
.delivery-status-badge.delivered { background: #D1FAE5; color: #047857; }
.delivery-status-badge.failed { background: #FEE2E2; color: #B91C1C; }

/* Empty State */
.gps-driver-list .empty-state {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state p {
    margin: 4px 0;
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .gps-main-content {
        flex-direction: column;
    }

    .gps-driver-list {
        width: 100%;
        max-height: 200px;
    }

    .driver-detail-panel {
        width: 100%;
    }

    .gps-stats {
        gap: 16px;
    }

    .gps-stat .stat-value {
        font-size: 20px;
    }
}

/* Dark Mode Adjustments */
body.dark-mode .delivery-card {
    background: #1f1f1f;
}

body.dark-mode .scanner-container,
body.dark-mode .photo-capture-container {
    background: #000;
}

body.dark-mode .signature-modal {
    background: #1a1a1a;
}

body.dark-mode .signature-canvas-wrapper {
    background: #2a2a2a;
}

body.dark-mode #signatureCanvas {
    background: #2a2a2a;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .delivery-filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .delivery-filter-tab {
        min-width: 60px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .delivery-fab {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .delivery-action-buttons {
        grid-template-columns: 1fr;
    }

    .delivery-complete-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .scanner-controls {
        padding: 12px;
    }

    .scanner-btn {
        padding: 10px 12px;
        font-size: 12px;
    }

    .photo-btn.capture {
        width: 60px;
        height: 60px;
    }
}

/* ============================================================================
   ERROR DASHBOARD
   ============================================================================ */

.error-dashboard {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Stats Row */
.error-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.error-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.error-stat-card .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.error-stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.error-stat-open .stat-number { color: #e74c3c; }
.error-stat-investigating .stat-number { color: #f39c12; }
.error-stat-resolved .stat-number { color: #27ae60; }
.error-stat-high .stat-number { color: #9b59b6; }

/* Controls */
.error-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.error-filter-group,
.error-sort-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-filter-group label,
.error-sort-group label {
    font-size: 13px;
    color: var(--text-secondary);
}

.error-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
}

/* Error List */
.error-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.error-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* Error Card */
.error-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid var(--border);
}

.error-card.error-status-open { border-left-color: #e74c3c; }
.error-card.error-status-investigating { border-left-color: #f39c12; }
.error-card.error-status-resolved { border-left-color: #27ae60; }
.error-card.error-status-ignored { border-left-color: #95a5a6; }

.error-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.error-priority-badge,
.error-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.error-priority-badge.error-priority-high { background: #fdf2f8; color: #be185d; }
.error-priority-badge.error-priority-medium { background: #fef3c7; color: #b45309; }
.error-priority-badge.error-priority-low { background: #dbeafe; color: #1e40af; }

.error-status-badge.error-status-open { background: #fee2e2; color: #dc2626; }
.error-status-badge.error-status-investigating { background: #fef3c7; color: #d97706; }
.error-status-badge.error-status-resolved { background: #d1fae5; color: #059669; }
.error-status-badge.error-status-ignored { background: #f3f4f6; color: #6b7280; }

.error-time {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

.error-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.error-card-location {
    margin-bottom: 8px;
}

.error-card-location code {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--info-bg);
    padding: 2px 6px;
    border-radius: 4px;
}

.error-card-env {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.error-env-badge,
.error-notified-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--info-bg);
    color: var(--text-secondary);
}

.error-notified-badge {
    background: #dbeafe;
    color: #1e40af;
}

.error-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.error-card-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* Error Modal */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-modal.hidden {
    display: none;
}

.error-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.error-modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.error-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.error-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

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

/* Error Detail */
.error-detail {
    padding: 24px;
}

.error-detail-section {
    margin-bottom: 24px;
}

.error-detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.error-detail-item label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.error-detail-item div {
    font-size: 14px;
    color: var(--text-primary);
}

.error-stack-trace,
.error-fix-code {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 8px;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-analysis {
    background: var(--info-bg);
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
}

.error-analysis code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

.error-status-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.error-resolution-notes label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.error-resolution-notes textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    background: var(--surface);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .error-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .error-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .error-card-actions {
        flex-direction: column;
    }

    .error-card-actions .btn {
        width: 100%;
    }

    .error-modal-content {
        width: 95%;
        max-height: 95vh;
    }
}

/* ============================================================================
   STATUS INDICATOR - Known Issues Banner
   ============================================================================ */

.status-indicator {
    background: linear-gradient(135deg, #fef3cd 0%, #fff3cd 100%);
    border-bottom: 2px solid #ffc107;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 100;
}

.status-indicator.hidden {
    display: none;
}

.status-indicator-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
}

.status-indicator-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.status-indicator-message {
    font-size: 14px;
    color: #856404;
    font-weight: 500;
}

.status-indicator-link {
    font-size: 13px;
    color: #0056b3;
    text-decoration: underline;
    white-space: nowrap;
}

.status-indicator-link:hover {
    color: #003d80;
}

/* Status Modal */
.status-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.status-modal {
    background: var(--surface);
    border-radius: 12px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.25s ease-out;
}

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

.status-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.status-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

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

.status-modal-body {
    padding: 24px 20px;
    text-align: center;
}

.status-modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.status-modal-body p {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
}

.status-modal-body p:last-of-type {
    margin-bottom: 0;
}

.status-modal-secondary {
    color: var(--text-secondary) !important;
    font-size: 14px !important;
}

.status-modal-timestamp {
    color: var(--text-muted) !important;
    font-size: 12px !important;
    margin-top: 16px !important;
}

.status-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

/* Dark mode support */
body.dark-mode .status-indicator {
    background: linear-gradient(135deg, #3d3a20 0%, #4a4520 100%);
    border-bottom-color: #a89120;
}

body.dark-mode .status-indicator-message {
    color: #ffc107;
}

body.dark-mode .status-indicator-link {
    color: #6ea8fe;
}

body.dark-mode .status-indicator-link:hover {
    color: #9ec5fe;
}

/* Responsive */
@media (max-width: 600px) {
    .status-indicator {
        padding: 8px 16px;
    }

    .status-indicator-content {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        gap: 8px;
    }

    .status-indicator-message {
        font-size: 13px;
    }
}

/* ============================================================================
   END OF STYLES
   ============================================================================ */