:root {
    --bg-dark: #0a0b10;
    --sidebar-bg: #12141d;
    --accent: #ff3333;
    --accent-glow: rgba(255, 51, 51, 0.3);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LIGHT THEME ===== */
body.light-theme {
    --bg-dark: #e8ecf4;
    --sidebar-bg: #f0f3fa;
    --accent: #c02020;
    --accent-glow: rgba(192, 32, 32, 0.18);
    --glass: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.13);
    --text-primary: #0f1120;
    --text-secondary: #3d4f68;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
    background-color: var(--bg-dark);
    color: var(--text-primary);
}


body.light-theme .app-container {
    background-color: #dde2ee !important;
}

body.light-theme .sidebar {
    background-color: #eef1f9;
    border-right: 1px solid rgba(0,0,0,0.13);
    box-shadow: 2px 0 16px rgba(0,0,0,0.09);
}

body.light-theme .main-content {
    background: transparent !important;
}

/* Sidebar nav items */
body.light-theme .nav-item {
    color: #3d4f68;
}
body.light-theme .nav-item i,
body.light-theme .nav-item svg {
    color: #3d4f68 !important;
}
body.light-theme .nav-item:hover {
    background-color: rgba(0,0,0,0.07) !important;
    color: #0f1120 !important;
}
body.light-theme .nav-item:hover i,
body.light-theme .nav-item:hover svg {
    color: #0f1120 !important;
}
body.light-theme .nav-item.active {
    background-color: rgba(192,32,32,0.12) !important;
    color: #c02020 !important;
}
body.light-theme .nav-item.active i,
body.light-theme .nav-item.active svg {
    color: #c02020 !important;
}
body.light-theme .nav-item span {
    color: inherit !important;
}

/* Drop zone */
body.light-theme .drop-zone {
    background: #e1e3ed !important;
    border: 2px dashed rgba(0,0,0,0.18) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07) !important;
}
body.light-theme .drop-zone:hover,
body.light-theme .drop-zone.dragover {
    border-color: rgba(192,32,32,0.55) !important;
    background: rgba(192,32,32,0.04) !important;
}
body.light-theme .drop-zone p,
body.light-theme .drop-zone span,
body.light-theme .drop-zone h3 {
    color: #0f1120 !important;
}

/* ===== LIGHT THEME — SPLASH SCREEN ===== */
body.light-theme #app-preloader {
    background: #d4d9e8 !important;
}
/* App name text on splash */
body.light-theme #app-preloader h2 {
    color: #1a2236 !important;
    text-shadow: 0 0 12px rgba(192,32,32,0.35) !important;
}

/* ===== ANTI-FOUC — html class set before body renders ===== */
html.light-theme-early #app-preloader {
    background: #d4d9e8 !important;
}
html.light-theme-early #app-preloader h2 {
    color: #1a2236 !important;
    text-shadow: 0 0 12px rgba(192,32,32,0.35) !important;
}
/* Binary loading bar background */
body.light-theme #app-preloader [style*="background: rgba(7"] {
    background: rgba(200,205,220,0.85) !important;
    border-color: rgba(192,32,32,0.35) !important;
}

/* actions-grid must match the app background so panel border-radius corners show */
body.light-theme .actions-grid {
    background-color: #d4d9e8 !important;
}

/* Main panel sections */
body.light-theme .analysis-compact-section,
body.light-theme .modifications-section,
body.light-theme .dtc-container,
body.light-theme .car-list-panel {
    background: #e1e3ed !important;
    border: 1px solid rgba(0,0,0,0.13) !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.07) !important;
}

/* Logo — same glow shadow on both sidebar and login logos */
body.light-theme .logo img,
body.light-theme .sidebar .logo img,
body.light-theme .login-header img,
body.light-theme .logo-icon,
body.light-theme .drop-zone img,
body.light-theme #drop-area img {
    filter: drop-shadow(0 0 8px rgba(192, 32, 32, 0.55))
            drop-shadow(0 0 20px rgba(192, 32, 32, 0.28))
            drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35)) !important;
}


/* Inner sections */
body.light-theme .result-item {
    border-radius: 10px !important;
}
body.light-theme .dtc-section {
    background: rgba(0,0,0,0.03) !important;
    border: 1px solid rgba(0,0,0,0.09) !important;
    border-radius: 12px !important;
}
body.light-theme .search-bar-ecu {
    border-radius: 10px !important;
}
body.light-theme .table-wrapper {
    border-radius: 12px !important;
}

/* Modification tiles */
body.light-theme .mod-tile {
    border-radius: 12px !important;
    /* background: rgba(0, 0, 0, 0.04); */
    /* border: 1px solid rgba(0, 0, 0, 0.08) !important; */
}
body.light-theme .mod-tile.active {
    background: rgba(192,32,32,0.10) !important;
    border-color: rgba(192,32,32,0.25) !important;
}
body.light-theme .mod-name {
    color: #0f1120 !important;
}
body.light-theme .mod-status {
    color: #00660c !important;
}
body.light-theme .mod-icon-box {
    border-right: 1px solid rgba(0,0,0,0.08) !important;
}

/* Bottom bar buttons */
body.light-theme .controls-side > div:last-child {
    border-radius: 16px !important;
}

/* Result items */
body.light-theme .result-item {
    background: rgba(0,0,0,0.04);
}
body.light-theme .result-item .label {
    color: #3d4f68;
}
body.light-theme .result-item .value {
    color: #0f1120;
}

/* General text fixes */
body.light-theme h1,
body.light-theme h2,
body.light-theme h3,
body.light-theme h4,
body.light-theme h5,
body.light-theme h6 {
    color: #0f1120 !important;
}
body.light-theme p,
body.light-theme span:not(.ecu-badge):not(.status-pill):not([class*="badge"]):not([class*="status"]) {
    color: inherit;
}

/* Modals */
body.light-theme .modal-content {
    background: #e1e3ed !important;
    border: 1px solid rgba(0,0,0,0.14) !important;
    color: #0f1120 !important;
}
body.light-theme .modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.10) !important;
    color: #0f1120 !important;
}
body.light-theme .modal-header h3,
body.light-theme .modal-header h2 {
    color: #0f1120 !important;
}
body.light-theme .modal-body,
body.light-theme .modal-body p,
body.light-theme .modal-body label,
body.light-theme .modal-body td,
body.light-theme .modal-body th,
body.light-theme .modal-body span {
    color: #0f1120 !important;
}

/* Inputs / textarea / select */
body.light-theme input:not([type=checkbox]):not([type=radio]),
body.light-theme textarea {
    background: #e8ecf8 !important;
    color: #0f1120 !important;
    border: 1px solid rgba(0,0,0,0.18) !important;
}
body.light-theme input::placeholder,
body.light-theme textarea::placeholder {
    color: rgba(15,17,32,0.38) !important;
}
body.light-theme select {
    background: #e8ecf8 !important;
    color: #0f1120 !important;
    border: 1px solid rgba(0,0,0,0.18) !important;
}

/* Autofill override */
body.light-theme input:-webkit-autofill,
body.light-theme input:-webkit-autofill:hover,
body.light-theme input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #e8ecf8 inset !important;
    -webkit-text-fill-color: #0f1120 !important;
}

/* Search boxes */
body.light-theme .search-box {
    background: #e4e8f5;
    border: 1px solid rgba(0,0,0,0.16);
}
body.light-theme .search-box input {
    color: #0f1120 !important;
    background: none !important;
    border: none !important;
}
body.light-theme .search-box input::placeholder {
    color: rgba(15,17,32,0.38) !important;
}
body.light-theme .search-box i,
body.light-theme .search-box svg {
    color: #3d4f68 !important;
}

/* Reset background/border for search inputs — they have their own container styling */
body.light-theme #ecu-list-search,
body.light-theme #dtc-search-input,
body.light-theme #history-search,
body.light-theme #support-search-input,
body.light-theme #user-search,
body.light-theme #detail-log-search,
body.light-theme #compare-dtc-search {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
body.light-theme .search-bar-ecu {
    background: #e4e8f5 !important;
    border: 1px solid rgba(0,0,0,0.15) !important;
}
body.light-theme .search-bar-ecu input {
    color: #0f1120 !important;
    background: none !important;
}
body.light-theme .search-bar-ecu input::placeholder {
    color: rgba(15,17,32,0.38) !important;
}

/* .search-container — match other search boxes in light theme */
body.light-theme .search-container {
    background: #e4e8f5 !important;
    border: 1px solid rgba(0,0,0,0.15) !important;
}
body.light-theme .search-container:focus-within {
    background: #dde2f0 !important;
    border-color: rgba(192,32,32,0.45) !important;
    box-shadow: 0 0 0 3px rgba(192,32,32,0.08) !important;
}
body.light-theme .search-container input {
    color: #0f1120 !important;
}
body.light-theme .search-container input::placeholder {
    color: rgba(15,17,32,0.38) !important;
}
body.light-theme .search-container i,
body.light-theme .search-container svg {
    color: #5a6a8a !important;
}


/* Accordion */
body.light-theme .accordion-header {
    color: #0f1120 !important;
}
body.light-theme .accordion-header .brand-name,
body.light-theme .accordion-header span {
    color: #1a2236 !important;
}
body.light-theme .accordion-item:hover .accordion-header .brand-name,
body.light-theme .accordion-item:hover .accordion-header span {
    color: #0f1120 !important;
}
body.light-theme .accordion-item.active .accordion-header .brand-name,
body.light-theme .accordion-item.active .accordion-header span {
    color: #0f1120 !important;
}
body.light-theme .accordion-item.active .accordion-header {
    background: rgba(0,0,0,0.04) !important;
}
body.light-theme .brand-logo-svg {
    background: rgba(0,0,0,0.04) !important;
}
body.light-theme .accordion-header:hover {
    background: rgba(0,0,0,0.04) !important;
}
body.light-theme .accordion-content {
    background: #e1e3ed !important;
}
body.light-theme .ecu-row {
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}
body.light-theme .ecu-row:hover {
    background: rgba(56,130,246,0.06) !important;
}
/* ECU name — blue accent like dark theme cyan, but adapted for light bg */
body.light-theme .ecu-row .ecu-name,
body.light-theme .ecu-name {
    color: #1d6fcd !important;
    text-shadow: none !important;
}
body.light-theme .ecu-row:hover .ecu-name {
    color: #1558a8 !important;
    text-shadow: none !important;
}
/* tree-focused states */
body.light-theme .accordion-header.tree-focused {
    background: rgba(29,111,205,0.12) !important;
}
body.light-theme .accordion-header.tree-focused .brand-name {
    color: #0f1120 !important;
}
body.light-theme .ecu-row.tree-focused {
    background: rgba(29,111,205,0.15) !important;
}
body.light-theme .ecu-row.tree-focused .ecu-name {
    color: #0f3a7a !important;
    text-shadow: none !important;
}

/* card-title border — commented out, dark theme style */
body.light-theme .card-title,
body.light-theme .compare-file-card .card-title,
body.light-theme .results-summary-card .card-title,
body.light-theme .results-table-card .card-title,
body.light-theme .profile-card .card-title {
    /* border-bottom: none !important; */
}

/* DTC Table */
body.light-theme .dtc-table thead {
    background: #e0e5f0 !important;
}
body.light-theme .dtc-table th {
    color: #c02020 !important;
    background: #e0e5f0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.12) !important;
}
body.light-theme .dtc-table th[id^="dtc-sort-"]:hover {
    background: #d0d6e4 !important;
    color: #c02020 !important;
}
body.light-theme .dtc-table td {
    color: #0f1120 !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}
body.light-theme .dtc-table tr:hover {
    background: rgba(0,0,0,0.04) !important;
}
body.light-theme .dtc-code {
    color: #c02020 !important;
}
body.light-theme .dtc-hex {
    color: #3d4f68 !important;
}
body.light-theme .dtc-meaning {
    color: #3d4f68 !important;
}
body.light-theme .dtc-disabled {
    background: rgba(192,32,32,0.06) !important;
}
body.light-theme .table-wrapper {
    border: 1px solid rgba(0,0,0,0.10) !important;
}

/* Section headers */
body.light-theme .section-header h3,
body.light-theme .section-header h2 {
    color: #0f1120 !important;
}
body.light-theme .header-left h3 {
    color: #0f1120 !important;
}

/* User info section */
body.light-theme .license-info {
    background: rgba(0,160,90,0.10);
    border: 1px solid rgba(0,160,90,0.22);
}
body.light-theme #user-name-span {
    color: #0f1120 !important;
}
body.light-theme #license-status-span {
    color: #3d4f68 !important;
}
body.light-theme .sidebar-version {
    color: #c02020 !important;
}

/* Buttons */
body.light-theme .btn-primary {
    background: rgba(192,32,32,0.10) !important;
    color: #0f1120 !important;
    border: 1px solid rgba(192,32,32,0.28) !important;
}
body.light-theme .btn-primary:hover {
    background: rgba(192,32,32,0.22) !important;
    color: #0f1120 !important;
    box-shadow: 0 0 8px rgba(192,32,32,0.2) !important;
}
body.light-theme .btn-secondary {
    background: rgba(192,32,32,0.07) !important;
    color: #0f1120 !important;
    border: 1px solid rgba(192,32,32,0.22) !important;
}
body.light-theme .btn-secondary:hover {
    background: rgba(192,32,32,0.15) !important;
    color: #0f1120 !important;
}

/* History cards / rows */
body.light-theme .history-card,
body.light-theme .history-item,
body.light-theme [class*="history-row"],
body.light-theme [class*="card"] {
    background: #e1e3ed !important;
    /* border: 1px solid rgba(0,0,0,0.10) !important; */
    color: #0f1120 !important;
}

/* Support ticket rows */
body.light-theme [class*="ticket"],
body.light-theme [class*="support-row"],
body.light-theme [class*="admin-row"],
body.light-theme [class*="user-row"] {
    background: #e1e3ed !important;
    border: 1px solid rgba(0,0,0,0.10) !important;
}

/* Custom select dropdown */
body.light-theme .custom-select-trigger {
    background: #e8ecf8 !important;
    color: #0f1120 !important;
    border: 1px solid rgba(0,0,0,0.18) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07) !important;
}
body.light-theme .custom-select-trigger:hover {
    background: #dde3f2 !important;
    border-color: rgba(192,32,32,0.35) !important;
}
body.light-theme .custom-select-wrapper.open .custom-select-trigger {
    border-color: rgba(192,32,32,0.55) !important;
    background: #dde3f2 !important;
}
body.light-theme .custom-select-trigger .arrow {
    border-top-color: #3d4f68 !important;
}
body.light-theme .custom-select-options {
    background: #f0f3fa !important;
    border: 1px solid rgba(0,0,0,0.13) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.13) !important;
}
body.light-theme .custom-option {
    color: #0f1120 !important;
}
body.light-theme .custom-option:hover,
body.light-theme .custom-option.selected {
    background: rgba(192,32,32,0.08) !important;
    color: #c02020 !important;
}

/* select option dropdown bg */
body.light-theme select option {
    background: #f0f3fa !important;
    color: #0f1120 !important;
}

/* Version overlay */
body.light-theme .version-overlay {
    background: rgba(240,243,250,0.95);
    border: 1px solid rgba(0,0,0,0.12);
    color: var(--accent);
}

/* ===== LIGHT THEME — MOBILE BOTTOM NAV ===== */
body.light-theme .mobile-bottom-nav {
    background: rgba(196, 202, 220, 0.97) !important;
    border-top: 1px solid rgba(0,0,0,0.12) !important;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.10) !important;
}
body.light-theme .mobile-bottom-nav .nav-item {
    color: #4a5572 !important;
}
body.light-theme .mobile-bottom-nav .nav-item i,
body.light-theme .mobile-bottom-nav .nav-item svg {
    color: #4a5572 !important;
}
body.light-theme .mobile-bottom-nav .nav-item.active {
    color: var(--accent) !important;
}
body.light-theme .mobile-bottom-nav .nav-item.active i,
body.light-theme .mobile-bottom-nav .nav-item.active svg {
    color: var(--accent) !important;
}


/* Hex viewer — slightly lighter in light theme */
body.light-theme .hex-viewer {
    background: #2c3148 !important;
}
body.light-theme .hex-search-bar {
    background: rgba(255,255,255,0.04) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}

/* ===== LIGHT THEME — CHAT & SUPPORT MODALS (inline #141520 bg) ===== */
/* ===== LIGHT THEME — SUPPORT CHAT MODAL (full override) ===== */
/* Outer modal-content wrapper (#141520 inline) */
body.light-theme #support-chat-modal .modal-content {
    background: #f0f3fb !important;
    border: 1px solid rgba(0,0,0,0.14) !important;
    color: #0f1120 !important;
}
/* Header bar — override purple gradient for light theme */
body.light-theme #support-chat-modal .modal-content > div:first-child {
    background: linear-gradient(135deg, #bec7e4 0%, #aab5d8 100%) !important;
    border-bottom: 1px solid rgba(0,0,0,0.15) !important;
}
/* Title & subtitle text */
body.light-theme #chat-ticket-title {
    color: #000 !important;
}
body.light-theme #chat-ticket-subtitle {
    color: #4a5572 !important;
}
/* Icon circle */
body.light-theme #support-chat-modal .modal-content > div:first-child > div > div:first-child > div:first-child {
    background: rgba(192,32,32,0.12) !important;
    border-color: rgba(192,32,32,0.3) !important;
}
/* Close × button */
body.light-theme #close-support-chat-modal {
    color: #0f1120 !important;
}
/* Status badges — Açık / Çözüldü */
body.light-theme #chat-ticket-status-badge span[style*="color: #fbbf24"] {
    background: rgba(180,83,9,0.10) !important;
    border-color: rgba(180,83,9,0.3) !important;
    color: #b45309 !important;
}
body.light-theme #chat-ticket-status-badge span[style*="color: #4ade80"] {
    background: rgba(4,120,87,0.10) !important;
    border-color: rgba(4,120,87,0.3) !important;
    color: #047857 !important;
}
/* Info panel (#chat-info-panel) */
body.light-theme #chat-info-panel {
    background: #e8ecf8 !important;
    border-bottom: 1px solid rgba(0,0,0,0.10) !important;
}
body.light-theme #chat-info-panel span[style*="color: var(--text-secondary)"] {
    color: #5a6a8a !important;
}
body.light-theme #chat-info-panel span[style*="color: var(--text-primary)"],
body.light-theme #chat-info-note,
body.light-theme #chat-info-selected-brand-ecu,
body.light-theme #chat-info-detected-brand-ecu {
    color: #0f1120 !important;
}
/* Messages area (#0f0f16 inline) */
body.light-theme #chat-messages-area {
    background: #dde3f4 !important;
    background-image: none !important;
    border-bottom: 1px solid rgba(0,0,0,0.09) !important;
}
/* Input bar (#0f1016 inline) */
body.light-theme #support-chat-modal .modal-content > div:last-child,
body.light-theme #support-chat-modal .modal-content > div:nth-last-child(2) {
    background: #e4e9f6 !important;
    border-top: 1px solid rgba(0,0,0,0.09) !important;
}
/* Text input field */
body.light-theme #chat-message-input {
    background: #f0f3fb !important;
    color: #0f1120 !important;
    border: 1px solid rgba(0,0,0,0.18) !important;
}
body.light-theme #chat-message-input::placeholder {
    color: #7a8aaa !important;
}
/* Attach button */
body.light-theme #chat-attach-btn {
    background: rgba(0,0,0,0.06) !important;
    border: 1px solid rgba(0,0,0,0.12) !important;
    color: #3d4f68 !important;
}
/* Chat ticket title */
body.light-theme #chat-ticket-title {
    color: #ffffff !important;
}
/* Attachment preview */
body.light-theme #chat-attachment-preview {
    background: rgba(192,32,32,0.06) !important;
    border-color: rgba(0,0,0,0.08) !important;
}
/* Support request modal */
body.light-theme #support-request-modal .modal-content {
    background: #e1e3ed !important;
    border: 1px solid rgba(0,0,0,0.14) !important;
}
/* Fallback: any modal-content with inline dark bg override */
body.light-theme .modal-content[style*="background: #141520"],
body.light-theme .modal-content[style*="background:#141520"] {
    background: #e1e3ed !important;
    border: 1px solid rgba(0,0,0,0.14) !important;
}

/* ===== LIGHT THEME — HEX VIEWER TEXT COLORS ===== */
/* Offset column (currently too faint on dark hex bg) */
body.light-theme .offset-col {
    color: #a8b8d8 !important;
    font-weight: 600 !important;
}
/* Regular hex bytes */
body.light-theme .hex-col {
    color: #c5cfe8 !important;
}
/* Non-zero bytes — keep bright */
body.light-theme .hex-byte.nonzero {
    color: #e8edf8 !important;
    font-weight: 700 !important;
}
/* ASCII column */
body.light-theme .ascii-col {
    color: #a8b8d8 !important;
}
/* Hex header (OFFSET / ASCII labels) */
body.light-theme .hex-header {
    color: #c5cfe8 !important;
    background: rgba(255,255,255,0.05) !important;
}

/* Scrollbar */
body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(160,60,60,0.35) !important;
}
body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(160,60,60,0.60) !important;
}

/* Misc light-mode fixes */
body.light-theme .result-header {
    color: #c02020 !important;
}
body.light-theme .result-divider {
    background: rgba(0,0,0,0.10) !important;
}
body.light-theme .filename-badge-mini {
    background: rgba(0,0,0,0.06) !important;
    border-color: rgba(0,0,0,0.12) !important;
    color: #3d4f68 !important;
}
body.light-theme .count-badge {
    background: rgba(192,32,32,0.10) !important;
    border-color: rgba(192,32,32,0.28) !important;
    color: #c02020 !important;
}
body.light-theme .dtc-tooltip {
    background: rgba(240,243,250,0.98) !important;
    color: #0f1120 !important;
    border-color: #c02020 !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

/* ===== LIGHT THEME — CLOSE BUTTONS ===== */
body.light-theme .close-modal {
    color: #3d4f68 !important;
    opacity: 0.75 !important;
}
body.light-theme .close-modal:hover {
    color: #0f1120 !important;
    opacity: 1 !important;
}
body.light-theme button.close-modal i,
body.light-theme button.close-modal svg {
    color: #3d4f68 !important;
    stroke: #3d4f68 !important;
}
body.light-theme .close-admin-btn {
    color: #3d4f68 !important;
}
body.light-theme .close-admin-btn:hover {
    color: #0f1120 !important;
}
body.light-theme .close-admin-btn i,
body.light-theme .close-admin-btn svg {
    color: #3d4f68 !important;
    stroke: #3d4f68 !important;
}

/* Override hardcoded color:white on specific close buttons (inline style) */
body.light-theme #close-hex-modal,
body.light-theme #close-compare-hex-modal,
body.light-theme #close-compare-map-modal,
body.light-theme #close-user-modal,
body.light-theme #close-user-details-modal,
body.light-theme #close-history-v-modal,
body.light-theme #close-support-request-modal,
body.light-theme #close-support-chat-modal,
body.light-theme #close-program-updates-modal,
body.light-theme #close-program-updates-ok,
body.light-theme #close-forgot-modal {
    color: #3d4f68 !important;
    opacity: 0.80 !important;
}
body.light-theme #close-hex-modal:hover,
body.light-theme #close-compare-hex-modal:hover,
body.light-theme #close-compare-map-modal:hover,
body.light-theme #close-user-modal:hover,
body.light-theme #close-user-details-modal:hover,
body.light-theme #close-history-v-modal:hover,
body.light-theme #close-support-request-modal:hover,
body.light-theme #close-support-chat-modal:hover,
body.light-theme #close-program-updates-modal:hover,
body.light-theme #close-forgot-modal:hover {
    color: #0f1120 !important;
    opacity: 1 !important;
}
/* Icons inside those buttons */
body.light-theme #close-hex-modal i,
body.light-theme #close-hex-modal svg,
body.light-theme #close-compare-hex-modal i,
body.light-theme #close-compare-hex-modal svg,
body.light-theme #close-compare-map-modal i,
body.light-theme #close-compare-map-modal svg,
body.light-theme #close-user-modal i,
body.light-theme #close-user-modal svg,
body.light-theme #close-user-details-modal i,
body.light-theme #close-user-details-modal svg,
body.light-theme #close-history-v-modal i,
body.light-theme #close-history-v-modal svg {
    color: #3d4f68 !important;
    stroke: #3d4f68 !important;
}

/* ===== LIGHT THEME — BG SLIGHT DARKENING ===== */
/* Tweak root vars to be slightly more muted */
body.light-theme {
    --bg-dark: #d4d9e8;
    --sidebar-bg: #e8ecf6;
}
body.light-theme .app-container {
    background-color: #d4d9e8 !important;
}
body.light-theme .sidebar {
    background-color: #e8ecf6;
}

/* ===== LIGHT THEME — ACTIVITY LOG TABLE ===== */
/* Hardcoded dark header in activity/log tables */
body.light-theme table thead tr,
body.light-theme table thead th,
body.light-theme [class*="activity"] thead,
body.light-theme [class*="log-table"] thead {
    background: #d8deed !important;
    color: #0f1120 !important;
}
body.light-theme table tbody tr {
    background: transparent !important;
    color: #0f1120 !important;
}
body.light-theme table tbody td {
    color: #0f1120 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}
/* Specifically target the dark #1a1c28 / #0d0e14 style activity table */
body.light-theme [style*="background: #1a"],
body.light-theme [style*="background:#1a"],
body.light-theme [style*="background: #0d"],
body.light-theme [style*="background:#0d"],
body.light-theme [style*="background: #14"],
body.light-theme [style*="background:#14"],
body.light-theme [style*="background: #0a"],
body.light-theme [style*="background:#0a"] {
    /* Can't easily override inline, handled per-component below */
}
/* Override the black thead row that appears in user activity log */
body.light-theme .modal-body table thead tr {
    background: #d0d6e8 !important;
}
body.light-theme .modal-body table thead th {
    background: #d0d6e8 !important;
    color: #3d4f68 !important;
    border-bottom: 1px solid rgba(0,0,0,0.12) !important;
}
body.light-theme .modal-body table tbody tr {
    background: #eef1fa !important;
}
body.light-theme .modal-body table tbody tr:nth-child(even) {
    background: #e8ecf6 !important;
}
body.light-theme .modal-body table tbody td {
    color: #0f1120 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

/* "Filtrelere uygun işlem kaydı bulunamadı." area */
body.light-theme .modal-body [style*="color: white"],
body.light-theme .modal-body [style*="color:white"],
body.light-theme .modal-body [style*="color: #fff"],
body.light-theme .modal-body [style*="color:#fff"] {
    color: #0f1120 !important;
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    padding: 5px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

body.light-theme .theme-toggle-wrap {
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.10);
}

.theme-toggle-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color 0.2s;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.theme-toggle-label.active-label {
    color: var(--accent);
}

/* iOS-style pill toggle */
.theme-toggle-switch {
    position: relative;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.theme-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.theme-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s;
    border: 1px solid var(--glass-border);
}

body.light-theme .theme-toggle-slider {
    background: rgba(0,0,0,0.10);
    border-color: rgba(0,0,0,0.15);
}

.theme-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), background 0.3s;
}

.theme-toggle-switch input:checked + .theme-toggle-slider {
    background: rgba(212,43,43,0.25);
    border-color: rgba(212,43,43,0.4);
}

.theme-toggle-switch input:checked + .theme-toggle-slider::before {
    transform: translateY(-50%) translateX(18px);
    background: var(--accent);
}

/* Sun/Moon icons in toggle labels */
.theme-toggle-icon {
    font-size: 12px;
    line-height: 1;
}

.dtc-container {
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.table-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

/* Global Custom Scrollbar Style */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(208, 83, 83, 0.45) !important;
    border: 2px solid transparent !important;
    background-clip: padding-box !important;
    border-radius: 20px !important;
    min-height: 120px !important; /* Forces scrollbar thumb to have a highly visible minimum height */
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(208, 83, 83, 0.75) !important;
    border: 2px solid transparent !important;
    background-clip: padding-box !important;
}

/* Firefox compatibility styling */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(208, 83, 83, 0.45) transparent;
}

.dtc-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0px;
    table-layout: fixed; /* Enforces fixed column widths and prevents horizontal overflow */
}

.dtc-table th {
    text-align: left;
    padding: 12px;
    color: #b54545;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
}

.dtc-table th[id^="dtc-sort-"] {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dtc-table th[id^="dtc-sort-"]:hover {
    background: #272342 !important;
    color: #ffffff !important;
}


.dtc-table td {
    padding: 9px 12px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: white;
}

.dtc-table th:last-child,
.dtc-table td:last-child {
    text-align: right;
}

.dtc-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
    cursor: default;
}

.dtc-code {
    font-weight: 700;
    color: var(--accent);
}

.dtc-hex {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

.dtc-meaning {
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0; /* Ensures it truncates within the table-cell under table-layout: fixed */
    cursor: pointer;
}

/* Beautiful Premium Floating Tooltip for DTC Descriptions */
.dtc-tooltip {
    position: fixed;
    background: rgba(18, 20, 29, 0.96);
    border: 1px solid var(--accent);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    max-width: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--accent-glow);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.15s ease;
    backdrop-filter: blur(12px);
    line-height: 1.4;
    word-break: break-word;
    box-sizing: border-box;
    text-align: left;
}

.dtc-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dtc-tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--accent);
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
}

.status-pill {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.status-pill.on {
    background: rgba(0, 255, 127, 0.1);
    color: #00ff7f;
}

.status-pill.off {
    background: rgba(255, 51, 51, 0.1);
    color: #ff3333;
}

.dtc-disabled {
    background: rgba(255, 51, 51, 0.08) !important;
}

.dtc-disabled .dtc-code {
    color: #ff4d4d;
}

/* --- Section & Search Box Header Styles --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left i {
    color: var(--accent);
    width: 24px;
    height: 24px;
}

.header-left h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: white;
}

.count-badge {
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0 16px;
    transition: var(--transition);
    width: 260px;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    background: rgba(0, 0, 0, 0.35);
}

.search-box i,
.search-box svg {
    color: var(--text-secondary) !important;
    width: 16px !important;
    height: 16px !important;
    margin-right: 10px !important;
    flex-shrink: 0 !important;
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: white;
    padding: 10px 0;
    font-size: 13px;
    font-family: inherit;
    flex: 1 !important;
    width: 0 !important;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #12141d inset !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 5000s ease-in-out 0s;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100%;
    background-color: #262639 !important;
}

/* --- SIDEBAR (MODERN COLLAPSIBLE) --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    transition: var(--transition);
    z-index: 200;
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 48px;
    width: max-content;
    height: 32px;
    justify-content: flex-start;
}

.user-info-section {
    padding: 0;
    text-align: center;
    margin-bottom: 24px;
}

/* --- LANGUAGE SELECTOR --- */
.language-selector {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 0 12px;
}

.lang-btn {
    background: none;
    border: 2px solid transparent;
    padding: 2px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}

.lang-btn svg {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    object-fit: cover;
    display: block;
}

.lang-btn:hover {
    opacity: 0.95;
    transform: scale(1.15);
}

.lang-btn.active {
    opacity: 1;
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.user-greeting {
    font-size: 15px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.license-info {
    font-size: 11px;
    color: var(--text-secondary);
    /* Active Green */
    background: rgba(0, 255, 127, 0.1);
    border: 1px solid rgba(0, 255, 127, 0.2);
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.logo span {
    width: auto;
    opacity: 1;
    visibility: visible;
    margin-left: 16px;
    font-weight: 700;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-bottom: 5px;
    width: 100%;
    justify-content: flex-start;
}

.nav-item:hover i,
.nav-item.active i {
    opacity: 1;
    color: #ffffff !important;
}

.nav-item span {
    width: auto;
    opacity: 1;
    visibility: visible;
    margin-left: 16px;
    white-space: nowrap;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.modal-small {
    height: auto !important;
    min-height: auto !important;
}

.modal-small .modal-header {
    padding: 24px 32px;
}

.modal-small .modal-body {
    padding: 32px;
    padding-top: 0;
}

.modal-small .form-group {
    width: 100%;
}

.modal-small input {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.close-modal:hover {
    color: white !important;
    transform: scale(1.1);
}

#forgot-password-link:hover {
    text-decoration: underline !important;
    opacity: 0.8;
}

.version-overlay {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 6px 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    backdrop-filter: blur(10px);
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    padding: 32px 48px 24px;
    overflow-y: auto;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
    background: transparent !important;
}

.top-header {
    margin-bottom: 48px;
}

.top-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.top-header p {
    color: var(--text-secondary);
}

/* --- UPLOAD ZONE --- */
.upload-section {
    max-width: 1400px;
    /* Expanded further from 1200px to 1400px */
    width: 95%;
    /* Ensures it fills smaller screens too */
    margin: 0 auto;
}

.drop-zone {
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 64px 24px !important;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: rgba(255, 51, 51, 0.9) !important;
    background: linear-gradient(rgba(255, 51, 51, 0.03), rgba(255, 51, 51, 0.03)), var(--sidebar-bg) !important;
    box-shadow: 0 8px 32px rgba(255, 51, 51, 0.05), 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.drop-zone i {
    width: 64px;
    height: 64px;
    color: var(--accent);
    margin-bottom: 24px;
}

/* --- BUTTONS --- */
.btn-primary {
    background: rgba(255, 51, 51, 0.15) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 51, 51, 0.3) !important;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px !important;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: rgba(255, 51, 51, 0.35) !important;
    border-color: rgba(255, 51, 51, 0.6) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 0 4px #ff3333, 0 0 8px rgba(255, 51, 51, 0.75) !important;
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.3) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.btn-primary:disabled:hover,
.btn-primary:disabled:focus,
.btn-primary:disabled:active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.3) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.btn-primary:focus,
.btn-primary:active,
.btn-primary:focus-visible {
    outline: none !important;
}

.btn-secondary {
    background: rgba(255, 51, 51, 0.11) !important;
    color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 51, 51, 0.45) !important;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px !important;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(255, 51, 51, 0.08) !important;
    color: #ffffff !important;
    border-color: rgba(255, 51, 51, 0.4) !important;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.2) !important;
}

/* --- RESULT CARD (THE WINDOW) --- */
.result-card {
    background: transparent;
    backdrop-filter: none;
    border: none;
    padding: 0;
    margin-top: 10px;
    box-shadow: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--accent);
    min-width: 0;
    overflow: hidden;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filename-badge-mini {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
    box-sizing: border-box;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 0px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.result-item .label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 500;
}

.result-item .value {
    font-size: 13px;
    font-weight: 600;
}

.searchable-value {
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.searchable-value:hover {
    color: var(--accent) !important;
    text-decoration: underline;
    opacity: 0.9;
}

.result-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 12px 0;
}

/* --- ACTIONS GRID (INTERNAL WINDOW CONTENT) --- */
.actions-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
}

.side-column-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    height: calc(100vh - 66px);
}

.analysis-compact-section {
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.result-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.result-grid-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.dtc-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.controls-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: calc(100vh - 66px);
}

.modifications-section {
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: auto !important;
}

.modifications-section h4 {
    margin-bottom: 20px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
}

/* --- MODIFICATIONS GRID --- */
.modifications-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.mod-tile {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    user-select: none;
    position: relative;
    height: 50px;
}

.mod-icon-box {
    width: 40px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    padding: 2px 0;
}

.mod-icon-box i {
    width: 16px;
    height: 16px;
    color: white;
    filter: none;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.mod-indicator {
    font-size: 7px;
    font-weight: 900;
    margin-top: 1px;
    padding: 0px 3px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.mod-name {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
}

.mod-tile:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.mod-icon-box {
    width: 60px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    padding: 4px 0;
}

.mod-icon-box i {
    width: 20px;
    height: 20px;
    color: white;
    filter: none;
    opacity: 0.7;
    /* Increased from 0.4 for better visibility */
    transition: all 0.3s ease;
}

.mod-indicator {
    font-size: 8px;
    font-weight: 900;
    margin-top: 2px;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    opacity: 0.8;
    /* Increased visibility */
    transition: all 0.3s ease;
}



.mod-info {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mod-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #cbd5e1;
    /* Brighter than text-secondary for 'selectable' feel */
    text-transform: uppercase;
    text-align: center;
    opacity: 0.9;
}

.mod-status {
    font-size: 9px;
    font-weight: 800;
    color: #00ff1f;
    opacity: 0.4;
    margin-top: 1px;
    text-align: center;
}

/* --- ACTIVE STATES --- */
.mod-tile.active {
    background: rgba(255, 51, 51, 0.04);
    border-color: #ff3333;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.4);
    transform: translateY(-2px);
}

.mod-tile.active .mod-icon-box {
    background: rgba(255, 26, 26, 0.4);
}

.mod-tile.active .mod-icon-box i,
.mod-tile.active .mod-indicator,
.mod-tile.active .mod-status {
    color: #ff3333;
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.7);
}

.mod-tile.active .mod-icon-box i {
    filter: grayscale(0);
    transform: scale(1.1);
}

.mod-tile.active .mod-name {
    color: #ffffff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* Color Overrides for specific modules (Design Parity) */
[data-mod="egr"].active .mod-icon-box {
    background: rgba(255, 26, 26, 0.4);
}

[data-mod="egr"].active .mod-icon-box i,
[data-mod="egr"].active .mod-indicator,
[data-mod="egr"].active .mod-status {
    color: #ff3333;
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.7);
    /* Slightly toned down */
}

[data-mod="egr"].active {
    border-color: #ff3333;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.4);
    /* Toned down spread */
    background: rgba(255, 51, 51, 0.04);
}

[data-mod="egr"].active .mod-name {
    color: #ffffff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

[data-mod="dpf"].active .mod-icon-box {
    background: rgba(255, 26, 26, 0.4);
}

[data-mod="dpf"].active .mod-icon-box i,
[data-mod="dpf"].active .mod-indicator,
[data-mod="dpf"].active .mod-status {
    color: #ff3333;
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.7);
    /* Slightly toned down */
}

[data-mod="dpf"].active {
    border-color: #ff3333;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.4);
    /* Toned down spread */
    background: rgba(255, 51, 51, 0.04);
}

[data-mod="dpf"].active .mod-name {
    color: #ffffff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

[data-mod="immo"].active .mod-icon-box {
    background: rgba(255, 26, 26, 0.4);
}

[data-mod="immo"].active .mod-icon-box i,
[data-mod="immo"].active .mod-status {
    color: #ff3333;
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.7);
    /* Slightly toned down */
}

[data-mod="immo"].active {
    border-color: #ff3333;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.4);
    /* Toned down spread */
    background: rgba(255, 51, 51, 0.04);
}

[data-mod="immo"].active .mod-name {
    color: #ffffff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

[data-mod="stage1"].active .mod-icon-box {
    background: rgba(255, 152, 0, 0.15);
}

[data-mod="stage1"].active .mod-icon-box i {
    color: #ff9800;
}

[data-mod="stage1"].active {
    border-color: #ff9800;
}

[data-mod="stage2"].active .mod-icon-box {
    background: rgba(33, 150, 243, 0.15);
}

[data-mod="stage2"].active .mod-icon-box i {
    color: #2196f3;
}

[data-mod="stage2"].active {
    border-color: #2196f3;
}

/* Already Patched / Locked State (Detected from original file) */
.mod-tile.already-patched {
    background: rgb(255 0 0 / 6%);
    border: 1px solid rgb(106 1 1);
    box-shadow: none;
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
    transition: all 0.3s ease;
}

.mod-tile.already-patched .mod-name,
.mod-tile.already-patched .mod-icon-box {
    opacity: 0.6;
}

.mod-tile.already-patched .mod-icon-box {
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgb(106 1 1);
}

.mod-tile.already-patched .mod-icon-box i,
.mod-tile.already-patched .mod-indicator {
    color: #94a3b8;
    opacity: 0.6;
    text-shadow: none;
}

.mod-tile.already-patched .mod-status {
    font-weight: 900;
    color: #ff1a1a !important;
    opacity: 0.9 !important;
    filter: none !important;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(255, 26, 26, 0.65);
}

/* Locked/Placeholder State */
.mod-tile.locked {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.mod-tile.locked.eeprom-locked {
    opacity: 0.04 !important;
    cursor: default;
    pointer-events: none;
    filter: grayscale(1) blur(0.3px) !important;
}

.process-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
}

.process-group .btn-primary,
.process-group .btn-secondary {
    flex: 1;
    min-width: 120px;
    white-space: nowrap;
    padding: 10px;
    font-size: 13px;
}

.dtc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.dtc-search input {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 12px;
    color: white;
    font-size: 13px;
    width: 200px;
}

.dtc-table-container {
    max-height: 310px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.dtc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dtc-table th {
    text-align: left;
    padding: 8px 12px;
    background: #1e1e2d;
    /* Solid color to prevent text overlapping when scrolling */
    color: var(--accent);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dtc-table td {
    padding: 9px 12px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: white;
}

.dtc-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- MODALS --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-content {
    background: var(--sidebar-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    width: 90%;
    max-width: 1000px;
    height: auto;
    max-height: 90vh;
    /* Fixed from 115vh to prevent overflow */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* Specific constraint for Hex Modal to stay 50px from top and bottom */
#hex-modal .modal-content {
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
}

/* --- HEX VIEWER --- */
.hex-viewer {
    background: #0d0e14;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    /* Automatically fills space */
    min-height: 0;
}

.hex-search-bar {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--glass-border);
    align-items: center;
}

.hex-search-input-group {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
}

.hex-search-input-group select {
    background: rgba(208, 83, 83, 0.1);
    border: none;
    border-right: 1px solid var(--glass-border);
    color: var(--accent);
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    width: auto;
}

.hex-search-input-group input {
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: white;
    font-size: 13px;
    flex: 1;
    outline: none;
}

.btn-hex-search {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-hex-search:hover {
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-hex-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hex-search-result-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 20px 8px;
}

.hex-header {
    display: flex;
    background: rgba(208, 83, 83, 0.1);
    padding: 10px 20px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hex-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.hex-row {
    display: flex;
    padding: 2px 20px;
    transition: background 0.2s;
}

.hex-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.offset-col {
    color: var(--text-secondary);
    width: 100px;
    flex-shrink: 0;
}

.hex-col {
    flex: 1;
    display: flex;
    gap: 8px;
    padding: 0 20px;
    color: #94a3b8;
}

.hex-byte {
    width: 22px;
    text-align: center;
}

.hex-byte.null {
    opacity: 0.2;
}

.hex-byte.nonzero {
    color: var(--text-primary);
    font-weight: 600;
}

.hex-byte[contenteditable="true"] {
    outline: none;
    cursor: text;
    border-radius: 3px;
    transition: all 0.2s;
}

.hex-byte[contenteditable="true"]:focus,
.ascii-byte[contenteditable="true"]:focus {
    outline: none;
    background: var(--accent);
    color: white;
    box-shadow: 0 0 10px var(--accent-glow);
    font-weight: 700;
}

.hex-byte.modified {
    color: #ff9800;
    /* Orange for unsaved/modified */
    font-weight: 700;
}

.hex-byte.search-highlight,
.ascii-byte.search-highlight {
    background: var(--accent) !important;
    color: white !important;
    font-weight: 700 !important;
    box-shadow: 0 0 10px var(--accent-glow) !important;
    border-radius: 3px !important;
}

.hex-byte.saving {
    animation: pulse-border 1s infinite;
    opacity: 0.7;
}

@keyframes pulse-border {
    0% {
        background: rgba(208, 83, 83, 0.2);
    }

    50% {
        background: rgba(208, 83, 83, 0.5);
    }

    100% {
        background: rgba(208, 83, 83, 0.2);
    }
}

.ascii-col {
    width: 150px;
    flex-shrink: 0;
    color: var(--accent);
    display: flex;
    gap: 0;
    font-family: inherit;
    border-left: 1px solid var(--glass-border);
    padding-left: 20px;
    white-space: pre;
}

.ascii-byte {
    width: 9px;
    text-align: center;
    cursor: text;
    border-radius: 2px;
    transition: all 0.2s;
    user-select: none;
}

.ascii-byte[contenteditable="true"]:focus {
    background: var(--accent);
    color: white;
    outline: none;
}

.ascii-byte:hover {
    background: rgba(255, 255, 255, 0.05);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
}

.modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* --- UTILS --- */
.hidden {
    display: none !important;
}

.switch {
    width: 25px;
    height: 14px;
    position: relative;
    display: inline-block;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(11px);
}

/* --- HISTORY --- */
.history-section {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-container {
    position: relative;
    display: flex !important;
    align-items: center !important;
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 0 14px !important;
    margin: 0 !important;
    height: auto !important;
    box-sizing: border-box !important;
    transition: var(--transition) !important;
    width: 250px;
}

.search-container:focus-within {
    border-color: var(--accent) !important;
    box-shadow: 0 0 12px var(--accent-glow) !important;
    background: rgba(0, 0, 0, 0.5) !important;
}

.search-container i,
.search-container svg {
    color: var(--text-secondary) !important;
    width: 14px !important;
    height: 14px !important;
    margin-right: 10px !important;
    flex-shrink: 0 !important;
}

.search-container input {
    background: none !important;
    border: none !important;
    outline: none !important;
    color: white !important;
    padding: 10px 0 !important;
    padding-right: 32px !important;
    font-size: 14px !important;
    font-family: inherit;
    flex: 1 !important;
    width: 0 !important;
    height: auto !important;
}

.btn-refresh,
.btn-clear {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px !important;
}

.btn-clear {
    color: #ff4d4d;
    padding: 10px 18px;
    font-size: 14px !important;
    font-weight: 600;
    background: rgba(255, 77, 77, 0.05);
}

.btn-refresh:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-clear:hover {
    background: #ff4d4d;
    color: white;
    border-color: #ff4d4d;
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.3);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden !important;
    padding: 6px 4px 120px 4px !important;
}

.history-item {
    background: rgb(206 206 206 / 2%);
    border: 1px solid var(--glass-border);
    padding: 10px 24px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    transition: var(--transition);
    cursor: pointer;
    backdrop-filter: blur(15px);
    position: relative;
    overflow: visible !important; /* Changed from hidden to prevent custom select dropdown clipping */
    flex-shrink: 0 !important;
    z-index: 1;
}

.history-item:has(.custom-select-wrapper.open) {
    z-index: 999 !important;
}

.history-item:hover {
    background: rgba(255, 51, 51, 0.015) !important;
    transform: translateY(-2px);
    border-color: rgba(255, 51, 51, 0.08) !important;
    box-shadow: none !important;
}

.history-item.selected-history-item {
    background: rgba(255, 51, 51, 0.04) !important;
    border-color: rgba(255, 51, 51, 0.25) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.history-item.ticket-resolved {
    background: rgba(34, 197, 94, 0.06) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

.history-item.ticket-resolved:hover {
    background: rgba(34, 197, 94, 0.12) !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.1) !important;
}

.history-item.ticket-open {
    background: rgba(255, 51, 51, 0.045) !important;
    border-color: rgba(255, 51, 51, 0.2) !important;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.08) !important;
}

.history-item.ticket-open:hover {
    background: rgba(255, 51, 51, 0.09) !important;
    border-color: rgba(255, 51, 51, 0.4) !important;
    box-shadow: 0 0 16px rgba(255, 51, 51, 0.22) !important;
}

.history-item.selected-history-item .item-icon-container i {
    color: white !important;
}

.history-item .item-icon-container {
    width: 60px;
    height: 60px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.history-item:hover .item-icon-container {
    background: transparent;
    box-shadow: none;
}

.history-item .item-icon-container i {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.history-item:hover .item-icon-container i {
    color: white !important;
}

.history-item .item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.history-item h4 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.history-item .item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.history-item .meta-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 10px;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
}

.history-item .meta-badge strong {
    color: var(--accent);
    font-weight: 600;
    margin-right: 4px;
}

.history-item .item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    margin-left: 20px;
}

.history-item .item-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
}

.btn-delete {
    background: rgba(255, 77, 77, 0.05);
    border: 1px solid rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete:hover {
    background: rgba(255, 51, 51, 0.25) !important;
    border-color: #ff3333 !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.35) !important;
}

.btn-danger-outline {
    background: rgba(255, 51, 51, 0.08) !important;
    border: 1.5px solid rgba(255, 51, 51, 0.25) !important;
    color: #f87171 !important;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 14px !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out !important;
}

.btn-danger-outline:hover:not(:disabled) {
    background: rgba(255, 51, 51, 0.25) !important;
    border-color: #ff3333 !important;
    color: #fff !important;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.35) !important;
    transform: translateY(-1px);
}

.btn-danger-outline:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}

@media (max-width: 1000px) {
    .actions-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}

/* --- LOGIN SCREEN --- */
.login-container {
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1a1b26, var(--bg-dark));
    z-index: 2000;
    position: relative;
}

body.light-theme .login-container {
    background: radial-gradient(circle at top right, #eef2fa, var(--bg-dark)) !important;
}

.login-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 48px;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 28px;
    margin: 16px 0 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: var(--accent);
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 12px 16px;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    transition: var(--transition);
    box-sizing: border-box;
}

select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: rgba(255, 51, 51, 0.05) !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 14px !important;
    color: white !important;
    border: 1px solid rgba(255, 51, 51, 0.35) !important;
    border-radius: 10px !important;
    padding: 8px 36px 8px 14px !important;
    font-size: 13px !important;
    font-family: inherit;
    font-weight: 600 !important;
    outline: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    box-sizing: border-box !important;
}

select:hover {
    background-color: rgba(255, 51, 51, 0.09) !important;
    border-color: rgba(255, 51, 51, 0.5) !important;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.15) !important;
}

select:focus {
    border-color: var(--accent) !important;
    background-color: rgba(255, 51, 51, 0.1) !important;
    box-shadow: 0 0 12px var(--accent-glow) !important;
}

select option {
    background: #141520 !important;
    color: white !important;
    padding: 12px !important;
    font-size: 13px !important;
    border: none !important;
    outline: none !important;
}

/* --- CUSTOM SELECT COMPONENT STYLES --- */
.custom-select-hidden {
    display: none !important;
}

.custom-select-wrapper {
    position: relative;
    display: inline-block;
    z-index: 1;
    user-select: none;
}

.custom-select-wrapper.open {
    z-index: 9999 !important;
}

.form-group .custom-select-wrapper {
    width: 100% !important;
    display: block !important;
}

.form-group .custom-select-trigger {
    width: 100% !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--glass-border) !important;
    height: 46px !important;
    box-sizing: border-box !important;
}

.form-group .custom-select-trigger:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.form-group .custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--accent) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 0 12px var(--accent-glow) !important;
}



.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 51, 51, 0.05);
    color: white;
    border: 1px solid rgba(255, 51, 51, 0.35);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    min-width: 150px;
    box-sizing: border-box;
}

.custom-select-trigger:hover {
    background-color: rgba(255, 51, 51, 0.09);
    border-color: rgba(255, 51, 51, 0.5);
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.15);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--accent);
    background-color: rgba(255, 51, 51, 0.1);
    box-shadow: 0 0 12px var(--accent-glow);
}

.custom-select-trigger .arrow {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid white;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

.custom-select-wrapper.open .custom-select-trigger .arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #141520;
    border: 1px solid rgba(255, 51, 51, 0.25);
    border-radius: 12px;
    margin-top: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
}

.custom-select-wrapper.open .custom-select-options {
    display: block;
}

.custom-option {
    padding: 10px 14px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.custom-option:hover,
.custom-option.hovered {
    background: rgba(255, 51, 51, 0.15);
    color: white;
}

.custom-option.selected {
    background: rgba(255, 51, 51, 0.25);
    color: white;
    font-weight: 600;
}


.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(208, 83, 83, 0.05);
}

.error-msg {
    margin-top: 16px;
    color: #ff4d4d;
    font-size: 13px;
    text-align: center;
    background: rgba(255, 77, 77, 0.1);
    padding: 10px;
    border-radius: 8px;
}

/* --- ADMIN VIEW --- */
.admin-view {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-table-wrapper {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    overflow-y: auto;
    margin-top: 24px;
    flex: 1;
    min-height: 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    padding: 16px 24px;
    color: #b54545;
    font-size: 14px;
    border-bottom: 1px solid var(--glass-border);
}

.admin-table td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-size: 14px;
    color: var(--text-secondary);
}

.role-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.role-badge.admin {
    background: rgba(208, 83, 83, 0.2);
    color: var(--accent);
}

.role-badge.user {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-icon.edit:hover {
    color: var(--accent);
}

.btn-icon.delete:hover {
    color: #ff4d4d;
}

.date-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.date-group input {
    flex: 1;
}

.btn-extend {
    background: rgba(208, 83, 83, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-extend:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 8px;
}

.status-badge.active {
    background: rgba(0, 255, 127, 0.1);
    color: #00ff7f;
}

.status-badge.expired {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
}

/* --- PROFILE SECTION --- */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1000px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

#profile-msg.success {
    color: #00ff7f;
}

#profile-msg.error {
    color: #ff4d4d;
}

#forgot-msg.success {
    color: #00ff7f;
}

#forgot-msg.error {
    color: #ff4d4d;
}

/* --- PROFILE SECTION --- */
.profile-view {
    max-width: 800px;
    margin: 0 auto;
}

.profile-card {
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.profile-info-banner {
    background: rgba(208, 83, 83, 0.05);
    border: 1px solid rgba(208, 83, 83, 0.2);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-info-banner i {
    color: var(--accent);
}

#profile-msg {
    margin-top: 20px;
    font-size: 14px;
    font-weight: 500;
}

#profile-msg.success {
    color: #00ff7f;
}

#profile-msg.error {
    color: #ff4d4d;
}

@media (max-width: 1000px) {
    .profile-form-grid {
        grid-template-columns: 1fr;
    }
}

/* --- LINEAGE TREE STYLES --- */
.lineage-tree-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.lineage-node {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.lineage-node.child {
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px dashed rgba(255, 255, 255, 0.1);
}

.lineage-node.child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 23px;
    width: 16px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.version-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.version-card i {
    color: var(--text-secondary) !important;
    transition: var(--transition);
}

.version-card:hover {
    background: rgba(255, 51, 51, 0.03) !important;
    transform: translateY(-2px) !important;
    border-color: rgba(255, 51, 51, 0.15) !important;
    box-shadow: 0 4px 15px rgba(255, 51, 51, 0.05) !important;
}

.version-card:hover i {
    color: white !important;
}

.version-info h4 {
    margin: 0 0 4px;
    font-size: 14px;
    color: white;
}

.version-info .ops-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(208, 83, 83, 0.2);
    color: var(--accent);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
}

.version-info .original-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 255, 127, 0.1);
    color: #00ff7f;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.version-meta {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
}

/* --- EEPROM Specific History Styles --- */
.version-card.is-eeprom {
    background: rgba(208, 83, 83, 0.08);
    border-color: rgba(208, 83, 83, 0.3);
}

.version-card.is-eeprom:hover {
    background: rgba(255, 51, 51, 0.03) !important;
    border-color: rgba(255, 51, 51, 0.15) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(255, 51, 51, 0.05) !important;
}

.version-card.is-eeprom .ops-badge {
    background: rgba(208, 83, 83, 0.3);
    color: #b39ddb;
}

.version-card.is-eeprom h4 {
    color: #d1c4e9;
}

/* --- Sidebar History Item Differentiation --- */
.history-item.is-eeprom {
    background: rgb(255 77 77 / 7%);
}

.history-item.is-eeprom:hover {
    background: rgba(208, 83, 83, 0.08);
}

.history-item.is-eeprom .item-icon-container i {
    color: #b39ddb;
}
/* --- Modified History Item Indicator --- */
.history-item.has-modifications .item-icon-container i {
    color: #ff4d4d !important;
    filter: drop-shadow(0 0 5px rgba(255, 77, 77, 0.4));
}

/* --- Overriding all icon colors for modified files --- */
.history-item.has-modifications .item-icon-container i,
.history-item.has-modifications .item-icon-container [data-lucide],
.history-item.has-modifications .item-icon-container svg {
    color: #ff4d4d !important;
    opacity: 1 !important;
    filter: drop-shadow(0 0 8px rgba(255, 77, 77, 0.6)) !important;
}

/* --- CAR LIST ACCORDION & LAYOUT STYLES --- */
.initial-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 32px;
    align-items: stretch;
    width: 100%;
    transition: var(--transition);
}

.drop-zone-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.drop-zone-wrapper .drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

@media (max-width: 1100px) {
    .initial-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.car-list-panel {
    background: var(--sidebar-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    display: flex;
    flex-direction: column;
    gap: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.car-list-panel .panel-header {
    background: none !important;
    border-bottom: none !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    height: auto !important;
    box-sizing: content-box !important;
    gap: 6px !important;
}

.car-list-panel .panel-header .header-title {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: var(--accent) !important;
}

.car-list-panel .panel-header .header-title i {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    filter: drop-shadow(0 0 8px var(--accent-glow)) !important;
}

.car-list-panel .panel-header h3 {
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    color: white !important;
    margin: 0 !important;
    text-shadow: none !important;
    font-family: inherit !important;
}

.car-list-panel .panel-header p {
    display: block !important;
    font-size: 11px !important;
    color: var(--text-secondary) !important;
    line-height: 1.4 !important;
}

.car-list-panel .panel-header::after {
    display: none !important;
}

.search-bar-ecu {
    position: relative;
    display: flex !important;
    align-items: center !important;
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 0 14px !important;
    margin: 0 !important;
    height: auto !important;
    box-sizing: border-box !important;
    transition: var(--transition) !important;
}

.search-bar-ecu:focus-within {
    border-color: var(--accent) !important;
    box-shadow: 0 0 12px var(--accent-glow) !important;
    background: rgba(0, 0, 0, 0.5) !important;
}

.search-bar-ecu i,
.search-bar-ecu svg {
    color: var(--text-secondary) !important;
    width: 14px !important;
    height: 14px !important;
    margin-right: 10px !important;
    flex-shrink: 0 !important;
}

.search-bar-ecu input {
    background: none !important;
    border: none !important;
    outline: none !important;
    color: white !important;
    padding: 10px 0 !important;
    padding-right: 32px !important;
    font-size: 14px !important;
    font-family: inherit;
    flex: 1 !important;
    width: 0 !important;
    height: auto !important;
}

.clear-search-btn {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: none !important;
    border: none !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px !important;
    border-radius: 50% !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    opacity: 0.7;
    z-index: 5 !important;
}

.clear-search-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--accent) !important;
    opacity: 1;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 0 8px var(--accent-glow) !important;
}

.clear-search-btn i {
    width: 14px !important;
    height: 14px !important;
    margin-right: 0 !important;
}

.keyboard-hint {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 10px !important;
    color: var(--text-secondary) !important;
    margin-top: 6px !important;
    margin-bottom: 2px !important;
    opacity: 0.7 !important;
    background: none !important;
    border-bottom: none !important;
    padding: 0 !important;
}

.keyboard-hint i {
    width: 12px !important;
    height: 12px !important;
    color: var(--accent) !important;
}

.brand-accordion {
    flex: 1 !important;
    background: transparent !important;
    background-image: none !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    overflow-y: auto !important;
    border: none !important;
}

.brand-accordion::-webkit-scrollbar {
    width: 12px !important;
}

.brand-accordion::-webkit-scrollbar-track {
    background: transparent !important;
    border: none !important;
}

.brand-accordion::-webkit-scrollbar-thumb {
    background: rgba(208, 83, 83, 0.55) !important;
    border: 2px solid transparent !important;
    background-clip: padding-box !important;
    border-radius: 20px !important;
    min-height: 80px !important;
}

.brand-accordion::-webkit-scrollbar-thumb:hover {
    background: rgba(208, 83, 83, 0.85) !important;
    border: 2px solid transparent !important;
    background-clip: padding-box !important;
}

.brand-accordion::-webkit-scrollbar-button:single-button {
    display: none !important;
}

.accordion-item {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    transition: none !important;
}

.accordion-item:hover {
    background: transparent !important;
    border-color: transparent !important;
}

.accordion-header {
    height: 70px !important;
    padding: 0 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    cursor: pointer !important;
    user-select: none !important;
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.015) !important;
    position: relative !important;
    transition: none !important;
}

.accordion-item.active .accordion-header {
    background: rgba(255, 255, 255, 0.02) !important;
}

.accordion-header::before {
    display: none !important;
}

.accordion-header .chevron {
    display: none !important;
}

.accordion-header .tree-arrow {
    width: 0 !important;
    height: 0 !important;
    border-top: 4px solid transparent !important;
    border-bottom: 4px solid transparent !important;
    border-left: 6px solid #6b7280 !important;
    margin-right: 8px !important;
    transition: transform 0.15s ease !important;
    display: inline-block !important;
    transform-origin: 3px 4px !important;
}

.accordion-item.active .accordion-header .tree-arrow {
    transform: rotate(90deg) !important;
    border-left-color: #38bdf8 !important;
}

.brand-logo-svg {
    height: 60px !important;
    width: 60px !important;
    margin-right: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.025) 70%, transparent 100%) !important;
    border-radius: 14px !important;
    overflow: hidden !important;
}

.brand-logo-svg svg,
.brand-logo-svg img {
    height: 46px !important;
    width: 46px !important;
    object-fit: contain !important;
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.12)) drop-shadow(0px 2px 4px rgba(0,0,0,0.5)) !important;
    transition: transform 0.2s ease !important;
}

.accordion-item:hover .brand-logo-svg svg,
.accordion-item:hover .brand-logo-svg img {
    transform: scale(1.1);
}

/* Per-brand scale adjustments for logos with internal padding */
.accordion-item[data-brand="NISSAN"] .brand-logo-svg img,
.accordion-item[data-brand="VOLVO"] .brand-logo-svg img {
    transform: scale(1.4) !important;
}
.accordion-item[data-brand="NISSAN"]:hover .brand-logo-svg img,
.accordion-item[data-brand="VOLVO"]:hover .brand-logo-svg img {
    transform: scale(1.55) !important;
}

/* FORD Custom Scale (Oval shape, shrink to prevent clipping on focus/hover) */
.accordion-item[data-brand="FORD"] .brand-logo-svg img {
    transform: scale(1.1) !important;
}
.accordion-item[data-brand="FORD"]:hover .brand-logo-svg img {
    transform: scale(1.2) !important;
}

/* IVECO Logo Filter: Pastel Blue (#a0c4ff) */
.accordion-item[data-brand="IVECO"] .brand-logo-svg img {
    filter: invert(79%) sepia(21%) saturate(1072%) hue-rotate(188deg) brightness(102%) contrast(101%) !important;
}

/* IVECO Custom Scale (SVG Text version) */
.accordion-item[data-brand="IVECO"] .brand-logo-svg svg {
    transform: scale(1.22) !important;
}
.accordion-item[data-brand="IVECO"]:hover .brand-logo-svg svg {
    transform: scale(1.35) !important;
}

/* JEEP Metallic/Silver filter */
.accordion-item[data-brand="JEEP"] .brand-logo-svg img {
    filter: invert(1) brightness(1.2) !important;
}

/* TOYOTA Custom Scale (Shrink to fit) */
.accordion-item[data-brand="TOYOTA"] .brand-logo-svg svg {
    transform: scale(0.85) !important;
}
.accordion-item[data-brand="TOYOTA"]:hover .brand-logo-svg svg {
    transform: scale(0.95) !important;
}

.accordion-header .brand-name {
    font-size: 12px !important;
    font-weight: 800 !important;
    color: #a1a1aa !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.accordion-item:hover .accordion-header .brand-name {
    color: #e4e4e7 !important;
}

.accordion-item.active .accordion-header .brand-name {
    color: #f4f4f5 !important;
}

.brand-accordion .accordion-content {
    border-left: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    background: transparent !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.2s ease !important;
    border-top: none !important;
}

.accordion-item.active .accordion-content {
    max-height: 1000px !important;
    border-top-color: transparent !important;
}

.ecu-row {
    height: 34px !important;
    padding: 0 10px 0 38px !important;
    display: flex;
    align-items: center !important;
    justify-content: flex-start !important;
    background: transparent !important;
    border-bottom: none !important;
    cursor: pointer !important;
    transition: none !important;
}

.ecu-row::before {
    display: none !important;
}

.ecu-row .ecu-name {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    color: #38bdf8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-shadow: 0 0 1px rgba(56, 189, 248, 0.2) !important;
    transition: color 0.15s ease !important;
}

.ecu-row:hover .ecu-name {
    color: #60a5fa !important;
    text-shadow: 0 0 4px rgba(96, 165, 250, 0.4) !important;
}

.ecu-badges {
    display: none !important;
}

.accordion-header.tree-focused {
    background: rgba(56, 189, 248, 0.15) !important;
    border-left: none !important;
    padding-left: 10px !important;
}

.ecu-row.tree-focused {
    background: rgba(56, 189, 248, 0.2) !important;
    border-left: none !important;
    padding-left: 38px !important;
}

.accordion-header.tree-focused .brand-name {
    color: #ffffff !important;
}

.ecu-row.tree-focused .ecu-name {
    color: #ffffff !important;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6) !important;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
}

.compare-chevron {
    transition: transform 0.3s ease !important;
    transform: rotate(180deg) !important; /* Open (expanded) by default, pointing UP */
}

.compare-chevron.collapsed {
    transform: rotate(0deg) !important; /* Closed (collapsed), pointing DOWN */
}

/* Map Modal Format & Endianness Buttons */
.map-format-btn, .map-endian-btn {
    width: 68px !important;
    height: 26px !important;
    font-size: 11px !important;
    background: none !important;
    border: none !important;
    border-radius: 6px !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

.map-format-btn:hover, .map-endian-btn:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.map-format-btn.active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.map-endian-btn.active {
    background: rgba(255, 159, 67, 0.15) !important;
    color: #ff9f43 !important;
    border: 1px solid rgba(255, 159, 67, 0.25) !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(255, 159, 67, 0.05) !important;
}

/* Compare Table Tight Row Spacing Gaps */
.compare-table td {
    padding: 8px 12px !important;
    font-size: 13px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
    color: white !important;
}

.compare-table th {
    padding: 8px 12px !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #b54545 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.user-lang-btn:hover {
    border-color: rgba(255, 255, 255, 0.25) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-1px);
}

.user-lang-btn.active {
    border-color: var(--accent) !important;
    background: rgba(208, 83, 83, 0.15) !important;
    box-shadow: 0 0 10px rgba(208, 83, 83, 0.4) !important;
}

/* --- SUPPORT CARD BUTTONS & TRANSITIONS --- */

.btn-support-analyze {
    padding: 6px 12px;
    font-size: 14px;
    background: rgba(208, 83, 83, 0.15) !important;
    border: 1px solid rgba(208, 83, 83, 0.3) !important;
    color: #e28b8b !important;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease-in-out !important;
}

.btn-support-analyze:hover {
    background: rgba(208, 83, 83, 0.3) !important;
    border-color: rgba(208, 83, 83, 0.5) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(208, 83, 83, 0.25) !important;
}

.btn-support-download {
    padding: 6px 12px;
    font-size: 14px;
    background: rgba(34, 197, 94, 0.15) !important;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
    color: #4ade80 !important;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease-in-out !important;
}

.btn-support-download:hover {
    background: rgba(34, 197, 94, 0.3) !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.25) !important;
}

.btn-support-chat {
    padding: 6px 14px;
    font-size: 14px;
    background: rgba(34, 197, 94, 0.15) !important;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
    color: #4ade80 !important;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 600;
    position: relative;
    transition: all 0.2s ease-in-out !important;
}

.btn-support-chat:hover {
    background: rgba(34, 197, 94, 0.3) !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.25) !important;
}

.btn-support-read {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    color: #e28b8b !important;
    border: 1px solid rgba(208, 83, 83, 0.3) !important;
    background: rgba(208, 83, 83, 0.05) !important;
    font-weight: 600;
    transition: all 0.2s ease-in-out !important;
}

.btn-support-read:hover {
    background: rgba(208, 83, 83, 0.2) !important;
    border-color: rgba(208, 83, 83, 0.5) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(208, 83, 83, 0.2) !important;
}

.resolve-support-select {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-secondary) !important;
    outline: none;
    transition: all 0.2s ease-in-out !important;
}

.resolve-support-select:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
}

/* --- UNREAD CHAT NEON GLOW & PULSING BADGE --- */

.btn-support-chat.has-unread {
    background: rgba(34, 197, 94, 0.3) !important;
    border-color: #4ade80 !important;
    color: #fff !important;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.6) !important;
    animation: support-chat-pulse 2s infinite ease-in-out;
}

@keyframes support-chat-pulse {
    0% {
        box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.8), 0 0 30px rgba(34, 197, 94, 0.4);
    }
    100% {
        box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
    }
}

.unread-badge-dot {
    display: none !important;
}

@keyframes unread-dot-pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 6px #22c55e;
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 14px #22c55e, 0 0 20px #22c55e;
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 6px #22c55e;
    }
}

/* Unread ticket premium card style (matches open ticket styling for consistency) */
.history-item.ticket-unread {
    background: rgba(255, 51, 51, 0.045) !important;
    border-color: rgba(255, 51, 51, 0.2) !important;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.08) !important;
    position: relative;
}

/* Elegant vertical green bar on the left edge to indicate unread messages */
.history-item.ticket-unread::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    bottom: -1px;
    width: 30px;
    background: #22c55e !important;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    z-index: 2;
}

.history-item.ticket-unread:hover {
    background: rgba(255, 51, 51, 0.09) !important;
    border-color: rgba(255, 51, 51, 0.4) !important;
    box-shadow: 0 0 16px rgba(255, 51, 51, 0.22) !important;
}

/* --- Dynamic Request Support Button States --- */
#request-support-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Offline state (Red theme) */
#request-support-btn.support-offline {
    background: rgba(255, 51, 51, 0.05) !important;
    border: 1px solid rgba(255, 51, 51, 0.2) !important;
    color: #f87171 !important;
    box-shadow: none !important;
}

#request-support-btn.support-offline:hover {
    background: rgba(255, 51, 51, 0.1) !important;
    border-color: rgba(255, 51, 51, 0.5) !important;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.2) !important;
}

/* Online state (Green theme - matches premium download button) */
#request-support-btn.support-online {
    background: rgba(34, 197, 94, 0.05) !important;
    border: 1px solid rgba(34, 197, 94, 0.2) !important;
    color: #4ade80 !important;
    box-shadow: none !important;
}

#request-support-btn.support-online:hover {
    background: rgba(34, 197, 94, 0.1) !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.2) !important;
}


.close-admin-btn {
    position: absolute !important;
    right: 16px !important;
    top: 16px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    z-index: 10 !important;
    transition: all 0.2s !important;
    padding: 0 !important;
}

.close-admin-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.close-admin-btn i,
.close-admin-btn svg {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
}

.mobile-only-profile-actions {
    display: none;
}

.admin-only-btn {
    display: none !important;
}

body[data-user-role="admin"] .admin-only-btn {
    display: flex !important;
}

/* ==========================================
   PREMIUM MOBILE COMPATIBILITY & RESPONSIVE ENGINE
   ========================================== */

/* Show bottom navigation bar on mobile */
@media (max-width: 1000px) {
    body {
        height: 100vh !important;
        height: 100dvh !important;
    }

    .app-container {
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important;
    }

    .main-content {
        height: calc(100vh - 64px - env(safe-area-inset-bottom)) !important;
        height: calc(100dvh - 64px - env(safe-area-inset-bottom)) !important;
        padding: 10px 7px 80px !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
    }

    .mobile-bottom-nav {
        display: flex !important;
    }

    /* Stack grid structures on mobile */
    .profile-form-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .mobile-only-profile-actions {
        display: flex !important;
    }
    
    /* Optimize brand list scroll and size */
    .car-list-panel {
        height: auto !important;
        max-height: 380px !important;
        margin-bottom: 0 !important;
    }
    
    .drop-zone-wrapper {
        height: 180px !important;
    }

    .drop-zone {
        padding: 12px 16px !important;
        border-radius: 16px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
    }

    .drop-zone img {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 2px !important;
    }

    .drop-zone h3 {
        font-size: 12px !important;
        margin: 0 !important;
    }

    .drop-zone p {
        font-size: 10px !important;
        margin: 0 !important;
    }

    .drop-zone .btn-primary {
        margin-top: 2px !important;
        padding: 6px 12px !important;
        font-size: 11px !important;
        height: auto !important;
        width: auto !important;
    }

    .initial-layout {
        gap: 10px !important;
    }

    .top-header {
        margin-bottom: 24px !important;
    }

    .top-header h1 {
        font-size: 24px !important;
    }

    /* Admin view scroll & style overrides on mobile */
    .admin-view {
        height: auto !important;
        min-height: 100% !important;
        padding: 16px !important;
        border-radius: 20px !important;
        margin: 0 !important;
        border: 1px solid var(--glass-border) !important;
        background: var(--sidebar-bg) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
        backdrop-filter: blur(10px) !important;
        position: relative !important;
    }

    .close-admin-btn {
        display: flex !important;
    }

    .admin-table-wrapper {
        height: auto !important;
        overflow-y: visible !important;
        flex: none !important;
    }

    /* Analysis Screen panels padding and layout styling overrides for mobile */
    .analysis-compact-section, .modifications-section {
        padding: 7px !important;
        border-radius: 12px !important;
    }

    .modifications-grid {
        gap: 4px !important;
    }
    
    .mod-tile {
        height: 38px !important;
    }

    .mod-icon-box {
        width: 32px !important;
        padding: 2px 0 !important;
    }

    .mod-icon-box i {
        width: 14px !important;
        height: 14px !important;
    }

    .mod-indicator {
        font-size: 6px !important;
        padding: 0px 2px !important;
        margin-top: 1px !important;
    }

    .mod-info {
        padding: 0 4px !important;
    }

    .mod-name {
        font-size: 10px !important;
    }

    .mod-status {
        font-size: 7px !important;
        margin-top: 0px !important;
    }
}

@media (max-width: 1000px) {
    /* Responsive Dialogs & Modals */
    .modal {
        align-items: flex-start !important;
        padding-bottom: calc(64px + env(safe-area-inset-bottom) + 16px) !important;
        box-sizing: border-box !important;
    }

    .modal-content {
        width: 94% !important;
        max-width: 100% !important;
        margin: 16px auto !important;
        padding: 20px 16px !important;
        max-height: calc(100dvh - 32px - 64px - env(safe-area-inset-bottom) - 16px) !important;
    }
    
    /* Adjust general table paddings on small viewports */
    .admin-table th, .admin-table td {
        padding: 10px 12px !important;
        font-size: 12px !important;
    }

    /* Interactive Hex Compare Monitor size tuning */
    #compare-hex-modal .modal-content {
        height: calc(100dvh - 32px - 64px - env(safe-area-inset-bottom)) !important;
        width: 96% !important;
    }

    /* --- MOBILE SUPPORT TICKET SYSTEM & DIALOG OVERRIDES --- */
    
    /* Support ticket cards unread vertical green bar spacing fix */
    .history-item.ticket-unread {
        padding-left: 44px !important;
    }

    /* General support ticket cards stack style on mobile */
    #user-support-table-body .history-item,
    #support-table-body .history-item {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 16px !important;
        gap: 12px !important;
        border-radius: 16px !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    /* Ensure user support ticket cards that are not unread have regular padding-left */
    #user-support-table-body .history-item:not(.ticket-unread),
    #support-table-body .history-item:not(.ticket-unread) {
        padding-left: 16px !important;
    }

    /* Reset absolute positioning on card icon container */
    #user-support-table-body .history-item .item-icon-container,
    #support-table-body .history-item .item-icon-container {
        position: static !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        gap: 4px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        padding: 0 0 10px 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
        background: transparent !important;
        border-radius: 0 !important;
        height: auto !important;
    }

    /* Allow user emails inside ticket header to break/wrap */
    #support-table-body .history-item .user-email-title {
        white-space: normal !important;
        word-break: break-all !important;
    }

    /* Stack inner columns vertically */
    #user-support-table-body .history-item .item-info,
    #support-table-body .history-item .item-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        width: 100% !important;
    }

    #user-support-table-body .history-item .note-column,
    #support-table-body .history-item .note-column {
        padding-right: 0 !important;
        max-height: none !important;
        -webkit-line-clamp: unset !important;
        display: block !important;
        word-break: break-word !important;
    }

    #user-support-table-body .history-item .file-column,
    #support-table-body .history-item .file-column {
        flex: none !important;
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    #user-support-table-body .history-item .screenshot-column,
    #support-table-body .history-item .screenshot-column {
        width: 100% !important;
        justify-content: flex-start !important;
        flex: none !important;
        margin-top: 4px !important;
    }

    /* Card action footer for mobile */
    #user-support-table-body .history-item .item-right,
    #support-table-body .history-item .item-right {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 4px !important;
        padding-top: 12px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
        flex: none !important;
    }

    /* Stretch buttons & selects to divide row width equally on admin list */
    #support-table-body .history-item .item-right select,
    #support-table-body .history-item .item-right button {
        flex: 1 !important;
        width: 100% !important;
        margin: 0 !important;
    }

    #support-table-body .history-item .item-right {
        gap: 10px !important;
    }

    /* Support Chat Modal - Full screen, flush above bottom nav */
    #support-chat-modal {
        padding: 0 !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100% - 64px - env(safe-area-inset-bottom)) !important;
        height: calc(100dvh - 64px - env(safe-area-inset-bottom)) !important;
    }
    #support-chat-modal .modal-content {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    #chat-ticket-title {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 180px !important;
    }

    /* Support Request Modal layouts */
    .support-dropdown-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .support-upload-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center !important;
    }

    .support-upload-bar div {
        align-items: center !important;
    }

    .support-upload-bar button {
        width: 100% !important;
        justify-content: center !important;
    }

    .modal-action-buttons {
        flex-direction: column-reverse !important;
    }

    .modal-action-buttons button {
        width: 100% !important;
        justify-content: center !important;
    }

    /* --- MOBILE USER MANAGEMENT SCREEN OVERRIDES --- */
    
    /* Operations Button Bar Grid Layout on mobile */
    .admin-button-bar {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
        width: 100% !important;
    }

    .admin-button-bar button {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
    }

    /* General user management cards stack style on mobile */
    #user-table-body .history-item {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 16px !important;
        gap: 12px !important;
        border-radius: 16px !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    /* Mobile specific selected user row visual state override */
    #user-table-body .history-item.selected-user-row {
        background: rgba(255, 51, 51, 0.04) !important;
        border-color: rgba(255, 51, 51, 0.25) !important;
        box-shadow: 0 4px 15px rgba(255, 51, 51, 0.15) !important;
    }

    /* Reset absolute positioning on card icon container for users list */
    #user-table-body .history-item .item-icon-container {
        position: static !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        padding: 0 0 10px 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
        background: transparent !important;
        border-radius: 0 !important;
        height: auto !important;
    }

    #user-table-body .history-item .item-icon-container .icon-circle {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    /* Stack inner columns vertically */
    #user-table-body .history-item .item-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        width: 100% !important;
    }

    #user-table-body .history-item .title-column,
    #user-table-body .history-item .email-column,
    #user-table-body .history-item .phone-column {
        flex: none !important;
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    #user-table-body .history-item .title-column {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 2px !important;
    }

    #user-table-body .history-item h4 {
        padding-left: 0 !important;
        justify-content: center !important;
        text-align: center !important;
    }

    #user-table-body .history-item .flag-column {
        margin-left: 0 !important;
        margin-top: 4px !important;
    }

    /* Footer border for user cards on mobile */
    #user-table-body .history-item .item-right {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 4px !important;
        padding-top: 10px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
        flex: none !important;
    }

    /* User details modal responsive modifications */
    #user-details-modal .modal-content {
        max-height: 90dvh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #user-details-modal .modal-header h3 {
        font-size: 16px !important;
    }

    #close-user-details-modal {
        padding: 8px !important;
        margin: -8px !important;
    }

    #user-details-modal .modal-body {
        overflow-y: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    .user-details-summary-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Keep stats cards horizontal on mobile with smaller padding and fonts to save height */
    .user-details-stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .user-details-stats-grid > div {
        padding: 10px 4px !important;
        border-radius: 8px !important;
    }

    .user-details-stats-grid > div i {
        width: 18px !important;
        height: 18px !important;
        margin-bottom: 4px !important;
    }

    .user-details-stats-grid > div span:nth-of-type(1) {
        font-size: 10px !important;
    }

    .user-details-stats-grid > div span:nth-of-type(2) {
        font-size: 18px !important;
        margin-top: 2px !important;
    }

    /* Maintain row layout for key-values on mobile to keep it compact, but wrap values cleanly */
    #user-details-modal .modal-body div[style*="display: flex; justify-content: space-between"],
    #user-details-modal .modal-body div[style*="display:flex; justify-content:space-between"] {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        padding-bottom: 8px !important;
    }

    #user-details-modal .modal-body div[style*="display: flex; justify-content: space-between"] span:last-child,
    #user-details-modal .modal-body div[style*="display:flex; justify-content:space-between"] span:last-child {
        text-align: right !important;
        max-width: 70% !important;
        word-break: break-all !important;
    }

    /* Ensure flex phone number aligns content to the right end */
    #detail-user-phone {
        justify-content: flex-end !important;
    }
    
    .activity-history-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .activity-history-header h4 {
        white-space: nowrap !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .activity-history-actions {
        flex-direction: column !important;
        width: 100% !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    
    .activity-history-actions .search-container,
    .activity-history-actions select {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* Eliminate nested vertical scrolls by setting height to none/visible, while keeping horizontal scroll */
    #user-details-modal .compare-table-wrapper {
        overflow-x: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    #user-details-modal table {
        min-width: 600px !important;
    }

    /* User form submit button full width on mobile */
    #user-form div[style*="justify-content: flex-end"] {
        justify-content: stretch !important;
    }

    #user-form div[style*="justify-content: flex-end"] button {
        width: 100% !important;
    }

    /* ---- USER MANAGEMENT MODAL (ADD/EDIT) - MOBILE RESPONSIVE ---- */
    #user-modal .modal-content {
        max-height: calc(100dvh - 16px - 64px - env(safe-area-inset-bottom)) !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 16px !important;
        overflow: hidden !important;
    }

    #user-modal .modal-header {
        flex-shrink: 0 !important;
        margin-bottom: 12px !important;
        padding-bottom: 10px !important;
    }

    #user-modal .modal-header h3 {
        font-size: 16px !important;
    }

    #user-modal .modal-body {
        overflow-y: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Collapse form grid to single column on mobile */
    #user-form > div[style*="grid-template-columns"],
    #user-form div[style*="repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    /* All form groups take full width */
    #user-form .form-group {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Inputs full width */
    #user-form input,
    #user-form select {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Language selector buttons - smaller on mobile */
    #user-form .user-language-selector {
        gap: 6px !important;
    }

    #user-form .user-lang-btn {
        height: 36px !important;
    }

    /* Extend year button */
    #extend-year-btn {
        height: 36px !important;
        font-size: 13px !important;
    }
}

/* Bottom Navigation Bar Core styles */
.mobile-bottom-nav {
    display: none; /* hidden by default on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(12, 13, 20, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: space-around;
    align-items: center;
    z-index: 99999;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 6px 12px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 60px;
    text-align: center;
    opacity: 0.7;
}

.mobile-bottom-nav .nav-item span {
    margin-left: 0 !important;
}

.mobile-bottom-nav .nav-item i,
.mobile-bottom-nav .nav-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--accent) !important;
    opacity: 1 !important;
}

.mobile-bottom-nav .nav-item.active i,
.mobile-bottom-nav .nav-item.active svg {
    color: var(--accent) !important;
    filter: drop-shadow(0 0 5px rgba(255, 51, 51, 0.5));
}

/* Unread ticket premium card style (matches open ticket styling for consistency) */
.history-item.ticket-unread {
    background: rgba(255, 51, 51, 0.045) !important;
    border-color: rgba(255, 51, 51, 0.2) !important;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.08) !important;
    position: relative;
}

/* Elegant vertical green bar on the left edge to indicate unread messages */
.history-item.ticket-unread::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    bottom: -1px;
    width: 30px;
    background: #22c55e !important;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    z-index: 2;
}

.history-item.ticket-unread:hover {
    background: rgba(255, 51, 51, 0.09) !important;
    border-color: rgba(255, 51, 51, 0.4) !important;
    box-shadow: 0 0 16px rgba(255, 51, 51, 0.22) !important;
}

/* --- Dynamic Request Support Button States --- */
#request-support-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Offline state (Red theme) */
#request-support-btn.support-offline {
    background: rgba(255, 51, 51, 0.05) !important;
    border: 1px solid rgba(255, 51, 51, 0.2) !important;
    color: #f87171 !important;
    box-shadow: none !important;
}

#request-support-btn.support-offline:hover {
    background: rgba(255, 51, 51, 0.1) !important;
    border-color: rgba(255, 51, 51, 0.5) !important;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.2) !important;
}

/* Online state (Green theme - matches premium download button) */
#request-support-btn.support-online {
    background: rgba(34, 197, 94, 0.05) !important;
    border: 1px solid rgba(34, 197, 94, 0.2) !important;
    color: #4ade80 !important;
    box-shadow: none !important;
}

#request-support-btn.support-online:hover {
    background: rgba(34, 197, 94, 0.1) !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.2) !important;
}

/* --- PREMIUM MOBILE HISTORY SCREEN OVERRIDES --- */
@media (max-width: 1000px) {
    .search-container,
    .search-bar-ecu {
        width: 100% !important;
        max-width: 100% !important;
    }
    /* History Section Container overrides */
    .history-section {
        height: auto !important;
        min-height: 100% !important;
        padding: 16px !important;
        border-radius: 20px !important;
        margin: 0 !important;
        border: 1px solid var(--glass-border) !important;
        background: var(--sidebar-bg) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
        backdrop-filter: blur(10px) !important;
    }

    .list-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .list-header h1 {
        font-size: 22px !important;
        margin: 0 !important;
    }

    .list-header .header-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .list-header .search-container,
    .list-header .search-bar-ecu {
        width: 100% !important;
        height: auto !important;
    }

    .clear-search-btn {
        display: none !important;
    }

    .list-header select,
    .list-header .custom-select-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    .list-header .header-actions button {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        justify-content: center !important;
        height: 38px !important;
    }

    /* History Button Bar Grid Layout */
    .history-button-bar {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
        width: 100% !important;
    }

    .history-button-bar button {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
        height: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
    }

    /* Custom layout specifically for the delete and clear buttons */
    #admin-delete-history-btn {
        margin-left: 0 !important; /* override desktop auto-left */
    }

    /* History Items - Mobile Optimized Premium Cards */
    .history-list {
        padding: 4px 2px 20px 2px !important;
        gap: 10px !important;
        height: auto !important;
        overflow: visible !important;
    }

    .history-item {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 14px !important;
        gap: 10px !important;
        border-radius: 16px !important;
    }

    .history-item .item-icon-container {
        position: absolute !important;
        top: 14px !important;
        left: 14px !important;
        width: 36px !important;
        height: 36px !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border-radius: 10px !important;
        z-index: 2;
    }

    .history-item .item-icon-container i,
    .history-item .item-icon-container svg {
        width: 20px !important;
        height: 20px !important;
    }

    .history-item .item-info {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .history-item h4 {
        padding-left: 44px !important;
        min-height: 36px !important;
        display: flex !important;
        align-items: center !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: break-all !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        color: #ffffff !important;
        margin: 0 !important;
    }

    .history-item .item-meta {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
        margin-top: 0 !important;
    }

    .history-item .meta-badge {
        display: flex !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        align-items: center !important;
        width: 100% !important;
        padding: 6px 10px !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid rgba(255, 255, 255, 0.04) !important;
        border-radius: 8px !important;
        margin: 0 !important;
        font-size: 12px !important;
        box-sizing: border-box !important;
    }

    .history-item .meta-badge strong {
        color: var(--accent) !important;
        font-size: 11px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }

    /* Target the container containing admin email filter buttons in item-meta */
    .history-item .item-meta > div[style*="display: inline-flex"] {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
        margin-top: 4px !important;
    }

    .history-item .user-email-filter-btn,
    .history-item .user-email-click-badge {
        flex: 1 1 auto !important;
        justify-content: center !important;
        height: 28px !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    .history-item .item-right {
        grid-area: footer !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 4px !important;
        padding-top: 10px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    .history-item .item-date {
        font-size: 11px !important;
        color: rgba(255, 255, 255, 0.4) !important;
    }

    .history-item .btn-delete {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
    }

    /* File Analysis screen mobile responsiveness updates */
    .result-grid-mini {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .dtc-container {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .dtc-container .section-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .dtc-container .header-left {
        justify-content: flex-start !important;
        width: 100% !important;
    }

    .dtc-container .header-right {
        width: 100% !important;
    }

    .dtc-container .search-box {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .mod-name {
        font-size: 11px !important;
        font-weight: 700 !important;
        letter-spacing: 0.5px !important;
        color: #cbd5e1 !important;
    }

    .side-column-left,
    .controls-side {
        height: auto !important;
    }

    .dtc-container .table-wrapper {
        max-height: 300px !important;
        min-height: 200px !important;
    }

    .process-group {
        margin-top: 20px !important;
    }

    /* Force small helper and progress modals to remain vertically centered on mobile */
    #analysis-modal,
    #patch-success-modal,
    #global-alert-modal,
    #global-confirm-modal,
    #forgot-modal {
        align-items: center !important;
        padding-bottom: 0 !important;
    }

    #analysis-modal .modal-content,
    #patch-success-modal .modal-content,
    #global-alert-modal .modal-content,
    #global-confirm-modal .modal-content,
    #forgot-modal .modal-content {
        margin: auto !important;
        max-height: 90dvh !important;
    }

    .profile-mobile-lang-selector {
        display: flex !important;
    }

    #mobile-theme-toggle-wrap {
        display: flex !important;
    }

    /* Light Theme Mobile Overrides for Distinct Cards & Darker Text */
    body.light-theme #user-table-body .history-item,
    body.light-theme #user-support-table-body .history-item,
    body.light-theme #support-table-body .history-item {
        background: #f0f3fa !important;
        border: 1px solid rgba(0, 0, 0, 0.12) !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    }

    body.light-theme #user-table-body .history-item h4 {
        color: #0f1120 !important;
    }

    body.light-theme #user-table-body .history-item .item-icon-container,
    body.light-theme #user-support-table-body .history-item .item-icon-container,
    body.light-theme #support-table-body .history-item .item-icon-container {
        border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    body.light-theme #user-table-body .history-item .item-right,
    body.light-theme #user-support-table-body .history-item .item-right,
    body.light-theme #support-table-body .history-item .item-right {
        border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    body.light-theme .history-item .item-date {
        color: #3d4f68 !important;
    }

    body.light-theme #user-table-body .history-item .item-icon-container span {
        color: #b91c1c !important;
        background: rgba(220, 38, 38, 0.1) !important;
        border-color: rgba(220, 38, 38, 0.2) !important;
    }

    body.light-theme #user-table-body .history-item .item-icon-container .icon-circle[style*="#4ade80"] + span {
        color: #15803d !important;
        background: rgba(22, 163, 74, 0.1) !important;
        border-color: rgba(22, 163, 74, 0.2) !important;
    }

    body.light-theme #user-table-body .history-item.selected-user-row {
        background: rgba(192, 32, 32, 0.08) !important;
        border-color: rgba(192, 32, 32, 0.35) !important;
        box-shadow: 0 4px 15px rgba(192, 32, 32, 0.12) !important;
    }
}
