
.help-tooltip {
    position: absolute;
    right: 0;
    left: auto;
    bottom: calc(100% + 10px);

    width: min(320px, calc(100vw - 32px));
    padding: 12px 14px;

    background: #1d2430;
    border: 1px solid rgba(110,160,255,.25);
    border-radius: 12px;
    color: #d8e3f5;

    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;

    box-shadow:
        0 10px 30px rgba(0,0,0,.45),
        inset 0 1px rgba(255,255,255,.04);

    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease;

    pointer-events: none;
    z-index: 100000;
    white-space: normal;
}

.help-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 12px;

    border: 8px solid transparent;
    border-top-color: #1d2430;
}

.help:hover .help-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.help.tooltip-left .help-tooltip {
    left: 0;
    right: auto;
}

.help.tooltip-left .help-tooltip::after {
    left: 12px;
    right: auto;
}
/* Base blink: brief glow + slight color pop */
@keyframes fftBlink {
  0%   { background-color: rgba(255,255,255,0.00); }
  20%  { background-color: rgba(255,255,255,0.10); }
  100% { background-color: rgba(255,255,255,0.00); }
}

@keyframes fftBlinkGreen {
  0%   { color: inherit; text-shadow: none; }
  20%  { color: #4ade80; text-shadow: 0 0 10px rgba(74, 222, 128, 0.65); }
  100% { color: inherit; text-shadow: none; }
}

@keyframes fftBlinkRed {
  0%   { color: inherit; text-shadow: none; }
  20%  { color: #fb7185; text-shadow: 0 0 10px rgba(251, 113, 133, 0.65); }
  100% { color: inherit; text-shadow: none; }
}

@keyframes fftBlinkBlue {
  0%   { color: inherit; text-shadow: none; }
  20%  { color: #60a5fa; text-shadow: 0 0 10px rgba(96, 165, 250, 0.65); }
  100% { color: inherit; text-shadow: none; }
}

.fft-blink       { animation: fftBlink 420ms ease-out; }
.fft-blink-up    { animation: fftBlinkGreen 520ms ease-out; }
.fft-blink-down  { animation: fftBlinkRed 520ms ease-out; }
.fft-blink-info  { animation: fftBlinkBlue 520ms ease-out; }

/* ================== BASE ================== */
:root {
  --bg: #1f2430;
  --surface: #2a2f3b;
  --header: #1b2d41;
  --border: #394257;
  --text: #e9eef6;
  --muted: #c0c7d7;
  --blue: #2b6cb0;
  --blue-hover: #2f7ac6;
  --danger: #c53030;
  --danger-hover: #e03131;
  --success: #238636;
  --success-hover: #2ea043;
  --shadow: rgba(0,0,0,0.45);
}

body {
  font-family: 'Montserrat', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 20px;
}

/* ================== HEADER ================== */
header {
  display: flex;
  align-items: center;
  background-color: var(--header);
  color: #fff;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

header img {
  height: 40px;
  margin-right: 12px;
}

header h1 {
  font-size: 1.5rem;
  margin: 0;
  color: #fff;
}

header button {
  margin-left: auto;
  background-color: var(--success);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
}
header button:hover { background-color: var(--success-hover); }

/* ================== TYPOGRAPHY ================== */
h2, h3 { color: #fff; }
label {
  display: inline-block;
  font-weight: 600;
  margin-top: 5px;
  width: 25%;
  color: var(--muted);
}

/* ================== CONTROLS (STICKY BAR) ================== */
.controls {
  margin: 20px 0;
  padding: 1rem;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 2px 5px var(--shadow);
  border: 1px solid var(--border);
  border-radius: 8px;
}

select, input {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  padding: 10px;
  margin: 4px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.35);
}

/* ================== BUTTONS ================== */
button, .btn {
  background-color: var(--header);
  color: #fff;
  border: none;
  cursor: pointer;
  text-align: center;
  padding: 10px 20px;
  border-radius: 6px;
  display: inline-block;
  transition: background-color .15s ease;
}
button:hover, .btn:hover { background-color: #34495e; }



.btn-primary {
  background: var(--blue);
}
.btn-primary:hover { background: var(--blue-hover); }

.btn-danger {
  background: var(--danger);
}
.btn-danger:hover { background: var(--danger-hover); }

/* ================== LAYOUT / DASHBOARD ================== */
.layout-container {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.main-grid {
  flex: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.right-pane {
  flex: 1;
  background: var(--header);
  padding: 0px 10px 10px;
  border-left: 2px solid #555;
  border-radius: 8px;
  /* max-height: 1858px; */
  overflow-y: auto;
}

/* Grid variant */
.dashboard {
  grid-template-rows: auto 1fr;
  grid-template-columns: 2fr 1fr;
  grid-template-areas:
    "top top"
    "main right";
}

.top-pane,
.main-grid,
.right-pane {
  background-color: transparent;
  padding: 0px 10px 10px;
  border-radius: 10px;
}

.top-pane {
  grid-area: top;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  min-height: 320px;
  background-color: var(--header);
}


/* ================== CHART BLOCKS ================== */
.chart-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin: 10px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  min-width: 300px;
  flex: 1 1 auto;
  cursor: move; /* if draggable */
}

.chart-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin: 10px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  min-width: 300px;
  flex: 1 1 auto;
  cursor: move; /* if draggable */
}
/* Default (mobile / small screens) */
@media (max-width: 900px){
    .chart-block #fft {
      min-height: 350px !important; /* default height for mobile */
    }
}

@media (min-width: 1200px) {
    .chart-block #fft {
     min-height: 520px;
     }
 }

/* Alternate / legacy chart style override */
.chart-block.alt {
  background: var(--header);
  border-radius: 8px;
  padding: 10px;
  margin-right: 10px;
  box-shadow: 0 0 8px #000;
}



/* ================== PLOT & FAIL PANES ================== */
#plotPane {
  flex: 3;
  background: #000;
  padding: 10px;
  border-radius: 8px;
}

#waveform {
  background: #000;
  border-radius: 8px;
}

#failPane {
  flex: 1;
  margin-left: 10px;
  padding: 10px;
  border-left: 2px solid #555;
  background: #2c2c2c;
  height: 500px;
  overflow-y: auto;
}

.fail-entry {
  color: #ff5c5c;
  font-size: 12px;
  font-family: monospace;
}

/* ================== TOOLING / ADD MENU ================== */
.add-chart-box {
  padding: 10px;
  text-align: center;
  color: #ccc;
}

.add-tooltip {
  background: #222;
  border: 1px solid #666;
  padding: 8px;
  position: absolute;
  z-index: 1000;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}

.add-tooltip button {
  background: #333;
  border: 1px solid #666;
  padding: 5px 10px;
  width: 100%;
  color: #eee;
  margin-bottom: 4px;
  cursor: pointer;
  border-radius: 6px;
}
.add-tooltip button:hover { background: #3a3a3a; }

/* ================== FLOATING PANEL ================== */
.floating-panel {
  position: absolute;
  top: 10%;
  right: 5%;
  width: 240px;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  z-index: 999;
  font-family: sans-serif;
  overflow: hidden;
}

.floating-panel-top-violation {
 position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
   background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  z-index: 999;
  font-family: sans-serif;
  overflow: hidden;

    width: 320px; max-width: 92vw;
    background: var(--bg); color: var(--text);
    border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    padding: 14px 14px 16px 14px;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

    /* draggable centering */
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--header);
  color: #fff;
  padding: 10px 12px;
  font-weight: bold;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.close-btn {
  background: #1f2b3a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
}
.close-btn:hover { background: #3c4d63; }

.panel-body { padding: 15px; }
.section { margin-bottom: 16px; }

.section-title {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.export-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 12px;
  background-color: #2b4a67;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
}
.export-btn:hover { background-color: #3c6387; }

.full-width { width: 100%; }

/* ================== LOADER / SPLASH ================== */
#loader-container {
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#loader {
  border: 8px solid rgba(255,255,255,0.12);
  border-top: 8px solid var(--blue);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

#loading-text {
  font-family: Arial, sans-serif;
  font-size: 18px;
  color: var(--text);
  opacity: 0.9;
}

#content {
  display: none;
  text-align: center;
  padding-top: 100px;
  font-family: sans-serif;
  color: var(--text);
}

/* ================== DIALOG (kept consistent) ================== */
.dlg-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.hidden { display: none; }

.dlg-card {
  width: 320px; max-width: 92vw;
  background: var(--bg); color: var(--text);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  padding: 14px 14px 16px 14px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* draggable centering */
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.dlg-header {
 /* display: flex; */
 align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 16px; margin-bottom: 10px;
  cursor: move;
}
.dlg-close {
  background: transparent; color: #cfd6e6; border: 0; font-size: 20px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.dlg-close:hover { color: #fff; }

.dlg-section { margin-top: 10px; }
.dlg-subtitle { color: #aab3c5; font-size: 12px; margin: 6px 0 8px; }

.dlg-btn {
  width: 100%; border: 0; border-radius: 8px; padding: 10px 12px;
  font-weight: 700; cursor: pointer; margin: 6px 0; transition: transform .03s ease;
}
.dlg-danger  { background: var(--danger); color: #fff; }
.dlg-danger:hover { background: var(--danger-hover); }

.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.dlg-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
.dlg-item {
  background: var(--surface); border-radius: 8px; padding: 10px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
}
.dlg-item .meta { font-size: 12px; color: var(--muted); }
.dlg-item .strong { font-weight: 700; color: #fff; }
.dlg-item .pill {
  background: var(--danger); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 12px;
}
.dlg-actions { display: flex; gap: 6px; }
.dlg-mini {
  background: #394257; color: var(--text); border: 0; border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px; cursor: pointer;
}
.dlg-mini:hover { background: #445172; }

/* ================== FOOTER ================== */
footer {
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

footer a {
  color: #9cf;
  text-decoration: none;
  margin: 0 6px;
}
footer a:hover { text-decoration: underline; }
/* ---- Controls Bar Fixes ---- */
.controls {
  /* layout */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: center;
  gap: 12px 16px;

  /* appearance */
  background: var(--surface, #2a2f3b);
  border: 1px solid var(--border, #394257);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}

/* Label + field rows */
.controls .field {
  display: grid;
  #grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}
.controls .field > label {
  color: var(--muted, #c0c7d7);
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

/* Compact inline groups (buttons next to selects) */
.controls .inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Inputs & selects: consistent size/contrast */
.controls select,
.controls input[type="text"],
.controls input[type="number"],
.controls input[type="search"] {
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #394257);
  background: var(--bg, #1f2430);
  color: var(--text, #e9eef6);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  min-width: 160px;
}
.controls select:focus,
.controls input:focus {
  border-color: var(--blue, #2b6cb0);
  box-shadow: 0 0 0 2px rgba(43,108,176,.35);
}
.controls select::placeholder,
.controls input::placeholder {
  color: #98a3b7;
  opacity: .8;
}

/* Button system */
.controls .btn,
.controls button {
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
 <!--  display: inline-flex; -->
  align-items: center;
  gap: 8px;
  user-select: none;
}

/* Variants */
.btn-primary { background: var(--blue, #2b6cb0); color: #fff; }
.btn-primary:hover { background: var(--blue-hover, #2f7ac6); }

.btn-danger { background: var(--danger, #c53030); color: #fff; }
.btn-danger:hover { background: var(--danger-hover, #e03131); }

.btn-ghost {
  background: transparent;
  color: var(--text, #e9eef6);
  border-color: var(--border, #394257);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); }

.btn-dark {
  background: #223041;
  color: #e9eef6;
}
.btn-dark:hover { background: #2a3a4f; }
/* ===== Professional Controls Layout ===== */
.controls {
  display: grid;
  grid-template-columns: 1fr 320px;  /* left grid + right sidebar */
  gap: 16px;
  align-items: start;

  background: var(--surface, #2a2f3b);
  border: 1px solid var(--border, #394257);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 5px rgba(0,0,0,.35);
}

/* LEFT grid: three tidy columns, wraps responsively */
.controls-left {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px 16px;
  align-items: center;
}

/* RIGHT sidebar: stacked cards */
.controls-right {
  display: grid;
  grid-auto-rows: min-content;
  gap: 12px;
  padding-left: 6px; /* slight separation from border */
}

/* Fields */
.field {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px;
  align-items: center;
  min-width: 240px;
}
.field.stacked { grid-template-columns: 1fr; }
.field > label {
  color: var(--muted, #c0c7d7);
  font-weight: 700;
  white-space: nowrap;
}

/* Inline rows (buttons/selects on one line) */
.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.inline.stacked { flex-direction: column; align-items: stretch; gap: 10px; }
.inline .row { display: flex; gap: 8px; }
.inline .grow { flex: 1 1 auto; min-width: 140px; }


.btn-primary { background: var(--blue, #2b6cb0); color: #fff; }
.btn-primary:hover { background: var(--blue-hover, #2f7ac6); }
.btn-dark { background: #223041; color: #e9eef6; }
.btn-dark:hover { background: #2a3a4f; }
.btn-ghost { background: transparent; color: var(--text, #e9eef6); border: 1px solid var(--border, #394257); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.full { width: 100%; }

/* Dropdown arrow color (WebKit) */
.controls select {
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #9db6d8 50%),
    linear-gradient(135deg, #9db6d8 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) 16px,
    calc(100% - 12px) 16px,
    100% 0;
  background-size: 6px 6px, 6px 6px, 2.5rem 100%;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}

/* Responsive tweaks */
@media (max-width: 1200px) {
  .controls { grid-template-columns: 1fr 300px; }
  .controls-left { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .chart-block #fft {
          min-height: 350px;!important;
      }
}
@media (max-width: 900px) {
  .controls { grid-template-columns: 1fr; }
  .controls-right { padding-left: 0; }
  .field { grid-template-columns: 150px 1fr; }
  .chart-block #fft {
          min-height: 350px;!important;
      }
}
/* layout container */
.controls {
  display: grid;
  grid-template-columns: 1fr 340px; /* left grid + right stack */
  gap: 16px;
  align-items: start;
}

/* left side: two tidy columns */
.controls-left {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 12px 18px;
}

/* make an item span both columns when needed */
.span-2 { grid-column: 1 / -1; }

/* right side stack */
.controls-right {
  display: grid;
  gap: 12px;
}

.controls-right .row {
  display: flex; gap: 8px; align-items: center;
}
.controls-right .grow { flex: 1 1 auto; }

/* labels a touch lighter and aligned */
.field { display: grid; grid-template-columns: 200px 1fr; gap: 10px; align-items: center; }
.field.stacked { grid-template-columns: 1fr; }
.field > label { font-weight: 700; color: var(--muted, #c0c7d7); white-space: nowrap; }

/* keep all controls same height */
.controls select,
.controls input { height: 38px; }




/* Collapsible controls wrapper */
.controls-wrapper {
  margin-bottom: 10px;
}

/* collapse button */
.collapse-btn {
  background: #1b2d41;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}

.collapse-btn:hover {
  background: #34495e;
}

/* hidden state */
#controlsPanel.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

/* expanded state */
#controlsPanel {
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

/* hidden state */
#controlsPanelTopViolations.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

/* expanded state */
#controlsPanelTopViolations {
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

/* Toolbar outside the inner card */
.controls-toolbar {
  /* visually dock to the controls panel */
  background: var(--surface, #2a2f3b);
  border: 1px solid var(--border, #394257);
  border-top: none;                     /* join with the panel edge */
  border-radius: 0 0 12px 12px;         /* rounded bottom only */
  padding: 12px 16px;

  display: flex;
  gap: 8px;
  align-items: center;

  /* line up with the panel width */
  width: 100%;
  box-sizing: border-box;

  /* subtle depth like the panel */
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
}

/* Keep buttons tidy on narrow screens */
@media (max-width: 720px) {
  .controls-toolbar { flex-wrap: wrap; }
}

/* === FINAL DASHBOARD LAYOUT (authoritative) === */
#dashboard{
  display:grid;
  grid-template-columns:minmax(0,2fr) minmax(0,1fr); /* Left | Right */
  gap:16px;
  align-items:start;
  grid-auto-flow:row;
}

/* Top plot spans both columns */
.top-pane{ grid-column:1 / -1; padding:10px; background:var(--header); }

/* Lock panes into columns; prevent overflow from forcing wraps */
#dashboard > .left-pane{
  grid-column:1;
  display:grid;
  gap:16px;
  min-width:0;
}
#dashboard > .right-pane{
  grid-column:2;
  display:grid !important;        /* override any earlier display */
  min-width:0;
}

/* If the loader lives inside #dashboard, keep it full-width */
#dashboard > #loader-container{ grid-column:1 / -1; }

/* One-column on smaller screens */
@media (max-width:1024px){
  #dashboard{ grid-template-columns:1fr; }
  #dashboard > .right-pane{ grid-column:1; }
}

/* Plot containers fill cards */
#fft,#waveform,#phase,#groupDelay,#spectrogram,#spatial{
  width:100% !important;
  height:clamp(240px,38vh,620px) !important;
}

/* Drag affordances (works with Sortable handle:'h3') */
.chart-block{ cursor:grab; }
.chart-block h3{ user-select:none; cursor:grab; }
.sortable-ghost{ opacity:.35; }
.sortable-chosen{ box-shadow:0 0 0 2px rgba(43,108,176,.6) inset; border-radius:8px; }


.fft-info-card {
  margin-top: 10px;
  background: var(--panel-bg, #202530);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.fft-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.fft-info-body {
  font-family: monospace;
  font-size: 13px;
  line-height: 1.4em;
}

.hidden { display: none; }

.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
}
.switch input { display: none; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #555;
  border-radius: 18px;
  transition: .3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px; width: 14px;
  left: 2px; bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}
input:checked + .slider {
  background-color: #0ae;
}
input:checked + .slider:before {
  transform: translateX(16px);
}
.label-text {
  font-size: 12px;
  color: #aaa;
  margin-left: 4px;
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
  width: 14px; /* wider than default 10px */
}

::-webkit-scrollbar-track {
  background: #1c222d; /* deep navy-gray background */
}

::-webkit-scrollbar-thumb {
  background-color: #2b2f3a; /* slate thumb */
  border-radius: 8px;
  border: 3px solid #1c222d; /* keeps inset look */
}

::-webkit-scrollbar-thumb:hover {
  background-color: #3a404d; /* slightly lighter on hover */
}

/* Firefox */
* {
  scrollbar-width: auto;          /* enables slightly wider look */
  scrollbar-color: #2b2f3a #1c222d;
}


.top-pane {
    display: grid;
    grid-template-columns: 1fr;
}

.top-pane > .chart-block {
    width: 100%;
    max-width: none;
}


#topPane #fft,
#topPane #waveform,
#topPane #sweepChart,
#topPane #spectrogram {
  width: 100% !important;
  min-height: 320px;
}

    .top-offenders-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 12px 0 4px;
}

.top-offenders-pagination button {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #244766;
  background: #0b2a44;
  color: #fff;
  cursor: pointer;
}

.top-offenders-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.npu-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.npu-pagination button {
  padding: 4px 10px;
  cursor: pointer;
}

    .offenders-card {
  background: #111827;
  border: 1px solid #273244;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

.offenders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #e5e7eb;
}

.offenders-table th {
  background: #1f2937;
  color: #9ca3af;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #374151;
}

.offenders-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(55,65,81,.55);
}

.offender-row:hover {
  background: rgba(59,130,246,.08);
}

.rank {
  color: #93c5fd;
  font-weight: 700;
}

.type-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #243044;
  color: #dbeafe;
  font-weight: 700;
  font-size: 11px;
}

.ai-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-label {
  font-weight: 700;
}

.confidence {
  padding: 2px 6px;
  border-radius: 999px;
  background: #0f172a;
  color: #cbd5e1;
  font-size: 11px;
}

.margin-bad {
  color: #ff4d4f;
  font-weight: 800;
}

.margin-good {
  color: #22c55e;
  font-weight: 800;
}

.reason-row td {
  padding-top: 0;
  color: #9ca3af;
  font-size: 11px;
  line-height: 1.4;
  border-bottom: 1px solid rgba(55,65,81,.75);
}



        #analyzeReplayFloatingBanner {
            position: fixed !important;
            cursor: grab;
            user-select: none;
            touch-action: none;
        }

        #analyzeReplayFloatingBanner.dragging {
            cursor: grabbing;
        }
        .pager-btn {
            background: #334155;
            color: #fff;
            border: 0;
            border-radius: 6px;
            padding: 8px 10px;
            font-weight: 700;
            cursor: pointer;
        }

        .pager-btn:disabled {
            opacity: 0.8;
            cursor: default;
        }

        .pager-select {
            background: #334155;
            color: #fff;
            border: 0;
            border-radius: 6px;
            padding: 8px 10px;
        }
        .toggle {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
            color: #cbd5f5;
            cursor: pointer;
        }

        .toggle input {
            display: none;
        }

        .slider {
            position: relative;
            width: 38px;
            height: 20px;
            background: #374151;
            border-radius: 20px;
            transition: all 0.25s ease;
            box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
        }

        .slider::before {
            content: "";
            position: absolute;
            width: 16px;
            height: 16px;
            left: 2px;
            top: 2px;
            background: #e5e7eb;
            border-radius: 50%;
            transition: all 0.25s ease;
        }

        /* ON state */
        .toggle input:checked + .slider {
            background: linear-gradient(90deg, #3b82f6, #22c55e);
            box-shadow: 0 0 6px rgba(59,130,246,0.6);
        }

        .toggle input:checked + .slider::before {
            transform: translateX(18px);
            background: #ffffff;
        }

        /* hover effect */
        .toggle:hover .slider {
            box-shadow: 0 0 8px rgba(59,130,246,0.4);
        }

        .hoverlayer .hovertext {
            box-shadow: none !important;
            border-radius: 6px !important;
        }
        #block-phase,
        #block-groupDelay {
            min-height: 420px;
            display: flex;
            flex-direction: column;
        }

        #block-phase #phase,
        #block-groupDelay #groupDelay {
            width: 100% !important;
            height: clamp(320px, 42vh, 620px) !important;
            min-height: 320px !important;
            flex: 1 1 auto;
        }
        #measureFocusedChart {
            border-radius: 14px;
            overflow: hidden;
            background:
                    radial-gradient(1200px 280px at 50% -20%, rgba(88,130,255,0.12), transparent 60%),
                    linear-gradient(180deg, #0b1426 0%, #08111c 100%);
            box-shadow:
                    inset 0 1px 0 rgba(255,255,255,0.04),
                    inset 0 0 0 1px rgba(255,255,255,0.05),
                    0 10px 30px rgba(0,0,0,0.35);
        }
        .measure-focused-shell {
            padding: 10px 12px 12px;
            border-radius: 14px;
            background: linear-gradient(180deg, rgba(19,30,52,0.96), rgba(11,18,34,0.98));
            border: 1px solid rgba(120,160,220,0.14);
            box-shadow:
                    inset 0 1px 0 rgba(255,255,255,0.03),
                    0 16px 34px rgba(0,0,0,0.28);
        }

        .measure-focused-chart {
            width: 100%;
            min-height: 360px;
            height: clamp(340px, 42vh, 520px);
            border-radius: 12px;
            overflow: hidden;
        }

        .measure-toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 12px;
        }

        .measure-toolbar label {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            border-radius: 10px;
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.06);
            color: #dbe7ff;
            font-size: 12px;
        }

        .measure-toolbar select {
            height: 32px;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.08);
            background: #1b2a45;
            color: #fff;
            padding: 0 10px;
        }

        .measure-legend-strip {
            display: flex;
            justify-content: flex-end;
            gap: 18px;
            margin-top: 10px;
            padding: 10px 12px;
            border-radius: 12px;
            background: rgba(10,16,30,0.55);
            border: 1px solid rgba(255,255,255,0.05);
            color: #dbe7ff;
            font-size: 12px;
        }

        .measure-legend-item {
            display: inline-flex;
            align-items: center;
            gap: 7px;
        }

        .measure-legend-line {
            width: 18px;
            height: 2px;
            border-radius: 999px;
        }

        .measure-legend-value {
            color: #f8fafc;
            font-weight: 700;
        }

        .measure-legend-unit {
            color: #9fb2d8;
        }

        .analyze-replay-controls {
            display: flex;
            flex-direction: column;
            gap: 12px;
            width: 100%;
        }

        .analyze-replay-toolbar {
            display: grid;
            grid-template-columns: repeat(3, minmax(150px, 1fr));
            gap: 10px 12px;
            width: 100%;
            align-items: stretch;
        }

        .analyze-replay-toolbar .btn {
            width: 100%;
            min-height: 44px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            text-align: center;
            white-space: nowrap;
        }

        .analyze-replay-toolbar .btn i {
            width: 18px;
            height: 18px;
            flex: 0 0 auto;
        }

        .analyze-progress {
            width: 100%;
            box-sizing: border-box;
            padding: 12px 14px;
            border-radius: 12px;
            background: rgba(15, 23, 42, 0.78);
            border: 1px solid rgba(148, 163, 184, 0.14);
        }

        .analyze-progress.hidden {
            display: none !important;
        }

        .analyze-progress-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 8px;
            color: #dbe7ff;
            font-size: 12px;
            font-weight: 700;
        }

        .analyze-progress-bar {
            width: 100%;
            height: 10px;
            border-radius: 999px;
            overflow: hidden;
            background: rgba(255,255,255,0.08);
            border: 1px solid rgba(255,255,255,0.06);
        }

        .analyze-progress-fill {
            width: 0%;
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(90deg, #2563eb, #60a5fa);
            transition: width 0.18s ease;
        }

        .rec-icon {
            width: 16px;
            height: 16px;
            margin-right: 6px;
            transition: all 0.2s ease;
        }

        .recording .rec-icon {
            color: #ef4444;
            animation: rec-blink 1s infinite;
        }

        @keyframes rec-blink {
            0%   { opacity: 1; transform: scale(1); }
            50%  { opacity: 0.3; transform: scale(0.85); }
            100% { opacity: 1; transform: scale(1); }
        }

        @media (max-width: 980px) {
            .analyze-replay-toolbar {
                grid-template-columns: repeat(2, minmax(150px, 1fr));
            }
        }

        @media (max-width: 640px) {
            .analyze-replay-toolbar {
                grid-template-columns: 1fr;
            }
        }
        /* recording blink */
        .rec-icon {
            width: 16px;
            height: 16px;
            transition: all 0.2s ease;
        }

        .recording .rec-icon {
            color: #ef4444;
            animation: rec-blink 1s infinite;
        }

        @keyframes rec-blink {
            0% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.3; transform: scale(0.85); }
            100% { opacity: 1; transform: scale(1); }
        }

        /* responsive */
        @media (max-width: 980px) {
            .analyze-replay-toolbar {
                grid-template-columns: repeat(2, minmax(160px, 1fr));
            }
        }

        @media (max-width: 640px) {
            .analyze-replay-toolbar {
                grid-template-columns: 1fr;
            }
        }
        .analyze-progress {
            margin-top: 10px;
            padding: 10px 12px;
            border-radius: 12px;
            background: rgba(15, 23, 42, 0.72);
            border: 1px solid rgba(148, 163, 184, 0.14);
        }

        .analyze-progress.hidden {
            display: none !important;
        }

        .analyze-progress-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            margin-bottom: 8px;
            color: #dbe7ff;
            font-size: 12px;
            font-weight: 600;
        }

        .analyze-progress-bar {
            width: 100%;
            height: 10px;
            border-radius: 999px;
            overflow: hidden;
            background: rgba(255,255,255,0.08);
            border: 1px solid rgba(255,255,255,0.06);
        }

        .analyze-progress-fill {
            width: 0%;
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(90deg, #2563eb, #60a5fa);
            transition: width 0.18s ease;
        }
        /* Base icon style */
        .rec-icon {
            width: 16px;
            height: 16px;
            margin-right: 6px;
            transition: all 0.2s ease;
        }

        /* 🔴 Active recording state */
        .recording .rec-icon {
            color: #ef4444; /* red-500 */
            animation: rec-blink 1s infinite;
        }

        /* Blink animation */
        @keyframes rec-blink {
            0%   { opacity: 1; transform: scale(1); }
            50%  { opacity: 0.3; transform: scale(0.85); }
            100% { opacity: 1; transform: scale(1); }
        }
        :root { --gap: 10px; }
        body { font-family: system-ui, sans-serif; margin: 16px; }
        h2 { margin: 0 0 8px; }
        #toolbar { display: grid; grid-template-columns: auto 1fr auto; gap: var(--gap); align-items: center; margin-bottom: 12px; }
        #leftBtns, #rightBtns { display: flex; gap: var(--gap); align-items: center; }
        button.recording { background:#7f1d1d; color:#fff; border-color:#7f1d1d; }
        #status { font-variant-numeric: tabular-nums; color: #666; }

        .interactive-pipeline {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            margin: 14px 0 16px;
        }

        .interactive-pipeline .fft-stage {
            appearance: none;
            border: 1px solid #4b5568;
            background: #1f2937;
            color: #f8fafc;
            border-radius: 10px;
            padding: 10px 14px;
            min-height: 42px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition:
                    transform 0.15s ease,
                    box-shadow 0.15s ease,
                    border-color 0.15s ease,
                    background 0.15s ease;
        }

        .interactive-pipeline .fft-stage:hover,
        .interactive-pipeline .fft-stage:focus-visible {
            transform: translateY(-1px);
            border-color: #93c5fd;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
            outline: none;
        }

        .interactive-pipeline .fft-stage.is-hovered,
        .interactive-pipeline .fft-stage.is-focused {
            border-color: #60a5fa;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
        }

        .interactive-pipeline .fft-stage.is-selected {
            border-color: #fbbf24;
            box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
        }

        .interactive-pipeline .fft-stage.fft-stage-dim {
            opacity: 0.45;
        }

        .interactive-pipeline .fft-arrow.is-active {
            color: #93c5fd;
            text-shadow: 0 0 10px rgba(96, 165, 250, 0.45);
        }

        .fft-stage-help-panel {
            margin-top: 10px;
            padding: 12px 14px;
            border-radius: 10px;
            border: 1px solid rgba(120, 160, 220, 0.18);
            background: rgba(20, 28, 42, 0.88);
            color: #dbe7ff;
            min-height: 72px;
            line-height: 1.45;
        }

        .fft-stage-help-panel .fft-stage-title {
            color: #fff;
            font-weight: 700;
            margin-bottom: 4px;
        }

        .fft-stage-help-panel .fft-stage-meta {
            color: #9fb2d8;
            font-size: 12px;
            margin-top: 6px;
        }

        @media (prefers-reduced-motion: reduce) {
            .interactive-pipeline .fft-stage {
                transition: none;
            }
        }


        #cisprSweepResultsChart {
            width: 100%;
            min-height: 420px;
            height: clamp(360px, 48vh, 680px);
            border-radius: 12px;
            overflow: hidden;
        }

        #cisprSweepResults {
            margin-top: 10px;
            padding: 12px 14px;
            border-radius: 10px;
            background: linear-gradient(180deg, rgba(12,19,34,0.92), rgba(8,14,26,0.98));
            border: 1px solid rgba(120,160,220,0.14);
            color: #e5e7eb;
            line-height: 1.55;
        }

        #sweepResultsPanel {
            background: linear-gradient(180deg, #1f2937 0%, #182233 100%);
            border: 1px solid rgba(120,160,220,0.16);
            border-radius: 12px;
            box-shadow:
                    inset 0 1px 0 rgba(255,255,255,0.03),
                    0 10px 26px rgba(0,0,0,0.20);
        }

        #sweepChartMeta {
            color: #9fb2d8;
            font-size: 12px;
        }

        .sweep-status-card .sweep-note,
        #sweepStatusNote {
            color: #a7b4d5;
            font-size: 12px;
        }
        .sweep-status-card {
            margin-top: 10px;
            padding: 12px;
            border-radius: 10px;
            background: #1c2432;
            border: 1px solid #3c4450;
            color: #e5e7eb;
        }

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

        .sweep-status-grid div {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            font-size: 0.92rem;
        }

        #sweepChart {
            width: 100%;
            min-height: 360px;
            height: clamp(320px, 42vh, 620px);
        }

        .sweep-note {
            margin-top: 8px;
            font-size: 12px;
            color: #a7b4d5;
        }

        /* inline upgrade message inside panels */
        .upgrade-hint-inline {
            margin: 8px 0 12px;
            padding: 10px 12px;
            border-radius: 10px;
            font-size: 13px;
            color: #fbbf24;
            background: rgba(251, 191, 36, 0.08);
            border: 1px solid rgba(251, 191, 36, 0.25);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* optional icon */
        .upgrade-hint-inline::before {
            content: "🔒";
            font-size: 12px;
        }
        .plan-badge-live {
            position: fixed;
            top: 12px;
            right: 14px;
            z-index: 10001;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(255,255,255,0.12);
            background: rgba(20,28,42,0.92);
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            box-shadow: 0 8px 20px rgba(0,0,0,0.28);
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .plan-locked {
            position: relative;
            opacity: 0.65;
            border: 1px solid rgba(251, 191, 36, 0.25);
            background: rgba(251, 191, 36, 0.03);
        }

        .plan-locked::after {
            content: "";
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.18);
            border-radius: 12px;
            pointer-events: none;
        }

        /* lock on the FIRST text span inside the label */
        .plan-locked .switch-label > span:first-child {
            display: inline-flex;
            align-items: center;
            gap: 6px; /* spacing between text and lock */
        }

        /* lock icon */
        .plan-locked .switch-label > span:first-child::after {
            content: "🔒";
            color: #fbbf24;
            font-size: 12px;
            line-height: 1;
            display: inline-block;
            transform: translateY(-1px); /* fine tune vertical alignment */
        }

        .plan-lock-note {
            margin-top: 6px;
            font-size: 12px;
            color: #fbbf24;
            opacity: 0.95;
        }

        .plan-locked input[type="checkbox"] {
            pointer-events: none;
            opacity: 0.5;
            cursor: not-allowed;
        }
        html, body {
            height: 100%;
            margin: 0;
        }

        #container {
            width: 100%;
            height: 100vh;
        }
        .dropdown-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .dropdown-item {
            flex: 1;
            width: auto;
            text-align: left;
        }

        .dropdown-item-label {
            display: inline-block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 180px;
        }

        .dropdown-delete-btn {
            width: 36px;
            height: 36px;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 8px;
            background-color: transparent;
            background-repeat: no-repeat;
            background-position: center;
            background-size: 16px 16px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        /* white lucide-style trash icon */
        .dropdown-delete-btn {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4h6v2'/%3E%3C/svg%3E");
        }

        .dropdown-delete-btn:hover {
            background-color: rgba(220, 38, 38, 0.18);
            border-color: rgba(220, 38, 38, 0.35);
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4h6v2'/%3E%3C/svg%3E");
        }



        .custom-dropdown {
            position: relative;
            display: inline-flex;
        }

        .dropdown-menu {
            position: absolute;
            top: calc(100% + 6px);
            left: 0;
            min-width: 220px;
            display: none;
            flex-direction: column;
            padding: 6px;
            border-radius: 10px;
            background: #1f2937;
            border: 1px solid rgba(120,160,220,0.18);
            box-shadow: 0 12px 30px rgba(0,0,0,0.35);
            z-index: 1200;
        }

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

        .dropdown-item {
            width: 100%;
            text-align: left;
            padding: 10px 12px;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: #fff;
            cursor: pointer;
        }

        .dropdown-item:hover {
            background: rgba(59,130,246,0.18);
        }

        .dropdown-empty {
            padding: 10px 12px;
            color: #94a3b8;
        }

        .layout-toolbar {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap; /* optional */
        }

        /* Make all buttons same height */
        .layout-toolbar .btn {
            height: 38px;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 0 14px;
        }

        /* Dropdown should align with buttons */
        .custom-dropdown {
            position: relative;
            display: inline-flex;
        }

        .dropdown-menu {
            position: absolute;
            top: 100%;
            left: 0;
            margin-top: 6px;

            background: #1f2937;
            border: 1px solid rgba(120,160,220,0.2);
            border-radius: 8px;
            padding: 6px;

            display: none;
            z-index: 1000;
        }

        /* show dropdown on hover (simple version) */
        .custom-dropdown:hover .dropdown-menu {
            display: block;
        }


        .save-layout-popover {
            position: absolute;
            z-index: 1200;
            min-width: 360px;
            border-radius: 10px;
            background: #1f2937;
            border: 1px solid rgba(120, 160, 220, 0.22);
            box-shadow: 0 10px 24px rgba(0,0,0,0.35);
            overflow: hidden;
        }

        .save-layout-popover-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 10px 12px;
            background: #2a2f3b;
            border-bottom: 1px solid rgba(120, 160, 220, 0.16);
            cursor: move;
            user-select: none;
        }

        .save-layout-popover-title {
            color: #fff;
            font-weight: 600;
        }

        .save-layout-popover-body {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px;
        }

        .save-layout-popover input {
            flex: 1;
            min-width: 160px;
            height: 36px;
            padding: 0 12px;
            border-radius: 8px;
            border: 1px solid #3c4450;
            background: #1f2430;
            color: #fff;
            outline: none;
        }

        .save-layout-popover input:focus {
            border-color: #4b7fff;
            box-shadow: 0 0 0 2px rgba(75,127,255,0.18);
        }

        .save-layout-popover .btn {
            height: 36px;
            padding: 0 16px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .add-tooltip {
            position: absolute;
            z-index: 1000;
            min-width: 220px;
            padding: 10px;
            border-radius: 10px;
            background: rgba(31, 36, 48, 0.96);
            border: 1px solid rgba(120, 160, 220, 0.20);
            box-shadow:
                    0 12px 30px rgba(0, 0, 0, 0.35),
                    inset 0 1px 0 rgba(255,255,255,0.03);
            backdrop-filter: blur(8px);
        }

        .add-tooltip button {
            width: 100%;
            display: block;
            margin: 4px 0;
            padding: 10px 12px;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.12);
            background: rgba(255,255,255,0.04);
            color: #e9eef6;
            text-align: center;
            cursor: pointer;
            transition: background-color .15s ease, border-color .15s ease;
        }

        .add-tooltip button:hover {
            background: rgba(43, 108, 176, 0.22);
            border-color: rgba(96, 165, 250, 0.35);
        }

        .chart-block {
            position: relative;
        }

        .chart-block .panel-actions {
            position: absolute;
            top: 32px;
            right: 25px;
            display: flex;
            gap: 6px;
            z-index: 5;
        }
        .delete-btn {
            width: 28px;
            height: 28px;
            padding: 0;

            display: inline-flex;
            align-items: center;
            justify-content: center;

            border-radius: 6px;
            border: 1px solid rgba(255,255,255,0.12);

            background: rgba(20,28,42,0.9); /* same base as others */
            color: #fff;

            font-size: 14px;
            cursor: pointer;

            transition: all 0.15s ease;
        }

        .panel-actions button {
            width: 28px;
            height: 28px;

            display: inline-flex;
            align-items: center;
            justify-content: center;

            padding: 0;
            border-radius: 6px;

            border: 1px solid rgba(255,255,255,0.12);
            background: rgba(20,28,42,0.9);
            color: #dbe7ff;

            cursor: pointer;
            transition: all 0.15s ease;
        }
        .panel-actions button:hover {
            background: rgba(60,90,140,0.95);
        }


        .delete-btn {
            background: rgba(180, 20, 20, 0.9);
        }

        .delete-btn:hover {
            background: #dc2626;
        }
        .delete-btn {
            background: rgba(120, 0, 0, 0.7);
            color: #fff;
            transition: all 0.15s ease;
        }

        .delete-btn:hover {
            background: #dc2626;
            box-shadow: 0 0 6px rgba(220,38,38,0.5);
        }
        .panel-mini-btn {
            border: 1px solid rgba(255,255,255,0.12);
            background: rgba(20,28,42,0.9);
            color: #dbe7ff;
            border-radius: 6px;
            padding: 4px 8px;
            cursor: pointer;
            font-size: 12px;
        }

        .panel-mini-btn:hover {
            background: rgba(40,58,86,0.95);
        }
        .panel-mini-btn,
        .close-btn {
            width: 28px;
            height: 28px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            font-size: 14px;
        }


        .chart-block.floating {
            position: fixed !important;
            width: 520px;
            min-height: 280px;
            z-index: 4000;
            resize: both;
            overflow: auto;
            box-shadow: 0 18px 48px rgba(0,0,0,0.45);
            border: 1px solid rgba(120,160,220,0.22);
            background: #1f2937;
        }

        .chart-block.floating h3 {
            cursor: move;
            user-select: none;
        }

        .chart-block.docking-preview {
            outline: 2px dashed #60a5fa;
            outline-offset: 2px;
        }
        .pfb-shape-description {
            margin-top: 12px;
            padding: 12px 14px;
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 10px;
            color: #dbe7ff;
            font-size: 12px;
            line-height: 1.45;
        }

        .pfb-shape-description > div {
            margin-bottom: 10px;
        }

        .pfb-shape-description > div:last-child {
            margin-bottom: 0;
        }
        #pfbShapeChart {
            width: 100%;
            min-height: 260px;
        }

        #pfbShapePanel {
            margin-top: 14px;
        }
        .leakage-panel {
            margin-top: 14px;
            padding: 14px;
            #  background: linear-gradient(180deg, #13243b 0%, #0f1d31 100%);
            border: 1px solid rgba(120, 160, 220, 0.16);
            border-radius: 12px;
            box-shadow:
                    inset 0 1px 0 rgba(255,255,255,0.03),
                    0 8px 24px rgba(0,0,0,0.18);
        }

        .leakage-panel-title {
            margin: 0 0 10px 0;
            color: #ffffff;
            font-size: 14px;
            font-weight: 700;
            letter-spacing: 0.2px;
        }


        #leakageCards {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .leakage-section {
            background: linear-gradient(180deg, rgba(2,10,24,0.56), rgba(2,8,20,0.72));
            border: 1px solid rgba(91, 141, 239, 0.12);
            border-radius: 10px;
            padding: 10px 12px 10px;
        }

        .leakage-title {
            font-size: 12px;
            font-weight: 700;
            color: #ffffff;
            margin-bottom: 8px;
            letter-spacing: 0.15px;
        }

        .leakage-subtitle {
            font-size: 10px;
            color: #7d93bd;
            margin-bottom: 8px;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            opacity: 0.95;
        }

        .leakage-card {
            background: linear-gradient(180deg, rgba(7,17,34,0.96), rgba(5,13,26,0.98));
            border: 1px solid rgba(124, 158, 220, 0.12);
            border-radius: 8px;
            padding: 10px 10px 8px;
        }

        .channel-row {
            display: grid;
            grid-template-columns: 58px minmax(180px, 1fr) minmax(170px, 240px);
            gap: 8px;
            align-items: center;
            margin: 4px 0;
        }
        .channel-value {
            font-size: 10px;
            color: #d4e0f8;
            text-align: left;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
        }

        @media (max-width: 700px) {
            .channel-row {
                grid-template-columns: 52px minmax(120px, 1fr) minmax(130px, 180px);
                gap: 6px;
            }

            .channel-value {
                font-size: 9px;
            }
        }


        .channel-label {
            font-size: 10px;
            color: #9fb2d8;
            text-align: right;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            white-space: nowrap;
        }

        .channel-bar-wrap {
            min-width: 0;
            position: relative;
            height: 10px;
            border-radius: 5px;
            overflow: hidden;
            background:
                    repeating-linear-gradient(
                            90deg,
                            rgba(255,255,255,0.055) 0px,
                            rgba(255,255,255,0.055) 1px,
                            transparent 1px,
                            transparent 6px
                    ),
                    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005)),
                    #0a1323;
            border: 1px solid rgba(255,255,255,0.06);
            box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
        }

        .channel-bar-wrap::before {
            content: "";
            position: absolute;
            inset: 0 auto 0 50%;
            width: 1px;
            background: rgba(255,255,255,0.08);
            transform: translateX(-0.5px);
            pointer-events: none;
        }

        .channel-bar {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            border-radius: 5px;
            background:
                    linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02)),
                    linear-gradient(90deg, #2f6fff 0%, #5da0ff 100%);
            box-shadow:
                    0 0 10px rgba(55, 124, 255, 0.18),
                    inset 0 0 0 1px rgba(255,255,255,0.04);
        }

        .channel-bar.main {
            background:
                    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.03)),
                    linear-gradient(90deg, #3b82f6 0%, #7db6ff 100%);
            box-shadow:
                    0 0 12px rgba(96, 165, 250, 0.28),
                    inset 0 0 0 1px rgba(255,255,255,0.06);
        }

        .channel-value {
            font-size: 10px;
            color: #d4e0f8;
            text-align: left;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            white-space: nowrap;
        }

        .leakage-caption {
            margin-top: 8px;
            font-size: 11px;
            color: #d9e3f7;
            opacity: 0.95;
        }

        .leakage-meta {
            margin-top: 7px;
            display: flex;
            gap: 14px;
            flex-wrap: wrap;
            font-size: 10px;
            color: #8ea5d1;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        }

        .leakage-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

        .leakage-badge::before {
            content: "";
            width: 6px;
            height: 6px;
            border-radius: 999px;
            background: #60a5fa;
            box-shadow: 0 0 6px rgba(96,165,250,0.5);
        }


        #rbwWaterfall {
            width: 100%;
            min-height: 320px;
            background: #1f2937;
            border-radius: 8px;
        }


        .rbw-tradeoff-chart {
            width: 100%;
            min-height: 260px;
            height: clamp(260px, 38vh, 520px);
            margin-top: 12px;
        }

        .fft-chart-panel {
            display: flex;
            flex-direction: column;
            gap: 12px;
            min-width: 0;
        }

        #moduleCisprCompliance {
            width: 100%;
            min-width: 0;
        }

        #cisprCompliance,
        #cisprSummary {
            width: 100%;
            overflow-wrap: break-word;
            white-space: normal;
        }

        .fft-container {
            display: grid;
            grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
            gap: 14px;
            width: 100%;
        }

        .fft-info-panel,
        .fft-chart-panel {
            min-width: 0;
        }
        @media (max-width: 1100px) {
            .fft-container {
                grid-template-columns: 1fr;
            }
        }

        .switch-row-freq-domain {
            display: flex;
            flex-direction: column;
            gap: 16px;
            width: 100%;
        }

        .fft-help-section {
            width: 100%;
        }

        .fft-help-content {
            margin-top: 10px;
            line-height: 1.45;
            color: #e8edf7;
        }

        .fft-help-content p,
        .fft-help-content li,
        .fft-help-content h4,
        .fft-help-content summary {
            color: #e8edf7;
        }

        .fft-help-list {
            margin: 10px 0 0 18px;
            padding: 0;
        }

        .fft-help-list li {
            margin-bottom: 10px;
        }

        .fft-pipeline {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            margin: 14px 0 18px 0;
        }

        .fft-stage {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 40px;
            padding: 8px 12px;
            border-radius: 10px;
            border: 1px solid #4b5568;
            background: #1f2937;
            color: #f8fafc;
            font-size: 13px;
            font-weight: 600;
            box-shadow: 0 1px 2px rgba(0,0,0,0.25);
            text-align: center;
            white-space: normal;
        }

        .fft-stage.fft-stage-active {
            background: #2563eb;
            border-color: #60a5fa;
            color: #ffffff;
        }

        .fft-stage.fft-stage-core {
            background: #334155;
            border-color: #64748b;
            color: #f8fafc;
        }

        .fft-stage.fft-stage-output {
            background: #0f766e;
            border-color: #2dd4bf;
            color: #ffffff;
        }

        .fft-arrow {
            color: #cbd5e1;
            font-size: 18px;
            font-weight: 700;
            line-height: 1;
        }

        .fft-switch-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
            gap: 12px;
            width: 100%;
        }

        .fft-opt {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            min-height: 56px;
            padding: 10px 12px;
            border: 1px solid #3f4a5a;
            border-radius: 10px;
            background: #243041;
            color: #f1f5f9;
            box-sizing: border-box;
        }

        .switch-label {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            font-size: 14px;
            font-weight: 600;
            line-height: 1.2;
            color: #f8fafc;
        }

        .help {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #475569;
            color: #ffffff;
            font-size: 11px;
            font-weight: 700;
            cursor: help;
            flex: 0 0 auto;
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 38px;
            height: 22px;
            flex: 0 0 auto;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            inset: 0;
            cursor: pointer;
            background-color: #64748b;
            transition: .2s;
            border-radius: 22px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 3px;
            top: 3px;
            background-color: white;
            transition: .2s;
            border-radius: 50%;
        }

        .switch input:checked + .slider {
            background-color: #4f7cff;
        }

        .switch input:checked + .slider:before {
            transform: translateX(16px);
        }

        details summary {
            cursor: pointer;
            color: #f8fafc;
            margin-bottom: 8px;
        }

        @media (max-width: 700px) {
            .fft-opt {
                align-items: flex-start;
            }

            .switch-label {
                max-width: 100%;
            }
        }

        .fft-arrow {
            font-weight: bold;
            font-size: 16px;
        }

        .fft-help-list {
            padding-left: 18px;
        }

        .fft-help-list li {
            margin-bottom: 8px;
        }

        .help-icon {

            display: inline-flex;
            align-items: center;
            justify-content: center;

            width: 16px;
            height: 16px;

            margin-left: 6px;

            border-radius: 50%;
            background: #3b3b3b;
            color: white;

            font-size: 11px;
            font-weight: bold;

            cursor: help;
            position: relative;
        }

        .help-icon:hover::after {

            content: attr(data-help);

            position: absolute;

            top: 24px;
            left: -120px;

            width: 260px;

            padding: 10px;

            background: #222;
            color: white;

            border-radius: 6px;

            font-size: 12px;
            line-height: 1.4;

            white-space: pre-line;

            box-shadow: 0 3px 10px rgba(0,0,0,0.4);

            z-index: 999;
        }
        .help {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            margin-left: 6px;
            border-radius: 50%;
            background: #3a3a3a;
            color: white;
            font-size: 11px;
            cursor: help;
            font-weight: bold;
        }



        .hidden { display:none !important; }
        .switch-row-freq-domain {
            display: flex;
            align-items: center;   /* vertical centering */
            gap: 8px;
        }

        .switch-label {
            font-size: 14px;
            color: #ccc;
            line-height: 1;         /* prevents label from rising */
            position: relative;
            top: 7px;               /* fine-tune vertical alignment */
        }

        .switch-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .fft-info-grid {
            gap: 6px 18px;
        }

        .fft-info-grid > div {
            padding: 2px 0;
        }

        .fft-info-header {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px 18px;
            background: #243041;
            border-bottom: 1px solid #3c4450;
            padding: 10px 12px;
        }

        .fft-info-header h3 {
            margin: 0;
            white-space: nowrap;
            flex: 0 0 auto;
        }

        .fft-input-group {
            display: flex;
            align-items: center;
            gap: 6px;
            flex: 0 0 auto;
        }

        .fft-info-grid div {
            display: flex;
            justify-content: space-between;
            background-color: transparent;
            padding: 2px 0;
            font-size: 0.95rem;
        }

        /* Responsive: stack columns on narrow screens */
        @media (max-width: 700px) {
            .fft-info-grid {
                grid-template-columns: 1fr;
            }
        }

        /* Container for full-width layout */
        .fft-container {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: stretch;
            width: auto;
            height: auto;
            background-color: #1f2937;
            border-radius: 8px;
            padding: 10px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.4);
            gap: 10px;
        }

        /* Both sides equal width */
        .fft-info-panel,
        .fft-chart-panel {
            flex: 1;
            background-color: #1f2937;
            color: #e5e7eb;
            border-radius: 8px;
            padding: 12px 18px;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
        }

        /* Info list scrolling */
        .fft-info-card {
            overflow-y: auto;
            line-height: 1.35;
            font-size: 0.92rem;
            background: #1c2432;
            border-radius: 8px;
            padding: 10px 12px;
        }

        /* Chart area styling */
        .fft-chart-panel #rbwTradeoff {
            width: auto;
            height: auto;
        }

        /* Make responsive */
        @media (max-width: 900px) {
            .fft-container {
                flex-direction: column;
                height: auto;
            }
            .fft-info-panel,
            .fft-chart-panel {
                width: 100%;
                height: 400px;
            }
        }

        .fft-info-header {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 16px; /* even spacing across all groups */
            background-color: #2b303b;
            border-bottom: 1px solid #3c4450;
            padding: 6px 12px;
            color: #dce3ee;
            font-family: 'Inter', sans-serif;
            font-size: 0.9rem;
        }

        .fft-info-header h3 {

            margin: 0;
            white-space: nowrap;

        }

        element.style {
        }
        .chart-block h3 {
            user-select: none;
            cursor: grab;
        }
        h2, h3 {
            color: #fff;
            margin-top:5px!;
        }
        * {
            scrollbar-width: auto;
            scrollbar-color: #2b2f3a #1c222d;
        }
        h3 {
            display: block;
            font-size: 1.17em;
            margin-block-start: 1em;
            margin-block-end: 1em;
            margin-inline-start: 0px;
            margin-inline-end: 0px;
            font-weight: bold;
            unicode-bidi: isolate;
        }
        /* Toggle */
        .switch {
            position: relative;
            display: inline-block;
            width: 34px;
            height: 18px;
            margin-left: 4px;
            margin-right: 10px;
            flex-shrink: 0;
            top: 0.5px;
        }
        .switch input { opacity: 0; width: 0; height: 0; }
        .slider {
            position: absolute;
            cursor: pointer;
            inset: 0;
            background-color: #434a55;
            border-radius: 18px;
            transition: 0.3s;
        }
        .slider:before {
            position: absolute;
            content: "";
            height: 12px;
            width: 12px;
            left: 3px;
            bottom: 3px;
            background-color: #b0b8c8;
            border-radius: 50%;
            transition: 0.3s;
        }
        .switch input:checked + .slider {
            background-color: #4b7fff;
        }
        .switch input:checked + .slider:before {
            transform: translateX(16px);
            background-color: #e8ecf8;
        }

        /* Input groups evenly spaced */
        .fft-input-group {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-top: 0;
            flex: 0 0 auto;
        }

        .fft-input-group label {
            color: #a7b4d5;
            font-weight: 500;
            white-space: nowrap;
            font-size: 0.88rem;
            margin: 0;
            padding-right: 2px;
        }

        /* Inputs proportionally sized */
        .fft-input-group input[type="number"] {
            width: 70px;
            max-width: 80px;
            background-color: #20242c;
            border: 1px solid #3c4450;
            border-radius: 6px;
            padding: 3px 6px;
            color: #e6ebf5;
            font-size: 0.88rem;
            text-align: center;
            outline: none;
            transition: border-color 0.2s, box-shadow 0.2s;
        }
        .fft-input-group input[type="number"]:hover {
            border-color: #5a7cff;
            background-color: #1e2634;
        }
        .fft-input-group input[type="number"]:focus {
            border-color: #4b7fff;
            box-shadow: 0 0 4px #4b7fff;
        }

        /* Close button remains aligned */
        .close-btn {
            margin-left: auto;
            background-color: #b91c1c;
            color: #fff;
            border: none;
            border-radius: 6px;
            width: 22px;
            height: 22px;
            font-size: 0.85rem;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .close-btn:hover {
            background-color: #dc2626;
        }

        /* Collapse to one column on smaller screens */
        @media (max-width:1024px){
            #dashboard{ grid-template-columns: 1fr; }
            #dashboard > .right-pane{ grid-column: 1; }
        }

        /* Plot areas fill their cards */
        #fft, #waveform, #phase, #groupDelay, #spectrogram, #spatial{
            width:100%!important;
            height:clamp(240px,38vh,620px)!important;
        }

        /* ---------- MOBILE/TABLET HARDENING ---------- */
        html { -webkit-text-size-adjust: 100%; }
        button, input, select { font-size: 16px; touch-action: manipulation; } /* avoid iOS zoom */
        :root {
            --dlg-maxw: 680px;
            --dlg-pad: 14px;
        }

        /* Backdrop always covers and blocks page scroll */
        .dlg-backdrop { position: fixed; inset: 0; overflow: hidden; }

        /* Card: desktop/tablet default */
        .dlg-card{
            width: min(var(--dlg-maxw), 92vw);
            max-height: min(84vh, 760px);
            display: grid;
            grid-template-rows: auto 1fr auto;   /* header | list | pager */
            overflow: hidden;
        }

        /* Sticky header + scrollable list area */
        .dlg-header{
            position: sticky; top: 0;
            background: inherit;
            z-index: 1;
            padding: 8px 4px;
        }
        .dlg-section:first-of-type { padding-top: 0; }
        .dlg-list{
            overflow: auto;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
            padding-right: 2px;  /* keep scrollbar from overlapping text */
        }

        /* Row layout: content + actions (desktop) */
        .dlg-item{
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 10px;
        }
        .dlg-actions{
            display: flex; gap: 8px;
            align-items: center;
            justify-content: flex-end;
            flex-wrap: wrap;
        }
        .dlg-mini { min-height: 36px; }

        /* Pager area (we create it as #violationsPager) */
        #violationsPager{
            padding-top: 8px;
            border-top: 1px solid rgba(255,255,255,.08);
        }
        #violationsPager .inline{
            display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
        }
        #violationsPager select { height: 38px; }

        /* ---------- PHONE LAYOUT ---------- */
        @media (max-width: 600px){
            /* Full-screen modal on phones; safe-area aware */
            .dlg-card{
                width: 100vw; height: 100dvh;
                max-height: none; max-width: none;
                border-radius: 0;
                transform: none !important;
                top: 0 !important; left: 0 !important;
                padding: calc(var(--dlg-pad) + env(safe-area-inset-top))
                calc(var(--dlg-pad) + env(safe-area-inset-right))
                calc(var(--dlg-pad) + env(safe-area-inset-bottom))
                calc(var(--dlg-pad) + env(safe-area-inset-left));
                box-sizing: border-box;
                .chart-block #fft {
                    min-height: 450px;!important;
                }
            }
            .dlg-header{ padding: 6px 0; }

            /* Stack row actions under the text */
            .dlg-item{ grid-template-columns: 1fr; }
            .dlg-actions{
                justify-content: flex-start;
            }

            /* Bigger tap targets */
            .dlg-mini{ min-height: 44px; padding: 10px 12px; }
            #violationsPager .meta { font-size: 13px; opacity: .9; }

            /* Ensure dashboard collapses to 1 col (if not already) */
            #dashboard{ grid-template-columns: 1fr !important; }
        }

        /* ---------- TABLET TWEAKS ---------- */
        @media (min-width: 601px) and (max-width: 1024px){
            .dlg-card{ width: min(92vw, 720px); max-height: 86vh; }
            .dlg-mini{ min-height: 40px; }
            .chart-block #fft {
                min-height: 450px;!important;
            }
        }

        /* Nice text scaling everywhere */
        .dlg-item .strong { font-size: clamp(14px, 1.7vw, 16px); }
        .dlg-item .meta   { font-size: clamp(12px, 1.5vw, 14px); line-height: 1.35; }
        .dlg-item .pill   { font-size: clamp(11px, 1.4vw, 12px); }

        /* ---- Toolbar group wrapper ---- */
        .controls-toolbar{ display:flex; flex-wrap:wrap; gap:10px; align-items:center }
        .controls-toolbar .btn{ flex:0 0 auto; } /* don't shrink buttons */

        /* New, responsive slider group */
        .toolbar-spacers{
            display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end;
        }

        @media (max-width: 600px){
            .controls-toolbar label[for], .controls-toolbar label{
                display:flex; flex-direction:column; gap:6px;
                margin:0 !important; width:auto !important;
                .chart-block #fft {
                    min-height: 450px;!important;
                }
            }
            .controls-toolbar input[type="range"]{
                width:100% !important;
            }
        }


        #exportPanelHeader { position: relative; padding: 14px 16px; }
        .dlg-close {
            position: absolute;
            right: 10px;
            top: 50% !important;              /* override the inline 5px */
            transform: translateY(-50%);
        }
        #exportPanelHeader h2 { margin: 0; }
        <!-- RED Button

             .dlg-close {
                 display: inline-flex;
                 align-items: center;
                 justify-content: center;
                 width: 28px; height: 28px;
                 border: 0; border-radius: 6px;
                 background: #aa0000; color: #fff;
                 cursor: pointer; line-height: 1;
             }-->
        #exportPanelHeader h2 { margin: 0; }
        .dlg-close { background: transparent; color: #cfd6e6; border: 0; font-size: 20px; cursor: pointer; }
        /* Default for all devices */
        .chart-block #fft {
            width: 100% !important;
            max-width: 100% !important;
            min-height: 350px !important; /* ensures readability on very small phones */
            height: auto !important;
            overflow: hidden !important;
        }

        /* Medium screens (tablets, small laptops) */
        @media (min-width: 768px) {
            .chart-block #fft {
                min-height: 450px !important;
            }
        }

        /* Large screens (desktop and ultrawide monitors) */
        @media (min-width: 1200px) {
            .chart-block #fft {
                min-height: 520px !important;
            }
        }




        .workflow-mode-toggle {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin: 10px 0 0;
            padding: 6px;
            border-radius: 999px;
            border: 1px solid rgba(120,160,220,0.18);
            background: rgba(15, 23, 42, 0.82);
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 24px rgba(0,0,0,0.18);
        }

        .workflow-mode-btn {
            appearance: none;
            min-height: 34px;
            padding: 0 14px;
            border-radius: 999px;
            border: 1px solid transparent;
            background: transparent;
            color: #cbd5e1;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.02em;
            cursor: pointer;
            transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
        }

        .workflow-mode-btn:hover,
        .workflow-mode-btn:focus-visible {
            color: #ffffff;
            border-color: rgba(147,197,253,0.32);
            outline: none;
        }

        .workflow-mode-btn.active {
            color: #ffffff;
            background: linear-gradient(180deg, rgba(59,130,246,0.38), rgba(37,99,235,0.24));
            border-color: rgba(147,197,253,0.45);
            box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
        }

        .advanced-workflow-note {
            display: none;
            margin: 10px 0 16px;
            padding: 14px 16px;
            border-radius: 16px;
            border: 1px solid rgba(251,191,36,0.26);
            background: linear-gradient(180deg, rgba(251,191,36,0.10), rgba(15,23,42,0.72));
            color: #e8edf7;
            line-height: 1.45;
        }

        .advanced-workflow-note strong { color: #ffffff; }

        body.workflow-experience-advanced .workflow-bar {
            display: none !important;
        }

        body.workflow-experience-advanced .advanced-workflow-note {
            display: block;
        }

        body.workflow-experience-advanced [data-workflow-section] {
            display: block !important;
        }

        /* Method scope still wins in Advanced view: hide Sweep panels/charts when FFT is selected, and hide FFT panels when Sweep is selected. */
        body.workflow-experience-advanced [data-method-scope].workflow-hidden,
        body.workflow-experience-advanced [data-workflow-section].workflow-hidden {
            display: none !important;
        }

        .workflow-bar {
            display: grid;
            grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
            gap: 16px;
            margin: 10px 0 16px;
            padding: 14px;
            border-radius: 18px;
            border: 1px solid rgba(120,160,220,0.16);
            background: linear-gradient(180deg, rgba(18,26,39,0.98), rgba(14,21,33,0.98));
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 16px 32px rgba(0,0,0,0.22);
        }
        .workflow-tabs {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 14px;
        }
        .workflow-tab {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: flex-start;
            gap: 8px;
            min-height: 160px;
            padding: 18px 18px 16px;
            border-radius: 18px;
            border: 1px solid rgba(138, 156, 188, 0.18);
            background: linear-gradient(180deg, rgba(38,46,63,0.98), rgba(26,34,48,0.98));
            color: #eef4ff;
            text-align: left;
            cursor: pointer;
            box-shadow: 0 12px 28px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.04);
            transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
        }
        .workflow-tab:hover,
        .workflow-tab:focus-visible {
            transform: translateY(-2px);
            border-color: rgba(122, 162, 255, 0.4);
            box-shadow: 0 14px 30px rgba(0,0,0,0.3), 0 0 0 3px rgba(59,130,246,0.12);
            outline: none;
        }
        .workflow-tab.active {
            border-color: rgba(96,165,250,0.62);
            background: linear-gradient(180deg, rgba(46,116,216,0.32), rgba(31,77,161,0.3)), linear-gradient(180deg, rgba(38,46,63,0.98), rgba(26,34,48,0.98));
            box-shadow: 0 16px 34px rgba(8,47,113,0.34), 0 0 0 1px rgba(96,165,250,0.16) inset;
        }
        .workflow-tab::after {
            content: attr(data-tier);
            position: absolute;
            top: 12px;
            right: 12px;
            padding: 6px 10px;
            border-radius: 999px;
            background: rgba(255,255,255,0.08);
            border: 1px solid rgba(255,255,255,0.12);
            color: #f8fbff;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.02em;
        }
        .workflow-tab.active::after {
            background: rgba(96,165,250,0.18);
            border-color: rgba(147,197,253,0.28);
        }
        .workflow-tab-icon {
            font-size: 18px;
            line-height: 1;
        }
        .workflow-tab-title {
            font-size: 24px;
            line-height: 1.1;
            font-weight: 800;
            color: #ffffff;
        }
        .workflow-tab-subtitle {
            font-size: 13px;
            font-weight: 700;
            color: #d7e5ff;
        }
        .workflow-tab-meta {
            margin-top: auto;
            font-size: 13px;
            line-height: 1.45;
            color: #b8c9e8;
        }

        .workflow-tab-open-btn {
            margin-top: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            min-height: 40px;
            padding: 0 14px;
            border-radius: 12px;
            border: 1px solid rgba(147,197,253,0.28);
            background: rgba(96,165,250,0.14);
            color: #eef4ff;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
            transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
        }
        .workflow-tab-open-btn:hover,
        .workflow-tab-open-btn:focus-visible {
            background: rgba(96,165,250,0.24);
            border-color: rgba(147,197,253,0.48);
            box-shadow: 0 0 0 3px rgba(59,130,246,0.14);
            outline: none;
        }
        .workflow-tab-open-btn:active {
            transform: translateY(1px);
        }

        .workflow-tab-title {
            display: block;
            font-size: 18px;
            line-height: 1.1;
            font-weight: 800;
            color: #ffffff;
        }
        .workflow-card-art {
            position: relative;
            width: 100%;
            min-height: 84px;
            margin-top: 8px;
            border-radius: 14px;
            overflow: hidden;
            border: 1px solid rgba(120, 160, 220, 0.12);
            background: linear-gradient(180deg, rgba(10,18,32,0.92), rgba(7,13,24,0.96));
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
        }
        .workflow-card-art svg {
            display: block;
            width: 100%;
            height: 84px;
        }
        .workflow-card-art .grid-line {
            stroke: rgba(140, 174, 255, 0.12);
            stroke-width: 1;
        }
        .workflow-card-art .trace-primary {
            fill: none;
            stroke: #60a5fa;
            stroke-width: 2.2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
        .workflow-card-art .trace-accent {
            fill: rgba(96,165,250,0.12);
            stroke: rgba(147,197,253,0.42);
            stroke-width: 1;
        }
        .workflow-card-art .trace-gold {
            fill: none;
            stroke: #fbbf24;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
        .workflow-card-art .trace-green {
            fill: none;
            stroke: #34d399;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
        .workflow-card-art .trace-muted {
            fill: none;
            stroke: rgba(203, 213, 225, 0.35);
            stroke-width: 1.4;
            stroke-dasharray: 4 4;
        }
        .workflow-card-art .art-label {
            font-size: 10px;
            fill: #cfe0ff;
            font-weight: 700;
            letter-spacing: 0.02em;
        }
        .workflow-card-art .art-meta {
            font-size: 9px;
            fill: #8fb1eb;
        }
        .workflow-tab:hover .workflow-card-art,
        .workflow-tab:focus-visible .workflow-card-art,
        .workflow-tab.active .workflow-card-art {
            border-color: rgba(96,165,250,0.22);
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 0 1px rgba(96,165,250,0.08);
        }
        .workflow-tab.active .workflow-card-art {
            background: linear-gradient(180deg, rgba(12,24,44,0.96), rgba(8,16,30,0.98));
        }
        .workflow-copy {
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: 18px 20px;
            border-radius: 18px;
            border: 1px solid rgba(138,156,188,0.14);
            background: linear-gradient(180deg, rgba(26,34,48,0.98), rgba(20,27,40,0.98));
            color: #c6d4ec;
            font-size: 13px;
            line-height: 1.55;
            min-height: 160px;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
        }
        .workflow-copy strong { color: #fff; }
        .configure-preview {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }
        .configure-preview-header {
            display: flex;
            align-items: center;
            gap: 10px;
            color: #f8fbff;
            font-size: 14px;
            font-weight: 700;
        }
        .configure-preview-header i {
            width: 16px;
            height: 16px;
            color: #9ec5ff;
        }
        .configure-preview-text {
            color: #c6d4ec;
            font-size: 13px;
            line-height: 1.55;
        }
        .configure-preview-grid {
            display: grid;
            grid-template-columns: minmax(200px, 0.9fr) minmax(0, 1.1fr);
            gap: 14px;
            align-items: stretch;
        }
        .configure-preview-list {
            display: grid;
            gap: 8px;
        }
        .configure-preview-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            padding: 9px 10px;
            border-radius: 12px;
            background: rgba(255,255,255,0.035);
            border: 1px solid rgba(138,156,188,0.12);
            color: #d9e6fb;
            font-size: 12px;
            line-height: 1.45;
        }
        .configure-preview-item::before {
            content: '';
            width: 7px;
            height: 7px;
            margin-top: 5px;
            border-radius: 999px;
            background: #60a5fa;
            box-shadow: 0 0 8px rgba(96,165,250,0.55);
            flex: 0 0 auto;
        }
        .configure-preview-chart-shell {
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 10px;
            border-radius: 14px;
            background: linear-gradient(180deg, rgba(12,18,30,0.95), rgba(9,15,26,0.98));
            border: 1px solid rgba(120,160,220,0.18);
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
        }
        .configure-preview-chart-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            color: #a9bddf;
            font-size: 11px;
        }
        .configure-preview-chart-meta strong {
            color: #eef4ff;
        }
        .configure-compare-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }
        .configure-compare-card {
            display: flex;
            flex-direction: column;
            gap: 8px;
            min-width: 0;
            padding: 10px;
            border-radius: 12px;
            background: linear-gradient(180deg, rgba(10,16,28,0.96), rgba(6,12,22,0.98));
            border: 1px solid rgba(120,160,220,0.14);
        }
        .configure-compare-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            color: #dbe7ff;
            font-size: 11px;
        }
        .configure-compare-title {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-weight: 700;
        }
        .configure-compare-badge {
            padding: 4px 8px;
            border-radius: 999px;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.02em;
            border: 1px solid rgba(255,255,255,0.12);
            background: rgba(255,255,255,0.06);
            color: #d8e4fb;
        }
        .configure-compare-badge.fft {
            background: rgba(96,165,250,0.14);
            border-color: rgba(96,165,250,0.24);
            color: #bfdbfe;
        }
        .configure-compare-badge.pfb {
            background: rgba(52,211,153,0.12);
            border-color: rgba(52,211,153,0.22);
            color: #a7f3d0;
        }
        .configure-compare-note {
            color: #8ea5d1;
            font-size: 10px;
            line-height: 1.45;
        }
        .configure-compare-summary {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }
        .configure-compare-stat {
            padding: 8px 10px;
            border-radius: 10px;
            background: rgba(255,255,255,0.035);
            border: 1px solid rgba(138,156,188,0.1);
        }
        .configure-compare-label {
            display: block;
            color: #8ea5d1;
            font-size: 10px;
            margin-bottom: 4px;
        }
        .configure-compare-value {
            color: #eef4ff;
            font-size: 11px;
            font-weight: 700;
        }
        #configureFftPreview,
        #configurePfbPreview {
            width: 100%;
            min-height: 132px;
            height: 132px;
        }
        @media (max-width: 860px) {
            .configure-preview-grid {
                grid-template-columns: 1fr;
            }
            .configure-compare-grid,
            .configure-compare-summary {
                grid-template-columns: 1fr;
            }
            #configureFftPreview,
            #configurePfbPreview {
                height: 150px;
            }
        }
        .workflow-hidden { display:none !important; }
        .section-badge { display:inline-flex; align-items:center; gap:6px; margin-left:10px; padding:2px 8px; border-radius:999px; font-size:11px; font-weight:700; letter-spacing:.02em; vertical-align:middle; }
        .section-badge.configure { background: rgba(99,102,241,0.16); color: #c7d2fe; border: 1px solid rgba(129,140,248,0.28); }
        .section-badge.configure { background: rgba(99,102,241,0.16); color: #c7d2fe; border: 1px solid rgba(129,140,248,0.28); }
        .section-badge.scan { background: rgba(37,99,235,0.18); color: #bfdbfe; border: 1px solid rgba(96,165,250,0.3); }
        .section-badge.measure { background: rgba(217,119,6,0.16); color: #fde68a; border: 1px solid rgba(251,191,36,0.28); }
        .section-badge.analyze { background: rgba(16,185,129,0.14); color: #a7f3d0; border: 1px solid rgba(52,211,153,0.22); }
        .mode-caption { margin-top: 8px; color: #a7b4d5; font-size: 12px; }
        @media (max-width: 1180px) {
            .workflow-bar {
                grid-template-columns: 1fr;
            }
            .workflow-copy {
                min-height: 0;
            }
        }
        @media (max-width: 980px) {
            .workflow-tabs {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }
        @media (max-width: 640px) {
            .workflow-bar {
                padding: 12px;
                border-radius: 16px;
            }
            .workflow-tabs {
                grid-template-columns: 1fr;
            }
            .workflow-tab,
            .workflow-copy {
                min-height: 0;
            }
            .workflow-tab-title {
                font-size: 22px;
            }
        }


        .top-pane-pinned > .chart-block {
            width: 100%;
        }


        .workflow-detached-panel {
            position: fixed;
            top: 50%;
            left: 50%;
            right: auto;
            width: min(1100px, calc(100vw - 48px));
            height: min(86vh, 920px);
            transform: translate(-50%, -50%);
            z-index: 12000;
            display: none;
            flex-direction: column;
            border-radius: 18px;
            border: 1px solid rgba(120,160,220,0.22);
            background: linear-gradient(180deg, rgba(20,28,42,0.98), rgba(12,18,30,0.99));
            box-shadow: 0 22px 60px rgba(0,0,0,0.45);
            overflow: hidden;
        }
        .workflow-detached-panel.open {
            display: flex;
        }
        .workflow-detached-panel.is-dragging,
        .workflow-detached-panel.is-dragging .workflow-detached-header {
            cursor: grabbing;
            user-select: none;
        }
        .workflow-detached-backdrop {
            position: fixed;
            inset: 0;
            z-index: 11990;
            display: none;
            background: rgba(2, 6, 16, 0.55);
            backdrop-filter: blur(4px);
        }
        .workflow-detached-backdrop.open {
            display: block;
        }
        .workflow-detached-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 14px 18px;
            border-bottom: 1px solid rgba(120,160,220,0.14);
            background: linear-gradient(180deg, rgba(35,45,64,0.98), rgba(26,34,48,0.98));
            cursor: grab;
        }
        .workflow-detached-title-wrap {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
            flex: 1;
        }
        .workflow-detached-title {
            color: #fff;
            font-size: 18px;
            font-weight: 800;
        }
        .workflow-detached-subtitle {
            color: #a9bddf;
            font-size: 12px;
        }
        .workflow-detached-body {
            flex: 1;
            overflow: auto;
            padding: 18px;
            display: grid;
            gap: 16px;
            align-content: start;
        }
        .workflow-detached-body > * {
            margin: 0 !important;
        }
        .workflow-detached-placeholder {
            display: none !important;
        }
        #workflowDetachedClose.dlg-close {
            position: static;
            transform: none;
            flex: 0 0 auto;
            width: 34px;
            height: 34px;
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,0.12);
            background: rgba(220, 38, 38, 0.92);
            color: #fff;
            font-size: 22px;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }
        #workflowDetachedClose.dlg-close:hover {
            background: #ef4444;
            box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
        }
        #workflowDetachedClose.dlg-close:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px rgba(96,165,250,0.26);
        }
        body.workflow-detached-open {
            overflow: hidden;
        }
        @media (max-width: 900px) {
            .workflow-detached-panel {
                top: 12px;
                left: 12px;
                right: 12px;
                width: auto;
                height: calc(100vh - 24px);
                transform: none !important;
            }
            .workflow-detached-header {
                cursor: default;
            }
            .workflow-detached-body {
                padding: 14px;
            }
        }



        /* Analyze Replay Set A/B file dropdowns */
        .analyze-set-row { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 10px 12px; width: 100%; grid-column: 1 / -1; }
        .analyze-set-control { width: 100%; display: block; }
        .analyze-set-trigger.btn { width: 100%; height: 38px; display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 0 10px; overflow: hidden; }
        .analyze-set-badge { flex: 0 0 auto; min-width: 42px; padding: 3px 6px; border-radius: 7px; background: rgba(15, 23, 42, 0.72); color: #fff; font-size: 11px; font-weight: 800; line-height: 1.05; text-align: center; }
        .analyze-set-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
        .analyze-set-caret { flex: 0 0 auto; opacity: 0.8; }
        .analyze-replay-menu.dropdown-menu { width: min(560px, calc(100vw - 48px)); max-height: 420px; overflow: auto; z-index: 6000; }
        .analyze-menu-action { width: 100%; padding: 9px 10px; border: 1px solid rgba(255,255,255,0.10); border-radius: 8px; background: rgba(59,130,246,0.15); color: #fff; text-align: left; cursor: pointer; font-weight: 700; }
        .analyze-menu-action:hover { background: rgba(59,130,246,0.28); }
        .dropdown-group-title { padding: 9px 8px 5px; color: #93a4c7; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
        .dropdown-row.replay-file-row { display: flex; align-items: center; gap: 6px; padding: 2px; border-radius: 8px; }
        .dropdown-row.replay-file-row.is-latest { background: rgba(37, 99, 235, 0.30); box-shadow: inset 0 0 0 1px rgba(96,165,250,0.42); }
        .dropdown-row.replay-file-row.is-selected { background: rgba(59, 130, 246, 0.20); }
        .dropdown-row.replay-file-row .dropdown-item { min-width: 0; }
        .dropdown-item-label { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
        .dropdown-file-meta { margin-left: 6px; color: #9fb2d8; font-size: 11px; white-space: nowrap; }
        .dropdown-icon-btn, .dropdown-delete-btn, .dropdown-pin-btn, .dropdown-rename-btn { flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; background: rgba(15, 23, 42, 0.36); color: #cbd5e1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
        .dropdown-icon-btn:hover, .dropdown-pin-btn:hover, .dropdown-rename-btn:hover { background: rgba(59,130,246,0.20); color: #fff; }
        .dropdown-pin-btn.is-pinned { color: #fbbf24; background: rgba(251,191,36,0.12); }
        .dropdown-delete-btn:hover { background: rgba(220,38,38,0.20); border-color: rgba(220,38,38,0.45); color: #fff; }
        .dropdown-rename-input { flex: 1 1 auto; min-width: 160px; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid #4b7fff; background: #111827; color: #fff; outline: none; }
        .dropdown-empty { padding: 10px 12px; color: #94a3b8; }
        @media (max-width: 760px) { .analyze-set-row { grid-template-columns: 1fr; } }



        /* Set B is always visible, but locked until Compare mode is enabled. */
        #btnAnalyzeSetB:disabled,
        #btnAnalyzeSetB.is-disabled {
            opacity: 0.46;
            cursor: not-allowed;
            filter: grayscale(0.35);
        }

        #btnAnalyzeSetB:disabled .analyze-set-caret,
        #btnAnalyzeSetB.is-disabled .analyze-set-caret {
            opacity: 0.45;
        }

        #btnAnalyzeCompare {
            transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
        }

        #btnAnalyzeCompare.active {
            border-color: rgba(96, 165, 250, 0.95);
            box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25), 0 0 14px rgba(96, 165, 250, 0.28);
        }

        #btnAnalyzeCompare.active::before {
            content: "";
            width: 8px;
            height: 8px;
            border-radius: 999px;
            background: #22c55e;
            box-shadow: 0 0 10px rgba(34, 197, 94, 0.85);
        }


        /* Professional spectrogram toolbar */
        #block-spectrogram .spectrogram-panel {
            padding: 14px;
            border-radius: 14px;
            background:
                    radial-gradient(900px 220px at 50% -30%, rgba(59, 130, 246, 0.14), transparent 65%),
                    linear-gradient(180deg, rgba(24, 34, 52, 0.98), rgba(14, 22, 36, 0.98));
            border: 1px solid rgba(120, 160, 220, 0.18);
        }

        #block-spectrogram .spectrogram-toolbar {
            display: grid;
            grid-template-columns: minmax(160px, 220px) repeat(4, minmax(132px, 1fr)) minmax(180px, 240px);
            gap: 10px;
            align-items: center;
            margin-bottom: 12px;
            padding: 10px;
            border-radius: 12px;
            background: rgba(8, 13, 25, 0.58);
            border: 1px solid rgba(148, 163, 184, 0.12);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
        }

        #block-spectrogram .spectrogram-control,
        #block-spectrogram .spectrogram-toggle,
        #block-spectrogram .spectrogram-range-control {
            min-height: 42px;
            box-sizing: border-box;
            display: inline-flex;
            align-items: center;
            gap: 9px;
            padding: 8px 10px;
            border-radius: 10px;
            color: #dbe7ff;
            background: rgba(255, 255, 255, 0.035);
            border: 1px solid rgba(148, 163, 184, 0.12);
            font-size: 12px;
            font-weight: 700;
            white-space: nowrap;
        }

        #block-spectrogram .spectrogram-control-label {
            color: #93a4c7;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.08em;
        }

        #block-spectrogram .spectrogram-select {
            width: 100%;
            height: 34px;
            min-width: 0;
            border-radius: 8px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: #111827;
            color: #f8fafc;
            padding: 0 10px;
            outline: none;
        }

        #block-spectrogram .spectrogram-toggle {
            cursor: pointer;
            justify-content: flex-start;
        }

        #block-spectrogram .spectrogram-toggle input {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }

        #block-spectrogram .spectrogram-toggle-ui {
            position: relative;
            width: 34px;
            height: 18px;
            flex: 0 0 34px;
            border-radius: 999px;
            background: #475569;
            box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
            transition: background-color 0.18s ease, box-shadow 0.18s ease;
        }

        #block-spectrogram .spectrogram-toggle-ui::before {
            content: "";
            position: absolute;
            width: 14px;
            height: 14px;
            left: 2px;
            top: 2px;
            border-radius: 50%;
            background: #e5e7eb;
            transition: transform 0.18s ease;
        }

        #block-spectrogram .spectrogram-toggle input:checked + .spectrogram-toggle-ui {
            background: linear-gradient(90deg, #2563eb, #22c55e);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
        }

        #block-spectrogram .spectrogram-toggle input:checked + .spectrogram-toggle-ui::before {
            transform: translateX(16px);
            background: #ffffff;
        }

        #block-spectrogram .spectrogram-toggle:focus-within,
        #block-spectrogram .spectrogram-select:focus,
        #block-spectrogram .spectrogram-range-control:focus-within {
            border-color: rgba(96, 165, 250, 0.55);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
        }

        #block-spectrogram .spectrogram-range-control {
            justify-content: space-between;
        }

        #block-spectrogram .spectrogram-range-control input {
            width: 130px;
            accent-color: #3b82f6;
        }

        #block-spectrogram .spectrogram-chart {
            width: 100%;
            height: clamp(320px, 46vh, 620px);
            min-height: 320px;
            border-radius: 12px;
            overflow: hidden;
            background: #080f1f;
            border: 1px solid rgba(148, 163, 184, 0.10);
        }

        @media (max-width: 1280px) {
            #block-spectrogram .spectrogram-toolbar {
                grid-template-columns: repeat(3, minmax(170px, 1fr));
            }
        }

        @media (max-width: 760px) {
            #block-spectrogram .spectrogram-toolbar {
                grid-template-columns: 1fr;
            }

            #block-spectrogram .spectrogram-range-control input {
                width: 100%;
            }
        }



        /* IF response chart display switches */
        .if-response-display-options {
            display: flex;
            flex-wrap: wrap;
            gap: 10px 14px;
            align-items: center;
            margin: 8px 0 10px;
            padding: 8px 10px;
            border: 1px solid rgba(148,163,184,.18);
            border-radius: 10px;
            background: rgba(15,23,42,.45);
            color: #dbeafe;
            font-size: 12px;
        }
        .if-response-display-options label {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            user-select: none;
        }
        .if-response-display-options input[type="checkbox"] {
            accent-color: #38bdf8;
        }


        .display-performance-panel {
            margin: 10px 0 12px;
            padding: 12px 14px;
            border-radius: 12px;
            background: rgba(15, 23, 42, 0.82);
            border: 1px solid rgba(120, 160, 220, 0.18);
            color: #dbe7ff;
        }

        .display-performance-header {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 10px;
            font-size: 13px;
            font-weight: 700;
        }

        .display-performance-note {
            color: #9fb2d8;
            font-size: 12px;
            font-weight: 500;
        }

        .display-performance-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
            gap: 10px 14px;
        }

        .display-performance-control {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 6px 10px;
            align-items: center;
            font-size: 12px;
        }

        .display-performance-control input[type="range"] {
            grid-column: 1 / -1;
            width: 100%;
        }

        .display-performance-value {
            color: #f8fafc;
            font-weight: 800;
            font-variant-numeric: tabular-nums;
        }
span.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;

  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);

  color: #d7dde8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;

  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              transform 0.15s ease, box-shadow 0.15s ease;
}




/* =========================================================
   OSCINEX LIVE PREMIUM THEME OVERRIDE
   Aligns the analyser platform with the Oscinex landing page.
   ========================================================= */
:root{
  --bg:#050914;
  --bg2:#071224;
  --surface:rgba(10,21,40,.72);
  --surface-strong:rgba(12,25,48,.88);
  --header:rgba(5,12,24,.76);
  --border:rgba(125,211,252,.18);
  --border-strong:rgba(125,211,252,.30);
  --text:#f8fbff;
  --muted:#9fb2cc;
  --blue:#38bdf8;
  --blue-hover:#2563eb;
  --cyan:#67e8f9;
  --green:#22c55e;
  --orange:#f59e0b;
  --danger:#ef4444;
  --danger-hover:#dc2626;
  --shadow:0 28px 90px rgba(0,0,0,.52);
}

html{
  background:#050914;
}

body{
  margin:0;
  padding:20px;
  color:var(--text);
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(900px 520px at 72% 8%, rgba(56,189,248,.20), transparent 62%),
    radial-gradient(700px 460px at 14% 22%, rgba(37,99,235,.24), transparent 58%),
    radial-gradient(700px 460px at 72% 88%, rgba(34,197,94,.10), transparent 60%),
    linear-gradient(180deg,#050914 0%,#071224 42%,#050914 100%) !important;
  overflow-x:hidden;
}

body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:-1;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size:52px 52px;
  mask-image:radial-gradient(circle at 50% 10%, black, transparent 72%);
}

body::after{
  content:"";
  position:fixed;
  inset:-20%;
  pointer-events:none;
  z-index:-2;
  opacity:.42;
  filter:blur(42px);
  background:
    radial-gradient(circle at 20% 30%, rgba(56,189,248,.20), transparent 28%),
    radial-gradient(circle at 78% 22%, rgba(34,197,94,.15), transparent 24%),
    radial-gradient(circle at 64% 74%, rgba(168,85,247,.12), transparent 22%);
  animation:oscinexDrift 14s ease-in-out infinite alternate;
}

@keyframes oscinexDrift{
  from{transform:translate3d(-2%,-1%,0) scale(1)}
  to{transform:translate3d(2%,2%,0) scale(1.06)}
}

/* Premium top brand bar */
.oscinex-platform-topbar{
  position:sticky;
  top:0;
  z-index:5000;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin:0 0 18px;
  padding:14px 16px;
  border:1px solid var(--border);
  background:rgba(5,12,24,.78);
  backdrop-filter:blur(22px);
  border-radius:24px;
  box-shadow:var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
}

.oscinex-brand{
  display:flex;
  align-items:center;
  gap:12px;
  color:#fff;
  font-weight:950;
  letter-spacing:-.04em;
  white-space:nowrap;
}

.oscinex-mark{
  width:46px;
  height:46px;
  border-radius:16px;
  display:grid;
  place-items:center;
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.55), transparent 18%),
    linear-gradient(135deg,#0ea5e9,#2563eb 55%,#22c55e);
  box-shadow:0 0 34px rgba(56,189,248,.36);
}

.oscinex-mark svg{
  width:32px;
  height:32px;
  filter:drop-shadow(0 0 10px rgba(255,255,255,.35));
}

.oscinex-brand-name{
  font-size:22px;
}

.oscinex-live{
  color:var(--cyan);
  font-size:12px;
  margin-left:6px;
  letter-spacing:.12em;
}

.oscinex-status-row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}

.oscinex-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(125,211,252,.18);
  background:rgba(8,17,31,.56);
  color:#d9e8ff;
  font-size:13px;
  font-weight:850;
}

.oscinex-pill.live{
  color:#d9fbe8;
  border-color:rgba(34,197,94,.22);
  background:rgba(34,197,94,.10);
}

.oscinex-dot{
  width:9px;
  height:9px;
  border-radius:999px;
  background:var(--green);
  box-shadow:0 0 0 7px rgba(34,197,94,.10),0 0 20px rgba(34,197,94,.7);
}

/* Global panels/cards */
.workflow-mode-toggle,
.advanced-workflow-note,
.workflow-bar,
.controls,
.controls-toolbar,
.display-performance-panel,
.card,
.chart-block,
.measure-focused-shell,
.leakage-panel,
.sweep-status-card,
.floating-panel,
.dlg-card,
#dashboard > .right-pane,
.top-pane,
.left-pane{
  border-color:var(--border) !important;
  background:
    radial-gradient(600px 240px at 18% 0%, rgba(56,189,248,.08), transparent 62%),
    linear-gradient(180deg, rgba(11,24,45,.78), rgba(4,11,24,.86)) !important;
  box-shadow:var(--shadow), inset 0 1px 0 rgba(255,255,255,.05) !important;
  border-radius:24px !important;
}

.workflow-bar{
  padding:16px !important;
  margin:18px 0 !important;
}

.workflow-tabs{
  gap:14px !important;
}

.workflow-tab{
  border:1px solid rgba(125,211,252,.18) !important;
  border-radius:24px !important;
  background:rgba(8,17,31,.66) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05) !important;
  transition:transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.workflow-tab:hover{
  transform:translateY(-2px);
  border-color:rgba(56,189,248,.34) !important;
  box-shadow:0 18px 48px rgba(37,99,235,.20), inset 0 1px 0 rgba(255,255,255,.08) !important;
}

.workflow-tab.active{
  border-color:rgba(34,197,94,.42) !important;
  box-shadow:0 0 34px rgba(34,197,94,.13), inset 0 1px 0 rgba(255,255,255,.09) !important;
}

.workflow-tab-title,
h1,h2,h3,
.panel-title-row strong{
  color:#fff !important;
  letter-spacing:-.035em;
}

.workflow-tab-subtitle,
.workflow-tab-meta,
.workflow-copy,
.advanced-workflow-note,
.display-performance-note,
.mode-caption,
.sweep-note{
  color:var(--muted) !important;
}

/* Buttons like landing page */
button,
.btn,
.workflow-tab-open-btn,
.collapse-btn,
.dlg-btn,
.dlg-mini,
.export-btn{
  border:1px solid rgba(255,255,255,.12) !important;
  border-radius:999px !important;
  background:rgba(255,255,255,.055) !important;
  color:#fff !important;
  font-weight:850 !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08);
  transition:transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

button:hover,
.btn:hover,
.workflow-tab-open-btn:hover,
.collapse-btn:hover,
.dlg-btn:hover,
.dlg-mini:hover,
.export-btn:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.09) !important;
  border-color:rgba(56,189,248,.26) !important;
}

.btn-primary,
button.btn-primary,
#startBtn,
#startSweepBtn,
.layout-toolbar .btn-primary{
  border-color:rgba(56,189,248,.35) !important;
  background:linear-gradient(135deg,#38bdf8,#2563eb) !important;
  box-shadow:0 18px 48px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.22) !important;
}

.btn-danger,
.dlg-danger{
  background:linear-gradient(135deg,#ef4444,#b91c1c) !important;
}

/* Inputs */
select,
input,
textarea{
  border:1px solid rgba(125,211,252,.18) !important;
  border-radius:16px !important;
  background:rgba(3,8,18,.55) !important;
  color:#f8fbff !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}

select:focus,
input:focus,
textarea:focus{
  border-color:rgba(56,189,248,.55) !important;
  box-shadow:0 0 0 4px rgba(56,189,248,.10) !important;
}

label,
.field > label{
  color:#dbeafe !important;
}

/* Main dashboard breathing room */
#dashboard{
  gap:18px !important;
}

.top-pane,
.left-pane,
.right-pane{
  padding:14px !important;
}

.chart-block{
  padding:18px !important;
  margin:12px 0 !important;
  overflow:hidden;
}

.chart-block h3{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:0;
  font-size:18px;
}

/* Badges */
.section-badge,
.leakage-badge,
.type-pill,
.pill{
  border:1px solid rgba(125,211,252,.18) !important;
  background:rgba(56,189,248,.10) !important;
  color:#dff7ff !important;
  border-radius:999px !important;
  font-weight:850 !important;
}

/* Plot containers */
#fft,
#waveform,
#phase,
#groupDelay,
#spectrogram,
#spatial,
#interferogram,
#cisprCompliance,
#rbwTradeoff,
#measureFocusedChart,
#cisprSweepResultsChart,
#pfbShapeChart{
  border:1px solid rgba(255,255,255,.08);
  border-radius:20px !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(56,189,248,.10), transparent 38%),
    #06101f !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04), 0 18px 44px rgba(0,0,0,.25);
}

/* Tables and lists */
.offenders-card,
.dlg-item,
.fft-info-card{
  border:1px solid rgba(125,211,252,.16) !important;
  border-radius:18px !important;
  background:rgba(8,17,31,.62) !important;
}

.offenders-table th{
  background:rgba(56,189,248,.08) !important;
  color:#dbeafe !important;
}

.offenders-table td{
  border-bottom:1px solid rgba(255,255,255,.08) !important;
}

/* Performance panel */
.display-performance-grid{
  gap:14px !important;
}

.display-performance-control{
  border:1px solid rgba(125,211,252,.14);
  border-radius:18px;
  padding:14px;
  background:rgba(3,8,18,.35);
}

/* Sliders */
input[type="range"]{
  accent-color:#38bdf8;
}

/* Switches */
.slider{
  background:rgba(148,163,184,.24) !important;
}

input:checked + .slider{
  background:linear-gradient(90deg,#38bdf8,#22c55e) !important;
  box-shadow:0 0 16px rgba(56,189,248,.35) !important;
}

/* Scrollbar */
::-webkit-scrollbar{width:14px;height:14px}
::-webkit-scrollbar-track{background:#050914}
::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,rgba(56,189,248,.34),rgba(37,99,235,.30));
  border-radius:999px;
  border:3px solid #050914;
}
::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,#38bdf8,#2563eb)}
*{scrollbar-color:#2563eb #050914}

/* Loader */
#loader-container{
  background:
    radial-gradient(700px 380px at 50% 25%, rgba(56,189,248,.18), transparent 60%),
    #050914 !important;
}
#loader{
  border-color:rgba(255,255,255,.10) !important;
  border-top-color:#38bdf8 !important;
  box-shadow:0 0 34px rgba(56,189,248,.30);
}

/* Modal polish */
.dlg-backdrop,
.modal{
  background:rgba(2,6,23,.76) !important;
  backdrop-filter:blur(18px);
}

/* Responsive */
@media(max-width:980px){
  body{padding:12px}
  .oscinex-platform-topbar{align-items:flex-start;flex-direction:column}
  .oscinex-status-row{justify-content:flex-start}
  .controls-left{grid-template-columns:1fr !important}
  .field{grid-template-columns:1fr !important}
}




/* =========================================================
   OSCINEX FIX PACK
   Fixes topbar z-index layering and detached/open panel clipping.
   ========================================================= */

/* Keep the platform header above normal page content, but BELOW modals */
.oscinex-platform-topbar{
  position: sticky !important;
  top: 12px !important;
  z-index: 900 !important;
  margin-bottom: 24px !important;
  overflow: visible !important;
}

/* Prevent red/amber auto-reply banner from appearing behind/through header */
#scopeStatus,
#analyzeReplayFloatingBanner,
.auto-reply-banner,
.analyze-replay-floating-banner,
[class*="floatingBanner"],
[id*="FloatingBanner"]{
  z-index: 850 !important;
}

/* Detached workflow/open panels must appear above topbar */
#workflowDetachedBackdrop{
  position: fixed !important;
  inset: 0 !important;
  z-index: 2500 !important;
  background: rgba(2,6,23,.72) !important;
  backdrop-filter: blur(18px) !important;
}

#workflowDetachedPanel{
  position: fixed !important;
  z-index: 2600 !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;

  width: min(1120px, calc(100vw - 34px)) !important;
  max-height: min(86vh, 920px) !important;
  overflow: hidden !important;

  border: 1px solid rgba(125,211,252,.28) !important;
  border-radius: 30px !important;
  background:
    radial-gradient(520px 230px at 50% 0%, rgba(56,189,248,.18), transparent 62%),
    linear-gradient(180deg, rgba(11,24,45,.98), rgba(3,8,18,.98)) !important;
  box-shadow: 0 44px 140px rgba(0,0,0,.74), inset 0 1px 0 rgba(255,255,255,.07) !important;
}

#workflowDetachedPanel[aria-hidden="true"]{
  display: none !important;
}

#workflowDetachedPanel[aria-hidden="false"]{
  display: flex !important;
  flex-direction: column !important;
}

.workflow-detached-header{
  position: sticky !important;
  top: 0 !important;
  z-index: 3 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:16px !important;
  padding:18px 22px !important;
  background: rgba(15,23,42,.88) !important;
  backdrop-filter: blur(18px) !important;
  border-bottom: 1px solid rgba(125,211,252,.18) !important;
}

.workflow-detached-title{
  color:#fff !important;
  font-size:22px !important;
  font-weight:950 !important;
  letter-spacing:-.04em !important;
}

.workflow-detached-subtitle{
  color:var(--muted,#9fb2cc) !important;
  margin-top:4px !important;
}

.workflow-detached-body{
  flex:1 1 auto !important;
  min-height:0 !important;
  overflow-y:auto !important;
  padding:22px !important;
}

/* Stop modal content from clipping at the top */
.workflow-detached-body .chart-block,
.workflow-detached-body .card,
.workflow-detached-body .leakage-panel,
.workflow-detached-body .measure-focused-shell{
  max-height:none !important;
  overflow:visible !important;
}

/* Open panel plot containers need real height */
.workflow-detached-body #fft,
.workflow-detached-body #waveform,
.workflow-detached-body #phase,
.workflow-detached-body #groupDelay,
.workflow-detached-body #spectrogram,
.workflow-detached-body #spatial,
.workflow-detached-body #interferogram,
.workflow-detached-body #cisprCompliance,
.workflow-detached-body #measureFocusedChart{
  min-height:320px !important;
  height:clamp(320px, 48vh, 620px) !important;
}

/* Close / action icons should float correctly in panel cards */
.chart-block .section-badge,
.workflow-detached-body .section-badge{
  z-index:4 !important;
}

/* Prevent accidental horizontal overflow in detached panel */
.workflow-detached-body *,
#workflowDetachedPanel *{
  max-width:100%;
}

/* The old dashboard sometimes overlays content using absolute controls; normalize stacking */
.workflow-bar,
.controls-wrapper,
#dashboard,
.top-pane,
.left-pane,
.right-pane{
  position:relative !important;
  z-index:1 !important;
}

/* Keep normal popups above all */
.dlg-backdrop,
.modal,
#violationsModalPopUp,
#violationsModal{
  z-index:3000 !important;
}

/* If Plotly modebar is hidden/cut off, keep it on top inside panels */
.modebar,
.modebar-container{
  z-index:20 !important;
}

/* Make open panel feel like the landing page, not a dark block */
.workflow-detached-body{
  background:
    radial-gradient(900px 420px at 70% 0%, rgba(56,189,248,.10), transparent 60%),
    linear-gradient(180deg, rgba(5,12,24,.20), rgba(5,12,24,.42)) !important;
}

@media(max-width:760px){
  .oscinex-platform-topbar{
    top:6px !important;
  }
  #workflowDetachedPanel{
    width:calc(100vw - 18px) !important;
    max-height:90vh !important;
    border-radius:22px !important;
  }
  .workflow-detached-body{
    padding:14px !important;
  }
}



/* =========================================================
   OSCINEX LANDING-STYLE PLATFORM NAV FIX
   Single-row glass nav, clickable brand, aligned user pills,
   animated Connected + Logout buttons.
   ========================================================= */
:root{
  --osc-bg:#050914;
  --osc-line:rgba(125,211,252,.18);
  --osc-text:#f8fbff;
  --osc-muted:#9fb2cc;
  --osc-blue:#38bdf8;
  --osc-blue2:#2563eb;
  --osc-green:#22c55e;
  --osc-cyan:#67e8f9;
  --osc-red:#ef4444;
  --osc-red2:#dc2626;
  --osc-shadow:0 28px 90px rgba(0,0,0,.52);
}

.platform-topnav,
.oscinex-platform-nav{
  height:86px !important;
  min-height:86px !important;
  display:flex !important;
  align-items:center !important;
  gap:14px !important;
  padding:14px 18px !important;
  border:1px solid var(--osc-line) !important;
  border-radius:0 0 24px 24px !important;
  background:rgba(5,12,24,.86) !important;
  backdrop-filter:blur(22px) !important;
  box-shadow:0 18px 60px rgba(0,0,0,.36), inset 0 1px 0 rgba(255,255,255,.06) !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
}

/* Important: do not nest a second full topbar inside .platform-topnav */
.platform-topnav > .oscinex-platform-topbar{
  display:contents !important;
  height:auto !important;
  min-height:0 !important;
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  background:transparent !important;
  box-shadow:none !important;
}

.oscinex-brand-btn{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:12px !important;
  height:50px !important;
  padding:6px 16px 6px 8px !important;
  margin:0 12px 0 0 !important;
  border:1px solid rgba(56,189,248,.32) !important;
  border-radius:999px !important;
  background:linear-gradient(135deg,rgba(56,189,248,.16),rgba(37,99,235,.10)) !important;
  color:#fff !important;
  cursor:pointer !important;
  white-space:nowrap !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 0 32px rgba(56,189,248,.10) !important;
  transition:transform .25s ease, box-shadow .25s ease, border-color .25s ease, filter .25s ease !important;
}

.oscinex-brand-btn:hover{
  transform:translateY(-2px) scale(1.015) !important;
  border-color:rgba(56,189,248,.55) !important;
  box-shadow:0 0 34px rgba(56,189,248,.28), inset 0 1px 0 rgba(255,255,255,.12) !important;
  filter:drop-shadow(0 0 14px rgba(56,189,248,.25)) !important;
}

.oscinex-brand-btn:active{transform:scale(.98) !important;}

.oscinex-brand{
  display:inline-flex !important;
  align-items:center !important;
  gap:12px !important;
}

.oscinex-mark,
.brand-mark{
  width:42px !important;
  height:42px !important;
  min-width:42px !important;
  border-radius:15px !important;
  display:grid !important;
  place-items:center !important;
  overflow:hidden !important;
  background:
    radial-gradient(circle at 28% 24%,rgba(255,255,255,.55),transparent 18%),
    linear-gradient(135deg,#0ea5e9,#2563eb 55%,#22c55e) !important;
  box-shadow:0 0 30px rgba(56,189,248,.36) !important;
}

.oscinex-mark svg,
.brand-mark svg{
  width:30px !important;
  height:30px !important;
  filter:drop-shadow(0 0 10px rgba(255,255,255,.35)) !important;
}

.oscinex-brand-name,
.brand-name{
  font-size:17px !important;
  font-weight:950 !important;
  letter-spacing:-.04em !important;
  color:#fff !important;
}

.oscinex-live,
.brand-live{
  color:var(--osc-cyan) !important;
  font-size:10px !important;
  margin-left:5px !important;
  letter-spacing:.12em !important;
}

.platform-topnav button:not(.oscinex-brand-btn):not(.logout-btn),
.platform-topnav a{
  height:44px !important;
  display:inline-flex !important;
  align-items:center !important;
  gap:8px !important;
  padding:0 14px !important;
  border:1px solid transparent !important;
  border-radius:999px !important;
  background:transparent !important;
  color:#b8c7dc !important;
  font-weight:850 !important;
  text-decoration:none !important;
  white-space:nowrap !important;
  cursor:pointer !important;
  transition:transform .22s ease, background .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease !important;
}

.platform-topnav button:not(.oscinex-brand-btn):not(.logout-btn):hover,
.platform-topnav a:hover{
  color:#fff !important;
  background:rgba(255,255,255,.06) !important;
  transform:translateY(-1px) !important;
}

.platform-topnav button.active:not(.oscinex-brand-btn){
  color:#fff !important;
  border-color:rgba(56,189,248,.34) !important;
  background:linear-gradient(135deg,rgba(56,189,248,.20),rgba(37,99,235,.16)) !important;
  box-shadow:0 0 30px rgba(56,189,248,.14), inset 0 1px 0 rgba(255,255,255,.12) !important;
}

.platform-user-area,
.user-actions{
  margin-left:auto !important;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:12px !important;
  white-space:nowrap !important;
}

.platform-user-pill,
.user-pill{
  height:44px !important;
  display:inline-flex !important;
  align-items:center !important;
  gap:9px !important;
  padding:0 18px !important;
  border-radius:999px !important;
  border:1px solid rgba(34,197,94,.22) !important;
  background:rgba(34,197,94,.10) !important;
  color:#d9fbe8 !important;
  font-weight:850 !important;
}

.platform-connection,
.connected-btn{
  height:44px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:9px !important;
  padding:0 20px !important;
  border-radius:999px !important;
  border:1px solid rgba(56,189,248,.28) !important;
  background:linear-gradient(135deg,#38bdf8,#2563eb) !important;
  color:#fff !important;
  font-weight:900 !important;
  box-shadow:0 12px 30px rgba(37,99,235,.30), inset 0 1px 0 rgba(255,255,255,.22) !important;
}

.logout-btn{
  position:relative !important;
  overflow:hidden !important;
  height:44px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:10px !important;
  padding:0 20px !important;
  border:none !important;
  border-radius:999px !important;
  cursor:pointer !important;
  color:#fff !important;
  font-weight:900 !important;
  background:linear-gradient(135deg,#ef4444,#dc2626) !important;
  box-shadow:0 12px 30px rgba(239,68,68,.28), inset 0 1px 0 rgba(255,255,255,.20) !important;
  transition:transform .28s ease, box-shadow .28s ease, background .35s ease, filter .35s ease !important;
}

.logout-btn::before{
  content:"" !important;
  position:absolute !important;
  inset:0 !important;
  border-radius:999px !important;
  background:linear-gradient(120deg,transparent 25%,rgba(255,255,255,.25) 50%,transparent 75%) !important;
  transform:translateX(-150%) !important;
  transition:transform .6s ease !important;
}

.logout-btn:hover{
  transform:translateY(-3px) scale(1.04) !important;
  background:linear-gradient(135deg,#ff5b5b,#e11d48) !important;
  box-shadow:0 18px 45px rgba(239,68,68,.45),0 0 30px rgba(255,80,80,.30) !important;
}

.logout-btn:hover::before{transform:translateX(150%) !important;}
.logout-btn i{transition:transform .35s ease !important;}
.logout-btn:hover i{transform:translateX(4px) !important;}
.logout-btn:active{transform:translateY(0) scale(.98) !important;}

@media(max-width:980px){
  .platform-topnav{height:auto !important;min-height:86px !important;flex-wrap:wrap !important;}
  .platform-user-area{margin-left:0 !important;width:100% !important;justify-content:flex-start !important;}
}
.chart-block{
  width:100% !important;
  min-width:0 !important;
  margin-left:0 !important;
  margin-right:0 !important;
  cursor:default;
}

/* Forms and sticky controls */
.controls{
  position:sticky;
  top:env(safe-area-inset-top,0px);
  display:grid !important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)) !important;
  gap:12px !important;
  align-items:end !important;
  overflow:visible !important;
}
.controls .field,.controls .inline,.controls-left,.controls-right,.controls-right .row{
  min-width:0 !important;
  width:100% !important;
  flex-wrap:wrap !important;
}
label,.controls .field > label{
  width:auto !important;
  max-width:100% !important;
  white-space:normal !important;
}
select,input,textarea,.controls select,.controls input[type="text"],.controls input[type="number"],.controls input[type="search"]{
  width:100% !important;
  min-width:0 !important;
}
.controls button,.controls .btn{width:auto;min-height:42px;}

/* Charts, Plotly, and canvases */
#fft,#waveform,#cisprCompliance,#rbwTradeoff,[id$="Chart"],.plot-container,.svg-container,.main-svg{
  max-width:100% !important;
}
#fft,#waveform,#cisprCompliance,#rbwTradeoff{
  width:100% !important;
  min-height:clamp(320px,52vh,560px) !important;
}
.js-plotly-plot,.plotly,.plot-container{width:100% !important;}

/* Tables should scroll inside their own frame, not the page */
.table-wrap,table,.data-table-wrap{
  overflow-x:auto !important;
  -webkit-overflow-scrolling:touch;
}
.table-wrap table,table.responsive-table{
  min-width:680px;
}

/* =========================================================
   RBW Compliance panel layout fix — right-pane safe
   Place at END of oscinex-analyser.css
   ========================================================= */
#dashboard{
  grid-template-columns: minmax(0, 1fr) minmax(520px, 0.48fr) !important;
  gap: 16px !important;
  overflow-x: hidden !important;
}

#dashboard > .left-pane,
#dashboard > .right-pane,
#right-pane,
#block-fftInfo{
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#dashboard > .right-pane{
  overflow-x: hidden !important;
}

#block-fftInfo{
  padding: 18px !important;
  overflow: hidden !important;
}

#block-fftInfo .switch-row{
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 14px !important;
}

#block-fftInfo .switch-row h3{
  min-width: 0 !important;
  margin: 0 !important;
  font-size: clamp(18px, 1.25vw, 22px) !important;
  line-height: 1.18 !important;
  white-space: normal !important;
}

#block-fftInfo .section-badge{
  display: none !important;
}

#block-fftInfo .fft-container,
#block-fftInfo .fft-info-panel,
#block-fftInfo .fft-chart-panel,
#block-fftInfo #moduleCisprCompliance,
#block-fftInfo #fft-basic-info{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

#block-fftInfo .fft-container{
  display: block !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#block-fftInfo .fft-info-header{
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px 14px !important;
  align-items: end !important;
  padding: 0 0 18px !important;
  margin: 0 0 18px !important;
  border-bottom: 1px solid rgba(125,211,252,.14) !important;
  overflow: visible !important;
}

#block-fftInfo .fft-input-group{
  min-width: 0 !important;
  width: 100% !important;
  display: grid !important;
  grid-template-columns: auto auto minmax(88px, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
}

#block-fftInfo .fft-input-group label{
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: normal !important;
  line-height: 1.15 !important;
  font-size: 12px !important;
}

#block-fftInfo .fft-input-group input,
#block-fftInfo .fft-input-group select{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 34px !important;
}

#block-fftInfo .fft-input-group:has(#rbwModeSelect){
  grid-column: 1 / -1 !important;
  grid-template-columns: auto auto minmax(180px, 1fr) !important;
}

#block-fftInfo #fft-basic-info{
  padding: 18px 22px !important;
  border-radius: 24px !important;
}

#block-fftInfo .fft-info-grid{
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0 32px !important;
  width: 100% !important;
  min-width: 0 !important;
}

#block-fftInfo .fft-info-grid > div{
  min-width: 0 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(74px, auto) !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 0 !important;
  border-bottom: 1px solid rgba(125,211,252,.10) !important;
}

#block-fftInfo .fft-info-grid b,
#block-fftInfo .fft-info-grid span{
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#block-fftInfo .fft-info-grid span{
  text-align: right !important;
}

#block-fftInfo #cisprCompliance,
#block-fftInfo #cisprSummary,
#block-fftInfo #rbwTradeoff,
#block-fftInfo #pfbShapePanel,
#block-fftInfo #moduleCisprCompliance p{
  display: none !important;
}

/* avoid floating auto-reply/status pill covering the RBW controls */
#block-fftInfo .auto-reply-banner,
#block-fftInfo [id*="autoReply"],
#block-fftInfo [class*="auto-reply"],
#block-fftInfo [class*="autoreply"]{
  position: static !important;
  display: inline-flex !important;
  max-width: 100% !important;
  margin: 0 0 10px auto !important;
  transform: none !important;
}

@media (max-width: 1500px){
  #dashboard{
    grid-template-columns: minmax(0, 1fr) minmax(500px, .55fr) !important;
  }
  #block-fftInfo .fft-info-grid{
    gap: 0 22px !important;
  }
}

@media (max-width: 1150px){
  #dashboard{
    grid-template-columns: 1fr !important;
  }
  #dashboard > .right-pane{
    grid-column: 1 !important;
  }
  #block-fftInfo .fft-info-header,
  #block-fftInfo .fft-info-grid{
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px){
  #block-fftInfo{
    padding: 14px !important;
  }
  #block-fftInfo .switch-row{
    grid-template-columns: 1fr auto !important;
  }
  #block-fftInfo .fft-info-header,
  #block-fftInfo .fft-input-group,
  #block-fftInfo .fft-input-group:has(#rbwModeSelect){
    grid-template-columns: 1fr !important;
  }
  #block-fftInfo .fft-info-grid > div{
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }
  #block-fftInfo .fft-info-grid span{
    text-align: left !important;
  }
}

/* =========================================================
   Measure focused detector header polish
   Match the rest of the chart-card headers, e.g. Capture Window.
   ========================================================= */
.measure-focused-shell{
  padding:28px 18px 14px !important;
  border-radius:32px !important;
  overflow:hidden !important;
}

.measure-focused-shell > .panel-title-row{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:12px !important;
  min-height:38px !important;
  margin:0 0 20px !important;
  padding:0 !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}

.measure-focused-shell > .panel-title-row strong{
  display:block !important;
  margin:0 !important;
  color:#fff !important;
  font-size:22px !important;
  line-height:1.15 !important;
  font-weight:950 !important;
  letter-spacing:-.055em !important;
}

.measure-focused-shell #measureFocusedChart,
.measure-focused-shell .measure-focused-chart{
  margin-top:0 !important;
  border-radius:22px !important;
}

/* =========================================================
   SWEEP PANEL LAYOUT FIX
   Keeps content away from card edges and docks actions at bottom.
   ========================================================= */
#moduleCisprSweep {
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
  padding: 24px 28px 26px !important;
}

#moduleCisprSweep > h3 {
  margin: 0 0 20px !important;
}

#moduleCisprSweep .sweep-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
  width: 100% !important;
  min-width: 0 !important;
}

#moduleCisprSweep .field {
  display: grid !important;
  grid-template-columns: minmax(190px, 200px) minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

#moduleCisprSweep .field > label {
  width: auto !important;
  margin: 0 !important;
  padding-left: 0 !important;
  line-height: 1.35 !important;
}

#moduleCisprSweep .field > input,
#moduleCisprSweep .field > select {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

#moduleCisprSweep .sweep-note {
  margin: 16px 0 0 !important;
  padding: 0 2px !important;
  color: #9fb2cc !important;
  line-height: 1.5 !important;
}

#moduleCisprSweep .sweep-actions {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  width: 100% !important;
  margin-top: 18px !important;
  padding-top: 18px !important;
  border-top: 1px solid rgba(125, 211, 252, .14) !important;
}

#moduleCisprSweep .sweep-actions button {
  min-height: 42px !important;
  margin: 0 !important;
}

#moduleUnits {
  margin-top: 24px !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

@media (max-width: 760px) {
  #moduleCisprSweep {
    padding: 20px 18px 22px !important;
  }

  #moduleCisprSweep .field {
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  #moduleCisprSweep .sweep-actions button {
    flex: 1 1 180px !important;
  }
}


/* =========================================================
   CONFIGURATION PANELS — consistent spacing and edge padding
   Applies the Sweep panel treatment to CISPR, Manual Limits,
   Calibration, FFT Time Domain Setup, and Emission Unit.
   ========================================================= */
#controlsPanel > .card{
  padding:18px !important;
  box-sizing:border-box !important;
}

#controlsPanel .config-section,
#moduleManualLimitsCard,
#moduleCalibration,
#moduleReceiver,
#moduleUnits,
#moduleComplianceControls{
  width:100% !important;
  margin:0 0 12px !important;
  padding:22px 24px 24px !important;
  box-sizing:border-box !important;
  border:1px solid rgba(125,211,252,.20) !important;
  border-radius:24px !important;
  background:
    radial-gradient(620px 220px at 12% 0%,rgba(56,189,248,.09),transparent 60%),
    linear-gradient(180deg,rgba(11,24,45,.72),rgba(4,11,24,.84)) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05) !important;
  overflow:hidden !important;
}

#controlsPanel .config-section > h3,
#moduleManualLimitsCard > h3,
#moduleCalibration > h3,
#moduleReceiver > h3,
#moduleUnits > h3,
#moduleComplianceControls > h3{
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  margin:0 0 20px !important;
  padding:0 !important;
  line-height:1.25 !important;
}

#controlsPanel .config-section .controls-left,
#moduleManualLimits,
#calibrationList{
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  gap:14px 18px !important;
  width:100% !important;
  min-width:0 !important;
}

#controlsPanel .config-section .field,
#moduleManualLimits .field,
#calibrationList .field{
  display:grid !important;
  grid-template-columns:minmax(185px,auto) minmax(0,1fr) !important;
  align-items:center !important;
  gap:14px !important;
  width:100% !important;
  min-width:0 !important;
  margin:0 !important;
}

#controlsPanel .config-section .field > label,
#moduleManualLimits .field > label,
#calibrationList .field > label{
  width:auto !important;
  min-width:0 !important;
  margin:0 !important;
  padding:0 !important;
  white-space:normal !important;
  line-height:1.35 !important;
}

#controlsPanel .config-section select,
#controlsPanel .config-section input,
#moduleManualLimits select,
#moduleManualLimits input,
#calibrationList select,
#calibrationList input{
  width:100% !important;
  min-width:0 !important;
  margin:0 !important;
  box-sizing:border-box !important;
}

#moduleComplianceControls #acquisitionModeHelp{
  grid-column:2 !important;
  margin:2px 0 0 !important;
  padding:0 2px !important;
  line-height:1.4 !important;
}

#moduleUnits .span-2{
  grid-column:1 / -1 !important;
}

#moduleCalibration .calibration-mode-placeholder{
  display:none !important;
}

#moduleManualLimitsCard .switch,
#moduleCalibration .switch{
  flex:0 0 auto !important;
  width:38px !important;
  margin:0 !important;
}

@media(max-width:1100px){
  #controlsPanel .config-section .controls-left,
  #moduleManualLimits,
  #calibrationList{
    grid-template-columns:1fr !important;
  }
  #moduleUnits .span-2{grid-column:auto !important;}
}

@media(max-width:700px){
  #controlsPanel > .card{padding:10px !important;}
  #controlsPanel .config-section,
  #moduleManualLimitsCard,
  #moduleCalibration,
  #moduleReceiver,
  #moduleUnits,
  #moduleComplianceControls{
    padding:18px 16px 20px !important;
    border-radius:20px !important;
  }
  #controlsPanel .config-section .field,
  #moduleManualLimits .field,
  #calibrationList .field{
    grid-template-columns:1fr !important;
    gap:7px !important;
  }
  #moduleComplianceControls #acquisitionModeHelp{grid-column:1 !important;}
}


/* =========================================================
   FINAL CONTROL POLISH — Gaussian default, peak sliders, sweep actions
   ========================================================= */
.controls-toolbar{
  display:grid !important;
  grid-template-columns:auto minmax(420px,1fr) auto !important;
  gap:18px !important;
  align-items:center !important;
  padding:14px 18px !important;
}

.stream-range-controls{
  display:grid !important;
  grid-template-columns:repeat(2,minmax(220px,1fr)) !important;
  gap:16px !important;
  align-items:center !important;
  min-width:0 !important;
}

.stream-range-control{
  display:grid !important;
  grid-template-columns:auto minmax(120px,1fr) auto !important;
  align-items:center !important;
  gap:10px !important;
  width:100% !important;
  margin:0 !important;
  padding:0 !important;
  white-space:nowrap !important;
}

.stream-range-label{
  color:#dbeafe !important;
  font-weight:800 !important;
}

.stream-range-value{
  grid-column:3 !important;
  min-width:46px !important;
  padding:5px 9px !important;
  border-radius:999px !important;
  text-align:center !important;
  color:#e0f2fe !important;
  background:rgba(56,189,248,.10) !important;
  border:1px solid rgba(56,189,248,.20) !important;
  font-variant-numeric:tabular-nums !important;
  font-weight:900 !important;
}

.stream-range-control input[type="range"]{
  grid-column:2 !important;
  grid-row:1 !important;
  width:100% !important;
  min-width:120px !important;
  margin:0 !important;
}

.sweep-actions{
  display:flex !important;
  flex-wrap:wrap !important;
  gap:12px !important;
  align-items:center !important;
  margin-top:20px !important;
  padding-top:18px !important;
  border-top:1px solid rgba(125,211,252,.12) !important;
}

.sweep-action-btn{
  min-height:46px !important;
  padding:0 18px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:9px !important;
  border-radius:14px !important;
  font-size:14px !important;
  line-height:1 !important;
}

.sweep-action-btn svg,
.sweep-action-btn i{
  width:18px !important;
  height:18px !important;
  flex:0 0 auto !important;
}

#stopSweepBtn:not(:disabled){
  border-color:rgba(248,113,113,.32) !important;
  background:linear-gradient(135deg,rgba(239,68,68,.92),rgba(185,28,28,.92)) !important;
}

#clearSweepBtn{
  border-color:rgba(245,158,11,.25) !important;
}

#exportSweepPdfBtn{
  border-color:rgba(168,85,247,.26) !important;
}

.sweep-action-btn:disabled{
  opacity:.48 !important;
  cursor:not-allowed !important;
  transform:none !important;
  box-shadow:none !important;
}

@media(max-width:1250px){
  .controls-toolbar{
    grid-template-columns:auto 1fr !important;
  }
  .toolbar-actions{
    grid-column:1 / -1 !important;
    justify-content:flex-end !important;
  }
}

@media(max-width:850px){
  .controls-toolbar{
    grid-template-columns:1fr !important;
  }
  .stream-range-controls{
    grid-template-columns:1fr !important;
  }
  .toolbar-actions{
    grid-column:auto !important;
    justify-content:flex-start !important;
  }
  .sweep-action-btn{
    flex:1 1 210px !important;
  }
}
