/* Prevent flash of blue links - must be first */
.sidebar a,
.nav-item,
.sidebar a:link,
.sidebar a:visited,
.sidebar a:hover,
.sidebar a:active,
.sidebar a:focus,
.nav-item:link,
.nav-item:visited,
.nav-item:hover,
.nav-item:active,
.nav-item:focus {
    color: inherit !important;
    text-decoration: none !important;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.1);
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #059669;
    --warning-color: #ea580c;
    --danger-color: #dc2626;
    /* Mobile variables */
    --sidebar-width: 250px;
    --secondary-sidebar-width: 240px;
    --mobile-menu-size: 48px;
    --touch-target-min: 44px;
}
[data-theme="dark"] {
    --background: #0f172a;
    --card-background: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --primary-light: rgba(37, 99, 235, 0.2);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { touch-action: manipulation; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--background); color: var(--text-primary); font-size: clamp(0.875rem, 1.5vw, 1rem); }
body.theme-transitions-enabled { transition: background 0.3s ease, color 0.3s ease; }

.topbar { height: 60px; background: var(--card-background); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; padding: 0 2rem; position: fixed; top: 0; left: 0; right: 0; z-index: 1000; }
.company-name { font-size: 1.25rem; font-weight: 700; color: var(--primary-color); cursor: pointer; }
.version { font-size: 0.75rem; color: var(--text-secondary); margin-left: 0.5rem; cursor: pointer; }
.version:hover { color: var(--primary-color); }
.location-selector { margin-left: 2rem; margin-right: 2rem; }
.location-dropdown { background: var(--primary-color); color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; font-weight: 600; }
.location-dropdown:hover { background: var(--primary-hover); }
.search-container { flex: 1; max-width: 400px; position: relative; }
.topbar .search-container { position: absolute; left: 250px; top: 50%; transform: translateY(-50%); flex: none; max-width: 350px; width: 350px; }
.search-input { width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--background); color: var(--text-primary); }
.topbar .search-input { padding-left: calc(2.5rem + 25px); }
.search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.topbar-actions { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.theme-toggle, .notification-icon { width: 40px; height: 40px; background: var(--background); border: 1px solid var(--border-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
button.theme-toggle { -webkit-appearance: none; -moz-appearance: none; appearance: none; outline: none; padding: 0; font: inherit; }
.notification-badge { position: absolute; top: -5px; right: -5px; background: var(--danger-color); color: white; border-radius: 50%; width: 20px; height: 20px; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; }
.user-info { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; padding: 0.5rem; border-radius: 8px; transition: background 0.2s; position: relative; }
.user-info:hover { background: var(--primary-light); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-color); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.user-dropdown { position: absolute; top: 100%; right: 0; min-width: 200px; background: var(--card-background); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); display: none; z-index: 1001; margin-top: 0.5rem; }
.user-dropdown.show { display: block; }
.user-dropdown-header { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.user-dropdown-name { font-weight: 600; color: var(--text-primary); }
.user-dropdown-email { font-size: 0.875rem; color: var(--text-secondary); }
.user-dropdown-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: var(--text-primary); text-decoration: none; transition: background 0.2s; cursor: pointer; }
.user-dropdown-item:hover { background: var(--primary-light); }
.user-dropdown-item.danger { color: var(--danger-color); }
.user-dropdown-item.danger:hover { background: rgba(220, 38, 38, 0.1); }
.user-dropdown-divider { height: 1px; background: var(--border-color); margin: 0.25rem 0; }

.sidebar { width: 250px; height: 100vh; background: var(--card-background); border-right: 1px solid var(--border-color); position: fixed; top: 60px; left: 0; overflow-y: auto; display: flex; flex-direction: column; z-index: 500; }
.nav-section { padding: 1rem 0; }
.nav-title { padding: 0 1rem; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.nav-item { display: flex; align-items: center; padding: 0.75rem 1rem; cursor: pointer; transition: all 0.2s ease; text-decoration: none; color: var(--text-primary); }
.nav-item:hover { background: var(--primary-light); }
.nav-item.active { background: var(--primary-color); color: white; }
.nav-icon { margin-right: 0.75rem; }

.main-content { margin-left: 250px; margin-top: 60px; padding: 2rem; width: calc(100% - 250px); box-sizing: border-box; }
.main-content > * { max-width: 1400px; margin-left: auto; margin-right: auto; }
.page { display: block; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.page-title { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; }
.page-actions { display: flex; gap: 1rem; }

.card { background: var(--card-background); border-radius: 12px; padding: 1.5rem; border: 1px solid var(--border-color); margin-bottom: 2rem; }
.placeholder-content { text-align: center; padding: 2rem; color: var(--text-secondary); }
.placeholder-icon { font-size: 3rem; margin-bottom: 1rem; }

.btn { background: var(--primary-color); color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s ease; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--primary-hover); }
.btn.btn-success { background: var(--success-color); }
.btn.btn-outline { background: transparent; color: var(--text-secondary); border: 2px solid var(--border-color); }

.section-title { font-size: clamp(1rem, 2.5vw, 1.125rem); font-weight: 600; margin-bottom: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group.full-width { grid-column: 1 / -1; }
.phone-group { display: flex; gap: 0.5rem; }
.phone-type { flex: 0 0 120px; }
.phone-number { flex: 1; }
.phone-ext { flex: 0 0 80px; }
.referral-group { grid-column: 1 / -1; }
.referral-input-container { display: flex; gap: 1rem; align-items: flex-start; }
.referral-input-container select { flex: 0 0 300px; }
.referral-search-container { flex: 1; position: relative; margin-top: 0; }
.referral-results { max-height: 200px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 6px; background: var(--card-background); margin-top: 0.5rem; display: none; position: absolute; width: 100%; z-index: 100; }
.referral-result-item { padding: 0.75rem 1rem; cursor: pointer; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.referral-result-item:last-child { border-bottom: none; }
.referral-result-item:hover { background: var(--primary-light); }
.referral-result-name { font-weight: 600; }
.referral-result-details { color: var(--text-secondary); font-size: 0.875rem; }
.selected-referral { background: var(--success-color); color: white; padding: 0.5rem 1rem; border-radius: 6px; margin-top: 0.5rem; display: flex; justify-content: space-between; align-items: center; }
.remove-referral { background: none; border: none; color: white; cursor: pointer; font-weight: bold; }
.quick-add-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; }
.left-actions { display: flex; }
.right-actions { display: flex; gap: 1rem; }
.admin-section { margin-bottom: 2rem; }
.admin-section h4 { margin-bottom: 1rem; }
input, select, textarea { width: 100%; padding: 0.875rem; border: 2px solid var(--border-color); border-radius: 8px; background: var(--card-background); color: var(--text-primary); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
label { display: block; margin-bottom: 0.5rem; font-weight: 600; }
.required::after { content: " *"; color: var(--danger-color); }

.color-picker-container { display: flex; align-items: center; }
.color-presets { display: flex; gap: 0.5rem; }
.color-preset { width: 32px; height: 32px; border-radius: 8px; cursor: pointer; border: 2px solid var(--border-color); transition: all 0.2s ease; }
.color-preset:hover { border-color: var(--primary-color); transform: scale(1.1); }
input[type="color"] { width: 60px; height: 40px; border: 2px solid var(--border-color); border-radius: 8px; padding: 0; cursor: pointer; }
input[type="range"] { accent-color: var(--primary-color); }
input[type="checkbox"] { width: auto; margin-right: 0.5rem; }
.module-toggle { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 0.5rem; }
.module-info { display: flex; align-items: center; gap: 0.5rem; }
.module-status { width: 12px; height: 12px; border-radius: 50%; }
.module-status.enabled { background: var(--success-color); }
.module-status.disabled { background: var(--text-secondary); }

.hidden { display: none; }
/* Position Location and Admin sections at bottom with proper spacing */
.nav-section-location {
    margin-top: auto;
}
.nav-section-admin {
    margin-bottom: 4rem;
}

/* Make location dropdown open upwards */
.nav-section-location select {
    direction: ltr;
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */

/* Mobile Menu Toggle Button - Top Right */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    width: var(--mobile-menu-size);
    height: var(--mobile-menu-size);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: var(--primary-hover);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle.open {
    background: var(--danger-color);
}

/* Hamburger icon lines */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animate to X when open */
.mobile-menu-toggle.open .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.open .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.open .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.visible {
    display: block;
    opacity: 1;
}

[data-theme="dark"] .mobile-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* Secondary Sidebar Toggle Button - Below primary hamburger */
.secondary-menu-toggle {
    display: none;
    position: fixed;
    top: 68px; /* Below primary toggle (10px + 48px + 10px gap) */
    right: 10px;
    width: var(--mobile-menu-size);
    height: var(--mobile-menu-size);
    background: var(--secondary-color, #6c757d);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.secondary-menu-toggle:hover {
    background: #5a6268;
}

.secondary-menu-toggle:active {
    transform: scale(0.95);
}

.secondary-menu-toggle.open {
    background: var(--danger-color);
}

/* Responsive Table - Horizontal Scroll on Mobile */
@media (max-width: 768px) {
    .table-card-view {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-card-view thead,
    .table-card-view tbody,
    .table-card-view tr,
    .table-card-view th,
    .table-card-view td {
        display: revert;
    }

    .table-card-view th,
    .table-card-view td {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
    }
}

/* Tablet Breakpoint (1024px) */
@media (max-width: 1024px) {
    .topbar .search-container {
        max-width: 280px;
        width: 280px;
    }

    .secondary-sidebar {
        display: none;
    }

    .main-content.with-secondary-sidebar {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

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

    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* Mobile Breakpoint (768px) */
@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Sidebar transforms - slides from left */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        top: 0;
        height: 100vh;
        padding-top: 60px;
    }

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

    /* Secondary sidebar handling - use !important to override page-specific styles */
    .secondary-sidebar {
        display: block !important;
        position: fixed !important;
        transform: translateX(-100%) !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 300px !important;
        height: 100vh !important;
        z-index: 1000 !important;
        transition: transform 0.3s ease !important;
        padding-top: 60px !important;
        background: var(--card-background) !important;
        border-right: 1px solid var(--border-color) !important;
        overflow-y: auto !important;
    }

    .secondary-sidebar.open {
        transform: translateX(0) !important;
    }

    /* Show secondary menu toggle on pages with secondary sidebar */
    .secondary-menu-toggle {
        display: flex;
    }

    /* Topbar adjustments */
    .topbar {
        padding: 0 1rem;
    }

    .topbar .search-container {
        display: none;
    }

    .location-selector {
        display: none;
    }

    .company-name {
        font-size: clamp(0.9rem, 3vw, 1.25rem);
    }

    .version {
        display: none;
    }

    /* Main content adjustments - use !important to override page-specific styles */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 1rem !important;
        padding-right: 1rem !important;
        margin-top: 60px !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
    }

    .main-content.with-secondary-sidebar {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Page header adjustments */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* Cards */
    .card {
        padding: 1rem;
        border-radius: 8px;
        max-width: 100% !important;
        overflow-x: auto !important;
        box-sizing: border-box !important;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .phone-group {
        flex-direction: column;
    }

    .phone-type, .phone-number, .phone-ext {
        flex: 1;
    }

    /* Touch-friendly spacing */
    .nav-item {
        padding: 1rem;
        min-height: var(--touch-target-min);
    }

    .btn {
        min-height: var(--touch-target-min);
        padding: 0.75rem 1rem;
    }

    .filter-group select,
    .filter-group input {
        min-height: var(--touch-target-min);
        padding: 0.75rem;
    }

    /* Filters stack on mobile */
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
    }

    /* Tables horizontal scroll fallback */
    .tickets-table,
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Toast positioning on mobile */
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Modals */
    .modal-content {
        margin: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    /* Row/Column layouts */
    .row {
        flex-direction: column;
    }

    .col-6, .col-4, .col-3 {
        flex: 1;
        width: 100%;
    }

    /* Dashboard grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Stats and widgets */
    .stat-value {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
    }
}

/* Small Mobile Breakpoint (480px) */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
    }

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

    .topbar-actions {
        gap: 0.5rem;
    }

    .user-info span {
        display: none;
    }

    .theme-toggle, .notification-icon {
        width: 36px;
        height: 36px;
    }

    .card {
        padding: 0.75rem;
    }

    /* Smaller checkboxes/radios with bigger touch area */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
}

/* Extra Small Mobile (320px) */
@media (max-width: 320px) {
    .company-name {
        font-size: 0.85rem;
    }

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

    .topbar {
        padding: 0 0.5rem;
    }

    .main-content {
        padding: 0.5rem;
    }
}

/* Custom WYSIWYG Editor Styles */
.custom-editor {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
}

.editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background);
    border-radius: 6px 6px 0 0;
    flex-wrap: wrap;
}

.editor-btn {
    padding: 6px 10px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.editor-btn:hover {
    background: var(--primary-light);
    border-color: var(--border-color);
}

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

.editor-separator {
    width: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}

.editor-content {
    min-height: 150px;
    padding: 12px;
    outline: none;
    line-height: 1.5;
    color: var(--text-primary);
}

.editor-content:focus {
    background: var(--primary-light);
}

.editor-content:empty:before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
    font-style: italic;
    pointer-events: none;
}

.editor-content:empty:focus:before {
    content: '';
}

.editor-select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--card-background);
    font-size: 14px;
    color: var(--text-primary);
}

.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.editor-content img:hover {
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.editor-content img.selected {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2001;
}

.image-modal-content {
    background: var(--card-background);
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    margin: 15px 0;
    transition: border-color 0.3s;
    cursor: pointer;
}

.image-upload-area:hover,
.image-upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    margin: 10px auto;
    display: none;
    border-radius: 4px;
}

.image-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.image-size-select, .image-align-select {
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-background);
    color: var(--text-primary);
}

#imageFileInput {
    display: none;
}

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 2000; }
.modal-content { background: var(--card-background); margin: 5% auto; padding: 0; width: 90%; max-width: 800px; border-radius: 8px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: clamp(1rem, 2.5vw, 1.25rem); font-weight: 600; }
.close { font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: end; gap: 1rem; }

.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input[type="checkbox"] { width: 1rem; height: 1rem; }

.row { display: flex; gap: 1rem; }
.col-6 { flex: 1; }
.col-4 { flex: 0 0 33.333%; }
.col-3 { flex: 0 0 25%; }

.badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-product { background: var(--primary-light); color: var(--primary-color); }
.badge-service { background: #fef3c7; color: #d97706; }

.stock-fields { display: none; margin-top: 1rem; padding: 1rem; background: var(--primary-light); border-radius: 6px; }
.stock-fields.show { display: block; }

.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

.loading { display: none; text-align: center; padding: 2rem; color: var(--text-secondary); }
.error { display: none; text-align: center; padding: 2rem; color: var(--danger-color); }
.empty { display: none; text-align: center; padding: 2rem; color: var(--text-secondary); }

.search-container { margin-bottom: 1.5rem; }
.search-input { width: 300px; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 6px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { background: var(--background); color: var(--text-secondary); font-weight: 600; }
.table tbody tr:hover { background: var(--primary-light); }

/* Tickets page styles */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

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

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-background);
    color: var(--text-primary);
    min-width: 150px;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.tickets-table th {
    background: var(--background);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ticket-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ticket-row:hover {
    background: var(--primary-light);
}

.ticket-title {
    font-weight: 600;
    color: var(--text-primary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge,
.priority-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Status badges */
.status-open {
    background: #fef3c7;
    color: #d97706;
}

.status-in-progress {
    background: #dbeafe;
    color: #2563eb;
}

.status-waiting-parts {
    background: #fed7d7;
    color: #e53e3e;
}

.status-waiting-customer {
    background: #fef5e7;
    color: #dd6b20;
}

.status-resolved {
    background: #d1fae5;
    color: #059669;
}

/* Priority badges */
.priority-urgent {
    background: #fed7d7;
    color: #e53e3e;
}

.priority-high {
    background: #fef5e7;
    color: #dd6b20;
}

.priority-medium {
    background: #dbeafe;
    color: #2563eb;
}

.priority-low {
    background: #e6fffa;
    color: #319795;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    margin-right: 0.25rem;
    transition: all 0.2s ease;
}

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

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

.loading-state .placeholder-icon,
.empty-state .placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Dark theme adjustments for tickets */
[data-theme="dark"] .status-open {
    background: rgba(217, 119, 6, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .status-in-progress {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .status-waiting-parts {
    background: rgba(229, 62, 62, 0.2);
    color: #f87171;
}

[data-theme="dark"] .status-waiting-customer {
    background: rgba(221, 107, 32, 0.2);
    color: #fb923c;
}

[data-theme="dark"] .status-resolved {
    background: rgba(5, 150, 105, 0.2);
    color: #34d399;
}

[data-theme="dark"] .priority-urgent {
    background: rgba(229, 62, 62, 0.2);
    color: #f87171;
}

[data-theme="dark"] .priority-high {
    background: rgba(221, 107, 32, 0.2);
    color: #fb923c;
}

[data-theme="dark"] .priority-medium {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .priority-low {
    background: rgba(49, 151, 149, 0.2);
    color: #4fd1c7;
}
/* Toast Notification Styles */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
    position: relative;
}
.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}
.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}
.toast-message {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9rem;
}
.toast.success {
    border-left: 4px solid var(--success-color);
}
.toast.error {
    border-left: 4px solid var(--danger-color);
}
.toast.warning {
    border-left: 4px solid var(--warning-color);
}
.toast.info {
    border-left: 4px solid var(--primary-color);
}
.toast.success .toast-icon {
    color: var(--success-color);
}
.toast.error .toast-icon {
    color: var(--danger-color);
}
.toast.warning .toast-icon {
    color: var(--warning-color);
}
.toast.info .toast-icon {
    color: var(--primary-color);
}
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
