/* =============================================================================
   ARMOR Shield — Ergonomics & Telemetry Studio Stylesheet
   Styled after armor-exo.com: Geist type, Orbitron wordmark, neutral canvas,
   black pill buttons, brand orange (#eb7900) used sparingly as an accent.
   Company Colors: #5a5a5a, #eb7900, #ffffff, #000000, canvas #f7f7f7
   Supports Light & Dark Mode via [data-theme]
   ============================================================================= */

/* ═══════════════════════════════════════════════════════════════════════
   Design Tokens — Dark Mode (Default)
   ═══════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --bg-base: #000000;
    --bg-surface: #0e0e0e;
    --bg-surface-elevated: #161616;
    --bg-glass: rgba(255, 255, 255, 0.04);

    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(255, 255, 255, 0.28);

    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-dim: rgba(255, 255, 255, 0.45);

    --accent: #eb7900;
    --accent-glow: rgba(235, 121, 0, 0.14);
    --accent-secondary: #5a5a5a;

    /* Primary (pill) button — inverted on dark */
    --btn-primary-bg: #ffffff;
    --btn-primary-fg: #000000;
    --btn-primary-hover: rgba(255, 255, 255, 0.85);

    --emerald: #10b981;
    --emerald-dark: #059669;
    --magenta: #f43f5e;
    --amber: #f59e0b;

    --roll-color: #f43f5e;
    --pitch-color: #10b981;
    --yaw-color: #06b6d4;

    --shadow-glass: none;
    --card-hover-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.6);
    --modal-bg: #0e0e0e;
}

/* ═══════════════════════════════════════════════════════════════════════
   Design Tokens — Light Mode
   ═══════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
    --bg-base: #f7f7f7;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-glass: rgba(0, 0, 0, 0.03);

    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(0, 0, 0, 0.2);

    --text-main: #000000;
    --text-muted: #5a5a5a;
    --text-dim: rgba(90, 90, 90, 0.65);

    --accent: #eb7900;
    --accent-glow: rgba(235, 121, 0, 0.1);
    --accent-secondary: #5a5a5a;

    /* Primary (pill) button — black like armor-exo.com */
    --btn-primary-bg: #000000;
    --btn-primary-fg: #ffffff;
    --btn-primary-hover: #5a5a5a;

    --emerald: #059669;
    --emerald-dark: #047857;
    --magenta: #dc2626;
    --amber: #d97706;

    --roll-color: #dc2626;
    --pitch-color: #059669;
    --yaw-color: #0284c7;

    --shadow-glass: 0 1px 2px rgba(0, 0, 0, 0.04);
    --card-hover-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.12);
    --modal-bg: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════════════
   Core Tokens (shared)
   ═══════════════════════════════════════════════════════════════════════ */
:root {
    --font-ui: 'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-wordmark: 'Orbitron', var(--font-ui);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --radius-sm: 0.625rem;
    --radius-md: 1.25rem;
    --radius-lg: 1.75rem;
    --radius-pill: 999px;
    --tracking-label: 0.14em;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fluid base size: every rem in this sheet scales with the viewport.
   ≈16px on a 1440×900 laptop, up to 22px on large displays, never below 14px. */
html {
    font-size: clamp(14px, min(0.45vw + 9.5px, 0.8vh + 8.8px), 22px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Shell */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: clamp(0.5rem, 1vw, 1.25rem) clamp(0.5rem, 1.4vw, 1.75rem);
    gap: 0.625rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════════════════════════ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.625rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.625rem 1.25rem;
    box-shadow: var(--shadow-glass);
    flex-shrink: 0;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.brand-badge { display: flex; align-items: center; gap: 0.625rem; }
.brand-logo-img { width: 2rem; height: 2rem; object-fit: contain; }
.brand-title { font-family: var(--font-wordmark); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.18em; color: var(--text-main); display: block; line-height: 1.2; }
.brand-sub { font-size: 0.58rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-muted); display: block; }

/* Status Pill */
.status-pill {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.3125rem 0.875rem; border-radius: 62.4375rem;
    font-size: 0.75rem; font-weight: 500; letter-spacing: 0.01em;
    transition: all 0.3s ease; border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
}
.status-pill:hover { filter: brightness(1.1); }
.status-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-pill.connected { background: rgba(16, 185, 129, 0.12); color: var(--emerald); border-color: rgba(16, 185, 129, 0.3); }
.status-pill.disconnected { background: rgba(244, 63, 94, 0.12); color: var(--magenta); border-color: rgba(244, 63, 94, 0.3); }
.status-dot { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: pulse-dot 1.8s infinite; }
@keyframes pulse-dot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: 0.6; } }

/* Header Right */
.header-left { flex-shrink: 0; }
.header-center { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.header-right { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.625rem; }
.header-right button, .tab-btn, .btn-chart-preset, .modal-btn { white-space: nowrap; }
.status-pill { max-width: 100%; min-width: 0; }
.status-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metrics-strip { display: flex; gap: 0.375rem; }
.metric-pill { background: var(--bg-glass); border: 1px solid var(--border-subtle); padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); display: flex; flex-direction: column; align-items: center; transition: background 0.3s ease, border-color 0.3s ease; }
.metric-label { font-size: 0.52rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-dim); }
.metric-value { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--text-main); }

/* Theme Toggle */
.btn-icon { width: 2rem; height: 2rem; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; }
.btn-icon:hover { color: var(--text-main); border-color: var(--border-highlight); }
.btn-icon svg { width: 0.9375rem; height: 0.9375rem; }

/* USB Connect Button (Web Serial) */
.btn-usb-connect {
    display: inline-flex; align-items: center; gap: 0.4375rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.35);
    padding: 0.4375rem 0.875rem; border-radius: var(--radius-pill);
    font-family: var(--font-ui); font-weight: 500; font-size: 0.78rem;
    cursor: pointer; transition: all 0.2s var(--ease);
}
.btn-usb-connect svg { width: 0.875rem; height: 0.875rem; }
.btn-usb-connect:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--emerald);
}
.btn-usb-connect.connected {
    background: rgba(16, 185, 129, 0.18);
    color: var(--emerald);
    border-color: var(--emerald);
}
.btn-usb-connect.connected:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--magenta);
    border-color: var(--magenta);
}

/* Pairing Button */
.btn-pairing { display: inline-flex; align-items: center; gap: 0.4375rem; background: transparent; color: var(--text-main); border: 1px solid var(--border-highlight); padding: 0.4375rem 0.875rem; border-radius: var(--radius-pill); font-family: var(--font-ui); font-weight: 500; font-size: 0.78rem; cursor: pointer; transition: all 0.2s var(--ease); }
.btn-pairing svg { width: 0.875rem; height: 0.875rem; }
.btn-pairing:hover { background: var(--bg-glass); border-color: var(--text-main); }
.btn-pairing.active { background: var(--accent); color: #fff; border-color: var(--accent); animation: pulseBorder 1.5s infinite; }
.btn-pairing .pairing-pulse { display: none; width: 0.4375rem; height: 0.4375rem; background: #fff; border-radius: 50%; }
.btn-pairing.active .pairing-pulse { display: inline-block; animation: blink 1s infinite; }
@keyframes pulseBorder { 0%, 100% { box-shadow: 0 0 0 0 rgba(235, 121, 0, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(235, 121, 0, 0); } }
@keyframes blink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.3; transform: scale(0.7); } }

/* Action Button (Save All CSV) */
.btn-action { display: inline-flex; align-items: center; gap: 0.375rem; background: var(--btn-primary-bg); color: var(--btn-primary-fg); border: 1px solid var(--btn-primary-bg); padding: 0.4375rem 1rem; border-radius: var(--radius-pill); font-family: var(--font-ui); font-weight: 500; font-size: 0.78rem; cursor: pointer; transition: all 0.2s var(--ease); }
.btn-action svg { width: 0.875rem; height: 0.875rem; }
.btn-action:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }

/* ═══════════════════════════════════════════════════════════════════════
   Tab Bar
   ═══════════════════════════════════════════════════════════════════════ */
.tab-bar {
    display: flex; gap: 0.25rem; flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 0.25rem;
    box-shadow: var(--shadow-glass);
}

.tab-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.5rem 1rem; border: none; border-radius: var(--radius-pill);
    background: transparent; color: var(--text-muted);
    font-family: var(--font-ui); font-size: 0.72rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: var(--tracking-label);
    cursor: pointer; transition: all 0.2s var(--ease);
}

.tab-btn svg { width: 0.9375rem; height: 0.9375rem; }

.tab-btn:hover { color: var(--text-main); }

.tab-btn.active {
    color: var(--btn-primary-fg);
    background: var(--btn-primary-bg);
}

/* ═══════════════════════════════════════════════════════════════════════
   Tab Content
   ═══════════════════════════════════════════════════════════════════════ */
.tab-content {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column; gap: 0.75rem;
}
.tab-content:not(.active) { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════
   Shared Panel
   ═══════════════════════════════════════════════════════════════════════ */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-glass);
    transition: background 0.3s ease, border-color 0.3s ease;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.625rem; flex-shrink: 0; }
.panel-title-group { display: flex; align-items: center; gap: 0.625rem; }
.panel-icon { width: 1.875rem; height: 1.875rem; border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center; }
.panel-icon svg { width: 1rem; height: 1rem; }
.panel-icon.accent { background: var(--accent-glow); color: var(--accent); }
.panel-icon.accent-secondary { background: rgba(90, 90, 90, 0.2); color: var(--accent-secondary); }
[data-theme="dark"] .panel-icon.accent-secondary { color: var(--text-muted); }
.panel-title { font-size: 1rem; font-weight: 500; letter-spacing: -0.01em; }
.panel-subtitle { font-size: 0.68rem; color: var(--text-muted); }
.node-count-badge { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; color: var(--text-main); background: var(--bg-glass); border: 1px solid var(--border-subtle); padding: 3px 0.5rem; border-radius: 62.4375rem; }

/* ═══════════════════════════════════════════════════════════════════════
   Ergonomics Tab Layout
   ═══════════════════════════════════════════════════════════════════════ */
.ergo-layout {
    display: flex; gap: 0.75rem; flex: 1; min-height: 0;
}

/* 3D Skeleton Panel */
.skeleton-panel { flex: 1; min-width: 0; }
.skeleton-canvas-area { flex: 1; min-height: 18.75rem; position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-glass); }
.skeleton-canvas-area canvas { display: block; width: 100% !important; height: 100% !important; }

.skeleton-view-btns { display: flex; gap: 0.25rem; }
.btn-snap {
    width: 1.75rem; height: 1.75rem; border-radius: var(--radius-pill);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    color: var(--text-dim); font-family: var(--font-mono);
    font-size: 0.6rem; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease;
}
.btn-snap:hover { color: var(--text-main); border-color: var(--border-highlight); }

/* Configuration Panel */
.config-panel { width: clamp(20rem, 28vw, 30rem); flex-shrink: 0; overflow: hidden; }
.config-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; padding-right: 0.25rem; }

.config-section { display: flex; flex-direction: column; gap: 0.5rem; }
.config-section-title { font-size: 0.6rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-dim); text-transform: uppercase; padding-bottom: 2px; border-bottom: 1px solid var(--border-subtle); }

/* Height input */
.height-input-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.height-input-row label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }
.height-input-row input {
    width: 5rem; padding: 0.3125rem 0.625rem; border-radius: var(--radius-pill);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    color: var(--text-main); font-family: var(--font-mono);
    font-size: 0.82rem; font-weight: 600; text-align: center;
    transition: border-color 0.2s;
}
.height-input-row input:focus { outline: none; border-color: var(--accent); }

/* Tare All & Axis Calibration */
.tare-all-row { display: flex; gap: 0.5rem; }
.btn-calib-wizard {
    flex: 1.3; display: flex; align-items: center; justify-content: center; gap: 0.375rem;
    padding: 0.5rem 0.75rem; border-radius: var(--radius-pill);
    background: transparent; border: 1px solid var(--border-highlight);
    color: var(--text-main); font-family: var(--font-ui); font-weight: 500; font-size: 0.74rem;
    cursor: pointer; transition: all 0.2s var(--ease);
}
.btn-calib-wizard svg { width: 0.875rem; height: 0.875rem; }
.btn-calib-wizard:hover {
    background: var(--bg-glass); border-color: var(--text-main);
}

.btn-tare-all {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.375rem;
    padding: 0.5rem 0.75rem; border-radius: var(--radius-pill);
    background: var(--btn-primary-bg); border: 1px solid var(--btn-primary-bg);
    color: var(--btn-primary-fg); font-family: var(--font-ui); font-weight: 500; font-size: 0.74rem;
    cursor: pointer; transition: all 0.2s var(--ease);
}
.btn-tare-all svg { width: 0.875rem; height: 0.875rem; }
.btn-tare-all:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }

/* IMU Slot Cards */
.imu-slot-list { display: flex; flex-direction: column; gap: 0.375rem; }

.imu-slot-card {
    background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
    border-radius: 0.875rem; padding: 0.625rem 0.75rem;
    transition: all 0.2s var(--ease); cursor: default;
}
.imu-slot-card:hover { border-color: var(--border-highlight); }
.imu-slot-card.assigned { border-left: 3px solid var(--accent); }
.imu-slot-card.offline { opacity: 0.5; }
.imu-slot-card.identified {
    border-color: #f59e0b !important;
    border-left: 4px solid #f59e0b !important;
    background: rgba(245, 158, 11, 0.1) !important;
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.45), inset 0 0 12px rgba(245, 158, 11, 0.12) !important;
    animation: pulse-shake-card 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
}

.imu-slot-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.imu-slot-top > :first-child { flex: 1 1 5.5rem; min-width: 0; }
.imu-slot-label { font-size: 0.74rem; font-weight: 600; color: var(--text-main); }
.imu-slot-sublabel { font-size: 0.58rem; color: var(--text-dim); font-weight: 500; }

.imu-slot-controls { display: flex; align-items: center; gap: 0.375rem; }

.imu-node-select {
    padding: 3px 0.375rem; border-radius: var(--radius-pill);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    color: var(--text-main); font-family: var(--font-mono);
    font-size: 0.7rem; font-weight: 600; cursor: pointer;
}
.imu-node-select:focus { outline: none; border-color: var(--accent); }

.btn-slot-tare {
    width: 1.5rem; height: 1.5rem; border-radius: 0.25rem;
    background: transparent; border: 1px solid transparent;
    color: var(--text-dim); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease;
}
.btn-slot-tare svg { width: 0.8125rem; height: 0.8125rem; }
.btn-slot-tare:hover { color: var(--accent); border-color: rgba(235, 121, 0, 0.3); background: rgba(235, 121, 0, 0.08); }

.btn-slot-calib {
    width: 1.5rem; height: 1.5rem; border-radius: 0.25rem;
    background: transparent; border: 1px solid transparent;
    color: var(--text-dim); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease; font-size: 0.72rem;
}
.btn-slot-calib svg { width: 0.8125rem; height: 0.8125rem; }
.btn-slot-calib:hover { color: #06b6d4; border-color: rgba(6, 182, 212, 0.3); background: rgba(6, 182, 212, 0.08); }

/* Axis Config (collapsible) */
.imu-axis-config { display: none; flex-direction: column; gap: 3px; margin-top: 0.375rem; padding-top: 0.375rem; border-top: 1px solid var(--border-subtle); }
.imu-slot-card.expanded .imu-axis-config { display: flex; }

.axis-row { display: flex; align-items: center; gap: 0.375rem; font-size: 0.65rem; }
.axis-row label { color: var(--text-dim); font-weight: 700; width: 2rem; }
.axis-row select { padding: 2px 0.25rem; font-size: 0.65rem; border-radius: 3px; background: var(--bg-glass); border: 1px solid var(--border-subtle); color: var(--text-main); font-family: var(--font-mono); }
.axis-row .flip-label { display: flex; align-items: center; gap: 3px; color: var(--text-dim); font-size: 0.6rem; cursor: pointer; }
.axis-row input[type="checkbox"] { accent-color: var(--accent); width: 0.75rem; height: 0.75rem; }

.btn-expand-axis {
    width: 1.25rem; height: 1.25rem; border-radius: 3px; background: transparent; border: none;
    color: var(--text-dim); font-size: 0.6rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: color 0.15s;
}
.btn-expand-axis:hover { color: var(--text-main); }

/* ═══════════════════════════════════════════════════════════════════════
   Ergonomic Score Cards
   ═══════════════════════════════════════════════════════════════════════ */
.ergo-score-card {
    background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
    border-radius: 0.875rem; overflow: hidden;
    transition: border-color 0.2s;
}
.ergo-score-card:hover { border-color: var(--border-highlight); }

.score-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border-subtle);
}
.score-card-label { font-size: 0.66rem; font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-main); }
.score-card-badge {
    font-size: 0.55rem; font-weight: 600; letter-spacing: 0.06em;
    padding: 2px 0.5rem; border-radius: 62.4375rem;
    background: rgba(16, 185, 129, 0.15); color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
    transition: all 0.3s ease;
}

.score-card-body { padding: 0.625rem 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }

.score-main-row { display: flex; align-items: center; gap: 0.75rem; }
.score-big { display: flex; align-items: baseline; gap: 2px; }
.score-number { font-family: var(--font-ui); font-size: 1.75rem; font-weight: 500; letter-spacing: -0.035em; color: var(--text-main); }
.score-unit { font-size: 0.65rem; font-weight: 600; color: var(--text-dim); }

.score-gauge-track {
    flex: 1; height: 0.375rem; border-radius: var(--radius-pill);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    overflow: hidden;
}
.score-gauge-fill {
    height: 100%; border-radius: 3px;
    background: var(--emerald); width: 10%;
    transition: width 0.3s ease, background 0.3s ease;
}

/* NIOSH-specific */
.niosh-params { display: flex; gap: 0.625rem; }
.niosh-param { display: flex; flex-direction: column; gap: 1px; }
.np-label { font-size: 0.52rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-dim); text-transform: uppercase; }
.np-val { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; color: var(--text-main); }

.niosh-config-row {
    display: flex; gap: 0.5rem; padding-top: 0.375rem; border-top: 1px solid var(--border-subtle);
}
.niosh-config-row label {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 0.6rem; font-weight: 700; color: var(--text-dim);
}
.niosh-config-row input, .niosh-config-row select {
    padding: 0.25rem 0.5rem; border-radius: var(--radius-sm);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    color: var(--text-main); font-family: var(--font-mono);
    font-size: 0.72rem; font-weight: 600; width: 5rem;
}
.niosh-config-row input:focus, .niosh-config-row select:focus { outline: none; border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════
   Node Status Grid Cards (Data Stream Tab)
   ═══════════════════════════════════════════════════════════════════════ */
.nodes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(16.25rem, 100%), 1fr)); gap: 0.75rem; }
.empty-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 2.5rem 1rem; color: var(--text-dim); font-size: 0.85rem; text-align: center; }

.node-status-card {
    background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); padding: 0.75rem 0.875rem;
    transition: all 0.25s ease; position: relative;
}
.node-status-card:hover { border-color: var(--border-highlight); box-shadow: var(--card-hover-shadow); }
.node-status-card.offline { opacity: 0.4; filter: grayscale(0.7); }
.node-status-card.offline:hover { opacity: 0.55; filter: grayscale(0.4); }
.node-status-card.offline .offline-tag-badge { display: inline-block; }

.offline-tag-badge { display: none; font-size: 0.52rem; font-weight: 800; letter-spacing: 0.06em; color: var(--magenta); background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.3); padding: 1px 0.3125rem; border-radius: 0.25rem; margin-left: 0.375rem; vertical-align: middle; }

.node-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.node-card-title-stack { display: flex; flex-direction: column; gap: 1px; }
.node-card-num { font-size: 0.66rem; font-weight: 500; letter-spacing: 0.04em; color: var(--text-muted); display: flex; align-items: center; }
.node-card-name { font-size: 1.05rem; font-weight: 500; letter-spacing: -0.02em; color: var(--text-main); line-height: 1.2; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-three-dots { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--bg-glass); border: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: center; gap: 3px; cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; }
.btn-three-dots:hover { border-color: var(--border-highlight); }
.btn-three-dots .dot { width: 3px; height: 3px; background: var(--text-muted); border-radius: 50%; }
.btn-three-dots:hover .dot { background: var(--text-main); }

.node-card-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.node-rpy-stack { display: flex; flex-direction: column; gap: 1px; }
.rpy-line { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; color: var(--text-main); }
.rpy-label { color: var(--text-dim); font-weight: 700; margin-right: 2px; }

.node-card-actions-battery { display: flex; align-items: flex-end; gap: 3px; }
.card-icon-btn { width: 1.625rem; height: 1.625rem; background: transparent; border: 1px solid transparent; border-radius: var(--radius-pill); color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.card-icon-btn svg { width: 0.875rem; height: 0.875rem; }
.card-icon-btn:hover { color: var(--text-main); background: var(--bg-glass); border-color: var(--border-subtle); }
.card-icon-btn.btn-card-delete:hover { color: var(--magenta); border-color: rgba(244, 63, 94, 0.3); background: rgba(244, 63, 94, 0.08); }
.card-icon-btn.btn-card-tare:hover { color: var(--accent); border-color: rgba(235, 121, 0, 0.3); background: rgba(235, 121, 0, 0.08); }

/* Battery */
.card-battery-group { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-left: 2px; }
.node-volt-text { font-family: var(--font-mono); font-size: 0.58rem; font-weight: 700; color: var(--emerald); }
.node-battery-shell { width: 3rem; height: 1.125rem; border: 2px solid var(--emerald); border-radius: 0.25rem; padding: 2px; position: relative; background: rgba(16, 185, 129, 0.06); }
.node-battery-shell::after { content: ''; position: absolute; right: -0.25rem; top: 3px; width: 3px; height: 0.5rem; background: var(--emerald); border-radius: 0 2px 2px 0; }
.battery-fill-level { height: 100%; background: var(--emerald-dark); border-radius: 2px; transition: width 0.3s ease, background 0.3s ease; }
.battery-pct-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }

/* Shake Identification Styles */
.node-status-card.identified {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4), 0 0 28px rgba(245, 158, 11, 0.45), inset 0 0 16px rgba(245, 158, 11, 0.12) !important;
    animation: pulse-shake-card 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
    z-index: 5;
}

@keyframes pulse-shake-card {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.5), 0 0 30px rgba(245, 158, 11, 0.55), inset 0 0 18px rgba(245, 158, 11, 0.15);
        transform: translateY(-2px) scale(1.015);
    }
    50% {
        box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25), 0 0 14px rgba(245, 158, 11, 0.25), inset 0 0 8px rgba(245, 158, 11, 0.05);
        transform: translateY(-1px) scale(1.0);
    }
}

.shake-identified-badge {
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.54rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: 1px solid #fbbf24;
    padding: 2px 0.375rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
    text-transform: uppercase;
    animation: fadeInBadge 0.2s ease-out;
}

.node-status-card.identified .shake-identified-badge {
    display: inline-flex;
}

@keyframes fadeInBadge {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

/* Countdown bar hidden as requested */
.shake-identified-bar {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   Real-Time Chart Panel
   ═══════════════════════════════════════════════════════════════════════ */
.chart-panel { flex: 1; min-height: 15.625rem; }
.chart-toolbar { display: flex; gap: 0.375rem; }
.btn-chart-preset { background: transparent; color: var(--text-muted); border: 1px solid var(--border-subtle); padding: 0.3125rem 0.75rem; border-radius: var(--radius-pill); font-family: var(--font-ui); font-size: 0.68rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.btn-chart-preset:hover { color: var(--text-main); border-color: var(--border-highlight); background: var(--bg-glass); }
.btn-chart-preset.danger:hover { color: var(--magenta); border-color: var(--magenta); background: rgba(244, 63, 94, 0.1); }

.chart-split-layout { display: flex; gap: 0.75rem; flex: 1; min-height: 0; }
.channel-selector-sidebar { width: clamp(11rem, 14vw, 16rem); flex-shrink: 0; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: 0.875rem; display: flex; flex-direction: column; overflow: hidden; transition: background 0.3s ease, border-color 0.3s ease; }
.sidebar-title { font-size: 0.55rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-dim); padding: 0.5rem 0.625rem 0.3125rem; border-bottom: 1px solid var(--border-subtle); }
.channel-tree { flex: 1; overflow-y: auto; padding: 3px 0; }

.tree-node-group { border-bottom: 1px solid rgba(128,128,128,0.08); transition: background 0.2s ease, border-color 0.2s ease; }
.tree-node-group.identified {
    background: rgba(245, 158, 11, 0.15) !important;
    border-left: 3px solid #f59e0b !important;
    box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.15);
}
.tree-node-group:last-child { border-bottom: none; }
.tree-node-header { display: flex; align-items: center; justify-content: space-between; padding: 0.375rem 0.625rem; cursor: pointer; transition: background 0.15s ease; }
.tree-node-header:hover { background: var(--bg-glass); }
.tree-node-label { display: flex; align-items: center; gap: 0.4375rem; font-size: 0.72rem; font-weight: 500; color: var(--text-main); cursor: pointer; }
.tree-checkbox { accent-color: var(--accent); width: 0.8125rem; height: 0.8125rem; cursor: pointer; }

.tree-channels-submenu { display: flex; flex-direction: column; padding: 0 0.625rem 0.3125rem 1.75rem; gap: 1px; }
.tree-channel-item { display: flex; align-items: center; gap: 0.4375rem; font-size: 0.68rem; color: var(--text-muted); padding: 2px 0; cursor: pointer; transition: color 0.15s ease; }
.tree-channel-item:hover { color: var(--text-main); }
.channel-color-dot { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; flex-shrink: 0; }
.chart-canvas-wrapper { flex: 1; position: relative; min-height: 0; min-width: 0; }

/* ═══════════════════════════════════════════════════════════════════════
   Node Details Modal
   ═══════════════════════════════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-content { background: var(--modal-bg); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); width: min(36.25rem, 95vw); max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 60px -12px rgba(0,0,0,0.3); animation: modalIn 0.2s ease-out; }
@keyframes modalIn { from { transform: scale(0.95) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle); }
.modal-title-group { display: flex; align-items: center; gap: 0.625rem; }
.modal-node-tag { font-size: 0.58rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--accent); background: var(--accent-glow); border: 1px solid transparent; padding: 3px 0.5625rem; border-radius: var(--radius-pill); }
.modal-title { font-size: 1.1rem; font-weight: 500; letter-spacing: -0.02em; }
.btn-modal-close { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--bg-glass); border: 1px solid var(--border-subtle); color: var(--text-muted); font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.btn-modal-close:hover { color: var(--text-main); border-color: var(--border-highlight); }

.modal-body { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal-meta-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.625rem, 1fr)); gap: 0.5rem; }
.m-field { display: flex; flex-direction: column; gap: 2px; }
.m-label { font-size: 0.55rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-dim); text-transform: uppercase; }
.m-val { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; color: var(--text-main); }
.m-val.status-online { color: var(--emerald); }
.m-val.status-offline { color: var(--magenta); }

.modal-battery-chart-wrap {
    height: 8.125rem;
    width: 100%;
    position: relative;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 0.875rem;
    padding: 0.375rem 0.625rem;
}

.modal-section-title { font-size: 0.6rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-dim); text-transform: uppercase; padding-top: 0.25rem; border-top: 1px solid var(--border-subtle); }
.modal-data-grid { display: grid; gap: 0.375rem; }
.modal-data-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.modal-data-cell { background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.4375rem 0.625rem; display: flex; flex-direction: column; gap: 2px; }
.modal-data-cell.roll-accent  { border-left: 3px solid var(--roll-color); }
.modal-data-cell.pitch-accent { border-left: 3px solid var(--pitch-color); }
.modal-data-cell.yaw-accent   { border-left: 3px solid var(--yaw-color); }
.cell-label { font-size: 0.55rem; font-weight: 500; letter-spacing: var(--tracking-label); color: var(--text-dim); text-transform: uppercase; }
.cell-value { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700; color: var(--text-main); }
.cell-raw { font-family: var(--font-mono); font-size: 0.52rem; color: var(--text-dim); }

.modal-actions-bar { display: flex; flex-wrap: wrap; gap: 0.375rem; padding-top: 0.375rem; border-top: 1px solid var(--border-subtle); }
.modal-btn { display: inline-flex; align-items: center; gap: 0.3125rem; background: transparent; color: var(--text-main); border: 1px solid var(--border-highlight); padding: 0.4375rem 0.875rem; border-radius: var(--radius-pill); font-family: var(--font-ui); font-size: 0.7rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.modal-btn svg { width: 0.8125rem; height: 0.8125rem; }
.modal-btn:hover { color: var(--text-main); border-color: var(--text-main); background: var(--bg-glass); }
.modal-btn.accent { color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); background: var(--btn-primary-bg); }
.modal-btn.accent:hover { color: var(--btn-primary-fg); border-color: var(--btn-primary-hover); background: var(--btn-primary-hover); }
.modal-btn.danger { color: var(--magenta); border-color: rgba(244, 63, 94, 0.3); }
.modal-btn.danger:hover { background: rgba(244, 63, 94, 0.12); border-color: var(--magenta); }

/* ═══════════════════════════════════════════════════════════════════════
   Fall Detection & Emergency Alert UI
   ═══════════════════════════════════════════════════════════════════════ */
.btn-fall-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.28);
    color: #10b981;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.4375rem 0.875rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-fall-status:hover {
    background: rgba(16, 185, 129, 0.16);
    border-color: #10b981;
}
.fall-pulse-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #10b981;
}
.btn-fall-status.disabled {
    background: rgba(100, 116, 139, 0.1);
    border-color: rgba(100, 116, 139, 0.3);
    color: var(--text-dim);
}
.btn-fall-status.disabled .fall-pulse-dot {
    background: var(--text-dim);
    box-shadow: none;
}
.btn-fall-status.alert {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    animation: emergency-badge-pulse 1s infinite alternate;
}
.btn-fall-status.alert .fall-pulse-dot {
    background: #ef4444;
    box-shadow: 0 0 12px #ef4444;
    animation: emergency-dot-pulse 0.6s infinite alternate;
}
@keyframes emergency-badge-pulse {
    0% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.3); }
    100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.8); }
}
@keyframes emergency-dot-pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.3); opacity: 1; }
}

/* Emergency Alert Modal */
.emergency-overlay {
    background: rgba(15, 5, 5, 0.88);
    backdrop-filter: blur(12px);
    z-index: 9999;
}
.emergency-card {
    max-width: 31.25rem;
    text-align: center;
    border: 2px solid #ef4444;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.5), inset 0 0 20px rgba(239, 68, 68, 0.1);
    animation: emergency-card-shake 0.5s ease-in-out;
}
@keyframes emergency-card-shake {
    0%, 100% { transform: translate(0, 0) scale(1); }
    15% { transform: translate(-6px, -2px) scale(1.02); }
    30% { transform: translate(6px, 2px); }
    45% { transform: translate(-4px, 1px); }
    60% { transform: translate(4px, -1px); }
    75% { transform: translate(-2px, 0); }
}
.emergency-icon-wrap {
    position: relative;
    width: 4.25rem;
    height: 4.25rem;
    margin: 0.5rem auto 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    color: #ef4444;
}
.emergency-icon {
    width: 2.25rem;
    height: 2.25rem;
    stroke: #ef4444;
    z-index: 2;
}
.emergency-pulse-ring {
    position: absolute;
    inset: -0.375rem;
    border-radius: 50%;
    border: 2px solid #ef4444;
    animation: emergency-ring-expand 1.2s infinite ease-out;
}
@keyframes emergency-ring-expand {
    0% { transform: scale(0.85); opacity: 0.9; }
    100% { transform: scale(1.4); opacity: 0; }
}
.emergency-title {
    font-family: var(--font-ui);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #ef4444;
    margin: 0 0 0.375rem;
}
.emergency-subtitle {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin: 0 0 1.125rem;
}
.emergency-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    text-align: left;
}
.e-metric {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    padding: 0.5625rem 0.75rem;
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.e-label {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    text-transform: uppercase;
}
.e-val {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}
.e-val.danger {
    color: #ef4444;
    font-size: 1.1rem;
}
.emergency-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.btn-emergency-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 0.6875rem 1.125rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-emergency-dismiss svg { width: 1rem; height: 1rem; }
.btn-emergency-dismiss:hover {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
}
.btn-emergency-ack {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.625rem 1.125rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-emergency-ack svg { width: 0.9375rem; height: 0.9375rem; color: #10b981; }
.btn-emergency-ack:hover {
    border-color: var(--text-main);
}
.btn-emergency-mute {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}
.btn-emergency-mute svg { width: 0.8125rem; height: 0.8125rem; }
.btn-emergency-mute:hover { color: var(--text-muted); }

/* Fall Settings & Log Modal */
.fall-settings-card {
    max-width: 35rem;
}
.fall-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    margin-bottom: 1.125rem;
}
.fall-setting-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 0.375rem;
    padding: 0.625rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.fall-setting-card.full-width {
    grid-column: 1 / -1;
}
.setting-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.setting-title {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-main);
}
.setting-desc {
    font-size: 0.62rem;
    color: var(--text-dim);
}
.toggle-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: #ef4444;
    cursor: pointer;
}
.fall-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.74rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
}
.fall-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.875rem 0 0.5rem;
}
.btn-text-action {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.btn-text-action:hover { color: var(--magenta); }
.fall-log-table-wrap {
    max-height: 12.5rem;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 0.375rem;
}
.fall-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}
.fall-table th {
    background: rgba(128,128,128,0.06);
    color: var(--text-dim);
    font-size: 0.60rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.5rem 0.625rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}
.fall-table td {
    padding: 0.4375rem 0.625rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-muted);
}
.fall-table tr:last-child td { border-bottom: none; }
.fall-status-chip {
    display: inline-block;
    padding: 2px 0.375rem;
    border-radius: 3px;
    font-size: 0.60rem;
    font-weight: 700;
    text-transform: uppercase;
}
.fall-status-chip.active { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.fall-status-chip.dismissed { background: rgba(100, 116, 139, 0.15); color: var(--text-dim); }
.fall-status-chip.acknowledged { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.table-empty-msg {
    text-align: center;
    color: var(--text-dim);
    padding: 1rem !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   Scrollbar & Responsive
   ═══════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 0.3125rem; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.35); }

/* ═══════════════════════════════════════════════════════════════════════
   Axis Calibration Wizard Modal
   ═══════════════════════════════════════════════════════════════════════ */
.wizard-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}
.wizard-card {
    width: min(42.5rem, 95vw);
    max-width: 95vw;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.35);
}

/* Stepper */
.wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: rgba(128, 128, 128, 0.03);
    border-bottom: 1px solid var(--border-subtle);
}
.wizard-step-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
    opacity: 0.5;
    transition: all 0.25s ease;
}
.wizard-step-item.active {
    opacity: 1;
}
.wizard-step-item.completed {
    opacity: 0.9;
}
.step-circle {
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-dim);
    background: var(--bg-surface);
    transition: all 0.25s ease;
}
.wizard-step-item.active .step-circle {
    border-color: var(--btn-primary-bg);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
}
.wizard-step-item.completed .step-circle {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}
.step-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}
.wizard-step-item.active .step-label {
    color: var(--text-main);
}
.step-line {
    flex: 1;
    height: 2px;
    background: var(--border-subtle);
    margin: 0 0.5rem;
    transition: background 0.25s ease;
}
.step-line.completed {
    background: #10b981;
}

/* Wizard Body */
.wizard-body {
    padding: 1rem 1.25rem;
}
.wizard-scope-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid var(--border-subtle);
}
.wizard-scope-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dim);
}
.wizard-slot-select {
    padding: 3px 0.5rem;
    border-radius: 0.25rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.wizard-slot-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Guide Grid */
.wizard-guide-grid {
    display: grid;
    grid-template-columns: 8.75rem 1fr;
    gap: 1rem;
    align-items: center;
}
.wizard-svg-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.pose-svg {
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.2));
}
.wizard-instructions-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.wizard-inst-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-main);
}
.wizard-inst-desc {
    margin: 0;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.wizard-timer-display {
    position: relative;
    width: 5rem;
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.25rem;
}
.progress-ring {
    transform: rotate(-90deg);
}
.progress-ring__circle {
    transition: stroke-dashoffset 0.1s linear;
}
.timer-number {
    position: absolute;
    font-size: 1.05rem;
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--text-main);
}
.wizard-countdown-status {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    font-style: italic;
}

/* Live Sensor Motion Monitor */
.wizard-live-monitor {
    margin-top: 0.875rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(128, 128, 128, 0.04);
    border: 1px solid var(--border-subtle);
}
.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.monitor-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}
.monitor-legend {
    font-size: 0.65rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.3125rem;
}
.dot-active {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}
.monitor-bars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(8.125rem, 100%), 1fr));
    gap: 0.375rem;
}
.motion-bar-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0.25rem 0.375rem;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}
.motion-bar-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.60rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
}
.motion-bar-track {
    height: 0.25rem;
    background: var(--border-subtle);
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.motion-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #06b6d4, #10b981);
    transition: width 0.1s ease;
    border-radius: 2px;
}

/* Results Review */
.wizard-results-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.results-header-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 0.5rem;
}
.banner-icon {
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 50%;
    background: #10b981;
    color: #000;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.banner-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #10b981;
}
.banner-sub {
    font-size: 0.70rem;
    color: var(--text-muted);
}
.results-table-wrap {
    max-height: 12.5rem;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 0.375rem;
}
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.70rem;
}
.results-table th {
    background: rgba(128, 128, 128, 0.06);
    color: var(--text-dim);
    font-size: 0.60rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.5rem 0.625rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}
.results-table td {
    padding: 0.4375rem 0.625rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-muted);
}
.results-table tr:last-child td {
    border-bottom: none;
}
.conf-badge {
    display: inline-block;
    padding: 2px 0.375rem;
    border-radius: 3px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
}
.conf-badge.high {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.conf-badge.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.conf-badge.low {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.axis-tag {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
}
.axis-tag.flipped {
    color: #f43f5e;
}
.axis-tag.normal {
    color: #10b981;
}

/* Wizard Footer */
.wizard-footer-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.875rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}
.modal-btn.success {
    background: #10b981;
    color: #000;
    font-weight: 700;
    border: 1px solid #10b981;
}
.modal-btn.success:hover {
    background: #059669;
    border-color: #059669;
    color: #000;
}

/* ═══════════════════════════════════════════════════════════════════════
   Responsive Breakpoints
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .app-shell { height: auto; min-height: 100vh; }
    .ergo-layout { flex-direction: column; }
    .config-panel { width: 100%; }
    .skeleton-canvas-area { min-height: clamp(18rem, 55vh, 32rem); }
    .chart-split-layout { flex-direction: column; }
    .channel-selector-sidebar { width: 100%; max-height: 11.25rem; }
    .chart-canvas-wrapper { min-height: 18rem; }
    .header-center { order: 3; flex-basis: 100%; justify-content: flex-start; }
}

@media (max-width: 640px) {
    .app-header { padding: 0.625rem 0.875rem; }
    .header-right { justify-content: flex-start; width: 100%; gap: 0.375rem; }
    .metrics-strip { order: -1; width: 100%; }
    .metric-pill { flex: 1; }
    .btn-usb-connect, .btn-pairing, .btn-action, .btn-fall-status { flex: 1 1 auto; justify-content: center; }
    .tab-btn { padding: 0.5rem 0.625rem; letter-spacing: 0.08em; }
    .panel { padding: 0.875rem; }
    .tare-all-row { flex-direction: column; }
    .niosh-config-row, .niosh-params { flex-wrap: wrap; }
    .modal-data-grid.cols-3 { grid-template-columns: 1fr; }
    .emergency-metrics-grid, .fall-controls-grid { grid-template-columns: 1fr; }
    .wizard-guide-grid { grid-template-columns: 1fr; }
    .wizard-stepper .step-label { display: none; }
    .modal-header, .modal-body, .wizard-body { padding-left: 0.875rem; padding-right: 0.875rem; }
}
