:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    padding: 24px;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    margin: -24px -24px 20px -24px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: nowrap;
    gap: 16px;
}

/* Unified Cross-Page Navigation */
.header-nav-group, .analytics-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.nav-link-btn, .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-link-btn:hover, .nav-btn:hover {
    color: var(--text-main);
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
}

.nav-link-btn.active, .nav-btn.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-wrench {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--card-border, #334155);
    border-radius: 8px;
    color: var(--text-main, #f8fafc);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-wrench:hover {
    color: var(--text-main, #ffffff);
    border-color: var(--accent-amber, #f59e0b);
    background: rgba(245, 158, 11, 0.12);
}

.btn-wrench.pending {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--accent-amber, #f59e0b);
    color: var(--accent-amber, #f59e0b);
}

.btn-wrench.clock-unsynced {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--accent-amber, #f59e0b);
}

.time-range-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--card-border);
    padding: 3px 5px;
    border-radius: 8px;
    flex-shrink: 0;
}

.time-btn {
    background: transparent;
    border: none;
    padding: 5px 10px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.time-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.time-btn.active {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    font-weight: 700;
}

.btn-export:hover {
    border-color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-emerald);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

.header-title h1, header h1, .header h2 {
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.header-status-pills {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.btn-wrench.sync-flash {
    animation: sync-glow 1.2s ease;
}

@keyframes sync-glow {
    0% { border-color: var(--accent-emerald); box-shadow: 0 0 16px rgba(16, 185, 129, 0.8); }
    100% { border-color: var(--card-border); box-shadow: none; }
}

.pulse-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
    display: inline-block;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-device-dropdown {
    display: flex;
    align-items: center;
}

.badge-live {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--accent-emerald);
}

.main-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.panel {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

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

.panel-header h2 {
    font-size: 21px;
    font-weight: 600;
}

/* Dynamic Node Matrix */
.node-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 12px;
    align-content: start;
    flex: 1;
}

.node-cell {
    min-height: 192px;
    height: auto;
    background: #0f172a;
    border: 2px solid var(--card-border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    position: relative;
    padding: 12px 10px 10px 10px;
    box-sizing: border-box;
}

.node-cell:hover {
    transform: translateY(-2px) scale(1.03);
    z-index: 10;
}

/* Single group outline states */
.node-cell.group-border-emerald { border-color: #22c55e !important; box-shadow: 0 0 14px rgba(34, 197, 94, 0.4) !important; }
.node-cell.group-border-cyan    { border-color: #00d8f6 !important; box-shadow: 0 0 14px rgba(0, 216, 246, 0.4) !important; }
.node-cell.group-border-amber   { border-color: #f59e0b !important; box-shadow: 0 0 14px rgba(245, 158, 11, 0.4) !important; }
.node-cell.group-border-rose    { border-color: #f43f5e !important; box-shadow: 0 0 14px rgba(244, 63, 94, 0.4) !important; }
.node-cell.group-border-purple  { border-color: #b829ea !important; box-shadow: 0 0 14px rgba(184, 41, 234, 0.4) !important; }
.node-cell.group-border-blue    { border-color: #3b82f6 !important; box-shadow: 0 0 14px rgba(59, 130, 246, 0.4) !important; }

/* Multi-Group Cycling Outline Base */
.node-cell.multi-group-cycling {
    border-width: 2px;
    border-style: solid;
}

/* Fallback borders when no group cycling or specific group class is active */
.node-cell.online:not(.multi-group-cycling):not([class*="group-border-"]) {
    border: 2px solid var(--accent-emerald);
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

.node-cell.local-node:not(.multi-group-cycling):not([class*="group-border-"]) {
    border: 2px solid var(--accent-cyan);
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.35);
}

.node-cell.syncing {
    border-color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.15);
    animation: pulse 1.5s infinite;
}

.node-cell.offline {
    opacity: 0.55;
    border-color: var(--card-border);
    background: #1e293b;
}

.node-id {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.node-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 38px;
    margin: 0;
    padding: 0 4px;
}

.node-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    line-height: 1.25;
    margin: 0;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
}

.btn-node-edit {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-user-select: none; /* Safari */
    user-select: none; /* Standard syntax */
}

.node-cell:hover .btn-node-edit,
.node-card-header:hover .btn-node-edit {
    opacity: 0.75;
    visibility: visible;
}

.btn-node-edit:hover {
    opacity: 1 !important;
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.15);
}

.node-telemetry-sub {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.2px;
    margin: 1px 0 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    opacity: 0.9;
    flex-wrap: wrap;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.node-cell:hover .node-telemetry-sub {
    color: var(--accent-cyan);
    opacity: 1;
}

.telemetry-separator {
    color: #475569;
    font-size: 11px;
    margin: 0 1px;
}

.telemetry-chip {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.telemetry-cfg {
    color: #94a3b8;
    font-size: 11px;
}

.node-packet-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(51, 65, 85, 0.45);
    border-radius: 6px;
    padding: 3px 8px;
    margin: 4px 0 6px 0;
    width: 100%;
    box-sizing: border-box;
}

.packet-stats-label {
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.3px;
}

.packet-stats-val {
    font-weight: 600;
    font-size: 11.5px;
}

.packet-health-pct {
    color: var(--accent-emerald);
    font-weight: 700;
    font-size: 11px;
}

.node-pricing-box {
    width: 100%;
    margin: 2px 0 6px 0;
}

.node-pricing-listbox {
    background: #090e17;
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 8px;
    padding: 6px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
}

.fancy-rule-card {
    width: 100%;
    background: #131d2e;
    border: 1px solid rgba(51, 65, 85, 0.85);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all 0.15s ease;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
    box-sizing: border-box;
    cursor: default;
}

.fancy-rule-card:hover {
    background: #1a2538;
    border-color: var(--accent-cyan);
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.25);
}

.fancy-rule-card.dragging {
    opacity: 0.35;
    background: rgba(6, 182, 212, 0.15);
}

.fancy-rule-card.drag-over {
    border-top: 2px solid var(--accent-cyan);
    background: rgba(6, 182, 212, 0.25);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.45);
}

.rule-card-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.drag-handle {
    font-size: 15px;
    color: #64748b;
    line-height: 1;
    flex-shrink: 0;
    letter-spacing: -1.5px;
    cursor: grab;
    opacity: 0.8;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.drag-handle:hover {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.15);
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.rule-index-badge {
    font-size: 12px;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.35);
    padding: 2px 5px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1.2;
}

.btn-rule-delete {
    margin-left: auto;
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    opacity: 0.6;
    flex-shrink: 0;
}

.fancy-rule-card:hover .btn-rule-delete {
    opacity: 1;
}

.btn-rule-delete:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.rule-card-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    padding-left: 2px;
}

.rule-chip {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.3;
}

.chip-price {
    background: rgba(6, 182, 212, 0.2);
    color: #e0f2fe;
    border: 1px solid rgba(6, 182, 212, 0.45);
    font-weight: 800;
}

.chip-freeplay {
    background: rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
    border: 1px solid var(--accent-emerald);
    font-weight: 800;
}

.chip-credits {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
}

.chip-days {
    background: rgba(245, 158, 11, 0.18);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.45);
    font-weight: 600;
}

.chip-dates {
    background: rgba(168, 85, 247, 0.18);
    color: #e9d5ff;
    border: 1px solid rgba(168, 85, 247, 0.45);
    font-weight: 600;
}

.chip-time {
    background: rgba(6, 182, 212, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(6, 182, 212, 0.45);
    font-weight: 600;
}

.node-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

.node-badge-group {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    margin: 0;
    padding: 0;
}

.node-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0px;
    min-width: 0;
    height: 28px;
    font-size: 15px;
    padding: 0 4px;
    border-radius: 6px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-badge-btn {
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.node-badge-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
    filter: brightness(1.2);
}

.node-badge-btn:active, .node-badge-btn.pulse-active {
    transform: scale(0.94);
    filter: brightness(1.4);
    box-shadow: 0 0 10px var(--accent-cyan);
}

.badge-speaker-svg {
    display: inline-block;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    margin-left: 3px;
    flex-shrink: 0;
    opacity: 0.95;
}

/* Badge Lifecycle States: Red (Problem), Yellow (Setup/Sync), Green (Ready -> Fade Out Completely) */
.node-badge-red,
.node-badge-espnow-disabled,
.node-badge-telnet-disabled,
.node-badge-http-disabled {
    opacity: 1 !important;
    background: rgba(244, 63, 94, 0.22) !important;
    color: var(--accent-rose) !important;
    border: 1px solid rgba(244, 63, 94, 0.5) !important;
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.35);
    animation: badgePulseError 2.5s infinite ease-in-out;
}

.node-badge-yellow,
.node-badge-http-insecure {
    opacity: 1 !important;
    background: rgba(245, 158, 11, 0.22) !important;
    color: var(--accent-amber) !important;
    border: 1px solid rgba(245, 158, 11, 0.5) !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
    animation: badgePulseSetup 1.5s infinite ease-in-out;
}

.node-badge-green,
.node-badge-direct,
.node-badge-telnet,
.node-badge-https,
.node-badge-online {
    animation: badgeFadeOut 3.5s forwards ease-out;
}

/* Faded Out: stays completely invisible and inert until a problem or status change occurs */
.node-badge-faded-out,
.node-badge-faded-out:hover {
    opacity: 0 !important;
    background: transparent !important;
    color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    pointer-events: none !important;
    cursor: default !important;
}

.node-badge-local {
    background: var(--accent-cyan);
    color: #0f172a;
    font-weight: 800;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.node-badge-hidden {
    visibility: hidden;
    pointer-events: none;
    border: 1px solid transparent;
}

@keyframes badgeFadeOut {
    0% {
        opacity: 1;
        background: rgba(16, 185, 129, 0.38);
        color: #ffffff;
        border: 1px solid var(--accent-emerald);
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.55);
    }
    30% {
        opacity: 1;
        background: rgba(16, 185, 129, 0.30);
        color: #ffffff;
        border: 1px solid var(--accent-emerald);
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
    }
    100% {
        opacity: 0;
        background: transparent;
        color: transparent;
        border-color: transparent;
        box-shadow: none;
    }
}

@keyframes badgePulseSetup {
    0%, 100% {
        background: rgba(245, 158, 11, 0.18);
        border-color: rgba(245, 158, 11, 0.4);
        color: var(--accent-amber);
    }
    50% {
        background: rgba(245, 158, 11, 0.35);
        border-color: var(--accent-amber);
        color: #ffffff;
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    }
}

@keyframes badgePulseError {
    0%, 100% {
        background: rgba(244, 63, 94, 0.18);
        border-color: rgba(244, 63, 94, 0.4);
        color: var(--accent-rose);
    }
    50% {
        background: rgba(244, 63, 94, 0.32);
        border-color: var(--accent-rose);
        color: #ffffff;
        box-shadow: 0 0 8px rgba(244, 63, 94, 0.4);
    }
}

.badge-repeat {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    background: rgba(6, 182, 212, 0.2);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.4);
}

.node-badge-offline {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Progress Bar */
.progress-container {
    background: #0f172a;
    border-radius: 8px;
    height: 24px;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--card-border);
    margin: 12px 0;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

/* Form Controls */
.btn {
    background-color: var(--accent-cyan);
    color: #0f172a;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background-color: #38bdf8;
}

.btn-secondary {
    background-color: var(--card-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 14px;
}

.btn-emerald {
    background-color: var(--accent-emerald);
    color: #0f172a;
}

.btn-block {
    width: 100%;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: white;
    font-size: 15px;
}

/* Log Table */
.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.log-table th {
    text-align: left;
    background-color: #0f172a;
    padding: 10px 14px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--card-border);
}

.log-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    white-space: nowrap;
}

/* In an auto-layout table, a cell's own content normally sets a hard lower
   bound on its column's width - a long Machine name would force the column
   (and the whole table) to grow to fit it. max-width: 0 + width: 100% opts
   this cell out of that: the column instead takes only whatever space is
   left over from the other columns, and the cell's own ellipsis kicks in
   at exactly that width, however small it shrinks to. */
.log-table td.machine-cell {
    max-width: 0;
    width: 100%;
    overflow: hidden;
}

.log-table td.node-col-cell,
.log-table td.channel-col-cell {
    text-align: center;
}

/* Same shrink-to-fit + ellipsis technique as .log-table's Machine column,
   scoped to the Activity Stream table (identified the same way its own JS
   does, via .card table). */
.card table td {
    white-space: nowrap;
}
.card table td.machine-cell {
    max-width: 0;
    width: 100%;
    overflow: hidden;
}

.filter-tray-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-tray-columns-row {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    border-top: 1px solid rgba(51, 65, 85, 0.3);
    padding-top: 10px;
}

.column-toggle-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-reset-filters {
    margin-left: auto;
    background: none;
    border: none;
    color: #f43f5e;
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
    font-weight: 500;
}

.btn-toggle-all-columns {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
    font-weight: 500;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-emerald {
    color: var(--accent-emerald);
}

.text-cyan {
    color: var(--accent-cyan);
}

.text-amber {
    color: var(--accent-amber);
}

.text-rose {
    color: var(--accent-rose);
}

.text-muted {
    color: var(--text-muted);
}

.badge-tx {
    display: inline-block;
    background: rgba(6, 182, 212, 0.18);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.badge-rx {
    display: inline-block;
    background: rgba(248, 250, 252, 0.12);
    color: #f8fafc;
    border: 1px solid rgba(248, 250, 252, 0.25);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.badge-status-err {
    display: inline-block;
    background: rgba(244, 63, 94, 0.18);
    color: var(--accent-rose);
    border: 1px solid var(--accent-rose);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.badge-status-ok {
    display: inline-block;
    background: rgba(248, 250, 252, 0.12);
    color: #f8fafc;
    border: 1px solid rgba(248, 250, 252, 0.25);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

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

.panel-desc {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.w-0 {
    width: 0%;
}

.w-100 {
    width: 100%;
}

/* Modal Dialog */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.15s ease-out;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-node-summary {
    background: rgba(15, 23, 42, 0.6);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-summary-label {
    font-size: 13px;
    color: var(--text-muted);
}

.modal-node-display {
    font-size: 17px;
    color: var(--accent-cyan);
}

.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.form-group-compact {
    margin-top: 6px;
}

.checkbox-group {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-input {
    cursor: pointer;
}

.checkbox-label {
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 0;
}

.panel-header-wrap {
    flex-wrap: wrap;
    gap: 12px;
}

.filter-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-select {
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #22d3ee 0%, #34d399 100%);
    color: #000000;
    border: 1.5px solid rgba(52, 211, 153, 0.65);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.filter-select:hover,
.filter-select:focus {
    background: linear-gradient(135deg, #67e8f9 0%, #6ee7b7 100%);
    border-color: #34d399;
    color: #000000;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.55);
}

.filter-select option {
    background: #0f172a;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
}

.log-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 18px;
}

.log-slot-cell {
    color: var(--text-muted);
    font-size: 14px;
    white-space: nowrap;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 90%;
    max-width: 460px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.2s ease-out;
}

.modal-content-wide {
    max-width: 520px;
}

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

.modal-header h3 {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 21px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--card-border);
    padding-top: 16px;
}

.btn-sound {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sound:hover {
    background: linear-gradient(135deg, #22d3ee, #60a5fa);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

.sound-indicator {
    display: inline-block;
    transition: transform 0.1s ease;
}

.node-actions {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-muted);
    padding: 6px 14px;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: var(--accent-cyan);
    color: var(--text-main);
    transform: scale(1.1);
}

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

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

/* Card Selection Checkmark (Google Photos Style) */
.node-check-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    z-index: 6;
    color: transparent;
    box-sizing: border-box;
}

.node-cell:hover .node-check-btn {
    opacity: 0.85;
}

.node-check-btn:hover {
    opacity: 1 !important;
    transform: scale(1.15);
    border-color: var(--accent-cyan) !important;
}

.node-cell.selected .node-check-btn,
.node-check-btn.selected {
    opacity: 1 !important;
    background: var(--accent-cyan) !important;
    border-color: var(--accent-cyan) !important;
    color: #0f172a !important;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

.node-cell.selected {
    border: 2px solid var(--accent-cyan) !important;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.45) !important;
    background: rgba(14, 116, 144, 0.18) !important;
    animation: none !important;
}

/* Selection Header Toolbar */
.selection-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent-cyan);
    border-radius: 6px;
    padding: 4px 10px;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
    animation: fadeIn 0.2s ease;
}

.selection-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-cyan);
    white-space: nowrap;
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-select-action {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    color: var(--text-main);
    padding: 3px 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-select-action:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
}

.btn-select-sound {
    color: var(--accent-cyan);
}

.btn-select-config {
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.12);
}

.btn-select-config:hover {
    background: var(--accent-cyan);
    color: #0f172a;
    border-color: var(--accent-cyan);
}

.btn-select-close {
    color: var(--text-muted);
}
.btn-select-close:hover {
    color: var(--accent-rose);
    border-color: var(--accent-rose);
}

/* Fleet Pulse Configuration & Promotional Scheduler */
.fleet-config-section {
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    margin-top: 16px;
    padding-top: 14px;
}

.fleet-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.fleet-config-title {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-cyan);
    margin: 0;
}

.fleet-config-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.target-scope-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.target-scope-pill.selected-active {
    background: rgba(6, 182, 212, 0.12);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.schedule-tab-group {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(15, 23, 42, 0.6);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.schedule-tab-btn {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
}

.schedule-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.schedule-tab-btn.active {
    background: rgba(6, 182, 212, 0.18);
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

.expiry-clock-alert {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--accent-amber);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--accent-amber);
    font-size: 13px;
    font-weight: 600;
}

.schedule-timer-box,
.schedule-box {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 8px;
}

.schedule-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.schedule-box-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

.duration-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.duration-field {
    display: flex;
    align-items: center;
    gap: 4px;
}

.duration-field input {
    width: 60px;
    text-align: center;
    padding: 4px 6px;
}

.unit-label {
    font-size: 13px;
    color: var(--text-muted);
}

.duration-preview-text {
    font-size: 13px;
    color: var(--accent-cyan);
    font-weight: 600;
}

.quick-preset-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    border-top: 1px dashed rgba(148, 163, 184, 0.15);
    padding-top: 8px;
}

.chip-preset-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.4px;
}

.btn-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 12px;
    padding: 3px 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-chip:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.day-pills-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.day-pill {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.day-pill input {
    display: none;
}

.day-pill span {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.day-pill input:checked + span {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #0f172a;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.day-presets {
    display: flex;
    gap: 4px;
}

.btn-chip-xs {
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 2px 7px;
    cursor: pointer;
}

.btn-chip-xs:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.deploy-action-bar {
    margin-top: 14px;
}

.btn-deploy {
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.btn-deploy:disabled {
    background: rgba(148, 163, 184, 0.12) !important;
    color: var(--text-muted) !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
}

.fleet-deploy-feedback {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.2s ease;
}

.fleet-deploy-feedback.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid var(--accent-emerald);
    color: #a7f3d0;
}

.fleet-deploy-feedback.error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid var(--accent-rose);
    color: #fecdd3;
}

.form-grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* =========================================================================
   Top Row Split Layout: Payment Gateways Matrix + Machine Profiles
   ========================================================================= */
.top-row-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1.15fr);
    gap: 24px;
    align-items: stretch;
    transition: grid-template-columns 0.3s cubic-bezier(0.16, 1, 0.3, 1), gap 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.top-row-layout.single-column {
    grid-template-columns: 1fr;
    gap: 0;
}

@media (max-width: 1200px) {
    .top-row-layout {
        grid-template-columns: 1fr;
    }
}

.matrix-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    margin-bottom: 0 !important;
}

.matrix-panel, .profiles-panel {
    margin-bottom: 0 !important;
}

.profiles-panel {
    display: flex;
    flex-direction: column;
}

.panel-header-freeplay {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.header-controls-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.schedule-filter-dropdown-container {
    position: relative;
    display: inline-block;
}

.btn-excel-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 38px;
    padding: 0 10px;
    background: rgba(15, 23, 42, 0.75);
    border: 1.5px solid var(--card-border);
    border-radius: 20px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.btn-excel-filter:hover, .btn-excel-filter.open {
    background: #334155;
    color: #ffffff;
    border-color: var(--accent-cyan);
}

.btn-excel-filter.active {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.35);
}

.filter-arrow {
    font-size: 11px;
    line-height: 1;
    margin-left: 2px;
}

.active-days-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-cyan);
    color: #000000;
    font-size: 11px;
    font-weight: 800;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.schedule-calendar-expand-row {
    background: transparent;
    border: none;
    padding: 0;
    margin: 6px 0 10px 0;
    width: 100%;
    transition: all 0.2s ease;
}

.schedule-calendar-expand-row.hidden {
    display: none;
}

.schedule-days-expand-row {
    padding: 0;
    background: transparent;
    border: none;
    margin-top: 8px;
    margin-bottom: 2px;
    width: 100%;
    transition: all 0.2s ease;
}

.schedule-days-expand-row.hidden {
    display: none;
}

.calendar-fields-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
}

.calendar-field-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.calendar-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-date-input {
    height: 42px;
    background: #0f172a;
    border: 1.5px solid var(--card-border);
    border-radius: 6px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    padding: 0 8px;
    box-sizing: border-box;
    width: 100%;
    cursor: pointer;
    color-scheme: dark;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    transition: border-color 0.2s ease;
}

.calendar-date-input:focus {
    border-color: var(--accent-cyan);
    outline: none;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.35);
}

.calendar-action-col {
    flex-shrink: 0;
}

.btn-clear-date {
    height: 42px;
    padding: 0 14px;
    background: #334155;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-date:hover {
    background: var(--accent-rose);
    color: #ffffff;
    border-color: var(--accent-rose);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.35);
}

.day-buttons-row {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    width: 100%;
}

.btn-day {
    flex: 1;
    height: 36px;
    background: #1e293b;
    border: 1.5px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
}

.btn-day:hover {
    background: #334155;
    color: #ffffff;
    border-color: var(--accent-cyan);
}

.btn-day.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #000000;
    font-weight: 800;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* Time Schedule Container & 15-min Steppers */
.time-schedule-container {
    width: 100%;
    margin-top: 8px;
    margin-bottom: 2px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.all-day-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 1px 2px;
}

.all-day-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
   -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
}

.all-day-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

.all-day-text {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    transition: color 0.15s ease;
}

.all-day-checkbox-label:hover .all-day-text {
    color: #ffffff;
}

.time-steppers-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 8px 0 10px 0;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.time-steppers-row.hidden {
    display: none;
}

.time-separator-to {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 0 2px;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
    flex-shrink: 0;
}

.time-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.time-number-input {
    width: 100%;
    height: 42px;
    background: #0f172a;
    border: 1.5px solid var(--card-border);
    border-radius: 6px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    padding: 0 4px;
    box-sizing: border-box;
    outline: none;
    cursor: default;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    transition: border-color 0.2s ease;
}

.time-number-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.35);
}

.header-free-play {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.75);
    border: 1.5px solid var(--card-border);
    border-radius: 24px;
    padding: 6px 14px;
    flex-shrink: 0;
}

.header-free-play .toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
    margin: 0;
}

.header-free-play .free-play-text {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: var(--accent-emerald);
}

.header-free-play .toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.header-free-play .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.header-free-play .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155;
    transition: 0.25s ease;
    border-radius: 26px;
}

.header-free-play .toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s ease;
    border-radius: 50%;
}

.header-free-play input:checked + .toggle-slider {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.55);
}

.header-free-play input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.schedule-h-divider {
    width: 100%;
    height: 1px;
    background: var(--card-border);
    margin: 4px 0 10px 0;
    opacity: 0.85;
}

.price-control-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 6px 0;
}

.steppers-horizontal-row {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.stepper-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.stepper-v-divider {
    width: 1.5px;
    background: var(--card-border);
    align-self: stretch;
    margin: 2px 2px;
    opacity: 0.85;
    flex-shrink: 0;
}

.price-stepper-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.btn-stepper {
    width: 38px;
    height: 42px;
    min-width: 38px;
    border-radius: 6px;
    background: #334155;
    border: 1px solid var(--card-border);
    color: #ffffff;
    font-size: 21px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
    padding: 0;
}

.btn-stepper:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: #000000;
    transform: scale(1.04);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.btn-stepper:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.2);
}

.price-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.credits-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.currency-symbol {
    position: absolute;
    left: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-cyan);
    pointer-events: none;
}

.credits-unit-label {
    position: absolute;
    right: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #94a3b8;
    pointer-events: none;
    text-transform: lowercase;
    letter-spacing: 0.2px;
}

.price-number-input {
    width: 100%;
    height: 42px;
    background: #0f172a;
    border: 1.5px solid var(--card-border);
    border-radius: 6px;
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    text-align: center;
    padding-left: 20px;
    padding-right: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.credits-number-input {
    padding-left: 10px !important;
    padding-right: 58px !important;
    text-align: left;
    font-size: 18px;
}

.price-number-input:focus {
    border-color: var(--accent-cyan);
    outline: none;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.35);
}

.price-number-input:disabled {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.credits-input-wrapper:has(input:disabled) .credits-unit-label,
.price-input-wrapper:has(input:disabled) .currency-symbol {
    opacity: 0.35;
}

.btn-apply-price {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.modal-intro-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.4;
}

/* =========================================================================
   Pulse Control Panel & Presets Styling
   ========================================================================= */
.control-panels-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.control-panels-column.visible-controls {
    display: flex;
    animation: controlsSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.control-panels-column.hidden-controls {
    display: none !important;
}

@keyframes controlsSlideIn {
    0% {
        opacity: 0;
        transform: translateX(40px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.pulse-panel {
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
}

.panel-header-pulse {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pulse-presets-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-preset-chip {
    background: rgba(15, 23, 42, 0.75);
    border: 1.5px solid var(--card-border);
    border-radius: 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-preset-chip:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
}

.btn-preset-chip.active {
    color: #0f172a;
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    font-weight: 800;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.control-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 0 2px;
}

.control-col-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.limit-hint {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    background: rgba(15, 23, 42, 0.6);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.pulse-controls-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 6px;
}

.pulse-visualizer-box {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pulse-viz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
}

.viz-title {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.5px;
}

.viz-value {
    color: var(--accent-cyan);
    font-weight: 700;
    font-size: 12px;
}

.pulse-waveform-track {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 14px;
    background: rgba(2, 6, 23, 0.7);
    border-radius: 4px;
    padding: 2px 4px;
    overflow: hidden;
    box-sizing: border-box;
}

.wave-pulse {
    height: 100%;
    background: var(--accent-cyan);
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(6, 182, 212, 0.6);
    flex: 1;
    min-width: 6px;
}

.wave-pause {
    height: 2px;
    background: #475569;
    border-radius: 1px;
    flex: 1;
    min-width: 3px;
}

.btn-cyan {
    background: var(--accent-cyan);
    color: #0f172a;
    font-weight: 800;
    border: none;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.35);
}

.btn-cyan:hover {
    background: #22d3ee;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.55);
}

.btn-apply-pulse {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Plays & Activity Analytics Panel */
.play-analytics-panel {
    margin-bottom: 24px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px 20px;
}

.play-analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}

.play-analytics-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.play-analytics-icon {
    font-size: 20px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-analytics-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.play-stat-pill {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.play-stat-pill .pill-label {
    color: var(--text-muted);
    font-size: 12px;
}

.play-stat-pill .pill-val {
    font-weight: 700;
    font-size: 14px;
}

.timeframe-toggle-group {
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.btn-timeframe {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-timeframe.active {
    background: var(--accent-cyan);
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(6, 182, 212, 0.35);
}

.play-chart-container {
    position: relative;
    width: 100%;
    height: 160px;
}

/* =============================================================================
   CUSTOM MACHINE GROUPS & FILTER STRIP
   ============================================================================= */
.groups-filter-strip,
.fob-filter-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    flex-wrap: wrap; /* Allows chips to flow to the next row */
}

.groups-filter-strip {
    margin-bottom: 12px;
}

.group-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 14px;
    border-radius: 18px;
    background: #1e293b;
    border: 1.5px solid var(--card-border);
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
    flex-shrink: 0;
}

.group-chip:hover {
    color: #ffffff;
    border-color: #64748b;
    background: #334155;
}

.group-chip.active {
    background: #0f172a;
    color: #ffffff;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.35);
}

.group-chip-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #94a3b8;
}

.group-cyan .group-chip-dot { background: #00d8f6; }
.group-emerald .group-chip-dot { background: #22c55e; }
.group-amber .group-chip-dot { background: #f59e0b; }
.group-rose .group-chip-dot { background: #f43f5e; }
.group-purple .group-chip-dot { background: #b829ea; }
.group-blue .group-chip-dot { background: #3b82f6; }

.group-chip.active.group-cyan { border-color: #00d8f6; box-shadow: 0 0 10px rgba(0, 216, 246, 0.4); }
.group-chip.active.group-emerald { border-color: #22c55e; box-shadow: 0 0 10px rgba(34, 197, 94, 0.4); }
.group-chip.active.group-amber { border-color: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
.group-chip.active.group-rose { border-color: #f43f5e; box-shadow: 0 0 10px rgba(244, 63, 94, 0.4); }
.group-chip.active.group-purple { border-color: #b829ea; box-shadow: 0 0 10px rgba(184, 41, 234, 0.4); }
.group-chip.active.group-blue { border-color: #3b82f6; box-shadow: 0 0 10px rgba(59, 130, 246, 0.4); }

.group-chip-count {
    font-size: 12px;
    font-weight: 800;
    background: #0f172a;
    color: #94a3b8;
    padding: 2px 7px;
    border-radius: 12px;
}

.group-chip.active .group-chip-count {
    background: #1e293b;
    color: #ffffff;
}

.group-chip-add {
    margin-left: auto;
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border: 1.5px solid var(--accent-cyan);
    font-size: 13px;
    font-weight: 800;
    height: 34px;
    padding: 0 14px;
    border-radius: 18px;
}

.group-chip-add:hover:not(.disabled) {
    background: var(--accent-cyan);
    color: #0f172a;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.45);
}

.group-chip-add.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: var(--card-border);
    color: var(--text-muted);
    background: transparent;
}

.group-chip-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1;
    margin-left: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.group-chip-del:hover {
    background: var(--accent-rose);
    color: #ffffff;
}

/* Node Card Group Badges */
.node-groups-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 2px;
}

.node-group-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
    background: #1e293b;
    border: 1px solid var(--card-border);
    color: #94a3b8;
    transition: all 0.15s ease;
    -webkit-user-select: none; /* Safari */
user-select: none; /* Standard syntax */
}

.node-group-tag:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.node-group-tag.tag-cyan { color: var(--accent-cyan); border-color: rgba(6, 182, 212, 0.35); background: rgba(6, 182, 212, 0.1); }
.node-group-tag.tag-emerald { color: var(--accent-emerald); border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.1); }
.node-group-tag.tag-amber { color: var(--accent-amber); border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.1); }
.node-group-tag.tag-rose { color: var(--accent-rose); border-color: rgba(244, 63, 94, 0.35); background: rgba(244, 63, 94, 0.1); }
.node-group-tag.tag-purple { color: #a855f7; border-color: rgba(168, 85, 247, 0.35); background: rgba(168, 85, 247, 0.1); }
.node-group-tag.tag-blue { color: #3b82f6; border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.1); }

/* Simple Create Group Modal */
.modal-content-sm {
    max-width: 440px;
    width: 100%;
}

.group-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.btn-color-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    background: #1e293b;
    border: 1.5px solid var(--card-border);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-color-choice:hover {
    color: #ffffff;
    border-color: #475569;
}

.btn-color-choice.active {
    background: #334155;
    color: #ffffff;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Collapsible Panel Body (e.g. Machines, Keys) - same grid-template-rows
   technique as .filter-settings-tray, so collapse/expand always animates
   to the content's real height instead of a fixed ceiling. Content stays
   rendered (not display:none) while collapsed, so polling/data updates
   underneath keep working. */
.panel-collapsible {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.panel-collapsible.open {
    grid-template-rows: 1fr;
    /* .panel-header's own margin-bottom is zeroed for collapsible panels
       (see .panel-header-collapsible) so the header sits centered in the
       panel's padding while collapsed; restore the header-to-body gap
       here instead, only while actually expanded. */
    margin-top: 16px;
}
.panel-collapsible-inner {
    overflow: hidden;
    min-height: 0;
}

.panel-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Collapsible panels (Machines, Keys) have no visible body while
   collapsed, so the header's usual margin-bottom would only add
   asymmetric space below the title - zeroed here, restored via
   .panel-collapsible.open's margin-top once actually expanded. */
.panel-header-collapsible {
    margin-bottom: 0;
}

.btn-panel-collapse-toggle {
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
    transition: transform 0.2s ease, color 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}
.btn-panel-collapse-toggle:hover {
    color: #38bdf8;
}
.btn-panel-collapse-toggle.collapsed {
    transform: rotate(-90deg);
}

.color-dot.color-cyan { background: var(--accent-cyan); }
.color-dot.color-emerald { background: var(--accent-emerald); }
.color-dot.color-amber { background: var(--accent-amber); }
.color-dot.color-rose { background: var(--accent-rose); }
.color-dot.color-purple { background: #a855f7; }
.color-dot.color-blue { background: #3b82f6; }

/* Column Visibility Toggles */
.column-toggle-chip {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.6);
    color: var(--text-muted, #94a3b8);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.column-toggle-chip:hover {
    border-color: rgba(148, 163, 184, 0.8);
    color: #f8fafc;
}
.column-toggle-chip.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}
.column-toggle-chip:not(.active) {
    opacity: 0.5;
}

/* Dynamic Column Hide rules (Analytics Stream table) */
.hide-col-1 th:nth-child(1), .hide-col-1 td:nth-child(1) { display: none; }
.hide-col-2 th:nth-child(2), .hide-col-2 td:nth-child(2) { display: none; }
.hide-col-3 th:nth-child(3), .hide-col-3 td:nth-child(3) { display: none; }
.hide-col-4 th:nth-child(4), .hide-col-4 td:nth-child(4) { display: none; }
.hide-col-5 th:nth-child(5), .hide-col-5 td:nth-child(5) { display: none; }
.hide-col-6 th:nth-child(6), .hide-col-6 td:nth-child(6) { display: none; }
.hide-col-7 th:nth-child(7), .hide-col-7 td:nth-child(7) { display: none; }
.hide-col-8 th:nth-child(8), .hide-col-8 td:nth-child(8) { display: none; }
.hide-col-9 th:nth-child(9), .hide-col-9 td:nth-child(9) { display: none; }
.hide-col-10 th:nth-child(10), .hide-col-10 td:nth-child(10) { display: none; }
.hide-col-11 th:nth-child(11), .hide-col-11 td:nth-child(11) { display: none; }
.hide-col-12 th:nth-child(12), .hide-col-12 td:nth-child(12) { display: none; }
.hide-col-13 th:nth-child(13), .hide-col-13 td:nth-child(13) { display: none; }

/* Dynamic Column Hide rules (Event Stream table) */
.hide-fcol-1 th:nth-child(1), .hide-fcol-1 td:nth-child(1) { display: none; }
.hide-fcol-2 th:nth-child(2), .hide-fcol-2 td:nth-child(2) { display: none; }
.hide-fcol-3 th:nth-child(3), .hide-fcol-3 td:nth-child(3) { display: none; }
.hide-fcol-4 th:nth-child(4), .hide-fcol-4 td:nth-child(4) { display: none; }
.hide-fcol-5 th:nth-child(5), .hide-fcol-5 td:nth-child(5) { display: none; }
.hide-fcol-6 th:nth-child(6), .hide-fcol-6 td:nth-child(6) { display: none; }
.hide-fcol-7 th:nth-child(7), .hide-fcol-7 td:nth-child(7) { display: none; }
.hide-fcol-8 th:nth-child(8), .hide-fcol-8 td:nth-child(8) { display: none; }
.hide-fcol-9 th:nth-child(9), .hide-fcol-9 td:nth-child(9) { display: none; }
.hide-fcol-10 th:nth-child(10), .hide-fcol-10 td:nth-child(10) { display: none; }
.hide-fcol-11 th:nth-child(11), .hide-fcol-11 td:nth-child(11) { display: none; }
.hide-fcol-12 th:nth-child(12), .hide-fcol-12 td:nth-child(12) { display: none; }
.hide-fcol-13 th:nth-child(13), .hide-fcol-13 td:nth-child(13) { display: none; }
.hide-fcol-14 th:nth-child(14), .hide-fcol-14 td:nth-child(14) { display: none; }

/* Custom Event Badges in Grid */
.badge-ev {
    font-size: 12px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    display: inline-block;
}
.badge-ev-tx { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); border-color: rgba(6, 182, 212, 0.2); }
.badge-ev-rx { background: rgba(248, 250, 252, 0.12); color: #f8fafc; border-color: rgba(248, 250, 252, 0.25); }

/* =============================================================================
   KEY / FOB PROVISIONING DRAWER & MODERN ENROLLMENT PANEL
   ============================================================================= */
.fob-provision-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 12px;
    padding: 24px 28px;
    margin-top: 14px;
    margin-bottom: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 15px rgba(6, 182, 212, 0.1);
    position: relative;
    overflow: hidden;
    animation: fadeInSlideDown 0.2s ease-out;
}

.fob-provision-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00d8f6, #22c55e, #a855f7);
}

@keyframes fadeInSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fob-provision-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}

.fob-provision-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fob-provision-icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    font-size: 19px;
    flex-shrink: 0;
}

.fob-provision-title {
    font-size: 16.5px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 3px;
}

.fob-provision-subtitle {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-muted);
}

.fob-target-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(6, 182, 212, 0.35);
    font-size: 12.5px;
}

.fob-target-badge-pill.blind-mode {
    border-color: rgba(148, 163, 184, 0.3);
}

.fob-mode-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}

.fob-mode-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.65);
    border: 1.5px solid var(--card-border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.fob-mode-row:hover {
    border-color: rgba(6, 182, 212, 0.5);
    background: rgba(30, 41, 59, 0.7);
}

.fob-mode-row.active {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.14);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.fob-mode-row-icon {
    font-size: 20px;
    line-height: 1;
}

.fob-mode-row-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fob-mode-row-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #f8fafc;
}

.fob-mode-row-desc {
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--text-muted);
}

@media (max-width: 560px) {
    .fob-mode-list { grid-template-columns: 1fr; }
}

.fob-slots-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.fob-panel-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 4px;
}

.fob-grant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

/* Matches .fob-badge (Keys panel row badges) - same padding/radius/weight,
   so a fob's grants read consistently whether shown in the table or here. */
.fob-grant-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    white-space: nowrap;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

/* Mirrors .badge-freeplay */
.fob-grant-chip.type-freeplay {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.4);
}

/* Mirrors .badge-wallet-active */
.fob-grant-chip.type-balance {
    background: #0f172a;
    border: 1.5px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
    font-family: var(--font-mono);
}

/* Mirrors .badge-credits-active */
.fob-grant-chip.type-credits {
    background: #0f172a;
    border: 1.5px solid rgba(251, 191, 36, 0.4);
    color: #fde047;
    font-family: var(--font-mono);
}

/* Mirrors .badge-unregistered's muted palette, dashed to read as a placeholder */
.fob-grant-chip.empty {
    background: rgba(51, 65, 85, 0.3);
    color: #94a3b8;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    font-weight: 700;
}

.fob-grant-chip.empty:hover {
    border-color: rgba(6, 182, 212, 0.5);
    color: #cbd5e1;
}

/* Currently-selected chip - same visual language as .fob-row.selected */
.fob-grant-chip.active {
    box-shadow: 0 0 0 2px var(--accent-cyan), 0 0 10px rgba(6, 182, 212, 0.3);
}

.fob-grant-chip-remove {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.65;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
}

.fob-grant-chip-remove:hover {
    opacity: 1;
    color: var(--accent-rose);
}

.fob-provision-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px 18px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.fob-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}


/* Grant type row: FreePlay toggle + Balance/Credits steppers side by side */
.fob-grant-type-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.fob-grant-type-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fob-grant-type-cell.freeplay-cell {
    flex-shrink: 0;
}

.fob-grant-type-cell.stepper-cell {
    flex: 1;
    min-width: 110px;
}

/* Stepper: minus button / number input / plus button */
.fob-stepper {
    display: flex;
    align-items: center;
    height: 38px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
}

.fob-stepper-btn {
    flex-shrink: 0;
    width: 34px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fob-stepper-btn:hover:not(:disabled) {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.fob-stepper-btn:disabled,
.fob-stepper input:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.fob-stepper input[type="number"] {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
}

.fob-stepper input[type="number"]::-webkit-inner-spin-button,
.fob-stepper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fob-form-label {
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.fob-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    cursor: pointer;
}

.fob-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.fob-switch-track {
    position: relative;
    flex-shrink: 0;
    width: 38px;
    height: 21px;
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--card-border);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.fob-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.15s ease, background 0.15s ease;
}

.fob-switch input:checked + .fob-switch-track {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.5);
}

.fob-switch input:checked + .fob-switch-track .fob-switch-thumb {
    transform: translateX(17px);
    background: #fbbf24;
}

.fob-switch input:focus-visible + .fob-switch-track {
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.4);
}

.fob-tier-toggle-group {
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
    height: 38px;
}

.btn-tier-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-tier-toggle:hover {
    color: #fff;
}

.btn-tier-toggle.active {
    background: rgba(6, 182, 212, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: var(--accent-cyan);
    font-weight: 700;
}

.btn-tier-toggle.active.tier-admin {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.fob-provision-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.btn-provision-submit {
    height: 40px;
    padding: 0 22px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-cyan);
    border: 1px solid #38bdf8;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
    transition: all 0.15s ease;
}

.btn-provision-submit:hover:not(:disabled) {
    background: #0891b2;
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.5);
    transform: translateY(-1px);
}

.btn-provision-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fob-provision-status-msg {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =============================================================================
   NFC FOB & KEYCARD MANAGEMENT LIST (GRID ALIGNED)
   ============================================================================= */
.fob-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 14px; /* Increased from 13px */
    font-weight: 600;
    padding: 5px 12px; /* Slightly thicker */
    border-radius: 6px;
    white-space: nowrap;
    text-align: center;
    width: fit-content; 
    min-width: 80px;
}


   .fob-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 14px;
}
.fob-table-head {
    display: grid;
    /* 1st col takes all extra space (1fr). 5th col is Action, 6th col is unlabelled delete column */
    grid-template-columns: 1fr 85px 85px 130px 105px 36px;
    align-items: center;
    gap: 16px; 
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    margin-bottom: 6px;
    min-width: 750px;
}

.fob-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 750px;
    /* Sized to content (JS tracks the tallest height seen and never lets
       it shrink back down - see growDynamicHeight in the page script), so
       filtering only ever grows this panel, never shrinks it out from
       under the cursor. Caps out and scrolls past that JS-driven height. */
    overflow-y: auto;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fob-row {
    display: grid;
    /* Must exactly match the header grid columns */
    grid-template-columns: 1fr 85px 85px 130px 105px 36px;
    align-items: center;
    gap: 16px; 
    background-color: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.15s ease;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.fob-row:hover {
    background-color: rgba(30, 41, 59, 0.85);
    border-color: rgba(6, 182, 212, 0.35);
}

.fob-row.selected {
    background-color: rgba(6, 182, 212, 0.14);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

/* --- Unregistered FOB Row Styling (Subdued / Unselected) --- */
.fob-row.fob-row-unregistered {
    background-color: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--card-border);
    border-left: 3px solid rgba(245, 158, 11, 0.55);
}

.fob-row.fob-row-unregistered:hover {
    background-color: rgba(30, 41, 59, 0.85);
    border-color: rgba(148, 163, 184, 0.4);
    border-left: 3px solid #f59e0b;
}

/* --- Selected State (Crisp Cyan Outline & Glow) --- */
.fob-row.fob-row-unregistered.selected {
    background-color: rgba(6, 182, 212, 0.14) !important;
    border-color: var(--accent-cyan) !important;
    border-left: 3px solid var(--accent-cyan) !important;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25) !important;
}



.fob-row.selected .fob-badge.badge-unregistered {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.4);
}

.fob-col-uid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0; /* Crucial: Allows grid column to shrink and trigger ellipsis naturally */
}

.fob-uid {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-cyan);
    font-size: 15px; /* Increased from 13.5px */
    letter-spacing: 0.5px;
}

.fob-col-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap; /* Keep on one line so text ellipsis works correctly */
    min-width: 0; 
}

.fob-col-role,
.fob-col-plan,
.fob-col-credits,
.fob-col-wallet,
.fob-col-stats,
.fob-col-action,
.fob-col-del {
    display: flex;
    align-items: center;
}

.fob-col-action {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.fob-col-del {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.fob-badge.badge-sysop {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    font-weight: 700;
}

.fob-badge.badge-admin {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Increase text size specifically in the Credits and Balance columns */
.fob-badge.badge-credits-active,
.fob-badge.badge-credits-empty,
.fob-badge.badge-wallet-active,
.fob-badge.badge-wallet-empty,
.fob-badge.badge-freeplay,
.fob-badge.badge-unregistered {
    font-size: 16px; 
}

.fob-badge.badge-player {
    background: rgba(51, 65, 85, 0.25);
    color: #94a3b8;
    border: 1px solid rgba(51, 65, 85, 0.4);
}

/* --- Subdued Unregistered Badge Pill --- */
.fob-badge.badge-unregistered {
    background: rgba(51, 65, 85, 0.3);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.25);
    font-weight: 600;
}

.fob-badge.badge-freeplay {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.4);
    font-weight: 700;
}

.fob-badge.badge-standard {
    background: rgba(51, 65, 85, 0.25);
    color: #94a3b8;
    border: 1px solid rgba(51, 65, 85, 0.4);
}

.fob-badge.badge-credits-active,
.fob-badge.badge-credits-empty,
.fob-badge.badge-wallet-active,
.fob-badge.badge-wallet-empty {
    background: #0f172a;
    border: 1.5px solid var(--card-border);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 82px;
    box-sizing: border-box;
}

.fob-badge.badge-credits-active {
    color: #fde047;
    border-color: rgba(251, 191, 36, 0.4);
    background: #0f172a;
}

.fob-badge.badge-credits-empty {
    color: #475569;
    border-color: var(--card-border);
    background: #0f172a;
    opacity: 0.75;
}

.fob-badge.badge-wallet-active {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
    background: #0f172a;
}

.fob-badge.badge-wallet-empty {
    color: #475569;
    border-color: var(--card-border);
    background: #0f172a;
    opacity: 0.75;
}

.fob-chip-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #a5f3fc;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
    max-width: fit-content;
}

.fob-desc-text {
    font-size: 14px; 
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Delete max-width: 340px; and let the grid dictate the width */
    max-width: none; 
    min-width: 0; 
    flex: 1; /* Tells the text to consume all remaining column space */
}

.fob-stats-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.fob-stat-line {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 13.5px; /* Increased from 12px */
}

.btn-toggle-unrecognized {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 6px;
    padding: 5px 12px;
    color: #fbbf24;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 32px;
}

.btn-toggle-unrecognized:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
    color: #ffffff;
}

.btn-toggle-unrecognized.active {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fef08a;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.btn-toggle-unrecognized.muted {
    border-color: rgba(51, 65, 85, 0.6);
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.5);
    opacity: 0.75;
}

.btn-toggle-unrecognized .dot-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}

.btn-toggle-unrecognized.muted .dot-indicator {
    background: #64748b;
    box-shadow: none;
}

.btn-activate-discovered {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.5);
    border-radius: 6px;
    padding: 0 12px;
    height: 32px; /* Increased from 28px */
    font-size: 12.5px; /* Increased from 11px */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-activate-discovered:hover {
    background: var(--accent-cyan);
    color: #0f172a;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
    transform: scale(1.05);
}

/* Icon-only variant: square, no text padding, larger emoji */
.btn-activate-discovered.btn-icon-only {
    width: 32px;
    padding: 0;
    font-size: 16px;
    gap: 0;
}

.btn-dismiss-discovered,
.btn-remove-fob {
    background: rgba(51, 65, 85, 0.3);
    color: #94a3b8;
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 6px;
    padding: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    box-sizing: border-box;
    opacity: 0;
}

.btn-dismiss-discovered:hover,
.btn-remove-fob:hover {
    background: rgba(244, 63, 94, 0.25);
    color: #fda4af;
    border-color: #f43f5e;
    transform: scale(1.08);
}

/* Hide action + delete buttons until the row is hovered */
.btn-activate-discovered {
    opacity: 0;
}

.fob-row:hover .btn-activate-discovered,
.fob-row:hover .btn-dismiss-discovered,
.fob-row:hover .btn-remove-fob {
    opacity: 1;
}

/* Protected (disabled) delete button — visible on hover but muted, not clickable */
.fob-row:hover .btn-protected {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-protected:hover {
    background: rgba(51, 65, 85, 0.3) !important;
    color: #94a3b8 !important;
    border-color: rgba(51, 65, 85, 0.5) !important;
    transform: none !important;
    box-shadow: none !important;
}

.discovered-target-banner {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.fob-protected-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    line-height: 1;
    font-weight: 600;
    padding: 0;
    border-radius: 6px;
    background: rgba(51, 65, 85, 0.3);
    color: #64748b;
    border: 1px solid rgba(51, 65, 85, 0.4);
    width: 28px;
    height: 28px;
    text-align: center;
    flex-shrink: 0;
}





/* =========================================================================
   Single-Node Telemetry, Flash Storage & System Diagnostics
   (Consolidated from style.css)
   ========================================================================= */
.grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); 
  gap: 16px; 
  margin-bottom: 24px; 
}

.card { 
  background-color: var(--card-bg); 
  border: 1px solid var(--card-border);
  border-radius: 12px; 
  padding: 18px; 
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: #475569;
}

.card h4 { 
  color: var(--text-muted); 
  font-size: 12px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.card .value { 
  font-size: 24px; 
  font-weight: 700; 
  letter-spacing: -0.5px;
}

.value-compact {
  font-size: 20px;
}

.card-fleet-link {
  text-decoration: none;
  display: block;
  border-color: rgba(6, 182, 212, 0.45);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  cursor: pointer;
}

.card-fleet-link:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.card-fleet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-fleet-title {
  color: var(--accent-cyan);
  margin: 0;
}

.card-fleet-arrow {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.card-fleet-value {
  color: #f8fafc;
  margin-top: 6px;
}

.card-fleet-sub {
  color: var(--text-muted);
}

/* Action Buttons */
.btn-action {
  background-color: var(--accent-cyan);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-compact {
  width: auto;
  padding: 8px 14px;
}

.btn-action:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-action:disabled {
  background-color: #334155;
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  border: 1px solid transparent;
}

.pulse-status-msg {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.status-highlight {
  color: var(--accent-emerald);
  font-weight: 600;
}

.status-highlight-warn {
  color: var(--accent-amber);
  font-weight: 600;
}

.status-err-msg {
  color: var(--accent-rose);
}

.form-caption {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.form-group {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 120px;
}

.form-field-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.form-input, .form-select {
  background-color: #0f172a;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}

.form-input {
  font-family: var(--font-mono);
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
}

.form-input:disabled, .form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Unified Multi-Segment Flash Storage Bar */
.unified-track {
  width: 100%;
  height: 16px;
  background: #0f172a;
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--card-border);
  margin: 16px 0 20px 0;
}

.seg {
  height: 100%;
  transition: width 0.4s ease;
  position: relative;
}

.seg-firmware { background: var(--accent-cyan); }
.seg-nvs      { background: var(--accent-purple); }
.seg-littlefs { background: var(--accent-emerald); }
.seg-archive  { background: var(--accent-amber); }
.seg-archive-res { background: #475569; border-left: 1px dashed rgba(255, 255, 255, 0.2); }
.seg-empty    { background: #1e293b; }

.w-0 { width: 0%; }
.w-100 { width: 100%; }

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.legend-card {
  background: #0f172a;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dot-firmware { background: var(--accent-cyan); }
.dot-nvs { background: var(--accent-purple); }
.dot-littlefs { background: var(--accent-emerald); }
.dot-archive { background: var(--accent-amber); }
.dot-archive-res { background: #475569; }
.dot-empty { background: #1e293b; border: 1px solid #475569; }

.legend-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  margin-bottom: 8px;
}

.gauge-stat {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  font-weight: 600;
  text-align: right;
  margin-left: auto;
}

/* RAM Heap Line Chart & Telemetry Card */
.heap-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.heap-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.heap-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.heap-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.heap-header-right {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.heap-current-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.heap-pct-val {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-mono);
}

/* KPI Stat Chips */
.heap-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.heap-kpi-chip {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.kpi-value {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Chart Canvas / SVG Container */
.heap-chart-wrapper {
  position: relative;
  width: 100%;
  height: 120px;
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.heap-chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.heap-tooltip {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid var(--accent-cyan);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: #fff;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.heap-tooltip-sub {
  color: var(--text-muted);
  font-size: 10px;
}

.heap-time-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 4px 4px 0 4px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #0f172a;
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.fill-heap {
  background: linear-gradient(90deg, #a855f7, #c084fc);
}

.gauge-subtext {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.status-ok { color: var(--accent-emerald); }
.status-err { color: var(--accent-rose); }

/* Modern Table Styling */
.table-container {
  overflow-x: auto;
  /* Sized to content instead of a fixed height: JS (growDynamicHeight)
     measures the table's natural height on every re-render and tracks the
     tallest it's ever been, so a filter/toggle that reduces the row count
     never shrinks this container - only growing past a previous size
     changes the height, which pushes things down rather than yanking them
     up from under the cursor. Caps out and scrolls past that height. */
  overflow-y: auto;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-top: 14px;
  /* Always show a thin scrollbar rather than relying on the OS's overlay
     scrollbar (invisible until actively dragging on macOS/trackpad setups),
     so horizontal scroll availability is actually discoverable. */
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}

.table-container thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-container::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-container::-webkit-scrollbar-track {
  background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 5px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

table { 
  width: 100%; 
  border-collapse: collapse; 
  text-align: left;
}

th { 
  background-color: #0f172a;
  padding: 10px 14px; 
  color: var(--text-muted); 
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--card-border);
}

tr.data-row { 
  background-color: transparent; 
  border-bottom: 1px solid var(--card-border);
  transition: background-color 0.15s ease; 
}

tr.data-row:last-child {
  border-bottom: none;
}

tr.data-row:hover { 
  background-color: rgba(255, 255, 255, 0.02); 
}

td { 
  padding: 10px 14px; 
  font-size: 13px; 
}

.mono-text { font-family: var(--font-mono); color: var(--accent-cyan); font-size: 12px; }

/* Placed after .mono-text so it actually overrides its color when both
   classes are on the same element (equal specificity - source order wins). */
.mono-text.text-white { color: #f8fafc; }

.card-section { margin-bottom: 24px; }

.empty-state { 
  text-align: center; 
  color: var(--text-muted); 
  padding: 24px; 
  font-size: 13px;
}

.last-sync-value { font-size: 18px; }

.section-title { 
  font-size: 16px; 
  font-weight: 700; 
  color: var(--text-main); 
  margin-bottom: 14px; 
}

.section-title-inline { margin-bottom: 0; }
.hidden { display: none !important; }

/* =========================================================================
   Test & Profile Hierarchy Workspace
   ========================================================================= */
.days-container { display: flex; gap: 6px; margin-bottom: 20px; }
.day-pill { flex: 1; padding: 10px 0; text-align: center; background: #eee; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600; -webkit-user-select: none; user-select: none; transition: all 0.2s; }
.day-pill.active { background: #007aff; color: white; border-color: #0062cc; }
.time-row { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.time-group { flex: 1; }
.btn-block-green { width: 100%; padding: 12px; background: #28a745; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-block-green:hover { background: #218838; }
.result { margin-top: 15px; padding: 10px; background: #e9ecef; border-radius: 6px; font-family: monospace; font-size: 0.85rem; word-break: break-all; display: none; }

.grid-layout { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.grid-layout .panel { background: #111827; border: 1px solid var(--card-border); border-radius: 12px; padding: 20px; }
.panel-title { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.profile-list { display: flex; flex-direction: column; gap: 10px; }
.profile-card { background: #0f172a; border: 1.5px solid var(--card-border); border-radius: 10px; padding: 14px; cursor: pointer; transition: all 0.15s; }
.profile-card:hover { border-color: var(--accent-cyan); }
.profile-card.active { border-color: var(--accent-cyan); background: rgba(6, 182, 212, 0.08); }
.profile-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.profile-name { font-size: 15px; font-weight: 700; color: #fff; }
.profile-badge { font-size: 12px; font-weight: 700; color: var(--accent-cyan); background: rgba(6, 182, 212, 0.15); padding: 2px 8px; border-radius: 6px; }
.profile-specs { font-size: 13px; color: var(--text-muted); }
.schedule-card { background: #0f172a; border: 1.5px solid var(--card-border); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.schedule-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.schedule-name { font-size: 15px; font-weight: 700; color: #fff; }
.schedule-rule { font-size: 13px; color: var(--accent-amber); font-weight: 600; }
.device-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 16px; }
.device-card { background: #0f172a; border: 1.5px solid var(--card-border); border-radius: 10px; padding: 14px; position: relative; cursor: pointer; }
.device-card.selected { border-color: var(--accent-cyan); background: rgba(6, 182, 212, 0.08); }
.device-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.device-tags { display: flex; flex-direction: column; gap: 4px; }
.tag-profile { background: #334155; color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; text-align: center; }
.tag-promo { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); border: 1px solid var(--accent-amber); padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 600; text-align: center; }
.sim-bar { background: #111827; border: 1px solid var(--card-border); border-radius: 10px; padding: 16px; margin-top: 20px; display: flex; align-items: center; justify-content: space-between; }
.sim-controls { display: flex; align-items: center; gap: 12px; }
.sim-select { background: #1e293b; color: #fff; border: 1px solid var(--card-border); border-radius: 6px; padding: 6px 12px; font-size: 14px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.mt-20 { margin-top: 20px; }
.panel-subtitle-text { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.flex-gap-8 { display: flex; gap: 8px; }
.midnight-badge { display: none; font-size: 0.75rem; background: #ff9500; color: white; padding: 2px 6px; border-radius: 4px; margin-top: 4px; font-weight: bold; }
button.save-btn { width: 100%; padding: 12px; background: #34c759; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; }
button.save-btn:active { background: #28a745; }


/* =========================================================================
   Fleet Analytics & Revenue Charts
   (Consolidated from analytics.html)
   ========================================================================= */
.kpi-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }
    .kpi-card {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: 12px;
      padding: 18px;
      position: relative;
      overflow: hidden;
    }
    .kpi-card::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: var(--accent-cyan);
    }
    .kpi-card.accent-emerald::before { background: var(--accent-emerald); }
    .kpi-card.accent-purple::before { background: #a855f7; }
    .kpi-card.accent-amber::before { background: var(--accent-amber); }
    .kpi-card.accent-blue::before { background: #3b82f6; }
    .kpi-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    .kpi-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .kpi-icon {
      font-size: 18px;
      opacity: 0.85;
    }
    .kpi-val {
      font-size: 28px;
      font-weight: 800;
      color: var(--text-main);
      line-height: 1.1;
      margin-bottom: 4px;
      font-family: var(--font-mono);
    }
    .kpi-sub {
      font-size: 11px;
      color: var(--text-muted);
    }
    .section-divider {
      font-size: 13px;
      font-weight: 700;
      color: #cbd5e1;
      margin: 28px 0 16px 0;
      display: flex;
      align-items: center;
      gap: 8px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .section-divider::after {
      content: "";
      flex: 1;
      height: 1px;
      background: rgba(255, 255, 255, 0.08);
    }
    .chart-grid-2col {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
      gap: 20px;
      margin-bottom: 24px;
    }
    .chart-grid-3col {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 20px;
      margin-bottom: 24px;
    }
    .chart-box {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: 12px;
      padding: 20px;
      position: relative;
    }
    .chart-box-standalone {
      margin-bottom: 24px;
    }
    .filter-bar-controls {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
    }
    .chart-box-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
    }
    .chart-box-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .chart-box-sub {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 2px;
    }
    .chart-canvas-wrapper {
      position: relative;
      height: 240px;
      width: 100%;
    }
    .chart-canvas-wrapper-tall {
      height: 280px;
    }
    .chart-canvas-wrapper-doughnut {
      height: 210px;
    }
    .chart-canvas-wrapper-short {
      height: 150px;
    }
    .filter-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }
    .search-input {
      background: #0f172a;
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 7px 12px;
      color: #fff;
      font-size: 13px;
      min-width: 220px;
      height: 32px;
      box-sizing: border-box;
      outline: none;
      transition: border-color 0.15s ease;
    }
    .search-input:focus {
      border-color: var(--accent-cyan);
    }
    .search-input-wide {
      min-width: 380px;
      flex: 1;
    }
    .filter-chips {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }
    .filter-chip {
      padding: 4px 10px;
      border-radius: 6px;
      background: #0f172a;
      border: 1px solid var(--card-border);
      color: var(--text-muted);
      font-size: 12px;
      cursor: pointer;
      font-weight: 600;
      transition: all 0.15s ease;
    }
    .filter-chip:hover, .filter-chip.active {
      color: #fff;
      border-color: var(--accent-cyan);
      background: rgba(6, 182, 212, 0.15);
    }
    .badge-count {
      font-size: 11px;
      padding: 2px 7px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.08);
      font-family: var(--font-mono);
    }