:root {
    --bg: #0f0f0f;
    --panel-1: #1a1a1a;
    --panel-2: #121212;
    --panel-3: #0e0f11;
    --text: #e0ffe0;
    --muted: #a8ffdc;
    --muter: #7bcfa6;
    --neon: #00ff88;
    --neon-05: rgba(0, 255, 136, .05);
    --neon-10: rgba(0, 255, 136, .10);
    --neon-14: rgba(0, 255, 136, .14);
    --neon-20: rgba(0, 255, 136, .20);
    --neon-30: rgba(0, 255, 136, .30);
    --neon-35: rgba(0, 255, 136, .35);
    --neon-40: rgba(0, 255, 136, .40);
    --neon-55: rgba(0, 255, 136, .55);
    --warn: #ffb868;
    --info: #40c4ff;
    --danger: #ff7866;
    --panel-bg-1: #1a1a1a;
    --panel-bg-2: #121212;
    --panel-row-alt: #191919;
    --r-xs: 8px;
    --r-sm: 10px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 18px;
    --gap-1: 6px;
    --gap-2: 10px;
    --gap-3: 14px;
    --gap-4: 20px;
    --gap-5: 24px;
    --card-b: 1px solid var(--neon-20);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}

* {
    box-sizing: border-box;
    will-change: auto;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top left, var(--bg), #1a1a1a);
    color: var(--text);
    margin: 0;
    padding: 0;
}

.top-bar {

    background: var(--panel-2);
    color: var(--neon);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--neon-20);
    z-index: 1100;
    /* must be higher than sticky-filter-bar */

}

.button,
.stop-toolbar-actions .primary,
.stop-toolbar-actions .ghost,
.stop-form-actions .primary,
.stop-form-actions .ghost,
.stop-form-actions .danger,
.stop-table-action,
.expand-btn,
.quick-range-buttons button,
.menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--r-md);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    border: 1px solid var(--neon-35);
    background: transparent;
    color: var(--muted);
    transition: transform .15s ease, opacity .15s ease, border-color .15s ease;
}

.button--primary,
.stop-form-actions .primary,
.stop-toolbar-actions .primary,
.quick-range-buttons button.active {
    background: linear-gradient(135deg, rgba(0, 255, 136, .25), rgba(0, 180, 150, .25));
    color: #fff;
    border-color: var(--neon-55);
}

.button--ghost,
.stop-form-actions .ghost,
.stop-toolbar-actions .ghost,
.menu-button {
    background: transparent;
    color: var(--neon);
}

.button--danger,
.stop-form-actions .danger {
    background: rgba(255, 120, 102, .15);
    color: #ffb7a8;
    border-color: rgba(255, 120, 102, .6);
}

.button:hover,
.stop-toolbar-actions .primary:hover,
.stop-toolbar-actions .ghost:hover,
.stop-form-actions .primary:hover,
.stop-form-actions .ghost:hover,
.stop-table-action:hover,
.expand-btn:hover,
.quick-range-buttons button:hover,
.menu-button:hover {
    transform: translateY(-1px);
    border-color: var(--neon-55);
    box-shadow: 0 0 18px rgba(0, 255, 136, .25);
}

.button--danger:hover,
.stop-form-actions .danger:hover {
    box-shadow: 0 0 18px rgba(255, 120, 102, .25);
}

.card {
    background: rgba(20, 20, 20, .85);
    border: var(--card-b);
    border-radius: var(--r-lg);
    box-shadow: var(--card-shadow);
}

.table,
#stop-hours-table,
.telemetry-table,
.power-table,
.status-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .9rem;
    color: #d7ffe9;
}

.table thead,
#stop-hours-table thead,
.telemetry-table thead,
.power-table thead,
.status-table thead {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #0f1714 0%, #0a1411 100%);
    box-shadow: 0 6px 10px rgba(0, 0, 0, .45);
    z-index: 2;
}

.table th,
.table td,
#stop-hours-table th,
#stop-hours-table td,
.telemetry-table th,
.telemetry-table td,
.power-table th,
.power-table td,
.status-table th,
.status-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 255, 136, .12);
}

.table thead th,
#stop-hours-table thead th,
.telemetry-table thead th,
.power-table thead th,
.status-table thead th {
    color: var(--neon);
    border-bottom: 1px solid var(--neon-20);
    font-weight: 600;
    letter-spacing: .2px;
}

.table tr:nth-child(even),
#stop-hours-table tr:nth-child(even),
.telemetry-table tr:nth-child(even),
.power-table tr:nth-child(even),
.status-table tr:nth-child(even) {
    background: #191919;
}

.table-wrap,
.stop-hours-table-wrapper,
.telemetry-table-wrap,
.power-table-wrapper,
.status-table-wrapper,
.stop-catalog-table-wrapper {
    overflow: auto;
    border: 1px solid var(--neon-20);
    border-radius: var(--r-md);
    box-shadow: 0 0 0 1px var(--neon-10) inset, 0 0 22px var(--neon-10);
}

.modal,
.stop-dialog,
.stop-modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(0, 0, 0, .68);
    backdrop-filter: blur(5px);
    z-index: 3000;
}

.modal.open,
.stop-dialog.is-active,
.stop-modal[open] {
    display: grid;
}

.modal[style*="display: block"],
.stop-modal[style*="display: block"],
.stop-dialog[style*="display: block"],
.login-modal[style*="display: block"] {
    display: grid !important;
    place-items: center;
    padding: 24px;
}

.modal[style*="display: flex"],
.stop-modal[style*="display: flex"],
.stop-dialog[style*="display: flex"],
.login-modal[style*="display: flex"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-content,
.stop-dialog-content,
.stop-modal-content {
    width: min(860px, 92vw);
    max-height: 85vh;
    overflow: auto;
    background: rgba(22, 22, 22, .98);
    border: 1px solid var(--neon-35);
    border-radius: var(--r-lg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
    padding: 24px;
    position: relative;
}

.stop-modal-content>.close {
    position: absolute;
    top: 18px;
    right: 18px;
    float: none;
    line-height: 1;
}

.stop-modal-content>h2 {
    margin: 0 0 var(--gap-3);
    text-align: center;
    color: var(--neon);
    font-size: clamp(1.4rem, 1vw + 1.1rem, 2rem);
}

@media (max-width: 680px) {
    .modal-content,
    .stop-dialog-content,
    .stop-modal-content {
        width: calc(100vw - 32px);
        padding: 18px;
    }
}

*::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

*::-webkit-scrollbar-track {
    background: var(--bg);
}

*::-webkit-scrollbar-thumb {
    background: var(--neon-20);
    border-radius: 8px;
    border: 2px solid var(--bg);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--neon-35);
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #0f0f0f;
    box-shadow: 0 2px 10px rgba(0, 255, 136, 0.2);
}
/* .dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
} */
.dashboard-container {
    max-width: 1200px;
    /* keep this if you still want a max width */
    margin: 0 auto;
    padding: 40px 20px;
    /* desktop spacing */
    text-align: center;

    flex: 1;
    /* lets the flexbox grow */
    min-width: 0;
    /* ← prevents horizontal overflow */
    box-sizing: border-box;
    /* good measure */
}


h1 {
    font-size: clamp(2rem, 2.5vw + 1rem, 3rem);
    color: var(--neon);
    margin: .2em 0 .3em;
}

h2.section-title {
    font-size: clamp(1.1rem, .8vw + .8rem, 1.6rem);
    margin: 32px 0 8px;
}

h3 {
    font-size: clamp(1rem, .6vw + .7rem, 1.25rem);
}

:focus-visible {
    outline: 2px solid var(--neon);
    outline-offset: 2px;
    border-radius: 6px;
}

.stop-filter-btn:focus-visible,
.stop-chart-toggle__btn:focus-visible,
.stop-table-action:focus-visible {
    outline: 2px solid var(--neon);
}

.subtitle {
    color: #ccc;
    font-size: 1.2em;
    margin-bottom: 30px;
}

.dashboard-summary {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}


.summary-card {
    background: rgba(20, 20, 20, .85);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 20px;
    width: 200px;
    box-shadow: var(--card-shadow);
}

.summary-card h3 {
    margin: 0;
    color: var(--neon);
    font-size: 1.1em;
}

.summary-card p {
    font-size: 2em;
    margin: 10px 0 0;
    color: #fff;
}

.dropdown-menu {
    background-color: #222;
    border: 1px solid var(--neon);
    border-radius: 8px;
    position: absolute;
    top: 60px;
    right: 20px;
    display: none;
    flex-direction: column;
    z-index: 2000;
    /* must be higher than sticky-filter-bar */

}

.dropdown-menu.show {
    display: flex;
}

.dropdown-menu a {
    color: var(--neon);
    padding: 10px 20px;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: var(--neon-14);
}

.date-filters {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* align inputs and button at bottom */
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.date-filter {
    display: flex;
    flex-direction: column;
    /* align-items: flex-start; */
    justify-content: center;
    min-height: 80px;
}

.date-filter label {
    color: var(--neon);
    font-size: 0.9em;
    margin-bottom: 5px;
    font-weight: 500;
}

.date-filter input {
    padding: 10px 14px;
    font-size: 1em;
    border-radius: 8px;
    border: 1px solid var(--neon);
    background-color: #111;
    color: #e0ffe0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: border 0.3s;
}

.date-filter input:focus {
    outline: none;
    border-color: #00cc6a;
    box-shadow: 0 0 5px var(--neon);
}

.date-filter button {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 8px;
    background: transparent;
    border: 2px solid var(--neon);
    color: var(--neon);
    font-weight: bold;
    width: 100%;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

.date-filter.button-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    min-height: 80px;
    /* Remove this ↓ */
    /* margin-top: 22px; */
}


.date-filter button:hover {
    background-color: var(--neon);
    color: #0f0f0f;
}

@media (max-width: 600px) {
    .date-filter button {
        font-size: 1.1em;
        padding: 12px;
    }
}

@media (max-width: 675px) {
    .date-filters {
        flex-direction: column;
        align-items: center;
        gap: 5px;
        /* smaller gap */
        margin-bottom: 10px;
    }

    .date-filter {
        min-height: auto;
        margin-bottom: 5px;
    }

    .date-filter input,
    .date-filter button {
        padding: 8px;
        font-size: 0.95em;
        width: 100%;
        max-width: 300px;
    }
}




.percentage-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.percentage-card {
    background: #333;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    width: 150px;
    box-shadow: 0px 0px 10px rgba(0, 255, 136, 0.4);
}

.progress-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(var(--neon) calc(var(--percent) * 1%), #222 calc(var(--percent) * 1%));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    margin: 10px auto 0;
}

@media (max-width: 768px) {
    .dashboard-summary {
        flex-direction: column;
        align-items: center;
    }
}




.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.form-grid label {
    grid-column: span 2;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-grid input,
.form-grid select {
    grid-column: span 2;
    padding: 10px;
    border-radius: 5px;
    border: none;
    background: #34495e;
    color: white;
}

.form-grid input:focus,
.form-grid select:focus {
    outline: none;
    border: 2px solid var(--neon);
}



.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

.loader {
    display: none;
    position: fixed;
    z-index: 999;
    /* Below the modal but above other content */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 12px solid #f3f3f3;
    border-top: 12px solid var(--neon);
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 99;
    /* Below the modal and spinner but above the form */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Semi-transparent background */
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.tooltip-container {
    display: inline-block;
    position: relative;
    margin-left: 5px;
}

.tooltip-icon {
    color: #17a2b8;
    cursor: pointer;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ===============================
   Authentication Container (Dark Themed for Dyno Raptor)
================================= */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-box {
    background-color: #1a1a1a;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 20px var(--neon-30);
    max-width: 400px;
    width: 100%;
    color: #e0ffe0;
}

.form-title {
    text-align: center;
    color: var(--neon);
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 1.8em;
}

.auth-form .form-control {
    background-color: #2c2c2c;
    border: 1px solid var(--neon);
    color: #e0ffe0;
    padding: 10px;
    border-radius: 5px;
}

.auth-form .form-control:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--neon);
    border-color: var(--neon);
}

.login-btn {
    width: 100%;
    background-color: var(--neon);
    border: none;
    color: #0f0f0f;
    padding: 10px;
    font-weight: bold;
    border-radius: 5px;
    transition: background 0.3s;
}

.login-btn:hover {
    background-color: #00cc6a;
}

.auth-links {
    text-align: center;
    margin-top: 15px;
}

.auth-links a {
    display: block;
    color: var(--neon);
    text-decoration: none;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.auth-links a:hover {
    text-decoration: underline;
}

.hidden {
    display: none;
}

.error-message {
    color: #ff4c4c;
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
}

.alert-info {
    background-color: #2a2a2a;
    color: var(--neon);
    border: 1px solid var(--neon);
}

.login-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    padding: 24px;
}

.login-modal-content {
    width: min(420px, 92vw);
    background: rgba(22, 22, 22, 0.96);
    color: #e0ffe0;
    padding: 24px;
    border-radius: var(--r-lg);
    border: 1px solid var(--neon-35);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

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


/* ───────────── Stop events panel ───────────── */

.stop-events-panel {
    margin-top: 48px;
    text-align: left;
}

.stop-events-summary {
    display: flex;
    gap: var(--gap-4);
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: var(--gap-4) 0;
}

.stop-summary-card {
    background: rgba(20, 20, 20, .85);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 14px 18px;
    min-width: 150px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stop-summary-card:hover {
    border-color: var(--neon-55);
    box-shadow: 0 0 24px rgba(0, 255, 136, 0.16);
}

.stop-summary-label {
    font-size: 0.85rem;
    color: var(--neon);
    display: block;
    margin-bottom: 6px;
}

.stop-summary-card strong {
    font-size: clamp(1.2rem, 1.2vw + .9rem, 1.8rem);
    font-weight: 600;
    color: #ffffff;
}

.stop-events-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: var(--gap-2);
    margin-bottom: var(--gap-4);
}

.stop-toolbar-left {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-2);
    align-items: center;
}

.stop-toolbar-message {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(0, 255, 136, 0.75);
}

.stop-toolbar-block {
    display: flex;
    flex-direction: column;
    gap: var(--gap-1);
    min-width: 120px;
}

.stop-toolbar-left label {
    font-size: 0.85rem;
    color: var(--neon);
}

.stop-toolbar-left input,
.stop-toolbar-left select {
    width: 100%;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(15, 15, 15, 0.95);
    color: var(--text);
}

.stop-toolbar-block input[type="number"] {
    max-width: 110px;
}

.stop-toolbar-left select {
    min-width: 160px;
}

.stop-toolbar-actions {
    display: flex;
    gap: var(--gap-2);
    align-items: center;
}

.stop-config-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.stop-config-button span[aria-hidden="true"] {
    font-size: 1.15rem;
}

.stop-config-label {
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.stop-column-controls {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}

.stop-dyno-filter {
    display: flex;
    flex-direction: column;
    gap: var(--gap-1);
    min-width: 160px;
}

.stop-dyno-filter label {
    font-size: 0.82rem;
    color: rgba(0, 255, 136, 0.8);
}

.stop-dyno-filter select {
    padding: 6px 10px;
    border-radius: var(--r-sm);
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(15, 15, 15, 0.95);
    color: var(--text);
}

.stop-toolbar-hint {
    font-size: 0.75rem;
    color: var(--muter);
    opacity: 0.85;
}

.stop-events-layout {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.6fr);
    gap: var(--gap-4);
    align-items: flex-start;
}

.stop-events-spinner {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 10, 8, 0.65);
    backdrop-filter: blur(2px);
    z-index: 4000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.stop-events-spinner.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.stop-events-spinner::before {
    content: '';
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid rgba(0, 255, 136, 0.25);
    border-top-color: rgba(0, 255, 136, 0.9);
    animation: stop-spinner-rotate 0.75s linear infinite;
    box-shadow: 0 0 18px rgba(0, 255, 136, 0.45);
}

@keyframes stop-spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

.stop-column {
    background: rgba(20, 20, 20, .85);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 18px;
    box-shadow: var(--card-shadow);
}

.stop-column--list {
    display: flex;
    flex-direction: column;
    gap: var(--gap-2);
    min-height: 420px;
}

.stop-column--insights {
    display: flex;
    flex-direction: column;
    gap: var(--gap-4);
    min-height: 420px;
}

.stop-chart-card {
    position: relative;
    background: rgba(20, 20, 20, .9);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 20px 22px 24px;
    box-shadow: var(--card-shadow);
}


.stop-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 14px;
}

.stop-chart-controls {
    /* display: flex; */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    flex: 1 1 auto;
    padding-right: 76px;
}

.stop-chart-expand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(12, 20, 16, 0.85);
    color: #9ef5ca;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.stop-chart-expand:hover,
.stop-chart-expand:focus-visible {
    outline: none;
    color: #ffffff;
    border-color: rgba(0, 255, 136, 0.7);
    background: rgba(0, 255, 136, 0.18);
    transform: translateY(-1px);
}

.stop-chart-expand.stop-chart-expand--active {
    color: #ffffff;
    border-color: rgba(0, 255, 136, 0.75);
    background: linear-gradient(140deg, rgba(0, 255, 136, 0.25), rgba(0, 140, 108, 0.25));
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.35);
}

.stop-chart-expand__icon {
    font-size: 1rem;
    line-height: 1;
}

.stop-chart-expand {
    position: absolute;
    top: 18px;
    right: 24px;
}

.stop-chart-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stop-chart-header h3 {
    margin: 0;
    color: #ffffff;
}

.stop-chart-subtitle {
    font-size: 0.82rem;
    color: #8debbd;
    opacity: 0.85;
}

.stop-chart-toggle {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.stop-chart-toggle__btn {
    border: 1px solid rgba(0, 255, 136, 0.25);
    background: rgba(18, 18, 18, 0.9);
    color: #8debbd;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.stop-chart-toggle__btn:hover,
.stop-chart-toggle__btn:focus-visible {
    border-color: rgba(0, 255, 136, 0.55);
    color: #ffffff;
    outline: none;
}

.stop-chart-toggle__btn.is-active {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.22), rgba(0, 150, 110, 0.22));
    border-color: rgba(0, 255, 136, 0.6);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.25);
}

.stop-chart-canvas {
    position: relative;
    height: 320px;
}

.stop-chart-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    margin-top: 0;
    max-height: none;
    background: rgba(16, 16, 16, 0.78);
    border-radius: 14px;
    border: 1px solid rgba(0, 255, 136, 0.12);
}

.stop-chart-card.is-expanded {
    position: fixed;
    top: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(96vw, 1020px);
    height: 80vh;
    z-index: 1400;
    padding: 26px 28px;
}

.stop-chart-card.is-expanded .stop-chart-canvas {
    height: calc(100% - 110px);
}

.stop-chart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 8, 0.72);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1300;
}

.stop-chart-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

body.stop-chart-expanded {
    overflow: hidden;
}

.stop-hours-table-card {
    margin-top: var(--gap-3);
    background: rgba(20, 20, 20, .9);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 18px 20px 22px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: var(--gap-2);
}

.stop-hours-table-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.stop-hours-table-header h4 {
    margin: 0;
    font-size: 1.02rem;
    letter-spacing: 0.04em;
    color: #ffffff;
}

.stop-hours-table-caption {
    font-size: 0.78rem;
    color: rgba(0, 255, 136, 0.7);
    letter-spacing: 0.03em;
}

.stop-hours-table-wrapper {
    overflow-x: auto;
    scrollbar-color: rgba(0, 255, 136, 0.5) rgba(0, 0, 0, 0.2);
}

.stop-hours-table-wrapper.is-empty {
    opacity: 0.75;
}


.stop-hours-table {
    min-width: 540px;
    font-size: 0.85rem;
}

.stop-hours-table thead th {
    text-align: center;
}

.stop-hours-table tbody th {
    text-align: left;
    border-right: 1px solid rgba(0, 255, 136, 0.12);
}

.stop-hours-table td {
    text-align: right;
}

.stop-hours-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.stop-hours-sort:focus-visible {
    outline: 2px solid rgba(0, 255, 136, 0.6);
    outline-offset: 2px;
}

.stop-hours-sort__icon {
    font-size: 0.7rem;
    opacity: 0.75;
}

.stop-hours-sort.is-active .stop-hours-sort__icon {
    opacity: 1;
    color: rgba(0, 255, 136, 0.9);
}

.stop-hours-table td.stop-hours-table__cell--total,
.stop-hours-table tfoot td {
    font-weight: 600;
    color: #ffffff;
}

.stop-hours-table tfoot {
    background: rgba(0, 255, 136, 0.08);
}

.stop-hours-table tfoot td,
.stop-hours-table tfoot th {
    padding: 10px 12px;
    text-align: right;
    border-top: 1px solid rgba(0, 255, 136, 0.25);
}

.stop-hours-table tfoot th {
    text-align: left;
}

.stop-hours-table__empty td {
    text-align: center;
    padding: 14px 12px;
    font-style: italic;
    color: rgba(0, 255, 136, 0.7);
}

.stop-table-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 6px;
    background: var(--pill-bg, rgba(0, 255, 136, 0.6));
}

.stop-column-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 16px;
}

.stop-column-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stop-column-header h3 {
    margin: 0;
    color: var(--neon);
}

.stop-pending-highlight {
    border-color: var(--neon-55);
    background: var(--neon-10);
}

.stop-event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    padding: 2px 4px 6px 0;
}

.stop-event-card {
    padding: 12px 14px;
    border-radius: var(--r-lg);
    border: 1px solid var(--neon-20);
    background: rgba(30, 30, 30, 0.9);
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, border-color .15s ease;
    position: relative;
}

.stop-event-card--pending {
    border-left: 3px solid color-mix(in oklab, var(--warn) 85%, #000 15%);
}

.stop-event-card--recorded {
    border-left: 3px solid color-mix(in oklab, var(--info) 85%, #000 15%);
}

@supports not (color: color-mix(in oklab, red, blue)) {
    .stop-event-card--pending {
        border-left-color: #ffb868;
    }

    .stop-event-card--recorded {
        border-left-color: #40c4ff;
    }
}

.stop-event-card.active {
    border-color: var(--neon-55);
    background: var(--neon-10);
}

.stop-event-card--pending.active {
    border-left-color: color-mix(in oklab, var(--warn) 92%, #000 8%);
}

.stop-event-card--recorded.active {
    border-left-color: color-mix(in oklab, var(--info) 92%, #000 8%);
}

.stop-event-card:hover {
    border-color: var(--neon-55);
}


.stop-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}


.stop-event-card .stop-event-title {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.stop-event-card .stop-event-title span:last-child {
    font-size: 0.85rem;
    color: #8debbd;
    font-weight: 500;
}

.stop-event-card .stop-event-meta {
    font-size: 0.78rem;
    color: #9adfbf;
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stop-event-meta--secondary {
    font-size: 0.74rem;
    color: #8debbd;
    opacity: 0.85;
}

.stop-event-card .stop-event-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.stop-badge {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 136, 0.4);
    color: #84f0ba;
}

.stop-event-status {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-weight: 600;
    gap: 6px;
    flex-shrink: 0;
}

.stop-event-status--pending {
    color: #ffddaa;
    border-color: rgba(255, 190, 104, 0.45);
    background: rgba(255, 190, 104, 0.15);
    box-shadow: 0 0 10px rgba(255, 190, 104, 0.15);
}

.stop-event-status--recorded {
    color: #9ee5ff;
    border-color: rgba(64, 196, 255, 0.45);
    background: rgba(64, 196, 255, 0.18);
    box-shadow: 0 0 10px rgba(64, 196, 255, 0.15);
}

.stop-event-filters {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stop-filter-btn {
    border: 1px solid rgba(0, 255, 136, 0.25);
    background: rgba(18, 18, 18, 0.9);
    color: #8debbd;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.stop-filter-btn:hover,
.stop-filter-btn:focus-visible {
    border-color: rgba(0, 255, 136, 0.55);
    color: #ffffff;
    outline: none;
}

.stop-filter-btn.is-active {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.22), rgba(0, 150, 110, 0.22));
    border-color: rgba(0, 255, 136, 0.6);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.25);
}

.stop-badge.long {
    border-color: #ff8f5a;
    color: #ffb38f;
}

.stop-form-card {
    margin-bottom: var(--gap-4);
    background: rgba(28, 28, 28, 0.95);
    border-radius: var(--r-lg);
    padding: 20px;
    border: var(--card-b);
    box-shadow: var(--card-shadow);
}

.stop-form-card--modal {
    margin-bottom: 0;
}

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

.stop-form-header h3 {
    margin: 0;
    color: #ffffff;
}

.stop-duration-badge {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 136, 0.45);
    color: #84f0ba;
}

.stop-form-row {
    display: flex;
    flex-direction: column;
    gap: var(--gap-1);
    margin-bottom: var(--gap-2);
}

.stop-form-row--inline {
    flex-direction: row;
    gap: var(--gap-3);
}

.stop-form-row--inline>div {
    flex: 1;
}

.stop-form-value {
    background: rgba(18, 18, 18, 0.9);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    font-size: 0.95rem;
}

.stop-form-row select,
.stop-form-row textarea {
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 10px;
    padding: 10px 12px;
    color: #e0ffe0;
    font-size: 0.95rem;
}

.stop-form-row textarea {
    resize: vertical;
}

.stop-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.stop-tag {
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 999px;
    padding: 6px 14px;
    background: rgba(18, 18, 18, 0.9);
    color: var(--neon);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.stop-tag:hover {
    border-color: rgba(0, 255, 136, 0.65);
}

.stop-tag.active {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.7);
    color: #ffffff;
}

.stop-tag--type {
    min-width: 100px;
    text-align: center;
}

.stop-type-token {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.stop-type-token__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stop-type-token:not(.is-active) .stop-type-token__badge {
    opacity: 0.55;
    filter: saturate(0.35);
    box-shadow: none;
}

.stop-type-token.is-active .stop-type-token__badge {
    opacity: 1;
    filter: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 14px rgba(0, 255, 136, 0.25);
}

.stop-type-token__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--token-dot, var(--neon));
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}

.stop-type-token__label {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stop-type-token:hover .stop-type-token__badge,
.stop-type-token:focus-visible .stop-type-token__badge {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.35);
}

.stop-type-token:focus-visible .stop-type-token__badge {
    outline: 2px solid rgba(0, 255, 136, 0.45);
    outline-offset: 2px;
}

.stop-type-toggle {
    display: inline-flex;
    gap: 8px;
}

.stop-type-toggle button {
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: transparent;
    color: #8debbd;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.stop-type-toggle button.active {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.65);
    color: #ffffff;
}

.stop-form-actions {
    display: flex;
    gap: var(--gap-2);
    flex-wrap: wrap;
}

.stop-form-actions .ghost {
    border-color: rgba(0, 255, 136, 0.35);
}

.stop-form-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.35);
    color: #8debbd;
    font-size: 0.9rem;
}

.stop-recorded-card {
    background: rgba(20, 20, 20, .9);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 18px;
    box-shadow: var(--card-shadow);
}

.stop-recorded-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    margin-bottom: 12px;
}

.stop-recorded-header h3 {
    margin: 0;
}

.stop-recorded-info {
    font-size: 0.82rem;
    color: #86d8b1;
}

.stop-event-list--compact .stop-event-card {
    padding: 9px 11px;
}

.stop-empty {
    font-size: 0.9rem;
    color: #7bcfa6;
    border: 1px dashed rgba(0, 255, 136, 0.35);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    background: rgba(16, 16, 16, 0.65);
}

.stop-empty--inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 10px;
}

.stop-catalog-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 18px;
}

.stop-config-section {
    grid-column: 1 / -1;
    background: rgba(32, 32, 32, 0.9);
    border-radius: 14px;
    padding: 18px;
    border: 1px solid rgba(0, 255, 136, 0.25);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stop-config-section__header h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
}

.stop-config-section__header p {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: rgba(0, 255, 136, 0.7);
}

.stop-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.stop-config-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: rgba(0, 255, 136, 0.8);
}

.stop-config-grid input[type="number"] {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(10, 10, 10, 0.95);
    color: #f0fff0;
    font-size: 0.95rem;
}

.stop-config-grid input[type="number"]:focus {
    outline: none;
    border-color: rgba(0, 255, 136, 0.75);
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.stop-catalog-section {
    background: rgba(32, 32, 32, 0.9);
    border-radius: var(--r-lg);
    padding: 16px;
    border: var(--card-b);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stop-catalog-section h3 {
    margin-top: 0;
}

.stop-catalog-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.stop-catalog-header h3 {
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.stop-catalog-controls {
    display: flex;
    gap: 10px;
    align-items: stretch;
    width: 100%;
    flex: 1 1 auto;
}

.stop-catalog-controls input[type="search"] {
    flex: 1 1 auto;
    width: 100%;
    background: rgba(16, 16, 16, 0.92);
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 12px;
    height: 36px;
    /* exact height to match button */
    padding: 0 14px;
    /* vertical height comes from 'height' */
    font-size: 0.95rem;
    color: #e0ffe0;
}

.stop-catalog-controls input[type="search"]::placeholder {
    color: rgba(224, 255, 224, 0.55);
}

.stop-catalog-controls .primary {
    flex: 0 0 auto;
    height: 36px;
    /* match input */
    padding: 0 14px;
    /* horizontal padding only */
    border-radius: 10px;
    font-size: 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.stop-catalog-table-wrapper {
    max-height: 240px;
    overflow: auto;
}

.stop-catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stop-catalog-table th,
.stop-catalog-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.12);
    text-align: left;
    vertical-align: middle;
}

.stop-catalog-table tr:last-child th,
.stop-catalog-table tr:last-child td {
    border-bottom: none;
}

.stop-catalog-table td:last-child {
    text-align: right;
    white-space: nowrap;
    /* display: flex; */
    /* cleaner vertical centering */
    justify-content: flex-end;
    align-items: center;
    gap: 8px;

}

.stop-catalog-chip {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 6px;
}

.stop-catalog-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    background: var(--tag-bg, var(--neon));
    color: var(--tag-color, #001b13);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stop-status-cell {
    text-align: center;
    width: 70px;
}

.stop-status-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 136, 0.25);
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.stop-status-indicator.is-active {
    background: var(--neon);
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.stop-status-indicator.is-inactive {
    opacity: 0.35;
    border-color: rgba(0, 255, 136, 0.12);
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.stop-color-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stop-color-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 6px 12px;
    color: #e0ffe0;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.stop-color-trigger:hover,
.stop-color-trigger:focus {
    border-color: rgba(0, 255, 136, 0.7);
    transform: translateY(-1px);
    outline: none;
}

.stop-color-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.3);
}

.stop-color-label {
    font-weight: 600;
    letter-spacing: 0.04em;
}

.stop-color-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

body.stop-dialog-open {
    overflow: hidden;
}

.stop-dialog-content {
    position: relative;
    width: min(420px, 90vw);
    padding: 30px 28px 26px;
}

.stop-dialog--event .stop-dialog-content--event {
    width: min(640px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    padding: 34px 32px 28px;
    background: rgba(14, 18, 15, 0.97);
    border: 1px solid rgba(0, 255, 136, 0.35);
}

.stop-dialog--event .stop-dialog-close {
    top: 16px;
    right: 16px;
}

.stop-dialog-content h4 {
    margin: 0 0 18px;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: #f2fff5;
    text-align: left;
}

.stop-dialog-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stop-dialog-form label {
    text-align: left;
    /* ← left align labels */
    font-weight: 600;
    color: #a8ffdc;
}

.stop-dialog-form input,
.stop-dialog-form textarea {
    background: rgba(16, 16, 16, 0.94);
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 12px;
    padding: 10px 14px;
    color: #e0ffe0;
}

.stop-dialog-form textarea {
    resize: vertical;
    min-height: 70px;
}

.stop-dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #f2fff5;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.stop-dialog-close:hover,
.stop-dialog-close:focus {
    border-color: rgba(0, 255, 136, 0.7);
    color: var(--neon);
    outline: none;
}

.stop-dialog-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.stop-dialog-actions .primary {
    flex: 1;
}

.stop-dialog-actions .primary {
    flex: 1;
    background: linear-gradient(135deg, rgba(0, 255, 136, .25), rgba(0, 180, 150, .25));
    border: 1px solid rgba(0, 255, 136, .55);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 12px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.stop-dialog-actions .primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(0, 255, 136, .35);
    border-color: rgba(0, 255, 136, .8);
}

.stop-dialog-actions .danger {
    min-width: 120px;
    background: rgba(255, 120, 102, .15);
    border: 1px solid rgba(255, 120, 102, .6);
    color: #ffb7a8;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 12px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.stop-dialog-actions .danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(255, 120, 102, .35);
    border-color: rgba(255, 120, 102, .85);
}

.stop-catalog-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stop-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #8debbd;
}

.stop-catalog-list small {
    font-size: 0.75rem;
    color: #7bcfa6;
}

.stop-table-action {
    height: 32px;
    padding: 0 12px;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 255, 136, .35);
    /* softer outline */
    background: transparent;
    /* no fill */
    color: #a8ffdc;
    /* calmer text */
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    /* lighter weight */
    letter-spacing: .2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: none;
    /* remove aggressive glow */
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
    text-decoration: none;
}

.stop-table-action:hover {
    background: rgba(0, 255, 136, .08);
    /* subtle wash */
    border-color: rgba(0, 255, 136, .55);
    transform: translateY(-1px);
}

.stop-table-action:focus-visible {
    outline: none;
    border-color: rgba(0, 255, 136, .7);
    box-shadow: 0 0 0 2px rgba(0, 255, 136, .15);
    /* gentle focus ring */
}

.stop-table-action.danger {
    display: none;
}

/* Tipos de evento: hide Color col (2nd) */
#stop-type-table th:nth-child(2),
#stop-type-table td:nth-child(2) {
    display: none !important;
}

/* Name column → tokenized label using --chip */
#stop-type-table td:first-child {
    white-space: nowrap;
}

#stop-type-table td:first-child .type-token {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--chip, var(--neon));
    background: rgba(0, 255, 136, .08);
    color: #eafff6;
    font-weight: 600;
    letter-spacing: .2px;
}

#stop-type-table td:first-child .type-token::before {
    content: "";
    inline-size: 10px;
    block-size: 10px;
    border-radius: 50%;
    background: var(--chip, var(--neon));
    box-shadow: 0 0 8px var(--chip, var(--neon));
}

/* Estado column (3rd) shows dot only when active */
#stop-type-table td:nth-child(3) {
    text-align: center;
    font-size: 0;
    /* hide any legacy text like “Activo/Inactivo” */
}

#stop-type-table td:nth-child(3)[data-active="true"]::before {
    content: "";
    display: inline-block;
    inline-size: 10px;
    block-size: 10px;
    border-radius: 50%;
    background: var(--neon);
    box-shadow: 0 0 8px rgba(0, 255, 136, .9);
}

/* Actions column → link-like “Editar” */

@media (max-width: 1024px) {
    .stop-events-layout {
        grid-template-columns: 1fr;
    }

    .stop-chart-canvas {
        height: 280px;
    }
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 72px 18px 48px;
    }

    .stop-chart-canvas {
        height: 240px;
    }

    .stop-events-summary {
        justify-content: center;
    }

    .stop-toolbar-left {
        flex-direction: column;
        align-items: flex-start;
    }

    .telemetry-table-wrap {
        overflow-x: auto;
    }

    .telemetry-table {
        min-width: 720px;
        table-layout: auto;
    }
}

.login-modal-title {
    color: var(--neon);
    margin: 0;
    font-size: 1.2em;
}

.login-modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}

.login-modal-close:hover {
    color: #fff;
}

.login-modal-body {
    margin-top: 10px;
    font-size: 1em;
}

/* quick range buttons */

.quick-range-container {
    width: 100%;
    text-align: center;
    margin-top: 10px;
}

/* .quick-range-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
} */
.quick-range-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--gap-2);
    flex-wrap: wrap;
}

.quick-range-buttons button {
    pointer-events: auto;
}




.filter-modal-content {
    max-width: 420px;
    width: calc(100% - 48px);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap-3);
}

.filter-modal-content button.outlined-button {
    background-color: var(--neon);
    color: #0f0f0f;
    border-color: var(--neon);
}

.filter-modal-content h2 {
    margin: 0;
    text-align: center;
    font-size: clamp(1.2rem, .9vw + .9rem, 1.8rem);
    color: var(--neon);
}




.modal-date-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--gap-3);
    margin-top: var(--gap-3);
}

.modal-date-filters .date-filter {
    display: flex;
    flex-direction: column;
    gap: var(--gap-1);
    padding: 16px;
    background: rgba(20, 20, 20, .85);
    border: 1px solid var(--neon-20);
    border-radius: var(--r-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.modal-date-filters .date-filter label {
    color: var(--muted);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.modal-date-filters .date-filter input {
    padding: 10px 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--neon-20);
    background: rgba(15, 15, 15, .9);
    color: var(--text);
    font-family: inherit;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.modal-date-filters .date-filter input:focus {
    border-color: var(--neon-55);
    box-shadow: 0 0 0 2px var(--neon-20);
    outline: none;
}

.modal .outlined-button {
    margin-top: var(--gap-2);
    background: transparent;
    border: 2px solid var(--neon);
    color: var(--neon);
    padding: 12px;
    font-weight: 700;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease, background .2s ease, transform .2s ease;
}

.modal .outlined-button:hover {
    background: var(--neon-10);
    border-color: var(--neon-55);
    color: #fff;
    transform: translateY(-1px);
}

.modal-content button {
    background-color: var(--neon);
    color: #1a1a1a;
    border: none;
    padding: 12px 18px;
    border-radius: var(--r-md);
    width: auto;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.modal-content button:hover {
    background-color: #00cc6a;
    box-shadow: 0 0 18px rgba(0, 255, 136, .25);
    transform: translateY(-1px);
}

.sticky-filter-bar {
    position: sticky;
    /* on the buttom part of the screen */
    top: 60px;
    z-index: 500;
    /* background-color: #0f0f0f; */
    padding: 10px 0;
    /* width: 100%; */
    /* box-shadow: 0 2px 8px rgba(0, 255, 136, 0.2); */
    pointer-events: none;
    /* 👈 prevents it from blocking clicks */
}



.sticky-filter-bar * {
    pointer-events: auto;
    /* 👈 restores interaction for children */
}

/* ─────────────────────────  Uptime table  ───────────────────────── */

.uptime-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
    margin: 30px 0 40px;
    border-radius: 12px;
}

.uptime-table {
    width: 100%;
    border-collapse: collapse;
    /* margin: 40px 0; */
    font-size: 0.95rem;
}

.uptime-table thead {
    background: #111;
    color: var(--neon);
}

.uptime-table th,
.uptime-table td {
    padding: 12px 16px;
    border: 1px solid var(--neon-20);
    /* subtle grid lines   */
    text-align: left;
}

.uptime-table tbody tr:nth-child(even) {
    background: #222;
}

.uptime-table tbody tr:hover {
    background: var(--neon-14);
}

.uptime-table .pct-cell {
    font-weight: bold;
}



/* colour-strip rows to match the emoji flag */
#dyno-table-last-ping tr.ok {
    background: #004d2a22;
}

#dyno-table-last-ping tr.lag {
    background: #66550022;
}

#dyno-table-last-ping tr.off {
    background: #4d000022;
}



/* ─── CARD SHELL (inherits border & glow) ─────────────────────────── */
.summary-card.status-card {
    width: 240px;
    /* a bit wider */
    /* height: 260px; */
    max-height: 150px;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* header bar */
.summary-card.status-card h3 {
    padding: 5px 18px;
    margin: 0;
    /* background: #111; */
    border-bottom: 1px solid var(--neon);
    font-size: 1.05rem;
}

/* scroll box */
.status-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
}

/* ─── TABLE LOOK & FEEL ───────────────────────────────────────────── */
.status-table {
    font-size: .85rem;
}

.status-table th,
.status-table td {
    text-align: left;
    white-space: nowrap;
}

/* coloured pill based on status class */
.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: .75rem;
}


/* ───── power-outage table ───── */
.power-table-wrapper {
    max-height: 400px;
    margin: 30px 0 40px;
}

.power-table td {
    text-align: left;
}

.sub-value {
    display: block;
    margin-top: 4px;
    font-size: .75rem;
    color: var(--muter);
}


/* ─────────────────────────   ───────────────────────── */

/* base – visible in desktop, hidden in mobile (media query below) */
.sidebar {
    flex: 0 0 220px;
    transform: translateX(0);
    transition: transform .25s ease, flex-basis .25s ease;
}

/* CLOSED (desktop) */
.sidebar.closed {
    flex: 0 0 0;
    transform: translateX(-220px);
}

/* MOBILE default = hidden */
@media (max-width:768px) {
    .sidebar {
        position: fixed;
        top: 60px;
        height: calc(100% - 60px);
        z-index: 1200;
        transform: translateX(-220px);
        /* off-canvas by default */
    }

    .sidebar.open {
        /* slide in when .open present */
        transform: translateX(0);
    }
}

/* show hamburger ALWAYS (was mobile-only) */
.hamburger {
    display: inline-block;
    margin-right: 12px;
    cursor: pointer;
    width: 26px;
    height: 20px;
}

.hamburger span,
.hamburger::before,
.hamburger::after {
    content: "";
    display: block;
    height: 3px;
    background: var(--neon);
    margin: 4px 0;
    transition: transform .25s;
}





/* optional: shrink summary cards to two per row */
.dashboard-summary {
    gap: 16px;
}

.summary-card {
    width: 140px;
}


/* ─────────── layout shell ─────────── */
.app-wrapper {
    display: flex;
    /* height: 100vh; */
    /* overflow: hidden; */
}

.sidebar {
    width: 220px;
    background: #0e0f11;
    color: #e0ffe0;
    display: flex;
    flex-direction: column;
    padding-top: 60px;
    /* below sticky‑header */
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.4);
}

@media (min-width: 769px) {
    .sidebar {
        position: sticky;
        top: 60px;
        height: calc(100vh - 60px);
        overflow-y: auto;
    }
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar li {
    padding: 14px 24px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.0px;
    transition: background 0.18s;
}

.sidebar li:hover {
    background: var(--neon-14);
}

.sidebar li.active {
    background: var(--neon);
    color: #0e0f11;
}

/* push main content down so sticky bars never cover it */
.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 80px 32px 64px;
    /* 80px top resembles header + filter */
}

.section-container {
    display: none;
    animation: fadeIn 0.18s ease-out;
}

.section-container.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* compact table + selected row highlight */
/* compact dyno table + sort + selection */



/* ========= Telemetry: shared styles for any metrics panel ========= */


/* Base layout for telemetry rows (replaces the inline styles) */
.telemetry-row {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

/* Base chart column sizing (replaces the inline styles) */
.telemetry-chart-wrap {
    flex: 1 1 600px;
    /* grow, shrink, preferred width */
    min-width: 300px;
    position: relative;
    height: 100%;
}

.telemetry-chart-wrap canvas {
    width: 100%;
    height: 100%;
    max-height: none;
}

.telemetry-selected-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(0, 255, 136, .12);
    color: #e0ffe0;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    transition: background .2s ease;
}

.telemetry-selected-name::before {
    content: '●';
    font-size: 0.65rem;
    color: var(--neon);
    line-height: 1;
}

.telemetry-selected-name[data-overlay="true"]::before {
    color: #7cf0ff;
}

.telemetry-selected-name[data-overlay="true"] {
    background: rgba(124, 240, 255, .16);
    color: #c8fbff;
}


/* default sizing beside the chart */
#energy-row .telemetry-table-wrap {
    flex: 0 1 260px;
    min-width: 260px;
}

/* when expanded, let it stretch */
.telemetry-row.expanded .telemetry-table-wrap {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* default: table narrow beside chart */
#power-row .telemetry-table-wrap {
    flex: 0 1 260px;
    min-width: 260px;
}

/* expanded: table stretches */
.telemetry-row.expanded .telemetry-table-wrap {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* default: table narrow beside chart */
#energyuse-row .telemetry-table-wrap {
    flex: 0 1 260px;
    min-width: 260px;
}

/* expanded: table stretches full width under the chart */
.telemetry-row.expanded .telemetry-table-wrap {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

#freq-row .telemetry-table-wrap {
    flex: 0 1 260px;
    min-width: 260px;
}






/* Table base */
.telemetry-table th,
.telemetry-table td {
    padding: 6px 8px;
    font-size: .9rem;
    white-space: nowrap;
}



.telemetry-table th.sortable {
    cursor: pointer;
}

/* Sticky header on tall tables */
.telemetry-table thead {
    position: sticky;
    top: 0;
    background: #111;
    z-index: 1;
}

/* Table wrapper (scroll behavior) */
.telemetry-table-wrap {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Collapsed mode: show only first column (Máquina) */
.telemetry-table-wrap.collapsed thead tr:nth-child(2) {
    /* hide the μ/σ/min/max row if you render one */
    display: none;
}

.telemetry-table-wrap.collapsed thead tr:first-child th:nth-child(n+2),
.telemetry-table-wrap.collapsed tbody td:nth-child(n+2) {
    display: none;
}

/* Row layout & expanded mode */
.telemetry-row.expanded {
    /* applies to the panel’s row container */
    flex-direction: column;
}

.telemetry-row.expanded canvas {
    margin-top: var(--gap-2);
    /* tighter spacing when stacked */
}

.telemetry-row.expanded .telemetry-chart-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.telemetry-row.expanded .telemetry-table-wrap {
    order: 2;
    width: 100%;
    height: auto;
    max-height: none;
    overflow-y: auto;
    overflow-x: auto;
}


/* ================================
   Telemetry tables – neon theme
   (Drop this at the end of your CSS)
===================================*/

/* Card look for the table container */
.telemetry-table-wrap {
    background: linear-gradient(180deg, var(--panel-bg-1) 0%, var(--panel-bg-2) 100%);
    border: 1px solid var(--neon-20);
    border-radius: 12px;
    box-shadow:
        0 0 0 1px var(--neon-10) inset,
        0 0 22px var(--neon-14);
    margin: 30px 0 40px;
    overflow: auto;
    /* keeps your existing scroll behavior */
}

/* Let the table keep rounded corners */
.telemetry-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: transparent;
    font-size: .9rem;
}

/* Sticky header with neon punch */
.telemetry-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #0f1714 0%, #0a1411 100%);
    box-shadow: 0 6px 10px rgba(0, 0, 0, .45);
}

.telemetry-table thead th {
    color: var(--neon);
    border-bottom: 1px solid var(--neon-20);
    padding: 10px 12px;
    font-weight: 600;
    letter-spacing: .2px;
    text-shadow: 0 0 6px var(--neon-30);
    /* Ensure header cells participate in stacking so z-index works */
    position: relative;
    z-index: 1;
}

.telemetry-table thead th:first-child {
    border-top-left-radius: 12px;
}

.telemetry-table thead th:last-child {
    border-top-right-radius: 12px;
}

/* Body rows: stripes, dividers, hover glow */
.telemetry-table tbody tr:nth-child(even) {
    background: var(--panel-row-alt);
}

.telemetry-table tbody td {
    border-bottom: 1px solid rgba(0, 255, 136, .12);
    padding: 8px 12px;
}

.telemetry-table tbody tr:hover {
    background: linear-gradient(90deg, var(--neon-05), transparent);
}




/* Round the bottom corners on the last row */
.telemetry-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.telemetry-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

/* Right-align metrics (keep first column left-aligned) */
.telemetry-table th:not(:first-child),
.telemetry-table td:not(:first-child) {
    /* text-align: right; */
    font-variant-numeric: tabular-nums;
}

/* Sort affordance (works if you toggle .sorted-asc / .sorted-desc) */
.telemetry-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.telemetry-table th.sortable::after {
    content: '↕';
    font-size: .8rem;
    margin-left: .4rem;
    opacity: .55;
}

.telemetry-table th.sortable.sorted-asc::after {
    content: '↑';
    opacity: 1;
}

.telemetry-table th.sortable.sorted-desc::after {
    content: '↓';
    opacity: 1;
}

/* Compact density option (if you add .is-compact to the table) */
.telemetry-table.is-compact th,
.telemetry-table.is-compact td {
    padding: 6px 8px;
}

/* Collapsed mode: show only first column (matches your JS toggling .collapsed on the wrapper) */
.telemetry-table-wrap.collapsed thead tr:nth-child(2) {
    display: none;
}

.telemetry-table-wrap.collapsed thead tr:first-child th:nth-child(n+2),
.telemetry-table-wrap.collapsed tbody td:nth-child(n+2) {
    display: none;
}

/* Neon scrollbars inside the table container */
.telemetry-table-wrap::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

.telemetry-table-wrap::-webkit-scrollbar-track {
    background: #0f0f0f;
}

.telemetry-table-wrap::-webkit-scrollbar-thumb {
    background: var(--neon-30);
    border-radius: 8px;
    border: 2px solid #0f0f0f;
}

.telemetry-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--neon-40);
}

/* Glowing total chip */
.total-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--neon);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.06), rgba(0, 255, 136, 0.02));
    box-shadow: 0 0 18px rgba(0, 255, 136, 0.25), inset 0 0 12px rgba(0, 255, 136, 0.1);
    backdrop-filter: blur(2px);
}

.total-chip>span {
    color: #a8ffdc;
    font-size: .85rem;
    letter-spacing: .2px;
}

.total-chip>strong {
    color: #ffffff;
    font-size: 1.1rem;
    letter-spacing: .3px;
}

.total-chip>.unit {
    color: var(--neon);
    font-weight: 700;
    font-size: .85rem;
    opacity: .9;
}


/* ===== Selected row: clear, bright, and simple (final override) ===== */
/* === Selected row: fixed layout, no shifting, rail inside first cell === */

/* Stabilize column widths so header/body always align */
.telemetry-table {
    table-layout: fixed;
    /* prevents width recalcs on hover/selection */
}

.telemetry-table th,
.telemetry-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Keep first column (machine name) visible and above scrolled content */
.telemetry-table thead th:first-child,
.telemetry-table thead tr:first-child>th:first-child {
    position: sticky;
    left: 0;
    background: #0f0f0f;
    z-index: 6;
    /* keep above body first column */
}

/* Ensure the sticky first header cell stays above other header cells when scrolling X */
.telemetry-table thead th:first-child {
    z-index: 6;
}

/* Keep body first column above non-sticky header cells but below the sticky header cell */
.telemetry-table tbody td:first-child {
    z-index: 5;
}

/* Base hover (non-selected) stays subtle */
.telemetry-table tbody tr:not(.selected):hover {
    background: linear-gradient(90deg, var(--neon-10), transparent);
    box-shadow: inset 0 0 0 1px var(--neon-10);
}

/* Strong selected state (no transform!) */
.telemetry-table tbody tr.selected {
    background: linear-gradient(90deg, rgba(0, 255, 136, .28) 0%, rgba(0, 255, 136, .12) 45%, transparent 100%);
    box-shadow:
        inset 0 0 0 1px var(--neon-20),
        0 0 24px var(--neon-20);
}

/* Put the neon rail INSIDE the first cell so columns don’t shift */
.telemetry-table tbody td:first-child {
    position: relative;
}

/* Add a bit of left padding only when selected to make room for the rail */
.telemetry-table tbody tr.selected td:first-child {
    padding-left: 18px;
}

/* The rail itself */
.telemetry-table tbody tr.selected td:first-child::before {
    content: "";
    position: absolute;
    left: 6px;
    /* inside the cell, not outside the table */
    top: 8px;
    /* a little vertical inset looks nicer */
    bottom: 8px;
    width: 6px;
    background: linear-gradient(180deg, var(--neon) 0%, #7affc9 100%);
    box-shadow: 0 0 10px var(--neon), 0 0 22px var(--neon);
    border-radius: 3px;
}

/* Slightly stronger on hover, but no translate/shift */
.telemetry-table tbody tr.selected:hover {
    background: linear-gradient(90deg, rgba(0, 255, 136, .34) 0%, rgba(0, 255, 136, .16) 50%, transparent 100%);
    box-shadow:
        inset 0 0 0 1px var(--neon-30),
        0 0 30px var(--neon-20);
}

/* Crisper text in selected row */
.telemetry-table tbody tr.selected td {
    color: #eafff6;
}

.telemetry-table tbody tr.selected td:first-child {
    color: var(--neon);
    font-weight: 700;
}

/* Remove any previous selected-row transform if it exists */
.telemetry-table tbody tr.selected,
.telemetry-table tbody tr.selected:hover {
    transform: none;
}


/* Expand/collapse button – subtle neon pulse */
.expand-btn {
    --glow: var(--neon);
    background: transparent;
    color: var(--glow);
    border: 1px solid var(--glow);
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 600;
    box-shadow: 0 0 0 0 rgba(0, 255, 136, .2);
    --pulse-blur: 28px;
    /* was ~12px */
    --pulse-spread: 8px;
    /* was ~2px */
    --pulse-alpha: .55;
    /* stronger opacity */
    animation: neon-pulse 2.2s ease-in-out infinite;
    transition: background .2s, box-shadow .2s, transform .2s;
}

.expand-btn:hover,
.expand-btn:focus {
    background: rgba(0, 255, 136, .08);
    box-shadow: 0 0 18px rgba(0, 255, 136, .35), 0 0 2px rgba(0, 255, 136, .8) inset;
    transform: translateY(-1px);
}

/* When the row is open, stop the pulsing */
.telemetry-row.expanded .expand-btn {
    animation-play-state: paused;
    box-shadow: none;
}

@keyframes neon-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, .18);
    }

    50% {
        box-shadow: 0 0 var(--pulse-blur) var(--pulse-spread) rgba(0, 255, 136, var(--pulse-alpha));
    }
}

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }

    .expand-btn {
        animation: none;
    }
}



:root {
    --sidebar-width: 220px;
}

/* Floating toggle at bottom-left */
.bottom-sidebar-toggle {
    position: fixed;
    bottom: 16px;
    left: 16px;
    /* default when sidebar is hidden */
    z-index: 1500;
    /* above header/sidebar/spinner */
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid var(--neon);
    background: rgba(0, 0, 0, .35);
    color: var(--neon);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(0, 255, 136, .25);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.bottom-sidebar-toggle:hover,
.bottom-sidebar-toggle:focus {
    outline: none;
    transform: translateY(-1px);
    background: rgba(0, 255, 136, .10);
    box-shadow: 0 0 18px rgba(0, 255, 136, .35);
}

/* Hide-only helper for accessible text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 1px, 1px);
    white-space: nowrap;
    border: 0;
}

/* Make the button icon-only and center the glyph */
.bottom-sidebar-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    /* hide any stray text */
    line-height: 1;
}

/* Default icon = 'open' chevron (›). If you prefer plain '>' replace below. */
.bottom-sidebar-toggle::after {
    content: '›';
    font-size: 20px;
    /* icon size */
}

/* ===== Desktop state (sidebar visible when NOT .closed) ===== */
.app-wrapper>.sidebar:not(.closed)~.bottom-sidebar-toggle::after {
    content: '‹';
    /* points left to collapse */
}

/* ===== Mobile state (sidebar visible when .open) ===== */
@media (max-width: 768px) {
    .app-wrapper>.sidebar.open~.bottom-sidebar-toggle::after {
        content: '‹';
        /* points left to close */
    }

    .app-wrapper>.sidebar:not(.open)~.bottom-sidebar-toggle::after {
        content: '⮜';
        /* points right to open */
    }
}


/* On desktop, when the sidebar is visible (not .closed), nudge the button so it sits just outside the menu */
@media (min-width: 769px) {
    .app-wrapper>.sidebar:not(.closed)~.bottom-sidebar-toggle {
        left: calc(var(--sidebar-width) + 16px);
    }
}

/* On mobile, the sidebar is overlayed (class .open); keep the button at 16px from the edge */
@media (max-width: 768px) {
    .bottom-sidebar-toggle {
        left: 16px;
    }
}

/* Optional: hide when printing */
@media print {
    .bottom-sidebar-toggle {
        display: none;
    }
}


/* Mobile: always show as expanded; ignore collapse; disable expand button */
@media (max-width: 768px) {

    /* 1) Force "expanded" layout even if the JS never sets .expanded */
    .telemetry-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .telemetry-row .telemetry-chart-wrap {
        flex: 1 1 auto;
        min-width: 0;
        /* override the 300px min so it doesn't overflow */
        width: 100%;
        position: relative;
        height: auto;
    }

    .telemetry-row .telemetry-table-wrap {
        order: 2;
        /* table below chart */
        width: 100%;
        height: auto;
        max-height: none;
        /* let it grow naturally */
        overflow-y: auto;
        overflow-x: auto;
    }

    /* 2) If JS adds .collapsed, undo the column hiding on mobile */
    .telemetry-table-wrap.collapsed thead tr:nth-child(2) {
        display: table-row;
    }

    .telemetry-table-wrap.collapsed thead tr:first-child th:nth-child(n+2),
    .telemetry-table-wrap.collapsed tbody td:nth-child(n+2) {
        display: table-cell;
    }

    /* 3) Hide the "Estadísticas" expand buttons in telemetry sections on mobile */
    #section-currents .section-title .expand-btn,
    #section-power .section-title .expand-btn,
    #section-frequency .section-title .expand-btn,
    #section-energy .section-title .expand-btn,
    .telemetry-row .expand-btn {
        display: none;
    }

    /* 4) Keep the visuals fitting nicely on small screens */
    .telemetry-row canvas {
        width: 100%;
        height: auto;
    }

    .telemetry-selected-name {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }

    .telemetry-table-wrap {
        max-height: 60vh;
        margin: 6px 0 10px;
        /* a little tighter spacing than desktop */
    }
}

/* Mobile: readable, horizontally-scrollable table for Currents/Voltages */
/* Mobile: improve ONLY telemetry tables (keep charts as-is) */
@media (max-width: 768px) {

    /* 1) The table wrapper scrolls horizontally */
    .telemetry-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        /* nicer iOS/Android swiping */
        touch-action: pan-x;
        /* helps prevent vertical-grab conflicts */
    }

    /* 2) Let the table be wider than the viewport so it can scroll */
    .telemetry-table {
        width: auto;
        max-width: none;
        table-layout: auto;
        min-width: 720px;
        /* tweak to taste */
    }

    /* 3) Readable minimums for columns */
    .telemetry-table th:first-child,
    .telemetry-table td:first-child {
        min-width: 180px;
    }

    /* label column */

    .telemetry-table th:not(:first-child),
    .telemetry-table td:not(:first-child) {
        min-width: 96px;
    }

    /* numeric cols */

    /* 4) For tables that effectively have a single column, still allow swipe */
    .telemetry-table:has(thead th:first-child:last-child) {
        /* single header cell */
        min-width: 560px;
        /* force some scroll room */
    }

    /* 5) Optional: keep first column visible while swiping */
    .telemetry-table thead th:first-child,
    .telemetry-table tbody td:first-child {
        position: sticky;
        left: 0;
        z-index: 3;
        background: linear-gradient(180deg, #0f1714, #0a1411);
        box-shadow: 1px 0 0 rgba(0, 255, 136, .2);
    }

    /* 6) Keep charts unchanged on mobile (explicit reset in case of old rules) */
    .telemetry-chart-wrap {
        overflow-x: visible;
    }

    .telemetry-chart-wrap canvas {
        width: 100%;
        max-width: 100%;
        height: auto;
    }
}
