
.loading {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0,0,0,.5);
  }
  
  .loading-wheel {
  
    position: absolute;
    top: 50%;
    left: 50%;
    
    animation: spin 1s infinite linear;
    border: 2px solid rgba(30, 30, 30, 0.5);
    border-left: 4px solid #fff;
    border-radius: 50%;
    height: 50px;
    width: 50px;
    margin-top: -25px;
    margin-left: -25px;
    margin-bottom: 10px;
  
  }
  
  .loading-text {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    margin-top: 35px;
    color: #fff;
    font-family: arial, sans-serif;
    display: flex;
    justify-content: center;
  }
  
  .loading-text:after {
    content: 'Loading';
    animation: load 2s linear infinite;
  }
  
  @keyframes load {
    0% {
      content: 'Loading';
    }
    33% {
      content: 'Loading.';
    }
    67% {
      content: 'Loading..';
    }
    100% {
      content: 'Loading...';
    }
  }
  
  @-webkit-keyframes spin {
    0% {
        -webkit-transform: rotate(0);
    }
    100% {
        -webkit-transform: rotate(360deg);
    }
  }
  
.login-modal-body {
    width: 320px;
    max-width: 100%;
  }
  
  .login-modal-body h2 {
    margin-bottom: 1rem;
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.06em;
    color: var(--font-muted);
    text-transform: uppercase;
  }
  
  .login-modal-body .login-form {
    margin-bottom: 1rem;
  }
  
  .login-modal-body .form-group {
    margin-bottom: 1rem;
  }
  
  .login-modal-body .form-group label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--font-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  
  .login-modal-body .form-control {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    font-family: scifi;
    color: var(--font-primary-color);
    caret-color: var(--font-primary-color);
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    border-radius: 0;
    outline: none;
    transition: border-color 0.15s;
  }

  /* Neutralize Chrome autofill background flash and font override */
  .login-modal-body .form-input:-webkit-autofill,
  .login-modal-body .form-input:-webkit-autofill:hover,
  .login-modal-body .form-input:-webkit-autofill:focus,
  .login-modal-body .form-input:-webkit-autofill:active {
    /* Bury Chrome's yellow/blue autofill background behind our own color */
    -webkit-box-shadow: 0 0 0 1000px #18242B inset !important;
    box-shadow:         0 0 0 1000px #18242B inset !important;
    /* Keep our font color and family */
    -webkit-text-fill-color: var(--font-primary-color) !important;
    font-family: scifi !important;
    font-size: 0.9rem !important;
    /* Delay the autofill transition so the above shadow stays visible */
    transition: background-color 9999s ease-in-out 0s;
    border-bottom: 1px solid rgba(255,255,255,0.2);
  }

  .text-invalid {
    color: red;
  }

  input.invalid {
    outline: 2px solid red !important;
    border-radius: 5px;
  }
  
  .login-modal-body .form-input:focus {
    border-color: var(--font-primary-color);
  }
  
  .login-modal-body .btn-primary {
    background: var(--bg-secondary-color);
    color: var(--font-secondary-color);
    border: 1px solid var(--font-secondary-color);
    border-radius: 5px;
    padding: 7px 28px;
    font-size: 0.875rem;
    font-family: scifi;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
  }
  
  .login-modal-body .btn-primary:hover {
    background: rgba(111,189,204,0.12);
    border-color: var(--font-secondary-color);
  }
  
  .login-modal-body .btn-primary:focus,
  .login-modal-body .btn-primary.focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(111,189,204,0.3);
  }
  
  
  .login-modal-body .btn-danger:focus,
  .login-modal-body .btn-danger.focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5);
  }
  
  .login-modal-body footer {
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
  }

  .login-modal-body footer small {
    margin-bottom: 10px;
    border-bottom: 1px solid red;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
  }
.slitan-modal-background {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: radial-gradient(circle at center, rgba(42, 183, 171, 0.2) 0%, rgba(0, 0, 0, 0.8) 70%);
}

.slitan-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1100;
  width: fit-content;
  max-width: min(500px, 92vw);
  min-width: min(320px, 92vw);
  background: var(--fg-primary-color); /* Keep dark theme */
  border-radius: 5px; 
  overflow: hidden;
  box-shadow: 0 0 20px rgba(42, 183, 171, 0.3); /* Teal glow */
  border: 1px solid var(--font-muted); /* Keep subtle border */
}

.slitan-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px; /* Slightly less than 15px 20px for a tighter feel */
  /*background-color: #333; /* Flat color, no gradient */
  background: linear-gradient(to right, #333, var(--fg-primary-color));
  color: var(--font-primary-color);
  border-bottom: 1px solid var(--font-muted);
}

.slitan-modal-title {
  margin: 0;
  font-size: 1.5rem; /* Match original size */
  text-transform: uppercase; /* Keep for modern feel */
  letter-spacing: 1px; /* Reduced from 2px */
}

.slitan-modal-close {
  border: none;
  background: transparent;
  color: var(--font-primary-color);
  font-size: 1.8rem; /* Slightly smaller than 2rem */
  cursor: pointer;
  transition: color 0.2s ease; /* Simpler transition */
}

.slitan-modal-close:hover {
  color: var(--font-secondary-color); /* Softer hover, no glow */
}

.slitan-modal-body {
  overflow-y: auto !important;
  max-height: 80vh;
  padding: 20px; /* Match original padding, not 25px */
  background: transparent; /* Still relies on inner content */
}

.slitan-modal-background.show {
  pointer-events: auto;
  opacity: 1;
}

.slitan-modal-background.show .slitan-modal {
  display: block;
  /* Removed animation for simplicity */
}
/* dashboard-tab.css — FUI tile grid dashboard */

/* ================================================================ ROOT */
.dashboard-tab-root {
    width: 100%; height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-primary-color);
}

.db-layout {
    display: flex;
    width: 100%; height: 100%;
    overflow: hidden;
}

/* ================================================================ LEFT COLUMN */
.db-left {
    width: 35vw;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(111,189,204,0.1);
    overflow: hidden;
    background: #000;
}

.db-holo-wrap {
    flex: 0 0 55vh;
    position: relative;
    overflow: hidden;
    background: #000;
}

/* ================================================================ MOBILE */
@media (max-width: 768px) {
    .dashboard-tab-root {
        height: auto;
        min-height: 100%;
    }

    .db-layout {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .db-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(111,189,204,0.1);
    }

    .db-holo-wrap {
        flex: 0 0 55vw;
    }

    .db-alerts-panel {
        height: 220px;
        flex: none;
    }

    .db-tiles {
        grid-template-columns: repeat(6, 1fr);
        overflow-y: visible;
    }

    /* Collapse all spans to full width on mobile */
    .db-col-2, .db-col-3, .db-col-4, .db-col-5,
    .db-col-6, .db-col-7, .db-col-8,
    .db-col-9, .db-col-12,
    .db-tile-wide, .db-tile-full {
        grid-column: span 6;
    }

    /* Row 1 badges stay small side by side */
    .db-tile-badge { grid-column: span 3; }

    .db-version-row {
        width: 100%;
    }

    .db-mqtt-cells {
        flex-wrap: wrap;
    }

    .db-mqtt-cell-div {
        display: none;
    }

    .db-mqtt-cell {
        flex: 1 1 40%;
        border-bottom: 1px solid rgba(204,195,111,0.08);
    }
}

.db-hud-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(111,189,204,0.06);
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    pointer-events: none;
}

.db-holo-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 10px;
}

.db-coord-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}

/* ── Holo overlay: bot identity ── */
.db-holo-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.db-holo-kernel {
    font-size: 0.65rem;
    font-family: 'Jura', sans-serif;
    color: rgba(111,189,204,0.5);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.db-bot-id-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.db-bot-name-large {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Jura', sans-serif;
    color: rgba(111,189,204,0.9);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(111,189,204,0.6);
    line-height: 1;
}

.db-bot-daxos {
    font-size: 0.68rem;
    font-family: 'Jura', sans-serif;
    color: rgba(111,189,204,0.45);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.db-bot-daxos span {
    color: rgba(111,189,204,0.8);
    font-weight: 700;
}

.db-coord-row {
    font-size: 0.72rem;
    font-family: 'Jura', sans-serif;
    color: rgba(111,189,204,0.55);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    min-width: 100px;
}
.db-coord-row span { color: rgba(111,189,204,0.9); font-weight: 700; }

.db-alerts-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(111,189,204,0.1);
    overflow: hidden;
}

.db-alerts-panel-hdr {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 5px 10px;
    font-family: 'Jura', sans-serif;
    background: var(--bg-secondary-color);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.db-alerts-panel > .db-list-body {
    padding: 6px 10px;
}

/* ================================================================ TILE GRID */
.db-tiles {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: min-content;
    gap: 1px;
    background: rgba(111,189,204,0.06);
    overflow-y: auto;
    align-content: start;
}

.db-tile {
    background: var(--bg-secondary-color);
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}
.db-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: rgba(111,189,204,0.08);
}

/* Column-span classes for 12-col grid */
.db-col-2  { grid-column: span 2; }
.db-col-3  { grid-column: span 3; }
.db-col-4  { grid-column: span 4; }
.db-col-5  { grid-column: span 5; }
.db-col-6  { grid-column: span 6; }
.db-col-7  { grid-column: span 7; }
.db-col-8  { grid-column: span 8; }
.db-col-9  { grid-column: span 9; }
.db-col-12 { grid-column: span 12; }

/* Legacy aliases used by list/panel helpers */
.db-tile-wide { grid-column: span 6;  }
.db-tile-full { grid-column: span 12; }

.db-section-label,
.db-tile-label {
    font-size: 0.58rem;
    font-family: 'Jura', sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--font-muted);
    flex-shrink: 0;
}

/* Badge tiles */
.db-tile-badge { align-items: center; justify-content: center; gap: 4px; }

.db-badge {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid currentColor;
    font-family: 'Jura', sans-serif;
}
.db-badge-ok     { color: var(--font-secondary-color); border-color: rgba(111,189,204,0.4); background: rgba(111,189,204,0.08); }
.db-badge-danger { color: var(--danger-color);          border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); }
.db-badge-dim    { color: var(--font-muted);             border-color: rgba(255,255,255,0.1); background: transparent; }
.db-badge-err    { color: #f87171;                       border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.08); }

/* Task tile */
.db-tile-task { justify-content: center; }
.db-task-value {
    font-size: 0.82rem; font-weight: 600;
    font-family: 'Jura', sans-serif;
    color: var(--font-primary-color);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Rotary / Compass tiles */
.db-tile-rotary,
.db-tile-compass { align-items: center; justify-content: center; }

.db-rotary-wrap,
.db-compass-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 82px;
    align-self: center;
}

.db-rotary-svg,
.db-compass-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.db-rotary-track {
    fill: none;
    stroke: rgba(255,255,255,0.07);
    stroke-width: 5;
    stroke-linecap: round;
}

.db-rotary-arc {
    fill: none;
    stroke: #6FBDCC;
    stroke-width: 5;
    stroke-linecap: round;
    transform-origin: 40px 40px;
    transform: rotate(-90deg);
    transition: stroke-dasharray 0.3s, stroke 0.3s;
}
.db-rotary-arc-ram  { stroke: #ccc36f; }
.db-rotary-arc-gpu  { stroke: #cc6fbb; }
.db-rotary-arc-disk { stroke: #6fccaa; }

.db-rotary-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.db-rotary-val  { font-size: 0.9rem; font-weight: 700; font-family: 'Jura', sans-serif; color: var(--font-secondary-color); font-variant-numeric: tabular-nums; line-height: 1; }
.db-rotary-unit { font-size: 0.55rem; font-family: 'Jura', sans-serif; color: var(--font-muted); line-height: 1; }

/* Bar tiles */
.db-tile-bar { justify-content: center; }

.db-big-val {
    font-size: 1.15rem; font-weight: 700;
    font-family: 'Jura', sans-serif;
    color: var(--font-secondary-color);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    display: flex; align-items: baseline; gap: 3px;
}
.db-big-unit { font-size: 0.7rem; font-family: 'Jura', sans-serif; color: var(--font-muted); font-weight: 400; }

.db-hbar-wrap {
    height: 5px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: visible;
    position: relative;
}
.db-hbar-fill {
    height: 100%;
    background: var(--font-secondary-color);
    border-radius: 3px;
    transition: width 0.35s;
}
.db-hbar-fill-imu    { background: rgba(111,189,204,0.5); }
.db-hbar-fill-signal { background: var(--font-secondary-color); }
.db-hbar-fill.danger { background: var(--danger-color); }
.db-hbar-fill.warn   { background: var(--font-terciary-color); }

.db-hbar-center-mark {
    position: absolute;
    top: -2px; bottom: -2px; left: 50%;
    width: 1px;
    background: rgba(255,255,255,0.25);
}
.db-hbar-range { font-size: 0.55rem; font-family: 'Jura', sans-serif; color: rgba(255,255,255,0.18); letter-spacing: 0.04em; }

/* Sparkline chart tiles */
.db-tile-chart { padding-bottom: 8px; }
.db-spark-wrap { position: relative; height: 100px; }

/* CPU cores sphere tile */
.db-tile-cpu-sphere {
    min-height: 83px;
}
.db-cpu-sphere-canvas {
    display: block;
    width: 100%;
    height: 68px;
    /* Override the intrinsic aspect-ratio derived from canvas width/height
       attributes — the CSS dimensions must govern layout, not the pixel buffer. */
    aspect-ratio: auto;
}

/* Network tile — interface name shown inline with label */
.db-net-iface {
    font-size: 0.6rem;
    font-family: 'Jura', monospace;
    color: var(--font-secondary-color);
    letter-spacing: 0.08em;
    opacity: 0.75;
    margin-left: 4px;
    text-transform: lowercase;
}

/* List tiles */
.db-tile-list { padding: 0; gap: 0; max-height: 140px; }
.db-tile-list.db-tile-full,
.db-tile-list.db-col-12 { max-height: 200px; }
.db-tile-list .db-tile-label {
    padding: 5px 9px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: var(--bg-secondary-color);
}
.db-list-body { overflow-y: auto; flex: 1; padding: 4px 0; }

.dashboard-proc-item {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.75rem;
    font-family: 'Jura', sans-serif;
}
.dashboard-proc-dot     { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.dashboard-proc-name    { flex: 1; color: var(--font-muted); }
.dashboard-proc-desire  {
    font-variant-numeric: tabular-nums;
    font-size: 0.68rem;
    font-family: 'Jura', sans-serif;
    color: rgba(255,255,255,0.2);
    flex-shrink: 0;
}
.dashboard-proc-arrow   { color: rgba(255,255,255,0.15); font-size: 0.6rem; flex-shrink: 0; }
.dashboard-proc-wdesire {
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem; font-weight: 700;
    font-family: 'Jura', sans-serif;
    color: var(--font-secondary-color);
    flex-shrink: 0;
    min-width: 32px;
    text-align: right;
}
.dashboard-proc-age {
    font-size: 0.6rem;
    font-family: 'Jura', sans-serif;
    color: rgba(255,255,255,0.18);
    flex-shrink: 0;
    margin-left: 2px;
}
.dashboard-proc-item.active .dashboard-proc-name    { color: var(--font-secondary-color); }
.dashboard-proc-item.active .dashboard-proc-desire  { color: rgba(255,255,255,0.35); }
.dashboard-proc-item.active .dashboard-proc-arrow   { color: rgba(111,189,204,0.3); }
.dashboard-proc-item.rejected .dashboard-proc-name    { color: rgba(255,255,255,0.22); }
.dashboard-proc-item.rejected .dashboard-proc-wdesire { color: rgba(255,255,255,0.22); }
.dashboard-proc-divider {
    padding: 4px 9px 2px;
    font-size: 0.56rem;
    font-family: 'Jura', sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.18);
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 2px;
}

.dashboard-no-procs,
.dashboard-no-alerts {
    padding: 8px; text-align: center;
    font-family: 'Jura', sans-serif;
    color: var(--font-muted); font-size: 0.75rem;
}

/* ── Versions tile ── */
.db-tile-versions { gap: 0; padding: 0; }
.db-tile-versions .db-tile-label {
    padding: 5px 9px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: var(--bg-secondary-color);
}
.db-versions-body {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    overflow-y: auto;
    flex: 1;
    padding: 3px 0;
}
.db-version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 8px;
    width: 50%;
    border-bottom: 1px solid rgba(255,255,255,0.025);
    font-family: 'Jura', sans-serif;
    font-size: 0.66rem;
    min-width: 0;
}
.db-version-key {
    color: var(--font-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}
.db-version-val {
    color: var(--font-secondary-color);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.68rem;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}
.db-ver-update-badge {
    color: var(--font-terciary-color);
    font-size: 0.7rem;
    cursor: default;
    margin-left: 2px;
    vertical-align: middle;
    animation: db-ver-warn-pulse 2s ease-in-out infinite;
}
@keyframes db-ver-warn-pulse {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 1;   }
}
.db-ver-rc-badge {
    color: #f87171;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: default;
    margin-left: 3px;
    vertical-align: middle;
    animation: db-ver-rc-pulse 1.2s ease-in-out infinite;
}
@keyframes db-ver-rc-pulse {
    0%, 100% { opacity: 0.65; }
    50%       { opacity: 1;    }
}
.db-ver-ok-badge {
    color: var(--font-secondary-color);
    font-size: 0.65rem;
    cursor: default;
    margin-left: 2px;
    opacity: 0.5;
    vertical-align: middle;
}

/* ── MQTT telemetry conjoined panel ── */
.db-mqtt-panel {
    gap: 0;
    padding: 0;
    background: var(--bg-secondary-color);
    border: 1px solid rgba(204,195,111,0.18);
    border-radius: 8px;
    overflow: hidden;
}

.db-mqtt-panel-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: rgba(204,195,111,0.06);
    border-bottom: 1px solid rgba(204,195,111,0.15);
    flex-shrink: 0;
}

.db-mqtt-panel-note {
    font-size: 0.6rem;
    font-family: 'Jura', sans-serif;
    color: rgba(204,195,111,0.5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.db-mqtt-cells {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.db-mqtt-cell {
    flex: 1 1 80px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    min-width: 70px;
}

.db-mqtt-cell-div {
    width: 1px;
    background: rgba(204,195,111,0.12);
    align-self: stretch;
    flex-shrink: 0;
}

.db-mqtt-cell-val {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Jura', sans-serif;
    color: var(--font-secondary-color);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

.db-mqtt-cell-badge {
    font-size: 0.78rem !important;
    padding: 2px 8px !important;
}

/* ── MQTT command buttons ── */
.db-tile-mqtt-actions { gap: 6px; }

.db-mqtt-btns {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.db-mqtt-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary-color);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    padding: 6px 10px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s;
    font-family: 'Jura', sans-serif;
}
.db-mqtt-btn:hover {
    background: var(--fg-primary-color);
}

.db-mqtt-btn-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.db-mqtt-btn-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1;
}

.db-mqtt-btn-sub {
    font-size: 0.58rem;
    color: var(--font-muted);
    letter-spacing: 0.06em;
    margin-top: 2px;
    font-family: monospace;
}

.db-mqtt-btn-boot {
    border-color: rgba(111,189,204,0.3);
    color: var(--font-secondary-color);
}
.db-mqtt-btn-boot:hover {
    border-color: var(--font-secondary-color);
    background: rgba(111,189,204,0.08);
}

.db-mqtt-btn-shut {
    border-color: rgba(248,113,113,0.3);
    color: #f87171;
}
.db-mqtt-btn-shut:hover {
    border-color: #f87171;
    background: rgba(248,113,113,0.08);
}

.db-btn-disabled,
.db-btn-disabled:hover {
    opacity: 0.28;
    cursor: not-allowed;
    pointer-events: none;
    border-color: rgba(255,255,255,0.08) !important;
    background: var(--bg-primary-color) !important;
    color: var(--font-muted) !important;
}

.dashboard-alert-item {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 3px 9px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.72rem;
    font-family: 'Jura', sans-serif;
}
.dashboard-alert-icon       { flex-shrink: 0; font-size: 0.72rem; }
.dashboard-alert-icon.error { color: var(--danger-color); }
.dashboard-alert-icon.warn  { color: var(--font-terciary-color); }
.dashboard-alert-chip       { color: var(--font-secondary-color); font-size: 0.66rem; }
.dashboard-alert-msg        { color: var(--font-primary-color); flex: 1; }

/* ── Platform EM tile ── */
.db-tile-em { padding: 0; gap: 0; min-height: 60px; max-height: 140px; }
.db-tile-em .db-tile-label {
    padding: 5px 9px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: var(--bg-secondary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.db-em-error-pill {
    font-size: 0.54rem;
    letter-spacing: 0.12em;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s, transform 0.2s;
}

/* Default (error/headline) - red */
.db-tile-em.db-em-has-active .db-em-error-pill {
    border: 1px solid rgba(248,113,113,0.5);
    background: rgba(248,113,113,0.12);
    color: #f87171;
    opacity: 1;
    transform: scale(1);
    animation: db-em-pulse-error 2s ease-in-out infinite;
}

/* Warn severity - yellow */
.db-tile-em.db-em-has-active.db-em-severity-warn .db-em-error-pill {
    border: 1px solid rgba(204,195,111,0.5);
    background: rgba(204,195,111,0.12);
    color: var(--font-terciary-color);
    animation: db-em-pulse-warn 2s ease-in-out infinite;
}

@keyframes db-em-pulse-error {
    0%, 100% { 
        box-shadow: 0 0 0 rgba(248,113,113,0);
        border-color: rgba(248,113,113,0.5);
    }
    50% { 
        box-shadow: 0 0 8px rgba(248,113,113,0.6);
        border-color: rgba(248,113,113,0.9);
    }
}

@keyframes db-em-pulse-warn {
    0%, 100% { 
        box-shadow: 0 0 0 rgba(204,195,111,0);
        border-color: rgba(204,195,111,0.5);
    }
    50% { 
        box-shadow: 0 0 8px rgba(204,195,111,0.6);
        border-color: rgba(204,195,111,0.9);
    }
}

.db-em-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    overflow-y: auto;
    flex: 1;
}

.db-em-nominal {
    font-size: 0.66rem;
    font-family: 'Jura', sans-serif;
    color: var(--font-secondary-color);
    letter-spacing: 0.12em;
    text-align: center;
    padding: 6px 0;
    opacity: 0.7;
}

.db-em-chip-group {
    display: flex;
    flex-direction: column;
}

.db-em-chip-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px 2px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.db-em-chip-label {
    font-size: 0.52rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-family: 'Jura', sans-serif;
    color: var(--font-muted);
    flex-shrink: 0;
    min-width: 38px;
}

.db-em-chip-divider {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.04);
}

.db-em-fault-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 7px 2px 13px;
    border-bottom: 1px solid rgba(255,255,255,0.025);
    transition: background 0.15s;
}
.db-em-fault-row:last-child { border-bottom: none; }

.db-em-fault-row.db-em-active {
    background: rgba(255,255,255,0.025);
}

.db-em-fault-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(255,255,255,0.08);
    transition: background 0.15s, box-shadow 0.15s;
}
/* Inactive — faint tint of the severity color */
.db-em-fault-dot.db-em-lvl-error    { background: rgba(248,113,113,0.28); }
.db-em-fault-dot.db-em-lvl-warn     { background: rgba(204,195,111,0.25); }
.db-em-fault-dot.db-em-lvl-headline { background: rgba(111,189,204,0.22); }
/* Active — full glow */
.db-em-fault-row.db-em-active .db-em-fault-dot.db-em-lvl-error    { background: #f87171; box-shadow: 0 0 5px #f87171; }
.db-em-fault-row.db-em-active .db-em-fault-dot.db-em-lvl-warn     { background: var(--font-terciary-color); box-shadow: 0 0 5px var(--font-terciary-color); }
.db-em-fault-row.db-em-active .db-em-fault-dot.db-em-lvl-headline { background: var(--font-secondary-color); box-shadow: 0 0 5px var(--font-secondary-color); }

.db-em-fault-code {
    font-size: 0.62rem;
    font-family: monospace;
    color: rgba(255,255,255,0.15);
    flex-shrink: 0;
    min-width: 32px;
    letter-spacing: 0.04em;
}

.db-em-fault-msg {
    font-size: 0.72rem;
    font-family: 'Jura', sans-serif;
    color: rgba(255,255,255,0.22);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}
.db-em-fault-row.db-em-active .db-em-fault-msg { color: var(--font-primary-color); }

.db-em-fault-status {
    font-size: 0.6rem;
    font-family: monospace;
    color: rgba(255,255,255,0.15);
    flex-shrink: 0;
    letter-spacing: 0.04em;
    min-width: 20px;
    text-align: right;
}

/* ================================================================
   POWER-ON STATES — only data elements start dim; structural chrome is always visible
   ================================================================ */

/* Hologram viewport dim state (whole pane, since HUD rings are very subtle) */
/* (no dim applied — hologram is always visible) */

/* Inline-tile content elements that start dim until data arrives */
.db-task-value,
.db-versions-body,
.db-list-body,
.db-em-body {
    opacity: 0.06;
    filter: saturate(0) brightness(0.4);
}

/* ── Shared flicker keyframe ─────────────────────────────────────
   Used by sub-partials (applied to their own root or data elements)
   and by inline tile content via db-content--live.
   ────────────────────────────────────────────────────────────── */
@keyframes db-flicker-on {
    0%   { opacity: 0.06; filter: saturate(0) brightness(0.4);  }
    10%  { opacity: 0.9;  filter: saturate(1) brightness(1.6);  }
    18%  { opacity: 0.0;  filter: brightness(0.1);              }
    38%  { opacity: 1;    filter: saturate(1) brightness(1.2);  }
    100% { opacity: 1;    filter: saturate(1) brightness(1);    }
}

/* Applied by DashboardTab._flicker_tile() to inline content areas */
.db-content--live {
    animation: db-flicker-on 0.5s ease-out forwards;
}

/* debug-view.css — base styles shared by all debug views */

.debug-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary-color);
    position: relative;
}

/* ── Common view header ─────────────────────────────────────── */
.debug-view-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary-color);
    border-bottom: 1px solid rgba(111,189,204,0.12);
}
.debug-view-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--font-secondary-color);
    text-transform: uppercase;
}
.debug-view-subtitle {
    font-size: 0.72rem;
    color: var(--font-muted);
    letter-spacing: 0.08em;
}
.debug-view-header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ── Scrollable body ────────────────────────────────────────── */
.debug-view-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Two-column layout for side-by-side panels ──────────────── */
.debug-view-body.split {
    flex-direction: row;
    padding: 0;
}
.debug-view-split-left {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.debug-view-split-right {
    width: 320px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Canvas / map container ─────────────────────────────────── */
.debug-canvas-wrap {
    flex: 1;
    position: relative;
    min-height: 200px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}
.debug-canvas-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

/* ── Chart container ─────────────────────────────────────────── */
.debug-chart-wrap {
    position: relative;
    height: 180px;
}
.debug-chart-wrap.tall {
    height: 260px;
}

/* ── KV info table (key–value pairs) ────────────────────────── */
.debug-kv-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.debug-kv-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.82rem;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.debug-kv-key {
    color: var(--font-muted);
    flex: 0 0 140px;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.debug-kv-val {
    color: var(--font-primary-color);
    font-weight: 600;
    font-size: 0.85rem;
    flex: 1;
    font-variant-numeric: tabular-nums;
}
.debug-kv-val.teal { color: var(--font-secondary-color); }
.debug-kv-val.amber { color: var(--font-terciary-color); }
.debug-kv-val.red { color: var(--danger-color); }
.debug-kv-val.green { color: var(--success-color); }

/* ── Driver widget ───────────────────────────────────────────── */
.debug-driver-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--fg-primary-color);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    flex-shrink: 0;
}
.debug-driver-label {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--font-muted);
}
.debug-driver-toggle {
    margin-left: auto;
}

/* rotary-gauge.css */

.db-rotary-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 82px;
    align-self: center;
}

.db-rotary-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.db-rotary-track {
    fill: none;
    stroke: rgba(255,255,255,0.07);
    stroke-width: 5;
    stroke-linecap: round;
}

.db-rotary-arc {
    fill: none;
    stroke: #6FBDCC;
    stroke-width: 5;
    stroke-linecap: round;
    transform-origin: 40px 40px;
    transform: rotate(-90deg);
    transition: stroke-dasharray 0.3s, stroke 0.3s;
}
.db-rotary-arc-cpu { stroke: #6FBDCC; }
.db-rotary-arc-ram { stroke: #ccc36f; }

/* ── Dim/live state — applied to .db-rotary-wrap root ─────────────────── */
/* Track is always full opacity (not targeted) */
.db-rotary-wrap--dim .db-rotary-arc {
    opacity: 0.05;
    stroke: rgba(255,255,255,0.12);
    stroke-dasharray: 0 188.5;
}
.db-rotary-wrap--dim .db-rotary-center {
    opacity: 0;
}

@keyframes db-rotary-flicker {
    0%   { opacity: 0.05; filter: brightness(0.3) saturate(0);   }
    10%  { opacity: 1;    filter: brightness(1.7) saturate(1.1); }
    20%  { opacity: 0;    filter: brightness(0.1);               }
    42%  { opacity: 1;    filter: brightness(1.15) saturate(1);  }
    100% { opacity: 1;    filter: brightness(1) saturate(1);     }
}

.db-rotary-wrap--live .db-rotary-arc {
    animation: db-rotary-flicker 0.5s ease-out forwards;
}
.db-rotary-wrap--live .db-rotary-center {
    animation: db-rotary-flicker 0.5s ease-out forwards 0.03s;
}

.db-rotary-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}

.db-rotary-val {
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Jura', sans-serif;
    color: var(--font-secondary-color);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transition: color 0.3s;
}

.db-rotary-unit {
    font-size: 0.55rem;
    font-family: 'Jura', sans-serif;
    color: var(--font-muted);
    line-height: 1;
}

/* bar-readout.css */

.db-bar-readout {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    width: 100%;
    flex: 1;
}

.db-big-val {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'Jura', sans-serif;
    color: var(--font-secondary-color);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 3px;
}
.db-big-unit {
    font-size: 0.7rem;
    font-family: 'Jura', sans-serif;
    color: var(--font-muted);
    font-weight: 400;
}

/* ── Dim/live state — applied to .db-bar-readout root ─────────────────── */
/* Track background (.db-hbar-wrap) is always visible, not targeted here */
.db-bar-readout--dim .db-big-val {
    opacity: 0;
}
.db-bar-readout--dim .rr-bar {
    opacity: 0;
}

@keyframes db-bar-flicker {
    0%   { opacity: 0;   filter: brightness(0.2) saturate(0);   }
    10%  { opacity: 1;   filter: brightness(1.7) saturate(1.1); }
    20%  { opacity: 0;   filter: brightness(0.1);               }
    42%  { opacity: 1;   filter: brightness(1.15) saturate(1);  }
    100% { opacity: 1;   filter: brightness(1) saturate(1);     }
}

.db-bar-readout--live .db-big-val {
    animation: db-bar-flicker 0.5s ease-out forwards;
}
.db-bar-readout--live .rr-bar {
    animation: db-bar-flicker 0.5s ease-out forwards 0.04s;
}

.db-hbar-wrap {
    height: 5px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: visible;
    position: relative;
}
.db-hbar-fill {
    height: 100%;
    background: var(--font-secondary-color);
    border-radius: 3px;
    transition: width 0.35s, background 0.25s;
}
.db-hbar-fill.danger { background: #f87171; }
.db-hbar-fill.warn   { background: var(--font-terciary-color); }

.db-hbar-bidir .db-hbar-fill {
    position: absolute;
    top: 0;
    left: 50%;
    transform-origin: left center;
}
.db-hbar-center-mark {
    position: absolute;
    top: -2px; bottom: -2px; left: 50%;
    width: 1px;
    background: rgba(255,255,255,0.25);
}
.db-hbar-range {
    font-size: 0.55rem;
    font-family: 'Jura', sans-serif;
    color: rgba(255,255,255,0.18);
    letter-spacing: 0.04em;
}

/* spark-chart.css */

.db-spark-wrap {
    position: relative;
    height: 100px;
    flex: 1;
    min-height: 60px;
}

/* ── Dim/live state — applied to .db-spark-wrap root ───────────────── */
.db-spark-wrap--dim canvas {
    opacity: 0.04;
    filter: saturate(0) brightness(0.3);
}

@keyframes db-spark-flicker {
    0%   { opacity: 0.04; filter: saturate(0) brightness(0.3);  }
    10%  { opacity: 1;    filter: saturate(1) brightness(1.6);  }
    20%  { opacity: 0;    filter: brightness(0.1);              }
    42%  { opacity: 1;    filter: saturate(1) brightness(1.15); }
    100% { opacity: 1;    filter: saturate(1) brightness(1);    }
}

.db-spark-wrap--live canvas {
    animation: db-spark-flicker 0.55s ease-out forwards;
}

/* badge-tile.css */

.db-badge {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid currentColor;
    font-family: 'Jura', sans-serif;
}

.db-badge-ok      { color: var(--font-secondary-color); border-color: rgba(111,189,204,0.4);  background: rgba(111,189,204,0.08); }
.db-badge-danger  { color: #f87171;                     border-color: rgba(248,113,113,0.4);  background: rgba(248,113,113,0.08); }
.db-badge-err     { color: #f87171;                     border-color: rgba(248,113,113,0.4);  background: rgba(248,113,113,0.08); }
.db-badge-dim     { color: var(--font-muted);            border-color: rgba(255,255,255,0.1);  background: transparent; }

/* One-shot flicker animation added by JS on first real data */
@keyframes db-badge-flicker {
    0%   { opacity: 0.1; filter: brightness(0.3) saturate(0);   }
    12%  { opacity: 1;   filter: brightness(2.0) saturate(1.2); }
    22%  { opacity: 0;   filter: brightness(0.1);               }
    45%  { opacity: 1;   filter: brightness(1.2) saturate(1);   }
    100% { opacity: 1;   filter: brightness(1) saturate(1);     }
}

.db-badge--flash {
    animation: db-badge-flicker 0.5s ease-out forwards;
}

/* console-overlay.css — floating FAB + slide-up console overlay */

/* ── Positioning root ───────────────────────────────────────── */
.co-root {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 500;
}

/* ── FAB button ─────────────────────────────────────────────── */
.co-fab-btn {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-secondary-color);
    border: 1px solid rgba(111, 189, 204, 0.38);
    color: var(--font-secondary-color);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: all;
    user-select: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(111,189,204,0.08);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s, transform 0.15s;
    z-index: 502;
    letter-spacing: 0.04em;
    font-family: 'Courier New', monospace;
    line-height: 1;
    font-weight: 700;
}

.co-fab-btn:hover {
    border-color: var(--font-secondary-color);
    background: var(--fg-primary-color);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.75), 0 0 16px rgba(111,189,204,0.22);
    color: #fff;
    transform: scale(1.06);
}

.co-fab-btn.co-open {
    border-color: var(--font-secondary-color);
    background: var(--fg-primary-color);
    box-shadow: 0 0 0 3px rgba(111,189,204,0.18), 0 4px 24px rgba(0,0,0,0.75);
    color: #fff;
}

/* ── Phase 1: frame slides in from right edge, reveals leftward ── */
@keyframes co-frame-in {
    0% {
        clip-path: inset(0 0 0 100% round 8px);
        box-shadow:
            inset  0   0  60px rgba(111,189,204,0.20),
            inset -10px 0  32px rgba(111,189,204,0.28),
            inset  10px 0  22px rgba(111,189,204,0.12),
            0 10px 48px rgba(0,0,0,0.8);
    }
    65% {
        clip-path: inset(0 0 0 0% round 8px);
        box-shadow:
            inset  0   0  30px rgba(111,189,204,0.10),
            inset -5px 0  16px rgba(111,189,204,0.14),
            inset  5px 0  12px rgba(111,189,204,0.06),
            0 10px 48px rgba(0,0,0,0.8);
    }
    100% {
        clip-path: inset(0 0 0 0% round 8px);
        box-shadow:
            0 10px 48px rgba(0,0,0,0.8),
            0 0 0 1px rgba(111,189,204,0.06);
    }
}

/* ── Phase 2: content flickers in (header + terminal) ─────────── */
@keyframes co-content-flicker {
    0%   { opacity: 0;    filter: brightness(0);   }
    18%  { opacity: 1;    filter: brightness(3.0); }
    30%  { opacity: 0;    filter: brightness(0);   }
    56%  { opacity: 1;    filter: brightness(1.6); }
    76%  { opacity: 0.88; filter: brightness(1.1); }
    100% { opacity: 1;    filter: brightness(1);   }
}

/* ── Overlay panel ──────────────────────────────────────────── */
.co-overlay {
    position: fixed;
    bottom: 84px;
    right: 22px;
    width: 640px;
    max-width: calc(100vw - 44px);
    height: 440px;
    background: #000e11;
    border: 1px solid rgba(111, 189, 204, 0.22);
    border-radius: 8px;
    box-shadow: 0 10px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(111,189,204,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: all;
    z-index: 501;

    /* ── CLOSED state ── */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease-in, visibility 0s linear 0.12s;
}

/* Driven by an external trigger — no FAB beneath it to clear */
.co-overlay.co-overlay--no-fab {
    bottom: 22px;
}

/* ── OPEN state: phase 1 frame animation ─────────────────────── */
.co-overlay.co-visible {
    opacity: 1;
    visibility: visible;
    transition: none;
    animation: co-frame-in 0.20s ease-out forwards;
}

/* ── OPEN state: phase 2 content flicker, delayed after frame ── */
.co-overlay.co-visible .co-overlay-header,
.co-overlay.co-visible .co-terminal-wrap {
    animation: co-content-flicker 0.22s ease-out 0.18s both;
}

/* ── Resize handles ─────────────────────────────────────────── */
.co-resize-n {
    position: absolute;
    top: 0;
    left: 14px;
    right: 14px;
    height: 7px;
    cursor: n-resize;
    z-index: 10;
}

.co-resize-w {
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 0;
    width: 7px;
    cursor: ew-resize;
    z-index: 10;
}

.co-resize-nw {
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 11;
}

/* Subtle visual indicator on hover over resize areas */
.co-resize-n:hover,
.co-resize-nw:hover {
    background: linear-gradient(
        to bottom,
        rgba(111,189,204,0.12) 0%,
        transparent 100%
    );
    border-radius: 8px 8px 0 0;
}

.co-resize-w:hover {
    background: linear-gradient(
        to right,
        rgba(111,189,204,0.12) 0%,
        transparent 100%
    );
    border-radius: 8px 0 0 8px;
}

/* ── Overlay header ─────────────────────────────────────────── */
.co-overlay-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    background: #040f12;
    border-bottom: 1px solid rgba(111, 189, 204, 0.12);
    user-select: none;
    cursor: default;
}

.co-overlay-title {
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    color: rgba(111, 189, 204, 0.6);
    text-transform: uppercase;
    font-family: 'Jura', sans-serif;
    flex-shrink: 0;
}

.co-overlay-path {
    font-size: 0.75rem;
    color: rgba(111, 189, 204, 0.85);
    font-family: 'Courier New', monospace;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.co-overlay-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* ── Terminal container ─────────────────────────────────────── */
.co-terminal-wrap {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .co-fab-btn {
        bottom: 14px;
        right: 14px;
        width: 48px;
        height: 48px;
    }

    .co-overlay {
        bottom: 74px;
        right: 8px;
        left: 8px;
        width: auto !important;   /* override any inline resize width */
        max-width: none;
        height: 58vh !important;  /* override any inline resize height */
        border-radius: 10px;
    }

    .co-overlay.co-overlay--no-fab {
        bottom: 14px;
    }

    /* Hide resize handles on mobile — not useful for touch */
    .co-resize-n,
    .co-resize-w,
    .co-resize-nw {
        display: none;
    }
}

/* debug-tab.css */
/* Override the flex-direction: column set by .tab-pane.active
   without touching display (that's controlled by .tab-pane / .tab-pane.active) */
#tab-debug.debug-tab-root {
    flex-direction: row;
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Left sidebar: view list ──────────────────────────────────── */
.debug-tab-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--filterbar-color);
    border-right: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.debug-tab-sidebar-header {
    padding: 12px 14px 8px;
    flex-shrink: 0;
}
.debug-tab-sidebar-title {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--font-secondary-color);
    opacity: 0.75;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.debug-tab-search {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    color: var(--font-primary-color);
    font-family: inherit;
    font-size: 0.8rem;
    padding: 5px 2px;
    outline: none;
}
.debug-tab-search:focus { border-bottom-color: var(--font-secondary-color); }

.debug-tab-view-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.debug-tab-category {
    padding: 8px 14px 4px;
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    color: rgba(111,189,204,0.7);
    text-transform: uppercase;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: 4px;
}
.debug-tab-category:first-child { border-top: none; margin-top: 0; }

.debug-tab-view-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    user-select: none;
    border-left: 2px solid transparent;
}
.debug-tab-view-item:hover {
    background: rgba(111,189,204,0.06);
    color: var(--font-secondary-color);
}
.debug-tab-view-item.active {
    background: rgba(111,189,204,0.08);
    color: var(--font-secondary-color);
    border-left-color: var(--font-secondary-color);
}
.debug-tab-view-icon {
    font-size: 0.9rem;
    opacity: 0.7;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}
.debug-tab-view-name {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.debug-tab-view-desc {
    display: none; /* shown on hover via JS tooltip if needed */
}

/* ── Right content area ───────────────────────────────────────── */
.debug-tab-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Make debug view roots fill the content area */
.debug-tab-content > .debug-view-root {
    flex: 1;
    min-height: 0;
}

.debug-tab-no-bot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--font-muted);
    font-size: 0.85rem;
    gap: 10px;
}
.debug-tab-no-bot-icon {
    font-size: 3rem;
    opacity: 0.15;
}

/* ── No-view-selected placeholder ─────────────────────────────── */
.debug-tab-no-view {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Subtle diagonal stripe pattern */
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(111,189,204,0.025) 0px,
        rgba(111,189,204,0.025) 1px,
        transparent 1px,
        transparent 18px
    );
    pointer-events: none;
}

/* Corner bracket decorations */
.dt-ph-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    opacity: 0.5;
}
.dt-ph-tl { top: 18px; left: 18px;
    border-top: 2px solid var(--font-secondary-color);
    border-left: 2px solid var(--font-secondary-color); }
.dt-ph-tr { top: 18px; right: 18px;
    border-top: 2px solid var(--font-secondary-color);
    border-right: 2px solid var(--font-secondary-color); }
.dt-ph-bl { bottom: 18px; left: 18px;
    border-bottom: 2px solid var(--font-secondary-color);
    border-left: 2px solid var(--font-secondary-color); }

/* Removed scan line — replaced by static stripe pattern above */
.dt-ph-scan { display: none; }

/* Centred body */
.dt-ph-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    user-select: none;
}

/* Concentric pulsing rings + hex */
.dt-ph-rings {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dt-ph-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--font-secondary-color);
}
.dt-ph-ring-outer {
    width: 110px; height: 110px;
    opacity: 0.18;
    animation: dt-ph-ring-pulse 3.5s ease-in-out infinite;
}
.dt-ph-ring-mid {
    width: 72px; height: 72px;
    opacity: 0.28;
    animation: dt-ph-ring-pulse 3.5s ease-in-out infinite 0.6s;
}
@keyframes dt-ph-ring-pulse {
    0%, 100% { opacity: 0.14; transform: scale(1);    }
    50%       { opacity: 0.38; transform: scale(1.04); }
}
.dt-ph-hex {
    position: relative;
    font-size: 2.6rem;
    color: var(--font-secondary-color);
    opacity: 0.38;
    line-height: 1;
    animation: dt-ph-hex-pulse 3.5s ease-in-out infinite 1.2s;
}
@keyframes dt-ph-hex-pulse {
    0%, 100% { opacity: 0.28; }
    50%       { opacity: 0.55; }
}

.dt-ph-status {
    font-size: 0.62rem;
    letter-spacing: 0.3em;
    color: var(--font-secondary-color);
    opacity: 0.65;
    text-transform: uppercase;
    font-weight: 600;
}

.dt-ph-hint {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: var(--font-muted);
    opacity: 0.7;
}

.debug-tab-count-badge {
    margin-left: auto;
    font-size: 0.65rem;
    background: rgba(111,189,204,0.12);
    color: var(--font-secondary-color);
    border-radius: 10px;
    padding: 1px 6px;
}

/* ── Mobile menu toggle ────────────────────────────────────────── */
.debug-tab-menu-toggle {
    display: none; /* Hidden on desktop */
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background: var(--bg-secondary-color);
    border: 1px solid rgba(111,189,204,0.3);
    border-radius: 5px;
    color: var(--font-primary-color);
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.debug-tab-menu-toggle:hover {
    background: var(--fg-primary-color);
    border-color: var(--font-secondary-color);
}
.debug-tab-menu-icon {
    display: block;
    line-height: 1;
}

.debug-tab-backdrop {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s;
}
.debug-tab-backdrop.visible {
    display: block;
    opacity: 1;
}

/* ── Mobile responsiveness ───────────────────────────────────────── */
@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .debug-tab-menu-toggle {
        display: block;
    }

    /* Make sidebar overlay content */
    .debug-tab-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 80vw;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
        padding-top: 60px;
    }

    .debug-tab-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Make content area full width */
    .debug-tab-content {
        width: 100%;
    }

    /* Add padding for menu toggle button so content doesn't overlap */
    #tab-debug.debug-tab-root {
        padding-top: 50px;
    }

    /* Adjust sidebar header to accommodate close button */
    .debug-tab-sidebar-header {
        padding-right: 44px;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .debug-tab-sidebar {
        width: 260px;
    }
    
    .debug-tab-menu-toggle {
        top: 8px;
        left: 8px;
        padding: 6px 10px;
        font-size: 1.1rem;
    }
}

/* pathing-view.css */
.pathing-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pathing-map-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.pathing-canvas-wrap {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-width: 0;
}

.pathing-canvas-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.pathing-sidebar {
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--bg-secondary-color);
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pathing-sidebar-section {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.pathing-sidebar-section-title {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--font-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pathing-sidebar-section-title::before {
    content: '';
    width: 3px;
    height: 10px;
    background: var(--font-secondary-color);
    border-radius: 2px;
    display: inline-block;
}

.pathing-pid-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}

.pathing-pid-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pathing-pid-key {
    font-size: 0.68rem;
    color: var(--font-muted);
    letter-spacing: 0.05em;
}
.pathing-pid-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--font-primary-color);
    font-variant-numeric: tabular-nums;
}

.pathing-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary-color);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.pathing-driver-status {
    font-size: 0.72rem;
    color: var(--font-muted);
    margin-left: auto;
}

/* pslam-view.css */

/* ── Root layout ───────────────────────────────────────────── */
.pslam-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Map + sidebar area ────────────────────────────────────── */
.pslam-map-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ── Canvas wrapper ────────────────────────────────────────── */
.pslam-canvas-wrap {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-width: 0;
}

.pslam-canvas-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── Loading / status overlay ──────────────────────────────── */
.pslam-canvas-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.68);
    z-index: 10;
    pointer-events: none;
}

.pslam-overlay-text {
    color: var(--font-muted);
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(8, 14, 16, 0.8);
}

/* ── Header status pill ────────────────────────────────────── */
.pslam-status-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.45);
    font-size: 0.77rem;
    color: var(--font-muted);
    margin-left: auto;
    letter-spacing: 0.05em;
    user-select: none;
}

.pslam-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s;
}

.pslam-status-dot.pslam-status-active {
    background: var(--font-secondary-color);
    box-shadow: 0 0 7px var(--font-secondary-color);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.pslam-sidebar {
    width: 280px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--bg-secondary-color);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pslam-sidebar-section {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pslam-sidebar-section-title {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--font-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pslam-sidebar-section-title::before {
    content: '';
    width: 3px;
    height: 10px;
    background: var(--font-secondary-color);
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Legend ────────────────────────────────────────────────── */
.pslam-sidebar-legend {
    flex: 1;
}

.pslam-legend-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 7px;
}

.pslam-legend-swatch {
    width: 24px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
}

.pslam-legend-gradient {
    background: linear-gradient(to right, rgba(0,20,25,0.9), rgba(255,160,0,0.9));
    border: 1px solid rgba(255,255,255,0.1);
}

.pslam-legend-label {
    font-size: 0.76rem;
    color: var(--font-muted);
    letter-spacing: 0.04em;
}

/* ── Subsample input ───────────────────────────────────────── */
.pslam-subsample-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    color: var(--font-primary-color);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    width: 60px;
    padding: 1px 0;
    outline: none;
    transition: border-color 0.15s;
}

.pslam-subsample-input:focus {
    border-bottom-color: var(--font-secondary-color);
}

/* normal-view.css */
.nv-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── 2D canvas area ── */
.nv-canvas-wrap {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-height: 0;
}

.nv-canvas-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── 3D mesh area ── */
.nv-three-wrap {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-height: 0;
}

.nv-three-container {
    width: 100%;
    height: 100%;
}

.nv-three-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.nv-three-hint {
    position: absolute;
    bottom: 14px;
    right: 14px;
    font-size: 0.65rem;
    color: var(--font-muted);
    letter-spacing: 0.08em;
    pointer-events: none;
    background: rgba(0,0,0,0.5);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.08);
}

/* ── Mode toggle button group ── */
.nv-mode-group {
    display: flex;
    gap: 0;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
}

.nv-mode-group .nv-mode-btn {
    border-radius: 0;
    border: none;
    border-right: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
    padding: 5px 12px;
}

.nv-mode-group .nv-mode-btn:last-child {
    border-right: none;
}

.nv-mode-btn.nv-mode-active {
    background: var(--fg-primary-color);
    color: var(--font-secondary-color);
    border-color: transparent !important;
}

/* ── Legend overlays ── */
.nv-legend {
    position: absolute;
    bottom: 14px;
    left: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.nv-legend-bar {
    width: 100px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, hsl(120,78%,42%), hsl(50,78%,42%), hsl(0,78%,42%));
    border: 1px solid rgba(255,255,255,0.15);
}

.nv-legend-labels {
    display: flex;
    justify-content: space-between;
    width: 100px;
}

.nv-legend-labels span {
    font-size: 0.65rem;
    color: var(--font-muted);
    letter-spacing: 0.06em;
}

/* Normal-map legend */
.nv-nm-legend {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.nv-nm-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.15);
    /* Approximates a normal-map sphere patch: blue-ish center */
    background: radial-gradient(circle at 40% 40%, #8080ff, #0000ff 70%, #4040aa);
    flex-shrink: 0;
}

.nv-nm-label {
    font-size: 0.65rem;
    color: var(--font-muted);
    letter-spacing: 0.08em;
    white-space: nowrap;
}

/* ── Driver / controls strip ── */
.nv-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary-color);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.nv-driver-status {
    font-size: 0.72rem;
    color: var(--font-muted);
    margin-left: auto;
}

/* Cell count in header */
.nv-stat {
    font-size: 0.72rem;
    color: var(--font-muted);
    font-variant-numeric: tabular-nums;
    padding: 3px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
}

/* voxel-view.css — 3D voxel map view */

/* ── Root layout ────────────────────────────────────────────── */
.voxel-view-root {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.voxel-view-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    overflow: hidden;
}

/* ── THREE.js canvas wrapper ─────────────────────────────────── */
.voxel-canvas-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
    background: #000;
    overflow: hidden;
}

/* THREE.js injects a <canvas> — fill the container */
.voxel-canvas-wrap > canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ── Loading overlay ────────────────────────────────────────── */
.voxel-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.voxel-loading-text {
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    color: var(--font-secondary-color);
    animation: vv-pulse 1.4s ease-in-out infinite;
}

@keyframes vv-pulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1; }
}

/* ── Hint label ─────────────────────────────────────────────── */
.voxel-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.22);
    pointer-events: none;
    white-space: nowrap;
}

/* ── Height legend ───────────────────────────────────────────── */
.voxel-legend {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 130px;
    background: rgba(8, 14, 16, 0.82);
    border: 1px solid rgba(111, 189, 204, 0.15);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.7rem;
    color: var(--font-muted);
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.voxel-legend-title {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--font-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
}

/* gradient bar: green → cyan → blue → purple → amber */
.voxel-legend-bar {
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(
        to right,
        hsl(138, 60%, 42%),
        hsl(180, 60%, 52%),
        hsl(215, 65%, 58%),
        hsl(275, 55%, 58%),
        hsl( 45, 65%, 60%)
    );
    margin-bottom: 4px;
}

.voxel-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 7px;
}

.voxel-legend-collision {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.35);
}

.voxel-legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    flex-shrink: 0;
}
.voxel-legend-dot.collision {
    background: #cc1f1f;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.voxel-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--bg-secondary-color);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.voxel-sidebar-section {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.voxel-sidebar-title {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--font-secondary-color);
    margin-bottom: 8px;
    font-weight: 600;
}

/* ── Height filter sliders ───────────────────────────────────── */
.voxel-filter-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 9px;
}

.voxel-filter-row:last-child {
    margin-bottom: 0;
}

.voxel-filter-label {
    font-size: 0.7rem;
    color: var(--font-muted);
    letter-spacing: 0.06em;
}

.voxel-range-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.voxel-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--font-secondary-color);
    cursor: pointer;
    border: none;
}

.voxel-range-input:hover {
    background: rgba(111, 189, 204, 0.18);
}

.voxel-range-val {
    font-size: 0.72rem;
    color: var(--font-primary-color);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ── View option checkboxes ──────────────────────────────────── */
.voxel-option-row {
    margin-bottom: 7px;
}

.voxel-option-row:last-child {
    margin-bottom: 0;
}

.voxel-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--font-muted);
    transition: color 0.15s;
    user-select: none;
}

.voxel-toggle-label:hover {
    color: var(--font-primary-color);
}

.voxel-toggle-label input[type="checkbox"] {
    accent-color: var(--font-secondary-color);
    width: 13px;
    height: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.voxel-axes-legend {
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

/* state-viz-view.css */
.state-viz-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.state-viz-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ── Main canvas ── */
.state-viz-canvas-wrap {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-width: 0;
}

.state-viz-canvas-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── Sidebar ── */
.state-viz-sidebar {
    width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--bg-secondary-color);
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
}

.state-viz-section {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.state-viz-section-title {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--font-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.state-viz-section-title::before {
    content: '';
    width: 3px;
    height: 10px;
    background: var(--font-secondary-color);
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* KV table */
.sv-kv-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sv-kv-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.sv-kv-key {
    font-size: 0.7rem;
    color: var(--font-muted);
    letter-spacing: 0.05em;
    min-width: 80px;
    flex-shrink: 0;
}
.sv-kv-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--font-primary-color);
    font-variant-numeric: tabular-nums;
}
.sv-kv-val.teal {
    color: var(--font-secondary-color);
}
.sv-kv-val.amber {
    color: var(--font-terciary-color);
}

/* Blow-up-cov button */
.state-viz-blowup-wrap {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Inset roll/pitch canvas */
.state-viz-inset-wrap {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.state-viz-inset-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background: #000;
    border: 1px solid rgba(255,255,255,0.07);
}

/* Legend dots */
.sv-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.sv-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    color: var(--font-muted);
}
.sv-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Bottom driver strip ── */
.state-viz-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary-color);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.state-viz-driver-status {
    font-size: 0.72rem;
    color: var(--font-muted);
    margin-left: auto;
}

/* system-view.css */
.system-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.system-charts-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* imu-view.css */
.imu-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.imu-charts-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* log-view.css */
.log-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.log-view-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary-color);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.log-view-filter {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    color: var(--font-primary-color);
    font-family: inherit;
    font-size: 0.82rem;
    padding: 4px 4px;
    outline: none;
    width: 200px;
}
.log-view-filter:focus { border-bottom-color: var(--font-secondary-color); }
.log-feed {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
}
.log-entry {
    display: flex;
    gap: 10px;
    padding: 4px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    line-height: 1.5;
    transition: background 0.1s;
}
.log-entry:hover { background: rgba(255,255,255,0.025); }
.log-ts {
    color: var(--font-muted);
    flex-shrink: 0;
    width: 75px;
}
.log-chip {
    color: var(--font-secondary-color);
    flex-shrink: 0;
    width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.log-msg { color: var(--font-primary-color); flex: 1; word-break: break-word; }
.log-level-warn  .log-msg { color: var(--font-terciary-color); }
.log-level-error .log-msg { color: var(--danger-color); }
.log-level-headline .log-msg { color: var(--font-secondary-color); font-weight: 700; }

/* preview-view.css */
.preview-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.preview-images-row {
    display: flex;
    flex: 1;
    gap: 12px;
    padding: 16px;
    overflow: hidden;
    align-items: stretch;
}
.preview-cam-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary-color);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    overflow: hidden;
}
.preview-cam-label {
    padding: 7px 12px;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: var(--font-muted);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.preview-cam-label::before {
    content: '';
    width: 3px; height: 10px;
    background: var(--font-secondary-color);
    border-radius: 2px;
}
.preview-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}
.preview-img-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}
.preview-no-img {
    color: var(--font-muted);
    font-size: 0.8rem;
}

/* metavision-view.css */

/* ── Root / layout ─────────────────────────────────────────────── */
.metavision-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.metavision-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Status strip ──────────────────────────────────────────────── */
.metavision-status-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.metavision-stat-card {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
}

.metavision-stat-label {
    font-size: 0.66rem;
    color: var(--font-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.metavision-stat-value {
    font-size: 0.88rem;
    color: var(--font-primary-color);
    font-weight: 500;
    line-height: 1.4;
}

/* ── Pipeline tree card ────────────────────────────────────────── */
.metavision-pipeline-card {
    padding: 14px 18px 18px;
}

.metavision-pipeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.metavision-pipeline-legend {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.mv-legend-item {
    font-size: 0.70rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    opacity: 0.85;
    user-select: none;
}

.mv-legend-ok   { color: #6FBDCC; }
.mv-legend-warn { color: #ccc36f; }
.mv-legend-crit { color: #f87171; }
.mv-legend-none { color: rgba(255,255,255,0.28); }

/* Scrollable SVG viewport — primary focus area */
.metavision-pipeline-tree {
    overflow: auto;
    min-height: 280px;
    padding: 6px 4px;
    border-radius: 4px;
    background: rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.05);
}

.mv-empty-state {
    color: var(--font-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 72px 0;
}

/* ── Logs section (collapsible) ────────────────────────────────── */
.metavision-logs-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding-bottom: 2px;
}

.metavision-logs-toggle:hover .dax-card-title {
    color: var(--font-secondary-color);
}

.mv-logs-caret {
    font-size: 0.85rem;
    color: var(--font-muted);
    transition: color 0.15s;
}

.metavision-logs-toggle:hover .mv-logs-caret {
    color: var(--font-secondary-color);
}

.metavision-logs-wrap {
    margin-top: 10px;
}

.metavision-logs-wrap.mv-collapsed {
    display: none;
}

.metavision-logs-content {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--font-primary-color);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow-y: auto;
    padding: 8px 10px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 4px;
}

.metavision-logs-content::-webkit-scrollbar { width: 6px; }

.metavision-logs-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

.metavision-logs-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

.metavision-logs-content::-webkit-scrollbar-track {
    background: transparent;
}

/**
 * joystick-view.css
 * Styling for the Joystick debug view — mobile-friendly analog control
 */

.joystick-view-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.joystick-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 30px;
    overflow-y: auto;
}

/* Instructions */
.joystick-instructions {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.joy-instr-line {
    font-size: 0.95rem;
    color: var(--font-primary-color);
    letter-spacing: 0.02em;
}

.joy-muted {
    font-size: 0.8rem;
    color: var(--font-muted);
}

/* Joystick Widget */
.joystick-widget {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.joystick-boundary {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: var(--bg-secondary-color);
    border: 2px solid rgba(111, 189, 204, 0.3);
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.4);
}

/* Crosshair guides */
.joystick-crosshair-h,
.joystick-crosshair-v {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
}

.joystick-crosshair-h {
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    transform: translateY(-50%);
}

.joystick-crosshair-v {
    left: 50%;
    top: 10%;
    bottom: 10%;
    width: 1px;
    transform: translateX(-50%);
}

/* Draggable knob */
.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        rgba(111, 189, 204, 0.4) 0%, 
        rgba(111, 189, 204, 0.2) 100%);
    border: 2px solid var(--font-secondary-color);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(111, 189, 204, 0.15);
    cursor: grab;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease-out, box-shadow 0.15s;
    touch-action: none;
    user-select: none;
}

.joystick-knob:active {
    cursor: grabbing;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.8),
        inset 0 0 30px rgba(111, 189, 204, 0.3),
        0 0 20px rgba(111, 189, 204, 0.4);
    border-color: rgba(111, 189, 204, 0.9);
}

.joystick-knob-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, 
        rgba(111, 189, 204, 0.6), 
        rgba(111, 189, 204, 0.3));
    transform: translate(-50%, -50%);
    border: 1px solid rgba(111, 189, 204, 0.5);
}

/* Readout panel */
.joystick-readout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-secondary-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 280px;
}

.joy-readout-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.joy-readout-label {
    flex: 0 0 80px;
    color: var(--font-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.joy-readout-value {
    flex: 1;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--font-primary-color);
    min-width: 60px;
}

.joy-readout-unit {
    flex: 0 0 50px;
    color: var(--font-muted);
    font-size: 0.75rem;
}

.joy-readout-drive {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
}

.joy-readout-drive:first-of-type {
    margin-top: 4px;
}

.joy-readout-drive .joy-readout-value {
    color: var(--font-secondary-color);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .joystick-boundary {
        width: 240px;
        height: 240px;
    }
    
    .joystick-knob {
        width: 80px;
        height: 80px;
    }
    
    .joystick-knob-inner {
        width: 32px;
        height: 32px;
    }
    
    .joystick-readout {
        min-width: 240px;
        font-size: 0.85rem;
    }
    
    .joy-readout-label {
        flex: 0 0 70px;
        font-size: 0.7rem;
    }
    
    .joy-readout-value {
        font-size: 1rem;
        min-width: 50px;
    }
}

/* Very small screens (portrait phones) */
@media (max-width: 400px) {
    .joystick-container {
        gap: 20px;
        padding: 10px;
    }
    
    .joystick-boundary {
        width: 200px;
        height: 200px;
    }
    
    .joystick-knob {
        width: 70px;
        height: 70px;
    }
    
    .joystick-knob-inner {
        width: 28px;
        height: 28px;
    }
}

/* trailer-view.css — Charging trailer debug view */

/* ── Root ───────────────────────────────────────────────────── */
.trailer-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Vitals strip (battery SOC + propane) ────────────────────── */

.trailer-vitals-card {
    flex-shrink: 0;
}

.trailer-vitals-row {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.trailer-vitals-sep {
    width: 1px;
    background: rgba(255,255,255,0.07);
    margin: 0 28px;
    flex-shrink: 0;
}

.trailer-gauge {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trailer-gauge-label {
    font-size: 0.68rem;
    letter-spacing: 0.15em;
    color: var(--font-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.trailer-gauge-value {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--success-color);
    font-variant-numeric: tabular-nums;
    transition: color 0.4s ease;
}

.trailer-gauge-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
}

.trailer-gauge-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: var(--success-color);
    transition: width 0.6s ease, background 0.4s ease;
    box-shadow: 0 0 8px currentColor;
}

.trailer-gauge-sub {
    font-size: 0.78rem;
    color: var(--font-muted);
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

.trailer-gauge-fault {
    font-size: 0.72rem;
    color: var(--font-muted);
    letter-spacing: 0.04em;
    font-style: italic;
    min-height: 1em;
}

/* ── Top row: battery card + generator card ─────────────────── */
.trailer-top-row {
    display: flex;
    gap: 14px;
    flex-shrink: 0;
}

.trailer-battery-card {
    flex: 1;
    min-width: 0;
}

.trailer-generator-card {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── SOC bar ─────────────────────────────────────────────────── */
.trailer-soc-bar-wrap {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    margin-top: 13px;
    overflow: hidden;
}
.trailer-soc-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: var(--success-color);
    transition: width 0.6s ease, background 0.4s ease;
}

/* ── Generator status ────────────────────────────────────────── */
.trailer-gen-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trailer-gen-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}
.trailer-gen-indicator.running {
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
    animation: tv-gen-pulse 1.6s ease-in-out infinite;
}
.trailer-gen-indicator.stopped {
    background: var(--danger-color);
    box-shadow: none;
    animation: none;
}

@keyframes tv-gen-pulse {
    0%, 100% { box-shadow: 0 0 4px var(--success-color); }
    50%       { box-shadow: 0 0 14px var(--success-color); }
}

.trailer-gen-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--font-primary-color);
    letter-spacing: 0.05em;
}

.trailer-gen-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* ── SVG wiring diagram ──────────────────────────────────────── */
.trailer-wiring-wrap {
    width: 100%;
    overflow: hidden;
}

.trailer-wiring-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* SVG node boxes */
.tv-node {
    fill: var(--fg-primary-color);
    stroke: rgba(111,189,204,0.22);
    stroke-width: 1;
    transition: stroke 0.3s;
}

.tv-node-comp {
    stroke: rgba(204,195,111,0.18);
}

.tv-pad-node {
    stroke: rgba(111,189,204,0.15);
}

/* SVG text labels */
.tv-node-label {
    fill: var(--font-muted);
    font-size: 8.5px;
    font-family: 'Jura', sans-serif;
    text-anchor: middle;
    letter-spacing: 0.14em;
    font-weight: 700;
}

.tv-node-sub {
    fill: var(--font-secondary-color);
    font-size: 7.5px;
    font-family: 'Jura', sans-serif;
    text-anchor: middle;
    letter-spacing: 0.07em;
    transition: fill 0.3s;
}

/* Animated flow lines */
@keyframes tv-flow-dash {
    from { stroke-dashoffset: 24; }
    to   { stroke-dashoffset: 0;  }
}

.tv-wire-flow {
    animation: tv-flow-dash 0.75s linear infinite;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ── Charger pad cards grid ──────────────────────────────────── */
.trailer-chargers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    flex-shrink: 0;
}

.trailer-charger-card {
    flex: 1 1 190px;
    min-width: 175px;
    display: flex;
    flex-direction: column;
}

.trailer-charger-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ── Connection dot in charger card title ────────────────────── */
.trailer-pad-conn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}
.trailer-pad-conn-dot.connected {
    background: var(--success-color);
    box-shadow: 0 0 5px var(--success-color);
}

/* lane-assist-view.css */

.la-view-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.la-map-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ── Canvas wrap ────────────────────────────────────────── */

.la-canvas-wrap {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-width: 0;
}

.la-canvas-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── Floating legend ────────────────────────────────────── */

.la-legend {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
    z-index: 10;
}

.la-clear-btn,
.la-fit-btn {
    pointer-events: all;
    margin-top: 4px;
    font-size: 0.68rem;
    padding: 3px 10px;
    cursor: pointer;
}

.la-clear-btn {
    border-color: rgba(255,255,255,0.2);
    color: var(--font-muted);
}
.la-clear-btn:hover {
    border-color: #f87171;
    color: #f87171;
    background: rgba(248,113,113,0.1);
}

.la-fit-btn {
    border-color: rgba(255,255,255,0.2);
    color: var(--font-muted);
}
.la-fit-btn.dax-btn-primary,
.la-fit-btn:hover {
    border-color: var(--font-secondary-color);
    color: var(--font-secondary-color);
    background: rgba(111,189,204,0.1);
}

.la-heatmap-btn {
    pointer-events: all;
    font-size: 0.68rem;
    padding: 3px 10px;
    border-color: rgba(255,255,255,0.2);
    color: var(--font-muted);
    cursor: pointer;
}
.la-heatmap-btn:hover,
.la-heatmap-btn.dax-btn-primary {
    border-color: var(--font-secondary-color);
    color: var(--font-secondary-color);
    background: rgba(111,189,204,0.1);
}

.la-legend-item {
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255,255,255,0.1);
}

.la-legend-left   { color: #6FBDCC; }
.la-legend-right  { color: #ccc36f; }
.la-legend-center { color: rgba(255,255,255,0.6); }
.la-legend-unified { color: var(--font-terciary-color); }
.la-legend-line   { color: rgba(255,255,255,0.9); letter-spacing: 0.02em; }
.la-legend-bot    { color: var(--font-primary-color); }

/* Layer toggle buttons in the legend */
.la-layer-btn {
    pointer-events: all;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s, text-decoration 0.15s;
    background: rgba(0,0,0,0.6);
}
.la-layer-btn.active {
    opacity: 1;
    text-decoration: none;
}
.la-layer-btn:not(.active) {
    opacity: 0.38;
    text-decoration: line-through;
}

/* ── Sidebar ────────────────────────────────────────────── */

.la-sidebar {
    width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--bg-secondary-color);
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.la-sidebar-section {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.la-sidebar-section-title {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--font-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.la-sidebar-section-title::before {
    content: '';
    width: 3px;
    height: 10px;
    background: var(--font-secondary-color);
    border-radius: 2px;
    display: inline-block;
}

/* ── Controls strip ─────────────────────────────────────── */

.la-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary-color);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.la-mono {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem !important;
    color: var(--font-muted) !important;
}

/* ── Tracer tunables ────────────────────────────────────── */

.la-tunable-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.la-tunable {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.la-tunable-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.la-tunable-label {
    font-size: 0.70rem;
    color: var(--font-muted);
    letter-spacing: 0.04em;
}

.la-tunable-val {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--font-secondary-color);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: right;
}

.la-tunable-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.12);
    outline: none;
    cursor: pointer;
}
.la-tunable-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--font-secondary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 4px rgba(111,189,204,0.5);
}
.la-tunable-slider:hover {
    background: rgba(111,189,204,0.25);
}

.la-tunable-hint {
    font-size: 0.62rem;
    color: var(--font-terciary-color);
    opacity: 0.7;
    letter-spacing: 0.03em;
}

/* ── HardwareTab ─────────────────────────────────────────────── */

.hw-tab-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: var(--bg-primary-color);
}

/* ── No-bot placeholder ──────────────────────────────────────── */

.hw-tab-no-bot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--font-muted);
    font-size: 0.85rem;
}

.hw-tab-no-bot-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

/* ── Tab body ────────────────────────────────────────────────── */

.hw-tab-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────── */

.hw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: var(--bg-secondary-color);
    flex-shrink: 0;
}

.hw-header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.hw-header-title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--font-secondary-color);
}

.hw-header-sub {
    font-size: 0.75rem;
    color: var(--font-muted);
}

.hw-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Identity strip ─────────────────────────────────────────── */

.hw-identity-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: var(--bg-secondary-color);
    flex-shrink: 0;
}

.hw-identity-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hw-badge-label {
    font-size: 0.68rem;
    color: var(--font-muted);
    letter-spacing: 0.1em;
    font-weight: 600;
}

.hw-badge {
    background: var(--fg-primary-color);
    border: 1px solid var(--font-secondary-color);
    color: var(--font-secondary-color);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    font-weight: 600;
    text-transform: uppercase;
}

.hw-badge.hw-badge-dim {
    border-color: rgba(255,255,255,0.15);
    color: var(--font-muted);
}

.hw-identity-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Diff bar ────────────────────────────────────────────────── */

.hw-diff-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 6px 20px;
    background: rgba(204,163,111,0.1);
    border-bottom: 1px solid rgba(204,163,111,0.3);
    flex-shrink: 0;
}

.hw-diff-bar.hw-diff-bar-visible {
    display: flex;
}

.hw-diff-bar-icon {
    color: var(--font-terciary-color);
    font-size: 0.9rem;
}

.hw-diff-bar-text {
    flex: 1;
    font-size: 0.8rem;
    color: var(--font-terciary-color);
}

/* ── Component grid ──────────────────────────────────────────── */

.hw-components-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-content: flex-start;
}

.hw-empty-state {
    color: var(--font-muted);
    font-size: 0.85rem;
    padding: 24px;
    text-align: center;
    width: 100%;
}

/* ── Component card ──────────────────────────────────────────── */

.hw-component-card {
    background: var(--bg-secondary-color);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 14px 16px;
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s;
}

.hw-component-card:hover {
    border-color: rgba(111,189,204,0.3);
}

.hw-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.hw-card-key {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--font-primary-color);
    letter-spacing: 0.05em;
    word-break: break-all;
}

.hw-card-type {
    font-size: 0.72rem;
    color: var(--font-secondary-color);
    letter-spacing: 0.04em;
    word-break: break-all;
    opacity: 0.85;
}

.hw-card-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 4px 0;
}

.hw-card-conns-label {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--font-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.hw-card-conns {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 18px;
}

.hw-conn-empty {
    font-size: 0.72rem;
    color: var(--font-muted);
    font-style: italic;
}

.hw-conn-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
}

.hw-conn-key {
    color: var(--font-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hw-conn-arrow {
    color: var(--font-secondary-color);
    flex-shrink: 0;
}

.hw-conn-dest {
    color: var(--font-primary-color);
    font-weight: 600;
    flex-shrink: 0;
}

.hw-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* ── Icon buttons on cards ───────────────────────────────────── */

.hw-icon-btn {
    background: transparent;
    border: none;
    color: var(--font-muted);
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.8rem;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
    flex-shrink: 0;
}

.hw-rm-hw-btn:hover,
.hw-rm-conn-btn:hover {
    color: #f87171;
    background: rgba(248,113,113,0.1);
}

/* ── Button variants ─────────────────────────────────────────── */

.hw-btn-warn {
    border-color: rgba(204,163,111,0.5) !important;
    color: var(--font-terciary-color) !important;
}

.hw-btn-warn:hover {
    border-color: var(--font-terciary-color) !important;
    background: rgba(204,163,111,0.12) !important;
}

.hw-btn-danger {
    border-color: rgba(248,113,113,0.4) !important;
    color: #f87171 !important;
}

.hw-btn-danger:hover {
    border-color: #f87171 !important;
    background: rgba(248,113,113,0.12) !important;
}

/* ── Templates drawer ────────────────────────────────────────── */

.hw-templates-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    background: var(--filterbar-color);
    border-left: 1px solid rgba(255,255,255,0.1);
    box-shadow: -4px 0 24px rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.hw-templates-drawer.hw-drawer-open {
    transform: translateX(0);
}

.hw-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(1px);
    z-index: 199;
    display: none;
}

.hw-drawer-backdrop.hw-drawer-open {
    display: block;
}

.hw-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.hw-drawer-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--font-secondary-color);
}

.hw-templates-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hw-template-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bg-secondary-color);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    padding: 8px 12px;
    transition: border-color 0.15s;
}

.hw-template-row:hover {
    border-color: rgba(111,189,204,0.3);
}

.hw-template-name {
    font-size: 0.82rem;
    color: var(--font-primary-color);
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hw-template-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Modal content helpers ───────────────────────────────────── */

.hw-confirm-body,
.hw-form-body {
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hw-confirm-body p,
.hw-form-body p {
    font-size: 0.88rem;
    color: var(--font-primary-color);
    margin: 0;
}

.hw-form-hint {
    font-size: 0.8rem !important;
    color: var(--font-muted) !important;
}

.hw-confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.hw-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hw-form-check {
    flex-direction: row;
    align-items: center;
}

.hw-form-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--font-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin: 0;
}

.hw-input,
.hw-select {
    background: var(--fg-primary-color);
    color: var(--font-primary-color);
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    border-radius: 0;
    padding: 6px 4px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.hw-input:focus,
.hw-select:focus {
    border-bottom-color: var(--font-primary-color);
}

.hw-select option {
    background: var(--fg-primary-color);
}

/* ── Diff modal ──────────────────────────────────────────────── */

.hw-diff-body {
    max-height: 60vh;
    overflow-y: auto;
    padding: 2px 0;
}

.hw-diff-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
}

.hw-diff-add    { border-left-color: var(--font-secondary-color); background: rgba(111,189,204,0.06); }
.hw-diff-remove { border-left-color: #f87171;                     background: rgba(248,113,113,0.06); }
.hw-diff-change { border-left-color: var(--font-terciary-color);   background: rgba(204,195,111,0.06); }

.hw-diff-gutter {
    font-weight: 700;
    font-size: 1rem;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
.hw-diff-add    .hw-diff-gutter { color: var(--font-secondary-color); }
.hw-diff-remove .hw-diff-gutter { color: #f87171; }
.hw-diff-change .hw-diff-gutter { color: var(--font-terciary-color); }

.hw-diff-action {
    min-width: 168px;
    font-size: 0.68rem;
    letter-spacing: 0.07em;
    color: var(--font-muted);
    flex-shrink: 0;
}

.hw-diff-args {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.hw-diff-arg-key { color: var(--font-primary-color); font-weight: 600; }
.hw-diff-arg-val { color: var(--font-secondary-color); }
.hw-diff-sep     { color: var(--font-muted); opacity: 0.45; }
.hw-diff-arrow   { color: var(--font-muted); }

.hw-diff-empty {
    color: var(--font-muted);
    text-align: center;
    padding: 20px;
    font-size: 0.82rem;
}

.hw-diff-error {
    color: #f87171;
    padding: 12px;
    font-size: 0.82rem;
}

/* ── Mobile ──────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .hw-component-card {
        width: 100%;
    }

    .hw-templates-drawer {
        width: 100%;
    }

    .hw-identity-strip {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── HealthTab ───────────────────────────────────────────────── */

.health-tab-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: var(--bg-primary-color);
}

/* ── No-bot placeholder ──────────────────────────────────────── */

.health-no-bot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--font-muted);
    font-size: 0.85rem;
}

.health-no-bot-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.health-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── The lamp ────────────────────────────────────────────────── */

.health-lamp {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: var(--bg-secondary-color);
    flex-shrink: 0;
}

.health-lamp-light {
    font-size: 2.2rem;
    line-height: 1;
    color: var(--font-muted);
    transition: color 0.15s;
}

.health-lamp-good    { color: var(--success-color); text-shadow: 0 0 12px var(--success-color); }
.health-lamp-bad     { color: var(--danger-color);  text-shadow: 0 0 12px var(--danger-color); }
.health-lamp-unknown { color: var(--font-muted); }

.health-lamp-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.health-lamp-verdict {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.health-lamp-sub {
    font-size: 0.8rem;
    color: var(--font-muted);
}

.health-lamp-counts {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.health-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 54px;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
}

.health-count-n {
    font-size: 1.1rem;
    font-weight: 600;
}

.health-count-label {
    font-size: 0.68rem;
    color: var(--font-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.health-count-fault .health-count-n   { color: var(--danger-color); }
.health-count-warning .health-count-n { color: var(--warn-color); }
.health-count-zero .health-count-n    { color: var(--font-muted); }

.health-lamp-stamp {
    font-size: 0.7rem;
    color: var(--font-muted);
}

/* ── Three-column body ───────────────────────────────────────── */

.health-columns {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.health-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid rgba(255,255,255,0.07);
    overflow: hidden;
}

.health-col-monitors { flex: 0 0 260px; }
.health-col-detail   { flex: 1 1 auto; }
.health-col-journal  { flex: 0 0 380px; border-right: none; }

.health-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: var(--bg-secondary-color);
    flex-shrink: 0;
}

.health-col-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--font-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.health-empty {
    padding: 20px 14px;
    text-align: center;
    color: var(--font-muted);
    font-size: 0.8rem;
}

/* ── Monitor list ────────────────────────────────────────────── */

.health-monitor-list {
    flex: 1;
    overflow-y: auto;
}

.health-chip-header {
    padding: 8px 14px 4px;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--font-muted);
}

.health-monitor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    user-select: none;
    border-left: 2px solid transparent;
    transition: background 0.15s, color 0.15s;
}

.health-monitor-row:hover {
    background: var(--bg-secondary-color);
    color: var(--font-secondary-color);
}

.health-monitor-row-selected {
    background: var(--fg-primary-color);
    border-left-color: var(--font-secondary-color);
}

.health-monitor-glyph {
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.health-monitor-name {
    flex: 1;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Severity is the quiet qualifier — a muted comment, not a badge. Fault
   gets a faint danger tint so it still reads as the heavier of the two. */
.health-monitor-sev {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--font-muted);
    flex-shrink: 0;
}

.health-monitor-sev.health-sev-fault { color: var(--danger-color); opacity: 0.75; }

/* State is what a tech scans for, so it carries the badge: a bordered pill
   coloured by state. */
.health-monitor-badge {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    padding: 1px 5px;
    flex-shrink: 0;
    color: var(--font-muted);
}

.health-badge-bad {
    color: var(--danger-color);
    border-color: var(--danger-border);
    background: rgba(248,113,113,0.10);
}

.health-badge-good {
    color: var(--success-color);
    border-color: rgba(74,222,128,0.35);
    background: rgba(74,222,128,0.08);
}

.health-badge-unproven {
    color: var(--warn-color);
    border-color: rgba(204,195,111,0.35);
    background: rgba(204,195,111,0.08);
}

.health-badge-never_run,
.health-badge-masked {
    color: var(--font-muted);
    border-color: rgba(255,255,255,0.15);
}

/* State colouring, shared by the list rows and the record headline */
.health-state-bad       .health-monitor-glyph,
.health-state-bad       .health-record-glyph  { color: var(--danger-color); }
.health-state-good      .health-monitor-glyph,
.health-state-good      .health-record-glyph  { color: var(--success-color); }
.health-state-unproven  .health-monitor-glyph,
.health-state-unproven  .health-record-glyph  { color: var(--warn-color); }
.health-state-never_run .health-monitor-glyph,
.health-state-never_run .health-record-glyph,
.health-state-masked    .health-monitor-glyph,
.health-state-masked    .health-record-glyph  { color: var(--font-muted); }

/* ── Record panel ────────────────────────────────────────────── */

.health-detail {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
}

.health-record {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.health-record-headline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.health-record-glyph  { font-size: 1.3rem; }
.health-record-state  { font-size: 1rem; font-weight: 600; letter-spacing: 0.08em; }

.health-record-sev {
    font-size: 0.68rem;
    color: var(--font-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.health-record-desc {
    font-size: 0.9rem;
}

.health-record-message {
    font-size: 0.85rem;
    color: var(--font-primary-color);
    border-left: 2px solid var(--danger-border);
    padding-left: 10px;
}

.health-record-detail {
    font-size: 0.78rem;
    color: var(--font-muted);
}

.health-explainer {
    font-size: 0.8rem;
    color: var(--font-muted);
    background: var(--bg-secondary-color);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 10px 12px;
    line-height: 1.5;
}

/* ── Key/value grid ──────────────────────────────────────────── */

.health-kv-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
}

.health-kv {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 92px;
}

.health-kv-key {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--font-muted);
}

.health-kv-val {
    font-size: 0.85rem;
}

/* ── Sections ────────────────────────────────────────────────── */

.health-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.health-section-title {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--font-secondary-color);
}

.health-section-note {
    font-size: 0.78rem;
    color: var(--font-muted);
    line-height: 1.5;
}

/* ── Odometer bar ────────────────────────────────────────────── */

.health-odo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.health-odo-bar {
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}

.health-odo-fill {
    height: 100%;
    background: var(--font-secondary-color);
    transition: width 0.3s;
}

.health-odo-over { background: var(--danger-color); }

.health-odo-text {
    font-size: 0.78rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.health-odo-name { color: var(--font-muted); }

/* ── Remedy ──────────────────────────────────────────────────── */

.health-remedy-summary { font-size: 0.85rem; line-height: 1.5; }

.health-remedy-proc,
.health-remedy-docs {
    font-size: 0.78rem;
    color: var(--font-muted);
}

.health-remedy-docs {
    color: var(--font-secondary-color);
    cursor: pointer;
}

/* ── Observation history ─────────────────────────────────────── */

.health-hist {
    display: flex;
    flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
}

.health-hist-row {
    display: flex;
    gap: 10px;
    padding: 4px 0;
    font-size: 0.76rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.health-hist-time   { color: var(--font-muted); flex: 0 0 62px; }
.health-hist-status { flex: 0 0 82px; letter-spacing: 0.04em; }
.health-hist-msg    { flex: 1; min-width: 0; color: var(--font-muted); }

.health-hist-pass  .health-hist-status { color: var(--success-color); }
.health-hist-fail  .health-hist-status { color: var(--danger-color); }
.health-hist-clear .health-hist-status { color: var(--font-secondary-color); }
.health-hist-inconclusive .health-hist-status { color: var(--warn-color); }

/* ── Masked note ─────────────────────────────────────────────── */

.health-masked-note {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.health-masked-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--font-muted);
    letter-spacing: 0.06em;
}

.health-masked-body {
    font-size: 0.82rem;
    color: var(--font-muted);
    line-height: 1.55;
}

/* ── Journal ─────────────────────────────────────────────────── */

.health-journal {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.health-journal-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 14px;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Fixed left column: day label stacked over HH:MM, never shared with the body. */
.health-journal-time {
    flex: 0 0 74px;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.health-journal-date {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--font-muted);
}
.health-journal-date.is-past { color: var(--font-secondary-color); font-weight: 600; }
.health-journal-date.is-old  { color: var(--warn-color);           font-weight: 600; }
.health-journal-hm {
    color: var(--font-muted);
    font-variant-numeric: tabular-nums;
}

/* Everything else wraps within its own block, aligned to a single left edge. */
.health-journal-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}
.health-journal-type  { color: var(--font-secondary-color); }
.health-journal-code  { font-weight: 600; }
.health-journal-arrow { color: var(--font-muted); }
.health-journal-msg   { flex-basis: 100%; color: var(--font-muted); }
.health-journal-actor { color: var(--warn-color); }

.health-journal-row[data-type="health.clear"]      { background: rgba(111,189,204,0.05); }
.health-journal-row[data-type="health.transition"] { background: rgba(248,113,113,0.04); }

/* Per-row detail affordance: a quiet ⓘ that brightens on row hover, so the
   stream stays scannable but every event is one click from its full record. */
.health-journal-info {
    flex: 0 0 auto;
    align-self: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--font-muted);
    opacity: 0.35;
    transition: opacity 0.12s, color 0.12s;
}
.health-journal-row:hover .health-journal-info { opacity: 0.8; }
.health-journal-info:hover { color: var(--font-secondary-color); opacity: 1; }

/* ── Journal detail modal ────────────────────────────────────── */

.health-jd {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.health-jd-transition {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    font-family: monospace;
    font-size: 0.9rem;
}
.health-jd-from  { color: var(--font-muted); }
.health-jd-arrow { color: var(--font-muted); }
.health-jd-to    { color: var(--font-secondary-color); font-weight: 600; }

.health-jd-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.health-jd-label {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--font-muted);
}

.health-jd-text {
    font-size: 0.85rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.health-jd-empty {
    font-size: 0.82rem;
    color: var(--font-muted);
    font-style: italic;
}

.health-jd-json {
    margin: 0;
    padding: 10px 12px;
    max-height: 340px;
    overflow: auto;
    background: var(--bg-secondary-color);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre;
}

/* ── Clear modal ─────────────────────────────────────────────── */

.health-clear-modal {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.health-clear-code {
    font-size: 1rem;
    font-weight: 600;
}

.health-clear-warn {
    font-size: 0.8rem;
    color: var(--font-muted);
    line-height: 1.55;
    border-left: 2px solid var(--warn-color);
    padding-left: 10px;
}

.health-clear-actor {
    font-size: 0.78rem;
    color: var(--font-muted);
}

.health-clear-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--font-muted);
}

.health-clear-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    color: var(--font-primary-color);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 6px 2px;
}

.health-clear-input:focus {
    outline: none;
    border-bottom-color: var(--font-primary-color);
}

.health-clear-error {
    font-size: 0.78rem;
    color: var(--danger-color);
    min-height: 1em;
}

.health-clear-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.health-btn-warn {
    border-color: var(--danger-border);
    color: var(--danger-color);
}

.health-btn-warn:hover {
    border-color: var(--danger-color);
    background: rgba(248,113,113,0.12);
}

/* ── Narrow screens: stack the columns ───────────────────────── */

@media (max-width: 1100px) {
    .health-columns { flex-direction: column; overflow-y: auto; }

    .health-col {
        flex: none;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.07);
    }

    .health-monitor-list,
    .health-journal { max-height: 320px; }
}

/* console-tab.css — inline-cursor terminal, FUI aesthetic */

.console-tab-root {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #000;
    font-family: 'Courier New', 'Consolas', monospace;
    position: relative;   /* anchor for .xt-overlay */
}

/* ── Header strip ───────────────────────────────────────────── */
.console-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 14px;
    background: #050d10;
    border-bottom: 1px solid rgba(111,189,204,0.15);
    user-select: none;
}
.console-header-title {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(111,189,204,0.6);
    text-transform: uppercase;
    font-family: 'Jura', sans-serif;
}
.console-path-display {
    font-size: 0.78rem;
    color: rgba(111,189,204,0.85);
    font-family: 'Courier New', monospace;
    flex: 1;
}
.console-header-actions {
    display: flex;
    gap: 6px;
}

/* ── Terminal container ──────────────────────────────────────── */
.console-terminal-wrap {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Hidden input that summons the mobile virtual keyboard ──────
   Must NOT be display:none or visibility:hidden (unfocusable).
   font-size ≥16px prevents iOS Safari from auto-zooming on focus. ── */
.terminal-mobile-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: none;
    outline: none;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    padding: 0;
    margin: 0;
    font-size: 16px;
    z-index: -1;
}

/* ── Terminal root (injected by Terminal.js) ─────────────────── */
.terminal-root {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    cursor: text;
    /* subtle scanlines */
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0,0,0,0) 0px,
            rgba(0,0,0,0) 1px,
            rgba(0,0,0,0.03) 1px,
            rgba(0,0,0,0.03) 2px
        ),
        #000;
}

/* ── Scrolling screen ────────────────────────────────────────── */
.terminal-screen {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 10px;
    display: block;
    min-height: 0;
    word-break: break-all;
}

/* ── Output lines ────────────────────────────────────────────── */
.terminal-line {
    display: block;
    line-height: 1.55;
    font-size: 0.82rem;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 1.55em;
}

/* Line type colours */
.terminal-line.cmd-echo .terminal-text { color: rgba(111,189,204,0.9); }
.terminal-line.cmd-echo .terminal-prompt { color: rgba(111,189,204,0.5); }
.terminal-line.result   .terminal-text { color: rgba(255,255,255,0.75); }
.terminal-line.info     .terminal-text { color: rgba(255,255,255,0.6); font-style: italic; }
.terminal-line.warn     .terminal-text { color: #ccc36f; }
.terminal-line.error    .terminal-text { color: #f87171; }
.terminal-line.success  .terminal-text { color: #6fcc94; }
.terminal-line.system   .terminal-text { color: rgba(111,189,204,0.45); font-style: italic; }
.terminal-line.proc-log .terminal-text { color: rgba(204,195,111,0.75); }
.terminal-line.image    { display: block; }
.terminal-line.image .terminal-text { display: none; }
.terminal-img { max-width: 100%; max-height: 200px; margin: 4px 0; border-radius: 4px; }

.terminal-prompt {
    color: rgba(111,189,204,0.5);
    display: inline;
    margin-right: 8px;
    user-select: none;
    white-space: pre;
}

.terminal-text { display: inline; white-space: pre-wrap; }

/* JSON blocks */
.terminal-json {
    display: block;
    background: rgba(111,189,204,0.04);
    border-left: 2px solid rgba(111,189,204,0.2);
    padding: 6px 10px;
    border-radius: 0 4px 4px 0;
    margin: 2px 0;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: visible;
}

/* JSON syntax highlight token colours */
.json-key   { color: rgba(111,189,204,0.9); }     /* teal  — object keys   */
.json-str   { color: rgba(111,204,139,0.9); }     /* green — string values */
.json-num   { color: rgba(204,195,111,0.9); }     /* amber — numbers       */
.json-bool  { color: rgba(204,140,111,0.9); }     /* orange — true/false   */
.json-null  { color: rgba(180,111,204,0.8); }     /* purple — null         */
.json-punct { color: rgba(255,255,255,0.35); }    /* muted — { } [ ] : ,  */

/* ── Live input line (inline, last line of screen) ───────────── */
.terminal-input-line {
    display: block;
    line-height: 1.55;
    font-size: 0.82rem;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 1.55em;
    margin-top: 2px;
}

.terminal-input-line .terminal-prompt {
    color: rgba(111,189,204,0.65);
    display: inline;
    margin-right: 8px;
    user-select: none;
    white-space: pre;
}

.terminal-input-line .terminal-text {
    display: inline;
    color: rgba(255,255,255,0.9);
    white-space: pre-wrap;
}

/* Blinking block cursor */
.terminal-cursor {
    display: inline-block;
    background: rgba(111,189,204,0.75);
    color: #000;
    animation: terminal-blink 1.1s step-end infinite;
    min-width: 0.55em;
}

@keyframes terminal-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* Busy: cursor dims, stops blinking */
.terminal-input-line.terminal-busy .terminal-cursor {
    background: rgba(111,189,204,0.25);
    animation: none;
}

/* ── Autocomplete popup ───────────────────────────────────────── */
.terminal-ac {
    position: absolute;
    bottom: 0;
    left: 16px;
    background: #060f13;
    border: 1px solid rgba(111,189,204,0.2);
    border-radius: 5px 5px 5px 5px;
    z-index: 300;
    max-height: 180px;
    overflow-y: auto;
    min-width: 160px;
}
.terminal-ac-item {
    padding: 6px 14px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}
.terminal-ac-item:hover,
.terminal-ac-item.selected {
    background: rgba(111,189,204,0.1);
    color: var(--font-secondary-color);
}

/* ── Scrollbar ───────────────────────────────────────────────── */
.terminal-screen::-webkit-scrollbar { width: 12px; }
.terminal-screen::-webkit-scrollbar-thumb {
    background-color: #2a4a55;
    border-radius: 9999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.terminal-screen::-webkit-scrollbar-thumb:hover { background-color: #3d6a78; }
.terminal-screen::-webkit-scrollbar-track { background: #050d10; }

/* ── SSH Tunnel overlay (xterm.js) ───────────────────────────── */

/* Hidden by default — shown by adding .xt-overlay--visible */
.xt-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    background: #000;
    /* Start fully hidden — slide up from below */
    transform: translateY(100%);
    transition: transform 0.22s ease;
    pointer-events: none;
}

.xt-overlay--visible {
    transform: translateY(0);
    pointer-events: all;
}

/* ── Overlay header bar ──────────────────────────────────────── */

.xt-overlay-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    background: #050d10;
    border-bottom: 1px solid rgba(111,189,204,0.2);
    user-select: none;
}

.xt-overlay-label {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(111,189,204,0.6);
    text-transform: uppercase;
    font-family: 'Jura', sans-serif;
}

.xt-overlay-port {
    font-size: 0.78rem;
    color: rgba(111,189,204,0.85);
    font-family: 'Courier New', monospace;
}

.xt-overlay-spacer { flex: 1; }

/* ── Status dot ──────────────────────────────────────────────── */

.xt-status-dot {
    width:  8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s;
}

.xt-dot--connecting {
    background: #ccc36f;
    box-shadow: 0 0 6px rgba(204,195,111,0.6);
    animation: xt-dot-pulse 1s step-end infinite;
}

.xt-dot--connected {
    background: #6fbdcc;
    box-shadow: 0 0 6px rgba(111,189,204,0.7);
}

.xt-dot--disconnected {
    background: rgba(255,255,255,0.2);
    box-shadow: none;
}

.xt-dot--error {
    background: #f87171;
    box-shadow: 0 0 6px rgba(248,113,113,0.6);
}

@keyframes xt-dot-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── xterm.js container ──────────────────────────────────────── */

.xt-terminal-el {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 4px;
}

/* xterm.js internal overrides */
.xt-terminal-el .xterm {
    height: 100%;
}
.xt-terminal-el .xterm-viewport {
    overflow-y: scroll;
}
.xt-terminal-el .xterm-viewport::-webkit-scrollbar {
    width: 14px;
}
.xt-terminal-el .xterm-viewport::-webkit-scrollbar-thumb {
    background-color: #2a4a55;
    border-radius: 9999px;
    border: 4px solid transparent;
    background-clip: padding-box;
}
.xt-terminal-el .xterm-viewport::-webkit-scrollbar-track {
    background: #050d10;
}

/* ============================================================
   SparkyTab — Dr Sparky chat interface
   Follows AGENTS.md: dark FUI / sci-fi aesthetic
   ============================================================ */

/* ── Root layout ─────────────────────────────────────────────── */
/* display/width/height come from .tab-pane and .tab-pane.active  */
.sparky-tab {
    overflow: hidden;     /* prevent .tab-pane's overflow-y:auto from double-scrolling */
    background: var(--bg-primary-color);
}

/* ── Main content area (thread panel + chat) ─────────────────── */
.sparky-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.sparky-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Thread sidebar ──────────────────────────────────────────── */
.sparky-threads-panel {
    width: 190px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--filterbar-color);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.sparky-threads-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sparky-threads-title {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--font-muted);
    user-select: none;
}

.sparky-threads-panel .dax-btn {
    background: var(--bg-secondary-color);
    color: var(--font-primary-color);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 0.7rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.sparky-threads-panel .dax-btn:hover:not(:disabled) {
    border-color: var(--font-secondary-color);
    background: var(--fg-primary-color);
}
.sparky-threads-panel .dax-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.sparky-threads-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px 0;
}

/* ── Thread item ─────────────────────────────────────────────── */
.sparky-thread-item {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 10px;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 0.12s, border-color 0.12s;
    user-select: none;
}
.sparky-thread-item:hover {
    background: rgba(111, 189, 204, 0.05);
}
.sparky-thread-item:hover .sparky-thread-delete {
    opacity: 1;
}
.sparky-thread-item.active {
    background: rgba(111, 189, 204, 0.08);
    border-left-color: var(--font-secondary-color);
}

.sparky-thread-item-body {
    flex: 1;
    min-width: 0;
}
.sparky-thread-item-title {
    font-size: 0.75rem;
    color: var(--font-primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}
.sparky-thread-item.active .sparky-thread-item-title {
    color: var(--font-secondary-color);
}
.sparky-thread-item-meta {
    font-size: 0.62rem;
    color: var(--font-muted);
    margin-top: 2px;
    opacity: 0.75;
}

.sparky-thread-delete {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--font-muted);
    font-size: 0.6rem;
    cursor: pointer;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.12s, background 0.12s, color 0.12s;
    padding: 0;
    margin-top: 2px;
}
.sparky-thread-delete:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    opacity: 1;
}

/* ── Empty thread list ───────────────────────────────────────── */
.sparky-threads-empty {
    padding: 18px 12px;
    text-align: center;
    color: var(--font-muted);
    font-size: 0.7rem;
    opacity: 0.7;
    line-height: 1.7;
}

/* ── Header ──────────────────────────────────────────────────── */
.sparky-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: var(--bg-secondary-color);
    border-bottom: 1px solid rgba(111, 189, 204, 0.2);
    box-shadow: 0 1px 0 rgba(111, 189, 204, 0.06), inset 0 -1px 24px rgba(0, 0, 0, 0.25);
}
.sparky-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sparky-logo-mark {
    color: var(--font-secondary-color);
    font-size: 1.1rem;
    opacity: 0.9;
}
.sparky-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--font-secondary-color);
}
.sparky-header-sep {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
}
.sparky-bot-name {
    font-size: 0.8rem;
    color: var(--font-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sparky-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── dax-btn helpers (shared across tabs) ────────────────────── */
.sparky-tab .dax-btn {
    background: var(--bg-secondary-color);
    color: var(--font-primary-color);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.sparky-tab .dax-btn:hover {
    border-color: var(--font-secondary-color);
    background: var(--fg-primary-color);
}
.sparky-tab .dax-btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* ── Empty state ─────────────────────────────────────────────── */
.sparky-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--font-muted);
}
.sparky-empty-icon {
    font-size: 2.8rem;
    color: var(--font-secondary-color);
    opacity: 0.25;
    line-height: 1;
}
.sparky-empty-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--font-primary-color);
    opacity: 0.35;
}
.sparky-empty-subtitle {
    font-size: 0.8rem;
    color: var(--font-muted);
    opacity: 0.7;
}

/* ── Chat body ───────────────────────────────────────────────── */
.sparky-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;    /* subtle scanline texture — very low opacity to keep it understated */
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.018) 3px,
        rgba(0, 0, 0, 0.018) 4px
    );}

.sparky-messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 20px;
    max-width: 900px;
    margin: 0 auto;
}

/* ── User message ────────────────────────────────────────────── */
.sparky-msg-user {
    display: flex;
    justify-content: flex-end;
    margin: 6px 0;    animation: sparky-msg-in 0.2s ease both;}
.sparky-user-bubble {
    max-width: 68%;
    background: rgba(111, 189, 204, 0.1);
    border: 1px solid rgba(111, 189, 204, 0.28);
    border-radius: 12px 12px 2px 12px;
    padding: 10px 14px;
    color: var(--font-primary-color);
    font-size: 0.88rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Bot message ─────────────────────────────────────────────── */
.sparky-msg-bot {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 8px 0;
}
.sparky-bot-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(111, 189, 204, 0.08);
    border: 1px solid rgba(111, 189, 204, 0.3);
    border-radius: 50%;
    color: var(--font-secondary-color);
    font-size: 0.78rem;
    margin-top: 2px;
}
.sparky-bot-content {
    flex: 1;
    min-width: 0;
}

/* ── Thinking block ──────────────────────────────────────────── */
.sparky-thinking {
    background: var(--filterbar-color);
    border: 1px solid rgba(204, 195, 111, 0.18);
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.15s;    animation: sparky-card-in 0.2s ease both;}
.sparky-thinking:hover {
    border-color: rgba(204, 195, 111, 0.35);
}
.sparky-thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    user-select: none;
    color: var(--font-terciary-color);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}
.sparky-thinking-icon {
    font-size: 0.85rem;
    opacity: 0.8;
}
.sparky-thinking-label {
    flex: 1;
}
.sparky-thinking-toggle {
    font-size: 0.65rem;
    color: var(--font-muted);
    transition: transform 0.2s;
}
.sparky-thinking.sk-open .sparky-thinking-toggle {
    transform: rotate(180deg);
}
.sparky-thinking-body {
    display: none;
    padding: 8px 12px 10px;
    border-top: 1px solid rgba(204, 195, 111, 0.12);
    color: var(--font-muted);
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow-y: auto;
}
.sparky-thinking.sk-open .sparky-thinking-body {
    display: block;
}

/* ── Tool call block ─────────────────────────────────────────── */
.sparky-tool {
    display: flex;
    flex-direction: column;
    background: var(--fg-primary-color);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.15s;    animation: sparky-card-in 0.18s ease both;}
.sparky-tool-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    cursor: pointer;
    user-select: none;
}
.sparky-tool-icon {
    color: var(--font-secondary-color);
    font-size: 0.8rem;
    flex-shrink: 0;
}
.sparky-tool-name {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--font-secondary-color);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.02em;
}
.sparky-tool-status {
    font-size: 0.68rem;
    color: var(--font-muted);
    letter-spacing: 0.04em;
}
.sparky-tool-status.sk-running {
    color: var(--font-secondary-color);
    animation: sparky-pulse-opacity 1.5s ease-in-out infinite;
}
.sparky-tool-status.sk-done {
    color: var(--success-color);
}
.sparky-tool-status.sk-error {
    color: var(--danger-color);
}
.sparky-tool-toggle {
    font-size: 0.65rem;
    color: var(--font-muted);
    transition: transform 0.2s;
}
.sparky-tool.sk-open .sparky-tool-toggle {
    transform: rotate(180deg);
}
.sparky-tool-detail {
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.sparky-tool.sk-open .sparky-tool-detail {
    display: block;
}
.sparky-tool-section {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.sparky-tool-section:last-child {
    border-bottom: none;
}
.sparky-tool-section-label {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--font-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
}
.sparky-tool-section pre {
    margin: 0;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    color: var(--font-primary-color);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 8px 10px;
}
.sparky-tool-section pre.sk-error-pre {
    color: var(--danger-color);
}

/* ── Response text block ─────────────────────────────────────── */
.sparky-text {
    color: var(--font-primary-color);
    font-size: 0.88rem;
    line-height: 1.7;
    word-break: break-word;
}
.sparky-text p { margin: 0 0 0.75em; }
.sparky-text p:last-child { margin-bottom: 0; }
.sparky-text strong { color: var(--font-secondary-color); font-weight: 600; }
.sparky-text em { color: var(--font-muted); font-style: italic; }
.sparky-text code {
    font-family: 'Courier New', monospace;
    font-size: 0.82em;
    background: rgba(111, 189, 204, 0.1);
    border: 1px solid rgba(111, 189, 204, 0.15);
    border-radius: 3px;
    padding: 1px 5px;
    color: var(--font-secondary-color);
}
.sparky-text pre {
    background: #050b0e;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 10px 0;
}
.sparky-text pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--font-primary-color);
    font-size: 0.82rem;
}
.sparky-text ul, .sparky-text ol {
    padding-left: 1.5em;
    margin: 0 0 0.75em;
}
.sparky-text li { margin-bottom: 0.25em; }
.sparky-text h1, .sparky-text h2, .sparky-text h3 {
    color: var(--font-secondary-color);
    font-weight: 600;
    letter-spacing: 0.03em;
    margin: 1em 0 0.4em;
}
.sparky-text h1 { font-size: 1.1rem; }
.sparky-text h2 { font-size: 1rem; }
.sparky-text h3 { font-size: 0.9rem; }
.sparky-text blockquote {
    border-left: 3px solid rgba(111, 189, 204, 0.4);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--font-muted);
}
.sparky-text a {
    color: var(--font-secondary-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(111, 189, 204, 0.3);
}
.sparky-text a:hover {
    border-color: var(--font-secondary-color);
}
.sparky-text hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 12px 0;
}

/* ── Token usage badge ───────────────────────────────────────── */
.sparky-usage {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    font-size: 0.65rem;
    color: var(--font-muted);
    letter-spacing: 0.04em;
}
.sparky-usage-sep { opacity: 0.4; }

/* ── Error block ─────────────────────────────────────────────── */
.sparky-error-block {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: 6px;
    margin: 6px 0;
    color: var(--danger-color);
    font-size: 0.83rem;
}
.sparky-error-icon { flex-shrink: 0; }

/* ── Typing indicator ────────────────────────────────────────── */
.sparky-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 0 4px;
}
.sparky-typing span {
    width: 5px;
    height: 5px;
    background: var(--font-secondary-color);
    border-radius: 50%;
    opacity: 0.5;
    animation: sparky-dot-bounce 1.3s ease-in-out infinite;
}
.sparky-typing span:nth-child(2) { animation-delay: 0.18s; }
.sparky-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes sparky-dot-bounce {
    0%, 80%, 100% { opacity: 0.4; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-4px); }
}

/* ── Input area ──────────────────────────────────────────────── */
.sparky-input-row {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-secondary-color);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}
/* Full-width wrapper so border-top spans the full viewport */
.sparky-input-wrap {
    flex-shrink: 0;
    background: var(--bg-secondary-color);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
}
.sparky-input {
    flex: 1;
    background: var(--fg-primary-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--font-primary-color);
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.5;
    resize: none;
    overflow-y: hidden;
    min-height: 42px;
    max-height: 180px;
    overflow-y: auto;
    transition: border-color 0.15s;
    outline: none;
}
.sparky-input::placeholder {
    color: var(--font-muted);
}
.sparky-input:focus {
    border-color: rgba(111, 189, 204, 0.45);
}
.sparky-send-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    background: rgba(111, 189, 204, 0.1);
    border: 1px solid rgba(111, 189, 204, 0.28);
    border-radius: 8px;
    color: var(--font-secondary-color);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}
.sparky-send-btn:hover:not(:disabled) {
    background: rgba(111, 189, 204, 0.2);
    border-color: var(--font-secondary-color);
}
.sparky-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
/* Stop mode — shown while streaming */
.sparky-send-btn.sk-stop-mode {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.4);
    color: #f87171;
}
.sparky-send-btn.sk-stop-mode:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: #f87171;
}

/* ── Divider between turns ───────────────────────────────────── */
.sparky-turn-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    color: rgba(255,255,255,0.1);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
}
.sparky-turn-divider::before,
.sparky-turn-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

/* ── Welcome banner ──────────────────────────────────────────── */
.sparky-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 20px 18px;
    color: var(--font-muted);
    font-size: 0.78rem;
    text-align: center;
    opacity: 0.7;
}
.sparky-welcome-title {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--font-secondary-color);
    opacity: 1;
}

/* ── Streaming cursor ─────────────────────────────────────── */
/* Injected inline just before the last closing tag each drip tick,
   so it always appears at the end of the current text line. */
.sk-cursor {
    display: inline;
    color: var(--font-secondary-color);
    font-size: 0.9em;
    line-height: 1;
    margin-left: 1px;
    vertical-align: baseline;
    user-select: none;
    animation: sparky-cursor-blink 1.0s step-end infinite;
}

@keyframes sparky-cursor-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ── Message & card entry animations ──────────────────────── */
@keyframes sparky-msg-in {
    from { opacity: 0; transform: translateY(7px); }
    to   { opacity: 1; transform: translateY(0);   }
}
@keyframes sparky-card-in {
    from { opacity: 0; transform: translateX(-3px); }
    to   { opacity: 1; transform: translateX(0);    }
}

/* ── Pulse animation (reusable) ──────────────────────────────── */
@keyframes sparky-pulse-opacity {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 1; }
}

/* ── Shell command approval card ─────────────────────────────── */
.sparky-shell-approval {
    margin: 8px 0;
    border: 1px solid rgba(204, 163, 111, 0.3);   /* amber accent — danger signal */
    border-radius: 6px;
    background: rgba(204, 163, 111, 0.04);
    font-size: 0.8rem;
    overflow: hidden;
    transition: border-color 0.15s;
}
.sparky-shell-approval.sk-resolved {
    border-color: rgba(255, 255, 255, 0.1);
    background: transparent;
    opacity: 0.8;
}

.sparky-shell-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    background: rgba(204, 163, 111, 0.07);
    border-bottom: 1px solid rgba(204, 163, 111, 0.15);
}
.sparky-shell-approval.sk-resolved .sparky-shell-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.sparky-shell-icon {
    color: var(--font-terciary-color);
    font-size: 0.85rem;
    opacity: 0.9;
}
.sparky-shell-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--font-terciary-color);
    flex: 1;
}

/* Approval badge — reuses sk-* state classes from .sparky-tool */
.sparky-shell-badge {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 1px 7px;
    border-radius: 3px;
    border: 1px solid;
}
.sparky-shell-badge.sk-pending {
    color: var(--font-terciary-color);
    border-color: rgba(204, 163, 111, 0.4);
    background: rgba(204, 163, 111, 0.08);
}
.sparky-shell-badge.sk-running {
    color: var(--font-secondary-color);
    border-color: rgba(111, 189, 204, 0.4);
    background: rgba(111, 189, 204, 0.08);
    animation: sparky-pulse-opacity 1.2s ease-in-out infinite;
}
.sparky-shell-badge.sk-done {
    color: #6fbdcc;
    border-color: rgba(111, 189, 204, 0.35);
    background: rgba(111, 189, 204, 0.08);
}
.sparky-shell-badge.sk-error {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.08);
}
.sparky-shell-badge.sk-blocked {
    color: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.12);
    background: transparent;
}

.sparky-shell-body {
    padding: 10px 12px 12px;
}
.sparky-shell-section-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 5px;
}
.sparky-shell-pre {
    margin: 0 0 12px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(204, 163, 111, 0.15);
    border-radius: 4px;
    color: var(--font-terciary-color);
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-all;
}
.sparky-shell-approval.sk-resolved .sparky-shell-pre {
    color: var(--font-muted);
    border-color: rgba(255, 255, 255, 0.06);
}

.sparky-shell-actions {
    display: flex;
    gap: 8px;
}
.sparky-shell-btn {
    padding: 5px 14px;
    border-radius: 4px;
    font-family: scifi, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}
.sparky-shell-approve {
    background: rgba(111, 189, 204, 0.08);
    border: 1px solid rgba(111, 189, 204, 0.35);
    color: var(--font-secondary-color);
}
.sparky-shell-approve:hover:not(:disabled) {
    background: rgba(111, 189, 204, 0.18);
    border-color: var(--font-secondary-color);
}
.sparky-shell-block {
    background: rgba(248, 113, 113, 0.06);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #f87171;
}
.sparky-shell-block:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.15);
    border-color: #f87171;
}
.sparky-shell-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Hide the action buttons once resolved (keep layout tidy) */
.sparky-shell-approval.sk-resolved .sparky-shell-actions {
    display: none;
}

/* ── Documentation refresh progress card ──────────────────────────────── */

.sparky-docs-progress {
    background: var(--bg-secondary-color);
    border: 1px solid rgba(111, 189, 204, 0.18);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 4px 0 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.25s, opacity 0.25s;
}

.sparky-docs-progress.sk-resolved {
    border-color: rgba(111, 189, 204, 0.08);
    opacity: 0.55;
}

.sparky-docs-progress.sk-error {
    border-color: rgba(248, 113, 113, 0.35);
}

.sparky-docs-progress-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sparky-docs-progress-icon {
    color: var(--font-secondary-color);
    font-size: 0.85rem;
    opacity: 0.8;
    animation: sk-spin 1.4s linear infinite;
}
.sparky-docs-progress.sk-resolved .sparky-docs-progress-icon,
.sparky-docs-progress.sk-error    .sparky-docs-progress-icon {
    animation: none;
}

@keyframes sk-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.sparky-docs-progress-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--font-secondary-color);
    flex: 1;
}

.sparky-docs-progress-badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--font-muted);
    background: rgba(255, 255, 255, 0.04);
}
.sparky-docs-progress-badge.sk-downloading,
.sparky-docs-progress-badge.sk-extracting {
    border-color: rgba(111, 189, 204, 0.4);
    color: var(--font-secondary-color);
    background: rgba(111, 189, 204, 0.08);
}
.sparky-docs-progress-badge.sk-done {
    border-color: rgba(74, 222, 128, 0.4);
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
}
.sparky-docs-progress-badge.sk-error {
    border-color: rgba(248, 113, 113, 0.4);
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
}

.sparky-docs-progress-message {
    font-size: 0.8rem;
    color: var(--font-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress track */
.sparky-docs-progress-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 9999px;
    overflow: hidden;
}

.sparky-docs-progress-fill {
    height: 100%;
    width: 0;
    background: var(--font-secondary-color);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Indeterminate shimmer when total bytes are unknown */
.sparky-docs-progress-fill.sparky-docs-indeterminate {
    width: 40% !important;
    animation: sk-docs-shimmer 1.4s ease-in-out infinite;
}

@keyframes sk-docs-shimmer {
    0%   { margin-left: -40%; }
    100% { margin-left: 100%; }
}

/* Warning one-liner (no creds configured) */
.sparky-docs-progress-warning {
    font-size: 0.78rem;
    color: var(--font-terciary-color);
    padding: 6px 10px;
    background: rgba(204, 195, 111, 0.06);
    border: 1px solid rgba(204, 195, 111, 0.18);
    border-radius: 5px;
    margin: 4px 0;
}

/* ── Thread panel toggle (mobile only) ───────────────────────── */
.sparky-threads-toggle {
    display: none; /* shown via media query on mobile */
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 2px;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    color: var(--font-muted);
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
    user-select: none;
}
.sparky-threads-toggle:hover,
.sparky-threads-toggle.sk-active {
    border-color: var(--font-secondary-color);
    color: var(--font-secondary-color);
}

/* Backdrop — hidden on desktop, used by mobile drawer */
.sk-thread-backdrop {
    display: none;
}

/* ── Mobile responsive (≤ 640px) ──────────────────────────────── */
@media (max-width: 640px) {

    /* Show the toggle button */
    .sparky-threads-toggle {
        display: flex;
    }

    /* Thread panel becomes a slide-in left drawer */
    .sparky-threads-panel {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 20;
        width: 230px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }
    .sparky-main.sk-threads-open .sparky-threads-panel {
        transform: translateX(0);
    }

    /* Backdrop behind the drawer */
    .sk-thread-backdrop {
        position: absolute;
        inset: 0;
        z-index: 19;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(1px);
        display: none;
    }
    .sparky-main.sk-threads-open .sk-thread-backdrop {
        display: block;
    }

    /* sparky-main needs position:relative for absolute children */
    .sparky-main {
        position: relative;
    }

    /* Thread delete — always visible on touch screens */
    .sparky-thread-delete {
        opacity: 1;
    }

    /* Tighten up header */
    .sparky-title,
    .sparky-header-sep {
        display: none;
    }
    .sparky-bot-name {
        max-width: 140px;
    }
    .sparky-header {
        padding: 8px 12px;
    }

    /* Reduce message area padding */
    .sparky-messages {
        padding: 0 10px;
    }

    /* Wider user bubbles */
    .sparky-user-bubble {
        max-width: 85%;
    }

    /* Tighten input row */
    .sparky-input-row {
        padding: 10px 12px;
    }

    /* Shrink avatar a touch on small screens */
    .sparky-bot-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.68rem;
    }
    .sparky-msg-bot {
        gap: 8px;
    }
}
