:root {
    --header-h: 60px;
    --filters-h: 50px;
    --filters-extra: 70px;
    --telemetry-viewport: calc(100dvh - var(--header-h) - var(--filters-h) - var(--filters-extra));
    --bg: #050505;
    --panel-1: #101010;
    --panel-2: #161616;
    --panel-3: #1c1c1c;
    --panel-row-alt: #151515;
    --text: #f4f4f4;
    --muted: #a8b0bd;
    --muter: #7f8796;
    --line: rgba(255, 255, 255, .10);
    --accent: #44ff66;
    --accent-rgb: 68, 255, 102;
    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 12px;
    --gap-1: 12px;
    --gap-2: 16px;
    --gap-3: 20px;
    --gap-4: 24px;
    --gap-5: 32px;
    --card-b: 1px solid var(--line);
    --neon-05: rgba(255, 255, 255, .05);
    --neon-10: rgba(255, 255, 255, .08);
    --neon-14: rgba(255, 255, 255, .10);
    --neon-20: rgba(255, 255, 255, .10);
    --neon-30: rgba(255, 255, 255, .18);
    --neon-35: rgba(255, 255, 255, .20);
    --neon-40: rgba(255, 255, 255, .24);
    --neon-55: var(--accent);
    --warn: rgba(255, 255, 255, .18);
    --info: rgba(255, 255, 255, .18);
    --danger: #ff4d4f;
    --r-xs: var(--radius-xs);
    --r-sm: var(--radius-sm);
    --r-md: var(--radius-md);
    --r-lg: var(--radius-lg);
    --r-xl: var(--radius-lg);
}

@supports (height: 100svh) {
    :root {
        --telemetry-viewport: calc(100svh - var(--header-h) - var(--filters-h) - var(--filters-extra));
    }
}

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

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
}

button,
input,
select,
textarea {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

.top-bar {

    background: var(--panel-2);
    color: var(--text);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    z-index: 1100;
    position: sticky;
    top: 0;
    min-height: var(--header-h);
    /* must be higher than sticky-filter-bar */

}

.top-bar>div:first-child {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar .top-bar-cta {
    color: #050505;
    font-weight: 600;
}

.top-bar .top-bar-cta:hover {
    text-decoration: none;
}




.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);
    min-height: 40px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--muted);
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.button--primary,
.stop-form-actions .primary,
.stop-toolbar-actions .primary,
.quick-range-buttons button.active {
    background: var(--accent);
    color: #050505;
    border-color: var(--accent);
}

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

.button--danger,
.stop-form-actions .danger {
    background: transparent;
    color: var(--muted);
    border-color: var(--line);
}



.button:hover:not(.button--primary):not(.button--ghost),
.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 {
    background: rgba(255, 255, 255, .04);
    /* border-color: var(--line); */
}

.button--danger:hover,
.stop-form-actions .danger:hover {
    background: rgba(255, 255, 255, .04);
}

.button--ghost.is-danger:hover,
.button--ghost.is-danger:focus-visible {
    background: color-mix(in srgb, var(--danger, #f44336) 18%, transparent);
    /* border-color: var(--danger, #f44336); */
    color: var(--danger, #f44336);
    outline: none;
}

/* Button system inside modals (wins over legacy rules) */
/* Primary hover/focus (global + inside modals) */
.button.button--primary:hover,
.button.button--primary:focus-visible,
.modal-content .button.button--primary:hover,
.modal-content .button.button--primary:focus-visible {
    background: color-mix(in srgb, var(--accent) 80%, black 80%);
    border-color: var(--accent);
    color: #050505;
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .24);
}

/* Ghost hover/focus */
.button.button--ghost:hover,
.button.button--ghost:focus-visible,
.modal-content .button.button--ghost:hover,
.modal-content .button.button--ghost:focus-visible {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
    box-shadow: none;
}

/* Ghost + Danger (global) */
.button.button--ghost.is-danger:hover,
.button.button--ghost.is-danger:focus-visible {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    border-color: var(--danger);
    color: var(--danger);
    outline: none;
    box-shadow: none;
}

/* Ghost + Danger (inside modals — beats the modal ghost hover) */
.modal-content .button.button--ghost.is-danger:hover,
.modal-content .button.button--ghost.is-danger:focus-visible {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    border-color: var(--danger);
    color: var(--danger);
    outline: none;
    box-shadow: none;
}



/* nice hovers */


.modal-content .button.button--ghost:hover,
.modal-content .button.button--ghost:focus-visible {
    background: rgba(255, 255, 255, .04);
    outline: none;
}


.card {
    background: var(--panel-2);
    border: var(--card-b);
    border-radius: var(--r-lg);
}

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

.table thead,
#stop-hours-table thead,
.telemetry-table thead,
.power-table thead,
.status-table thead {
    position: sticky;
    top: 0;
    background: var(--panel-2);
    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 var(--line);
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

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

.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: var(--panel-row-alt);
}

.status-chart-wrapper {
    margin: 24px 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--panel-2);
}

.status-chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-3);
    margin: 0 0 14px;
}

.status-chart-controls__toggles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-2);
}

.status-chart-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: var(--muted);
}

.status-chart-toggle input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: var(--muted);
}

.status-chart-color {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: .85rem;
    color: var(--muted);
}

.status-chart-color select {
    background: var(--panel-1);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: var(--r-md);
    padding: 8px 12px;
    min-width: 160px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.status-chart-color select:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .28);
}

.status-chart-color select:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.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(--line); */
    border-radius: var(--r-lg);
    box-shadow: none;
}

.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;
    box-sizing: border-box;
    margin: 0 auto;
    overflow: auto;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: none;
    padding: 24px;
    position: relative;
}



/* Optional: stronger hover for close in modals only */
.modal-content .modal-close:hover,
.modal-content .modal-close:focus-visible {
    background: rgba(255, 255, 255, .04);
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
}

.modal-content .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 0;
}




.icon-button {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--muted);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;

}

.icon-button:hover,
.icon-button:focus-visible {
    background: rgba(255, 255, 255, .04);
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
}

.modal-subtitle {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: .95rem;
}

.public-share-container {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 16px;
    margin-bottom: 24px;
}

.public-share-warning {
    margin: 0 0 12px;
    color: var(--highlight, #f4d35e);
    font-size: .9rem;
    font-weight: 600;
}

.public-share-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.public-share-input {
    flex: 1 1 280px;
    min-width: 220px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-family: inherit;
    font-size: .9rem;
}

.public-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .01));
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
    position: relative;
}

.public-share-btn:hover,
.public-share-btn:focus-visible {
    background: rgba(var(--accent-rgb), .18);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    outline: none;
}

.public-share-btn:active {
    transform: translateY(0);
}

.public-share-btn--rotate {
    border-color: rgba(255, 77, 79, .4);
    color: #ff8687;
}

.public-share-btn--rotate:hover,
.public-share-btn--rotate:focus-visible {
    background: rgba(255, 77, 79, .15);
    border-color: var(--danger);
    color: #ffb3b4;
}

#publicShareCopy::before,
#publicShareRotate::before {
    font-size: .95rem;
    line-height: 1;
}

#publicShareCopy::before {
    content: "⧉";
}

#publicShareRotate::before {
    content: "↻";
}

.public-share-feedback {
    margin-top: 10px;
    font-size: .85rem;
    color: var(--muted);
    min-height: 18px;
}

.modal-table-wrapper {
    max-height: min(60vh, 480px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.modal-status-table {
    width: 100%;
    border-collapse: collapse;
}

.modal-status-table th,
.modal-status-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.modal-status-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel-1);
    color: var(--muted);
    text-align: left;
}

.modal-status-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, .02);
}

.modal-status-table tbody tr:hover {
    background: rgba(255, 255, 255, .05);
}

.modal-status-table .status-cell {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
}

.modal-status-table .status-cell .status-text {
    color: var(--text);
}

.modal-status-table .status-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.modal-status-table .status-meta {
    font-size: .8rem;
    color: var(--muter);
    font-weight: 500;
}

.modal-status-table .empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--muted);
}

.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(--muted); */
    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: 0px;
    width: 10px;
}

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

*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .2);
    border-radius: 8px;
    border: 2px solid var(--bg);
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .3);
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--panel-2);
    border-bottom: 1px solid var(--line);
}

/* .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(24px, 2vw + 18px, 28px);
    font-weight: 600;
    color: var(--text);
    margin: 0 0 16px;
}

h2.section-title {
    font-size: clamp(18px, 1.6vw + 14px, 20px);
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px;
}

h3 {
    font-size: clamp(16px, 1.2vw + 12px, 18px);
    font-weight: 600;
    color: var(--text);
}

:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .28);
}

.subtitle {
    color: var(--muted);
    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: var(--panel-2);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 20px;
    width: 200px;
}

.summary-card h3 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 1em;
}

.summary-card p {
    font-size: 1.8em;
    margin: 0;
    color: var(--text);
    font-weight: 600;
}

.dropdown-menu {
    background-color: var(--panel-2);
    border: 1px solid var(--line);
    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(--accent);
    padding: 10px 20px;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: rgba(var(--accent-rgb), .08);
}

.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(--muted);
    font-size: 0.9em;
    margin-bottom: 5px;
    font-weight: 500;
}

.date-filter input {
    padding: 10px 14px;
    font-size: 1em;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background-color: var(--panel-1);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    transition: border 0.3s;
}

.date-filter input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .28);
}

.date-filter button {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: var(--r-md);
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #050505;
    font-weight: 600;
    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: rgba(var(--accent-rgb), .85);
}

@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: var(--panel-2);
    padding: 20px;
    border-radius: var(--r-lg);
    text-align: center;
    width: 150px;
    border: 1px solid var(--line);
}

.progress-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(var(--muted) calc(var(--percent) * 1%), var(--panel-1) 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: row;
        align-items: center;
    }
}




.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-1);
}

.form-grid label {
    grid-column: span 2;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--muted);
}

.form-grid input,
.form-grid select {
    grid-column: span 2;
    padding: 10px 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--panel-3);
    color: var(--text);
}

.form-grid input:focus,
.form-grid select:focus {
    outline: 0;
    border: 1px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .28);
}



.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: var(--muted);
    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: none;
    max-width: 400px;
    width: 100%;
    color: var(--text);
}

.form-title {
    text-align: center;

    margin-bottom: 20px;
    font-weight: bold;
    font-size: 1.8em;
}

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

.auth-form .form-control:focus {
    outline: none;
    box-shadow: none;
    border-color: var(--muted);
}

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

.login-btn:hover {
    background: color-mix(in srgb, var(--accent) 80%, black 80%);
    border-color: var(--accent);
    color: #050505;
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .24);
}

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

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

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

.hidden {
    display: none;
}

.error-message {
    color: var(--muted);
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
}

.alert-info {
    background-color: #2a2a2a;
    color: var(--muted);
    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: var(--text);
    padding: 24px;
    border-radius: var(--r-lg);
    border: 1px solid var(--neon-35);
    box-shadow: none;
}

.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: var(--panel-2);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 14px 18px;
    min-width: 150px;
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stop-summary-card:hover {
    border-color: var(--neon-55);
    box-shadow: none;
}

.stop-summary-label {
    font-size: 0.85rem;
    color: var(--muted);
    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: var(--muted);
}

.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(--muted);
}

.stop-toolbar-left input,
.stop-toolbar-left select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--panel-1);
    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(var(--accent-rgb), 0.8);
}

.stop-dyno-filter select {
    padding: 6px 10px;
    border-radius: var(--r-sm);
    border: 1px solid rgba(var(--accent-rgb), 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(12, 12, 12, 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(var(--accent-rgb), 0.25);
    border-top-color: rgba(var(--accent-rgb), 0.9);
    animation: stop-spinner-rotate 0.75s linear infinite;
    box-shadow: none;
}

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

.stop-column {
    background: var(--panel-2);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 18px;
    box-shadow: none;
}

.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: var(--panel-2);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 20px 22px 24px;
    box-shadow: none;
}


.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: var(--r-md);
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.stop-chart-expand:hover,
.stop-chart-expand:focus-visible {
    outline: 0;
    color: #050505;
    border-color: var(--accent);
    background: var(--accent);
}

.stop-chart-expand.stop-chart-expand--active {
    color: #050505;
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .85);
}

.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: var(--text);
}

.stop-chart-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
}

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

.stop-chart-toggle__btn {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.stop-chart-toggle__btn:hover,
.stop-chart-toggle__btn:focus-visible {
    outline: 0;
    border-color: var(--accent);
    color: #050505;
    background: var(--accent);
}

.stop-chart-toggle__btn.is-active {
    background: rgba(var(--accent-rgb), .85);
    border-color: var(--accent);
    color: #050505;
}

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

.stop-chart-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    margin-top: 0;
    max-height: none;
    background: var(--panel-1);
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
}

.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(12, 12, 12, 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: var(--panel-2);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 18px 20px 22px;
    box-shadow: none;
    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(var(--accent-rgb), 0.7);
    letter-spacing: 0.03em;
}

.stop-hours-table-wrapper {
    overflow-x: auto;
    scrollbar-color: rgba(var(--accent-rgb), 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(var(--accent-rgb), 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: 0;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .28);
}

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

.stop-hours-sort.is-active .stop-hours-sort__icon {
    opacity: 1;
    color: var(--text);
}

.stop-hours-table td.stop-hours-table__cell--total,
.stop-hours-table tfoot td {
    font-weight: 600;
    color: var(--text);
}

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

.stop-hours-table tfoot td,
.stop-hours-table tfoot th {
    padding: 10px 12px;
    text-align: right;
    border-top: 1px solid var(--line);
}

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

.stop-hours-table__empty td {
    text-align: center;
    padding: 14px 12px;
    font-style: italic;
    color: var(--muted);
}

.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(255, 255, 255, .24));
}

.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(--muted);
}

.stop-pending-highlight {
    border-color: var(--line);
    background: rgba(255, 255, 255, .04);
}

.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(--line);
    background: var(--panel-2);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
    position: relative;
}

.stop-event-card--pending {
    border-left: 3px solid var(--line);
}

.stop-event-card--recorded {
    border-left: 3px solid var(--line);
}

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

    .stop-event-card--recorded {
        border-left-color: var(--muted);
    }
}

.stop-event-card.active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .08);
}

.stop-event-card--pending.active {
    border-left-color: var(--accent);
}

.stop-event-card--recorded.active {
    border-left-color: var(--accent);
}

.stop-event-card:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, .04);
}


.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: var(--muted);
    font-weight: 500;
}

.stop-event-card .stop-event-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stop-event-meta--secondary {
    font-size: 0.74rem;
    color: var(--muted);
    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 var(--line);
    color: var(--muted);
}

.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: var(--muted);
    border-color: var(--line);
    background: rgba(255, 255, 255, .06);
    box-shadow: none;
}

.stop-event-status--recorded {
    color: var(--muted);
    border-color: var(--line);
    background: rgba(255, 255, 255, .06);
    box-shadow: none;
}

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

.stop-filter-btn {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.stop-filter-btn:hover {
    border-color: var(--line);
    color: var(--text);
    background: rgba(255, 255, 255, .04);
}

.stop-filter-btn:focus-visible {
    outline: 0;
    border-color: var(--accent);
    color: #050505;
    background: var(--accent);
}

.stop-filter-btn.is-active {
    background: rgba(var(--accent-rgb), .08);
    border-color: var(--accent);
    color: var(--text);
}

.stop-badge.long {
    border-color: var(--muted);
    color: var(--muted);
}

.stop-form-card {
    margin-bottom: var(--gap-4);
    background: var(--panel-2);
    border-radius: var(--r-lg);
    padding: 20px;
    border: var(--card-b);
    box-shadow: none;
}

.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(var(--accent-rgb), 0.45);
    color: var(--muted);
}

.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: var(--panel-1);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    font-size: 0.95rem;
}

.stop-form-row select,
.stop-form-row textarea {
    background: var(--panel-1);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    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(var(--accent-rgb), 0.35);
    border-radius: 999px;
    padding: 6px 14px;
    background: var(--panel-1);
    color: var(--muted);
    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(var(--accent-rgb), 0.65);
}

.stop-tag.active {
    background: rgba(var(--accent-rgb), 0.2);
    border-color: rgba(var(--accent-rgb), 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: none;
}

.stop-type-token__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--token-dot, var(--neon));
    box-shadow: none;
}

.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: none;
}

.stop-type-token:focus-visible .stop-type-token__badge {
    outline: 2px solid rgba(var(--accent-rgb), 0.45);
    outline-offset: 2px;
}

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

.stop-type-toggle button {
    border-radius: 999px;
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    background: transparent;
    color: var(--muted);
    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(var(--accent-rgb), 0.2);
    border-color: rgba(var(--accent-rgb), 0.65);
    color: #ffffff;
}

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

.stop-form-actions .ghost {
    border-color: rgba(var(--accent-rgb), 0.35);
}

.stop-form-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    color: var(--muted);
    font-size: 0.9rem;
}

.stop-recorded-card {
    background: var(--panel-2);
    border: var(--card-b);
    border-radius: var(--r-lg);
    padding: 18px;
    box-shadow: none;
}

.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: var(--muted);
}

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

.stop-empty {
    font-size: 0.9rem;
    color: var(--muted);
    border: 1px dashed rgba(var(--accent-rgb), 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: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 18px;
}

.stop-config-section {
    grid-column: 1 / -1;
    background: var(--panel-2);
    border-radius: 14px;
    padding: 18px;
    /* border: 1px solid rgba(var(--accent-rgb), 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(var(--muted), 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;
    font-weight: 600;
    color: rgba(var(--muted), 0.8);
}

.stop-config-grid input[type="number"] {

    background: var(--panel-3);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 10px 12px;
    color: var(--text);
}

.stop-config-grid input[type="number"]:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.75);
    box-shadow: none;
}

.stop-catalog-section {
    background: var(--panel-2);
    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%;

    /* border: 1px solid rgba(var(--accent-rgb), 0.35); */

    height: 36px;
    /* exact height to match button */
    padding: 0 14px;
    /* vertical height comes from 'height' */

    color: var(--text);

    background: var(--panel-3);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 10px 12px;
    color: var(--text);
}

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

.stop-catalog-controls .primary {
    flex: 0 0 auto;
    height: 36px;
    /* match input */
    padding: 0 14px;
    /* horizontal padding only */
    border-radius: 10px;

    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 0px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 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, #0f0f0f);
    box-shadow: none;
    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(var(--accent-rgb), 0.25);
    background: transparent;
    box-shadow: none;
    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(var(--accent-rgb), 0.5);
    box-shadow: none;
}

.stop-status-indicator.is-inactive {
    opacity: 0.35;
    border-color: rgba(var(--accent-rgb), 0.12);
    background: transparent;
    box-shadow: none;
}

.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: var(--text);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.stop-color-trigger:hover,
.stop-color-trigger:focus {
    border-color: rgba(var(--accent-rgb), 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: none;
}

.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, 100%);
    max-width: 90vw;
    padding: 30px 28px 26px;
}

.stop-dialog--event .stop-dialog-content--event {
    width: min(640px, 100%);
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 34px 32px 28px;
    background: rgba(18, 18, 18, 0.97);
    border: 1px solid rgba(var(--accent-rgb), 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: var(--text);
    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: var(--muted);
}

.stop-dialog-form input,
.stop-dialog-form textarea {
    background: rgba(16, 16, 16, 0.94);
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text);
}

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

.stop-dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    line-height: 1;
}

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

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

.stop-dialog-actions .danger {
    min-width: 120px;
}

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

.stop-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.stop-catalog-list small {
    font-size: 0.75rem;
    color: var(--muted);
}

.stop-table-action {
    height: 32px;
    padding: 0 5px;
    font-size: 0.85rem;
    /* border: 1px solid rgba(var(--accent-rgb), .35); */
    /* softer outline */
    background: transparent;
    /* no fill */
    color: var(--muted);
    /* 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(var(--accent-rgb), .08);
    /* subtle wash */
    border-color: rgba(var(--accent-rgb), .55);
    transform: translateY(-1px);
}

.stop-table-action:focus-visible {
    outline: none;
    border-color: rgba(var(--accent-rgb), .7);
    box-shadow: none;
    /* 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(var(--accent-rgb), .08);
    color: var(--text);
    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: none;
}

/* 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: none;
}

/* 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;
    }

    .stop-events-layout {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .stop-column {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 16px;
        box-sizing: border-box;
    }

    .stop-column--list,
    .stop-column--insights {
        min-height: auto;
    }

    .stop-column-controls {
        width: 100%;
    }

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

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

.login-modal-title {
    color: var(--muted);
    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(--muted);
    color: #0f0f0f;
    border-color: var(--muted);
}

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




.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: var(--panel-2);
    border: 1px solid var(--neon-20);
    border-radius: var(--r-lg);
    box-shadow: none;
}

.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: none;
    outline: none;
}

.modal .outlined-button {
    margin-top: var(--gap-2);
    background: transparent;
    border: 2px solid var(--neon);
    color: var(--muted);
    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);
}

/* Only style bare buttons; leave our .button system alone */
.modal-content button:not(.button):not(.public-share-btn):not(.icon-button) {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--muted);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.modal-content button:not(.button):not(.public-share-btn):not(.icon-button) {
    /* background-color: var(--muted); */
    box-shadow: none;
    transform: translateY(-1px);
}

.sticky-filter-bar {
    top: 10px;
    position: sticky;
    /* on the buttom part of the screen */
    /* top: var(--header-h); */
    z-index: 1000;
    /* background-color: #0f0f0f; */
    padding: 10px 0;
    /* width: 100%; */
    /* box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.2); */
    pointer-events: none;
    /* 👈 prevents it from blocking clicks */
    min-height: var(--filters-h);
}

@media (max-width: 980px) {
    .sticky-filter-bar {
        top: 76px;
    }
}



.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(--muted);
}

.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: #11111122;
}

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

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



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

/* under-name minutes line */
#dyno-table-last-ping td.name {
    align-items: flex-start;
}

#dyno-table-last-ping .label-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

#dyno-table-last-ping .label-wrap .sub {
    font-size: 11px;
    color: var(--muter, #7f8796);
    margin-top: 2px;
}


/* header bar */
.summary-card.status-card h3 {
    margin: 0;
    font-size: 1.05rem;
}

.summary-card.status-card .summary-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 18px;
    border-bottom: 1px solid var(--neon-20);
}

.summary-card-expand {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--r-sm);
    transition: color .15s ease, background .15s ease;
}

.summary-card-expand:hover,
.summary-card-expand:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, .06);
}

.summary-card-expand .fa {
    font-size: .9rem;
}

/* 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: var(--header-h);
        height: calc(100% - var(--header-h));
        z-index: 1200;
        transform: translateX(-220px);
        /* off-canvas by default */
    }

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

/* Neon tokens (already in your theme, kept for clarity) */
:root {
    --neon: #44ff66;
    --edge: rgba(68, 255, 102, .30);
    --text: #f4f4f4;
}

/* Hamburger button */
.hamburger {
    inline-size: 40px;
    block-size: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--edge);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.hamburger:hover,
.hamburger:focus-visible {
    border-color: var(--neon);
    box-shadow: 0 0 0 2px rgba(68, 255, 102, .10);
    outline: none;
}

/* 3 bars */
.hamburger .bar {
    position: relative;
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .18s ease, opacity .18s ease, background .18s ease;
}

.hamburger .bar+.bar {
    margin-top: 5px;
}

/* Active state → turn into “X” */
.hamburger[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
}

.hamburger[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Optional: keep bars neon when active */
.hamburger[aria-expanded="true"] .bar {
    background: var(--neon);
}

/* Sidebar open/closed (if you don’t have these already) */
.sidebar {
    /* desktop stays visible; mobile can slide */
    transition: transform .22s ease;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}






/* 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; */
    min-height: 0;
}

.sidebar {
    width: 220px;
    background: #0b0b0b;
    color: var(--text);
    display: flex;
    flex-direction: column;
    padding-top: var(--header-h);
    /* below sticky‑header */
    box-shadow: none;
}

@media (min-width: 769px) {
    .sidebar {
        position: sticky;
        top: var(--header-h);
        height: calc(100vh - var(--header-h));
        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;
    border-left: 2px solid transparent;
}

.sidebar li:hover {
    background: rgba(255, 255, 255, .04);
}

.sidebar li.active {
    background: rgba(255, 255, 255, .08);
    color: var(--text);
    border-left: 2px solid var(--accent);
}

/* push main content down so sticky bars never cover it */
.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 64px;
    min-height: 0;
}

.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: stretch;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Base chart column sizing (replaces the inline styles) */
.telemetry-chart-wrap {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    position: relative;
    min-width: 300px;
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    gap: 12px;
    padding: 0 18px;
}

.telemetry-row .telemetry-table-wrap {
    margin: 0;
}

.telemetry-section {
    height: calc(100dvh - var(--header-h) - var(--filters-h) - var(--filters-extra));
    display: flex;
    flex-direction: column;
    gap: var(--gap-2);
    min-height: 0;
}

.telemetry-section .telemetry-header {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--gap-2);
    padding-top: var(--gap-2);
}

.telemetry-section .telemetry-row {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

.telemetry-section .telemetry-table-wrap {
    margin: 0;
    max-height: 100%;
    height: fit-content;
}

.telemetry-stat-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.telemetry-stat-card {
    flex: 1 1 150px;
    max-width: 220px;
    min-width: 130px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--neon-20);
    background: linear-gradient(180deg, var(--panel-bg-1), var(--panel-bg-2));
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.telemetry-stat-card--state {
    align-items: flex-start;
    justify-content: space-between;
}

.telemetry-stat-card__title {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.telemetry-stat-card__value {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    font-weight: 600;
    color: var(--text);
    min-height: 34px;
}

.telemetry-stat-card__number {
    font-size: 1.6rem;
    line-height: 1;
    letter-spacing: 0.02em;
}

.telemetry-stat-card__unit {
    font-size: 0.8rem;
    color: var(--muted);
}

.telemetry-stat-card__unit--mini {
    margin-left: 4px;
    font-size: 0.72rem;
}

.telemetry-stat-card__minmax {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.telemetry-stat-card__mini {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.telemetry-stat-card__label {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.telemetry-stat-card__mini strong {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 600;
}

.telemetry-stat-card__std {
    border-top: 1px solid var(--line);
    padding-top: 5px;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    gap: 8px;
}

.telemetry-stat-card__std strong {
    color: var(--text);
    font-weight: 600;
}

.telemetry-stat-card__state {
    font-size: 0.95rem;
    color: var(--muted);
    min-height: 48px;
    display: flex;
    align-items: center;
}

.telemetry-row.expanded .telemetry-stat-cards {
    flex-direction: row;
}

.telemetry-table-wrap--selector {
    flex: 0 0 260px;
    max-width: 260px;
    min-width: 220px;
}

.telemetry-row.expanded .telemetry-table-wrap--selector {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
}

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

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

.telemetry-selected-name--energy {
    margin-left: 0;
}

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

.telemetry-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-2);
    flex-wrap: wrap;
}

.telemetry-toolbar__name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    min-height: 38px;
    position: relative;
}

.telemetry-toolbar__total {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin-left: clamp(1rem, 3vw, 2.75rem);
}

.telemetry-selected-name--energy-total {
    align-items: baseline;
    gap: 10px;
}

.telemetry-selected-name--energy-total .telemetry-selected-name__label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.telemetry-selected-name--energy-total .telemetry-selected-name__value {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.telemetry-selected-name--energy-total .telemetry-selected-name__unit {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.telemetry-toolbar__label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.telemetry-toolbar__label::after {

    margin-left: 4px;
}

.telemetry-toolbar__controls {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

.telemetry-toolbar__controls label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.telemetry-highres-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-right: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    user-select: none;
    cursor: pointer;
}

.telemetry-highres-toggle__label {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}

.telemetry-highres-toggle.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.telemetry-switch {
    position: relative;
    width: 46px;
    height: 26px;
    display: inline-flex;
    align-items: center;
}

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

.telemetry-switch__track {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.2s ease;
}

.telemetry-switch__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}

.telemetry-switch input:checked + .telemetry-switch__track {
    background: var(--accent, #44ff66);
}

.telemetry-switch input:checked + .telemetry-switch__track .telemetry-switch__thumb {
    transform: translateX(20px);
}

.telemetry-switch input:focus-visible + .telemetry-switch__track {
    box-shadow: 0 0 0 3px rgba(68, 255, 102, 0.35);
}

.telemetry-switch input:disabled + .telemetry-switch__track {
    opacity: 0.45;
}

.telemetry-controls {
    position: relative;
}

.telemetry-controls__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--panel-2);
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.telemetry-controls__trigger:hover {
    border-color: rgba(var(--accent-rgb), 0.7);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.telemetry-controls__trigger span {
    font-size: 0.85rem;
    color: var(--muted);
}

.telemetry-controls__panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    background: rgba(8, 8, 10, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
    padding: 14px 18px;
    z-index: 50;
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
}

.telemetry-controls[data-open="true"] .telemetry-controls__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.telemetry-controls__panel label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 0.92rem;
}

.telemetry-controls__panel label:last-child {
    margin-bottom: 0;
}

.telemetry-controls__panel .telemetry-controls__action {
    width: 100%;
    margin-top: 8px;
    border: 1px solid rgba(var(--accent-rgb), 0.6);
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.telemetry-controls__panel .telemetry-controls__action:hover {
    background: rgba(var(--accent-rgb), 0.3);
    border-color: rgba(var(--accent-rgb), 0.85);
    transform: translateY(-1px);
}

.telemetry-controls__panel .telemetry-controls__action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

#tariff-modal #tariff-save {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: auto;
    align-self: flex-start;
    border: 1px solid rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.22);
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

#tariff-modal #tariff-save:hover {
    background: rgba(var(--accent-rgb), 0.35);
    border-color: rgba(var(--accent-rgb), 0.9);
    transform: translateY(-1px);
}

#costs-panel #tariff-edit.tariff-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(var(--accent-rgb), 0.6);
    background: rgba(var(--accent-rgb), 0.18);
    color: var(--text);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 14px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

#costs-panel #tariff-edit.tariff-edit-btn:hover {
    background: rgba(var(--accent-rgb), 0.32);
    border-color: rgba(var(--accent-rgb), 0.85);
    transform: translateY(-1px);
}

#costs-panel #tariff-edit .tariff-edit__icon {
    font-size: 1rem;
    line-height: 1;
}

.telemetry-toolbar__actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 38px;
    margin-left: clamp(0.75rem, 2.5vw, 2.25rem);
}

.telemetry-toolbar__actions .expand-btn {
    margin-left: 0;
}

.telemetry-dyno-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(18, 18, 24, 0.9);
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.telemetry-dyno-trigger:hover {
    border-color: rgba(var(--accent-rgb), 0.8);
    color: #fff;
}

.telemetry-dyno-trigger.is-disabled,
.telemetry-dyno-trigger[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.telemetry-dyno-trigger__label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.telemetry-dyno-trigger__caret {
    font-size: 0.85rem;
    color: var(--muted);
    transition: transform .2s ease;
}

.telemetry-dyno-trigger[aria-expanded="true"] .telemetry-dyno-trigger__caret {
    transform: rotate(180deg);
}

.telemetry-dyno-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 230px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--panel-2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
    padding: 6px 0;
    z-index: 40;
}

.telemetry-dyno-option {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.95rem;
    padding: 8px 16px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.telemetry-dyno-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.telemetry-dyno-option__indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.25);
}

.telemetry-dyno-option.selected {
    background: rgba(var(--accent-rgb), 0.12);
    color: #fff;
}

.telemetry-dyno-option.selected .telemetry-dyno-option__indicator {
    background: rgba(var(--accent-rgb), 0.95);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.65);
}

.telemetry-dyno-option--empty {
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--muted);
}

.telemetry-chart-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: .95rem;
}

.telemetry-chart-controls label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.telemetry-chart-controls--energy {
    flex-direction: row-reverse;
}

.telemetry-table-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .telemetry-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .telemetry-toolbar__name {
        margin-right: 0;
        justify-content: flex-start;
    }

    .telemetry-toolbar__total {
        margin-left: 0;
        justify-content: flex-start;
    }

    .telemetry-toolbar__controls {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-left: 0;
    }

    .telemetry-highres-toggle {
        width: 100%;
        justify-content: space-between;
        margin-right: 0;
    }

    .telemetry-selected-name--energy {
        margin-left: 0;
    }

    .telemetry-toolbar__actions {
        margin-left: 0;
        justify-content: center;
    }

    .telemetry-chart-controls {
        justify-content: center;
        flex-direction: row;
        gap: 12px;
    }

    .telemetry-chart-controls--energy {
        flex-direction: row;
    }

    .telemetry-table-controls {
        justify-content: center;
    }
}

.telemetry-selected-name[data-overlay="true"]::before {
    color: var(--muted);
}

.telemetry-selected-name[data-overlay="true"] {
    background: rgba(var(--accent-rgb), .16);
    color: var(--text);
}


/* 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__name-cell {
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    padding-left: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.telemetry-row-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.9);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.45);
    opacity: 0;
    transform: scale(0.7);
    transition: opacity .18s ease, transform .18s ease;
}

.telemetry-table tbody tr.selected .telemetry-row-indicator {
    opacity: 1;
    transform: scale(1);
}

.telemetry-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.telemetry-table--selector {
    font-size: 0.95rem;
}

.telemetry-table--selector th,
.telemetry-table--selector td {
    white-space: nowrap;
}

.telemetry-table--selector tbody td {
    font-size: 0.95rem;
    padding-top: 10px;
    padding-bottom: 10px;
}

.telemetry-table__sort-hint th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-align: left;
    padding-top: 4px;
}



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

/* Sticky header on tall tables */
.telemetry-table thead {
    position: sticky;
    top: 0;
    background: var(--panel-2);
    z-index: 8;
}

/* Table wrapper (scroll behavior) */
.telemetry-table-wrap {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: var(--telemetry-viewport);
    min-height: 0;
}

/* 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;
    flex: 1 1 auto;
    gap: var(--gap-1);
}

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

.telemetry-row.expanded .telemetry-table-wrap {
    order: 2;
    width: 100%;
    height: auto;
    max-height: calc(var(--telemetry-viewport) / 2);
    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: none;
    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 */
}

.telemetry-section .telemetry-table-wrap {
    margin: var(--gap-1) 0;
}

/* 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: 8;
    background: var(--panel-2);
    box-shadow: none;
}

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

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

.telemetry-table thead tr:first-child 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 var(--line);
    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-wrap:not(.collapsed) .telemetry-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.telemetry-table-wrap:not(.collapsed) .telemetry-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.telemetry-table-wrap.collapsed .telemetry-table tbody tr:last-child td:first-child,
.telemetry-table-wrap.collapsed .telemetry-table tbody tr:last-child td:last-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* 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 */
/* ===== 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: var(--panel-2);
    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: 1;
    background: var(--panel-2);
}

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

/* Strong selected state (no transform!) */
.telemetry-table tbody tr.selected {
    background: linear-gradient(90deg, rgba(var(--accent-rgb), .28) 0%, rgba(var(--accent-rgb), .12) 45%, transparent 100%);
    box-shadow: none;
    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%, var(--neon) 100%);
    box-shadow: none;
    border-radius: 3px;
}

/* Slightly stronger on hover, but no translate/shift */
.telemetry-table tbody tr.selected:hover {
    background: linear-gradient(90deg, rgba(var(--accent-rgb), .34) 0%, rgba(var(--accent-rgb), .16) 50%, transparent 100%);
    box-shadow: none;
    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: var(--text);
}

.telemetry-table tbody tr.selected td:first-child {
    color: var(--text);
    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 – neon pill */
.expand-btn {
    --glow-base: rgba(var(--accent-rgb), .18);
    --glow-strong: rgba(var(--accent-rgb), .32);
    position: relative;
    isolation: isolate;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .16), rgba(18, 18, 18, .78) 72%);
    color: #fff;
    border: 1px solid rgba(var(--accent-rgb), .35);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 600;
    text-shadow: 0 0 6px rgba(var(--accent-rgb), .28);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .04),
        0 0 14px var(--glow-base),
        0 0 26px rgba(var(--accent-rgb), .18);
    transition: background .2s ease, color .2s ease, transform .2s ease;
    animation: neon-pulse 3s ease-in-out infinite;
}

.expand-btn::after {
    content: "";
    position: absolute;
    inset: -60%;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .28) 0%, transparent 60%);
    opacity: .35;
    filter: blur(16px);
    z-index: -1;
    pointer-events: none;
}

.expand-btn:hover,
.expand-btn:focus {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .24), rgba(24, 24, 24, .7) 74%);
    transform: translateY(-1px);
}

.expand-btn:focus-visible {
    outline: 2px solid rgba(var(--accent-rgb), .55);
    outline-offset: 2px;
}

/* When the row is open, stop the pulsing but keep the glow alive */
.telemetry-row.expanded .expand-btn {
    animation: none;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .04),
        0 0 12px var(--glow-base),
        0 0 22px rgba(var(--accent-rgb), .16);
}

@keyframes neon-pulse {

    0%,
    100% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, .04),
            0 0 12px var(--glow-base),
            0 0 20px rgba(var(--accent-rgb), .14);
    }

    50% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, .06),
            0 0 18px var(--glow-strong),
            0 0 30px rgba(var(--accent-rgb), .22);
    }
}

/* 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(--muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    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(var(--accent-rgb), .10);
    box-shadow: none;
}

/* 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;
    }

    [id$="-expand-btn"] {
        display: none;
    }
}

/* 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 */
    :is(#section-currents, #section-power, #section-frequency, #section-energy) .telemetry-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: hidden;
    }

    :is(#section-currents, #section-power, #section-frequency, #section-energy) .telemetry-row .telemetry-chart-wrap {
        width: 100%;
        min-width: 0;
        position: relative;
    }

    :is(#section-currents, #section-power, #section-frequency, #section-energy) .telemetry-row .telemetry-table-wrap {
        order: 2;
        width: 100%;
        flex: 1 1 calc(var(--telemetry-viewport) / 2);
        max-height: calc(var(--telemetry-viewport) / 2);
        overflow-y: auto;
        overflow-x: auto;
    }

    :is(#section-currents, #section-power, #section-frequency, #section-energy) .telemetry-row.expanded .telemetry-table-wrap {
        max-height: calc(var(--telemetry-viewport) / 2);
    }

    /* 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 */
    :is(#section-currents, #section-power, #section-frequency, #section-energy) .telemetry-row canvas {
        width: 100%;
        height: auto;
    }

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

    :is(#section-currents, #section-power, #section-frequency, #section-energy) .telemetry-table-wrap {
        max-height: calc(var(--telemetry-viewport) / 2);
        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;
        background: var(--panel-2);
        box-shadow: none;
    }

    /* 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;
    }
}

/* 1) Make ghost+danger red even when NOT hovered */
.button.button--ghost.is-danger,
.stop-form-actions .ghost.is-danger,
.stop-toolbar-actions .ghost.is-danger {
    color: var(--danger);
    /* border-color: var(--danger); */
    background: transparent;
    /* keep it clean */
}

/* You already have the hover/focus rules for danger; they’ll keep working */

/* 2) Give the menu button its own explicit styling so it stays green
      without affecting other ghosts */
.menu-button {
    background: transparent;
    color: var(--accent);
    border-color: transparent;
}

.menu-button:hover,
.menu-button:focus-visible {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    /* border-color: var(--accent); */
    color: var(--accent);
    outline: none;
}
