/* ===== NDA/CONFIDENTIALITY MODAL ===== */
.nda-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.nda-modal-content {
    background: var(--bg-card, #0d1225);
    border: 1px solid var(--jfp-orange);
    border-radius: 16px;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.nda-modal-header {
    padding: 24px 24px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.nda-shield-logo {
    height: 64px;
    width: auto;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 12px rgba(255, 105, 0, 0.3));
}

/* Dark mode: use white badge (already white) */
/* Light mode: invert to make it visible on light bg */
[data-theme="light"] .nda-shield-logo {
    filter: invert(0.15) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.nda-modal-header h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--jfp-orange);
    margin: 0;
}

.nda-modal-body {
    padding: 20px 24px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.nda-modal-body p {
    margin: 0 0 12px;
}

.nda-modal-body ul {
    margin: 12px 0;
    padding-left: 20px;
}

.nda-modal-body li {
    margin-bottom: 8px;
}

.nda-modal-footer {
    padding: 16px 24px 24px;
    text-align: center;
}

.nda-accept-btn {
    background: linear-gradient(135deg, var(--jfp-orange), #ff8533);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.nda-accept-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 105, 0, 0.3);
}

/* Persistent Confidentiality Footer */
/* C1 FIX: footer is position:fixed and overlaps chat content on mobile.
   The footer height (~38px) must be accounted for in .main padding-bottom.
   See search.css .main { padding-bottom } for the corresponding clearance. */
.confidentiality-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--jfp-navy, #0E143E) 0%, #0a1628 100%);
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 1000;
    border-top: 2px solid var(--jfp-orange, #FF6900);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}
/* Light mode: invert to light background so it doesn't clash with white page */
[data-theme="light"] .confidentiality-footer {
    background: linear-gradient(135deg, #f0f2f5 0%, #e4e8ed 100%);
    color: var(--text-primary, #0e143e);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

/* NDA Signature Section */
.nda-signature-section {
    margin-bottom: 20px;
    text-align: left;
}

.nda-signature-label {
    display: block;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.nda-signature-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 18px;
    font-family: 'Brush Script MT', 'Segoe Script', cursive, var(--font);
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    transition: all 0.2s;
}

.nda-signature-input:focus {
    outline: none;
    border-color: var(--jfp-orange);
    box-shadow: 0 0 0 3px rgba(255, 105, 0, 0.2);
}

.nda-signature-input::placeholder {
    font-family: var(--font);
    font-size: 14px;
    font-style: italic;
}

.nda-signature-legal {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.4;
    font-style: italic;
}

.nda-accept-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Add bottom padding to main content to account for footer */
.main-content {
    padding-bottom: 50px;
}

/* ===== CARD TOOLTIPS ===== */
.quick-card[data-tooltip] {
    position: relative;
    z-index: 1;
}

/* Hovered card must sit above siblings so tooltip isn't clipped behind them */
.quick-card[data-tooltip]:hover,
.quick-card[data-tooltip].tooltip-active {
    z-index: 100;
}

.card-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: var(--z-tooltip, 1000);
    min-width: 240px;
    max-width: 300px;
    padding: 14px 16px;
    background: rgba(10, 14, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 175, 210, 0.35);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 16px rgba(0, 175, 210, 0.12);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    text-align: left;
}

.card-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 175, 210, 0.35);
}

.quick-card:hover .card-tooltip,
.quick-card:focus-within .card-tooltip,
.quick-card.tooltip-active .card-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.card-tooltip-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #00AFD2;
    margin-bottom: 4px;
}

.card-tooltip-text {
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 10px;
}

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

/* Ensure tooltips on bottom cards don't go off-screen - flip above/below */
.quick-card.tooltip-flip .card-tooltip {
    bottom: auto;
    top: calc(100% + 10px);
}

.quick-card.tooltip-flip .card-tooltip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(0, 175, 210, 0.35);
}

/* Work Order Section - Always visible and prominent */
.wo-section {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(24, 144, 215, 0.05) 100%);
    border: 2px solid var(--jfp-blue);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
    display: block;
    box-shadow: 0 4px 20px rgba(24, 144, 215, 0.15);
}

.wo-section.visible {
    display: block;
}

.wo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.wo-title {
    font-size: 17px;
    font-weight: 600;
}

.wo-badge {
    font-family: var(--font-heading);
    font-size: 11px;
    background: var(--accent-cta);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wo-input-row {
    display: flex;
    gap: 12px;
}

.wo-input-row input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font);
}

.wo-skip {
    text-align: center;
    margin-top: 12px;
}

.wo-skip button {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
}

/* Enhanced Work Order Context Display */
.wo-context-panel {
    background: var(--bg-card);
    border: 1px solid var(--jfp-blue);
    border-radius: var(--radius-lg);
    margin-top: 16px;
    overflow: hidden;
}

.wo-context-header {
    background: linear-gradient(135deg, var(--jfp-blue) 0%, #1a5a96 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wo-context-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wo-context-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wo-priority-urgent {
    background: #ff3b30 !important;
}

.wo-priority-high {
    background: #ff9500 !important;
}

.wo-context-body {
    padding: 20px;
}

.wo-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.wo-info-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px;
    border-left: 3px solid var(--jfp-blue);
}

.wo-info-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.wo-info-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.wo-problem-section {
    background: linear-gradient(135deg, rgba(255, 105, 0, 0.1) 0%, rgba(255, 105, 0, 0.05) 100%);
    border: 1px solid rgba(255, 105, 0, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.wo-problem-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--jfp-orange);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wo-problem-text {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.5;
}

.wo-recommendations {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1) 0%, rgba(52, 199, 89, 0.05) 100%);
    border: 1px solid rgba(52, 199, 89, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.wo-recommendations-title {
    font-size: 13px;
    font-weight: 700;
    color: #34c759;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.wo-action-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(52, 199, 89, 0.2);
    font-size: 14px;
    color: var(--text-primary);
}

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

.wo-action-icon {
    color: #34c759;
    font-size: 16px;
    flex-shrink: 0;
}

.wo-history-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.wo-history-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--jfp-blue);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wo-history-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid var(--border);
}

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

.wo-history-problem {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wo-history-solution {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.wo-history-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.wo-parts-section {
    background: linear-gradient(135deg, rgba(88, 86, 214, 0.1) 0%, rgba(88, 86, 214, 0.05) 100%);
    border: 1px solid rgba(88, 86, 214, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.wo-parts-title {
    font-size: 13px;
    font-weight: 700;
    color: #5856d6;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wo-parts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wo-part-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(88, 86, 214, 0.15);
    border: 1px solid rgba(88, 86, 214, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-primary);
}

.wo-part-probability {
    font-size: 11px;
    color: #5856d6;
    font-weight: 600;
}

.wo-site-monitoring {
    background: linear-gradient(135deg, rgba(24, 144, 215, 0.1) 0%, rgba(24, 144, 215, 0.05) 100%);
    border: 1px solid rgba(24, 144, 215, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.wo-site-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--jfp-blue);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wo-dispenser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.wo-dispenser-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.wo-dispenser-id {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wo-dispenser-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.wo-dispenser-status.online {
    background: rgba(52, 199, 89, 0.2);
    color: #34c759;
}

.wo-dispenser-status.offline {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.wo-dispenser-status.warning {
    background: rgba(255, 149, 0, 0.2);
    color: #ff9500;
}

.wo-alerts-section {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.1) 0%, rgba(255, 59, 48, 0.05) 100%);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.wo-alerts-title {
    font-size: 13px;
    font-weight: 700;
    color: #ff3b30;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wo-alert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

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

.wo-context-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.wo-action-btn {
    flex: 1;
    min-width: 200px;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.wo-action-btn.primary {
    background: linear-gradient(135deg, var(--jfp-orange) 0%, #ff8533 100%);
    color: white;
    border: none;
}

.wo-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 105, 0, 0.3);
}

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

.wo-action-btn.secondary:hover {
    background: var(--bg-hover);
    border-color: var(--jfp-blue);
}

.wo-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.wo-loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--jfp-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

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

/* Tools Row */
.tools-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
}

.tool-link:hover {
    opacity: 0.8;
}

/* Answer Section */
#answer-section {
    display: none;
    margin-top: 32px;
}

.answer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

/* Hamburger Menu */
.hamburger-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition);
}

.hamburger-btn span {
    width: 16px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all var(--transition);
}

.hamburger-btn:hover {
    background: var(--accent-cta);
}

.hamburger-btn:hover span {
    background: white;
}

/* Light mode header controls */
[data-theme="light"] .hamburger-btn {
    background: rgba(14, 20, 62, 0.08);
}

[data-theme="light"] .hamburger-btn span {
    background: var(--jfp-navy);
}

[data-theme="light"] .hamburger-btn:hover {
    background: var(--accent-cta);
}

[data-theme="light"] .hamburger-btn:hover span {
    background: var(--jfp-navy);
}

/* Header User Avatar Button */
.header-user-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0, 175, 210, 0.5);
    background: linear-gradient(135deg, #00AFD2, #0E143E);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    transition: all var(--transition);
    position: relative;
}
.header-user-btn:hover {
    border-color: #00AFD2;
    box-shadow: 0 0 12px rgba(0, 175, 210, 0.4);
    transform: scale(1.08);
}
[data-theme="light"] .header-user-btn {
    border-color: rgba(14, 20, 62, 0.3);
}
[data-theme="light"] .header-user-btn:hover {
    border-color: #00AFD2;
}

/* Settings Popout Overlay */
.settings-popout-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(2px);
}
.settings-popout-overlay.active {
    display: block;
}

/* Settings Popout Panel */
.settings-popout {
    display: none;
    position: fixed;
    top: 60px;
    right: 16px;
    width: 340px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    z-index: 2001;
    animation: popoutSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-popout.active {
    display: block;
}
@keyframes popoutSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Popout Header (User Info) */
.settings-popout-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 175, 210, 0.15) 0%, rgba(14, 20, 62, 0.3) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}
.settings-popout-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.settings-popout-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00AFD2, #0E143E);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}
.settings-popout-identity {
    min-width: 0;
    flex: 1;
}
.settings-popout-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-popout-title {
    font-size: 12px;
    color: var(--accent);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-popout-email {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-popout-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    margin-top: -4px;
}
.settings-popout-close:hover {
    color: var(--text-primary);
}

/* Popout Body */
.settings-popout-body {
    padding: 16px 20px;
}
.settings-popout-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-popout-row:last-child {
    border-bottom: none;
}
.settings-popout-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.settings-popout-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}
.settings-popout-toggle-row .settings-popout-label {
    margin-bottom: 0;
}
.settings-popout-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}
.settings-popout-hint {
    font-size: 11px;
    color: var(--accent);
    margin-top: 4px;
    font-style: italic;
}
.settings-popout-mode-btns {
    display: flex;
    gap: 6px;
}
.settings-popout-mode-btns .settings-mode-btn {
    flex: 1;
    padding: 6px 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}

/* Toggle Switch */
.settings-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.settings-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.settings-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    transition: 0.3s;
}
.settings-toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.settings-toggle-switch input:checked + .settings-toggle-slider {
    background: #00AFD2;
}
.settings-toggle-switch input:checked + .settings-toggle-slider::before {
    transform: translateX(20px);
}

/* Auth Button */
.settings-popout-auth-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.settings-popout-auth-btn:hover {
    background: var(--accent-cta);
    color: white;
    border-color: var(--accent-cta);
}

/* H8 FIX: Advanced Settings collapsible group.
   Keeps the settings panel clean for field techs who just need dark mode
   and field mode. Power users can expand to reach language, voice, etc. */
.settings-advanced-group {
    margin: 4px 0 0;
    border: none;
}

.settings-advanced-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary, #8892a8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    list-style: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-advanced-toggle::-webkit-details-marker {
    display: none;
}

.settings-advanced-chevron {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.settings-advanced-group[open] .settings-advanced-chevron {
    transform: rotate(180deg);
}

.settings-advanced-content {
    padding-top: 4px;
}

[data-theme="light"] .settings-advanced-toggle {
    color: #757575;
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* Popout Footer */
.settings-popout-footer {
    padding: 10px 20px;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Light mode overrides */
[data-theme="light"] .settings-popout {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .settings-popout-row {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .settings-toggle-slider {
    background: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .settings-popout-footer {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .settings-popout {
        right: 8px;
        left: 8px;
        width: auto;
        top: 56px;
    }
}

[data-theme="light"] .theme-toggle label {
    background: rgba(14, 20, 62, 0.08);
}

[data-theme="light"] .theme-toggle label:hover {
    background: var(--accent-cta);
}

/* Settings Toggle Switches */
#settings-theme-toggle:checked + #theme-slider,
#settings-notifications-toggle:checked + .toggle-slider {
    background: var(--accent-cta, #00AFD2);
}
#theme-slider::before, .toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
#settings-theme-toggle:checked + #theme-slider::before,
#settings-notifications-toggle:checked + .toggle-slider::before {
    transform: translateX(20px);
}
.settings-mode-btn.active {
    background: var(--accent-cta, #00AFD2) !important;
    border-color: var(--accent-cta, #00AFD2) !important;
    color: white !important;
    font-weight: 700;
}

/* Mobile Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2000;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-menu {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100%;
    background: var(--bg-primary);
    z-index: 2001;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.side-menu.active {
    right: 0;
}

.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.side-menu-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.side-menu-section {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.side-menu-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.side-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    transition: all var(--transition);
}

.side-menu-item:hover {
    color: var(--accent);
}

/* H1/H9 FIX: version label in side menu (was inline style) */
.side-menu-version {
    padding: 8px 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Footer */
.footer {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-tertiary);
    font-size: 13px;
}

.footer-logo {
    height: 36px;
    width: auto;
    margin: 0 auto 12px auto;
    opacity: 0.6;
}

/* Theme-aware logos - inline-block for proper centering */
.logo-light { display: none !important; }
.logo-dark { display: inline-block !important; }

[data-theme="light"] .logo-light { display: inline-block !important; }
[data-theme="light"] .logo-dark { display: none !important; }
[data-theme="dark"] .logo-light { display: none !important; }
[data-theme="dark"] .logo-dark { display: inline-block !important; }

/* ===== VIEW MODE SYSTEM ===== */
/* Basic Mode: Clean, minimal - just search and quick actions */
/* Advanced Mode: + SentryTech insights, vehicle/equipment context, more filters */
/* Expert Mode: + Geotab, weather, Elastic raw access, diagnostics */

/* Basic-only elements: visible in basic mode, hidden otherwise */
.mode-basic-only { display: block; }
[data-mode="advanced"] .mode-basic-only,
[data-mode="expert"] .mode-basic-only,
[data-mode="dashboard"] .mode-basic-only,
[data-mode="executive"] .mode-basic-only,
[data-mode="sales"] .mode-basic-only,
[data-mode="admin"] .mode-basic-only { display: none !important; }

.mode-advanced, .mode-advanced-flex, .mode-expert, .mode-expert-flex, .mode-dashboard, .mode-dashboard-tabbed, .mode-executive, .mode-sales, .mode-admin { display: none !important; }
[data-mode="advanced"] .mode-advanced { display: block !important; }
[data-mode="advanced"] .mode-advanced-flex { display: flex !important; }
[data-mode="expert"] .mode-advanced,
[data-mode="expert"] .mode-expert { display: block !important; }
[data-mode="expert"] .mode-advanced-flex,
[data-mode="expert"] .mode-expert-flex { display: flex !important; }
[data-mode="dashboard"] .mode-dashboard,
[data-mode="dashboard"] .mode-dashboard-tabbed { display: block !important; }
[data-mode="executive"] .mode-dashboard,
[data-mode="executive"] .mode-executive { display: block !important; }
[data-mode="sales"] .mode-dashboard,
[data-mode="sales"] .mode-sales { display: block !important; }
[data-mode="admin"] .mode-dashboard,
[data-mode="admin"] .mode-admin { display: block !important; }

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius, 12px);
    margin-bottom: 24px;
}
.dashboard-tab {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(0, 180, 255, 0.2);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}
.dashboard-tab:hover { color: #00d4ff; background: rgba(0, 180, 255, 0.1); }
.dashboard-tab.active {
    background: linear-gradient(135deg, #0091ff 0%, #00d4ff 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
}
.dashboard-tab-content { display: none; }
.dashboard-tab-content.active { display: block; }

/* Time range selector bar */
.dashboard-range-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: rgba(0, 175, 210, 0.05);
    border: 1px solid rgba(0, 175, 210, 0.15);
    border-radius: 8px;
}
.dashboard-range-btn {
    padding: 4px 14px;
    border: 1px solid rgba(0, 175, 210, 0.3);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary, #a0aec0);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.dashboard-range-btn:hover {
    color: #00d4ff;
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}
.dashboard-range-btn.active {
    background: linear-gradient(135deg, #0091ff, #00d4ff);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}
[data-theme="light"] .dashboard-range-bar {
    background: rgba(14, 20, 62, 0.03);
    border-color: rgba(14, 20, 62, 0.1);
}
[data-theme="light"] .dashboard-range-btn {
    color: #4a5568;
    border-color: rgba(14, 20, 62, 0.2);
}

/* Dashboard 2-column grid for chart pairs */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* Dashboard table styling */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dashboard-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    border-bottom: 1px solid rgba(0, 180, 255, 0.2);
}
.dashboard-table td {
    padding: 10px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.dashboard-table tr:hover td {
    background: rgba(0, 180, 255, 0.05);
}
[data-theme="light"] .dashboard-table td {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .dashboard-table tr:hover td {
    background: rgba(24, 144, 215, 0.04);
}

/* ATG Fleet KPI chips */
.atg-kpi-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(0, 180, 255, 0.1);
    border: 1px solid rgba(0, 180, 255, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}
.atg-kpi-val {
    font-weight: 700;
    color: #00d4ff;
    font-size: 14px;
}
.atg-kpi-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}
.atg-badge-warn {
    background: rgba(255, 149, 0, 0.15);
    color: #FF9500;
    border: 1px solid rgba(255, 149, 0, 0.3);
}
.atg-badge-crit {
    background: rgba(255, 59, 48, 0.15);
    color: #FF3B30;
    border: 1px solid rgba(255, 59, 48, 0.3);
}
.atg-badge-ok {
    background: rgba(52, 199, 89, 0.15);
    color: #34C759;
    border: 1px solid rgba(52, 199, 89, 0.3);
}
[data-theme="light"] .atg-kpi-chip {
    background: rgba(24, 144, 215, 0.08);
    border-color: rgba(24, 144, 215, 0.2);
}
[data-theme="light"] .atg-kpi-val {
    color: #0078D4;
}

/* Tank Gauge site cards */
.tg-site-card {
    background: var(--bg-surface);
    border: 1px solid rgba(128,128,128,0.2);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tg-site-card:hover {
    border-color: #00AFD2;
    box-shadow: 0 2px 12px rgba(0,175,210,0.15);
}
.tg-site-card.tg-alert {
    border-color: rgba(255,149,0,0.5);
}
.tg-site-card.tg-critical {
    border-color: rgba(255,59,48,0.5);
}
.tg-site-card.tg-offline {
    opacity: 0.6;
    border-color: rgba(255,59,48,0.3);
}
.tg-site-card.tg-selected {
    border-color: #00AFD2;
    box-shadow: 0 0 0 2px rgba(0,175,210,0.3);
}
.tg-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.tg-card-site {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}
.tg-card-host {
    font-size: 10px;
    font-family: monospace;
    color: var(--text-secondary);
    margin-top: 2px;
}
.tg-card-model {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}
.tg-fill-bar {
    height: 20px;
    background: rgba(128,128,128,0.15);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin: 8px 0 6px;
}
.tg-fill-bar-inner {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.tg-fill-label {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.tg-card-stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}
.tg-card-flags {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.tg-flag {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}
.tg-flag-ok { background: rgba(52,199,89,0.12); color: #34C759; }
.tg-flag-warn { background: rgba(255,149,0,0.12); color: #FF9500; }
.tg-flag-crit { background: rgba(255,59,48,0.12); color: #FF3B30; }

/* Tank level bars in site detail */
.tg-tank-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(128,128,128,0.1);
}
.tg-tank-label {
    font-size: 12px;
    font-weight: 600;
    min-width: 70px;
    color: var(--text-primary);
}
.tg-tank-bar-wrap {
    flex: 1;
    height: 24px;
    background: rgba(128,128,128,0.12);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.tg-tank-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s;
}
.tg-tank-bar-label {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.tg-tank-detail {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 140px;
    text-align: right;
}
[data-theme="light"] .tg-site-card {
    border-color: rgba(128,128,128,0.15);
}
[data-theme="light"] .tg-site-card:hover {
    box-shadow: 0 2px 12px rgba(0,175,210,0.1);
}

/* Dashboard search input for site registry */
.dashboard-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 12px;
}
.dashboard-search::placeholder { color: var(--text-tertiary); }

/* Mode Selector */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.mode-btn {
    padding: 10px 18px;
    border: 1px solid rgba(0, 180, 255, 0.3);
    background: linear-gradient(135deg, rgba(0, 100, 180, 0.15) 0%, rgba(0, 60, 120, 0.1) 100%);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn:hover {
    color: #00d4ff;
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.25) 0%, rgba(0, 100, 180, 0.15) 100%);
    border-color: rgba(0, 180, 255, 0.5);
    box-shadow: 0 4px 16px rgba(0, 180, 255, 0.2);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #0091ff 0%, #00d4ff 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.5), 0 0 30px rgba(0, 212, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.mode-btn.active:hover {
    box-shadow: 0 6px 24px rgba(0, 212, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

[data-theme="dark"] .mode-btn:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

/* Advanced/Expert Panels - Modern Glassmorphism (ENHANCED) */
.insight-panel {
    background: linear-gradient(135deg, rgba(15, 25, 50, 0.98) 0%, rgba(20, 30, 60, 0.95) 50%, rgba(15, 25, 50, 0.98) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 2px solid rgba(0, 180, 255, 0.4);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow:
        0 0 30px rgba(0, 180, 255, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 180, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    animation: panel-glow 4s ease-in-out infinite;
}

/* Clip the decorative glow line to panel bounds without clipping child tooltips */
.insight-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 180, 255, 0.6), transparent);
}

.insight-panel:hover {
    border-color: rgba(0, 180, 255, 0.7);
    box-shadow:
        0 0 50px rgba(0, 180, 255, 0.25),
        0 16px 48px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 0 30px rgba(0, 180, 255, 0.1);
    transform: translateY(-4px);
}

[data-theme="light"] .insight-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.9) 100%);
    border-color: rgba(24, 144, 215, 0.2);
    box-shadow: 0 8px 32px rgba(14, 20, 62, 0.08);
}

[data-theme="light"] .insight-panel:hover {
    border-color: rgba(24, 144, 215, 0.4);
    box-shadow: 0 12px 48px rgba(24, 144, 215, 0.12);
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.insight-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-cta) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(0, 175, 210, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.insight-panel:hover .insight-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 24px rgba(0, 175, 210, 0.5);
}

.insight-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 0%, #c5d4e8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .insight-title {
    background: linear-gradient(135deg, var(--jfp-navy) 0%, var(--jfp-blue-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.insight-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.insight-stat {
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.12) 0%, rgba(0, 100, 180, 0.08) 100%);
    border: 1px solid rgba(0, 180, 255, 0.3);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    cursor: default;
}

.insight-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 180, 255, 0.5), transparent);
}

.insight-stat:hover {
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.18) 0%, rgba(0, 100, 180, 0.12) 100%);
    border-color: rgba(0, 180, 255, 0.5);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 180, 255, 0.15);
}

.insight-stat-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-cta);
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.6), 0 0 60px rgba(0, 212, 255, 0.3);
}

.insight-stat-label {
    font-family: var(--font-heading);
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Stat Tooltip (appears on hover of the stat card) */
.stat-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1000;
    min-width: 200px;
    max-width: 260px;
    padding: 10px 14px;
    background: rgba(10, 14, 39, 0.95);
    border: 1px solid rgba(0, 175, 210, 0.35);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-family: var(--font-body, system-ui);
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    white-space: normal;
}

.stat-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 175, 210, 0.35);
}

.insight-stat:hover .stat-tooltip:not(:empty),
.insight-stat-info:hover .stat-tooltip:not(:empty) {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.insight-stat:hover,
.insight-stat-info:hover {
    z-index: 100;
}

.insight-stat-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 16px;
    height: 16px;
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    color: var(--cyan, #00AFD2);
    border: 1px solid var(--cyan, #00AFD2);
    border-radius: 50%;
    cursor: help;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.insight-stat-info:hover {
    opacity: 1;
}

.insight-stat-info .stat-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1000;
    min-width: 260px;
    max-width: 340px;
    padding: 12px 14px;
    background: rgba(10, 14, 30, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 175, 210, 0.3);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-size: 12px;
    font-weight: 400;
    color: #AABBCC;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

[data-theme="light"] .stat-tooltip {
    background: #ffffff;
    border-color: rgba(14, 20, 62, 0.12);
    box-shadow: 0 8px 32px rgba(14, 20, 62, 0.15);
    color: #495057;
}

[data-theme="light"] .stat-tooltip::after {
    border-top-color: rgba(14, 20, 62, 0.12);
}

[data-theme="light"] .insight-stat {
    background: linear-gradient(135deg, rgba(24, 144, 215, 0.08) 0%, rgba(24, 144, 215, 0.03) 100%);
    border-color: rgba(24, 144, 215, 0.15);
}

[data-theme="light"] .insight-stat-value {
    text-shadow: none;
}

/* Expert Mode: Live Data Widgets - Modern Glassmorphism (ENHANCED) */
.live-widget {
    background: linear-gradient(135deg, rgba(15, 25, 50, 0.98) 0%, rgba(20, 30, 60, 0.95) 50%, rgba(15, 25, 50, 0.98) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 2px solid rgba(0, 180, 255, 0.4);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow:
        0 0 30px rgba(0, 180, 255, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 180, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.live-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 180, 255, 0.6), transparent);
}

.live-widget:hover {
    border-color: rgba(0, 180, 255, 0.7);
    box-shadow:
        0 0 50px rgba(0, 180, 255, 0.25),
        0 16px 48px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.live-widget:hover {
    border-color: rgba(0, 180, 255, 0.4);
    box-shadow: 0 12px 40px rgba(0, 180, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

[data-theme="light"] .live-widget {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.9) 100%);
    border-color: rgba(24, 144, 215, 0.15);
    box-shadow: 0 8px 32px rgba(14, 20, 62, 0.06);
}

[data-theme="light"] .live-widget:hover {
    border-color: rgba(24, 144, 215, 0.35);
    box-shadow: 0 12px 40px rgba(24, 144, 215, 0.1);
}

.live-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #34c759;
    box-shadow: 0 0 10px rgba(52, 199, 89, 0.6), 0 0 20px rgba(52, 199, 89, 0.3);
    animation: pulse-glow 2s ease infinite;
}

@keyframes panel-glow {
    0%, 100% {
        border-color: rgba(0, 180, 255, 0.4);
        box-shadow: 0 0 30px rgba(0, 180, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        border-color: rgba(0, 180, 255, 0.6);
        box-shadow: 0 0 50px rgba(0, 180, 255, 0.25), 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(52, 199, 89, 0.6), 0 0 20px rgba(52, 199, 89, 0.3);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 15px rgba(52, 199, 89, 0.8), 0 0 30px rgba(52, 199, 89, 0.5);
    }
}

/* Responsive - Mobile First */
@media (max-width: 768px) {
    /* Prevent horizontal overflow globally */
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .main {
        max-width: 100%;
        padding: 24px 12px 100px;
        overflow-x: hidden;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    /* Search box mobile */
    .search-container {
        width: 100%;
        max-width: 100%;
        margin-bottom: 24px;
    }

    .search-box {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .search-box input {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px 8px;
    }

    .search-btn {
        padding: 12px 16px;
        font-size: 13px;
    }

    /* Filter chips mobile - make them wrap properly */
    .context-filters {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .context-filters > div {
        width: 100%;
        max-width: 100%;
    }

    .filter-chip {
        padding: 5px 10px;
        font-size: 11px;
        flex-shrink: 0;
    }

    /* Quick grid mobile */
    .quick-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .quick-card {
        padding: 12px;
    }

    .quick-card-title {
        font-size: 13px;
    }

    .quick-card-desc {
        font-size: 10px;
    }

    /* Tools row */
    .tools-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* Side menu full width on mobile */
    .side-menu {
        width: 85vw;
        max-width: 320px;
    }

    /* Expert mode panels */
    .expert-grid {
        grid-template-columns: 1fr;
    }

    /* Mode selector */
    .mode-selector {
        gap: 4px;
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .hero-title {
        font-size: 24px;
    }

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

    .filter-chip {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* Voice pulse animation */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.voice-active {
    animation: pulse 1s ease infinite;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Diagnostic Modal Styles */
.diagnostic-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.diagnostic-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

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

.diagnostic-modal-header h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    margin: 0;
}

.diagnostic-modal-header .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    line-height: 1;
}

.diagnostic-modal-body {
    padding: 24px;
}

.diag-action-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.diag-action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.diag-icon {
    font-size: 24px;
}

.diag-btn-title {
    font-weight: 600;
    color: var(--text-primary);
}

.diag-btn-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.test-result {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.test-result.success {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.05);
}

.test-result.warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.test-result.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.test-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.03);
    font-weight: 500;
}

.test-status {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
}

.test-status.success { background: #dcfce7; color: #166534; }
.test-status.warning { background: #fef3c7; color: #92400e; }
.test-status.error { background: #fee2e2; color: #991b1b; }

.test-result-details {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.severity-critical { color: #ef4444; font-weight: 600; }
.severity-high { color: #f59e0b; font-weight: 600; }
.severity-medium { color: #3b82f6; }
.severity-low { color: #22c55e; }

/* Quick Reference Cards */
.quick-ref-card {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-ref-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.quick-ref-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.quick-ref-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.quick-ref-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Quick Reference Modal - Expandable Cards */
.qr-category-pill {
    display: inline-block;
    padding: 8px 16px;
    margin-right: 8px;
    border: none;
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.qr-category-pill:hover {
    background: var(--bg-hover);
}

.qr-category-pill.active {
    background: var(--jfp-blue);
    color: white;
}

.qr-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.qr-card.expanded {
    border-color: var(--jfp-blue);
    box-shadow: 0 4px 12px rgba(24, 144, 215, 0.15);
}

.qr-card-header {
    padding: 16px;
    cursor: pointer;
    position: relative;
}

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

.qr-card-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.qr-category-badge {
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(24, 144, 215, 0.15);
    color: var(--jfp-blue);
    border-radius: 4px;
    font-weight: 500;
}

.qr-vendor-badge {
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(255, 105, 0, 0.15);
    color: var(--jfp-orange);
    border-radius: 4px;
    font-weight: 500;
}

.qr-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    padding-right: 30px;
}

.qr-card-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.qr-expand-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 12px;
}

.qr-card-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}

.qr-content {
    padding: 16px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.qr-steps {
    margin-top: 12px;
}

.qr-steps-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.qr-steps-list {
    margin: 0;
    padding-left: 0;
    counter-reset: step-counter;
    list-style: none;
}

.qr-steps-list li {
    position: relative;
    padding-left: 36px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-primary);
    counter-increment: step-counter;
}

.qr-steps-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: var(--jfp-blue);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-warnings {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 149, 0, 0.1);
    border-radius: 8px;
    border-left: 4px solid #ff9500;
}

.qr-warning {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.qr-warning:last-child {
    margin-bottom: 0;
}

.qr-related {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.qr-related-title {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.qr-related-chip {
    display: inline-block;
    font-size: 12px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-right: 6px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

/* Error Code Chips */
.error-code-chip {
    padding: 6px 12px;
    background: rgba(14, 20, 62, 0.08);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.error-code-chip:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

[data-theme="dark"] .error-code-chip {
    background: rgba(255, 255, 255, 0.1);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(24, 144, 215, 0.3);
}
