/* ==========================================================================
   BIEROL Brewery Operations Dashboard - State-of-the-Art Design System
   ========================================================================== */

:root {
    color-scheme: dark;
    --bg-canvas: #0b0e14;
    --bg-card: #131822;
    --bg-card-hover: #192130;
    --bg-surface: #1e2638;
    --bg-surface-elevated: #263147;
    --bg-modal: #151b27;
    --border-subtle: #1e293b;
    --border-medium: #2d3b52;
    --border-bright: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Process state colors */
    --amber: #f59e0b;
    --amber-light: #fbbf24;
    --amber-glow: rgba(245, 158, 11, 0.25);
    
    --cyan: #06b6d4;
    --cyan-light: #22d3ee;
    --cyan-glow: rgba(6, 182, 212, 0.25);
    
    --emerald: #10b981;
    --emerald-light: #34d399;
    --emerald-glow: rgba(16, 185, 129, 0.25);
    
    --crimson: #ef4444;
    --crimson-light: #f87171;
    --crimson-glow: rgba(239, 68, 68, 0.35);
    
    --purple: #a855f7;
    --purple-light: #c084fc;
    --purple-glow: rgba(168, 85, 247, 0.25);
    
    --slate: #64748b;
    --slate-glow: rgba(100, 116, 139, 0.2);
    
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.55), 0 8px 10px -6px rgba(0, 0, 0, 0.45);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Type scale: the only font sizes the dashboard uses (SPA and classic UI). */
    --fs-micro: 10px;
    --fs-2xs: 11px;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-md: 14px;
    --fs-lg: 16px;
    --fs-xl: 18px;
    --fs-2xl: 20px;
    --fs-3xl: 24px;
    --fs-4xl: 32px;
    --fs-display: 38px;

    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-display: 800;

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    --fluid-empty: #334155;
}

[data-theme="light"] {
    color-scheme: light;
    --fluid-empty: #cbd5e1;
    --bg-canvas: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-surface: #e2e8f0;
    --bg-surface-elevated: #cbd5e1;
    --bg-modal: #ffffff;
    --border-subtle: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-bright: #94a3b8;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --amber: #d97706;
    --amber-light: #b45309;
    --amber-glow: rgba(217, 119, 6, 0.2);
    
    --cyan: #0891b2;
    --cyan-light: #0e7490;
    --cyan-glow: rgba(8, 145, 178, 0.2);
    
    --emerald: #059669;
    --emerald-light: #047857;
    --emerald-glow: rgba(5, 150, 105, 0.2);
    
    --crimson: #dc2626;
    --crimson-light: #b91c1c;
    --crimson-glow: rgba(220, 38, 38, 0.25);
    
    --purple: #9333ea;
    --purple-light: #7e22ce;
    --purple-glow: rgba(147, 51, 234, 0.2);
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

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

body.bierol-app {
    font-family: var(--font-sans);
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography Helpers */
.font-mono {
    font-family: var(--font-mono);
}

/* Initial loader */
.bierol-initial-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    background: var(--bg-canvas);
    color: var(--text-secondary);
}
.bierol-initial-loader .spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-medium);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   App Layout & Top Navigation
   ========================================================================== */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    background: rgba(11, 14, 20, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
[data-theme="light"] .top-nav {
    background: rgba(255, 255, 255, 0.92);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
}
.brand-logo-img {
    height: 34px;
    width: auto;
    object-fit: contain;
    display: block;
}
.brand-logo-img-lg {
    height: 54px;
    width: auto;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}
.brand-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand-sub {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 2px 7px;
    border-radius: 4px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border: 1px solid transparent;
}
.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}
.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-medium);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Telemetry & Alarms Indicator */
.telemetry-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    border-radius: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
    animation: pulse 2s infinite;
}
.pulse-dot.polling {
    background: var(--amber);
    box-shadow: 0 0 8px var(--amber);
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.alarm-kpi-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--crimson);
    color: var(--crimson-light);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.alarm-kpi-pill.has-alarms {
    animation: alarm-badge-pulse 2s infinite;
}

@keyframes alarm-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--crimson-glow); }
    50% { box-shadow: 0 0 0 6px var(--crimson-glow); }
}

/* Action Buttons & Icons */
.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-medium);
}

.btn-wallboard {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    height: 36px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-wallboard i {
    color: var(--amber);
    font-size: var(--fs-sm);
    transition: transform var(--transition-fast);
}

.btn-wallboard:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-medium);
}

.btn-wallboard:hover i {
    transform: scale(1.1);
}

/* User Menu & Role Badge */
.user-menu-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
}
.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--amber), #f97316);
    color: #fff;
    font-weight: var(--fw-bold);
    font-size: var(--fs-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}
.role-tag {
    font-size: var(--fs-micro);
    font-weight: var(--fw-display);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 6px;
    border-radius: 4px;
}
.role-dev { background: rgba(16, 185, 129, 0.22); color: var(--emerald-light); border: 1px solid var(--emerald); }
.role-admin { background: rgba(168, 85, 247, 0.2); color: var(--purple-light); border: 1px solid var(--purple); }
.role-brewer { background: rgba(245, 158, 11, 0.2); color: var(--amber-light); border: 1px solid var(--amber); }
.role-viewer { background: rgba(6, 182, 212, 0.2); color: var(--cyan-light); border: 1px solid var(--cyan); }

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    font-size: var(--fs-sm);
    transition: color var(--transition-fast);
}
.btn-logout:hover {
    color: var(--crimson);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: rgba(11, 14, 20, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-subtle);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
}
[data-theme="light"] .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.96);
}
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: var(--fs-micro);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}
.mobile-nav-item i {
    font-size: var(--fs-xl);
}
.mobile-nav-item.active {
    color: var(--amber);
}

/* ==========================================================================
   Main Content Area & Filters Strip
   ========================================================================== */
.main-viewport {
    flex: 1;
    padding: 24px;
    max-width: 1760px;
    margin: 0 auto;
    width: 100%;
}

/* 5-KPI Filter Strip */
.cellar-filter-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}
.kpi-pills-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.kpi-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.kpi-pill:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
}
.kpi-pill.active {
    color: #fff;
    background: var(--bg-surface-elevated);
    border-color: var(--border-bright);
}
.kpi-pill .badge {
    background: var(--bg-surface);
    padding: 2px 7px;
    border-radius: 12px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
}
.kpi-pill.pill-alarms.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--crimson);
    color: var(--crimson-light);
}

.search-box-wrapper {
    position: relative;
    min-width: 240px;
}
.search-box-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--fs-sm);
}
.search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    font-size: var(--fs-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast);
}
.search-input:focus {
    border-color: var(--amber);
}

/* ==========================================================================
   Responsive Vessel Cards Grid
   ========================================================================== */
.vessel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 18px;
}

.vessel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.vessel-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-lg);
}

/* Card Alarm State */
.vessel-card.has-alarm {
    border-color: var(--crimson);
    box-shadow: 0 0 16px var(--crimson-glow);
    animation: vessel-alarm-border 2s infinite;
}

@keyframes vessel-alarm-border {
    0%, 100% { border-color: var(--crimson); }
    50% { border-color: rgba(239, 68, 68, 0.4); }
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tank-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tank-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    letter-spacing: -0.2px;
}
.tank-stage-badge {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Status Badges */
.badge-empty { background: rgba(100, 116, 139, 0.15); color: var(--slate); border: 1px solid var(--border-subtle); }
.badge-filled { background: rgba(168, 85, 247, 0.15); color: var(--purple-light); border: 1px solid var(--purple); }
.badge-configured { background: rgba(168, 85, 247, 0.2); color: var(--purple-light); border: 1px solid var(--purple); }
.badge-fermenting, .badge-ramp { background: rgba(245, 158, 11, 0.15); color: var(--amber-light); border: 1px solid var(--amber); }
.badge-cooling { background: rgba(6, 182, 212, 0.15); color: var(--cyan-light); border: 1px solid var(--cyan); }
.badge-completed { background: rgba(16, 185, 129, 0.15); color: var(--emerald-light); border: 1px solid var(--emerald); }

.card-recipe-subtitle {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: -6px;
}

/* Card Telemetry Section */
.card-telemetry-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 6px 0;
}
.hero-actual-temp {
    font-size: var(--fs-4xl);
    font-weight: var(--fw-display);
    letter-spacing: -1px;
    color: var(--text-primary);
}
.hero-actual-temp small {
    font-size: var(--fs-xl);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    margin-left: 2px;
}
.setpoint-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}
.setpoint-label {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
}
.setpoint-value {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--text-secondary);
}

.delta-badge {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    padding: 2px 7px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.delta-good { background: rgba(16, 185, 129, 0.15); color: var(--emerald-light); }
.delta-warn { background: rgba(245, 158, 11, 0.15); color: var(--amber-light); }
.delta-crit { background: rgba(239, 68, 68, 0.18); color: var(--crimson-light); }

/* Card Middle Graphic & Sparkline */
.card-vis-row {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 90px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 8px 12px;
}

.tank-svg-vessel {
    width: 60px;
    height: 74px;
    flex-shrink: 0;
}

.card-sparkline-wrap {
    flex: 1;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-sparkline-svg {
    width: 100%;
    height: 100%;
}

/* Card Footer */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.card-footer-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: var(--fw-semibold);
}
.valve-duty-pill {
    color: var(--cyan);
}

/* ==========================================================================
   Slide-Over Tank Inspector Drawer & Mobile Bottom Sheet
   ========================================================================== */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}
.drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 580px;
    max-width: 100vw;
    background: var(--bg-card);
    border-left: 1px solid var(--border-medium);
    box-shadow: var(--shadow-xl);
    z-index: 201;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.drawer-panel.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.drawer-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.drawer-title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-display);
    letter-spacing: -0.3px;
}
.btn-close-drawer {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-surface);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-close-drawer:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

/* Drawer Tabs */
.drawer-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 6px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-canvas);
    padding: 10px 16px;
    overflow: hidden;
}
.drawer-tab {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 9px 10px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.drawer-tab:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-medium);
}
.drawer-tab.active {
    color: var(--amber);
    background: rgba(245, 158, 11, 0.14);
    border-color: var(--amber);
    box-shadow: 0 0 10px var(--amber-glow);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Process Stepper */
.process-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 10px 0;
}
.stepper-progress-line {
    position: absolute;
    top: 24px;
    left: 20px;
    right: 20px;
    height: 3px;
    background: var(--border-medium);
    z-index: 1;
}
.stepper-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--amber), var(--cyan));
    transition: width var(--transition-normal);
}
.step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: default;
}
.step-node {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--border-bright);
    color: var(--text-muted);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.step-item.active .step-node {
    background: var(--amber);
    border-color: var(--amber-light);
    color: #fff;
    box-shadow: 0 0 10px var(--amber-glow);
}
.step-item.completed .step-node {
    background: var(--emerald);
    border-color: var(--emerald);
    color: #fff;
}
.step-label {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-align: center;
}
.step-item.active .step-label {
    color: var(--text-primary);
    font-weight: var(--fw-bold);
}

/* Contextual Actions Panel */
.action-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.action-box-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.action-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: var(--fw-semibold);
    transition: all var(--transition-fast);
}
.btn-xs {
    padding: 3px 8px;
    font-size: var(--fs-2xs);
}
.btn-primary {
    background: var(--amber);
    color: #111;
}
.btn-primary:hover {
    background: var(--amber-light);
    box-shadow: 0 0 12px var(--amber-glow);
}
.btn-secondary {
    background: var(--bg-surface-elevated);
    border-color: var(--border-medium);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--border-bright);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--crimson);
    color: var(--crimson-light);
}
.btn-danger:hover {
    background: var(--crimson);
    color: #fff;
}
.btn-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Multi-Metric Telemetry Chart Box */
.chart-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chart-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
}
.time-pills {
    display: flex;
    gap: 4px;
}
.time-pill {
    padding: 4px 8px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
}
.time-pill.active {
    background: var(--amber);
    color: #111;
    border-color: var(--amber);
}
.chart-container-svg {
    width: 100%;
    height: 220px;
}

/* Comments & Alarms List */
.comment-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.comment-type-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: var(--fs-micro);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
}

/* ==========================================================================
   3-Step Live Hardware Handshake Modal
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}
.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.handshake-modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 520px;
    max-width: 100%;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.handshake-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-display);
    letter-spacing: -0.2px;
}
.handshake-subtitle {
    font-size: var(--fs-md);
    color: var(--text-secondary);
    margin-top: -12px;
}

.handshake-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 16px;
}
.handshake-step-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.handshake-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    color: var(--text-muted);
}
.handshake-step-row.done .handshake-step-icon {
    background: var(--emerald);
    border-color: var(--emerald);
    color: #fff;
}
.handshake-step-row.active .handshake-step-icon {
    background: var(--amber);
    border-color: var(--amber);
    color: #111;
    animation: pulse 1.2s infinite;
}
.handshake-step-row.timeout .handshake-step-icon {
    background: var(--crimson);
    border-color: var(--crimson);
    color: #fff;
}
.handshake-step-label {
    flex: 1;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
}
.handshake-timer {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--amber);
}

/* ==========================================================================
   Brewery TV / Wallboard Mode (/tv)
   ========================================================================== */
.tv-wallboard-view {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #07090e;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
}

.tv-header {
    height: 60px;
    padding: 0 24px;
    background: #0c1017;
    border-bottom: 1px solid #1a2233;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tv-clock {
    font-family: var(--font-mono);
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    color: var(--amber);
}

.tv-wallboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
    overflow: hidden;
    height: calc(100vh - 60px);
}

.tv-vessel-card {
    background: #0f1520;
    border: 1px solid #1f2b3e;
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.tv-vessel-card.tv-alarm {
    border-color: var(--crimson);
    box-shadow: inset 0 0 24px var(--crimson-glow), 0 0 20px var(--crimson-glow);
    animation: tv-alarm-pulse 1.5s infinite;
}

@keyframes tv-alarm-pulse {
    0%, 100% { border-color: var(--crimson); }
    50% { border-color: rgba(239, 68, 68, 0.4); }
}

.tv-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.tv-tank-name {
    font-size: var(--fs-lg);
    font-weight: var(--fw-display);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-recipe-name {
    font-size: var(--fs-xs);
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-temp-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.tv-actual-temp {
    font-size: var(--fs-display);
    font-weight: var(--fw-display);
    font-family: var(--font-mono);
    letter-spacing: -1.5px;
}
.tv-setpoint {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: #94a3b8;
    font-family: var(--font-mono);
}

/* ==========================================================================
   Recipe Fermentation Profile Preview Curve
   ========================================================================== */
.recipe-curve-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.recipe-curve-svg {
    width: 100%;
    height: 180px;
}

/* Forms & Tables */
.bierol-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-md);
}
.bierol-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: var(--fw-bold);
    border-bottom: 1px solid var(--border-subtle);
}
.bierol-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.bierol-table tr:hover td {
    background: var(--bg-surface);
}

.bierol-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.bierol-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
}
.bierol-input {
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--fs-md);
    outline: none;
    color-scheme: inherit;
}
.bierol-input:focus {
    border-color: var(--amber);
}
.calibration-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.calibration-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast-item {
    background: var(--bg-modal);
    border: 1px solid var(--border-bright);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    pointer-events: auto;
    animation: toast-in 0.25s ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Diff formatting */
.diff-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    margin-top: 4px;
    flex-wrap: wrap;
}
.diff-old {
    color: var(--crimson-light);
    text-decoration: line-through;
    background: rgba(239, 68, 68, 0.15);
    padding: 1px 5px;
    border-radius: 3px;
}
.diff-arrow {
    color: var(--text-muted);
}
.diff-new {
    color: var(--emerald-light);
    font-weight: var(--fw-bold);
    background: rgba(16, 185, 129, 0.15);
    padding: 1px 5px;
    border-radius: 3px;
}

/* Modals & Editors */
.editor-modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 620px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
}
.step-duration-helper {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.audit-filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.calibration-matrix-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1199px) {
    .vessel-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 767px) {
    .top-nav {
        padding: 0 12px;
        height: 56px;
    }
    .top-nav .nav-links,
    .top-nav .btn-wallboard,
    .top-nav .brand-title,
    .top-nav .telemetry-label-text,
    .top-nav .alarm-label-text,
    .top-nav .user-display-name,
    .top-nav .role-tag {
        display: none;
    }
    .brand-logo-img {
        height: 28px;
    }
    .nav-actions {
        gap: 6px;
    }
    .telemetry-status-pill {
        padding: 6px;
    }
    .alarm-kpi-pill {
        padding: 4px 8px;
    }
    .user-menu-badge {
        padding: 3px 6px;
        gap: 4px;
    }
    .drawer-tabs {
        grid-template-columns: repeat(2, 1fr);
        padding: 8px 12px;
        gap: 6px;
    }
    .drawer-tab {
        padding: 8px 6px;
        font-size: var(--fs-xs);
    }
    .calibration-form-grid-2,
    .calibration-form-grid-3 {
        grid-template-columns: 1fr;
    }
    .mobile-bottom-nav {
        display: flex;
    }
    .main-viewport {
        padding: 16px;
        padding-bottom: 74px;
    }
    .vessel-grid {
        grid-template-columns: 1fr;
    }
    .drawer-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 88vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        border-left: none;
        border-top: 1px solid var(--border-medium);
        transform: translateY(100%);
    }
    .drawer-panel.open {
        transform: translateY(0);
    }
    .tv-wallboard-view {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    .tv-header {
        padding: 10px 14px;
        height: auto;
        flex-wrap: wrap;
        gap: 8px;
    }
    .tv-header .brand-title {
        display: none;
    }
    .tv-clock {
        font-size: var(--fs-lg);
    }
    .tv-wallboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto;
        height: auto;
        overflow: visible;
    }
    .tv-vessel-card {
        min-height: 138px;
        overflow: visible;
    }
    .tv-actual-temp {
        font-size: var(--fs-3xl);
    }
    .tv-setpoint {
        font-size: var(--fs-sm);
    }
}

/* App Footer & Aeddix Branding */
.app-footer {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card);
    padding: 14px 24px;
    margin-top: auto;
    z-index: 20;
}

.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.footer-title {
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
}

.footer-divider {
    opacity: 0.4;
}

.footer-meta {
    font-size: var(--fs-2xs);
}

/* Aeddix Powered-By Branding */
.powered-by-aeddix {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.powered-by-aeddix:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-medium);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.powered-by-text {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.aeddix-brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.aeddix-brand-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    color: var(--amber);
}

.aeddix-brand-text {
    font-family: var(--font-sans);
    font-weight: var(--fw-display);
    font-size: var(--fs-sm);
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

[data-theme="light"] .powered-by-aeddix {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .powered-by-aeddix:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .aeddix-brand-text {
    color: #0f172a;
}

/* Plotly Dark Mode Customizations */
.js-plotly-plot .plotly .modebar {
    top: 4px !important;
    right: 6px !important;
    background: transparent !important;
}

.js-plotly-plot .plotly .modebar-group {
    background: rgba(18, 24, 38, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-sm);
    padding: 2px 4px !important;
}

.js-plotly-plot .plotly .modebar-btn path {
    fill: #94a3b8 !important;
}

.js-plotly-plot .plotly .modebar-btn:hover path {
    fill: var(--amber) !important;
}

.chart-container-svg {
    width: 100%;
    min-height: 260px;
}

/* Drawer KPI Grid & Setpoint Highlight */
.drawer-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.drawer-kpi-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: var(--transition-fast);
}

.drawer-kpi-card.kpi-card-target {
    border-color: rgba(245, 159, 0, 0.35);
    background: rgba(245, 159, 0, 0.04);
}

.drawer-kpi-label {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.drawer-kpi-card.kpi-card-target .drawer-kpi-label {
    color: var(--amber);
}

.drawer-kpi-value {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-display);
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.drawer-kpi-card.kpi-card-target .drawer-kpi-value {
    color: var(--amber);
}

.drawer-kpi-value small {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
}



/* ==========================================================================
   Sign-in, administration and account (component classes, no inline styles)
   ========================================================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.text-muted { color: var(--text-muted); }
.text-success { color: var(--emerald); }
.text-danger { color: var(--crimson); }
.text-strong { font-weight: var(--fw-bold); }

:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}

/* Sign-in */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-canvas);
    padding: var(--space-5) var(--space-4);
}
.auth-card {
    width: 420px;
    max-width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-8) var(--space-6);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.auth-brand {
    display: flex;
    justify-content: center;
}
.auth-title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-display);
    text-align: center;
    margin-top: var(--space-2);
}
.auth-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    text-align: center;
    margin-top: calc(-1 * var(--space-2));
}
.auth-form,
.modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.account-code-step {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.account-code-step[hidden] { display: none; }
.code-input {
    font-family: var(--font-mono);
    font-size: var(--fs-xl);
    letter-spacing: 0.3em;
    text-align: center;
}
.btn-block {
    width: 100%;
    justify-content: center;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
}
.btn-compact {
    padding: 6px 14px;
    font-size: var(--fs-xs);
    white-space: nowrap;
}
.btn-action.is-busy {
    opacity: 0.7;
    cursor: progress;
}
.link-button {
    align-self: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--fs-sm);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    padding: var(--space-1);
}
.link-button:hover { color: var(--text-primary); }
.field-hint {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.form-error,
.form-notice {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
}
.form-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--crimson);
    color: var(--crimson-light);
}
.form-notice {
    background: var(--amber-glow);
    border: 1px solid var(--amber);
    color: var(--text-primary);
}
.form-error[hidden],
.form-notice[hidden] { display: none; }
.login-aeddix-badge {
    margin-top: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

/* Administration */
.page-header { margin-bottom: var(--space-6); }
.admin-stack {
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    min-width: 0;
}
.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.admin-card-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-display);
}
.admin-card-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    margin-top: var(--space-1);
    max-width: 60ch;
}
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-6) var(--space-4) !important;
}
.matrix-input { min-width: 95px; }
.matrix-input-wide { min-width: 150px; }
.filter-input { width: 180px; }
.input-compact {
    width: auto;
    min-width: 150px;
    padding: 6px 10px;
}
.person-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.person-name { font-weight: var(--fw-semibold); }
.person-email {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}
.badge-muted {
    font-size: var(--fs-micro);
    font-weight: var(--fw-display);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    vertical-align: middle;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    white-space: nowrap;
}
.status-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.status-active, .status-paired { color: var(--emerald); }
.status-invited, .status-waiting { color: var(--amber); }
.status-disabled, .status-revoked { color: var(--crimson); }
.status-expired { color: var(--text-muted); }
.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.row-actions .btn-icon {
    width: 32px;
    height: 32px;
}
.btn-icon-danger:hover {
    color: #fff;
    background: var(--crimson);
    border-color: var(--crimson);
}
.role-tv { background: rgba(100, 116, 139, 0.22); color: var(--text-secondary); border: 1px solid var(--slate); }
.role-none { background: transparent; color: var(--text-muted); border: 1px dashed var(--border-bright); }
.empty-state {
    padding: var(--space-10);
    text-align: center;
    color: var(--crimson);
}

/* Modals */
.editor-modal.modal-sm { width: 480px; }
.modal-text {
    font-size: var(--fs-md);
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: var(--space-1);
}
.copy-field {
    display: flex;
    gap: var(--space-2);
}
.copy-field .bierol-input { flex: 1; }
.account-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}
.form-section-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
}
.tv-header-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 767px) {
    .auth-card { padding: var(--space-6) var(--space-5) var(--space-5); }
    /* People become stacked cards: name and email, role and status, then actions. */
    .users-table thead { display: none; }
    .users-table,
    .users-table tbody,
    .users-table tr,
    .users-table td {
        display: block;
        width: 100%;
    }
    .users-table tr {
        padding: var(--space-3) 0;
        border-bottom: 1px solid var(--border-subtle);
    }
    .users-table td {
        border: none;
        padding: var(--space-1) 0;
    }
    .users-table tr:hover td { background: transparent; }
    .users-table td:nth-child(2),
    .users-table td:nth-child(3) {
        display: inline-block;
        width: auto;
        margin-right: var(--space-3);
        vertical-align: middle;
    }
    .users-table td:nth-child(4) { display: none; }
    .users-table .row-actions { justify-content: flex-start; }
    .filter-input { width: 100%; }
    .copy-field { flex-direction: column; }
}

/* Header: one line at every width; secondary labels give way first. */
.nav-link,
.brand-title,
.telemetry-status-pill,
.alarm-kpi-pill,
.btn-wallboard,
.user-menu-badge,
.user-display-name {
    white-space: nowrap;
}
.user-display-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-nav { gap: var(--space-4); }
@media (max-width: 1599px) {
    .top-nav .brand-sub,
    .top-nav .user-display-name,
    .top-nav .user-menu-badge .role-tag,
    .top-nav .telemetry-label-text {
        display: none;
    }
}
@media (max-width: 1279px) {
    .top-nav .brand-title,
    .top-nav .alarm-label-text,
    .top-nav .btn-wallboard-label {
        display: none;
    }
    .nav-link { padding: 8px 10px; }
}
@media (max-width: 1023px) {
    .nav-link .nav-link-label { display: none; }
}

/* Inputs show focus with their border and a soft ring, not a second outline. */
.bierol-input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--amber-glow);
}

.page-header h2 i,
.admin-card-title i,
.modal-header h3 i {
    margin-right: var(--space-2);
}
