@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,600;1,700&family=JetBrains+Mono:wght@500;600;700&display=swap');

/* ==========================================================================
   THEME 1: INDUSTRIAL SLATE / SCADA NAVY (Default Control Room Dark)
   ========================================================================== */
:root, [data-theme="slate"] {
    --theme-name: "slate";
    --bg-base: #0c1017;
    --bg-primary: #111724;
    --bg-surface: #172033;
    --bg-surface-elevated: #1e2a44;
    --bg-card: #151d2e;
    --bg-card-hover: #1c263c;
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --border-focus: #3b82f6;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --accent-primary: #3b82f6;
    --accent-primary-glow: rgba(59, 130, 246, 0.25);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.2);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.2);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.2);
    --accent-rose: #ef4444;
    --accent-rose-glow: rgba(239, 68, 68, 0.2);
    --accent-teal: #14b8a6;

    --header-bg: rgba(17, 23, 36, 0.95);
    --nav-bg: rgba(12, 16, 23, 0.9);
    --table-header-bg: #131b2a;
    --table-border: rgba(255, 255, 255, 0.06);
    --table-hover: rgba(255, 255, 255, 0.03);
    --input-bg: #172033;
    --wedge-bg: rgba(59, 130, 246, 0.08);
    --wedge-border: #3b82f6;

    --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 16px rgba(59, 130, 246, 0.15);
}

/* ==========================================================================
   THEME 2: TACTICAL HIGH-CONTRAST (Warehouse Dock & Rugged Sleds)
   ========================================================================== */
[data-theme="tactical"] {
    --theme-name: "tactical";
    --bg-base: #12151b;
    --bg-primary: #181c24;
    --bg-surface: #1e2430;
    --bg-surface-elevated: #283040;
    --bg-card: #191e28;
    --bg-card-hover: #222938;

    --border-subtle: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.24);
    --border-focus: #f59e0b;

    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;

    --accent-primary: #f59e0b;
    --accent-primary-glow: rgba(245, 158, 11, 0.3);
    --accent-blue: #38bdf8;
    --accent-blue-glow: rgba(56, 189, 248, 0.25);
    --accent-green: #22c55e;
    --accent-green-glow: rgba(34, 197, 94, 0.25);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.3);
    --accent-rose: #ef4444;
    --accent-rose-glow: rgba(239, 68, 68, 0.25);
    --accent-teal: #06b6d4;

    --header-bg: #151921;
    --nav-bg: #12151b;
    --table-header-bg: #1d232e;
    --table-border: rgba(255, 255, 255, 0.1);
    --table-hover: rgba(255, 255, 255, 0.05);
    --input-bg: #1d222b;
    --wedge-bg: rgba(245, 158, 11, 0.1);
    --wedge-border: #f59e0b;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
    --shadow-glow-blue: 0 0 16px rgba(245, 158, 11, 0.2);
}

/* ==========================================================================
   THEME 3: SWISS MINIMALIST CLEAN CLINICAL (Light Mode / Hospital Audits)
   ========================================================================== */
[data-theme="clinical"] {
    --theme-name: "clinical";
    --bg-base: #f8fafc;
    --bg-primary: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;

    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-focus: #0284c7;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --accent-primary: #0284c7;
    --accent-primary-glow: rgba(2, 132, 199, 0.15);
    --accent-blue: #0284c7;
    --accent-blue-glow: rgba(2, 132, 199, 0.15);
    --accent-green: #15803d;
    --accent-green-glow: rgba(21, 128, 61, 0.15);
    --accent-amber: #b45309;
    --accent-amber-glow: rgba(180, 83, 9, 0.15);
    --accent-rose: #b91c1c;
    --accent-rose-glow: rgba(185, 28, 28, 0.15);
    --accent-teal: #0f766e;

    --header-bg: rgba(255, 255, 255, 0.95);
    --nav-bg: #f8fafc;
    --table-header-bg: #f1f5f9;
    --table-border: #e2e8f0;
    --table-hover: #f1f5f9;
    --input-bg: #ffffff;
    --wedge-bg: rgba(2, 132, 199, 0.05);
    --wedge-border: #0284c7;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --shadow-glow-blue: 0 0 16px rgba(2, 132, 199, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

header {
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-primary);
    box-shadow: 0 0 12px var(--accent-primary-glow);
    font-size: 1rem;
}

.brand-tag {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--accent-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.facility-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    color: var(--accent-green);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

.dot.offline {
    background-color: var(--accent-rose);
    box-shadow: 0 0 8px var(--accent-rose);
    animation: none;
}

.nav-tabs {
    display: flex;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 24px;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--table-hover);
}

.nav-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

main {
    flex: 1;
    padding: 24px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }
}

.scanner-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 640px) {
    .meta-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-control, select.form-control {
    width: 100%;
    padding: 12px 14px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 16px;
    padding-right: 40px;
}

select.form-control option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 10px;
}

input.form-control {
    background-image: none;
    padding-right: 14px;
    cursor: text;
}

.form-control:hover {
    border-color: var(--border-focus);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.wedge-input-box {
    position: relative;
    margin: 4px 0;
}

.wedge-input {
    width: 100%;
    padding: 18px 20px;
    background: var(--wedge-bg);
    border: 2px dashed var(--wedge-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.05em;
    transition: all 0.25s ease;
}

.wedge-input:focus {
    outline: none;
    background: var(--wedge-bg);
    border-style: solid;
    border-color: var(--wedge-border);
    box-shadow: 0 0 20px var(--accent-primary-glow);
}

.wedge-input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: normal;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 640px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-strong);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.stat-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
}

.scan-list-container {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    min-height: 480px;
}

.scan-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 14px;
}

.scan-table-wrapper {
    flex: 1;
    overflow-y: auto;
    max-height: 520px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

table.scan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.scan-table th {
    text-align: left;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-strong);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: sticky;
    top: 0;
    background: var(--table-header-bg);
    z-index: 10;
}

table.scan-table td {
    padding: 12px;
    border-bottom: 1px solid var(--table-border);
    color: var(--text-secondary);
}

table.scan-table tr:hover td {
    background: var(--table-hover);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-clean {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-soiled {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-ward {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-condemn {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-rose);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.btn-sim {
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sim:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ==========================================================================
   SEGMENTED LIGHT / DARK THEME TOGGLE
   ========================================================================== */
.theme-toggle-container {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 3px;
    gap: 2px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    user-select: none;
}

.theme-toggle-btn:hover {
    color: var(--text-primary);
}

.theme-toggle-btn.active {
    background: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--accent-primary-glow);
}

[data-theme="clinical"] .theme-toggle-btn.active {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

/* ==========================================================================
   FLOW & ZONES DIGITAL TWIN THEME ADAPTATIONS
   ========================================================================== */
.schematic-box-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 18px;
    position: relative;
    box-shadow: var(--shadow-md);
    overflow: visible;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.schematic-pod {
    fill: var(--bg-surface);
    stroke: var(--border-subtle);
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.schematic-pod-title {
    fill: var(--text-primary);
    font-family: var(--font-sans);
}
.node-rect {
    fill: var(--bg-card);
    stroke: var(--border-strong);
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.node-title {
    fill: var(--text-primary);
    font-family: var(--font-sans);
}
.node-sub {
    fill: var(--text-muted);
    font-family: var(--font-sans);
}
.node-val {
    fill: var(--accent-primary);
    font-family: var(--font-mono);
}
.highway-bg {
    stroke: #1e293b;
    fill: none !important;
    transition: stroke 0.2s ease;
}
.pill-box {
    fill: var(--bg-card);
    stroke: var(--border-subtle);
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.pill-title {
    fill: var(--text-primary);
    font-family: var(--font-sans);
}
.twin-node {
    cursor: pointer;
    pointer-events: auto;
    transition: filter 0.2s ease, opacity 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}
.twin-node:hover {
    filter: drop-shadow(0 0 12px rgba(45, 212, 191, 0.75));
}
.twin-node:active {
    filter: brightness(0.9) drop-shadow(0 0 5px rgba(45, 212, 191, 0.5));
    opacity: 0.95;
}
.twin-node:hover .node-rect,
.twin-node:hover .pill-box {
    stroke: #0284c7 !important;
    stroke-width: 1.8px !important;
}
.twin-node * {
    pointer-events: inherit;
}
.schematic-pod,
.conduit-line,
.conduit-line-reject,
.highway-rail,
.highway-bg,
.highway-center,
.truck-body-outbound,
.truck-cab-outbound,
.truck-body-inbound,
.truck-cab-inbound,
.truck-wheel,
.truck-window-outbound,
.truck-window-inbound,
.truck-headlight-beam,
.truck-headlight-bulb,
.truck-taillight,
.gantry-foot,
.gantry-frame,
.gantry-sensor,
.gantry-beacon,
.gantry-beacon-center {
    pointer-events: none;
}
.node-rect-reject {
    fill: #180e14;
    stroke: rgba(239, 68, 68, 0.55);
    stroke-width: 1.4;
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.dwell-bar-track {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-subtle);
}

/* Light mode specific fine-tuning */
[data-theme="clinical"] .schematic-pod {
    fill: #ffffff;
    stroke: #cbd5e1;
}
[data-theme="clinical"] .schematic-pod-title {
    fill: #0f172a;
}
[data-theme="clinical"] .node-rect {
    fill: #f8fafc;
    stroke: #94a3b8;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.06));
}
[data-theme="clinical"] .node-title {
    fill: #0f172a;
}
[data-theme="clinical"] .node-sub {
    fill: #64748b;
}
[data-theme="clinical"] .node-val {
    fill: #0284c7;
}
[data-theme="clinical"] .twin-node:hover {
    filter: drop-shadow(0 0 12px rgba(14, 165, 233, 0.65));
}
[data-theme="clinical"] .twin-node:active {
    filter: brightness(0.95) drop-shadow(0 0 5px rgba(14, 165, 233, 0.45));
    opacity: 0.95;
}
[data-theme="clinical"] .node-rect-reject {
    fill: #fef2f2;
    stroke: #fca5a5;
}
[data-theme="clinical"] .dwell-bar-track {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}
[data-theme="clinical"] .highway-bg {
    stroke: #334155;
    fill: none !important;
}
[data-theme="clinical"] .pill-title {
    fill: #0f172a;
}
[data-theme="clinical"] .pill-box {
    fill: #f0f9ff;
    stroke: #bae6fd;
}


.flow-analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.flow-analytics-grid > .card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
}
.flow-analytics-grid > .card > div:first-child {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}
@media (max-width: 900px) {
    .flow-analytics-grid {
        grid-template-columns: 1fr;
    }
}

.commission-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 1024px) {
    .commission-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   SVG CONDUIT, TELEMETRY & EQUIPMENT GRAPHICS (Dark Default)
   ========================================================================== */
.conduit-line {
    stroke: #2dd4bf;
    stroke-width: 2.5;
    fill: none !important;
}
.conduit-line-reject {
    stroke: #ef4444;
    stroke-width: 1.5;
    fill: none !important;
    stroke-dasharray: 6 3;
}
.highway-rail {
    stroke: #475569;
    stroke-opacity: 0.9;
    fill: none !important;
}
.highway-center {
    stroke: #f8fafc;
    stroke-dasharray: 10 8;
    fill: none !important;
}

.gantry-foot {
    fill: #334155;
}
.gantry-frame {
    stroke: #64748b;
}
.gantry-sensor {
    fill: #0f172a;
    stroke: #0ea5e9;
    stroke-width: 1;
}
.gantry-beacon {
    fill: #2dd4bf;
    filter: drop-shadow(0 0 4px rgba(45, 212, 191, 0.8));
}
.gantry-beacon-center {
    fill: #38bdf8;
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.9));
}

.rfid-icon-base {
    fill: #0f2231;
    stroke: #2dd4bf;
}
.rfid-icon-signal {
    stroke: #ffffff;
    fill: none !important;
}

.truck-body-outbound { fill: #38bdf8; }
.truck-cab-outbound { fill: #0284c7; }
.truck-body-inbound { fill: #10b981; }
.truck-cab-inbound { fill: #059669; }
.truck-wheel { fill: #1e293b; stroke: #64748b; }
.truck-window-outbound { fill: #bae6fd; }
.truck-window-inbound { fill: #a7f3d0; }

/* Highway Truck Night Driving Lights (Dark Mode Default) */
.truck-headlight-beam {
    opacity: 0.88;
    mix-blend-mode: screen;
    pointer-events: none;
    animation: headlightPulse 3.5s ease-in-out infinite alternate;
}
.truck-headlight-bulb {
    fill: #ffffff;
    filter: drop-shadow(0 0 3px #fef08a) drop-shadow(0 0 7px rgba(254, 240, 138, 0.9));
    pointer-events: none;
}
.truck-taillight {
    fill: #ef4444;
    filter: drop-shadow(0 0 3px #ef4444) drop-shadow(0 0 5px rgba(239, 68, 68, 0.8));
    pointer-events: none;
}

@keyframes headlightPulse {
    0% {
        opacity: 0.80;
    }
    50% {
        opacity: 0.95;
    }
    100% {
        opacity: 0.82;
    }
}

.ironer-frame {
    fill: #0e1b2b;
    stroke: #2dd4bf;
}
.ironer-slat { fill: #cbd5e1; }

.gauge-needle { stroke: #cbd5e1; }
.gauge-pivot { fill: #cbd5e1; }
.gauge-center { fill: #0f172a; }
.gauge-readout { fill: #2dd4bf; }
.arrow-cyan { fill: #2dd4bf; }
.arrow-red { fill: #ef4444; }

/* SVG Clinical Light Mode Overrides */
[data-theme="clinical"] .conduit-line {
    stroke: #0891b2;
    stroke-width: 2.5;
    fill: none !important;
}
[data-theme="clinical"] .conduit-line-reject {
    stroke: #dc2626;
    fill: none !important;
}
[data-theme="clinical"] .highway-rail {
    stroke: #94a3b8;
    stroke-opacity: 1;
    fill: none !important;
}
[data-theme="clinical"] .highway-center {
    stroke: #ffffff;
    stroke-dasharray: 10 8;
    fill: none !important;
}

[data-theme="clinical"] .gantry-foot {
    fill: #64748b;
}
[data-theme="clinical"] .gantry-frame {
    stroke: #475569;
}
[data-theme="clinical"] .gantry-sensor {
    fill: #f1f5f9;
    stroke: #0284c7;
    stroke-width: 1.2;
}
[data-theme="clinical"] .gantry-beacon {
    fill: #059669;
}
[data-theme="clinical"] .gantry-beacon-center {
    fill: #0284c7;
}
[data-theme="clinical"] .rfid-icon-base {
    fill: #e0f2fe;
    stroke: #0891b2;
}
[data-theme="clinical"] .rfid-icon-signal {
    stroke: #0891b2;
    fill: none !important;
}
[data-theme="clinical"] .truck-body-outbound { fill: #7dd3fc; }
[data-theme="clinical"] .truck-cab-outbound { fill: #0284c7; }
[data-theme="clinical"] .truck-body-inbound { fill: #6ee7b7; }
[data-theme="clinical"] .truck-cab-inbound { fill: #059669; }
[data-theme="clinical"] .truck-wheel { fill: #94a3b8; stroke: #475569; }
[data-theme="clinical"] .truck-window-outbound { fill: #e0f2fe; }
[data-theme="clinical"] .truck-window-inbound { fill: #d1fae5; }
[data-theme="clinical"] .truck-headlight-beam,
[data-theme="clinical"] .truck-headlight-bulb,
[data-theme="clinical"] .truck-taillight {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    filter: none !important;
    animation: none !important;
}
[data-theme="clinical"] .ironer-frame {
    fill: #f1f5f9;
    stroke: #0891b2;
}
[data-theme="clinical"] .ironer-slat { fill: #94a3b8; }
[data-theme="clinical"] .gauge-needle { stroke: #64748b; }
[data-theme="clinical"] .gauge-pivot { fill: #64748b; }
[data-theme="clinical"] .gauge-center { fill: #ffffff; }
[data-theme="clinical"] .gauge-readout { fill: #0284c7; }
[data-theme="clinical"] .arrow-cyan { fill: #0891b2; }
[data-theme="clinical"] .arrow-red { fill: #dc2626; }

/* ==========================================================================
   ANALYTICS SANKEY & HISTOGRAM THEME CLASSES
   ========================================================================== */
.sankey-container-box { fill: #131b2a; stroke: #24324f; }
.sankey-node-box { fill: #151e30; }
.sankey-node-letter { fill: #ffffff; }
.sankey-label-muted { fill: #94a3b8; }
.sankey-pill-bg { fill: #0b0f19; }
.sankey-icon-stroke { stroke: #38bdf8; fill: none !important; }
.sankey-icon-fill { fill: #38bdf8; }
.sankey-factory-icon { stroke: #a855f7; fill: #a855f7; }
.hist-gridline { stroke: rgba(255, 255, 255, 0.05); }
.hist-axis-label { fill: #64748b; }
.hist-axis-title { fill: #94a3b8; }

[data-theme="clinical"] .sankey-container-box { fill: #f8fafc; stroke: #cbd5e1; }
[data-theme="clinical"] .sankey-node-box { fill: #ffffff; }
[data-theme="clinical"] .sankey-node-letter { fill: #0f172a; }
[data-theme="clinical"] .sankey-label-muted { fill: #64748b; }
[data-theme="clinical"] .sankey-pill-bg { fill: #fff1f2; }
[data-theme="clinical"] .sankey-icon-stroke { stroke: #0284c7; }
[data-theme="clinical"] .sankey-icon-fill { fill: #0284c7; }
[data-theme="clinical"] .sankey-factory-icon { stroke: #7c3aed; fill: #7c3aed; }
[data-theme="clinical"] .hist-gridline { stroke: rgba(0, 0, 0, 0.06); }
[data-theme="clinical"] .hist-axis-label { fill: #475569; }
[data-theme="clinical"] .hist-axis-title { fill: #64748b; }

/* ==========================================================================
   12-STAGE NUMBERED BADGE STYLES
   ========================================================================== */
.stage-badge-bg {
    fill: #0ea5e9;
    stroke: #38bdf8;
    stroke-width: 1.6;
}
.stage-badge-num {
    fill: #ffffff;
    font-size: 10.5px;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: central;
    font-family: var(--font-mono);
}
.stage-badge-bg-amber {
    fill: #d97706;
    stroke: #f59e0b;
    stroke-width: 1.6;
}
.stage-badge-bg-emerald {
    fill: #059669;
    stroke: #10b981;
    stroke-width: 1.6;
}
.stage-badge-bg-purple {
    fill: #7c3aed;
    stroke: #a855f7;
    stroke-width: 1.6;
}

[data-theme="clinical"] .stage-badge-bg {
    fill: #0284c7;
    stroke: #0369a1;
}
[data-theme="clinical"] .stage-badge-num {
    fill: #ffffff;
}
[data-theme="clinical"] .stage-badge-bg-amber {
    fill: #b45309;
    stroke: #d97706;
}
[data-theme="clinical"] .stage-badge-bg-emerald {
    fill: #047857;
    stroke: #059669;
}
[data-theme="clinical"] .stage-badge-bg-purple {
    fill: #6d28d9;
    stroke: #7c3aed;
}

/* ==========================================================================
   STAGE SLA BADGE PILLS (Dark & Clinical Themes)
   ========================================================================== */
.sla-badge-bg {
    fill: rgba(14, 165, 233, 0.12);
    stroke: rgba(56, 189, 248, 0.35);
    stroke-width: 0.8;
}
.sla-badge-text {
    fill: #38bdf8;
    font-size: 8px;
    font-family: var(--font-mono);
    font-weight: 700;
}
.sla-badge-bg-amber {
    fill: rgba(245, 158, 11, 0.12);
    stroke: rgba(245, 158, 11, 0.4);
    stroke-width: 0.8;
}
.sla-badge-text-amber {
    fill: #f59e0b;
    font-size: 8px;
    font-family: var(--font-mono);
    font-weight: 700;
}
.sla-badge-bg-emerald {
    fill: rgba(16, 185, 129, 0.12);
    stroke: rgba(16, 185, 129, 0.4);
    stroke-width: 0.8;
}
.sla-badge-text-emerald {
    fill: #10b981;
    font-size: 8px;
    font-family: var(--font-mono);
    font-weight: 700;
}
.sla-badge-bg-purple {
    fill: rgba(168, 85, 247, 0.12);
    stroke: rgba(168, 85, 247, 0.4);
    stroke-width: 0.8;
}
.sla-badge-text-purple {
    fill: #c084fc;
    font-size: 8px;
    font-family: var(--font-mono);
    font-weight: 700;
}

[data-theme="clinical"] .sla-badge-bg {
    fill: #f0f9ff;
    stroke: #bae6fd;
}
[data-theme="clinical"] .sla-badge-text {
    fill: #0284c7;
}
[data-theme="clinical"] .sla-badge-bg-amber {
    fill: #fffbeb;
    stroke: #fcd34d;
}
[data-theme="clinical"] .sla-badge-text-amber {
    fill: #b45309;
}
[data-theme="clinical"] .sla-badge-bg-emerald {
    fill: #ecfdf5;
    stroke: #a7f3d0;
}
[data-theme="clinical"] .sla-badge-text-emerald {
    fill: #047857;
}
[data-theme="clinical"] .sla-badge-bg-purple {
    fill: #faf5ff;
    stroke: #e9d5ff;
}
[data-theme="clinical"] .sla-badge-text-purple {
    fill: #7c3aed;
}

/* ==========================================================================
   STAGE HARDWARE SCANNER & RFID TAG BADGES
   ========================================================================== */
.stage-glyph {
    stroke: #38bdf8;
    color: #38bdf8;
}
.scanner-badge-bg {
    fill: rgba(14, 165, 233, 0.09);
    stroke: rgba(14, 165, 233, 0.3);
    stroke-width: 0.8;
}
.scanner-badge-text {
    fill: #38bdf8;
    font-size: 7.5px;
    font-family: var(--font-mono);
    font-weight: 600;
}
.tag-badge-bg {
    fill: rgba(168, 85, 247, 0.09);
    stroke: rgba(168, 85, 247, 0.3);
    stroke-width: 0.8;
}
.tag-badge-text {
    fill: #c084fc;
    font-size: 7.5px;
    font-family: var(--font-mono);
    font-weight: 600;
}

[data-theme="clinical"] .stage-glyph {
    stroke: #0284c7;
    color: #0284c7;
}
[data-theme="clinical"] .scanner-badge-bg {
    fill: #f0f9ff;
    stroke: #bae6fd;
}
[data-theme="clinical"] .scanner-badge-text {
    fill: #0369a1;
}
[data-theme="clinical"] .tag-badge-bg {
    fill: #faf5ff;
    stroke: #e9d5ff;
}
[data-theme="clinical"] .tag-badge-text {
    fill: #6b21a8;
}

/* ==========================================================================
   CLOSED-LOOP ZONE MODEL: HIGHLIGHTED HERO NUMBERS & TRAFFIC LIGHT SLAS
   ========================================================================== */
.hero-val-clean {
    fill: #38bdf8;
    font-family: var(--font-mono);
    font-weight: 800;
}
.hero-val-soiled {
    fill: #f59e0b;
    font-family: var(--font-mono);
    font-weight: 800;
}
.hero-val-reject {
    fill: #ef4444;
    font-family: var(--font-mono);
    font-weight: 800;
}
.hero-val-circ {
    fill: #34d399;
    font-family: var(--font-mono);
    font-weight: 800;
}

.traffic-pill-green {
    fill: rgba(16, 185, 129, 0.12);
    stroke: rgba(16, 185, 129, 0.45);
    stroke-width: 0.9;
}
.traffic-text-green {
    fill: #10b981;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 10px;
}
.traffic-pill-amber {
    fill: rgba(245, 158, 11, 0.15);
    stroke: rgba(245, 158, 11, 0.55);
    stroke-width: 1;
}
.traffic-text-amber {
    fill: #f59e0b;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 10px;
}
.traffic-pill-red {
    fill: rgba(239, 68, 68, 0.18);
    stroke: #ef4444;
    stroke-width: 1.2;
}
.traffic-text-red {
    fill: #f87171;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 10px;
}

/* Single-Tag Primary Zone Badges (Dark Theme) */
.zone-badge-amber {
    fill: rgba(245, 158, 11, 0.2);
    stroke: rgba(245, 158, 11, 0.6);
    stroke-width: 1.2;
}
.zone-text-amber {
    fill: #f59e0b;
    font-family: var(--font-mono);
    font-weight: 800;
}
.zone-badge-cyan {
    fill: rgba(56, 189, 248, 0.2);
    stroke: rgba(56, 189, 248, 0.6);
    stroke-width: 1.2;
}
.zone-text-cyan {
    fill: #38bdf8;
    font-family: var(--font-mono);
    font-weight: 800;
}
.zone-badge-emerald {
    fill: rgba(16, 185, 129, 0.2);
    stroke: rgba(16, 185, 129, 0.6);
    stroke-width: 1.2;
}
.zone-text-emerald {
    fill: #10b981;
    font-family: var(--font-mono);
    font-weight: 800;
}
.zone-badge-purple {
    fill: rgba(168, 85, 247, 0.2);
    stroke: rgba(168, 85, 247, 0.6);
    stroke-width: 1.2;
}
.zone-text-purple {
    fill: #c084fc;
    font-family: var(--font-mono);
    font-weight: 800;
}
.zone-badge-red {
    fill: rgba(239, 68, 68, 0.2);
    stroke: rgba(239, 68, 68, 0.6);
    stroke-width: 1.2;
}
.zone-text-red {
    fill: #ef4444;
    font-family: var(--font-mono);
    font-weight: 800;
}

/* Clinical Light Theme WCAG AA High-Contrast Overrides */
[data-theme="clinical"] .hero-val-clean {
    fill: #0284c7;
}
[data-theme="clinical"] .hero-val-soiled {
    fill: #b45309;
}
[data-theme="clinical"] .hero-val-reject {
    fill: #b91c1c;
}
[data-theme="clinical"] .hero-val-circ {
    fill: #047857;
}
[data-theme="clinical"] .traffic-pill-green {
    fill: #ecfdf5;
    stroke: #a7f3d0;
}
[data-theme="clinical"] .traffic-text-green {
    fill: #047857;
}
[data-theme="clinical"] .traffic-pill-amber {
    fill: #fffbeb;
    stroke: #fde68a;
}
[data-theme="clinical"] .traffic-text-amber {
    fill: #b45309;
}
[data-theme="clinical"] .traffic-pill-red {
    fill: #fef2f2;
    stroke: #fecaca;
}
[data-theme="clinical"] .traffic-text-red {
    fill: #b91c1c;
}
[data-theme="clinical"] .node-sub {
    fill: #475569;
}
[data-theme="clinical"] .zone-badge-amber {
    fill: #fef3c7;
    stroke: #f59e0b;
}
[data-theme="clinical"] .zone-text-amber {
    fill: #b45309;
}
[data-theme="clinical"] .zone-badge-cyan {
    fill: #e0f2fe;
    stroke: #0284c7;
}
[data-theme="clinical"] .zone-text-cyan {
    fill: #0369a1;
}
[data-theme="clinical"] .zone-badge-emerald {
    fill: #d1fae5;
    stroke: #059669;
}
[data-theme="clinical"] .zone-text-emerald {
    fill: #047857;
}
[data-theme="clinical"] .zone-badge-purple {
    fill: #f3e8ff;
    stroke: #9333ea;
}
[data-theme="clinical"] .zone-text-purple {
    fill: #7e22ce;
}
[data-theme="clinical"] .zone-badge-red {
    fill: #fee2e2;
    stroke: #dc2626;
}
[data-theme="clinical"] .zone-text-red {
    fill: #b91c1c;
}

