/* ==========================================================================
   EX I LOOP CALCULATOR - CSS STYLING
   Theme: Industrial Cyberpunk & Safety Cockpit (Premium Dark Theme)
   ========================================================================== */

/* Global Variables & Colors */
:root {
    --bg-dark: #0a0d16;
    --bg-card: #121826;
    --bg-input: #1b2336;
    --border-color: #242f49;
    --border-focus: #3e527d;
    
    /* Text Colors */
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-light: #ffffff;
    
    /* Status Colors (Neon / Glowing) */
    --color-safe: #00ff66;
    --color-safe-glow: rgba(0, 255, 102, 0.2);
    --color-hazard: #ff3333;
    --color-hazard-glow: rgba(255, 51, 51, 0.2);
    --color-warning: #ffcc00;
    --color-warning-glow: rgba(255, 204, 0, 0.2);
    --color-info: #00e5ff;
    
    /* Font */
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.4;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
}
#app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-focus);
}

/* Typography */
h1, h2, h3, h4 {
    color: var(--text-light);
    font-weight: 600;
}

/* Layout Utilities */
.margin-top-xs { margin-top: 3px; }
.margin-top-sm { margin-top: 6px; }
.margin-top-md { margin-top: 10px; }
.margin-top-lg { margin-top: 16px; }
.margin-top-xl { margin-top: 24px; }
.hidden { display: none !important; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-success { color: var(--color-safe) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-hazard) !important; }
.text-link { color: var(--color-info); text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.text-xs { font-size: 12px; }
.text-caption { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-sm { gap: 10px; }
.h-full { height: 100%; }

/* Buttons styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
.btn-primary {
    background-color: var(--color-info);
    color: #000;
}
.btn-primary:hover {
    background-color: #00b8cc;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}
.btn-secondary {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--border-color);
    border-color: var(--border-focus);
}
.btn-success {
    background-color: var(--color-safe);
    color: #000;
}
.btn-success:hover {
    background-color: #00cc52;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.4);
}
.btn-danger {
    background-color: var(--color-hazard);
    color: #fff;
}
.btn-danger:hover {
    background-color: #cc2424;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.4);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 32px;
    background-color: #0c111e;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}
.hazard-glow {
    font-size: 26px;
    color: var(--color-warning);
    text-shadow: 0 0 8px var(--color-warning-glow);
}
.logo-text h1 {
    font-size: 18px;
    letter-spacing: -0.5px;
}
.logo-text span {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}
.pro-badge {
    background-color: rgba(0, 255, 102, 0.08);
    border: 1px solid var(--color-safe);
    color: var(--color-safe);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Navigation Tabs */
.app-tabs {
    display: flex;
    background-color: #0c111e;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.tab-link {
    background: none;
    border: none;
    outline: none;
    padding: 10px 20px;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tab-link:hover {
    color: var(--text-light);
}
.tab-link.active {
    color: var(--color-info);
    border-bottom-color: var(--color-info);
}

/* Main content wrapper */
.app-main-content {
    padding: 12px 20px;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Cockpit Grid (Loop Calculator - Restructured v2 Layout) */
.cockpit-layout-v2 {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.top-row-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 12px;
    align-items: start;
}
.bottom-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr 1fr;
    gap: 12px;
    align-items: stretch;
}

/* Responsive cockpit grid */
@media (max-width: 1400px) {
    .top-row-grid {
        grid-template-columns: 1fr;
    }
    .bottom-inputs-grid {
        grid-template-columns: 1fr 1.25fr;
    }
    .bottom-inputs-grid .device-card {
        grid-column: span 2;
    }
}
@media (max-width: 1000px) {
    .bottom-inputs-grid {
        grid-template-columns: 1fr;
    }
    .bottom-inputs-grid .device-card {
        grid-column: span 1;
    }
}

/* Grid Cards (Glassmorphism design) */
.grid-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Bottom input cards: fill height of grid cell, NO internal scroll */
.bottom-inputs-grid .grid-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.bottom-inputs-grid .card-body {
    flex: 1;
    padding: 12px 16px;
}

/* Top row: results panel also fills height */
.results-panel {
    display: flex;
    flex-direction: column;
}
.results-panel .checklist-grid {
    flex: 1;
}
.card-header {
    padding: 7px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h2 {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.card-body {
    padding: 10px 14px;
}

/* Form inputs styling */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
}
.form-group label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.form-select, .form-control {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 12px;
    padding: 5px 8px;
    border-radius: 5px;
    outline: none;
    transition: all var(--transition-fast);
    width: 100%;
}
.form-select:focus, .form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 5px rgba(62, 82, 125, 0.5);
}
.form-select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.parameters-inline-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.parameters-inline-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.input-section {
    padding: 10px 24px 24px 24px;
}
.border-section {
    border-bottom: 1px solid var(--border-color);
}
.border-section:last-of-type {
    border-bottom: none;
}
.input-section h3 {
    font-size: 14px;
    margin-bottom: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Slider Custom Styling */
.form-range {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    margin: 5px 0;
}
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-info);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
    transition: transform var(--transition-fast);
}
.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.compact-number-input {
    width: 70px !important;
    text-align: center;
    align-self: flex-end;
    margin-top: -22px;
    padding: 3px 5px;
    font-size: 11px;
}

/* Gas Group Toggle Switch */
.gas-group-toggle {
    display: flex;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
}
.gas-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 4px 6px;
    font-family: var(--font-primary);
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.gas-btn:hover {
    color: var(--text-light);
}
.gas-btn.active {
    background-color: var(--border-color);
    color: var(--color-warning);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Checkboxes */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    accent-color: var(--color-info);
    cursor: pointer;
}
.checkbox-label {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
}
.radio-label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.radio-label input {
    accent-color: var(--color-info);
}

/* Simple notice */
.simple-notice {
    background-color: rgba(0, 229, 255, 0.05);
    border: 1px dashed rgba(0, 229, 255, 0.3);
    color: var(--color-info);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    margin-top: 14px;
}

/* Center Panel (Schematic) */
.center-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.visualizer-card {
    position: relative;
}
.diagram-container {
    padding: 4px;
    background-color: #070a11;
}
#loop-svg {
    width: 100%;
    height: auto;
    max-height: 130px;
    display: block;
}

/* Animations for connection cable */
@keyframes flow-safe {
    from { stroke-dashoffset: 16; }
    to { stroke-dashoffset: 0; }
}
@keyframes flow-hazard {
    from { stroke-dashoffset: 16; }
    to { stroke-dashoffset: 0; }
}

.cable-flow-animation-safe {
    stroke: var(--color-safe) !important;
    animation: flow-safe 1s linear infinite;
    filter: drop-shadow(0 0 2px var(--color-safe));
}
.cable-flow-animation-hazard {
    stroke: var(--color-hazard) !important;
    animation: flow-hazard 0.5s linear infinite;
    filter: drop-shadow(0 0 5px var(--color-hazard));
}
.cable-flow-inactive {
    stroke: var(--border-color) !important;
}

/* Safety Status Banner */
.safety-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all var(--transition-normal);
}
.banner-icon-container {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.banner-text h3 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 0;
}
.banner-text p {
    font-size: 11px;
}

/* Status variants */
.status-pending {
    background-color: rgba(62, 82, 125, 0.08);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.status-pending .banner-icon-container {
    background-color: var(--bg-input);
    color: var(--text-secondary);
}

.status-safe {
    background-color: rgba(0, 255, 102, 0.06);
    border-color: var(--color-safe);
    color: #fff;
    box-shadow: 0 0 15px var(--color-safe-glow);
}
.status-safe h3 { color: var(--color-safe); }
.status-safe .banner-icon-container {
    background-color: var(--color-safe);
    color: #000;
    box-shadow: 0 0 10px var(--color-safe-glow);
}

.status-hazard {
    background-color: rgba(255, 51, 51, 0.06);
    border-color: var(--color-hazard);
    color: #fff;
    box-shadow: 0 0 15px var(--color-hazard-glow);
}
.status-hazard h3 { color: var(--color-hazard); }
.status-hazard .banner-icon-container {
    background-color: var(--color-hazard);
    color: #fff;
    box-shadow: 0 0 10px var(--color-hazard-glow);
}

/* 50% Rule Warning Block */
.alert-header {
    background-color: rgba(255, 204, 0, 0.03);
    border-bottom-color: rgba(255, 204, 0, 0.1);
}
.alert-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.flow-diagram-50 {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    background-color: var(--bg-input);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.flow-step .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}
.flow-step .step-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}
.flow-step.step-checked .step-num {
    background-color: var(--color-warning);
    border-color: var(--color-warning);
    color: #000;
    box-shadow: 0 0 8px var(--color-warning-glow);
}
.flow-step.step-checked .step-text {
    color: var(--color-warning);
}
.flow-step.step-active .step-num {
    background-color: var(--color-hazard);
    border-color: var(--color-hazard);
    color: #fff;
    box-shadow: 0 0 8px var(--color-hazard-glow);
}
.flow-step.step-active .step-text {
    color: var(--color-hazard);
}
.flow-connector {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 15px -16px 15px;
}

.rule-consequences-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.consequence-card {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}
.consequence-card .highlight-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-hazard);
}

/* Cable Advisor */
.max-length-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1b263b, #101622);
    border-left: 3px solid var(--color-info);
    border-radius: 5px;
    padding: 8px 12px;
}
.max-length-banner .title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}
.max-length-banner .val {
    font-size: 16px;
    font-weight: 800;
    color: var(--color-info);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

/* Data Table Common styling */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    text-align: left;
}
.data-table th, .data-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
}
.border-table th, .border-table td {
    border: 1px solid var(--border-color);
}

/* Checklist Grid (Right Column) */
.checklist-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    padding: 8px;
    flex: 1;
    min-height: 0;
}
.check-item#check-u,
.check-item#check-i,
.check-item#check-p {
    grid-column: span 2;
}
.check-item#check-c,
.check-item#check-l {
    grid-column: span 3;
}
.check-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    border-radius: 7px;
    transition: all var(--transition-fast);
    overflow: hidden;
    box-sizing: border-box;
}
.check-item:hover {
    border-color: var(--border-focus);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.05);
}
.check-item-pending {
    border-top: 3px solid var(--text-muted);
}
.check-item-safe {
    border-top: 3px solid var(--color-safe);
}
.check-item-hazard {
    border-top: 3px solid var(--color-hazard);
    background-color: rgba(255, 51, 51, 0.02);
}
.check-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 2px;
}
.check-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 4px;
}
.check-status-icon {
    font-size: 11px;
}
.check-pct {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-info);
}
.check-progress-container {
    height: 5px;
    background-color: #070a11;
    border-radius: 3px;
    margin: 8px 0;
    width: 100%;
    overflow: hidden;
}
.check-progress-bar {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width var(--transition-normal);
}
.check-progress-bar.bar-safe {
    background: linear-gradient(90deg, #00e5ff, var(--color-safe));
}
.check-progress-bar.bar-hazard {
    background: linear-gradient(90deg, #ffcc00, var(--color-hazard));
}
.check-progress-bar.bar-pending {
    background-color: var(--text-muted);
}
.check-comparison-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 9.5px;
    color: var(--text-secondary);
}
.check-comparison-values {
    color: var(--text-secondary);
}
.check-comparison-values strong {
    color: var(--text-light);
}
.marge-text {
    font-size: 9.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Multi-Visualization Layout System */

/* Default show/hide selectors based on active mode class */
.checklist-grid.mode-glow-slider .viz-glow-slider { display: flex; }
.checklist-grid.mode-glow-slider .viz-circular-ring { display: none; }
.checklist-grid.mode-glow-slider .viz-led-segment { display: none; }

.checklist-grid.mode-circular-ring .viz-glow-slider { display: none; }
.checklist-grid.mode-circular-ring .viz-circular-ring { display: flex; }
.checklist-grid.mode-circular-ring .viz-led-segment { display: none; }

.checklist-grid.mode-led-segment .viz-glow-slider { display: none; }
.checklist-grid.mode-led-segment .viz-circular-ring { display: none; }
.checklist-grid.mode-led-segment .viz-led-segment { display: flex; }

.card-dial-wrapper,
.card-slider-wrapper,
.card-led-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 42px;
    margin: 1px 0;
    box-sizing: border-box;
}

/* 1. Glow Slider / Bead */
.check-progress-bar {
    position: relative;
}
.glow-bead {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 0 8px #ffffff, 0 0 16px inherit;
    pointer-events: none;
}
/* Hide glow bead if width is 0% to prevent overflow leakage */
.check-progress-bar[style*="width: 0%"] .glow-bead,
.check-progress-bar[style="width:0%"] .glow-bead {
    display: none;
}

/* 2. Circular Rings (Gauges) */
.progress-ring-dial {
    display: block;
}
.progress-ring-dial circle {
    transform: rotate(-90deg);
    transform-origin: 20px 20px;
}
.progress-ring-circle {
    transition: stroke-dashoffset var(--transition-normal);
}
.progress-ring-circle.bar-safe {
    stroke: var(--color-safe);
    filter: drop-shadow(0 0 3px var(--color-safe));
}
.progress-ring-circle.bar-hazard {
    stroke: var(--color-hazard);
    filter: drop-shadow(0 0 3px var(--color-hazard));
}
.progress-ring-circle.bar-pending {
    stroke: var(--text-muted);
}
.dial-percentage-text {
    font-family: 'Outfit', sans-serif;
    font-size: 8px;
    font-weight: 700;
    fill: var(--text-light);
    dominant-baseline: middle;
    text-anchor: middle;
    transition: fill var(--transition-normal);
}
.dial-percentage-text.text-safe {
    fill: var(--color-safe);
    filter: drop-shadow(0 0 1px var(--color-safe));
}
.dial-percentage-text.text-hazard {
    fill: var(--color-hazard);
    filter: drop-shadow(0 0 1px var(--color-hazard));
}

/* 3. LED Segments */
.led-segment-container {
    display: flex;
    gap: 3px;
    width: 100%;
    height: 6px;
}
.led-segment {
    flex: 1;
    height: 100%;
    background-color: #070a11;
    border-radius: 1px;
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}
.led-segment.active-safe {
    background-color: var(--color-safe);
    box-shadow: 0 0 4px var(--color-safe);
}
.led-segment.active-hazard {
    background-color: var(--color-hazard);
    box-shadow: 0 0 4px var(--color-hazard);
}
.led-segment.active-warning {
    background-color: #ff9900;
    box-shadow: 0 0 4px #ff9900;
}

/* 4. Radar Chart Styling */
.radar-chart-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    height: 100%;
    padding: 10px 0;
}
.radar-grid {
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 1px;
    fill: none;
}
.radar-grid-line {
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 0.75px;
    stroke-dasharray: 2 2;
}
.radar-axis {
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1px;
}
.radar-limit-pentagon {
    stroke: rgba(255, 51, 51, 0.35);
    stroke-width: 1.5px;
    stroke-dasharray: 3 3;
    fill: none;
}
.radar-polygon {
    fill: rgba(0, 229, 255, 0.12);
    stroke: #00e5ff;
    stroke-width: 2px;
    filter: drop-shadow(0 0 3px rgba(0, 229, 255, 0.4));
    transition: all var(--transition-normal);
}
.radar-polygon.unsafe {
    fill: rgba(255, 51, 51, 0.12);
    stroke: var(--color-hazard);
    filter: drop-shadow(0 0 3px rgba(255, 51, 51, 0.4));
}
.radar-label {
    fill: var(--text-secondary);
    font-size: 9px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    text-anchor: middle;
    dominant-baseline: middle;
}
.radar-value-dot {
    fill: #00e5ff;
    stroke: #ffffff;
    stroke-width: 1px;
    r: 3px;
    transition: all var(--transition-normal);
}
.radar-value-dot.unsafe {
    fill: var(--color-hazard);
}


.info-footer-card {
    background-color: rgba(36, 47, 73, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0 14px 10px 14px;
}
.info-footer-card h4 {
    font-size: 11px;
    color: var(--color-info);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.info-footer-card p {
    font-size: 10.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* TAB 2: CERTIFICATE PARSER LAYOUT */
.parser-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 1100px) {
    .parser-grid {
        grid-template-columns: 1fr;
    }
}
.parser-left-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    background-color: var(--bg-input);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--color-info);
    background-color: rgba(0, 229, 255, 0.02);
}
.drop-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 15px;
    transition: color var(--transition-fast);
}
.upload-dropzone:hover .drop-icon {
    color: var(--color-info);
}
.upload-dropzone h3 {
    font-size: 16px;
    margin-bottom: 6px;
}
.upload-dropzone p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Upload progress loader */
.upload-status {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
}
.spinner-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-info);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--color-info);
    border-radius: 3px;
    transition: width var(--transition-fast);
}

/* Custom Saved Devices List */
.custom-devices-list-container {
    max-height: 400px;
    overflow-y: auto;
}
.custom-devices-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.empty-list-msg {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0;
}
.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}
.device-item:hover {
    border-color: var(--border-focus);
}
.device-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.device-name {
    font-weight: 600;
    color: var(--text-light);
    font-size: 14px;
}
.device-meta {
    font-size: 11px;
    color: var(--text-secondary);
}
.btn-delete-device {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 5px;
    transition: color var(--transition-fast);
}
.btn-delete-device:hover {
    color: var(--color-hazard);
}

/* Right Column Parser form styling */
.parser-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    text-align: center;
    color: var(--text-secondary);
    flex: 1;
}
.placeholder-icon {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.parser-placeholder p {
    font-size: 14px;
    max-width: 400px;
    line-height: 1.6;
}

.divider-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-info);
    letter-spacing: 0.5px;
    margin: 15px 0 10px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.15);
}
.form-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.table-input {
    padding: 6px 10px !important;
    text-align: center;
    font-size: 13px !important;
}
.parser-action-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}
.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: modal-enter 0.3s ease-out;
}
@keyframes modal-enter {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
}
.modal-close:hover {
    color: var(--text-light);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}
.danger-zone {
    background-color: rgba(255, 51, 51, 0.05);
    border: 1px dashed rgba(255, 51, 51, 0.3);
    border-radius: 6px;
    padding: 16px;
}
.danger-zone h4 {
    color: var(--color-hazard);
    font-size: 13.5px;
}


/* ==========================================================================
   PRINT-ONLY STYLES (A4 DSD Report Layout)
   ========================================================================== */
.print-only {
    display: none;
}

@media print {
    /* A4 page setup */
    @page {
        size: A4;
        margin: 12mm 15mm;
    }
    
    /* Hide screen application shell */
    .no-print, #app-container, .modal-overlay, nav, header {
        display: none !important;
    }
    
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 9pt !important;
        line-height: 1.3 !important;
        font-family: Arial, sans-serif !important;
        overflow: visible !important;
        height: auto !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .print-only {
        display: block !important;
    }
    
    #dsd-print-layout {
        width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    /* Header Structure */
    .dsd-header-table {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        border-bottom: 2px solid #000;
        padding-bottom: 6px;
        margin-bottom: 10px;
    }
    .dsd-title-block h1 {
        font-size: 14pt !important;
        color: #000 !important;
        font-weight: bold;
        margin-bottom: 2px;
    }
    .dsd-title-block h2 {
        font-size: 10pt !important;
        color: #555 !important;
        font-weight: normal;
        margin-bottom: 2px;
    }
    .dsd-title-block p {
        font-size: 8pt;
        color: #666;
    }
    .dsd-meta-block {
        text-align: right;
        font-size: 8.5pt;
    }
    .dsd-meta-block p {
        margin-bottom: 2px;
    }
    .print-status-safe {
        color: #008000 !important;
        font-weight: bold;
        border: 1px solid #008000;
        padding: 2px 6px;
        border-radius: 4px;
        display: inline-block;
    }
    .print-status-unsafe {
        color: #c00000 !important;
        font-weight: bold;
        border: 1px solid #c00000;
        padding: 2px 6px;
        border-radius: 4px;
        display: inline-block;
    }
    
    /* Info Blocks */
    .dsd-info-table {
        width: 100%;
        margin-bottom: 8px;
        border-collapse: collapse;
    }
    .dsd-info-table td {
        padding: 4px 6px;
        border: 1px solid #ccc;
        font-size: 8.5pt;
    }
    .editable-print-field {
        background-color: #fafafa;
        font-weight: bold;
        color: #111;
        outline: none;
    }
    
    /* Section Headings */
    #dsd-print-layout h3 {
        font-size: 9pt !important;
        color: #000 !important;
        border-bottom: 1px solid #000;
        padding-bottom: 2px;
        margin: 8px 0 5px 0;
        text-transform: uppercase;
        font-weight: bold;
    }
    
    /* Tables on printout */
    .dsd-components-table, .dsd-verification-table {
        width: 100%;
        border-collapse: collapse !important;
        margin-bottom: 8px;
        border: 1px solid #333 !important;
    }
    .dsd-components-table th, .dsd-verification-table th {
        background-color: #d8d8d8 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color: #000;
        font-size: 8pt;
        font-weight: bold;
        text-align: left;
        border: 1px solid #333 !important;
        padding: 4px 5px;
    }
    .dsd-components-table td, .dsd-verification-table td {
        border: 1px solid #333 !important;
        padding: 4px 5px;
        font-size: 8pt;
        vertical-align: middle;
    }
    
    .dsd-components-table td.text-center, .dsd-components-table th.text-center,
    .dsd-verification-table td.text-center, .dsd-verification-table th.text-center {
        text-align: center;
    }
    
    /* Alert details on printout */
    .print-alert-box {
        background-color: #fdf8e2;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border: 1px solid #f2e3a1;
        padding: 6px 10px;
        font-size: 8.5pt;
        margin: 8px 0;
        border-radius: 4px;
    }
    
    /* Signatures block */
    .signature-block {
        display: flex;
        justify-content: space-between;
        margin-top: 20px;
    }
    .sig-line {
        width: 45%;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .sig-line .label {
        font-size: 9pt;
        font-weight: bold;
    }
    .sig-line .line {
        border-bottom: 1px solid #000;
        height: 20px;
    }
    .sig-line .sub-label {
        font-size: 7.5pt;
        color: #555;
        margin-top: 3px;
    }
    
    /* Footer */
    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        border-top: 1px solid #ccc;
        padding-top: 4px;
        text-align: center;
        font-size: 7.5pt;
        color: #666;
    }
    
    /* Failure highlighting on print */
    .print-row-fail {
        background-color: #ffcccc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .print-status-fail-text {
        color: #ff0000 !important;
        font-weight: bold;
    }
}

/* ==========================================================================
   AI MODEL SELECTION MODAL
   ========================================================================== */

/* Override existing .modal-overlay for this larger modal */
#modal-model-select.modal-overlay {
    padding: 20px;
    align-items: flex-start;
    overflow-y: auto;
}

.modal-box {
    background: linear-gradient(145deg, #131929, #0d1320);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    margin: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 229, 255, 0.05);
    animation: modal-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-box .modal-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 24px 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.15), rgba(0, 229, 255, 0.05));
    border: 1px solid rgba(0, 229, 255, 0.25);
    font-size: 20px;
    color: var(--color-info);
}

.modal-box .modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 4px;
    display: block;
}

.modal-box .modal-header p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    margin-left: auto;
    transition: color var(--transition-fast);
    min-width: 28px;
}
.modal-close-btn:hover { color: var(--text-light); }

/* Cert info strip */
.modal-cert-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    color: var(--text-secondary);
}
.modal-cert-info i {
    color: var(--color-info);
    margin-right: 6px;
}
.modal-cert-info strong {
    color: var(--text-light);
}

.modal-action-link {
    background: none;
    border: none;
    color: var(--color-info);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.modal-action-link:hover {
    color: var(--text-light);
    background: rgba(0, 229, 255, 0.1);
}

/* Device card grid */
.modal-device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 24px;
    max-height: 55vh;
    overflow-y: auto;
}

.modal-device-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0; /* Prevents card squishing in large lists */
    min-height: 76px;
}

.modal-device-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--color-info), var(--color-accent));
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.modal-device-card:hover {
    background: rgba(0, 229, 255, 0.04);
    border-color: rgba(0, 229, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.05);
}

.modal-device-card:hover::before {
    transform: scaleY(1);
}

.device-card-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
}

.device-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.device-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.3;
    word-break: break-word; /* Wrap long model numbers neatly */
}

.device-card-params {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.param-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.param-badge.highlighted {
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.2);
    color: var(--color-info);
}

.device-card-arrow {
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.modal-device-card:hover .device-card-arrow {
    color: var(--color-info);
    transform: translateX(3px);
}

/* AI badge next to button */
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-info);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.25);
    padding: 2px 8px;
    border-radius: 20px;
}

/* Status badge for AI extraction mode */
.parser-ai-mode-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-info);
    padding: 8px 14px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 6px;
    margin-bottom: 12px;
}

/* Selected states and checkbox overrides for device cards */
.modal-device-card.selected {
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.08);
}

.modal-device-card.selected::before {
    transform: scaleY(1);
}

.modal-device-card.selected .device-card-icon {
    background: rgba(0, 229, 255, 0.1);
    border-color: rgba(0, 229, 255, 0.2);
    color: var(--color-info);
}

.device-card-checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 4px;
}

.device-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-info);
}

.modal-box .modal-footer {
    padding: 18px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Premium cockpit view settings for larger screens */
@media (min-width: 1200px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        min-height: 100vh;
    }
    #app-container {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    .app-header {
        flex-shrink: 0;
        padding: 12px 24px;
    }
    .app-tabs {
        flex-shrink: 0;
        padding: 0 24px;
    }
    .app-tabs .tab-link {
        padding: 12px 20px;
    }
    .app-main-content {
        padding: 15px 24px;
        display: flex;
        flex-direction: column;
        max-width: 100%;
    }
    .tab-content {
        display: none;
    }
    .tab-content.active {
        display: flex;
        flex-direction: column;
    }
    
    /* Loop Calculator tab adjustments */
    #tab-calculator.tab-content.active {
    }
    .cockpit-layout-v2 {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .top-row-grid {
        display: grid;
        grid-template-columns: 1.5fr 1fr;
        gap: 12px;
    }
    .bottom-inputs-grid {
        display: grid;
        grid-template-columns: 1fr 1.25fr 1fr;
        gap: 12px;
    }
    .center-panel {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .visualizer-card {
        display: flex;
        flex-direction: column;
    }
    .visualizer-card .card-body {
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .diagram-container {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #070a11;
        padding: 4px;
        border-radius: 8px;
    }
    #loop-svg {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        display: block;
    }
    .safety-banner {
        flex-shrink: 0;
        padding: 10px 16px;
        gap: 12px;
    }
    .banner-icon-container {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    .banner-text h3 {
        font-size: 15px;
    }
    .banner-text p {
        font-size: 12px;
    }
    .results-panel {
        display: flex;
        flex-direction: column;
    }
    .results-panel .checklist-grid {
        padding: 8px 10px;
        gap: 6px;
    }
    .results-panel .card-header {
        padding: 10px 16px;
    }
    .check-item {
        padding: 5px 10px;
    }
    .check-label {
        font-size: 11.5px;
    }
    .check-pct {
        font-size: 11px;
    }
    .check-progress-container,
    .led-segment-container {
        margin: 4px 0;
        height: 4px;
    }
    .check-comparison-row {
        font-size: 10.5px;
    }
    .marge-text {
        font-size: 10.5px;
    }
    .info-footer-card {
        margin: 0 10px 10px 10px;
        padding: 8px 12px;
        flex-shrink: 0;
    }
    .info-footer-card h4 {
        font-size: 12px;
        margin-bottom: 4px;
    }
    .info-footer-card p {
        font-size: 11px;
    }
    .bottom-inputs-grid .grid-card {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    .bottom-inputs-grid .grid-card .card-header {
        padding: 10px 16px;
        flex-shrink: 0;
    }
    .bottom-inputs-grid .grid-card .card-body {
        padding: 12px 16px;
    }
    .form-group {
        margin-bottom: 8px;
    }
    .form-group label {
        margin-bottom: 4px;
        font-size: 12px;
    }
    .form-select, .form-control {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Tab Parser adjustments */
    #tab-parser.tab-content.active {
        overflow: hidden;
    }
    .parser-grid {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr 1.5fr;
        gap: 16px;
        overflow: hidden;
        height: 100%;
        min-height: 0;
    }
    .parser-left-col {
        display: flex;
        flex-direction: column;
        gap: 16px;
        height: 100%;
        overflow-y: auto;
        padding-right: 4px;
    }
    #parser-results-form {
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
        min-height: 0;
    }
    #parser-results-form.grid-card {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    #parser-results-form .card-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }
    #parser-results-form .parser-action-footer {
        flex-shrink: 0;
    }
    .upload-dropzone {
        padding: 24px 16px;
    }
    .drop-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
}

/* Cascading Filters */
.cascading-filters-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.cascading-filters-row .form-select {
    font-size: 11px;
    padding: 4px 6px;
    height: 28px;
    border-radius: 4px;
}

/* Loop Metadata bar styles */
.loop-metadata-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.meta-inline-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 150px;
}
.meta-inline-group label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-bottom: 0;
}
.meta-inline-group .form-control-sm {
    flex: 1;
    height: 24px;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-light);
}
@media (max-width: 992px) {
    .loop-metadata-bar {
        gap: 8px;
    }
    .meta-inline-group {
        min-width: calc(50% - 8px);
    }
}
@media (max-width: 576px) {
    .meta-inline-group {
        min-width: 100%;
    }
}

/* =========================================
   IEC 60079-14 THEORY TAB STYLING
   ========================================= */
.theory-content {
    padding: 30px 40px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-light);
}

.theory-content h3 {
    font-size: 22px;
    color: var(--color-primary);
    margin-top: 40px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    font-weight: 600;
}

.theory-content h3:first-child {
    margin-top: 0;
}

.theory-content p {
    margin-bottom: 20px;
}

.theory-content strong {
    color: #fff;
    font-weight: 600;
}

.theory-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.rule-box {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.rule-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rule-box:hover {
    border-color: var(--color-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(14, 165, 233, 0.15);
    background: rgba(30, 41, 59, 0.7);
}

.rule-box:hover::before {
    opacity: 1;
}

.rule-box h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rule-box h4 i {
    color: var(--color-primary);
    font-size: 18px;
}

.formula {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 26px;
    font-weight: 700;
    color: var(--color-hazard);
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    margin: 20px 0 !important;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    letter-spacing: 2px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.formula sub {
    font-size: 14px;
    color: var(--text-muted);
}

.theory-note {
    background: rgba(14, 165, 233, 0.08);
    border-left: 4px solid var(--color-primary);
    padding: 16px 24px;
    border-radius: 0 8px 8px 0;
    margin: 25px 0;
    font-size: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.theory-note i {
    color: var(--color-primary);
    font-size: 20px;
    margin-top: 2px;
}

/* SVG Visualization */
.theory-visualization {
    margin: 40px 0;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.theory-svg {
    width: 100%;
    height: auto;
    display: block;
}

.svg-zone-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}

.svg-block-title {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
}

.svg-block-sub {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 300;
}

.svg-block-params {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .theory-content {
        padding: 20px;
    }
    .theory-rules-grid {
        grid-template-columns: 1fr;
    }
}


