@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Chart Studio ===== */
.chart-studio-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cs-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cs-toolbar-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cs-toolbar-ghost {
  font-size: var(--text-xs);
  padding: var(--sp-1) var(--sp-3);
}

.cs-toolbar-ghost[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.cs-views-wrap {
  position: relative;
}

.cs-views-trigger {
  font-size: var(--text-xs);
  padding: var(--sp-1) var(--sp-3);
}

.cs-views-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  z-index: 40;
}

.cs-views-menu[hidden] {
  display: none;
}

.cs-views-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.cs-views-row[data-active="1"] {
  border-left: 3px solid var(--accent);
  padding-left: 7px;
}

.cs-views-row[data-active="1"] .cs-views-name-btn {
  font-weight: 700;
}

.cs-views-name-btn {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  padding: 4px 6px;
  margin: -4px -6px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
}

.cs-views-name-btn:hover:not(:disabled) {
  background: rgba(88, 166, 255, 0.08);
}

.cs-views-delete {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.cs-views-delete:hover {
  color: var(--negative);
  border-color: rgba(248, 81, 73, 0.4);
}

.cs-views-save-as {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  text-align: left;
}

.cs-views-save-as:hover {
  background: rgba(88, 166, 255, 0.08);
}

/* Series row + anchored picker */
.cs-series-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-series-bar-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.cs-add-series-btn {
  flex-shrink: 0;
}

.cs-series-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 36px;
  align-items: center;
  flex: 1;
}

.cs-chip,
.cs-empty-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 8px;
  font-size: 12px;
}

.cs-chip--dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.cs-chip--drop-target {
  border-style: dashed;
  border-color: var(--accent);
}

.cs-chip-body {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cs-chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(340px, 55vw);
}

.cs-chip-latest {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.cs-chip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.cs-chip-freshness {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  letter-spacing: 0.04em;
}

.cs-chip-freshness--fresh {
  color: var(--positive);
  background: rgba(63, 185, 80, 0.1);
  border-color: rgba(63, 185, 80, 0.3);
}

.cs-chip-freshness--warn {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.cs-chip-freshness--stale {
  color: var(--negative);
  background: rgba(248, 81, 73, 0.1);
  border-color: rgba(248, 81, 73, 0.3);
}

.cs-chip-swatch {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-sm);
  background: var(--cs-color);
  cursor: grab;
  box-shadow: 0 0 10px color-mix(in srgb, var(--cs-color) 45%, transparent);
}

.cs-chip-swatch:active {
  cursor: grabbing;
}

.cs-chip-more {
  position: relative;
  flex-shrink: 0;
  margin-left: 2px;
}

.cs-chip-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  border-radius: 999px;
  transition: background 120ms ease, color 120ms ease;
}

.cs-chip-menu-btn:hover,
.cs-chip-menu-btn[aria-expanded="true"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.cs-chip-menu-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cs-chip-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 156px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  padding: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 30;
}

.cs-chip-menu[hidden] {
  display: none;
}

.cs-chip-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 100ms ease;
}

.cs-chip-menu button:hover:not(:disabled),
.cs-chip-menu button:focus-visible:not(:disabled) {
  background: rgba(88, 166, 255, 0.12);
  outline: none;
}

.cs-chip-menu button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cs-chip-remove-opt {
  color: var(--negative);
  border-top: 1px solid var(--border-subtle) !important;
  margin-top: 2px;
  padding-top: 9px !important;
}

.cs-chip-remove-opt:hover:not(:disabled),
.cs-chip-remove-opt:focus-visible:not(:disabled) {
  background: rgba(248, 81, 73, 0.12) !important;
}

.cs-inline-add {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.cs-picker-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 35;
  width: min(640px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(13, 17, 23, 0.96);
  padding: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.48);
}

.cs-picker-popover[hidden] {
  display: none;
}

.cs-picker-popover--region-strip .cs-picker-columns {
  grid-template-columns: minmax(240px, 1fr);
}

.cs-picker-stage--hidden {
  display: none !important;
}

.cs-picker-multi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
}

.cs-picker-multi-footer[hidden] {
  display: none !important;
}

.cs-picker-multi-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.cs-picker-multi-add {
  white-space: nowrap;
}

.cs-picker-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.cs-picker-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--track-normal);
  color: var(--text-muted);
}

.cs-picker-tab {
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-family: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  line-height: inherit;
}

.cs-picker-tab.active {
  color: var(--bg-primary);
  background: var(--accent);
}

.cs-picker-sep {
  opacity: 0.5;
}

.cs-picker-breadcrumb {
  font-size: 11px;
  color: var(--text-muted);
}

.cs-picker-crumb-chip {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
}

.cs-picker-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}

.cs-picker-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 1;
}

.cs-picker-stage--dim .cs-command-list button {
  opacity: 0.55;
}

.cs-picker-stage.cs-picker-stage--dim {
  opacity: 0.92;
}

.cs-picker-col label,
.chart-studio-panel .cs-card-compare > .cs-card-body > label:first-of-type {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: var(--track-normal);
  text-transform: uppercase;
}

.cs-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
}

.cs-date-dash {
  color: var(--text-dim);
  font-size: 12px;
  padding: 0 4px;
}

.cs-segment-group,
.cs-custom-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.cs-custom-dates {
  gap: 8px;
  margin-top: 8px;
}

.cs-custom-dates[hidden] {
  display: none !important;
}

.cs-command-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 230px;
  overflow: auto;
}

.cs-command-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.cs-command-list button.active,
.cs-command-list button:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.09);
}

.cs-command-list span {
  color: var(--text-muted);
  font-size: 11px;
}

.cs-contract-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.cs-contract-cb {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}

.cs-contract-body {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.cs-contract-body:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.09);
}

.cs-command-list .cs-contract-strip-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.cs-command-list .cs-contract-strip-btn:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.09);
}

.cs-ma-group {
  margin-top: 8px;
}

.cs-compare-period-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.cs-compare-period-row label {
  font-size: 11px;
  letter-spacing: var(--track-normal);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Control deck */
.cs-control-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.cs-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.cs-switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cs-card-display-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.chart-studio-panel #cs-y-mode .btn-segment:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.cs-switch-chip {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

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

.cs-switch-chip-ui {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-tight);
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.cs-switch-chip:hover .cs-switch-chip-ui {
  border-color: rgba(88, 166, 255, 0.5);
}

.cs-switch-chip input:focus-visible + .cs-switch-chip-ui {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cs-switch-chip input:checked + .cs-switch-chip-ui {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.cs-hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.35;
}

.cs-card-body.cs-benchmark-row,
.cs-card-compare .cs-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.cs-card-compare .trade-filter-select {
  max-width: 100%;
}

/* Status */
.cs-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 26px;
}

.cs-status-row--quiet .cs-status-pill:empty,
.cs-status-pill[data-cs-status-pill="idle"]:empty {
  display: none !important;
}

.cs-status-msg {
  font-size: 12px;
  color: var(--text-muted);
}

.cs-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
}

.cs-status-pill--idle {
  color: var(--text-muted);
  border-color: var(--border);
}

.cs-status-pill--loading {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.45);
}

.cs-status-pill--ok {
  color: var(--positive);
  border-color: rgba(63, 185, 80, 0.45);
}

.cs-status-pill--error {
  color: var(--negative);
  border-color: rgba(248, 81, 73, 0.5);
}

/* Chart card */
.cs-chart-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(13, 17, 23, 0.42);
}

.cs-chart-empty {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(13, 17, 23, 0.55);
}

.cs-chart-empty[hidden] {
  display: none !important;
}

.cs-chart-empty-inner.empty-state {
  padding: var(--sp-5) var(--sp-4);
}

.cs-chart-mini-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.cs-chart-mini-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cs-mini-btn {
  font-size: 11px;
  padding: 3px 8px !important;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-mono);
}

.cs-mini-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cs-chart {
  position: relative;
  z-index: 1;
  min-height: 460px;
  height: 460px;
  overflow: hidden;
}

.cs-chart-hero {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 32px;
  pointer-events: auto;
}

.cs-chart-hero[hidden] {
  display: none !important;
}

.cs-hero-logo {
  opacity: 0.92;
}

.cs-hero-title {
  font-size: 22px;
  font-weight: 700;
}

.cs-hero-sub {
  max-width: 420px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.cs-hero-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.cs-hero-quick-btn {
  font-size: var(--text-xs);
  padding: var(--sp-2) var(--sp-3) !important;
}

.cs-hero-cta {
  margin-top: 10px;
}

.cs-chart-skeleton {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  flex-direction: column;
  gap: 12px;
  padding: 36px;
  justify-content: center;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(13, 17, 23, 0.78), rgba(13, 17, 23, 0.55));
}

.cs-chart-skeleton:not([hidden]) {
  display: flex;
}

@keyframes cs-skel-shimmer {
  0% { background-position: 0 0; }
  100% { background-position: 200px 0; }
}

.cs-skel-bar {
  height: 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(88, 166, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 100%
  );
  background-size: 200px 100%;
  animation: cs-skel-shimmer 1.2s ease-in-out infinite;
}

.cs-skel-bar--mid { width: 78%; opacity: 0.86; animation-delay: 0.09s; }
.cs-skel-bar--short { width: 54%; opacity: 0.75; animation-delay: 0.18s; }

/* Stats strip */
.cs-stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cs-stat-card {
  flex: 1 1 280px;
  min-width: 240px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--cs-color);
  background: rgba(255, 255, 255, 0.035);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.cs-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cs-stat-title {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-stat-title span {
  display: none;
}

.cs-change-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.4;
}

.cs-change-pill--positive {
  color: var(--positive);
  background: rgba(63, 185, 80, 0.12);
  border-color: rgba(63, 185, 80, 0.32);
}

.cs-change-pill--negative {
  color: var(--negative);
  background: rgba(248, 81, 73, 0.12);
  border-color: rgba(248, 81, 73, 0.32);
}

.cs-change-pill--neutral {
  color: var(--text-muted);
  border-color: var(--border);
}

.cs-stat-mid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 26px;
  font-weight: 700;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.01em;
  line-height: 1;
}

.cs-spark-svg {
  flex: 1 1 auto;
  min-width: 80px;
  max-width: 160px;
  height: 32px;
  color: var(--cs-color);
  opacity: 0.95;
  align-self: center;
}

.cs-spark-svg path {
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cs-stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
  font-size: 11px;
}

.cs-stat-grid > span {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .cs-picker-columns {
    grid-template-columns: 1fr;
  }

  .cs-toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cs-toolbar-actions .btn-primary,
  .cs-toolbar-actions .btn-ghost {
    width: 100%;
    justify-content: center;
  }
}

:root {
  --bg-primary: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2129;
  --panel-bg: #161b22;
  --surface-elevated: #1c2129;
  --border: #30363d;
  --border-light: #484f58;
  --border-subtle: rgba(48,54,61,0.4);
  --text: #e6e6e6;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --green: #00ff88;
  --positive: #3fb950;
  --negative: #f85149;
  --red: #ff4444;
  --amber: #ffaa00;
  --accent: #58a6ff;
  --accent-muted: rgba(88,166,255,0.15);
  --cta: #00ff88;
  --cta-muted: rgba(0,255,136,0.12);
  --text-caption: rgba(255, 255, 255, 0.45);
  --text-caption-dim: rgba(255, 255, 255, 0.35);
  --price-green: #3fb950;
  --price-amber: #ffaa00;
  --price-orange: #dd7700;
  --price-red: #ff4444;
  --price-flash: #cc0000;
  --price-blue: #4488ff;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --text-2xs: 0.5625rem; /* ≈8px @ base — micro labels */
  --text-xs: 0.625rem;
  --text-sm: 0.75rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem; /* hero numbers (spot price) */
  --state-good: var(--positive);
  --state-warn: var(--amber);
  --state-bad: var(--negative);
  --state-info: var(--accent);
  /* Trading structure cards / accents */
  --asset-futures: #58a6ff;
  --asset-options: #d29922;
  --asset-cross: #f778ba;
  --surface-tint-1: rgba(255, 255, 255, 0.03);
  --surface-tint-2: rgba(255, 255, 255, 0.06);
  --bigprint-bg: color-mix(in srgb, var(--state-warn) 14%, transparent);
  --bigprint-edge: color-mix(in srgb, var(--state-warn) 55%, transparent);
  --watchlist-pinned-bg: color-mix(in srgb, var(--region-accent, var(--state-info)) 9%, transparent);
  --watchlist-star: var(--state-warn);
  --newprint-bg: color-mix(in srgb, var(--state-info) 18%, transparent);
  --newprint-edge: color-mix(in srgb, var(--state-info) 65%, transparent);
  --mostactive-card-bg: var(--surface-tint-1);
  --track-tight: 0.04em; /* small caps, compact buttons */
  --track-normal: 0.06em; /* section titles, table headers */
  --track-wide: 0.1em; /* NEM section band only */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --top-bar-h: 60px;
}


html {
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

a,
button,
[role="button"],
input,
select,
textarea,
.tab-btn,
.sub-tab-btn,
.mobile-nav-item {
  -webkit-tap-highlight-color: transparent;
}

/* ===== LOGIN PAGE ===== */

.login-page {
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(88,166,255,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(46,160,67,0.03) 0%, transparent 50%);
  min-height: 100vh;
  min-height: 100dvh;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(20px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px)) calc(20px + env(safe-area-inset-left, 0px));
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(88,166,255,0.05);
}

.login-card h1 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  text-align: center;
}

.login-card .login-subtitle {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
  font-size: 0.85rem;
}

.login-card label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.login-card input::placeholder {
  color: #484f58;
}

.login-card button,
.login-card input[type="submit"] {
  width: 100%;
  padding: 13px;
  background: var(--cta);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.login-card button:hover,
.login-card input[type="submit"]:hover {
  opacity: 0.9;
  box-shadow: 0 4px 16px rgba(46,160,67,0.25);
}

.login-card button:active,
.login-card input[type="submit"]:active {
  transform: scale(0.98);
}

.login-error {
  color: var(--red);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(248,81,73,0.08);
  border-radius: 6px;
  border: 1px solid rgba(248,81,73,0.2);
}

.auth-success {
  color: var(--positive);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(0,230,118,0.08);
  border-radius: 6px;
  border: 1px solid rgba(0,230,118,0.2);
}

.auth-success-hero {
  text-align: center;
  padding: 24px 16px;
  margin-bottom: 8px;
}

.auth-success-hero .success-icon {
  width: 56px;
  height: 56px;
  line-height: 56px;
  border-radius: 50%;
  background: rgba(46,160,67,0.15);
  color: #2ea043;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 16px;
  border: 2px solid rgba(46,160,67,0.3);
}

.auth-success-hero h2 {
  font-size: 1.3rem;
  color: var(--text);
  margin: 0 0 8px;
  font-weight: 600;
}

.auth-success-hero p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.forgot-link {
  color: var(--text-secondary, #8a8d93);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--accent, #4fc3f7);
  text-decoration: underline;
}

.auth-warning {
  color: #ff9800;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(255,152,0,0.08);
  border-radius: 6px;
  border: 1px solid rgba(255,152,0,0.2);
}

.auth-info {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.5;
}

.auth-detail-table {
  width: 100%;
  margin-top: 10px;
}

.auth-detail-table td {
  padding: 4px 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.auth-detail-table td:first-child {
  color: var(--text-dim);
  width: 80px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand .brand-subtitle {
  color: var(--accent);
  font-size: 0.85rem;
  margin-top: 6px;
}

.form-group {
  position: relative;
}

/* ===== FREE TRIAL (PLAN) BANNER ===== */

.trial-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(35, 134, 54, 0.15) 0%, rgba(31, 111, 235, 0.12) 100%);
  border: 1px solid rgba(35, 134, 54, 0.35);
  border-radius: 8px;
  padding: 8px 14px;
  margin: 0 16px 12px;
  font-size: 0.86rem;
  color: var(--text);
  position: relative;
}

.trial-banner[hidden] {
  display: none !important;
}

.trial-banner-text {
  font-weight: 500;
}

.trial-banner-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.trial-banner-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* ===== WELCOME BANNER ===== */

.welcome-banner {
  background: linear-gradient(135deg, #1a2332 0%, #161b22 100%);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px 28px;
  margin: 0 0 20px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #2ea043);
}

.welcome-banner-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #484f58;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.welcome-banner-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.welcome-banner h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.welcome-banner p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.6;
}

.welcome-banner-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}

.welcome-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.welcome-feature-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 14px;
  background: rgba(88,166,255,0.04);
  border: 1px solid rgba(88,166,255,0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.welcome-feature-card:hover {
  background: rgba(88,166,255,0.1);
  border-color: rgba(88,166,255,0.25);
  transform: translateY(-1px);
}

.welcome-feature-icon {
  font-size: 22px;
  line-height: 1;
}

.welcome-feature-card strong {
  font-size: 0.82rem;
  color: var(--text);
}

.welcome-feature-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.welcome-banner-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

.welcome-tour-btn {
  background: var(--cta);
  color: #0d1117;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  letter-spacing: 0.02em;
}

.welcome-tour-btn:hover {
  opacity: 0.9;
  box-shadow: 0 4px 16px rgba(0,255,136,0.2);
}

.welcome-dismiss-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.welcome-dismiss-btn:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.welcome-banner-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.welcome-banner-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(88,166,255,0.08);
  border: 1px solid rgba(88,166,255,0.15);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}

.welcome-banner-links a:hover {
  background: rgba(88,166,255,0.14);
  border-color: rgba(88,166,255,0.3);
  text-decoration: none;
}

/* ===== GUIDED TOUR ===== */

.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.65);
  z-index: 10000;
  transition: opacity 0.3s;
}

.tour-spotlight {
  position: fixed;
  z-index: 10001;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.65), 0 0 20px rgba(88,166,255,0.3);
  transition: all 0.4s ease;
  pointer-events: none;
}

.tour-tooltip {
  position: fixed;
  z-index: 10002;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px 22px 16px;
  max-width: min(360px, calc(100vw - 20px));
  width: min(360px, calc(100vw - 20px));
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(88,166,255,0.1);
  transition: all 0.35s ease;
}

.tour-tooltip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cta));
  border-radius: 12px 12px 0 0;
}

.tour-progress-wrap {
  margin-bottom: 12px;
}

.tour-step-counter {
  display: block;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.tour-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.tour-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cta));
  border-radius: 2px;
  transition: width 0.4s ease;
}

.tour-step-badge {
  display: none;
}

.tour-tooltip h3 {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 8px;
  font-weight: 600;
}

.tour-tooltip p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tour-next-btn {
  background: var(--cta);
  color: #0d1117;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.tour-next-btn:hover {
  opacity: 0.9;
}

.tour-skip-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}

.tour-skip-btn:hover {
  color: var(--text-muted);
}

.tour-dots {
  display: flex;
  gap: 6px;
}

.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.tour-dot.active {
  background: var(--accent);
}

.tour-dot.done {
  background: var(--cta);
}

/* ===== TOP BAR ===== */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;
  height: calc(var(--top-bar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
  padding-bottom: 0;
  background: #010409;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-text-short { display: none; }

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  white-space: nowrap;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
  transition: background 0.3s, box-shadow 0.3s;
}

.connection-dot.disconnected {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
}

.status-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.logout-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: color 0.2s, border-color 0.2s;
}

.logout-link:hover {
  color: var(--red);
  border-color: var(--red);
  text-decoration: none;
}

.logout-icon {
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.logout-icon svg {
  display: block;
}

.user-menu {
  position: relative;
  flex-shrink: 0;
}

.user-menu-btn {
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font: inherit;
  line-height: inherit;
  background: transparent;
  margin: 0;
}

.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  padding: 6px 0;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 1200;
}

.user-menu.open .user-menu-dropdown {
  display: block;
}

.user-menu-item {
  display: block;
  padding: 9px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
}

.user-menu-sep {
  height: 1px;
  margin: 6px 10px;
  background: var(--border);
}

.top-bar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.tab-bar {
  display: flex;
  gap: 1px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { display: none; }

.short-label { display: none; }
.nav-live-compact { display: none; align-items: center; gap: 6px; }
.compact-time-label { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); }

.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1050;
  backdrop-filter: blur(4px);
}
.mobile-menu-overlay.open { display: block; }

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  --mobile-menu-width: min(85vw, 320px);
  width: var(--mobile-menu-width);
  right: calc(-1 * var(--mobile-menu-width));
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #0d1117;
  border-left: 1px solid var(--border);
  z-index: 1100;
  flex-direction: column;
  padding-left: 0;
  padding-right: 0;
  overflow-y: auto;
  transition: right 0.25s ease;
}
.mobile-menu.open {
  display: flex;
  right: 0;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.mobile-menu-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mobile-menu-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.mobile-menu-close:hover { color: var(--text); }

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
}
.mobile-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 14px 16px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.mobile-nav-item.active {
  color: var(--accent);
  background: var(--accent-muted);
  border-left: 3px solid var(--accent);
}

.mobile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 20px;
}

.mobile-menu-actions {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
}
.mobile-nav-link {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 12px 16px;
  border-radius: 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav-link:hover { background: rgba(255,255,255,0.06); color: var(--text); text-decoration: none; }
.mobile-nav-logout:hover { color: var(--red); }

.mobile-menu-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.mobile-menu-live-text { color: var(--green); font-weight: 600; }
.mobile-menu-time-value { color: var(--text-muted); }

.tab-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.tab-btn.active {
  color: var(--accent);
  background: var(--accent-muted);
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-content.active {
  display: flex;
}

.sub-tab-bar {
  display: flex;
  gap: 4px;
  padding: 0 0 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sub-tab-btn {
  padding: 6px 16px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sub-tab-btn:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

.sub-tab-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.06);
}

.sub-tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.sub-tab-content.active {
  display: flex;
  min-width: 0;
  max-width: 100%;
}

.tab-content .sub-tab-content.sub-tab-gated-off {
  display: none !important;
}

/* ===== NEM OVERVIEW (spot cards) ===== */

/* SVG map price labels — class set from renderNEMMap */
.nem-state-price.price-green { fill: var(--price-green); }
.nem-state-price.price-amber { fill: var(--price-amber); }
.nem-state-price.price-red { fill: var(--price-red); }
.nem-state-price.price-flash { fill: var(--price-flash); }
.nem-state-price.price-negative,
.spot-card-price.price-negative { color: var(--price-blue); }

.spot-cards-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.spot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  min-height: 260px;
}

.spot-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.spot-card-label {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.spot-card-stamp {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim, #8a9bb0);
  white-space: nowrap;
}

.spot-card-price {
  font-size: var(--text-2xl);
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.15;
  margin-bottom: 10px;
}

.spot-card-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.spot-spark-row {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: stretch;
  margin-top: auto;
}
.spot-spark-row .sparkline-container {
  flex: 1;
  min-width: 0;
}
.spot-forward-spark {
  opacity: 0.92;
}

.sc-stat {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-dim);
  line-height: 1.4;
}

.sc-stat span {
  color: var(--text-muted);
  font-weight: 600;
}

.sc-stat-oe {
  color: var(--text-dim);
  font-size: var(--text-xs);
  opacity: 0.85;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 2px;
  padding-top: 2px;
}

.spot-chg {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-left: 6px;
  vertical-align: baseline;
}
.chg-up { color: var(--price-red); }
.chg-down { color: var(--state-good); }
.chg-flat { color: var(--text-dim); }

.spot-card-stats .range-red { color: var(--red); font-weight: 700; }
.spot-card-stats .range-flash { color: var(--price-red); font-weight: 700; animation: nem-flash-text 0.8s infinite alternate; }
.spot-card-stats .range-blue { color: var(--price-blue); font-weight: 700; }

@keyframes nem-flash-text {
  0% { opacity: 1; }
  100% { opacity: 0.5; }
}
.sl-muted { color: var(--text-dim); font-style: italic; }

.sparkline-container {
  margin-top: auto;
  height: 105px;
  overflow: visible;
  border-radius: 4px;
  background: transparent;
  padding: 4px 2px 2px;
  position: relative;
}

.sparkline-container svg {
  display: block;
}

.sparkline-hover-dot {
  fill: #0d1117;
  stroke: #e6edf3;
  stroke-width: 1.2;
  pointer-events: none;
}

.sparkline-hover-hit {
  cursor: crosshair;
}

.sparkline-hover-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid rgba(139,148,158,0.45);
  background: rgba(13,17,23,0.95);
  color: #e6edf3;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.1s ease, transform 0.1s ease;
  z-index: 2;
}

.sparkline-hover-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.nem-sparkline-wrap {
  width: 100%;
  min-width: 150px;
}

.nem-sparkline-wrap .spot-chart {
  width: 100%;
  height: 150px;
}

.nem-ic-table-wrap {
  margin-top: 8px;
}

.ic-cap-green { color: var(--state-good); font-weight: 600; }
.ic-cap-amber { color: var(--state-warn); font-weight: 600; }
.ic-cap-red { color: var(--red); font-weight: 600; }

/* ===== MARKET TAB GRID ===== */
.market-row {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.market-spot-row {
  margin-bottom: 14px;
  padding: 16px;
}

/* NEM Overview — logical grouping (non-interactive landmarks) */
.nem-section-band {
  margin: 10px 0 6px;
  padding: 0 2px;
}
.nem-section-band:first-child {
  margin-top: 0;
}
.nem-section-band-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-dim);
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 10px;
  line-height: 1.35;
}
#tab-nem .section-hdr {
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.panel.collapsible > h2.section-hdr.collapsible-toggle {
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.market-map-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }

.market-system,
.market-forward,
.market-context {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* NEM: shared filter bar + caption labels + skeletons */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-tint-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
  margin-bottom: 8px;
  box-sizing: border-box;
}
/* Nested filter groups: one outer chrome, inner is flex only */
.filter-bar > .pasa-filters.filter-bar {
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.spot-range-bar {
  gap: 10px;
  margin-bottom: 10px;
}
.trip-filter-row.filter-bar,
.rebid-filter-row.filter-bar {
  margin-bottom: 10px;
  gap: 12px;
}
.outage-filter-row.filter-bar {
  margin-bottom: 8px;
  gap: 10px;
}
.renewable-controls.filter-bar {
  margin-bottom: 10px;
}

.caption-label,
.spot-summary-subhdr,
.dist-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-caption);
  letter-spacing: var(--track-normal);
  text-transform: uppercase;
}
.spot-summary-subhdr {
  margin-bottom: 8px;
}
.dist-label {
  margin-bottom: 6px;
}
.spot-period-stats {
  font-size: var(--text-xs);
  color: var(--text-caption-dim);
  font-family: var(--font-mono);
  text-align: right;
  margin-bottom: 6px;
  letter-spacing: 0;
  text-transform: none;
}
.demand-sparkline-header {
  font-size: var(--text-xs);
  letter-spacing: var(--track-normal);
  color: var(--text-caption);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* Unified NEM table chrome (used with .spot-summary-table, .gen-trips-table, .demand-table) */
.nem-table {
  border-collapse: collapse;
}
.nem-table thead th {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-caption);
  letter-spacing: var(--track-normal);
  text-transform: uppercase;
}
.nem-table tbody td {
  font-family: var(--font-mono);
  font-size: var(--text-base);
}

.panel-skeleton {
  padding: 4px 0;
  animation: nem-skeleton-pulse 1.2s ease-in-out infinite;
}
.panel-skeleton--nem .skeleton-line,
.panel-skeleton--table .skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 10px;
}
.skeleton-line--title {
  width: 40%;
}
.skeleton-line--short {
  width: 55%;
}
.skeleton-block {
  height: 120px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 10px;
}
.skeleton-block--tall {
  height: 220px;
}
@keyframes nem-skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

.section-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  padding-left: var(--sp-3);
  border-bottom: none;
  border-left: 3px solid var(--accent);
}
.section-hdr-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
/* Shared NEM + panel + Event Feed primary headings */
.section-hdr-title,
.panel-title,
.ef-title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: var(--track-normal);
}
.section-hdr-sub {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-weight: 400;
}
.section-hdr-ts {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-weight: 400;
  font-family: var(--font-mono);
  margin-left: auto;
}
#panel-spot-prices .section-hdr {
  flex-wrap: wrap;
  gap: 4px 10px;
}
#panel-spot-prices .section-hdr .spot-sync-btn {
  margin-left: 0;
  flex: 0 0 auto;
}
.spot-aemo-stamp {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-weight: 400;
  font-family: var(--font-mono);
  flex: 0 0 auto;
  max-width: max-content;
}
.spot-aemo-stamp.is-stale {
  color: #e8a43a;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(232, 164, 58, 0.1);
  border: 1px solid rgba(232, 164, 58, 0.25);
}
.spot-aemo-stamp.is-very-stale {
  color: #f0a050;
  border-color: rgba(240, 160, 80, 0.45);
  background: rgba(240, 160, 80, 0.12);
}

#panel-renewable-outlook .section-hdr {
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
#panel-renewable-outlook .renewable-actuals-lag-chip[hidden] {
  display: none;
}
#panel-renewable-outlook .renewable-actuals-lag-chip {
  font-size: var(--text-xs);
  color: #e8a43a;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(232, 164, 58, 0.1);
  border: 1px solid rgba(232, 164, 58, 0.25);
  white-space: nowrap;
}

/* ===== IC TILES ===== */
.ic-tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.ic-tile {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ic-tile-name {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: var(--track-tight);
}
.ic-tile-route {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-dim);
}
.ic-tile-flow {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.ic-tile-flow .ic-arrow { font-size: var(--text-sm); }
.ic-tile-bar-wrap {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}
.ic-tile-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.ic-tile-pct {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-align: right;
}
.ic-tile.stress-green .ic-tile-flow { color: var(--state-good); }
.ic-tile.stress-green .ic-tile-bar { background: var(--state-good); }
.ic-tile.stress-green .ic-tile-pct { color: var(--state-good); }
.ic-tile.stress-amber .ic-tile-flow { color: var(--state-warn); }
.ic-tile.stress-amber .ic-tile-bar { background: var(--state-warn); }
.ic-tile.stress-amber .ic-tile-pct { color: var(--state-warn); }
.ic-tile.stress-red .ic-tile-flow { color: var(--red); }
.ic-tile.stress-red .ic-tile-bar { background: var(--red); }
.ic-tile.stress-red .ic-tile-pct { color: var(--red); }

/* Interconnectors: expanded data table (slightly larger than global .data-table for legibility) */
#panel-interconnectors-main #ic-table.data-table {
  font-size: var(--text-base);
}
#panel-interconnectors-main #ic-table.data-table thead th {
  font-size: var(--text-xs);
  padding: 9px 10px;
}
#panel-interconnectors-main #ic-table.data-table tbody td {
  font-size: var(--text-base);
  padding: 8px 10px;
}

/* Full-width outline control: shares .btn-segment sizing from parent */
.btn-segment.ic-expand-btn {
  display: block;
  width: 100%;
  margin-top: var(--sp-2);
  border-radius: var(--radius-sm);
  text-align: center;
  justify-content: center;
  font-size: var(--text-xs);
  padding: var(--sp-1) 0;
}
.btn-segment.ic-expand-btn:hover:not(.active) {
  color: var(--text-muted);
  border-color: var(--border-light);
}

.ic-table-wrap {
  margin-top: 6px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.ic-table-wrap.collapsed { max-height: 0; }
.ic-table-wrap.expanded {
  max-height: 500px;
  /* When open, allow horizontal scroll for wide tables (mobile) */
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== PULSE TAB (May 2026) =====
 * Mobile-first quick-check surface. Free clients land here by default; phones
 * land here regardless of role; pro/staff desktop can use it as a fast
 * "from the pub" view. All sections stack on phone; on wider screens the spot
 * strip relaxes into a horizontal row of tiles. */
.pulse-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 4px;
  max-width: 980px;
  margin: 0 auto;
}
.pulse-panel {
  padding: 12px 14px;
}
.pulse-spot-panel { padding-bottom: 16px; }

.pulse-alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pulse-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  border: 1px solid transparent;
}
.pulse-alert-icon {
  flex: 0 0 auto;
  font-size: 1rem;
}
.pulse-alert-label {
  flex: 1 1 auto;
  word-break: break-word;
}
.pulse-alert-critical {
  background: rgba(248, 81, 73, 0.18);
  border-color: rgba(248, 81, 73, 0.45);
  color: #f85149;
}
.pulse-alert-warning {
  background: rgba(255, 170, 0, 0.18);
  border-color: rgba(255, 170, 0, 0.45);
  color: var(--amber, #ffaa00);
}
.pulse-alert-info {
  background: rgba(66, 165, 245, 0.18);
  border-color: rgba(66, 165, 245, 0.4);
  color: #42a5f5;
}

.pulse-spot-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.pulse-tile {
  --tile-accent: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-elevated, var(--panel-bg));
  border: 1px solid var(--border);
  border-left: 3px solid var(--tile-accent);
  border-radius: 6px;
  min-height: 84px;
}
.pulse-tile-region {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: var(--track-tight);
  color: var(--tile-accent);
}
.pulse-tile-price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.05;
  color: var(--text);
}
.pulse-tile-price-cap   { color: #f85149; }
.pulse-tile-price-high  { color: var(--amber, #ffaa00); }
.pulse-tile-price-deep-neg { color: #42a5f5; }
.pulse-tile-unit {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}
.pulse-tile-chg {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.pulse-chg-up   { color: #f85149; }
.pulse-chg-dn   { color: #42a5f5; }
.pulse-chg-flat { color: var(--text-muted); }
.pulse-tile-renew {
  font-size: 0.7rem;
  color: var(--green, #3fb950);
  margin-top: 2px;
}

/* Snapshot strip — single horizontal row, no card border, saves vertical space */
.pulse-snapshot-strip {
  display: flex;
  gap: 12px;
  padding: 6px 14px 8px;
}
.pulse-snapshot-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 0;
}
.pulse-snapshot-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--track-normal);
}
.pulse-snapshot-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

/* Peak table reuses .pulse-traded-table but the panel header already added */
.pulse-peak { /* inherits pulse-traded-table inside */ }

.pulse-traded-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.pulse-traded-table thead th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-caption, var(--text-muted));
  text-transform: uppercase;
  letter-spacing: var(--track-normal);
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
}
.pulse-traded-table tbody td {
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.pulse-traded-table tbody td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}


/* Pulse is dormant — hide nav buttons on all devices until re-enabled */
.tab-btn[data-tab="pulse"],
.mobile-nav-item[data-tab="pulse"] { display: none; }

@media (max-width: 540px) {
  .pulse-wrap { padding: 4px 0; }
  .pulse-tile-price { font-size: 1.25rem; }
  .pulse-snapshot-value { font-size: 1.05rem; }
  .pulse-traded-table thead th,
  .pulse-traded-table tbody td { padding: 6px 6px; font-size: 0.78rem; }
}

/* ===== DEMAND COMPACT ===== */
.demand-compact { display: flex; flex-direction: column; gap: 0; min-height: 120px; box-sizing: border-box; }

/* Region card grid (May 2026 PR2 redesign).
 * 6 cards: 5 regions + NEM aggregate. Auto-fit so the grid relaxes from 6 cols
 * on wide screens down to 1 col on phones. min track of 130px keeps the big
 * MW number from clipping at narrow widths. */
.demand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  width: 100%;
}
.demand-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-elevated, var(--panel-bg));
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 88px;
}
.demand-card-agg {
  border-color: var(--accent, var(--text-muted));
  background: rgba(139,148,158,0.06);
}
.demand-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.demand-card-region {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: var(--track-tight);
}
.demand-pill {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.demand-pill-neutral { background: rgba(139,148,158,0.12); color: var(--text-muted); }
.demand-pill-ontrack { background: rgba(88,161,110,0.15); color: var(--success, #58a16e); border: 1px solid rgba(88,161,110,0.25); }
.demand-pill-under { background: rgba(66,165,245,0.15); color: #42a5f5; border: 1px solid rgba(66,165,245,0.25); }
.demand-pill-over { background: rgba(255,170,0,0.15); color: var(--amber); border: 1px solid rgba(255,170,0,0.25); }
.demand-pill-red { background: rgba(248,81,73,0.15); color: #f85149; border: 1px solid rgba(248,81,73,0.25); }
.demand-card-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.demand-card-now {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.demand-card-mw {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
}
.demand-card-unit {
  font-size: 0.65rem;
  color: var(--text-muted);
}
.demand-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.7rem;
}
.demand-card-forecast {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.demand-card-dev {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.dev-neutral { color: var(--text-muted); }
.dev-ontrack { color: var(--success, #58a16e); }
.dev-under { color: #42a5f5; }
.dev-over { color: var(--amber); }
.dev-red { color: #f85149; }
.demand-card-spark {
  margin-top: 2px;
  line-height: 0;
}
.demand-spark { display: block; }

/* Legacy table classes still referenced by other panels (e.g. spot summary
 * shares .nem-table chrome). The .dev-badge selectors below remain for any
 * non-demand callers; leave them alone. */
.dev-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.dev-badge-neutral { background: rgba(139,148,158,0.12); color: var(--text-muted); }
.dev-badge-under { background: rgba(66,165,245,0.15); color: #42a5f5; border: 1px solid rgba(66,165,245,0.25); }
.dev-badge-over { background: rgba(255,170,0,0.15); color: var(--amber); border: 1px solid rgba(255,170,0,0.25); }
.dev-badge-red { background: rgba(248,81,73,0.15); color: #f85149; border: 1px solid rgba(248,81,73,0.25); }

/* ===== PREDISPATCH HEATMAP ===== */
#panel-predispatch {
  display: flex;
  flex-direction: column;
}

.predispatch-table-wrap {
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  width: 100%;
  overscroll-behavior-x: contain;
  display: flex;
  flex-direction: column;
}

.predispatch-tbl {
  width: 100%;
  height: 100%;
}

.predispatch-tbl thead th,
.predispatch-tbl tbody td {
  text-align: center;
  padding: 16px 8px;
}

.predispatch-tbl tbody td {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-base);
}

.predispatch-tbl thead th {
  font-size: var(--text-sm);
}
.predispatch-tbl thead th.pd-now {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.predispatch-tbl tbody td:nth-child(2) {
  border-left: 2px solid rgba(0,255,136,0.2);
}
.pd-heat-0 { background: transparent; }
.pd-heat-1 { background: rgba(0,255,136,0.05); }
.pd-heat-2 { background: rgba(255,170,0,0.08); }
.pd-heat-3 { background: rgba(255,170,0,0.15); }
.pd-heat-4 { background: rgba(255,68,68,0.12); }
.pd-heat-5 { background: rgba(255,68,68,0.22); }

@media (max-width: 900px) {
  .market-system,
  .market-forward,
  .market-context,
  .market-map-row { grid-template-columns: 1fr; }
  .ic-tiles-grid { grid-template-columns: repeat(2, 1fr); }
  .spot-cards-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .ds-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 600px), (max-width: 720px) and (max-height: 480px) {
  .ic-tiles-grid { grid-template-columns: 1fr; }
  .spot-cards-row { grid-template-columns: repeat(2, 1fr); }
  .ds-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== VOL SURFACE ===== */

.vol-region-tabs {
  display: flex;
  gap: 4px;
  margin: 8px 0 12px;
}

.vol-region-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.vol-region-btn {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.vol-summary-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.vol-stat {
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.vol-stat-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vol-stat-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.vol-summary-empty {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-radius: 6px;
  background: rgba(88, 166, 255, 0.08);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.vol-chart {
  width: 100%;
  min-height: 280px;
}

.vol-table-wrap {
  width: 100%;
}

.vol-table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.vol-table-actions > * + * {
  border-left: 1px solid rgba(139, 148, 158, 0.18);
  padding-left: 10px;
}

.vol-action-btn {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.vol-table-container {
  overflow-x: auto;
  overflow-y: visible;
  width: 100%;
  padding-top: 8px;
}

.vol-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.vol-table thead th {
  background: rgba(22, 27, 34, 0.95);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  padding: 6px 8px;
  text-align: center;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.vol-th-tenor {
  text-align: left !important;
  min-width: 180px;
}

.vol-table tbody tr {
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
}

.vol-table tbody tr:hover {
  background: rgba(0, 255, 136, 0.03);
}

.vol-td-tenor {
  font-weight: 700;
  color: var(--text);
  padding: 5px 8px;
  text-align: left;
  background: rgba(22, 27, 34, 0.6);
  border-right: 1px solid var(--border);
  min-width: 180px;
}

.vol-td-iv {
  text-align: center;
  padding: 4px 6px;
  color: var(--text);
  transition: background 0.2s;
}

.vol-td-iv.iv-live {
  font-weight: 700;
}

.vol-td-iv.iv-carried {
  font-style: italic;
  opacity: 0.6;
}

.vol-td-iv.iv-empty {
  color: var(--text-dim);
  opacity: 0.3;
}

.vol-td-iv.iv-very-low {
  background: rgba(26, 58, 92, 0.35);
}

.vol-td-iv.iv-low {
  background: rgba(33, 150, 243, 0.15);
}

.vol-td-iv.iv-mid {
  background: rgba(0, 255, 136, 0.1);
}

.vol-td-iv.iv-high {
  background: rgba(255, 152, 0, 0.15);
}

.vol-td-iv.iv-very-high {
  background: rgba(244, 67, 54, 0.18);
}

/* Percentile rank colour scale */
.vol-td-iv.pct-very-low  { background: rgba(26, 58, 92, 0.45); color: #64b5f6; }
.vol-td-iv.pct-low       { background: rgba(33, 150, 243, 0.2); color: #90caf9; }
.vol-td-iv.pct-mid       { background: rgba(0, 200, 100, 0.12); }
.vol-td-iv.pct-high      { background: rgba(255, 152, 0, 0.22); color: #ffcc80; }
.vol-td-iv.pct-very-high { background: rgba(244, 67, 54, 0.28); color: #ef9a9a; font-weight: 600; }

/* ===== PASA PANEL ===== */
.pasa-filter-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.pasa-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pasa-filters.filter-bar {
  padding: 6px 12px;
  background: var(--surface-tint-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.pasa-filter-label { font-size: var(--text-xs); color: var(--text-dim); margin-right: 2px; }
.notices-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.notices-filters.filter-bar {
  padding: 4px 12px 6px;
  background: var(--surface-tint-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.pasa-container { overflow-x: auto; max-height: 500px; overflow-y: auto; }
.pasa-table { width: 100%; }
.pasa-table.nem-table thead th,
.pasa-table thead th { position: sticky; top: 0; background: var(--bg-card); z-index: 2; }
.pasa-chg-up   { color: var(--state-good); font-weight: 600; }
.pasa-chg-down { color: var(--state-bad); font-weight: 600; }

.pasa-region-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.pasa-region-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  transition: border-color 0.2s, transform 0.15s;
}
.pasa-region-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.pasa-card-region { font-weight: 700; font-size: var(--text-sm); letter-spacing: 0.04em; }
.pasa-card-net {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  margin: 4px 0 2px;
}
.pasa-net-positive { color: var(--state-good); }
.pasa-net-negative { color: var(--state-bad); }
.pasa-card-count { font-size: var(--text-xs); color: var(--text-dim); }

.pasa-notable {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 6px 0;
}
.pasa-notable-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pasa-notable-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}
.pasa-chip-return {
  background: rgba(63, 185, 80, 0.12);
  color: var(--state-good);
  border: 1px solid rgba(63, 185, 80, 0.25);
}
.pasa-chip-withdraw {
  background: rgba(248, 81, 73, 0.1);
  color: var(--state-bad);
  border: 1px solid rgba(248, 81, 73, 0.22);
}


.pasa-dir-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 6px;
}
.pasa-dir-return { background: rgba(76,175,80,0.15); color: #4caf50; border: 1px solid rgba(76,175,80,0.25); }
.pasa-dir-withdraw { background: rgba(239,83,80,0.12); color: #ef5350; border: 1px solid rgba(239,83,80,0.2); }

.outage-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.outage-custom-dates {
    display: flex;
    align-items: center;
    gap: 6px;
}
.outage-date-input {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 4px 8px;
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    height: 28px;
}
.outage-date-input:focus {
    border-color: var(--accent);
    outline: none;
}
.outage-date-sep {
    color: var(--text-muted);
    font-size: var(--text-xs);
}
.outage-date-apply {
    background: var(--accent) !important;
    color: var(--bg) !important;
    font-weight: 600;
}
.outage-date-apply:hover {
    opacity: 0.85;
}
.outage-region-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 8px 0 12px;
}
.outage-region-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    text-align: center;
}
.outage-region-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.outage-region-card.active { border-color: var(--accent); background: var(--accent-muted); }
.outage-card-region { font-size: var(--text-sm); font-weight: 700; color: var(--text); letter-spacing: 0.04em; }
.outage-card-mw { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: 700; color: var(--state-warn); margin: 4px 0 2px; }
.outage-card-pct { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); }
.outage-card-sub { font-size: var(--text-xs); color: var(--text-dim); margin-top: 2px; }
.outage-card-moderate .outage-card-mw { color: var(--state-warn); }
.outage-card-high .outage-card-mw { color: var(--state-bad); }
.outage-card-severe .outage-card-mw { color: var(--red); }
.outage-card-severe { border-color: rgba(255,23,68,0.3); background: rgba(255,23,68,0.06); }

.outage-notable-section { margin-bottom: 10px; }
.outage-notable-hdr {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--amber);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 0 6px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 6px;
}
.outage-notable-list { display: flex; flex-wrap: wrap; gap: 6px; }
.outage-notable-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,170,0,0.08);
    border: 1px solid rgba(255,170,0,0.18);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.75rem;
}
.outage-notable-name { font-weight: 600; color: var(--text); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outage-notable-mw { font-family: var(--font-mono); color: var(--amber); font-weight: 600; }
.outage-notable-region { color: var(--text-muted); font-size: 0.7rem; }

.outage-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
}
.outage-tag-new { background: rgba(0,255,136,0.15); color: var(--green); border: 1px solid rgba(0,255,136,0.3); }
.outage-tag-increase { background: rgba(255, 23, 68, 0.12); color: var(--state-bad); border: 1px solid rgba(255, 23, 68, 0.25); }

.outage-group { margin-bottom: 16px; }
.outage-group-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 4px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
}
.outage-group-region { font-weight: 700; font-size: var(--text-sm); color: var(--text); }
.outage-group-total { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); }

.outages-table { width: 100%; font-size: 0.78rem; }
.outages-table thead th { position: sticky; top: 0; background: var(--bg-card); z-index: 2; }
.outage-unit { font-weight: 600; color: rgba(255,255,255,0.85); max-width: 220px; }
.outage-duid { font-size: 0.65rem; color: var(--text-dim); font-family: var(--font-mono); margin-top: 1px; }
.outage-high { color: var(--state-bad); font-weight: 700; }
.outage-critical { color: var(--red); font-weight: 700; }
.outage-row-new { background: rgba(0,255,136,0.04); }
.outage-row-changed { background: rgba(255,170,0,0.04); }
.outage-fuel-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(88,166,255,0.1);
    color: var(--text-muted);
    border: 1px solid rgba(88,166,255,0.15);
}

/* ===== MARKET NOTICES PANEL ===== */
.notices-container { overflow-x: auto; max-height: 500px; overflow-y: auto; }

.notices-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 10px;
}
.notices-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.notices-cat-chip:hover { border-color: var(--border-light); color: var(--text); }
.notices-cat-active { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.notices-cat-critical { border-color: rgba(248,81,73,0.3); }
.notices-cat-critical.notices-cat-active { border-color: #f85149; background: rgba(248,81,73,0.12); color: #f85149; }
.notices-cat-warning { border-color: rgba(255,170,0,0.3); }
.notices-cat-warning.notices-cat-active { border-color: var(--amber); background: rgba(255,170,0,0.12); color: var(--amber); }
.notices-cat-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 2px;
}
.notices-cat-clear {
  color: var(--text-dim);
  font-size: 0.68rem;
  border-style: dashed;
}

/* Fixed layout + explicit widths so summary cannot paint over Time (global .data-table td has nowrap) */
.notices-table {
  width: 100%;
  max-width: 100%;
  font-size: 0.78rem;
  table-layout: fixed;
  border-collapse: collapse;
}

.notices-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}

.notices-table thead th:nth-child(5) {
  text-align: right;
}

.notices-table thead th:nth-child(1),
.notices-table tbody td:nth-child(1) {
  width: 4%;
  min-width: 0;
}

.notices-table thead th:nth-child(2),
.notices-table tbody td:nth-child(2) {
  width: 14%;
  min-width: 0;
}

.notices-table thead th:nth-child(3),
.notices-table tbody td:nth-child(3) {
  width: 7%;
  min-width: 0;
}

.notices-table thead th:nth-child(4),
.notices-table tbody td:nth-child(4) {
  width: 47%;
  min-width: 0;
}

.notices-table thead th:nth-child(5),
.notices-table tbody td:nth-child(5) {
  width: 22%;
  min-width: 0;
}

.notices-table thead th:nth-child(6),
.notices-table tbody td:nth-child(6) {
  width: 6%;
  min-width: 0;
}

.notices-table tbody td {
  white-space: normal;
  vertical-align: top;
  word-break: normal;
}

.notice-row { transition: background 0.2s; }
.notice-row:hover { background: rgba(255,255,255,0.03); }
.notice-row-critical { border-left: 3px solid #f85149; background: rgba(248,81,73,0.04); }
.notice-row-warning { border-left: 3px solid var(--amber); background: rgba(255,170,0,0.03); }
.notice-type-cell { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-summary-cell {
  min-width: 0;
  max-width: none;
}
.notice-time-cell {
  white-space: nowrap;
  text-align: right;
}
.notice-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
}
.notice-type-critical { background: rgba(248,81,73,0.15); color: #f85149; border: 1px solid rgba(248,81,73,0.25); }
.notice-type-warning { background: rgba(255,170,0,0.15); color: var(--amber); border: 1px solid rgba(255,170,0,0.25); }
.notice-type-normal { background: rgba(139,148,158,0.1); color: var(--text-muted); border: 1px solid rgba(139,148,158,0.15); }
.notice-region { font-size: 0.72rem; font-weight: 600; }
.notice-time { font-size: 0.68rem; color: var(--text-dim); font-family: var(--font-mono); }
.notice-ago {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 3px;
}
.notices-toggle-icon {
  font-size: 0.65rem;
  color: var(--text-dim);
  cursor: pointer;
  margin-left: auto;
  padding: 2px 4px;
  transition: color 0.2s;
}
.notices-toggle-icon:hover { color: var(--accent); }
.notice-summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.notice-full {
  font-size: 0.75rem;
  color: var(--text);
  line-height: 1.5;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}


/* ===== FORWARD CURVE INTRADAY RANGE ===== */
.range-tight  { color: #4caf50; font-size: 0.75rem; }
.range-normal { color: #ffa726; font-size: 0.75rem; }
.range-wide   { color: #ef5350; font-weight: 600; font-size: 0.75rem; }

.vol-view-toggle {
  float: right;
  display: inline-flex;
  gap: 2px;
}

.vol-view-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* ===== DASHBOARD LAYOUT ===== */

.dashboard {
  padding-top: calc(var(--top-bar-h) + env(safe-area-inset-top, 0px) + 16px);
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  padding-bottom: 32px;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-top: calc(var(--top-bar-h) + env(safe-area-inset-top, 0px) + 16px);
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  padding-bottom: 32px;
  max-width: 1440px;
  margin: 0 auto;
}

.panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== PANEL CARDS ===== */

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s;
}

.panel:hover {
  border-color: var(--border-light);
}

.panel-full {
  grid-column: 1 / -1;
}

.panel-half {
  grid-column: span 1;
  min-width: 0;
  overflow: hidden;
}

/* ===== PANEL HEADERS ===== */

.panel-title {
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-left: var(--sp-3);
  border-left: 3px solid var(--accent);
}

.panel-subtitle {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

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

.panel-header .panel-title {
  margin-bottom: 0;
}

/* ===== STANDARD BUTTONS ===== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--cta);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover {
  background: rgba(88,166,255,0.08);
  border-color: var(--accent);
}

.btn-segment {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: var(--track-tight);
}
.btn-segment:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-segment:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-segment:not(:first-child) { border-left: none; }
.btn-segment.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 700;
}
.btn-segment:hover:not(.active) {
  background: rgba(88,166,255,0.08);
  color: var(--text);
}

/* ===== COLLAPSIBLE ===== */

.collapsible-toggle {
  cursor: pointer;
  user-select: none;
}

.collapsible-toggle:hover {
  color: var(--accent);
}

.collapse-icon {
  font-size: 0.7rem;
  color: var(--text-dim);
  transition: transform 0.2s;
  margin-left: auto;
}

.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.collapsed .collapsible-content {
  display: none;
}

.collapsed .panel-body {
  display: none;
}

/* ===== PRICE DISPLAY ===== */

.price-green {
  color: var(--price-green) !important;
}

.price-amber {
  color: var(--price-amber) !important;
}

.price-orange {
  color: var(--price-orange) !important;
}

.price-red {
  color: var(--price-red) !important;
}

.price-blue {
  color: var(--price-blue) !important;
}

.price-flash {
  animation: flash 0.5s infinite;
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== SPARKLINES ===== */

.sparkline-wrap {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 8px 4px 8px;
  text-align: center;
}

.sparkline-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.spot-chart {
  width: 100%;
  height: 150px;
}

/* ===== DATA TABLES ===== */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table thead th {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: var(--track-normal);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.data-table tbody td {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 7px 10px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
  color: var(--text);
  white-space: nowrap;
}

.data-table:not(.tradelog-table) tbody tr:nth-child(even) {
  background: rgba(22, 27, 34, 0.5);
}

.data-table:not(.tradelog-table) tbody tr:nth-child(odd) {
  background: rgba(13, 17, 23, 0.3);
}

.data-table:not(.tradelog-table) tbody tr:hover {
  background: rgba(48, 54, 61, 0.3);
}

/* Trade log: explicit zebra (plain rows only); clip/strip use their own chrome */
.tradelog-table tbody tr[data-zebra="1"] {
  background: var(--surface-tint-1);
}
.tradelog-table tbody tr[data-zebra="0"] {
  background: transparent;
}
.tradelog-table tbody tr[data-zebra]:hover {
  background: var(--surface-tint-2);
}
.tradelog-table tbody tr.tradelog-row--expandable {
  cursor: pointer;
}

.data-table tbody td:first-child {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-muted);
}

.data-table.demand-table {
  font-size: var(--text-sm);
}
.data-table.demand-table thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-caption);
  letter-spacing: var(--track-normal);
  text-transform: uppercase;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
}
.data-table.demand-table thead th:not(:first-child) {
  text-align: right;
}
.data-table.demand-table thead th.demand-tbl-dev {
  text-align: right;
}
.data-table.demand-table tbody td {
  font-size: var(--text-sm);
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

/* Generic data tables on NEM: mono caption headers (overrides .data-table sans headers) */
.data-table.nem-table:not(.demand-table) thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-caption);
  letter-spacing: var(--track-normal);
  text-transform: uppercase;
}
.data-table.nem-table:not(.demand-table) tbody td {
  font-size: var(--text-sm);
}

.summary-table {
  margin-top: 4px;
}

.spot-summary-row {
  margin-top: 4px;
}

/* ===== ALERT FEED ===== */

.alerts-feed,
.alert-feed {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-item {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  transition: background 0.2s;
}

.alert-item:hover {
  background: var(--bg-card-hover);
}

.alert-emergency {
  border-left: 3px solid var(--red);
}

.alert-high {
  border-left: 3px solid var(--amber);
}

.alert-normal {
  border-left: 3px solid var(--border);
}

.alert-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-right: 8px;
}

.alert-message {
  color: var(--text);
}

.alert-severity {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
}

.alert-severity.emergency {
  background: rgba(255, 68, 68, 0.15);
  color: var(--red);
}

.alert-severity.high {
  background: rgba(255, 170, 0, 0.15);
  color: var(--amber);
}

/* ===== INTERCONNECTOR FLOWS ===== */

.interconnector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.interconnector-row:last-child {
  margin-bottom: 0;
}

.interconnector-row:hover {
  background: var(--bg-card-hover);
}

.ic-label {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 70px;
}

.ic-from,
.ic-to {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ic-arrow {
  color: var(--positive);
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  transition: color 0.3s;
}

.ic-arrow.flow-positive {
  color: var(--positive);
}

.ic-arrow.flow-negative {
  color: var(--red);
}

.ic-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  margin-left: auto;
}

/* ===== BADGES ===== */

.badge,
.structure-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(63, 185, 80, 0.15);
  color: var(--positive);
  line-height: 1;
}

.badge-red {
  background: rgba(255, 68, 68, 0.15);
  color: var(--red);
}

.badge-amber {
  background: rgba(255, 170, 0, 0.15);
  color: var(--amber);
}

/* ===== STATUS INDICATORS ===== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-connected {
  background: var(--green);
  box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}

.status-disconnected {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
}

/* ===== GENERATOR STATUS ===== */

.gen-section {
  margin-bottom: 16px;
}

.gen-section:last-child {
  margin-bottom: 0;
}

.section-subtitle {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.gen-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gen-item {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

/* ===== STRUCTURES ===== */

.trading-tables {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 16px;
  margin-top: 16px;
}

.trading-half {
  min-width: 0;
  overflow-x: auto;
}

.trade-filter-select {
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 5px 8px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  min-width: 90px;
  max-width: 180px;
}

.trade-filter-select:focus {
  border-color: var(--accent);
}

.trade-filter-select option {
  background: var(--bg-card);
  color: var(--text);
}

.trade-filter-clear {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
  transition: all 0.2s;
}

.trade-filter-clear:hover {
  color: var(--state-bad);
  border-color: color-mix(in srgb, var(--state-bad) 30%, transparent);
}

.parse-failure-count {
  display: none;
  margin-left: 12px;
  color: var(--state-bad);
  font-size: var(--text-xs);
}
.parse-failure-count.is-visible {
  display: inline;
}

.trading-top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.asx-refresh-btn {
  background: color-mix(in srgb, var(--state-info) 14%, transparent);
  color: var(--state-info);
  border: 1px solid color-mix(in srgb, var(--state-info) 35%, transparent);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.asx-refresh-btn:hover {
  background: color-mix(in srgb, var(--state-info) 24%, transparent);
}

.asx-refresh-btn.is-loading,
.asx-refresh-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Wraps the Refresh Trading button so the confirmation toast can anchor against
   it. inline-flex keeps the wrap transparent to the surrounding
   .trading-top-bar flex layout — the button still lives at position 1, the
   freshness badge at position 2 — and position:relative gives the
   absolutely-positioned toast a reliable origin. */
.asx-refresh-btn-wrap {
  position: relative;
  display: inline-flex;
}

.asx-refresh-toast {
  /* Absolute inside .asx-refresh-btn-wrap — sits directly under the button so
     the user sees the confirmation exactly where they clicked. Absolute (not
     in-flow) so the freshness badge doesn't jump when the toast appears. */
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  white-space: nowrap;
  transform: translateY(-6px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
  background: var(--bg-card);
  border: 1px solid rgba(0, 255, 136, 0.35);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.asx-refresh-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.asx-refresh-toast.success {
  border-color: rgba(0, 255, 136, 0.35);
}

.asx-refresh-toast.error {
  border-color: color-mix(in srgb, var(--state-bad) 45%, transparent);
  color: color-mix(in srgb, var(--state-bad) 50%, var(--text));
}

.asx-freshness-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  margin-left: auto;
}

.asx-freshness-badge .freshness-icon {
  font-size: var(--text-2xs);
}

.asx-freshness-badge.fresh .freshness-icon { color: var(--state-good); }
.asx-freshness-badge.stale .freshness-icon { color: var(--state-warn); }
.asx-freshness-badge.very-stale .freshness-icon { color: var(--state-bad); }
.asx-freshness-badge.closed .freshness-icon { color: var(--text-dim); }

@keyframes asxFreshnessPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.asx-freshness-badge.is-live .freshness-icon {
  animation: asxFreshnessPulse 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .asx-freshness-badge.is-live .freshness-icon {
    animation: none;
  }
}

.freshness-detail {
  color: var(--text-muted);
  margin-left: 4px;
}

#section-most-active {
  padding: 6px 10px;
  background: var(--mostactive-card-bg);
}

.most-active-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.most-active-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex: 0 0 auto;
}

.most-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}

.most-active-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface-tint-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.most-active-chip:focus-visible {
  outline: 2px solid var(--state-info);
  outline-offset: 2px;
}

.most-active-chip:hover {
  background: var(--surface-tint-1);
  border-color: var(--region-accent, var(--state-info));
}

.most-active-chip .ma-vol {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.most-active-chip[data-asset='futures'] {
  border-left: 3px solid var(--asset-futures);
}

.most-active-chip[data-asset='options'] {
  border-left: 3px solid var(--asset-options);
}

.most-active-empty {
  color: var(--text-dim);
  font-size: var(--text-xs);
  font-style: italic;
}

@media (max-width: 720px) {
  .most-active-label {
    flex-basis: 100%;
  }
}

.vol-split-screen {
  color: var(--state-info);
  margin-left: 8px;
}

.vol-split-block {
  color: var(--state-warn);
  margin-left: 8px;
}

.vol-split-other {
  color: var(--text-muted);
  margin-left: 8px;
}

.vol-split-screen::before,
.vol-split-block::before,
.vol-split-other::before {
  content: '\2022';
  margin-right: 6px;
  color: var(--text-dim);
}

.newprint-counter {
  font-size: var(--text-xs);
  color: var(--state-info);
  font-weight: 600;
  margin-left: 8px;
}

.watchlist-star {
  background: transparent;
  border: 0;
  padding: 0 4px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.95em;
  line-height: 1;
  transition: color 120ms ease, transform 120ms ease;
}

.watchlist-star:hover {
  color: var(--watchlist-star);
  transform: scale(1.15);
}

.watchlist-star:focus-visible {
  outline: 2px solid var(--state-info);
  outline-offset: 2px;
}

.watchlist-star--inline {
  margin-right: 4px;
  vertical-align: baseline;
}

.snapshot-table tr[data-pinned='1'],
.tradelog-table tbody tr[data-pinned='1'] {
  background: var(--watchlist-pinned-bg);
  box-shadow: inset 3px 0 0 0 var(--watchlist-star);
}

.snapshot-table tr[data-pinned='1'] .watchlist-star,
.tradelog-table tbody tr[data-pinned='1'] .watchlist-star {
  color: var(--watchlist-star);
}

.snapshot-table col.snap-c-contract,
.snapshot-table col.snap-c-prior,
.snapshot-table col.snap-c-last,
.snapshot-table col.snap-c-vs,
.snapshot-table col.snap-c-vol {
  width: 20%;
}

.snapshot-tenor {
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
}

.snapshot-row-traded .snapshot-tenor {
  text-align: center;
}

.snapshot-row--clickable {
  cursor: pointer;
}

.snapshot-row--clickable:hover {
  background: color-mix(in srgb, var(--region-accent, var(--state-info)) 10%, transparent);
}

.tradelog-table tbody tr[data-bigprint='1'] {
  background: var(--bigprint-bg);
  box-shadow: inset 3px 0 0 0 var(--bigprint-edge);
}

.tradelog-table tbody tr[data-bigprint='1']:hover {
  background: color-mix(in srgb, var(--state-warn) 22%, transparent);
}

.tradelog-table tbody tr[data-bigprint='1'][data-zebra='1'] {
  background: color-mix(in srgb, var(--state-warn) 18%, transparent);
}

@keyframes newprint-flash {
  0% {
    background: var(--newprint-bg);
  }

  100% {
    background: transparent;
  }
}

.tradelog-table tbody tr[data-newprint='1'] {
  box-shadow: inset 3px 0 0 0 var(--newprint-edge);
  animation: newprint-flash 12s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .tradelog-table tbody tr[data-newprint='1'] {
    animation: none;
    background: color-mix(in srgb, var(--state-info) 10%, transparent);
  }
}

.trading-counts {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.tradelog-split {
  display: flex;
  gap: clamp(8px, 1.2vw, 16px);
  min-width: 0;
  max-width: 100%;
  align-items: stretch;
}

.tradelog-half:first-child,
.tradelog-half:last-child {
  flex: 1 1 0;
  min-width: 0;
}

.tradelog-half {
  display: flex;
  flex-direction: column;
}

.tradelog-half .filter-bar {
  gap: 4px;
}

.tradelog-half .trade-filter-select {
  min-width: 0;
  flex: 1 1 4.5rem;
  max-width: min(9.5rem, 100%);
}

.tradelog-half .data-table-scroll {
  width: 100%;
  box-sizing: border-box;
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.tradelog-half .data-table-scroll table {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Futures: last col needs room for strip/clip "vol (meta) ▸" without ellipsis; contract col widened, tick tightened */
.tradelog-table--futures col.tl-fut-time {
  width: 11%;
}
.tradelog-table--futures col.tl-fut-contract {
  width: 22%;
}
.tradelog-table--futures col.tl-fut-type {
  width: 11%;
}
.tradelog-table--futures col.tl-fut-price {
  width: 13%;
}
.tradelog-table--futures col.tl-fut-tick {
  width: 9%;
}
.tradelog-table--futures col.tl-fut-settle {
  width: 13%;
}
.tradelog-table--futures col.tl-fut-vol {
  width: 21%;
  min-width: 6.25rem;
}

.tradelog-table--options col.tl-opt-time {
  width: 12%;
}
.tradelog-table--options col.tl-opt-contract {
  width: 18%;
}
.tradelog-table--options col.tl-opt-pc {
  width: 9%;
}
.tradelog-table--options col.tl-opt-strike {
  width: 12%;
}
.tradelog-table--options col.tl-opt-prem {
  width: 12%;
}
.tradelog-table--options col.tl-opt-under {
  width: 12%;
}
.tradelog-table--options col.tl-opt-iv {
  width: 12%;
}
.tradelog-table--options col.tl-opt-vol {
  width: 13%;
}

/* No letter-spacing on trade log headers (overrides .data-table thead th); up to 2 lines */
.tradelog-half .data-table-scroll .tradelog-table thead th {
  padding: 7px 5px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.15;
  vertical-align: middle;
  white-space: normal;
  word-break: keep-all;
}

.tradelog-half .data-table-scroll .tradelog-table--futures thead th {
  text-align: center;
}

.tradelog-half .data-table-scroll .tradelog-table--options thead th {
  text-align: center;
}

.tradelog-half .data-table-scroll table.data-table.tradelog-table tbody td {
  padding: 9px 6px;
  vertical-align: middle;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.tradelog-half .data-table-scroll .data-table.tradelog-table.nem-table tbody td {
  font-size: var(--text-base);
}

.tradelog-half .data-table-scroll .tradelog-table--futures tbody td {
  text-align: center;
}

.tradelog-half .data-table-scroll .tradelog-table--options tbody td {
  text-align: center;
}

.tradelog-half .data-table-scroll .tradelog-table--futures tbody td:nth-child(2) {
  white-space: nowrap;
}

.tradelog-half .data-table-scroll .tradelog-table--options tbody td:nth-child(2) {
  white-space: nowrap;
}

/* Futures: keep type, price, tick, vs settle on one line; vol row allows last-col overflow (no "2…" ellipsis) */
.tradelog-half .data-table-scroll .tradelog-table--futures tbody td:nth-child(3),
.tradelog-half .data-table-scroll .tradelog-table--futures tbody td:nth-child(4),
.tradelog-half .data-table-scroll .tradelog-table--futures tbody td:nth-child(5),
.tradelog-half .data-table-scroll .tradelog-table--futures tbody td:nth-child(6) {
  white-space: nowrap;
}

/* VOL: same centered layout as options; overflow visible so strip/clip cells are not ellipsed */
.tradelog-half .data-table-scroll table.data-table.tradelog-table--futures thead th:nth-child(7),
.tradelog-half .data-table-scroll table.data-table.tradelog-table--futures tbody td:nth-child(7) {
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  min-width: 0;
}

.tradelog-half .data-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card);
  box-shadow: 0 1px 0 var(--border);
}

.tradelog-half .data-table-scroll table.data-table.tradelog-table td.alert-time,
.tradelog-half .data-table-scroll table.data-table.tradelog-table td.clip-detail-time {
  white-space: nowrap !important;
}

/* Options: strike, premium, underlying, vol — nowrap; IV same (ellipsis only if value is unusually long) */
.tradelog-half .data-table-scroll .tradelog-table--options tbody td:nth-child(4),
.tradelog-half .data-table-scroll .tradelog-table--options tbody td:nth-child(5),
.tradelog-half .data-table-scroll .tradelog-table--options tbody td:nth-child(6),
.tradelog-half .data-table-scroll .tradelog-table--options tbody td:nth-child(7),
.tradelog-half .data-table-scroll .tradelog-table--options tbody td:nth-child(8) {
  white-space: nowrap;
}

.tradelog-half .data-table-scroll .tradelog-table--options tbody td:nth-child(7) .iv-display {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: inherit;
  line-height: 1.4;
}

.tradelog-half .data-table-scroll .iv-display {
  font-size: inherit;
  line-height: 1.4;
}

.tradelog-half .data-table-scroll .clip-badge,
.tradelog-half .data-table-scroll .clip-time-range {
  font-size: 0.75rem;
}

.tradelog-sub-header {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.count-badge {
  display: inline-block;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 600;
  font-family: var(--font-mono);
  vertical-align: middle;
}

.structures-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.structure-card {
  background: var(--bg-primary);
  border-left: 3px solid var(--region-accent, var(--border));
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin-bottom: 10px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.structure-card.conf-low-card {
  border-style: dashed;
  opacity: 0.7;
}

.conf-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.conf-high { background: color-mix(in srgb, var(--state-good) 20%, transparent); color: var(--state-good); border: 1px solid color-mix(in srgb, var(--state-good) 40%, transparent); }
.conf-medium { background: color-mix(in srgb, var(--state-warn) 20%, transparent); color: var(--state-warn); border: 1px solid color-mix(in srgb, var(--state-warn) 40%, transparent); }
.conf-low { background: color-mix(in srgb, var(--state-bad) 20%, transparent); color: var(--state-bad); border: 1px solid color-mix(in srgb, var(--state-bad) 40%, transparent); }
.conf-flags { font-size: var(--text-sm); color: var(--state-warn); cursor: help; vertical-align: middle; }

.struct-low-conf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: var(--track-tight);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.struct-low-conf-toggle:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
  border-color: var(--border-light);
}
.struct-low-conf-toggle input { cursor: pointer; }

.eod-structure-review-banner {
  margin: 8px 0 4px 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.eod-structure-review-banner--pending {
  background: color-mix(in srgb, var(--warn, #c9a227) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn, #c9a227) 35%, var(--border));
  color: var(--text);
}
.eod-structure-review-banner--ok {
  background: color-mix(in srgb, var(--success, #2ea043) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--success, #2ea043) 35%, var(--border));
  color: var(--text);
}

.sl-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.4;
}
.sl-price-btn {
  margin-left: auto;
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,0.3);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.sl-price-btn:hover {
  background: rgba(88,166,255,0.25);
}

.sl-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  padding-left: 2px;
}

.sl-type {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sl-type.tag-futures { background: color-mix(in srgb, var(--asset-futures) 15%, transparent); color: var(--asset-futures); }
.sl-type.tag-options { background: color-mix(in srgb, var(--asset-options) 15%, transparent); color: var(--asset-options); }
.sl-type.tag-cross { background: color-mix(in srgb, var(--asset-cross) 15%, transparent); color: var(--asset-cross); }

.sl-sep { color: var(--text-dim); margin: 0 6px; font-weight: 300; }
.sl-contract { color: var(--text); font-weight: 700; white-space: nowrap; }
.sl-name { color: var(--state-good); font-weight: 600; white-space: nowrap; }
.sl-decomp { color: var(--text-muted); font-weight: 400; font-size: 0.8em; font-style: italic; white-space: nowrap; }
.sl-details { color: var(--text-muted); }
.sl-net { font-weight: 500; white-space: nowrap; }
.sl-net-debit { color: var(--state-bad); font-weight: 600; }
.sl-net-credit { color: var(--state-good); font-weight: 600; }
.sl-net-zero { color: var(--text); font-weight: 600; }
.sl-net-unsigned { color: var(--text-muted); }
.sl-buyer-pays { color: var(--state-bad); font-weight: 600; }
.sl-seller-receives { color: var(--state-good); font-weight: 600; }
.sl-buyer-receives { color: var(--state-good); font-weight: 600; }
.sl-seller-pays { color: var(--state-bad); font-weight: 600; }
.sl-prem { color: var(--text-muted); white-space: nowrap; }
.sl-prem-green { color: color-mix(in srgb, var(--state-good) 70%, var(--state-info)); font-weight: 600; white-space: nowrap; }
.sl-delta { color: var(--state-info); white-space: nowrap; }
.sl-iv { color: var(--state-warn); white-space: nowrap; }
.sl-time { color: var(--text-dim); font-size: 0.75rem; margin-left: auto; white-space: nowrap; }

.sl-legs-wrap {
  padding: 4px 0 2px 0;
}
.sl-legs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  table-layout: fixed;
}
.sl-legs-table.nem-table thead th {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px 3px 0;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.sl-legs-table.nem-table tbody td {
  padding: 3px 8px 3px 0;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.sl-legs-table tbody tr:last-child td {
  border-bottom: none;
}
.sl-override-actions {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 4px 0;
}
.sl-override-actions.sl-override-actions--visible {
  display: flex;
}
.sl-leg-strike {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sl-dir-buy, .sl-dir-sell {
  font-weight: 600;
  font-size: var(--text-xs);
  width: 36px;
  min-width: 36px;
  text-align: center;
  display: inline-block;
  box-sizing: border-box;
}
.sl-dir-buy {
  color: var(--state-good);
}
.sl-dir-sell {
  color: var(--state-bad);
}
.sl-leg-prem {
  color: color-mix(in srgb, var(--state-good) 70%, var(--state-info));
  width: 64px;
}
.sl-leg-iv {
  color: var(--state-warn);
  width: 56px;
}
.sl-leg-delta {
  color: var(--state-info);
  width: 56px;
}
.sl-leg-vol {
  color: var(--text-dim);
  width: 48px;
}
.sl-delta-legs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 0 0;
}
.sl-delta-leg {
  font-size: var(--text-sm);
  color: var(--state-info);
  font-family: var(--font-mono);
}
.sl-fwd-ref {
  color: #a78bfa;
  font-weight: 500;
}
.sl-fwd-src {
  color: #8b8fa3;
  font-size: 0.8em;
  font-weight: 400;
}
.sl-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  font-size: 12px;
  padding: 4px 0 0 2px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.sl-copy-btn-full {
  display: block;
  width: calc(100% - 16px);
  margin: 8px 8px 4px 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: rgba(148, 163, 184, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.sl-copy-btn-full:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.35);
}
.sl-copy-btn-full.sl-copy-done {
  color: var(--state-good);
  border-color: color-mix(in srgb, var(--state-good) 40%, transparent);
  background: color-mix(in srgb, var(--state-good) 8%, transparent);
}
.sl-metrics-row {
  border-top: 1px solid rgba(255,255,255,0.04);
  padding-top: 4px;
  margin-top: 2px;
}

/* ===== EMPTY STATES ===== */

.empty-state-text {
  color: var(--text-dim);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--sp-5) var(--sp-3);
  font-style: italic;
}

td.empty-state-cell {
  text-align: center;
  color: var(--text-dim);
  font-size: var(--text-xs);
  font-style: italic;
  padding: 16px 8px;
}
td.empty-state-cell .empty-icon {
  font-size: 1.2rem;
  margin-bottom: 4px;
  opacity: 0.5;
}

/* ===== LOADING / SKELETON ===== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-primary) 25%,
    rgba(48, 54, 61, 0.3) 50%,
    var(--bg-primary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  min-height: 16px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-line:last-child {
  width: 60%;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.tradelog-skeleton-row td {
  padding: 6px 8px;
  background: transparent;
}
.tradelog-skeleton-row .skeleton-bar {
  height: 14px;
  width: 100%;
  border-radius: 4px;
}

.tradelog-error-row td {
  padding: 18px 12px;
  background: transparent;
  text-align: center;
}
.tradelog-error-msg {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--state-warn);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}
.tradelog-error-icon {
  font-size: var(--text-sm);
}
.tradelog-error-retry {
  background: color-mix(in srgb, var(--state-info) 14%, transparent);
  color: var(--state-info);
  border: 1px solid color-mix(in srgb, var(--state-info) 35%, transparent);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-left: 4px;
}
.tradelog-error-retry:hover {
  background: color-mix(in srgb, var(--state-info) 24%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .tradelog-skeleton-row .skeleton-bar {
    animation: none;
    opacity: 0.35;
  }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 17, 23, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  z-index: 10;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== INLINE LOADING FEEDBACK (AEMLoading helpers) ===== */

.aem-inline-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 5px;
  flex-shrink: 0;
}

/* Tab button while its deferred script is loading */
.tab-btn.aem-tab-loading {
  opacity: 0.65;
  pointer-events: none;
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-primary);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1400px) {
  .full-label { display: none; }
  .short-label { display: inline; }
  .nav-hide-medium { display: none; }
  .nav-live-compact { display: flex; }
  .tab-bar { gap: 0; padding: 2px; }
  .tab-btn { padding: 8px 10px; font-size: 0.72rem; }
  .top-bar-right { gap: 12px; }
}

@media (max-width: 1200px) {
  .brand-text-full { display: none; }
  .brand-text-short { display: inline; }
}

@media (max-width: 900px) {
  :root {
    --top-bar-h: 50px;
  }

  .top-bar {
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
    padding-bottom: 0;
    height: calc(var(--top-bar-h) + env(safe-area-inset-top, 0px));
  }
  .top-bar-center { display: none; }
  .nav-hide-narrow { display: none !important; }
  .hamburger-btn { display: flex; }
  .nav-live-compact { display: flex; }
  .top-bar-right { gap: 10px; }

  .brand-text-full,
  .brand-text-short { display: none; }
  .brand img { margin-right: 0 !important; }

  .dashboard {
    padding-top: calc(var(--top-bar-h) + env(safe-area-inset-top, 0px) + 12px);
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    padding-top: calc(var(--top-bar-h) + env(safe-area-inset-top, 0px) + 12px);
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
  }

  .panel-row { grid-template-columns: 1fr; }
  .panel-half { grid-column: span 1; }
  .data-table { font-size: 0.75rem; }
  .data-table thead th, .data-table tbody td { padding: 5px 6px; }
  .interconnector-row { font-size: 0.9rem; gap: 6px; }
  .trading-tables { grid-template-columns: 1fr; }

  .tradelog-split {
    flex-direction: column;
  }

  /* Column flex + flex-basis 0 on halves can collapse trade log height on phones */
  .tradelog-half:first-child,
  .tradelog-half:last-child {
    flex: 0 0 auto;
    width: 100%;
    align-self: stretch;
  }

  /* NEM tab: stack sub-tab bar + overview. Overview panels live inside #sub-overview — order must
     apply there (not #tab-nem > …), otherwise map/spot reorder never runs. */
  #tab-nem.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #tab-nem.active #sub-overview.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
  }

  #tab-nem.active #sub-overview.active > .market-map-row {
    display: contents;
  }

  #tab-nem.active #sub-overview.active > * {
    order: 10;
  }

  #tab-nem.active #sub-overview.active > .nem-section-band:first-of-type {
    order: 0;
  }

  #tab-nem.active #sub-overview.active #panel-nem-map {
    order: 1;
  }

  #tab-nem.active #sub-overview.active #panel-spot-prices {
    order: 2;
  }

  #tab-nem.active #sub-overview.active #panel-spot-summary {
    order: 3;
  }

  .market-snapshot-grid {
    grid-template-columns: 1fr;
  }

  .snapshot-table th,
  .snapshot-table td {
    padding: 4px 6px;
  }
}

.snapshot-header-trailing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 1;
  min-width: 0;
}

.snapshot-header-trailing .snapshot-header-right {
  margin-left: 0;
}

.snapshot-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.snapshot-header-right .collapse-icon {
  margin-left: 0;
}

/* Two flex rows on h2: title block + trailing cluster (controls + chevron flush right). */
#section-snapshot.panel > h2.section-hdr.collapsible-toggle {
  justify-content: flex-start;
  flex-wrap: nowrap;
  align-items: center;
}

#section-snapshot .snapshot-header-trailing .snapshot-header-right {
  flex-shrink: 1;
  min-width: 0;
}

#section-snapshot .date-picker-wrap {
  min-width: 0;
}

#section-snapshot .snapshot-header-trailing .collapse-icon {
  flex-shrink: 0;
}

.date-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.trading-date-caption {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
}
.trading-date-picker {
  background: var(--bg-primary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 3px 8px;
  min-width: 130px;
  width: 150px;
  flex-shrink: 0;
  outline: none;
  cursor: pointer;
  color-scheme: dark;
  transition: border-color 0.2s;
}
.trading-date-picker:hover {
  border-color: var(--border-light);
}
.trading-date-picker:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.15);
}
.trading-date-picker::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.opt-call { color: var(--state-good); font-weight: 600; }
.opt-put { color: var(--state-bad); font-weight: 600; }
.iv-display { color: var(--text-muted); white-space: nowrap; }

.tick-up { color: var(--positive); font-size: 0.75rem; }
.tick-down { color: var(--red); font-size: 0.75rem; }
.tick-same { color: var(--text-dim); font-size: 0.5rem; }

.vs-settle-up, .snapshot-table td.vs-settle-up { color: var(--state-good); font-weight: 600; }
.vs-settle-down, .snapshot-table td.vs-settle-down { color: var(--state-bad); font-weight: 600; }
.vs-settle-flat, .snapshot-table td.vs-settle-flat { color: var(--text-muted); }
.vs-settle-na { color: var(--text-dim); }

.market-summary-section {
  margin-bottom: 16px;
  padding: 0;
}

.market-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.snapshot-card {
  background: transparent;
  border: 1px solid var(--border);
  border-left: 2px solid var(--region-accent, var(--accent));
  border-radius: 6px;
  overflow: hidden;
}

.snapshot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-tint-1);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.snapshot-region-label {
  color: var(--region-accent, var(--accent));
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
}

.snapshot-header .count-badge {
  flex-shrink: 0;
}

/* Shared with NEM: .nem-table sets thead/body type scale; snapshot adds alignment + striping */
.snapshot-table.nem-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: var(--font-mono);
}

.snapshot-table th,
.snapshot-table td {
  text-align: center;
}

.snapshot-table th {
  color: var(--text-caption);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  padding: 7px 10px;
  white-space: normal;
  line-height: 1.15;
  word-break: keep-all;
}

.snapshot-table td {
  padding: 7px 10px;
  color: var(--text);
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.snapshot-table tbody tr:last-child td {
  border-bottom: none;
}

.snapshot-table tbody tr[data-zebra="1"] {
  background: var(--surface-tint-1);
}

.snapshot-table tbody tr[data-zebra]:hover {
  background: var(--surface-tint-2);
}

.snapshot-filter-bar.filter-bar {
  margin-bottom: 8px;
}

.snapshot-toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  user-select: none;
}

.snapshot-toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
}

/* .snapshot-traded-count uses global .count-badge */

.snapshot-collapse-icon {
  font-size: 0.6rem;
  color: var(--text-dim);
  transition: transform 0.2s;
  margin-left: 6px;
}

.snapshot-collapsed .snapshot-collapse-icon {
  transform: rotate(-90deg);
}

.snapshot-collapsed .snapshot-table,
.snapshot-collapsed .empty-state {
  display: none;
}

.snapshot-product-group td {
  padding: 5px 10px 3px;
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: var(--track-tight);
  border-bottom: 1px solid color-mix(in srgb, var(--state-good) 22%, transparent);
  background: color-mix(in srgb, var(--state-good) 6%, transparent);
}

.snapshot-traded-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--positive);
  background: rgba(63, 185, 80, 0.1);
  border-radius: 3px;
  letter-spacing: 0;
  text-transform: none;
}

.snapshot-row-traded td {
  color: var(--text);
}

.snapshot-row-traded td:first-child {
  color: var(--text);
  font-weight: 700;
}

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

.strip-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 2px;
  vertical-align: super;
  opacity: 0.7;
}

.snapshot-row-settle td {
  opacity: 0.45;
}

.snapshot-row-settle td:first-child {
  font-weight: 500;
}

.snapshot-row-settle td.muted {
  color: var(--text-muted);
  opacity: 0.3;
}

.snapshot-total-row {
  border-top: 1px solid var(--border);
}

.snapshot-total-row td {
  padding: 6px 6px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: none;
}

.snapshot-total-row td:first-child {
  color: var(--text-muted);
  font-weight: 600;
}

.snapshot-row-traded {
  cursor: pointer;
}

.snapshot-table tbody tr.snapshot-row-traded.snapshot-expanded {
  background: color-mix(in srgb, var(--state-good) 10%, var(--bg-card));
}

.snapshot-table tbody tr.snapshot-row-traded.snapshot-expanded:hover {
  background: color-mix(in srgb, var(--state-good) 14%, var(--bg-card));
}

.snapshot-detail-row td {
  background: rgba(13, 17, 23, 0.6);
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.snapshot-detail-panel {
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  margin: 0;
}

.snapshot-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.snapshot-detail-contract {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
}

.snapshot-range-btns {
  display: flex;
  gap: 4px;
}

.snapshot-range-btns button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.snapshot-range-btns button:hover {
  border-color: var(--border-light);
  color: var(--text);
}

.snapshot-range-btns button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
  font-weight: 700;
}

.snapshot-sparkline {
  width: 100%;
  margin-bottom: 8px;
  position: relative;
}

.snapshot-sparkline svg {
  display: block;
  max-width: 100%;
}

.snapshot-sparkline .trade-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.snapshot-sparkline .trade-dot {
  fill: var(--accent);
  opacity: 0.85;
}

.snapshot-sparkline .settle-line {
  stroke: var(--amber);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  opacity: 0.6;
  filter: drop-shadow(0 0 3px rgba(255, 171, 0, 0.45));
}

.snapshot-sparkline .settle-label {
  fill: var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  opacity: 0.9;
  text-anchor: end;
}

.snapshot-sparkline .day-boundary {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.5;
}

.snapshot-sparkline .day-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-anchor: middle;
}

.snapshot-sparkline .axis-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-anchor: end;
}

.snapshot-sparkline .grid-line {
  stroke: var(--border);
  stroke-width: 0.5;
  opacity: 0.4;
}

.snapshot-sparkline .time-tick {
  stroke: var(--border);
  stroke-width: 0.5;
  opacity: 0.5;
}

.snapshot-sparkline .time-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  text-anchor: middle;
}

.snapshot-sparkline .time-label-sub {
  fill: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 7px;
  text-anchor: middle;
}

.snapshot-sparkline-interactive {
  position: relative;
}

.snapshot-area-gradient .snapshot-area-stop0 {
  stop-color: var(--accent);
  stop-opacity: 0.22;
}

.snapshot-area-gradient .snapshot-area-stop1 {
  stop-color: var(--accent);
  stop-opacity: 0.02;
}

.snapshot-sparkline .snapshot-vol-bar {
  fill: var(--accent);
  opacity: 0.14;
  pointer-events: none;
}

.snapshot-sparkline .snapshot-crosshair {
  stroke: rgba(230, 237, 243, 0.35);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.snapshot-sparkline .snapshot-hover-indicator {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  pointer-events: none;
}

.snapshot-sparkline .snapshot-sparkline-hit {
  cursor: crosshair;
}

.snapshot-sparkline .trade-dot-anchor {
  fill: var(--accent);
  stroke: rgba(13, 17, 23, 0.85);
  stroke-width: 1;
  pointer-events: none;
}

.snapshot-sparkline .trade-dot-last {
  fill: var(--accent);
}

.snapshot-sparkline .snapshot-pulse-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  pointer-events: none;
  animation: snapshotPulseRing 2.2s ease-in-out infinite;
}

@keyframes snapshotPulseRing {
  0%,
  100% {
    stroke-opacity: 0.65;
  }

  50% {
    stroke-opacity: 0.12;
  }
}

.snapshot-hover-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  max-width: 220px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(139, 148, 158, 0.45);
  background: rgba(13, 17, 23, 0.96);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.snapshot-hover-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.snapshot-hover-tooltip strong {
  font-weight: 700;
  color: var(--text);
}

.snapshot-detail-stat .stat-value-animated {
  transition: color 0.2s ease;
}

.snapshot-detail-stat--chg .stat-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.snapshot-chg-arrow {
  font-size: 0.65rem;
  line-height: 1;
}

.snapshot-chg-arrow--up {
  color: var(--positive);
}

.snapshot-chg-arrow--down {
  color: var(--red);
}

.snapshot-chg-arrow--flat {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.snapshot-detail-stats {
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.snapshot-stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 20px;
}

.snapshot-stats-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
}

.snapshot-stats-group--rest {
  padding-left: 14px;
  border-left: 1px solid rgba(139, 148, 158, 0.35);
}

@media (max-width: 520px) {
  .snapshot-stats-group--rest {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid rgba(139, 148, 158, 0.25);
    padding-top: 10px;
    width: 100%;
  }
}

.snapshot-detail-stat {
  display: flex;
  gap: 4px;
  align-items: baseline;
}

.snapshot-detail-stat .stat-label {
  color: var(--text-muted);
  font-weight: 400;
}

.snapshot-detail-stat .stat-value {
  color: var(--text);
  font-weight: 600;
}

.snapshot-detail-stat .stat-value.up {
  color: var(--positive);
}

.snapshot-detail-stat .stat-value.down {
  color: var(--red);
}

.snapshot-detail-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.snapshot-detail-empty {
  text-align: center;
  padding: 16px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.context-section {
  min-width: 0;
}

.ctx-up {
  color: var(--positive);
}

.ctx-down {
  color: #ff6b6b;
}

.context-oi-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ctx-oi-card {
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 18px;
  min-width: 100px;
  text-align: center;
}

.ctx-oi-region {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ctx-oi-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.ctx-oi-change {
  font-size: 11px;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.vol-total-inline {
  font-weight: 400;
  font-size: 11px;
  color: var(--accent);
  margin-left: 8px;
  font-family: var(--font-mono);
}

.simult-indicator {
  display: inline-block;
  font-size: 10px;
  color: var(--amber);
  background: rgba(255, 183, 0, 0.15);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  text-align: center;
  line-height: 14px;
  margin-left: 4px;
  cursor: help;
  vertical-align: middle;
}

.clip-count {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.vol-asx-settle-ref {
  margin-top: 10px;
}

.settle-ref-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settle-ref-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settle-chip {
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text);
}

.settle-chip strong {
  color: var(--accent);
  margin-right: 6px;
}

.settle-delta {
  font-weight: 600;
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
}
.delta-close { color: #3fb950; background: rgba(63,185,80,0.15); }
.delta-warn { color: #d29922; background: rgba(210,153,34,0.15); }
.delta-far { color: #f85149; background: rgba(248,81,73,0.15); }

@media (max-width: 900px) {
  .context-grid {
    grid-template-columns: 1fr;
  }
}

.nem-map-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px;
    min-height: 340px;
    flex: 1;
}

#panel-nem-map {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.nem-map-container svg {
    max-width: 560px;
    width: 100%;
    height: auto;
}

.nem-state {
    stroke-width: 2.5;
    stroke-linejoin: round;
    paint-order: stroke fill;
    cursor: pointer;
    transition: opacity 0.2s, filter 0.2s;
    opacity: 0.88;
}

.nem-state:hover {
    opacity: 1;
    filter: brightness(1.35) drop-shadow(0 0 6px rgba(255,255,255,0.15));
}

.nem-state-glow {
    pointer-events: none;
}

.nem-state-label {
    fill: #fff;
    font-size: 17px;
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
    letter-spacing: 1.5px;
}

.nem-state-price {
    font-size: 15px;
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
    font-family: var(--font-mono);
}

/* NEM map interconnector flows (polished) */
.nem-ic-line-main {
    stroke: var(--ic-color, #888);
    stroke-width: var(--ic-stroke, 4px);
    stroke-linecap: round;
    stroke-dasharray: 8 5;
    pointer-events: none;
    fill: none;
    animation: nem-ic-march 1.15s linear infinite;
}

.nem-ic-line-main.reverse {
    animation-direction: reverse;
}

.nem-ic-glow {
    pointer-events: none;
    fill: none;
    stroke: var(--ic-color, #888);
    stroke-width: var(--ic-glow-stroke, 8px);
    stroke-linecap: round;
    filter: url(#ic-glow);
    opacity: 0.38;
}

.nem-ic-invisible-dir {
    fill: none;
    pointer-events: none;
    stroke: rgba(0, 0, 0, 0.01);
    stroke-width: 1.5;
    opacity: 0;
}

.nem-map-container:has(.nem-ic-group:hover) .nem-ic-group {
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

.nem-map-container:has(.nem-ic-group:hover) .nem-ic-group:hover {
    opacity: 1;
}

.nem-ic-group:hover .nem-ic-line-main {
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--ic-color, #3fb950) 55%, transparent));
    stroke-width: calc(var(--ic-stroke, 4px) + 1.5px);
}

.nem-ic-group:hover .nem-ic-glow {
    opacity: 0.48;
    stroke-width: calc(var(--ic-glow-stroke, 8px) + 2px);
}

.nem-ic-ui-overlay {
    fill: rgba(0, 0, 0, 0.0001);
    pointer-events: all;
    cursor: help;
    stroke: none;
}

.nem-ic-chip-bg {
    pointer-events: none;
    stroke-width: 1;
}

.nem-ic-name-caption {
    font-size: 9px;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
    text-transform: uppercase;
    fill: rgba(255, 255, 255, 0.7);
    paint-order: stroke fill;
    stroke: rgba(0, 0, 0, 0.7);
    stroke-width: 2px;
    letter-spacing: 0.08em;
}

.nem-ic-leader {
    fill: none;
    pointer-events: none;
    stroke: var(--ic-color, #3fb950);
    stroke-width: 0.7;
    stroke-dasharray: 2 3;
    opacity: 0.55;
    stroke-linecap: round;
}

.nem-ic-chip-text {
    font-size: 10.5px;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
    font-family: var(--font-mono);
    fill: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.02em;
}

.nem-ic-tooltip {
    position: absolute;
    z-index: 50;
    min-width: 12rem;
    max-width: 20rem;
    padding: 0.55rem 0.7rem;
    background: color-mix(in srgb, var(--surface-elevated) 96%, #000 4%);
    border: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
}

.nem-ic-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
}

/* NEM map: per-state market summary (follows cursor like IC tooltip) */
.nem-state-tooltip {
    position: absolute;
    z-index: 50;
    min-width: 12rem;
    max-width: 20rem;
    padding: 0.55rem 0.7rem;
    background: color-mix(in srgb, var(--surface-elevated) 96%, #000 4%);
    border: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
}

.nem-state-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
}

.nem-ic-tooltip strong,
.nem-state-tooltip strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.nem-ic-tooltip .nem-ic-tt-price,
.nem-state-tooltip .nem-ic-tt-price {
    font-family: var(--font-mono, monospace);
    font-weight: 700;
    font-size: 0.85rem;
    margin: 0.2rem 0 0.35rem 0;
}

.nem-ic-tooltip .nem-ic-tt-direction {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.nem-ic-tooltip .nem-ic-tt-row,
.nem-state-tooltip .nem-ic-tt-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.nem-ic-tooltip .nem-ic-tt-label,
.nem-state-tooltip .nem-ic-tt-label {
    color: var(--text-muted);
}

@keyframes nem-ic-march {
    to {
        stroke-dashoffset: -13;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nem-ic-line-main {
        animation: none;
    }
}

.nem-legend-label {
    fill: rgba(255,255,255,0.55);
    font-size: 11px;
    pointer-events: none;
}

.spot-summary-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.spot-period-stats + .spot-summary-section {
    margin-top: 12px;
}
.spot-summary-section .spot-comparison-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Allow grid column to shrink so wide summaries scroll instead of stretching the layout */
#panel-spot-summary,
#spot-summary-container {
    min-width: 0;
}

.spot-summary-table-wrap {
    position: relative;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 14px;
    overscroll-behavior-x: contain;
}

.spot-summary-table-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    background: linear-gradient(to left, var(--bg-card), rgba(13, 17, 23, 0));
    z-index: 3;
    opacity: 0.85;
}

/* Last column sits under the scroll-edge fade; pad so values (e.g. Peak MW) stay readable */
.spot-summary-table-wrap .spot-summary-table th:last-child,
.spot-summary-table-wrap .spot-summary-table td:last-child {
    padding-right: 28px;
}

.spot-summary-table-wrap .spot-summary-table {
    margin-bottom: 0;
    width: max-content;
    min-width: 100%;
}

.spot-summary-table-wrap .spot-summary-table th:first-child,
.spot-summary-table-wrap .spot-summary-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bg-card);
    box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.45);
}

.spot-summary-table-wrap .spot-summary-table thead th:first-child {
    z-index: 2;
}

.spot-summary-table-wrap .spot-summary-table tbody tr:hover td:first-child {
    background: rgba(255, 255, 255, 0.03);
}

.spot-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
}
.spot-summary-table th {
    text-align: left;
    padding: 10px 10px 9px;
    color: var(--text-caption);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
}
.spot-summary-table th:not(:first-child) {
    text-align: right;
}
.spot-summary-table td {
    padding: 10px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-family: var(--font-mono);
}
.spot-summary-table td:not(:first-child) {
    text-align: right;
}
.spot-summary-table tbody td:first-child {
    font-weight: 800;
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    color: rgba(230, 237, 243, 0.95);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding-top: 11px;
    padding-bottom: 11px;
}
.spot-summary-table tr:hover {
    background: rgba(255,255,255,0.03);
}
.spot-summary-detail-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.spot-event-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    border-left: 3px solid transparent;
    font-family: var(--font-mono);
    font-size: 11px;
}
.spot-event-card.spike {
    border-left-color: #ff4444;
}
.spot-event-card.negative {
    border-left-color: #4488ff;
}
.spot-event-card.mixed {
    border-image: linear-gradient(to bottom, #ff4444, #4488ff) 1;
}
.event-card-region {
    font-weight: 700;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    min-width: 28px;
}
.event-card-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.event-card-spike {
    color: #ff6666;
}
.event-card-neg {
    color: #6699ff;
}
.price-distribution {
    margin-bottom: 12px;
}
.price-distribution--embedded {
    margin-bottom: 0;
}
.dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.dist-region {
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: rgba(255,255,255,0.8);
    min-width: 28px;
}
.dist-bar {
    flex: 1;
    display: flex;
    height: 12px;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
}
.dist-seg {
    transition: opacity 0.2s;
}
.dist-seg:hover {
    opacity: 0.8;
}
.dist-legend {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    flex-wrap: wrap;
}
.dist-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    color: rgba(255,255,255,0.45);
    font-family: var(--font-mono);
}
.dist-legend-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 1px;
}
.demand-sparkline {
    margin-bottom: 12px;
    padding: 4px 4px 6px;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
}
.demand-sparkline-chart-shell {
    position: relative;
    width: 100%;
}
.demand-sparkline-header {
    position: absolute;
    top: 4px;
    right: 6px;
    z-index: 1;
    margin: 0;
    pointer-events: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.demand-sparkline-svg-wrap {
    width: 100%;
    min-height: 0;
}
.demand-peak-label {
    color: var(--positive);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}
.demand-sparkline svg {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
    overflow: visible;
}
.spot-gap-warning {
    padding: 5px 10px;
    margin-bottom: 8px;
    background: rgba(255,152,0,0.1);
    border: 1px solid rgba(255,152,0,0.25);
    border-radius: 4px;
    font-size: 11px;
    color: #ffaa44;
    font-family: var(--font-mono);
}
.spot-gap-warning--postsync {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.spot-gap-retry {
    font-size: 10px;
    padding: 2px 8px;
}

.spot-sync-btn {
    margin-left: 8px;
    font-size: 0.7rem;
    padding: 3px 10px;
    vertical-align: middle;
}
.spot-sync-btn[aria-busy="true"] {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}
.spot-sync-btn[aria-busy="true"]::after {
    content: '';
    display: inline-block;
    width: 0.6em;
    height: 0.6em;
    margin-left: 6px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: var(--accent, #5ad);
    border-radius: 50%;
    animation: spot-sync-spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes spot-sync-spin {
    to { transform: rotate(360deg); }
}
.spot-neg-warning {
    padding: 5px 10px;
    margin-bottom: 8px;
    background: rgba(100, 149, 237, 0.08);
    border: 1px solid rgba(100, 149, 237, 0.28);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted, #8a9bb0);
    font-family: var(--font-mono);
}

.ds-tightest-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
.ds-alert-critical { background: rgba(248,81,73,0.08); border-color: rgba(248,81,73,0.3); }
.ds-alert-warning { background: rgba(255,170,0,0.06); border-color: rgba(255,170,0,0.25); }
.ds-alert-normal { background: rgba(76,175,80,0.05); border-color: rgba(76,175,80,0.2); }
.ds-alert-icon { font-size: 1.2rem; }
.ds-alert-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ds-alert-detail { display: flex; align-items: center; gap: 10px; }
.ds-alert-region { font-weight: 700; font-size: 1rem; }
.ds-alert-mw { font-family: var(--font-mono); font-weight: 700; font-size: 1rem; color: var(--text); }
.ds-alert-time { font-size: var(--text-xs); color: var(--text-dim); margin-left: auto; }

.ds-nem-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
}
.ds-margin-tight { border-color: rgba(248,81,73,0.3); background: rgba(248,81,73,0.06); }
.ds-margin-watch { border-color: rgba(255,170,0,0.25); background: rgba(255,170,0,0.04); }
.ds-margin-ok { border-color: rgba(76,175,80,0.2); }
.ds-nem-label {
  font-size: var(--text-xs);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.ds-nem-mw { font-family: var(--font-mono); font-weight: 700; font-size: 1rem; color: var(--text); }
.ds-nem-pct {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ds-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.ds-region-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color 0.2s, transform 0.15s;
}
.ds-region-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.ds-card-tight { border-color: rgba(248,81,73,0.35); background: rgba(248,81,73,0.05); }
.ds-card-watch { border-color: rgba(255,170,0,0.3); background: rgba(255,170,0,0.03); }
.ds-card-ok { }
.ds-card-region { font-weight: 700; font-size: var(--text-sm); letter-spacing: 0.04em; margin-bottom: 4px; }
.ds-card-hero { font-family: var(--font-mono); font-size: 1rem; font-weight: 700; color: var(--text); }
.ds-card-tight .ds-card-hero { color: var(--state-bad); }
.ds-card-watch .ds-card-hero { color: var(--state-warn); }
.ds-card-ok .ds-card-hero { color: var(--state-good); }
.ds-card-pct-inline { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); font-weight: 600; margin-left: 4px; }
.ds-card-details { border-top: 1px solid var(--border-subtle); padding-top: 4px; margin-top: 4px; }
.ds-card-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-dim);
  padding: 2px 0;
}
.ds-card-row span:last-child { font-family: var(--font-mono); color: var(--text-muted); }

.gen-trips-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}
.gen-trips-table th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-caption);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-normal);
    border-bottom: 1px solid var(--border-subtle);
}
.gen-trips-table th:not(:first-child) {
    text-align: right;
}
.gen-trips-table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-family: var(--font-mono);
}
.gen-trips-table td:not(:first-child) {
    text-align: right;
}
.gen-trips-table td:first-child {
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}
.gen-trips-table tr:hover {
    background: rgba(255,255,255,0.03);
}
.gen-trips-table .trip-duid {
    font-family: var(--font-mono);
    font-weight: 700;
    color: rgba(255,255,255,0.85);
}
.gen-trips-table .trip-time {
    color: var(--text-caption);
    font-size: var(--text-xs);
}
.trip-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.trip-station {
    display: block;
    font-size: var(--text-2xs);
    color: var(--text-caption);
    font-family: var(--font-sans, sans-serif);
    line-height: 1.2;
    margin-top: 1px;
}
.trip-drop { font-weight: 700; }
.trip-drop-amber { color: var(--state-warn); }
.trip-drop-red { color: var(--state-bad); }
#gen-trips-container {
    max-height: 240px;
    overflow-y: auto;
}
#gen-trips-container .gen-trips-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}
.spot-summary-narrative {
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    border-left: 3px solid var(--accent);
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
}

.spot-presets {
    display: flex;
    gap: 4px;
}
.spot-preset {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
}
.spot-custom-dates {
    display: flex;
    align-items: center;
    gap: 6px;
}
.spot-date-input {
    padding: 3px 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 3px;
    color: rgba(255,255,255,0.8);
    font-size: 11px;
    font-family: var(--font-mono);
    color-scheme: dark;
}
.spot-date-sep {
    color: rgba(255,255,255,0.35);
    font-size: 11px;
}
.spot-compare-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    cursor: pointer;
    font-family: var(--font-mono);
}
.spot-compare-toggle input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}
.spot-copy-btn {
    margin-left: auto;
    padding: 2px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 3px;
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.15s;
}
.spot-copy-btn:hover {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: rgba(88,166,255,0.3);
}

.spot-shape-section {
    margin-top: 10px;
}
.spot-shape-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    user-select: none;
}
.spot-shape-toggle input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}
.spot-shape-table td.spot-td-sub {
    color: rgba(255,255,255,0.35);
    font-size: 10px;
}

.spot-comparison-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.spot-spreads-section {
    margin-top: 10px;
}
.spot-spread-cards {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.spot-spread-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px;
    min-width: 90px;
}
.spread-pair {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    font-family: var(--font-mono);
    margin-bottom: 2px;
}
.spread-val {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.spot-spike-calendar {
    margin-top: 10px;
}
.spike-cal-grid {
    margin-top: 6px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-bottom: 4px;
}
.spike-cal-row {
    display: flex;
    gap: 2px;
    margin-bottom: 2px;
    width: max-content;
    min-width: 100%;
}
.spike-cal-header {
    margin-bottom: 4px;
}
.spike-cal-label {
    width: 36px;
    min-width: 36px;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-card);
    box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.45);
}
.spike-cal-cell {
    width: 42px;
    min-width: 42px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-family: var(--font-mono);
    color: rgba(255,255,255,0.7);
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.04);
}
.spike-cal-cell.spike-cal-date {
    color: rgba(255,255,255,0.4);
    font-size: 9px;
    border: none;
    background: transparent !important;
}

.genmix-container {
    padding: 8px 0;
    min-height: 100px;
    box-sizing: border-box;
}

.genmix-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.genmix-region {
    display: flex;
    align-items: center;
    gap: 8px;
}

.genmix-region-name {
    width: 32px;
    font-weight: 700;
    font-size: 12px;
    color: #ccc;
    text-align: right;
    flex-shrink: 0;
}

.genmix-bar {
    flex: 1;
    display: flex;
    height: 20px;
    border-radius: 3px;
    overflow: hidden;
    background: #1a1f2e;
}

.genmix-segment {
    height: 100%;
    min-width: 2px;
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.genmix-pct {
    font-family: var(--font-mono);
    font-size: 9px;
    color: rgba(0,0,0,0.7);
    font-weight: 700;
    text-shadow: 0 0 2px rgba(255,255,255,0.3);
    pointer-events: none;
}

.genmix-segment:hover {
    opacity: 0.8;
}

.genmix-total {
    width: 70px;
    font-size: 11px;
    color: #888;
    text-align: right;
    flex-shrink: 0;
}

.genmix-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #1a1f2e;
}

.genmix-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #888;
}

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

.genmix-source {
    font-size: 10px;
    color: #666;
    text-align: right;
    margin-top: 4px;
}

.market-status-badge {
    display: none;
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 8px;
}
.market-status-badge.is-visible {
    display: inline-block;
}

.market-status-badge.pre-open {
    background: color-mix(in srgb, var(--state-warn) 15%, transparent);
    color: var(--state-warn);
    border: 1px solid color-mix(in srgb, var(--state-warn) 30%, transparent);
}

.market-status-badge.market-live {
    background: rgba(63, 185, 80, 0.15);
    color: var(--positive);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.market-status-badge.after-hours {
    background: color-mix(in srgb, var(--state-info) 12%, transparent);
    color: var(--state-info);
    border: 1px solid color-mix(in srgb, var(--state-info) 35%, transparent);
}

.market-status-badge.market-closed {
    background: color-mix(in srgb, var(--text-muted) 15%, transparent);
    color: var(--text-muted);
    border: 1px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
}

.section-hdr-ts.predispatch-run-stale {
    color: var(--state-warn);
}

/* Trade History: compact table panel header (inside #tab-asx) */
.section-hdr.section-hdr--hist-table-tight {
  margin-bottom: 0;
  border-bottom: none;
}

/* ===== EVENT CONSOLE ===== */

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

.timeline-legend {
    display: flex;
    gap: 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

.legend-critical { background: var(--red); }
.legend-warning { background: var(--amber); }
.legend-normal { background: var(--state-info); }
.legend-info { background: #6e7681; }

/* ===== EVENT FEED ===== */
.ef-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--top-bar-h) - 60px);
    min-height: 500px;
}

.ef-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.ef-toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ef-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ef-count {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-dim);
    background: rgba(48, 54, 61, 0.5);
    padding: 2px 10px;
    border-radius: 10px;
}

.ef-status-badge {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: var(--track-tight);
}

.ef-status-badge.ef-live {
    background: rgba(63,185,80,0.12);
    color: var(--positive);
    border: 1px solid rgba(63,185,80,0.3);
}

.ef-status-badge.ef-paused {
    background: rgba(255,68,68,0.12);
    color: var(--red);
    border: 1px solid rgba(255,68,68,0.3);
}

.ef-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ef-time-group {
    display: flex;
    gap: 2px;
    background: rgba(13,17,23,0.6);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--border);
}

.ef-time-btn {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: 4px 10px;
}

.ef-live-btn {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 700;
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(88, 166, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: var(--track-tight);
}

.ef-live-btn.ef-live-on {
    background: var(--accent-muted);
    color: var(--accent);
}

.ef-live-btn.ef-live-off {
    background: rgba(255,68,68,0.1);
    border-color: rgba(255,68,68,0.4);
    color: var(--red);
}

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

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

.ef-filter-label {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: var(--track-tight);
    margin-right: 4px;
}

.ef-chip {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 3px 8px;
    white-space: nowrap;
}

.ef-select {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: pointer;
    outline: none;
}

.ef-search-wrap {
    margin-left: auto;
}

.ef-search {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text);
    width: 220px;
    outline: none;
    transition: border-color 0.2s;
}

.ef-search:focus { border-color: var(--accent); }
.ef-search::placeholder { color: var(--text-dim); }

.ef-timeline-bar {
    flex-shrink: 0;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px 8px;
    overflow: hidden;
}

.ef-timeline {
    height: 220px;
    width: 100%;
    position: relative;
}

.ef-timeline-legend {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 6px;
}

.ef-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-dim);
}

.ef-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}
.ef-legend-dot--emergency { background: var(--red); }
.ef-legend-dot--high { background: var(--state-warn); }
.ef-legend-dot--normal { background: var(--state-info); }
.ef-legend-dot--info { background: var(--text-dim); }

.ef-new-events-bar {
    text-align: center;
    padding: 6px;
    flex-shrink: 0;
}

.ef-new-events-btn {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: 6px 20px;
    border-radius: 16px;
    border: 1px solid rgba(88, 166, 255, 0.4);
    background: var(--accent-muted);
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s;
}

.ef-new-events-btn:hover {
    background: rgba(88,166,255,0.2);
}

.ef-feed {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding-right: 4px;
}

.ef-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-dim);
    gap: 12px;
}

.ef-state-icon {
    font-size: 2rem;
    opacity: 0.4;
}

.ef-state-text {
    font-family: var(--font-sans);
    font-size: var(--text-lg);
}

.ef-state-sub {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-dim);
    margin-top: 4px;
}

.ef-state-retry {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 5px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 8px;
}

.ef-state-retry:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

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

.ef-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: ef-spin 0.8s linear infinite;
}

.ef-row {
    display: flex;
    align-items: stretch;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    min-height: 56px;
}

.ef-row:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.ef-row.ef-selected {
    border-color: rgba(88,166,255,0.4);
    background: rgba(88,166,255,0.03);
}

.ef-row.ef-new {
    animation: ef-flash 2.5s ease-out;
}

@keyframes ef-flash {
    0% { background: rgba(88,166,255,0.1); }
    100% { background: var(--bg-primary); }
}

.ef-row.ef-acked { opacity: 0.55; }
.ef-row.ef-muted { opacity: 0.35; }

.ef-sev-bar {
    width: 4px;
    border-radius: 6px 0 0 6px;
    flex-shrink: 0;
}

.ef-sev-emergency { background: var(--red); }
.ef-sev-high { background: var(--state-warn); }
.ef-sev-normal { background: var(--state-info); }
.ef-sev-watch { background: #cc9944; }
.ef-sev-info { background: #555d66; }

.ef-row-body {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.ef-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ef-row-time {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-dim);
    flex-shrink: 0;
    min-width: 68px;
}

.ef-row-age {
    font-size: var(--text-xs);
    color: var(--text-dim);
    opacity: 0.7;
}

.ef-pill {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: var(--track-tight);
    flex-shrink: 0;
    line-height: 1.3;
}

.ef-pill-emergency { background: rgba(255, 68, 68, 0.15); color: var(--red); border: 1px solid rgba(255, 68, 68, 0.3); }
.ef-pill-high { background: rgba(255, 170, 0, 0.12); color: var(--state-warn); border: 1px solid rgba(255, 170, 0, 0.25); }
.ef-pill-normal { background: var(--accent-muted); color: var(--state-info); border: 1px solid rgba(88, 166, 255, 0.2); }
.ef-pill-watch { background: rgba(204, 153, 68, 0.12); color: #cc9944; border: 1px solid rgba(204, 153, 68, 0.25); }
.ef-pill-info { background: rgba(110, 118, 129, 0.12); color: var(--text-muted); border: 1px solid rgba(110, 118, 129, 0.2); }

.ef-pill-type {
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.08);
}

.ef-pill-region {
    background: rgba(255,170,0,0.08);
    color: #cc9944;
    border: 1px solid rgba(255,170,0,0.15);
}

.ef-pill-asset {
    background: rgba(88, 166, 255, 0.06);
    color: var(--state-info);
    border: 1px solid rgba(88, 166, 255, 0.12);
    font-size: var(--text-2xs);
    opacity: 0.9;
}

.ef-count-badge {
    font-size: var(--text-2xs);
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--accent-muted);
    color: var(--state-info);
    border: 1px solid rgba(88, 166, 255, 0.2);
}

.ef-row-title {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.ef-row-summary {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ef-row-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.ef-row:hover .ef-row-actions { opacity: 1; }

.ef-act-btn {
    font-size: var(--text-sm);
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}

.ef-act-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
    border-color: var(--border-light);
}

.ef-act-btn.ef-acked-btn {
    color: var(--accent);
    border-color: rgba(88,166,255,0.3);
}

.ef-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
    cursor: pointer;
}

.ef-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.4);
}

.ef-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ef-drawer-title {
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text);
}

.ef-drawer-close {
    font-size: 1.25rem;
    line-height: 1;
    min-width: 36px;
    min-height: 36px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ef-drawer-close:hover {
    color: var(--text);
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.ef-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.6;
}

.ef-drawer-body .ef-detail-section {
    margin-bottom: 16px;
}

.ef-drawer-body .ef-detail-label {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: var(--track-tight);
    margin-bottom: 4px;
}

.ef-drawer-body .ef-detail-value {
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.ef-drawer-body .ef-detail-meta {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 6px 12px;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.ef-drawer-body .ef-detail-meta dt {
    color: var(--text-dim);
}

.ef-drawer-body .ef-detail-meta dd {
    color: var(--text);
}

.ef-drawer-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.ef-drawer-btn {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.ef-drawer-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.ef-drawer-footer {
    flex-shrink: 0;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.ef-drawer-footer-close {
    width: 100%;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.ef-drawer-footer-close:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

@media (max-width: 900px) {
    .ef-filter-row { gap: 8px; }
    .ef-search { width: 160px; }
    .ef-search-wrap { margin-left: 0; }
    .ef-detail-drawer { width: 100vw; max-width: 100vw; }
}

@media (max-width: 600px) {
    .ef-toolbar-row { flex-direction: column; gap: 8px; align-items: stretch; }
    .ef-toolbar-right { justify-content: space-between; }
    .ef-search { width: 100%; }
}

/* ===== TRADE HISTORY TAB ===== */
#sub-history .hist-filter-panel { margin-bottom: 0; }
#sub-history .hist-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
#sub-history .hist-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}
#sub-history .hist-filter-contract { flex: 1; min-width: 180px; max-width: 280px; }
#sub-history .hist-label {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#sub-history .hist-select,
#sub-history .hist-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#sub-history .hist-select:focus,
#sub-history .hist-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.08);
}
#sub-history .hist-select option { background: var(--bg-card); color: var(--text); }
#sub-history .hist-select-sm { padding: 5px 8px; font-size: 0.7rem; }
#sub-history .hist-date-input { width: 130px; }
#sub-history .hist-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  margin-top: 2px;
}
#sub-history .hist-dropdown-item {
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
#sub-history .hist-dropdown-item:hover { background: rgba(88,166,255,0.08); }
#sub-history .hist-range-btns {
  display: flex;
  gap: 2px;
}
#sub-history .hist-range-btn {
  background: rgba(22,27,34,0.6);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 6px 11px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}
#sub-history .hist-range-btn:hover { border-color: var(--accent); color: var(--text); }
#sub-history .hist-range-btn.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
#sub-history .hist-filter-actions { flex-direction: row; gap: 6px; align-self: flex-end; }
#sub-history .hist-btn {
  border: none;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 7px 18px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#sub-history .hist-btn-sm { padding: 5px 10px; font-size: 0.68rem; }

#sub-history .hist-stats-panel { margin-top: 12px; }
#sub-history .hist-stats-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#sub-history .hist-stat-chip {
  background: rgba(22,27,34,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  min-width: 85px;
  text-align: center;
  transition: border-color 0.2s;
}
#sub-history .hist-stat-chip:hover { border-color: var(--border-light); }
#sub-history .hist-stat-label {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
#sub-history .hist-stat-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}
#sub-history .hist-stat-chip.stat-pos .hist-stat-value { color: var(--positive); }
#sub-history .hist-stat-chip.stat-neg .hist-stat-value { color: var(--red); }
#sub-history .hist-tape-chart-hdr {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
#sub-history .hist-tape-hdr-titles {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  min-width: 0;
}
#sub-history .hist-tape-vol-toggle {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
#sub-history .hist-tape-vol-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}
#sub-history .hist-tape-vol-toggle.is-active {
  border-color: rgba(16, 185, 129, 0.55);
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

#sub-history .hist-stat-empty {
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.8rem;
  padding: 10px 0;
}
#sub-history .hist-loading {
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 24px;
  text-align: center;
}

#sub-history .hist-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
#sub-history .hist-chart-container {
  min-height: 360px;
  padding: 4px 2px 0;
}
#sub-history .hist-chart-left,
#sub-history .hist-chart-right {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
#sub-history .hist-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.8rem;
}

#sub-history .hist-table-panel { margin-top: 12px; }
#sub-history .hist-table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
#sub-history .hist-table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
#sub-history .hist-table-wrap {
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
  border-radius: 4px;
}
#sub-history .hist-data-table {
  width: 100%;
  font-variant-numeric: tabular-nums;
}
#sub-history .hist-data-table td {
  padding: 6px 10px;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(48,54,61,0.25);
}
#sub-history .hist-data-table th {
  font-size: 0.68rem;
  padding: 8px 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}
#sub-history .hist-data-table tbody tr:hover {
  background: rgba(88, 166, 255, 0.03);
}
#sub-history .hist-table-empty {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  padding: 24px;
}
.hist-reprice-btn {
  padding: 2px 10px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hist-reprice-btn:hover { background: rgba(88,166,255,0.2); border-color: rgba(88,166,255,0.4); }
.hist-reprice-btn:disabled { opacity: 0.25; cursor: default; }

#sub-history .hist-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(48,54,61,0.3);
}
#sub-history .hist-page-info {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.hist-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.hist-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hist-back-btn:hover {
  background: rgba(99,179,237,0.08);
  border-color: var(--accent);
}
.hist-breadcrumb-sep {
  color: var(--text-muted);
}
.hist-breadcrumb-contract {
  color: var(--text-main);
  font-weight: 600;
}

#sub-history .hist-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-dim);
  text-align: center;
}
#sub-history .hist-empty-text {
  font-size: 0.8rem;
  max-width: 500px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

#sub-history .stat-pos { color: var(--positive); }
#sub-history .stat-neg { color: var(--red); }

.hist-type-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 7px;
  border: 1px solid;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.hist-call { color: #3fb950; font-weight: 600; }
.hist-put { color: #f85149; font-weight: 600; }

.hist-time { color: var(--text-muted); font-size: 0.7rem; }

.hist-dropdown-region {
  padding: 8px 12px 4px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-top: 1px solid var(--border);
}
.hist-dropdown-region:first-child { border-top: none; }

.hist-quickpicks { width: 100%; max-width: 800px; }
.hist-qp-title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.hist-qp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.hist-qp-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.hist-qp-btn:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.hist-qp-name {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}
.hist-qp-meta {
  font-size: 0.63rem;
  color: var(--text-dim);
}

@media (max-width: 900px) {
  #sub-history .hist-charts-row { grid-template-columns: 1fr; }
  #sub-history .hist-filter-bar { flex-direction: column; align-items: stretch; }
  #sub-history .hist-filter-contract { max-width: none; }
  #sub-history .hist-filter-actions { justify-content: flex-end; }
  .hist-qp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

.vol-display-toggle {
  display: inline-flex;
  gap: 2px;
  margin-right: 12px;
}

.vol-mode-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.vol-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 4px 0;
}

.vol-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.vol-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.vol-dot-T { background: #00CC66; }
.vol-dot-S { background: #58A6FF; }
.vol-dot-F { background: #D29922; }
.vol-dot-SI { background: #9B7DDB; }
.vol-dot-I { background: #8B949E; }
.vol-dot-E { background: #6E7681; }
.vol-dot-X { background: #6E7681; }

.vol-confidence-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.vol-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.vol-conf-badge .conf-count {
  font-weight: 700;
  color: var(--text);
}

.vol-cell-T {
  background: rgba(0, 204, 102, 0.15);
  border-left: 3px solid #00CC66;
}

.vol-cell-S {
  background: rgba(88, 166, 255, 0.12);
  border-left: 3px solid #58A6FF;
}

.vol-cell-F {
  background: rgba(210, 153, 34, 0.10);
  border-left: 3px solid #D29922;
}

.vol-cell-SI {
  background: rgba(155, 125, 219, 0.08);
  border-left: 3px solid rgba(155, 125, 219, 0.6);
}

.vol-cell-I {
  background: rgba(139, 148, 158, 0.06);
  border-left: 3px solid rgba(139, 148, 158, 0.5);
}

.vol-cell-E {
  background: rgba(110, 118, 129, 0.04);
  border-left: 3px solid rgba(110, 118, 129, 0.35);
  color: rgba(201, 209, 217, 0.55);
}

.vol-cell-X {
  background: rgba(110, 118, 129, 0.03);
  border-left: 3px solid rgba(110, 118, 129, 0.25);
  color: rgba(201, 209, 217, 0.45);
}

.vol-liquidity-zone {
  box-shadow: inset 0 0 0 1px rgba(0, 204, 102, 0.18);
}
.vol-model-zone {
  opacity: 0.55;
  background-image: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 6px,
    rgba(110, 118, 129, 0.07) 6px,
    rgba(110, 118, 129, 0.07) 7px
  );
}
.vol-model-zone:hover {
  opacity: 0.85;
}
.vol-liquidity-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 8px;
  margin-bottom: 4px;
}
.vol-liquidity-legend .liq-swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 3px;
}
.vol-liquidity-legend .liq-swatch-traded {
  background: rgba(0, 204, 102, 0.25);
  border-left: 2px solid #00CC66;
}
.vol-liquidity-legend .liq-swatch-fitted {
  background: rgba(210, 153, 34, 0.18);
  border-left: 2px solid #D29922;
}
.vol-liquidity-legend .liq-swatch-model {
  background: rgba(110, 118, 129, 0.08);
  border-left: 2px solid rgba(110, 118, 129, 0.5);
  opacity: 0.55;
}

.vol-arb-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin-bottom: 4px;
}
.vol-arb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  user-select: none;
}
.vol-arb-badge.arb-clean {
  color: var(--positive);
  background: rgba(63, 185, 80, 0.08);
  border: 1px solid rgba(63, 185, 80, 0.25);
  cursor: default;
}
.vol-arb-badge.arb-warn {
  color: var(--amber);
  background: rgba(255, 170, 0, 0.10);
  border: 1px solid rgba(255, 170, 0, 0.35);
}
.vol-arb-badge.arb-warn:hover {
  background: rgba(255, 170, 0, 0.18);
}
.vol-arb-badge.arb-severe {
  color: var(--red);
  background: rgba(255, 68, 68, 0.10);
  border: 1px solid rgba(255, 68, 68, 0.35);
}
.vol-arb-badge.arb-severe:hover {
  background: rgba(255, 68, 68, 0.18);
}
.vol-arb-badge.arb-filter-on {
  box-shadow: 0 0 0 2px rgba(255, 170, 0, 0.5);
}
.vol-arb-cal {
  border-right: 3px solid var(--amber) !important;
}
.vol-arb-bfly {
  border-right: 3px solid #e040fb !important;
}
.vol-arb-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
}
.arb-corner-cal {
  border-width: 0 8px 8px 0;
  border-color: transparent var(--amber) transparent transparent;
}
.arb-corner-bfly {
  border-width: 0 8px 8px 0;
  border-color: transparent #e040fb transparent transparent;
}
.vol-arb-bfly-dual {
  border-right: 3px solid #e040fb !important;
  border-left: 3px solid var(--amber) !important;
}
.arb-corner-left {
  left: 0;
  right: auto;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent transparent #e040fb;
}
.vol-arb-hidden {
  opacity: 0.15 !important;
}

.vol-axis-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-left: 8px;
}
.vol-axis-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.vol-dynamics-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-left: 6px;
}
.vol-dyn-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.vol-fwd-shift {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}
.vol-fwd-shift[hidden] {
  display: none !important;
}
.fwd-shift-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.fwd-shift-input {
  width: 52px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 4px;
  text-align: center;
}
.fwd-shift-go {
  font-size: 10px !important;
  padding: 3px 8px !important;
}
.vol-fwd-shift-results {
  padding: 6px 10px;
  margin-bottom: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-x: auto;
}
.fwd-shift-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
}
.fwd-shift-table th {
  color: var(--text-secondary);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.fwd-shift-table th:first-child {
  text-align: left;
}
.fwd-shift-table td {
  padding: 3px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(48,54,61,0.4);
}
.fwd-shift-table td:first-child {
  text-align: left;
  color: var(--text-secondary);
}
.fwd-shift-up {
  color: var(--positive);
}
.fwd-shift-down {
  color: var(--red);
}
.fwd-shift-close-btn {
  float: right;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}
.delta-surface-table .vol-cell-strike {
  font-size: 8px;
  color: var(--text-secondary);
  opacity: 0.7;
  margin-top: 1px;
}
.delta-dynamics-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 2px 8px;
  margin-bottom: 6px;
}
.vol-cell-greek-sub {
  font-size: 8px;
  color: var(--text-secondary);
  opacity: 0.8;
  margin-top: 1px;
}
.vol-cell-greek-adj {
  font-size: 8px;
  color: var(--yellow, #d29922);
  margin-top: 1px;
}
.delta-surface-table .delta-col-header {
  font-family: var(--font-mono);
  font-size: 10px;
  min-width: 70px;
  text-align: center;
  color: var(--text-secondary);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vol-strip-row {
  border-top: 2px solid rgba(0, 255, 136, 0.3);
}
.vol-strip-row td {
  background: rgba(0, 255, 136, 0.04) !important;
}
.vol-strip-row .vol-tenor-info {
  background: rgba(0, 255, 136, 0.08);
}
.vol-strip-row .vol-tenor-label {
  color: var(--accent);
  font-style: italic;
  letter-spacing: 0.5px;
}

.vol-tenor-info {
  font-weight: 700;
  color: var(--text);
  padding: 4px 8px;
  text-align: left;
  background: rgba(22, 27, 34, 0.6);
  border-right: 1px solid var(--border);
  min-width: 180px;
  white-space: nowrap;
  vertical-align: top;
}

.vol-tenor-label {
  font-size: 12px;
  color: var(--text);
  font-weight: 700;
}

.vol-tenor-detail {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.3;
}

.vol-tenor-fwd-src {
  font-size: 8px;
  color: var(--text-dim);
  opacity: 0.7;
}

.vol-td-iv .vol-tag-letter {
  display: block;
  font-size: 8px;
  color: var(--text-dim);
  opacity: 0.6;
  line-height: 1;
  margin-top: 1px;
}

.vol-td-iv {
  min-width: 55px;
  max-width: 65px;
  width: 60px;
}

.vol-tooltip-cell {
  position: relative;
  cursor: default;
  --vol-tooltip-shift: 0px;
  --vol-tooltip-arrow-shift: 0px;
}
.vs-clickable {
  cursor: pointer;
}
.vs-clickable:hover {
  outline: 1px solid rgba(88,166,255,0.5);
  outline-offset: -1px;
}
.vs-clickable-hint {
  display: block;
  color: #58a6ff;
  font-weight: 700;
  margin-bottom: 2px;
}

.vol-tooltip-cell:hover .vol-tooltip,
.vol-tooltip-cell.is-tooltip-open .vol-tooltip {
  display: block;
}

.vol-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(calc(-50% + var(--vol-tooltip-shift)));
  background: rgba(13, 17, 23, 0.96);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: normal;
  width: max-content;
  max-width: min(280px, calc(100vw - 32px));
  z-index: 100;
  pointer-events: none;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.vol-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: calc(50% + var(--vol-tooltip-arrow-shift));
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
}

.vol-tooltip-cell.vol-tooltip-flip .vol-tooltip {
  top: 100%;
  bottom: auto;
}

.vol-tooltip-cell.vol-tooltip-flip .vol-tooltip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--border);
}

.vol-strike-th {
  overflow: visible;
}

.vol-compare-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid rgba(255, 171, 64, 0.35);
  border-radius: 999px;
  background: rgba(255, 171, 64, 0.08);
  color: #ffab40;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.vol-compare-badge[hidden] {
  display: none !important;
}

/* ===== SOURCE ATTRIBUTION BADGE ===== */
.source-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.source-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  margin-right: 4px;
  vertical-align: middle;
}

/* ===== CURVES TAB ===== */

.curve-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.curve-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.curve-toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.curve-view-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px;
}

.curve-view-btn {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

.curve-history-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.curve-hist-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.curve-hist-check {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
}

.curve-hist-check input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.curve-chart-container {
  min-height: 380px;
  width: 100%;
}

.curve-product-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px;
}

.curve-product-btn {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

/* ===== CAP vs SWAP DECOMPOSITION ===== */

.decomp-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.decomp-view-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px;
}

.decomp-view-btn {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

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

.decomp-table th {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  text-align: center;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.decomp-table td {
  text-align: center;
  padding: 5px 8px;
  min-width: 100px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border: 1px solid rgba(255,255,255,0.03);
}

.decomp-tenor {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  background: rgba(255,255,255,0.02);
}

.decomp-swap {
  font-size: 0.74rem;
  color: var(--text);
  font-weight: 600;
}

.decomp-cap {
  font-size: 0.66rem;
  margin-top: 2px;
}

.decomp-cap-bar {
  height: 3px;
  border-radius: 2px;
  margin-top: 3px;
  background: rgba(255,170,0,0.15);
}

.decomp-cap-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: #ffaa00;
}

.decomp-na {
  color: var(--text-dim);
}

/* ===== HEATMAP ===== */

.heatmap-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.heatmap-mode-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px;
}

.heatmap-mode-btn {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.heatmap-container {
  overflow-x: auto;
}

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

.heatmap-table th {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  text-align: center;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.heatmap-tenor {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  padding: 4px 8px !important;
  background: rgba(255,255,255,0.02);
}

.heatmap-cell {
  text-align: center;
  padding: 4px 6px !important;
  min-width: 90px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  transition: background 0.2s;
  border: 1px solid rgba(255,255,255,0.03);
}

.heatmap-price {
  font-size: 0.72rem;
  color: var(--text);
}

.heatmap-change {
  font-size: 0.68rem;
  font-weight: 600;
}

.heatmap-vol {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 1px;
}

.heatmap-na {
  color: var(--text-dim);
}

.heatmap-neutral {
  background: rgba(255,255,255,0.02);
}
.heatmap-neutral .heatmap-change { color: var(--text-muted); }

.heatmap-up-mild {
  background: rgba(0,255,136,0.06);
}
.heatmap-up-mild .heatmap-change { color: var(--positive); }

.heatmap-up {
  background: rgba(0,255,136,0.12);
}
.heatmap-up .heatmap-change { color: var(--positive); }

.heatmap-up-strong {
  background: rgba(0,255,136,0.22);
}
.heatmap-up-strong .heatmap-change { color: var(--positive); font-weight: 700; }

.heatmap-down-mild {
  background: rgba(255,68,68,0.06);
}
.heatmap-down-mild .heatmap-change { color: var(--red); }

.heatmap-down {
  background: rgba(255,68,68,0.12);
}
.heatmap-down .heatmap-change { color: var(--red); }

.heatmap-down-strong {
  background: rgba(255,68,68,0.22);
}
.heatmap-down-strong .heatmap-change { color: #ff4444; font-weight: 700; }

/* ===== BASIS TRACKER ===== */

.basis-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.basis-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.basis-window-btns {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px;
}

.basis-window-btn {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.basis-chart-container {
  min-height: 280px;
  width: 100%;
}

/* ===== VOLUME / OI TABLE ===== */

.volume-oi-container {
  overflow-x: auto;
}

.vol-oi-table th {
  font-size: 0.7rem;
  padding: 4px 6px;
  text-align: center;
}

.vol-oi-table td {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-align: center;
  padding: 3px 5px;
}

.liq-high {
  background: rgba(63,185,80,0.1);
  color: var(--positive);
  font-weight: 600;
}

.liq-med {
  background: rgba(255,170,0,0.08);
  color: var(--amber);
}

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

/* ===== CONTACT DESK FAB ===== */

.contact-desk-fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00cc66, #009944);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,204,102,0.3);
  transition: all 0.2s;
}

.contact-desk-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,204,102,0.4);
}

.fab-icon {
  font-size: 22px;
  line-height: 1;
}

.fab-panel {
  display: none;
  position: absolute;
  bottom: 56px;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  width: min(340px, 92vw);
  max-height: min(80vh, 520px);
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.fab-open .fab-panel {
  display: block;
}

.fab-panel-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.fab-link {
  display: block;
  padding: 6px 0;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
}

.fab-link:hover {
  text-decoration: underline;
}

.fab-disclaimer {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.fab-panel-intro {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 10px 0;
}
.fab-field-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 6px 0 4px;
  font-family: var(--font-mono);
}
.fab-select,
.fab-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-sans, system-ui);
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input, var(--bg-card));
  color: var(--text);
  padding: 6px 8px;
}
.fab-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.35;
}
.fab-feedback-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.fab-charcount {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.fab-send-btn {
  font-size: 0.75rem;
  padding: 4px 12px;
}
.fab-feedback-status {
  font-size: 0.7rem;
  min-height: 1.2em;
  margin-top: 8px;
  font-family: var(--font-mono);
}
.fab-feedback-status--ok {
  color: var(--state-good, #3fb950);
}
.fab-feedback-status--err {
  color: #f85149;
}
.fab-fallback-mailto {
  color: var(--accent);
  text-decoration: underline;
}
.fab-divider {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin: 12px 0 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-family: var(--font-mono);
}

/* ===== Transient toasts (spot sync, etc.) ===== */
.aem-floating-toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  right: max(12px, env(safe-area-inset-right, 0px) + 12px);
  left: auto;
  width: max-content;
  max-width: min(420px, 90vw);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--bg-elevated, var(--bg-card));
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}
.aem-floating-toast--show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.aem-floating-toast--warn {
  border-color: rgba(245, 158, 11, 0.55);
  color: var(--text);
}
.aem-floating-toast--ok {
  border-color: rgba(46, 204, 113, 0.45);
}

/* ===== GRID ROW ===== */

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

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

.broker-container {
  padding: 0 8px;
}

.broker-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--text);
}

.broker-subtitle {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 4px 0 12px;
}

.broker-hint {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin: 0 0 12px;
}

.broker-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.broker-nav-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 6px 6px 0 0;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
}

.broker-nav-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.broker-nav-btn.active {
  color: var(--accent);
  border-color: var(--border);
  border-bottom-color: var(--bg);
  background: var(--panel-bg);
}

.broker-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .broker-grid-2 {
    grid-template-columns: 1fr;
  }
}

.broker-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.broker-panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text);
}

.broker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.broker-table.compact {
  font-size: 0.78rem;
}

.broker-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.broker-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text);
}

.broker-table td.mono,
.mono {
  font-family: var(--font-mono);
}

.val-up { color: var(--positive); }
.val-down { color: #ff4444; }

.broker-contract {
  color: var(--accent);
  font-weight: 600;
}

.broker-activity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
}

.broker-act-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.02);
}

.broker-act-row:hover {
  background: rgba(255,255,255,0.05);
}

.act-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  min-width: 32px;
  text-align: center;
}

.act-fut {
  background: rgba(0,136,255,0.15);
  color: #4da6ff;
}

.act-opt {
  background: rgba(255,180,0,0.15);
  color: #ffb400;
}

.act-contract {
  color: var(--text);
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-detail {
  color: var(--accent);
  font-weight: 600;
}

.act-vol {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.act-iv {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.act-time {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.broker-settle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.broker-settle-region {
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  padding: 10px;
}

.broker-settle-region-name {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.spread-idea-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}

.spread-idea-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.spread-type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spread-cal {
  background: rgba(0,136,255,0.12);
  color: #4da6ff;
}

.spread-loc {
  background: rgba(180,80,255,0.12);
  color: #c080ff;
}

.spread-region {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.spread-idea-desc {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.spread-idea-legs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.spread-vs {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.spread-idea-signal {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.spread-signal-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.pin-risk-container {
  padding: 0 8px;
}

.pin-risk-header h2,
.pin-risk-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.pin-risk-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pin-risk-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pin-stat {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.pin-stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}

.pin-stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pin-risk-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pin-risk-filters label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.pin-risk-filters select {
  background: rgba(22, 27, 34, 0.8);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.pin-risk-filters select:focus {
  border-color: var(--accent);
}

.pin-risk-filters select option {
  background: #161b22;
  color: var(--text);
}

.pin-risk-filters #pin-risk-contract {
  min-width: 14rem;
  max-width: min(32rem, 100%);
}

.btn-refresh-pin {
  background: var(--cta);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-refresh-pin:hover {
  opacity: 0.85;
}

.risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.risk-high {
  background: rgba(255, 60, 60, 0.15);
  color: #ff4444;
  border: 1px solid rgba(255, 60, 60, 0.3);
}

.risk-medium {
  background: rgba(255, 180, 0, 0.15);
  color: #ffb400;
  border: 1px solid rgba(255, 180, 0, 0.3);
}

.risk-low {
  background: rgba(63, 185, 80, 0.12);
  color: var(--positive);
  border: 1px solid rgba(63, 185, 80, 0.2);
}

.pin-risk-body {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: stretch;
}
.pin-risk-body > .pin-risk-suggestions-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pin-risk-body > .pin-risk-suggestions-section > .pin-risk-suggestions {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .pin-risk-body {
    grid-template-columns: 1fr;
  }
}

.pin-risk-chart-section,
.pin-risk-suggestions-section,
.pin-risk-detail-section {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.pin-risk-chart-section h3,
.pin-risk-suggestions-section h3,
.pin-risk-detail-section h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text);
}

.pin-region-block {
  margin-bottom: 18px;
}

.pin-region-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pin-region-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

.pin-hhi {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.pin-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pin-bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 120px 70px;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.pin-bar-label {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: right;
}

.pin-bar-track {
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  height: 18px;
  overflow: hidden;
}

.pin-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(0,255,136,0.35), rgba(0,255,136,0.55));
  transition: width 0.4s ease;
  min-width: 2px;
}

.pin-bar.hot {
  background: linear-gradient(90deg, rgba(255,80,80,0.4), rgba(255,60,60,0.7));
}

.pin-bar-val {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.pin-bar-pc {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.pin-hotspots {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pin-hotspot-tag {
  background: rgba(255, 60, 60, 0.1);
  color: #ff6666;
  border: 1px solid rgba(255, 60, 60, 0.25);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.pin-suggestion {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.pin-suggestion.sug-high {
  border-left: 3px solid #ff4444;
}

.pin-suggestion.sug-medium {
  border-left: 3px solid #ffb400;
}

.sug-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sug-num {
  font-weight: 700;
  color: var(--text);
  font-size: 0.85rem;
}

.sug-structure-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(63,185,80,0.12);
  color: var(--positive);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.sug-reason-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(255,180,0,0.12);
  color: #ffb400;
}

.sug-priority {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: auto;
}

.sug-contract-line {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.sug-legs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 6px;
  border-left: 2px solid var(--accent);
}

.sug-leg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.leg-side {
  font-weight: 700;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 3px;
  min-width: 36px;
  text-align: center;
}

.leg-buy .leg-side {
  background: rgba(0,200,130,0.12);
  color: #00c882;
}

.leg-sell .leg-side {
  background: rgba(255,80,80,0.12);
  color: #ff5050;
}

.leg-strike {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 600;
}

.leg-prem {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.sug-net-prem {
  color: var(--positive);
  font-weight: 600;
}

.sug-trade {
  margin-bottom: 4px;
}

.sug-contract {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.sug-strike {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
}

.sug-reason-text {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.sug-meta {
  display: flex;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.iv-source-tag {
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 3px;
}

.iv-src-surface {
  color: var(--positive);
}

.iv-src-trade {
  color: var(--amber, #f59e0b);
}

.iv-src-mixed {
  color: var(--blue, #3b82f6);
}

.leg-iv {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  margin-left: 6px;
}

.sug-impact {
  font-size: 0.78rem;
  color: var(--positive);
  margin-bottom: 8px;
}

.sug-price-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sug-price-btn:hover {
  background: var(--accent);
  color: #000;
}

.pin-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.pin-detail-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pin-detail-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text);
}

.pin-hot-row td {
  background: rgba(255, 60, 60, 0.06);
}

.pin-pct-bar {
  position: relative;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  height: 18px;
  min-width: 80px;
}

.pin-pct-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 3px;
  background: rgba(0,255,136,0.3);
}

.pin-pct-bar span {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  color: var(--text);
  padding: 0 6px;
  line-height: 18px;
  font-family: var(--font-mono);
}

.pin-loading {
  text-align: center;
  color: var(--text-dim);
  padding: 40px;
  font-size: 0.9rem;
}

.pin-error {
  text-align: center;
  color: #ff4444;
  padding: 40px;
}

.pin-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 30px;
  font-size: 0.85rem;
}

.btn-small {
  padding: 4px 12px;
  font-size: 11px;
  background: rgba(0,200,120,0.15);
  color: #00cc66;
  border: 1px solid rgba(0,200,120,0.3);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.btn-small:hover { background: rgba(0,200,120,0.25); }
.btn-small:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
  padding: 4px 10px;
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s;
}
.btn-outline {
  background: transparent;
  color: #8090b0;
  border: 1px solid rgba(128,144,176,0.3);
}
.btn-outline:hover {
  background: rgba(128,144,176,0.12);
  border-color: rgba(128,144,176,0.5);
  color: #a0b0d0;
}
.btn-outline:disabled { opacity: 0.5; cursor: not-allowed; }

.eod-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
  gap: 12px;
}
.eod-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.eod-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #e8eaf0;
  letter-spacing: 0.3px;
}
.eod-header-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}
.eod-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(0,200,120,0.12);
  color: #00c878;
  font-family: var(--font-mono);
  font-weight: 600;
}
.eod-badge-muted {
  background: rgba(255,255,255,0.05);
  color: #8892b0;
  font-weight: 400;
}
.eod-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.eod-export-group.eod-export-group--tier-hint {
  flex-wrap: wrap;
}
.eod-exports-tier-hint {
  flex: 1 1 100%;
  margin-top: 4px;
  margin-left: 0;
  align-self: stretch;
  font-size: 11px;
  line-height: 1.35;
  color: var(--amber);
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 180, 80, 0.06);
  border: 1px solid rgba(255, 180, 80, 0.15);
  max-width: none;
}
.eod-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #c0c8d8;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  min-width: 140px;
}
.eod-input:focus {
  outline: none;
  border-color: rgba(0,200,120,0.4);
}
.eod-product-toggle {
  display: flex;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.eod-product-btn {
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
}
.eod-compare-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #8892b0;
  font-size: 12px;
  cursor: pointer;
}
.eod-compare-label input[type="checkbox"] {
  accent-color: #00c878;
}
.eod-rebuild-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
}
.eod-rebuild-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.eod-overview-chart-container {
  padding: 8px 16px;
  min-height: 420px;
}

.eod-marks-table-container {
  padding: 0 20px 16px;
  overflow-x: auto;
}
.eod-marks-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
  font-family: var(--font-mono);
}
.eod-marks-tbl th {
  text-align: right;
  padding: 8px 12px;
  background: rgba(10,14,24,0.95);
  color: #778899;
  font-weight: 600;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid rgba(41,128,185,0.3);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(8px);
}
.eod-marks-tbl th:first-child { text-align: left; border-radius: 4px 0 0 0; }
.eod-marks-tbl th:last-child { border-radius: 0 4px 0 0; }
.eod-marks-tbl td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  white-space: nowrap;
  color: #b0b8c8;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: background 0.1s;
}
.eod-marks-tbl td:first-child {
  text-align: left;
  font-weight: 600;
  color: #e0e8f0;
}
.eod-marks-tbl tr:hover td {
  background: rgba(41,128,185,0.06);
}
.eod-marks-tbl .state-section td {
  background: linear-gradient(90deg, rgba(41,128,185,0.1), rgba(41,128,185,0.03));
  color: #a0aec0;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(41,128,185,0.15);
  border-top: 1px solid rgba(255,255,255,0.04);
  text-align: left;
}
.eod-marks-tbl .stale-row td {
  opacity: 0.55;
}
.eod-marks-tbl .interpolated-row td {
  background: rgba(0,188,212,0.06);
  border-left: 2px solid rgba(0,188,212,0.3);
}
.eod-marks-tbl .decayed-row td {
  background: rgba(255,152,0,0.06);
  border-left: 2px solid rgba(255,152,0,0.3);
}
.eod-marks-tbl .nomark-row td {
  opacity: 0.3;
}
.eod-marks-tbl .eod-strip-row td {
  background: rgba(20, 26, 40, 0.5);
  border-left: 3px solid rgba(136, 146, 176, 0.25);
}
.eod-marks-tbl .eod-chg-up { color: var(--positive) !important; font-weight: 600; }
.eod-marks-tbl .eod-chg-down { color: #ff4444 !important; font-weight: 600; }
.eod-marks-tbl .eod-chg-flat { color: #8892b0; }
.eod-chg-cell { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }

/* Live Curve — shared day-change tint used by the in-app tab
   and reused by the pop-out window. Kept in the same tint family as
   EOD so brokers flipping between tabs don't get a colour whiplash. */
.eod-marks-tbl .dc-up,
td.dc-up { color: var(--positive) !important; font-weight: 600; }
.eod-marks-tbl .dc-down,
td.dc-down { color: #ff4444 !important; font-weight: 600; }

/* -------------------------------------------------------------------
   Live Curve pivot (exchange-style transposed) — contract rows × region cols
   (Base / Cap / Peak + AM/PM in stacked bands when product = All).
   Sticky left contract column; sticky region header; vertical scroll
   for tenors — avoids wide horizontal scroll.
   ------------------------------------------------------------------- */
.live-pivot-container { padding: 0 20px 8px; }
.live-pivot-scroll {
  overflow: auto;
  max-height: 58vh;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  background: rgba(10,14,24,0.55);
}
.live-pivot-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
  font-family: var(--font-mono);
  min-width: 0;
}
/* Transposed: ~5 state columns + contract — no forced min width */
.live-pivot-tbl-transposed { min-width: 0; max-width: 100%; }
.live-pivot-tbl thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(10,14,24,0.97);
  color: #a0aec0;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 10px;
  text-align: center;
  border-bottom: 2px solid rgba(41,128,185,0.35);
  white-space: nowrap;
}
.live-pivot-tbl thead th.live-pivot-strip {
  color: #c0d0e8;
  background: linear-gradient(180deg, rgba(41,128,185,0.14), rgba(10,14,24,0.97));
}
.live-pivot-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: rgba(14,18,28,0.98) !important;
  text-align: left !important;
  min-width: 140px;
  border-right: 2px solid rgba(255,255,255,0.08);
}
.live-pivot-tbl thead .live-pivot-sticky-col { z-index: 4; }
.live-pivot-rowhead {
  font-weight: 600;
  color: #d8e0ec;
  padding: 6px 12px;
  white-space: nowrap;
}
.live-pivot-prod {
  color: #8892b0;
  font-weight: 500;
  margin-left: 6px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.live-pivot-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.live-pivot-dot-sm {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.live-pivot-tbl tbody td {
  padding: 4px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  color: #c0c8d5;
  font-variant-numeric: tabular-nums;
  transition: background 0.1s;
  min-width: 72px;
}
.live-pivot-tbl tbody tr:hover td { background: rgba(41,128,185,0.06); }
.live-pivot-tbl tbody tr:hover .live-pivot-sticky-col { background: rgba(18,24,38,0.98) !important; }
.live-pivot-cell .live-pivot-mark {
  font-weight: 700;
  font-size: 12px;
  color: #f0f4fa;
  line-height: 1.15;
}
.live-pivot-cell .live-pivot-delta {
  font-size: 9.5px;
  color: inherit;
  line-height: 1.1;
  opacity: 0.85;
}
.live-pivot-empty {
  color: #4a5060;
  opacity: 0.5;
}
.live-pivot-year-break {
  border-left: 2px solid rgba(41,128,185,0.22);
}
.live-pivot-flag {
  display: inline-block;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
.live-pivot-flag-strip {
  background: rgba(136, 146, 176, 0.22);
  color: #b6c2d8;
  border: 1px solid rgba(136, 146, 176, 0.35);
}
.live-pivot-flag-drift {
  background: rgba(255, 152, 0, 0.18);
  color: #ffb770;
  border: 1px solid rgba(255, 152, 0, 0.35);
}
.live-pivot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 6px 4px;
  font-size: 10px;
  color: #8892b0;
  font-family: var(--font-mono);
}
.live-pivot-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* Transposed market layout: product band, contract column, year row breaks */
.live-pivot-tbl .live-pivot-colhead {
  text-align: center;
  white-space: nowrap;
  padding: 8px 6px;
}
.live-pivot-tbl tbody th.live-pivot-contract {
  text-align: right;
  min-width: 78px;
  max-width: 110px;
  font-weight: 600;
  color: #b8c4d4;
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: 0.2px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-right: 2px solid rgba(255,255,255,0.08);
}
.live-pivot-tbl tbody th.live-pivot-contract-strip {
  color: #c0d0e8;
  background: linear-gradient(90deg, rgba(41,128,185,0.1), rgba(14,18,28,0.98) 32%) !important;
}
.live-pivot-tbl tbody tr.live-pivot-year-break-row td,
.live-pivot-tbl tbody tr.live-pivot-year-break-row th {
  border-top: 2px solid rgba(41,128,185,0.3);
}
.live-pivot-tbl tbody tr.live-pivot-band th.live-pivot-band-hdr {
  text-align: left;
  background: linear-gradient(90deg, rgba(41,128,185,0.2), rgba(10,14,24,0.5));
  color: #e8eef8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(41,128,185,0.45);
  border-top: 1px solid rgba(41,128,185,0.2);
  position: relative;
  z-index: 1;
}
.page-live-curve-popout { margin: 0; padding: 0; min-height: 100vh; }
.page-live-curve-popout .live-popout-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  min-height: 44px;
}
.page-live-curve-popout .live-popout-back {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.page-live-curve-popout .live-popout-back:hover {
  text-decoration: underline;
  color: var(--cta);
}
.page-live-curve-popout .live-popout-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
#panel-live-curve-popout.panel { margin: 0; border: none; box-shadow: none; }
#panel-live-curve-popout .eod-header { padding-top: 10px; }
#panel-live-curve-popout .live-pivot-container {
  min-width: min(100%, 640px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.live-details-drilldown summary:hover {
  background: #222 !important;
}
.eod-chg-bar-wrap { display: inline-block; width: 44px; height: 10px; vertical-align: middle; position: relative; border-radius: 2px; background: rgba(255,255,255,0.02); }
.eod-chg-bar { position: absolute; top: 1px; height: 8px; border-radius: 2px; }
.eod-chg-bar.bar-up { background: rgba(0,255,136,0.45); left: 50%; }
.eod-chg-bar.bar-down { background: rgba(255,68,68,0.45); right: 50%; }
.eod-chg-bar-wrap::after { content: ''; position: absolute; left: 50%; top: 0; width: 1px; height: 10px; background: rgba(255,255,255,0.08); }

.eod-state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 20px;
  padding: 20px 24px;
}

.eod-state-card {
  background: linear-gradient(145deg, rgba(12,17,30,0.95), rgba(18,25,42,0.9));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.eod-state-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}

.eod-state-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.015);
}
.eod-state-name {
  display: flex;
  align-items: center;
  gap: 10px;
}
.eod-state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.eod-state-label {
  font-size: 15px;
  font-weight: 700;
  color: #e8edf3;
  letter-spacing: 0.5px;
}
.eod-state-sublabel {
  font-size: 11px;
  color: #667;
  font-weight: 400;
  margin-left: 6px;
}
.eod-state-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.eod-stat-pill {
  font-size: 9.5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.eod-stat-pill.settled {
  background: rgba(0,200,120,0.12);
  color: #00c878;
  border: 1px solid rgba(0,200,120,0.15);
}
.eod-stat-pill.stale {
  background: rgba(255,170,0,0.1);
  color: #ffaa00;
  border: 1px solid rgba(255,170,0,0.15);
}
.eod-stat-pill.no-mark {
  background: rgba(128,128,128,0.08);
  color: #888;
  border: 1px solid rgba(128,128,128,0.12);
}
.eod-stat-pill.traded {
  background: rgba(51,136,255,0.1);
  color: #3388ff;
  border: 1px solid rgba(51,136,255,0.15);
}
.eod-stat-pill.interpolated {
  background: rgba(0,188,212,0.12);
  color: #00bcd4;
  border: 1px solid rgba(0,188,212,0.15);
}
.eod-stat-pill.decayed {
  background: rgba(255,152,0,0.12);
  color: #ff9800;
  border: 1px solid rgba(255,152,0,0.15);
}

.eod-state-chart {
  height: 220px;
  padding: 8px 12px 10px;
}

.eod-state-table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.eod-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
  font-family: var(--font-mono);
}
.eod-tbl th {
  text-align: left;
  padding: 8px 10px;
  background: rgba(10,14,24,0.95);
  color: #778899;
  font-weight: 600;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(41,128,185,0.25);
  position: sticky;
  top: 0;
  z-index: 2;
}
.eod-tbl td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  white-space: nowrap;
  color: #b0b8c8;
  transition: background 0.1s;
}
.eod-tbl tr:hover td {
  background: rgba(41,128,185,0.06);
}
.eod-tbl .eod-tenor {
  font-weight: 600;
  color: #e0e8f0;
}
.eod-tbl .eod-mark {
  font-weight: 700;
  color: #ffffff;
  font-size: 12px;
}
.eod-tbl .positive { color: #00cc66; font-weight: 600; }
.eod-tbl .negative { color: #ff4444; font-weight: 600; }
.eod-tbl .eod-stale td {
  background: rgba(255,170,0,0.04);
}
.eod-tbl .eod-interpolated td {
  background: rgba(0,188,212,0.06);
  border-left: 2px solid rgba(0,188,212,0.3);
}
.eod-tbl .eod-decayed td {
  background: rgba(255,152,0,0.06);
  border-left: 2px solid rgba(255,152,0,0.3);
}
.eod-tbl .eod-nomark td {
  color: #556;
}
.eod-tbl .eod-sv-flag {
  color: #ffaa00;
  font-weight: 600;
}

.eod-period-row td {
  background: linear-gradient(90deg, rgba(41,128,185,0.08), rgba(41,128,185,0.02)) !important;
  color: #a0aec0 !important;
  font-weight: 700;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 8px 10px !important;
  border-bottom: 1px solid rgba(41,128,185,0.12) !important;
  border-top: 1px solid rgba(255,255,255,0.04) !important;
}

.conf-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.4;
}
.conf-badge.conf-high { background: rgba(0,200,120,0.15); color: #00c878; border: 1px solid rgba(0,200,120,0.2); }
.conf-badge.conf-medium { background: rgba(255,170,0,0.12); color: #ffaa00; border: 1px solid rgba(255,170,0,0.18); }
.conf-badge.conf-low { background: rgba(255,136,68,0.12); color: #ff8844; border: 1px solid rgba(255,136,68,0.18); }
.conf-badge.conf-vlow { background: rgba(255,68,68,0.12); color: #ff4444; border: 1px solid rgba(255,68,68,0.18); }
.conf-badge.conf-none { background: rgba(128,128,128,0.08); color: #556; border: 1px solid rgba(128,128,128,0.12); }

.dir-conf-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  margin-left: 4px;
}
.dir-conf-delta {
  background: rgba(0,200,120,0.18);
  color: #00c878;
  border: 1px solid rgba(0,200,120,0.3);
}
.dir-conf-ambiguous {
  background: rgba(255,170,0,0.18);
  color: #ffaa00;
  border: 1px solid rgba(255,170,0,0.3);
}
.dir-conf-manual {
  background: rgba(96,165,250,0.18);
  color: #60a5fa;
  border: 1px solid rgba(96,165,250,0.3);
}
.sl-legs-table thead th:nth-child(2),
.sl-legs-table tbody td:nth-child(2) {
  width: 42px;
  min-width: 42px;
  text-align: center;
}
.sl-dir-clickable {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 4px;
  transition: background 0.15s;
}
.sl-dir-clickable:hover {
  background: rgba(255,255,255,0.08);
}
.sl-save-btn {
  background: var(--cta);
  color: #0d1117;
  border: none;
  border-radius: 4px;
  padding: 4px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
}
.sl-save-btn:hover { opacity: 0.85; }
.sl-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sl-reset-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.sl-reset-link:hover { color: var(--text); }
.sl-edited-indicator {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #60a5fa;
  margin-left: 6px;
}

.eod-meta-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 24px;
  font-size: 11px;
  color: #778899;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-wrap: wrap;
}
.eod-meta-bar .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.04);
}
.eod-meta-bar .meta-value {
  color: #c0c8d8;
  font-weight: 600;
  font-family: var(--font-mono);
}

.eod-playback-bar {
  padding: 12px 24px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.02);
}
.eod-playback-bar .playback-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.eod-playback-bar .playback-date-label {
  color: #ffaa00;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.eod-playback-bar .playback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.playback-scrubber {
  flex: 1;
  min-width: 120px;
  accent-color: #3388ff;
  cursor: pointer;
}
.eod-playback-toggle-row {
  border-top: 1px solid rgba(255,255,255,0.04);
}

.eod-state-card .eod-toggle-table {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  color: #778899;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-top: 1px solid rgba(255,255,255,0.04);
  transition: color 0.2s, background 0.2s;
  user-select: none;
}
.eod-state-card .eod-toggle-table:hover {
  color: #2980b9;
  background: rgba(41,128,185,0.06);
}

.ss-panel {
  background: rgba(10,14,25,0.95);
  border: 1px solid rgba(0,200,120,0.15);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.ss-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,200,120,0.04);
}
.ss-headline {
  font-size: 15px;
  font-weight: 700;
  color: #00c878;
  letter-spacing: 0.5px;
}
.ss-meta {
  display: flex;
  gap: 16px;
  align-items: center;
}
.ss-date {
  font-size: 12px;
  font-weight: 600;
  color: #c0c8d8;
  font-family: var(--font-mono);
}
.ss-ts {
  font-size: 11px;
  color: #667;
  font-family: var(--font-mono);
}
.ss-session-label {
  font-size: 12px;
  color: #c0c8d8;
}
.ss-session-label strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #e8ecf4;
}
.ss-fetched {
  font-size: 10px;
  color: #667;
  font-family: var(--font-mono);
}
.ss-stats-row {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ss-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-right: 1px solid rgba(255,255,255,0.04);
}
.ss-stat:last-child { border-right: none; }
.ss-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: #e8ecf4;
  font-family: var(--font-mono);
  line-height: 1.2;
}
.ss-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #667;
  margin-top: 3px;
}
.ss-stat-total {
  background: rgba(0,200,120,0.05);
}
.ss-stat-total .ss-stat-val {
  color: #00c878;
}
.ss-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 900px) { .ss-body-grid { grid-template-columns: 1fr; } }
.ss-section {
  padding: 14px 18px;
}
.ss-section + .ss-section {
  border-left: 1px solid rgba(255,255,255,0.06);
}
@media (max-width: 900px) {
  .ss-section + .ss-section {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.06);
  }
}
.ss-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #8890a0;
  margin-bottom: 10px;
}
.ss-movers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--font-mono);
}
.ss-movers-table th {
  text-align: left;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #556;
  padding: 0 6px 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
}
.ss-movers-table td {
  padding: 5px 6px 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: #c0c8d8;
}
.ss-movers-table tr:last-child td { border-bottom: none; }
.ss-contract { font-weight: 600; color: #e0e6f0; }
.ss-price { color: #e0e6f0; }
.ss-ref { color: #667; font-size: 11px; }
.ss-up { color: #00c878; font-weight: 600; }
.ss-down { color: #ff5555; font-weight: 600; }
.ss-struct-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ss-struct-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 0;
}
.ss-struct-count {
  background: rgba(0,200,120,0.12);
  color: #00c878;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  min-width: 28px;
  text-align: center;
}
.ss-struct-type {
  color: #c0c8d8;
  font-weight: 600;
}
.ss-struct-contracts {
  color: #667;
  font-size: 11px;
  font-family: var(--font-mono);
}
.ss-spread-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
@media (max-width: 700px) { .ss-spread-list { grid-template-columns: 1fr; } }
.ss-spread-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
}
.ss-spread-pos { border-left: 3px solid #00c878; }
.ss-spread-neg { border-left: 3px solid #ff5555; }
.ss-spread-label {
  color: #c0c8d8;
  font-weight: 600;
  white-space: nowrap;
}
.ss-spread-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #e0e6f0;
}
.ss-spread-tenors {
  color: #667;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: auto;
}

.pricer-source-badge {
  display: inline-block; font-size: 8px; font-weight: 700; padding: 1px 5px;
  border-radius: 3px; margin-left: 4px; vertical-align: middle; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.pricer-badge-traded {
  background: rgba(210,153,34,0.15); color: #d29922; border: 1px solid rgba(210,153,34,0.4);
}
.pricer-badge-surface {
  background: rgba(88,166,255,0.15); color: #58a6ff; border: 1px solid rgba(88,166,255,0.4);
}
.pricer-diff {
  display: inline-block; font-size: 10px; font-family: var(--font-mono);
  margin-left: 4px; vertical-align: middle; font-weight: 600;
}
.pricer-diff-up { color: #3fb950; }
.pricer-diff-down { color: #f85149; }
.pricer-reprice-container {
  display: inline-flex; min-width: 0;
}
.pricer-reprice-btn {
  background: rgba(88,166,255,0.15) !important; border: 1px solid rgba(88,166,255,0.5) !important;
  color: #58a6ff !important; font-weight: 600;
}
.pricer-reprice-btn:hover { background: rgba(88,166,255,0.25) !important; }
.pricer-revert-btn {
  background: rgba(210,153,34,0.15) !important; border: 1px solid rgba(210,153,34,0.5) !important;
  color: #d29922 !important; font-weight: 600;
}
.pricer-revert-btn:hover { background: rgba(210,153,34,0.25) !important; }
.pricer-diff { min-width: 42px; text-align: right; display: inline-block; }
.pricer-source-badge { min-width: 48px; text-align: center; display: inline-block; }

.ctx-freshness-bar {
  padding: 8px 16px; border-radius: 4px; margin-bottom: 12px;
  font-size: 12px; font-family: 'SF Mono', monospace; letter-spacing: 0.3px;
}
.ctx-fresh-green { background: rgba(0,200,83,0.12); color: #69f0ae; border-left: 3px solid #69f0ae; }
.ctx-fresh-yellow { background: rgba(255,183,77,0.12); color: #ffb74d; border-left: 3px solid #ffb74d; }
.ctx-fresh-red { background: rgba(229,115,115,0.12); color: #e57373; border-left: 3px solid #e57373; }

.ctx-range-bar {
  display: flex; gap: 4px; margin-bottom: 16px;
}
.ctx-range-btn {
  font-size: var(--text-sm); font-weight: 600; letter-spacing: 0.5px;
}

.ctx-section { margin-bottom: 8px; }
.ctx-chart-container { height: 340px; margin-bottom: 12px; }
.ctx-table { font-size: 12px; }
.ctx-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.ctx-up { color: #69f0ae; }
.ctx-down { color: #e57373; }
.ctx-na { color: #556; }

.ctx-pctile-badge {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
}
.ctx-pctile-high { background: rgba(229,115,115,0.15); color: #e57373; }
.ctx-pctile-mid { background: rgba(255,183,77,0.12); color: #ffb74d; }
.ctx-pctile-low { background: rgba(79,195,247,0.12); color: #4fc3f7; }
.ctx-pctile-vlow { background: rgba(129,199,132,0.12); color: #81c784; }

.ctx-oi-interp {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.ctx-interp-card {
  flex: 1 1 200px; padding: 10px 14px; border-radius: 4px;
  font-size: 12px; line-height: 1.5;
}
.ctx-interp-bull { background: rgba(0,200,83,0.08); border-left: 3px solid #69f0ae; color: #b0bec5; }
.ctx-interp-bear { background: rgba(229,115,115,0.08); border-left: 3px solid #e57373; color: #b0bec5; }
.ctx-interp-warn { background: rgba(255,183,77,0.08); border-left: 3px solid #ffb74d; color: #b0bec5; }
.ctx-interp-neutral { background: rgba(255,255,255,0.03); border-left: 3px solid rgba(255,255,255,0.1); color: #667; }
.ctx-interp-label {
  display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 2px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(255,255,255,0.06); color: #ccd6f6;
}

.ctx-flag-rapid {
  display: inline-block; padding: 1px 6px; border-radius: 2px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  background: rgba(255,183,77,0.15); color: #ffb74d; letter-spacing: 0.5px;
}

.ctx-key-movers-section { }
.ctx-key-movers {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ctx-mover-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 6px; font-size: 12px;
  line-height: 1.4; flex: 1 1 calc(50% - 4px); min-width: 280px;
}
.ctx-mover-icon { font-size: 14px; flex-shrink: 0; }
.ctx-mover-text { color: #b0bec5; }
.ctx-mover-bull { background: rgba(0,200,83,0.08); border-left: 3px solid #69f0ae; }
.ctx-mover-bull .ctx-mover-icon { color: #69f0ae; }
.ctx-mover-bear { background: rgba(229,115,115,0.08); border-left: 3px solid #e57373; }
.ctx-mover-bear .ctx-mover-icon { color: #e57373; }
.ctx-mover-vol-up { background: rgba(255,183,77,0.08); border-left: 3px solid #ffb74d; }
.ctx-mover-vol-up .ctx-mover-icon { color: #ffb74d; }
.ctx-mover-vol-down { background: rgba(79,195,247,0.08); border-left: 3px solid #4fc3f7; }
.ctx-mover-vol-down .ctx-mover-icon { color: #4fc3f7; }
.ctx-mover-neutral { background: rgba(255,255,255,0.03); border-left: 3px solid rgba(255,255,255,0.1); }
.ctx-mover-empty { color: #667; font-size: 12px; padding: 8px 0; }

.ctx-commentary-section { }
.ctx-commentary {
  list-style: none; padding: 0; margin: 0;
}
.ctx-commentary li {
  padding: 8px 12px; margin-bottom: 4px; font-size: 12px;
  border-left: 2px solid rgba(79,195,247,0.3); color: #b0bec5;
  background: rgba(255,255,255,0.02); line-height: 1.5;
}
.ctx-commentary li:nth-child(odd) { border-left-color: rgba(129,199,132,0.3); }

/* ─── Vol Surface Enhancements ─── */
.vs-hist-panel { padding-bottom: 8px; }
.vs-hist-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 8px;
}
.vs-hist-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.vs-hist-btn {
  font-size: var(--text-sm); font-family: inherit;
}
.vs-hist-date-wrap { display: flex; gap: 4px; align-items: center; }
.vs-hist-date-input {
  padding: 4px 8px; border: 1px solid rgba(255,255,255,0.15); border-radius: 4px;
  background: rgba(0,0,0,0.3); color: #c9d1d9; font-size: 11px; font-family: inherit;
}
.vs-hist-date-input::-webkit-calendar-picker-indicator { filter: invert(0.7); }
.vs-hist-playback { display: flex; gap: 4px; align-items: center; }
.vs-play-btn {
  width: 28px; height: 28px; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.vs-play-btn.playing { color: var(--accent); border-color: rgba(88,166,255,0.3); }
.vs-play-label { font-size: 11px; color: #8b949e; min-width: 80px; text-align: center; }
.vs-hist-actions { display: flex; gap: 4px; margin-left: auto; }
.vs-action-btn {
  font-size: var(--text-sm); font-family: inherit;
}
.vs-action-btn.active { background: rgba(33,150,243,0.15); color: #64b5f6; border-color: rgba(33,150,243,0.3); }
.vs-hist-status {
  font-size: 11px; color: #8b949e; padding: 4px 12px; min-height: 16px;
}
.vs-hist-status .vs-compare-label { color: #ffab40; font-weight: 600; }

/* Trade overlay badges on vol cells */
.vol-trade-badge {
  position: absolute; top: 1px; right: 1px; font-size: 8px; padding: 0 3px;
  background: rgba(63,185,80,0.2); color: var(--positive); border-radius: 2px;
  line-height: 12px; pointer-events: none;
}
.vol-td-iv { position: relative; }

/* Confidence score display mode */
.vol-conf-score {
  font-size: 10px; font-weight: 600;
}
.vol-conf-label {
  font-size: 11px;
  letter-spacing: 0.02em;
}
.vol-conf-high { color: var(--positive); }
.vol-conf-mid { color: #ffab40; }
.vol-conf-low { color: #ff5252; }

/* Freshness sub-indicator on traded cells */
.vol-freshness {
  position: absolute; bottom: 1px; left: 1px; width: 5px; height: 5px;
  border-radius: 50%; pointer-events: none;
}
.vol-fresh-live { background: var(--positive); box-shadow: 0 0 3px var(--positive); }
.vol-fresh-recent { background: #4caf50; }
.vol-fresh-aged { background: #8bc34a; opacity: 0.6; }

/* IV Range indicators */
.vol-range-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,0.05); overflow: hidden;
}
.vol-range-fill {
  height: 100%; background: rgba(33,150,243,0.5); transition: width 0.2s;
}
.vol-range-extreme { background: rgba(255,82,82,0.6); }

/* Surface Analytics */
.vs-analytics-wrap { overflow-x: auto; }
.vs-analytics-table {
  width: 100%; border-collapse: collapse; font-size: 11px;
}
.vs-analytics-table th {
  padding: 6px 10px; background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08); color: #8b949e;
  text-align: left; font-weight: 600; white-space: nowrap;
}
.vs-analytics-table td {
  padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); color: #c9d1d9;
}
.vs-analytics-table tr:hover td { background: rgba(255,255,255,0.03); }
.vs-skew-pos { color: #ff9800; }
.vs-skew-neg { color: #2196f3; }
.vs-wing-rich { color: #ff5252; }
.vs-wing-cheap { color: #4caf50; }

/* Fit quality */
.vs-fit-quality-wrap { margin-top: 8px; }
.vs-fit-table {
  width: 100%; border-collapse: collapse; font-size: 11px;
}
.vs-fit-table th {
  padding: 5px 8px; background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06); color: #8b949e;
  text-align: left; font-weight: 600;
}
.vs-fit-table td {
  padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,0.03); color: #c9d1d9;
}
.vs-fit-good { color: var(--positive); }
.vs-fit-warn { color: #ffab40; }
.vs-fit-poor { color: #ff5252; }

/* R1 F-5: surface quality / freshness strip in #vol-fit-quality */
.vs-quality-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 8px 10px; font-size: 11px; color: #8b949e;
  border: 1px solid rgba(255,255,255,0.06); border-radius: 6px;
  background: rgba(255,255,255,0.02);
}
.vs-quality-grade { font-weight: 700; }
.vs-quality-sendable { color: #22c55e; }
.vs-quality-blocked { color: #ffaa00; }
.vs-quality-reasons { color: #8b949e; font-style: italic; }
.vs-quality-degraded { color: #ffaa00; }

/* Snapshot management */
.vs-snapshot-controls {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 0;
}
.vs-snapshot-input {
  padding: 5px 10px; border: 1px solid rgba(255,255,255,0.12); border-radius: 4px;
  background: rgba(0,0,0,0.3); color: #c9d1d9; font-size: 11px; font-family: inherit;
  width: 200px;
}
.vs-snapshot-notes { width: 300px; }
.vs-snapshot-list { margin-top: 8px; }
.vs-snapshot-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 11px;
}
.vs-snapshot-item:hover { background: rgba(255,255,255,0.03); }
.vs-snap-label { color: #64b5f6; font-weight: 600; min-width: 140px; }
.vs-snap-date { color: #8b949e; min-width: 90px; }
.vs-snap-notes { color: #b0bec5; flex: 1; }
.vs-snap-action {
  padding: 3px 8px; border: 1px solid rgba(255,255,255,0.1); border-radius: 3px;
  background: rgba(255,255,255,0.04); color: #8b949e; cursor: pointer;
  font-size: 10px; font-family: inherit;
}
.vs-snap-action:hover { background: rgba(255,255,255,0.08); color: #c9d1d9; }

/* Volume / IV / spread heatmaps — match JS height */
.vol-volume-chart { min-height: 550px; }
#vol-heatmap-chart.vol-chart { min-height: 550px; }
#vol-spread-chart.vol-chart { min-height: 550px; }

/* ===== STRUCTURE MONITOR ===== */
.sm-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.sm-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.sm-select {
  padding: 5px 10px;
  background: var(--bg-primary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
}

.sm-select:focus { border-color: var(--accent); outline: none; }

.sm-input {
  padding: 5px 10px;
  min-width: 160px;
  flex: 1 1 220px;
  max-width: 420px;
  background: var(--bg-primary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

.sm-input:focus {
  border-color: var(--accent);
  outline: none;
}

.sm-input::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.sm-btn {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.sm-summary {
  display: flex;
  gap: 16px;
  align-items: center;
}

.sm-stat {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sm-pnl-pos { color: var(--positive) !important; }
.sm-pnl-neg { color: var(--red) !important; }

.sm-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.sm-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-secondary, var(--text-muted));
}

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

.sm-page-controls {
  display: flex;
  gap: 6px;
}

.sm-page-controls button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.sm-loading {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sm-table {
  width: 100%;
  font-size: 0.85rem;
  border-collapse: collapse;
}

.sm-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  z-index: 1;
  font-size: 0.8rem;
}

.sm-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(48,54,61,0.8);
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.6;
}

.sm-table tbody tr:hover { background: var(--bg-card-hover); }
.sm-table tbody tr:nth-child(4n+1):not(.sm-legs-row) { background: rgba(255,255,255,0.015); }
.sm-table tbody tr:nth-child(4n+1):not(.sm-legs-row):hover { background: var(--bg-card-hover); }

.sm-sortable { cursor: pointer; user-select: none; }
.sm-sortable:hover { color: var(--accent); }

.sm-date { font-family: var(--font-mono); }
.sm-date-main { display: block; font-size: 0.84rem; }
.sm-date-time { display: block; font-size: 0.74rem; color: var(--text-dim); margin-top: 2px; }

.sm-region-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(88,166,255,0.08);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,0.15);
}

.sm-contract { font-family: var(--font-mono); font-weight: 600; font-size: 0.88rem; }

.sm-type { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.sm-label-main { font-weight: 600; font-size: 0.84rem; }
.sm-label-delta { color: var(--amber); font-size: 0.76rem; }

.sm-strikes { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.82rem; }

.sm-conf {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.sm-conf-high { background: rgba(0,204,102,0.12); color: #00cc66; border: 1px solid rgba(0,204,102,0.2); }
.sm-conf-med { background: rgba(255,170,0,0.12); color: #ffaa00; border: 1px solid rgba(255,170,0,0.2); }
.sm-conf-low { background: rgba(255,68,68,0.12); color: #ff4444; border: 1px solid rgba(255,68,68,0.2); }

.sm-conf-capped { color: var(--amber); margin-left: 1px; }

.sm-tape-banner {
  margin: 8px 0 4px 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  line-height: 1.4;
  background: color-mix(in srgb, var(--warn, #c9a227) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn, #c9a227) 35%, var(--border));
  color: var(--text);
}

/* R1 F-6: EOD stale-build banner (same advisory styling as the structmon tape banner) */
.eod-stale-banner {
  margin: 8px 0 4px 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  line-height: 1.4;
  background: color-mix(in srgb, var(--warn, #c9a227) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn, #c9a227) 35%, var(--border));
  color: var(--text);
}

.sm-stale { color: var(--text-dim); font-style: italic; font-size: 0.76rem; }

.sm-iv-changes { display: flex; gap: 3px; flex-wrap: wrap; }
.sm-iv-chip {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.sm-actions { display: flex; gap: 6px; }

.sm-action-btn {
  padding: 4px 10px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.76rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.sm-action-btn:hover { background: rgba(88,166,255,0.1); color: var(--accent); border-color: var(--accent); }

.sm-open-pricer { color: var(--accent); }

.sm-legs-row td { padding: 0 !important; background: rgba(0,0,0,0.15); }

.sm-legs-detail { padding: 14px 20px; }

.sm-legs-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.sm-legs-table th {
  padding: 6px 10px;
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
}

.sm-legs-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(48,54,61,0.3);
  font-family: var(--font-mono);
}

.sm-legs-arrow { color: var(--text-dim); font-size: 0.74rem; padding: 7px 3px !important; }

.sm-premium-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.sm-prem-traded { color: var(--text-muted); font-size: 0.84rem; }
.sm-prem-arrow { font-size: 0.68rem; }
.sm-prem-current { font-weight: 700; font-size: 0.9rem; }

.sm-arrow-up { color: var(--positive); }
.sm-arrow-down { color: var(--red); }
.sm-arrow-flat { color: var(--text-dim); }

.sm-pnl-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
}

.sm-pnl-value { font-weight: 700; font-size: 0.9rem; }
.sm-pnl-pct { font-size: 0.74rem; opacity: 0.8; }
.sm-pnl-total { font-size: 0.74rem; color: var(--text-dim); }
.sm-basis-tag { font-size: 0.70rem; color: var(--text-dim); opacity: 0.7; display: block; font-style: italic; }
/* Audit U-S6: package-edge classifier badge, inline in the P&L cell. */
.sm-edge-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.sm-edge-rich { background: rgba(34,197,94,0.18); color: #22c55e; border: 1px solid rgba(34,197,94,0.4); }
.sm-edge-cheap { background: rgba(239,68,68,0.18); color: #ef4444; border: 1px solid rgba(239,68,68,0.4); }
.sm-mark-tag { font-size: 0.60rem; font-weight: 600; padding: 0 3px; border-radius: 2px; margin-left: 3px; vertical-align: middle; }
.sm-mark-live { color: #4caf50; border: 1px solid rgba(76,175,80,0.4); }
.sm-mark-recent { color: #ffc107; border: 1px solid rgba(255,193,7,0.3); }
.sm-mark-surface { color: #90a4ae; border: 1px solid rgba(144,164,174,0.3); }

.sm-iv-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sm-iv-leg {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.3;
}

.sm-iv-type {
  color: var(--text-dim);
  min-width: 40px;
  font-size: 0.74rem;
}

.sm-iv-vals { color: var(--text-muted); }
.sm-iv-delta { font-weight: 600; font-size: 0.74rem; }

.sm-side-buy {
  color: var(--positive);
  font-weight: 700;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.sm-side-sell {
  color: var(--red);
  font-weight: 700;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.sm-fwd-change {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sm-fwd-arrow {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin: 0 2px;
}

.sm-fwd-delta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  margin-left: 5px;
}

.sm-fwd-context {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 6px 0 10px 0;
  border-bottom: 1px solid rgba(48,54,61,0.3);
  margin-bottom: 8px;
}

.sm-attrib-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px 0;
  margin-top: 8px;
  border-top: 1px solid rgba(48,54,61,0.3);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.sm-attrib-label {
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 4px;
}

.sm-attrib-item {
  font-weight: 600;
}

.sm-attrib-sep {
  color: var(--text-dim);
  opacity: 0.5;
}

.clip-row {
  background: color-mix(in srgb, var(--state-info) 8%, transparent);
  border-left: 3px solid var(--accent);
}
.clip-row:hover {
  background: color-mix(in srgb, var(--state-info) 14%, transparent);
}
.clip-row.clip-expanded {
  background: color-mix(in srgb, var(--state-good) 7%, transparent);
  border-bottom: none;
}
.clip-badge {
  display: inline-block;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.clip-expand-icon {
  font-size: 0.6rem;
  margin-left: 3px;
  display: inline-block;
  transition: transform 0.15s ease;
}
.clip-vol {
  font-weight: 700;
}
/* Compact leg/clip count after total vol, e.g. 2,500×4L (× = “by / across”); keeps VOL column on one line */
.tradelog-vol-xlegs {
  font-size: 0.78em;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: 1px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tradelog-half .data-table-scroll .clip-detail .tradelog-vol-xlegs,
.tradelog-half .data-table-scroll .clip-detail .clip-vol {
  font-size: inherit;
}
.clip-time-range {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.clip-detail {
  background: rgba(0, 255, 136, 0.02);
  border-left: 3px solid rgba(0, 255, 136, 0.25);
}
.clip-detail td {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding-top: 2px;
  padding-bottom: 2px;
}
.clip-detail-time::before {
  content: '└ ';
  color: var(--text-dim);
}
.strip-group-row {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-left: 3px solid var(--accent);
}
.strip-group-row:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.strip-group-row.clip-expanded {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-bottom: none;
}
.strip-badge {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.strip-detail {
  background: color-mix(in srgb, var(--accent) 3%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ===== DAILY WRAP ===== */
.daily-wrap-btn {
  background: rgba(0, 255, 136, 0.12);
  color: var(--accent);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.daily-wrap-btn.session-live {
  background: color-mix(in srgb, var(--state-info) 15%, transparent);
  border-color: color-mix(in srgb, var(--state-info) 40%, transparent);
  color: var(--state-info);
  animation: session-btn-glow 2s ease-in-out infinite;
}
@keyframes session-btn-glow {
  0%, 100% { box-shadow: 0 0 4px color-mix(in srgb, var(--state-info) 20%, transparent); }
  50% { box-shadow: 0 0 10px color-mix(in srgb, var(--state-info) 40%, transparent); }
}
.session-phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 3px;
  vertical-align: middle;
}
.session-phase-badge.phase-live {
  background: color-mix(in srgb, var(--state-info) 15%, transparent);
  color: var(--state-info);
  border: 1px solid color-mix(in srgb, var(--state-info) 30%, transparent);
}
.session-phase-badge.phase-closed {
  background: rgba(255, 200, 0, 0.12);
  color: #ffc800;
  border: 1px solid rgba(255, 200, 0, 0.25);
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--state-info);
  animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 3px var(--state-info); }
  50% { opacity: 0.3; box-shadow: 0 0 8px var(--state-info); }
}
.daily-wrap-btn:hover {
  background: rgba(0, 255, 136, 0.22);
}
.dw-close {
  background: rgba(255, 80, 80, 0.12);
  color: #f87171;
  border-color: rgba(255, 80, 80, 0.3);
}
.dw-close:hover {
  background: rgba(255, 80, 80, 0.22);
}
.dw-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 8px;
}
.daily-wrap-content {
  padding: 16px;
}
.dw-edit-textarea {
  width: 100%;
  min-height: 400px;
  background: var(--bg-primary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.dw-edit-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.15);
}
.dw-edit-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 8px;
  text-align: right;
}
.dw-style-saved {
  color: var(--positive);
  font-size: 0.7rem;
  margin-top: 4px;
  text-align: right;
}
.dw-save-copy {
  background: var(--cta);
  color: var(--bg-primary);
  font-weight: 600;
}
.dw-save-copy:hover {
  filter: brightness(1.1);
}
.dw-loading, .dw-error, .dw-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: var(--text-sm);
}
.dw-error { color: var(--state-bad); }
.dw-commentary-wrap {
  background: rgba(0, 255, 136, 0.03);
  border: 1px solid rgba(0, 255, 136, 0.1);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 22px;
}
.dw-commentary-section {
  margin-bottom: 12px;
}
.dw-commentary-section:last-child {
  margin-bottom: 0;
}
.dw-commentary-label {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(0, 255, 136, 0.08);
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 4px;
}
.dw-commentary-lines {
  padding-left: 2px;
}
.dw-commentary-line {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  font-family: var(--font-sans);
  padding: 1px 0;
}
.dw-commentary-para {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  font-family: var(--font-sans);
  margin: 0 0 12px 0;
}
.dw-commentary-para:last-child {
  margin-bottom: 0;
}
.dw-section {
  margin-bottom: 20px;
}
.dw-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 255, 136, 0.15);
}
.dw-sub-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 12px 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dw-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
}
.dw-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}
.dw-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 600;
}
.dw-stat-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}
.dw-up, .dw-table td.dw-up, .dw-table td .dw-up { color: var(--state-good); font-weight: 600; }
.dw-down, .dw-table td.dw-down, .dw-table td .dw-down { color: var(--state-bad); font-weight: 600; }
.dw-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
}
.dw-table.nem-table thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 600;
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
}
.dw-table.nem-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text);
  white-space: nowrap;
}
.dw-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.dw-contract {
  font-weight: 600;
  color: var(--accent);
}
.dw-time {
  color: var(--text-dim);
  font-size: var(--text-xs);
}
.dw-legs-cell {
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.dw-structures {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.dw-structure-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 12px;
}
.dw-structure-card:hover {
  background: rgba(255, 255, 255, 0.05);
}
.dw-struct-header {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 13px;
}
.dw-struct-trade {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 2px;
}
.dw-struct-analytics {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
}
@media (max-width: 900px) {
  .dw-stats-row { gap: 10px; }
  .dw-stat-value { font-size: var(--text-sm); }
  .dw-table.nem-table thead th,
  .dw-table.nem-table tbody td { font-size: var(--text-xs); padding: 3px 4px; }
  .dw-structure-card { padding: 8px 10px; }
  .dw-struct-header { font-size: 12px; }
}

/* Bid/Ask (spread) mode: wider cells, stacked bid | ask + width */
.vol-table.vol-spread-active .vol-td-iv {
  min-width: 82px;
  max-width: none;
  width: auto;
  white-space: normal;
  vertical-align: middle;
  line-height: 1.25;
}
.vol-spread-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.vol-spread-bidask-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.vol-spread-bid {
  color: #8b949e;
  font-weight: 600;
}
.vol-spread-sep {
  color: var(--text-dim);
  opacity: 0.7;
  font-weight: 400;
}
.vol-spread-ask {
  color: #c9d1d9;
  font-weight: 600;
}
.vol-spread-width {
  display: block;
  font-size: 9px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 0;
}
.vol-spread-cell {
  font-family: var(--font-mono);
  font-size: 12px;
}
.vol-spread-mid {
  color: #8b949e;
}
.spread-tight {
  color: #3fb950;
}
.spread-mid {
  color: #d29922;
}
.spread-wide {
  color: #f85149;
}

.pricer-attrib-bar {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.pricer-attrib-item {
  flex: 1;
  text-align: center;
  padding: 4px 2px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  cursor: help;
}
.pricer-attrib-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}
.pricer-attrib-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.pricer-attrib-legs {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.chart-title-bar {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(22,27,34,0.6);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.chart-title-bar .chart-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chart-title-bar .chart-sub {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-weight: 400;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-5);
  color: var(--text-dim);
  text-align: center;
  gap: var(--sp-3);
}
.empty-state-icon {
  font-size: 2rem;
  opacity: 0.35;
  line-height: 1;
}
.empty-state-message {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.5;
}
.empty-state-hint {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-dim);
}
.empty-state-action {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: var(--sp-1);
}
.empty-state-action:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--border-light);
}

/* ===== SPOT MESSAGE BUILDER MODAL ===== */

.spot-msg-overlay {
  display: none;
  position: fixed;
  inset: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
}
.spot-msg-overlay.open {
  display: flex;
}

.spot-msg-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 640px;
  max-height: calc(85vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-height: calc(85dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.spot-msg-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.spot-msg-title {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.spot-msg-charcount {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-dim);
  white-space: nowrap;
}
.spot-msg-charcount.charcount-low { color: var(--amber); }
.spot-msg-charcount.charcount-ok { color: var(--positive); }
.spot-msg-charcount.charcount-high { color: var(--negative); }

.spot-msg-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.spot-msg-close:hover { color: var(--text); }

.spot-msg-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 200px;
}

.spot-msg-preview {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-code-block {
  font-family: var(--font-mono, 'Consolas', 'Monaco', 'Courier New', monospace);
  font-size: 0.82em;
  line-height: 1.4;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 8px 0;
  white-space: pre;
  overflow-x: auto;
}

.spot-msg-textarea {
  width: 100%;
  min-height: 280px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.7;
  padding: 12px;
  resize: vertical;
  outline: none;
}
.spot-msg-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}

.spot-msg-edit-hint {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-top: 8px;
}

.spot-msg-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.spot-msg-actions-left,
.spot-msg-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== ALERT LOG (header badge) ===== */

.alert-log-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}
.alert-log-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.alert-log-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.1rem;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger, #c44);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
}

.alert-log-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.alert-log-dropdown[hidden] {
  display: none !important;
}

.alert-log-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--panel, #161b22);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 200;
  overflow: hidden;
}

.alert-log-dropdown.alert-log-dropdown--fixed {
  position: fixed;
  top: 52px;
  right: 8px;
  left: 8px;
  width: auto;
  max-height: min(480px, 75vh);
}

.alert-log-dropdown-header {
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.alert-log-dropdown-body {
  overflow-y: auto;
  padding: 8px 0;
  flex: 1;
  min-height: 0;
}

.alert-log-dropdown-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.alert-log-dropdown-footer .link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
}

.alert-log-dropdown-footer .link-btn:hover {
  color: var(--text);
}

.alert-log-section-label {
  padding: 6px 12px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--danger, #e66);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.alert-log-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  font-size: 0.82rem;
  line-height: 1.35;
}

.alert-log-item:last-child {
  border-bottom: none;
}

.alert-log-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.alert-log-sev {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-log-sev--critical,
.alert-log-sev--emergency {
  background: rgba(204, 68, 68, 0.25);
  color: #f88;
}

.alert-log-sev--high {
  background: rgba(230, 150, 50, 0.2);
  color: #fa4;
}

.alert-log-sev--medium,
.alert-log-sev--info {
  background: rgba(80, 120, 200, 0.2);
  color: #8ac;
}

.alert-log-type {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}

.alert-log-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
}

.alert-log-msg {
  color: var(--text-muted);
  padding: 12px;
  font-size: 0.85rem;
  text-align: center;
}

.alert-log-msg.alert-log-err {
  color: var(--danger, #f66);
}

.alert-log-item-msg {
  color: var(--text);
  word-break: break-word;
}

.rebids-strip {
  overflow-x: auto;
}
.rebids-table {
  width: 100%;
  table-layout: fixed;
}
.rebids-table thead th {
  text-align: left;
  padding: 6px 8px 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.rebids-table tbody td {
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rebids-table tbody tr:hover td {
  background: rgba(255,255,255,0.025);
}

.rebids-table .rebid-col-unit { width: 15%; }
.rebids-table .rebid-col-region { width: 5%; text-align: center; }
.rebids-table .rebid-col-dir { width: 6%; }
.rebids-table .rebid-col-type { width: 7%; }
.rebids-table .rebid-col-mw { width: 9%; text-align: right; }
.rebids-table .rebid-col-move { width: 17%; }
.rebids-table .rebid-col-window { width: 13%; }
.rebids-table .rebid-col-reason { width: 28%; }

.rebid-mw-val {
  font-weight: 700;
  color: rgba(255,255,255,0.92);
}

.rebid-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}
.rebid-chip-gen {
  color: #f7b731;
  background: rgba(247,183,49,0.1);
  border-color: rgba(247,183,49,0.35);
}
.rebid-chip-load {
  color: #4ecdc4;
  background: rgba(78,205,196,0.1);
  border-color: rgba(78,205,196,0.35);
}
.rebid-chip-energy {
  color: rgba(255,255,255,0.78);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
}
.rebid-chip-fcas {
  color: #a55eea;
  background: rgba(165,94,234,0.1);
  border-color: rgba(165,94,234,0.35);
}

.rebid-move-up {
  color: #f85149;
  font-weight: 700;
}
.rebid-move-down {
  color: #3fb950;
  font-weight: 700;
}
.rebid-move-sep {
  color: rgba(255,255,255,0.4);
  margin: 0 2px;
}

.rebid-time-span {
  display: inline-block;
  color: rgba(255,255,255,0.82);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.rebid-time-count {
  display: block;
  color: rgba(255,255,255,0.42);
  font-family: var(--font-sans, sans-serif);
  font-size: var(--text-xs);
  margin-top: 2px;
}
.rebid-time-muted {
  color: rgba(255,255,255,0.3);
}

.rebid-reason {
  display: block;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-sans, sans-serif);
  font-size: var(--text-sm);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}
.rebid-reason-empty {
  color: rgba(255,255,255,0.3);
  font-style: italic;
  font-size: var(--text-xs);
}

.empty-state-inline {
  padding: 0.5rem 0;
}
.empty-state-inline .empty-state-message {
  font-size: 0.9rem;
}

/* ===== NOTIFICATION SETTINGS ===== */

.notif-settings-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}
.notif-settings-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.tour-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}
.tour-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.notif-overlay {
  display: none;
  position: fixed;
  inset: 0;
  padding-top: calc(40px + env(safe-area-inset-top, 0px));
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2100;
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
}
.notif-overlay.open {
  display: flex;
}

.notif-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 94%;
  max-width: 720px;
  max-height: calc(100vh - 80px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - 80px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.7);
  margin-bottom: 40px;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.notif-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.notif-close:hover { color: var(--text); }

.notif-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.notif-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

.notif-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.notif-section-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.notif-hint {
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 12px 0;
}

/* Channel cards */
.notif-channels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) {
  .notif-channels-row { grid-template-columns: 1fr; }
}

.notif-channel-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.notif-channel-card.connected {
  border-color: rgba(63, 185, 80, 0.3);
}

.notif-channel-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.notif-channel-info {
  flex: 1;
  min-width: 0;
}

.notif-channel-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.notif-channel-status {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.notif-channel-status.connected {
  color: var(--positive);
}

.notif-channel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Buttons */
.notif-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
}
.notif-btn:disabled { opacity: 0.5; cursor: default; }

.notif-btn-primary {
  background: var(--accent);
  color: #0d1117;
}
.notif-btn-primary:hover:not(:disabled) { opacity: 0.85; }

.notif-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.notif-btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-light); }

.notif-btn-lg {
  padding: 12px 28px;
  font-size: 0.95rem;
}

.notif-btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  font-weight: 500;
}
.notif-btn-sm.notif-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.notif-btn-sm.notif-btn-ghost:hover { color: var(--text); }
.notif-btn-sm.notif-btn-danger {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.notif-btn-sm.notif-btn-danger:hover { color: var(--red); border-color: var(--red); }

/* Presets */
.notif-presets-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.notif-preset-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.notif-preset-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.notif-preset-btn.loading {
  opacity: 0.6;
}

.notif-preset-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 4px;
}

.notif-preset-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Smart profiles */
.notif-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.notif-profile-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  transition: border-color 0.2s;
}
.notif-profile-card:hover {
  border-color: var(--accent);
}

/* Alert catalogue */
.notif-cat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.notif-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.notif-cat-header:hover { background: rgba(255,255,255,0.03); }

.notif-cat-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.notif-cat-toggle-icon {
  font-size: 0.65rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.notif-cat-toggle-icon.collapsed { transform: rotate(-90deg); }

.notif-cat-body {
  border-top: 1px solid var(--border);
  padding: 0;
}
.notif-cat-body.collapsed { display: none; }

.notif-alert-row {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.3);
}
.notif-alert-row:last-child { border-bottom: none; }

.notif-alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notif-alert-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.notif-alert-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.3;
}

.notif-alert-config {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(48,54,61,0.2);
}

/* Toggle switch */
.notif-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.notif-toggle input { opacity: 0; width: 0; height: 0; }
.notif-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background 0.2s;
}
.notif-toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.notif-toggle input:checked + .notif-toggle-slider {
  background: var(--accent);
}
.notif-toggle input:checked + .notif-toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

/* Threshold inputs */
.notif-threshold-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.notif-threshold-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.notif-threshold-input {
  width: 100px;
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.notif-threshold-input:focus {
  border-color: var(--accent);
  outline: none;
}

/* Region pills */
.notif-region-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.notif-region-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.notif-region-pill input { display: none; }
.notif-region-pill.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

/* Quiet hours */
.notif-quiet-row {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.notif-quiet-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text);
}

.notif-quiet-times {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.notif-time-input {
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.notif-quiet-critical {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
}

/* Wizard */
.notif-wizard {
  min-height: 300px;
}

.notif-wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
}

.notif-progress-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--border);
  color: var(--text-dim);
  flex-shrink: 0;
}
.notif-progress-step.active {
  background: var(--accent);
  color: #0d1117;
}
.notif-progress-step.current {
  box-shadow: 0 0 0 3px rgba(88,166,255,0.25);
}

.notif-progress-line {
  width: 40px;
  height: 2px;
  background: var(--border);
}
.notif-progress-line.active {
  background: var(--accent);
}

.notif-wizard-step {
  max-width: 520px;
  margin: 0 auto;
}

.notif-wizard-heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  text-align: center;
}

.notif-wizard-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  text-align: center;
}

.notif-wizard-instructions {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px 12px;
  align-items: start;
  margin-bottom: 20px;
}
.notif-wizard-instructions p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
  padding-top: 4px;
}
.notif-wizard-instructions code {
  background: rgba(88,166,255,0.12);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.notif-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.notif-wizard-input-group {
  margin-bottom: 20px;
}
.notif-wizard-input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.notif-wizard-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.notif-wizard-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(88,166,255,0.1);
}

.notif-wizard-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 6px;
  min-height: 18px;
}

.notif-wizard-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.notif-wizard-link {
  display: inline-block;
  text-align: center;
  width: 100%;
  padding: 10px;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.notif-wizard-link:hover { text-decoration: none; opacity: 0.85; }

.notif-wizard-status {
  text-align: center;
  margin-top: 16px;
  min-height: 24px;
}

.notif-wizard-confirm {
  text-align: center;
  margin-top: 16px;
}
.notif-wizard-confirm p {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 12px;
}
.notif-wizard-confirm .notif-btn {
  margin: 0 6px;
}

.notif-wizard-success {
  text-align: center;
  padding: 24px 0;
}
.notif-wizard-success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(63,185,80,0.15);
  color: var(--positive);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.notif-wizard-success h3 {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 8px;
}
.notif-wizard-success p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.notif-success-text {
  color: var(--positive);
  font-weight: 500;
}
.notif-error-text {
  color: var(--red);
  font-size: 0.85rem;
  line-height: 1.4;
}

.notif-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: notif-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes notif-spin {
  to { transform: rotate(360deg); }
}

.notif-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--positive);
  color: var(--text);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 3000;
  transition: transform 0.3s ease;
  pointer-events: none;
}
.notif-toast.show {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 560px) {
  .eod-state-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px 12px;
  }
}

/* ===== MOBILE — iPhone 16 Pro Max (430px) & similar ===== */

@media (max-width: 480px) {

  html, body {
    overflow-x: hidden;
  }

  /* Mobile UX audit: touch targets, filter bars, predispatch, trade history, daily wrap */
  .btn-segment,
  .ef-chip,
  .hist-range-btn,
  .snapshot-range-btns button {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.68rem;
  }

  .trade-filter-select {
    min-height: 36px;
  }

  .trade-filter-clear {
    min-height: 36px;
    min-width: 36px;
    font-size: 1rem;
  }

  .pasa-filters,
  .notices-filters,
  .trip-filter-row,
  .outage-filter-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  .ef-filter-group {
    flex-wrap: wrap;
    gap: 4px;
  }

  .pasa-filter-label {
    width: 100%;
    font-size: 9px;
  }

  .predispatch-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #sub-history .hist-filter-group {
    width: 100%;
  }

  #sub-history .hist-select,
  #sub-history .hist-input {
    width: 100%;
    max-width: none;
  }

  #sub-history .hist-range-btns {
    flex-wrap: wrap;
  }

  #section-daily-wrap .snapshot-header-right {
    width: 100%;
    justify-content: flex-start;
  }

  #section-daily-wrap .snapshot-header-right .daily-wrap-btn {
    font-size: 0.65rem;
    padding: 4px 8px;
  }

  .brand {
    font-size: 0.9rem;
  }

  .dashboard {
    padding-left: 6px;
    padding-right: 6px;
  }

  .top-bar {
    padding: 0 8px;
    gap: 4px;
  }

  .top-bar-left {
    gap: 4px;
    min-width: 0;
  }

  .brand img {
    height: 24px !important;
  }

  .nav-live-compact {
    gap: 4px;
    font-size: 0.7rem;
  }

  .compact-time-label {
    font-size: 0.65rem;
  }

  .top-bar-right {
    gap: 6px;
  }

  .hamburger-btn {
    padding: 6px 8px;
  }

  .hamburger-btn span {
    width: 18px;
  }

  .spot-cards-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .spot-card {
    padding: 8px;
  }

  .spot-card-price {
    font-size: 1.1rem;
  }

  .ic-tiles-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .panel {
    padding: 10px;
    border-radius: 6px;
  }

  .panel-title {
    font-size: 0.85rem;
  }

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

  .sub-tab-bar {
    gap: 2px;
  }

  .sub-tab-btn {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .welcome-banner {
    padding: 16px 14px;
  }

  .welcome-banner h2 {
    font-size: 1rem;
  }

  .welcome-banner p {
    font-size: 0.8rem;
  }

  .welcome-feature-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .welcome-feature-card {
    padding: 12px 10px;
  }

  .welcome-feature-desc {
    font-size: 0.7rem;
  }

  .welcome-banner-actions {
    flex-direction: column;
    gap: 8px;
  }

  .welcome-tour-btn,
  .welcome-dismiss-btn {
    width: 100%;
    text-align: center;
  }

  .welcome-banner-links {
    gap: 8px;
  }

  .welcome-banner-links a {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .data-table {
    font-size: 0.68rem;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: 4px 5px;
  }

  .snapshot-table th,
  .snapshot-table td {
    padding: 3px 4px;
  }

  .market-snapshot-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .snapshot-card {
    min-width: 0;
  }

  .interconnector-row {
    font-size: 0.82rem;
    gap: 4px;
  }

  .tradelog-split {
    flex-direction: column;
  }

  .trading-tables {
    grid-template-columns: 1fr;
  }

  .collapsible-toggle {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pasa-container,
  .notices-container {
    max-height: 400px;
  }

  .ds-cards-grid,
  .pasa-region-cards {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .ds-tightest-alert,
  .ds-nem-summary {
    flex-wrap: wrap;
  }

  .demand-table,
  .notices-table {
    font-size: 11px;
  }

  .data-table.demand-table thead th,
  .data-table.demand-table tbody td {
    padding: 6px 6px;
    font-size: 10px;
  }

  .data-table.demand-table thead th {
    font-size: 9px;
  }

  .market-system,
  .market-forward,
  .market-context,
  .market-map-row {
    grid-template-columns: 1fr;
  }

  .contact-desk-fab {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    width: 42px;
    height: 42px;
  }

  .fab-icon {
    font-size: 18px;
  }

  .vol-summary-bar {
    gap: 4px;
  }

  .vol-stat {
    min-width: 60px;
    padding: 5px 8px;
  }

  .vol-stat-label {
    font-size: 8px;
  }

  .vol-stat-value {
    font-size: 0.78rem;
  }

  .vol-region-tabs {
    flex-wrap: wrap;
    gap: 3px;
  }

  .ss-body-grid {
    grid-template-columns: 1fr;
  }

  .spot-msg-modal {
    width: 96%;
    max-height: calc(90vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(90dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .spot-msg-header {
    padding: 12px 14px;
  }

  .notif-overlay {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }

  .notif-modal {
    width: 98%;
    max-height: calc(100vh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .notif-header {
    padding: 12px 16px;
  }

  .notif-toast {
    width: 90%;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.78rem;
  }

  .event-card {
    padding: 10px;
  }

  .event-card-details {
    font-size: 0.72rem;
  }

  .login-card {
    padding: 28px 20px;
    margin: 0 8px;
  }

  .login-card h1 {
    font-size: 1.2rem;
  }

  .brand-subtitle {
    font-size: 0.78rem;
  }

  .pricer-attrib-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pricer-attrib-item {
    min-width: 0;
    flex: 1 1 45%;
  }

  .date-picker-wrap {
    flex-shrink: 1;
    min-width: 0;
  }

  .trading-date-picker {
    min-width: 0;
    width: 100%;
    max-width: 130px;
  }

  .spot-range-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
  }

  .spot-presets {
    flex-wrap: wrap;
    gap: 3px;
  }

  .spot-preset {
    font-size: 10px;
    padding: 4px 8px;
    min-height: 36px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .pasa-filter-btn {
    min-height: 36px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
  }

  .spot-custom-dates {
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
  }

  .spot-date-input {
    flex: 1;
    min-width: 0;
    max-width: 120px;
    font-size: 10px;
    padding: 3px 4px;
  }

  .spot-compare-toggle {
    margin-left: 0;
    font-size: 10px;
  }

  .spot-summary-table-wrap {
    font-size: 10px;
  }

  .spot-summary-table-wrap .spot-summary-table th,
  .spot-summary-table-wrap .spot-summary-table td {
    padding: 6px 6px;
    white-space: nowrap;
    font-size: 10px;
  }

  .spot-summary-table-wrap .spot-summary-table tbody td:first-child {
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  #gen-trips-container .gen-trips-table th,
  #gen-trips-container .gen-trips-table td {
    padding: 6px 6px;
    font-size: 10px;
    white-space: nowrap;
  }

  .spot-card-label {
    font-size: 1.05rem;
    letter-spacing: 0.09em;
  }

  .nem-map-container {
    min-height: 240px;
    padding: 2px;
  }

  .nem-map-container svg {
    max-width: calc(100% - 8px);
  }

  #panel-nem-map {
    min-width: 0;
    overflow: hidden;
  }

  .trade-filter-select {
    min-width: 0;
    max-width: none;
    flex: 1 1 calc(50% - 4px);
    font-size: 10px;
    padding: 4px 6px;
  }

  .struct-low-conf-toggle {
    font-size: 10px;
  }

  .structure-card {
    padding: 8px 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
  }

  .sl-header {
    flex-wrap: wrap;
    font-size: 12px;
    gap: 4px;
  }

  .sl-contract {
    white-space: normal;
    word-break: break-word;
  }

  .sl-name {
    white-space: normal;
    word-break: break-word;
  }

  .sl-decomp {
    white-space: normal;
  }

  .sl-time {
    margin-left: 0;
    font-size: 0.65rem;
  }

  .sl-detail {
    font-size: 11px;
  }

  .sl-legs-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sl-legs-table {
    font-size: 10px;
    min-width: 320px;
  }

  .sl-legs-table thead th {
    font-size: 8px;
    padding: 2px 4px 2px 0;
  }

  .sl-legs-table tbody td {
    padding: 2px 4px 2px 0;
  }

  .sl-dir-buy, .sl-dir-sell {
    font-size: 9px;
    width: 28px;
    min-width: 28px;
  }

  .sl-legs-table thead th:nth-child(2),
  .sl-legs-table tbody td:nth-child(2) {
    width: 28px;
  }

  .sl-leg-prem,
  .sl-leg-iv,
  .sl-leg-delta {
    width: 44px;
  }

  .sl-leg-vol {
    width: 36px;
  }

  .sl-delta-legs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .sl-delta-leg {
    font-size: 10px;
  }

  .sl-metrics {
    font-size: 10px;
    flex-wrap: wrap;
  }

  .sl-price-btn {
    font-size: 9px;
    padding: 2px 6px;
  }

  .sl-copy-btn-full {
    font-size: 10px;
    padding: 5px 8px;
    margin: 6px 4px 2px 4px;
    width: calc(100% - 8px);
  }

  .sl-type {
    font-size: 0.6rem;
    padding: 1px 5px;
  }

  .sl-sep {
    margin: 0 3px;
  }

  .conf-badge {
    font-size: 8px;
    padding: 1px 4px;
  }

  .structures-list {
    min-width: 0;
    overflow: hidden;
  }

  .tradelog-half {
    min-width: 0;
  }

  .tradelog-half .data-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tradelog-half .data-table-scroll .tradelog-table--futures,
  .tradelog-half .data-table-scroll .tradelog-table--options {
    display: block;
    table-layout: auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #section-tradelog .tradelog-half .data-table-scroll {
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow-x: hidden;
  }

  #section-tradelog .tradelog-table colgroup,
  #section-tradelog .tradelog-table thead {
    display: none;
  }

  #section-tradelog .tradelog-table tbody {
    display: grid;
    gap: 8px;
  }

  #section-tradelog .tradelog-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
    box-shadow: none;
  }

  #section-tradelog .tradelog-table tbody tr[data-zebra="1"] {
    background: var(--surface-tint-1);
  }

  #section-tradelog .tradelog-table tbody tr[data-pinned="1"] {
    background: var(--watchlist-pinned-bg);
    border-left-color: var(--watchlist-star);
  }

  #section-tradelog .tradelog-table tbody tr[data-bigprint="1"] {
    background: var(--bigprint-bg);
    border-left-color: var(--bigprint-edge);
  }

  #section-tradelog .tradelog-table tbody tr[data-newprint="1"] {
    box-shadow: inset 0 0 0 1px var(--newprint-edge);
  }

  #section-tradelog .tradelog-table tbody tr.clip-row,
  #section-tradelog .tradelog-table tbody tr.strip-group-row {
    background: color-mix(in srgb, var(--state-info) 10%, transparent);
    border-left-color: var(--accent);
  }

  #section-tradelog .tradelog-table tbody tr.clip-row[data-pinned="1"],
  #section-tradelog .tradelog-table tbody tr.strip-group-row[data-pinned="1"] {
    background: var(--watchlist-pinned-bg);
    border-left-color: var(--watchlist-star);
  }

  #section-tradelog .tradelog-table tbody tr.clip-row[data-bigprint="1"],
  #section-tradelog .tradelog-table tbody tr.strip-group-row[data-bigprint="1"] {
    background: var(--bigprint-bg);
    border-left-color: var(--bigprint-edge);
  }

  #section-tradelog .tradelog-table tbody tr.clip-detail {
    margin-left: 10px;
    background: rgba(0, 255, 136, 0.03);
    border-left-color: rgba(0, 255, 136, 0.3);
  }

  #section-tradelog .tradelog-table tbody td {
    display: flex;
    min-width: 0;
    padding: 0 !important;
    border: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    overflow: visible !important;
    white-space: normal !important;
    text-align: left !important;
    text-overflow: clip;
    font-size: 12px;
    line-height: 1.25;
  }

  #section-tradelog .tradelog-table tbody td::before {
    display: block;
    color: var(--text-dim);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
  }

  #section-tradelog .tradelog-table tbody td:nth-child(1),
  #section-tradelog .tradelog-table tbody td:nth-child(2) {
    grid-column: 1 / -1;
  }

  #section-tradelog .tradelog-table tbody td:nth-child(2) {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
  }

  #section-tradelog .tradelog-table tbody td.empty-state-cell {
    display: block;
    grid-column: 1 / -1;
    padding: 14px 10px !important;
    text-align: center !important;
  }

  #section-tradelog .tradelog-table tbody td.empty-state-cell::before {
    content: none;
  }

  #section-tradelog .tradelog-table--futures tbody td:nth-child(1)::before {
    content: "Time";
  }

  #section-tradelog .tradelog-table--futures tbody td:nth-child(2)::before {
    content: "Contract";
  }

  #section-tradelog .tradelog-table--futures tbody td:nth-child(3)::before {
    content: "Type";
  }

  #section-tradelog .tradelog-table--futures tbody td:nth-child(4)::before {
    content: "Price";
  }

  #section-tradelog .tradelog-table--futures tbody td:nth-child(5)::before {
    content: "Tick";
  }

  #section-tradelog .tradelog-table--futures tbody td:nth-child(6)::before {
    content: "Delta Settle";
  }

  #section-tradelog .tradelog-table--futures tbody td:nth-child(7)::before {
    content: "Vol";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(1)::before {
    content: "Time";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(2)::before {
    content: "Contract";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(3)::before {
    content: "Put/Call";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(4)::before {
    content: "Strike";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(5)::before {
    content: "Premium";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(6)::before {
    content: "Underlying";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(7)::before {
    content: "IV";
  }

  #section-tradelog .tradelog-table--options tbody td:nth-child(8)::before {
    content: "Vol";
  }

  #section-tradelog .clip-detail-time::before {
    content: none;
  }

  #section-tradelog .clip-time-range {
    display: inline;
  }

  .tradelog-sub-header {
    font-size: 11px;
  }

  .eod-state-grid {
    gap: 12px;
    padding: 12px 8px;
  }

  .eod-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
    gap: 8px;
  }

  .eod-header-controls {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .eod-input {
    min-width: 0;
    flex: 1;
    max-width: 130px;
    font-size: 11px;
    padding: 4px 6px;
  }

  .eod-product-toggle {
    flex-wrap: wrap;
  }

  .eod-product-btn {
    font-size: 10px;
    padding: 4px 8px;
  }

  .eod-rebuild-btn {
    font-size: 10px;
    padding: 4px 8px;
  }

  .eod-export-group {
    flex-wrap: wrap;
    gap: 3px !important;
  }

  .eod-exports-tier-hint {
    font-size: 10px;
    padding: 5px 8px;
  }

  .eod-title {
    font-size: 14px;
  }

  .eod-header-badges {
    flex-wrap: wrap;
    gap: 4px;
  }

  .eod-badge {
    font-size: 9px;
    padding: 2px 6px;
  }

  .eod-marks-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .eod-marks-tbl {
    font-size: 10px;
    min-width: 500px;
  }

  .section-hdr {
    flex-wrap: wrap;
    gap: 4px;
  }

  #tab-nem .section-hdr {
    gap: 4px;
    align-items: flex-start;
  }

  .spot-copy-btn {
    margin-left: 0;
    font-size: 10px;
    padding: 2px 8px;
  }

  /* Was overflow-x: hidden — that clipped wide tables with no way to scroll on phones */
  .data-table-wrap,
  .data-table-scroll,
  .ic-table-wrap,
  .pasa-container,
  .notices-container,
  .snapshot-card,
  .vs-analytics-wrap,
  .structure-table-wrap,
  .sm-table-container,
  .history-table-wrap {
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  /* Trade log: keep horizontal scroll for wide tables; do not clip the whole block */
  #section-tradelog .tradelog-half {
    min-width: 0;
    overflow-x: visible;
    overflow-y: visible;
  }

  #section-tradelog .tradelog-half .data-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #section-tradelog {
    overflow-x: hidden;
    overflow-y: visible;
  }

  .snapshot-table {
    min-width: 0;
  }

  .chart-container,
  .plotly-chart,
  .js-plotly-plot {
    width: 100% !important;
    max-width: 100%;
  }

  .js-plotly-plot {
    margin-bottom: 12px;
  }

  .js-plotly-plot .legend {
    font-size: 9px !important;
  }

  .curve-chart-container,
  .basis-chart-container,
  .ctx-chart-container,
  .renewable-chart-container,
  .eod-overview-chart-container,
  #sub-history .hist-chart-container,
  .shape-chart-container,
  .vol-chart,
  .genmix-container {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .ctx-chart-container {
    height: auto;
    min-height: 300px;
  }
}

/*
 * NEM Overview (mobile / narrow): panels stay within the page width; wide content uses an inner
 * scrollport so tables and charts keep readable column widths instead of squishing.
 */
@media (max-width: 768px) {
  #tab-nem #sub-overview .panel,
  #tab-nem #sub-overview .market-spot-row {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: visible;
  }

  /* Predispatch */
  #tab-nem .predispatch-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  #tab-nem .predispatch-table-wrap .predispatch-tbl {
    width: max-content;
    min-width: 100%;
  }

  /* Demand vs forecast */
  #tab-nem #panel-demand .demand-compact {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  #tab-nem #panel-demand .demand-table {
    width: max-content;
    min-width: 100%;
  }

  /* Demand & supply context — card strip scrolls inside the panel */
  #tab-nem #panel-demand-supply .ds-cards-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin-left: 0;
    margin-right: 0;
    padding-bottom: 4px;
  }

  #tab-nem #panel-demand-supply .ds-cards-scroll .ds-cards-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    width: max-content;
    min-width: min(100%, max-content);
  }

  #tab-nem #panel-demand-supply .ds-cards-scroll .ds-region-card {
    flex: 0 0 auto;
    width: 148px;
    min-width: 148px;
  }

  /* Generation mix — full-width bar rows, scroll if the row is wider than the card */
  #tab-nem #panel-genmix .genmix-container {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  #tab-nem #panel-genmix .genmix-grid {
    width: max-content;
    min-width: 100%;
  }

  #tab-nem #panel-genmix .genmix-region {
    min-width: max-content;
  }

  /* Generator trips — filters + table */
  #tab-nem #panel-gen-trips .trip-filter-row .pasa-filters {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  #tab-nem #gen-trips-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  #tab-nem #gen-trips-container .gen-trips-table {
    width: max-content;
    min-width: 100%;
  }

  /* Interconnector expanded table */
  #tab-nem #panel-interconnectors-main .ic-table-wrap.expanded {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #tab-nem #panel-interconnectors-main #ic-table {
    width: max-content;
    min-width: 100%;
  }
}

@media (max-width: 430px) {
  .dashboard {
    padding-left: 4px;
    padding-right: 4px;
  }

  .panel {
    padding: 8px;
    border-radius: 4px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .panel-header .panel-title {
    width: 100%;
  }

  .collapsible-toggle {
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  .tab-content {
    padding: 0;
  }

  .sub-tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .sub-tab-bar::-webkit-scrollbar {
    display: none;
  }

  .sub-tab-btn {
    flex-shrink: 0;
    padding: 5px 8px;
    font-size: 0.68rem;
    min-height: 44px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .welcome-feature-grid {
    grid-template-columns: 1fr;
  }

  .snapshot-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .snapshot-header-right {
    gap: 6px;
    flex-wrap: nowrap;
  }

  #section-snapshot .snapshot-header-trailing {
    gap: 6px;
    flex-wrap: nowrap;
    max-width: 100%;
  }

  #section-snapshot.panel > h2.section-hdr.collapsible-toggle {
    overflow-x: auto;
  }

  #section-snapshot,
  #section-daily-wrap,
  #section-structures,
  #section-tradelog {
    padding: 10px;
  }

  .controls {
    flex-wrap: wrap;
    gap: 6px;
  }

  .controls select,
  .controls input[type="date"],
  .controls input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    font-size: 11px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-sm {
    padding: 5px 10px;
    font-size: 0.68rem;
  }

  .region-selector,
  .region-pills {
    flex-wrap: wrap;
    gap: 3px;
  }

  .region-selector .region-btn,
  .region-pill {
    padding: 3px 8px;
    font-size: 0.65rem;
  }

  .forward-controls,
  .heatmap-controls,
  .basis-controls {
    flex-wrap: wrap;
    gap: 6px;
  }

  .vs-mode-tabs,
  .vs-date-controls {
    flex-wrap: wrap;
    gap: 4px;
  }

  .vs-mode-btn {
    padding: 4px 8px;
    font-size: 0.68rem;
  }

  .vs-detail-drawer {
    width: 100vw;
    max-width: 100vw;
  }

  .pin-risk-container {
    padding: 10px 6px;
  }

  .pin-risk-filters {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pin-risk-filters select,
  .pin-risk-filters input {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    font-size: 10px;
  }

  .pin-risk-summary {
    flex-wrap: wrap;
    gap: 6px;
  }

  .broker-grid-2 {
    grid-template-columns: 1fr;
  }

  .broker-nav {
    flex-wrap: wrap;
    gap: 4px;
  }

  .broker-nav-btn {
    font-size: 10px;
    padding: 5px 10px;
  }

  .broker-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 10px;
  }

  .broker-settle-grid {
    grid-template-columns: 1fr;
  }

  .context-grid {
    grid-template-columns: 1fr;
  }

  .count-badge {
    font-size: 0.6rem;
    padding: 1px 6px;
  }

  .spot-summary-narrative {
    font-size: 11px;
    padding: 8px 10px;
  }

  .eod-state-card {
    border-radius: 8px;
  }

  .shape-block-cards {
    grid-template-columns: 1fr;
  }
}

/* ===== SHAPE SWAPS ===== */

.shape-section {
  margin-bottom: 16px;
}

.shape-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 0 4px;
}

.shape-control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shape-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.shape-select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 6px 10px;
  outline: none;
  min-width: 120px;
  transition: border-color 0.2s;
}

.shape-select:focus {
  border-color: var(--accent);
}

.shape-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 6px 10px;
  outline: none;
  min-width: 120px;
  transition: border-color 0.2s;
}

.shape-input:focus {
  border-color: var(--accent);
}

.shape-btn-group {
  display: flex;
  gap: 0;
}

.shape-range-btn {
  padding: 5px 12px;
  font-size: var(--text-xs);
}

.shape-btn-sm {
  padding: 5px 14px;
  font-size: var(--text-xs);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s;
}

.shape-btn-sm:hover {
  opacity: 0.85;
}

.shape-profile-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shape-chart-container {
  width: 100%;
  min-height: 450px;
  margin-bottom: 16px;
}

.shape-chart-half {
  min-height: 320px;
}

/* Payout simulator — premium chart framing (Plotly inside) */
#sub-todsimulator .shape-sim-chart-panel {
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.45);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.55) 50%, rgba(8, 12, 22, 0.75) 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 16px 10px 10px;
  margin-bottom: 20px;
  /* allow Plotly title + modebar to paint inside padded area without clipping */
  overflow: visible;
}
#sub-todsimulator .shape-sim-chart-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
#sub-todsimulator .shape-sim-dist-panel {
  min-height: 300px;
}
#sub-todsimulator .shape-sim-chart-panel .js-plotly-plot .plotly .modebar {
  top: 12px !important;
  right: 12px !important;
}
#sub-todsimulator .shape-sim-chart-panel .modebar-btn {
  color: #94a3b8 !important;
}

.shape-gen-mix-tall {
  min-height: 520px;
}

.shape-calc-btn {
  padding: 8px 24px;
  font-size: var(--text-sm);
  margin-top: 8px;
  align-self: flex-start;
}

/* Long-lookback scarcity: explains cap-threshold days vs raw mean */
.shape-duck-scarcity-banner {
  display: none;
  margin: 0 0 10px 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #e6edf3;
}
.shape-duck-scarcity-banner-inner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--bg-card) 85%, #f5a623 15%);
  border: 1px solid color-mix(in srgb, var(--border) 70%, #f5a623 30%);
  border-left-width: 3px;
  border-radius: var(--radius, 6px);
}
.shape-duck-scarcity-banner-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}
.shape-duck-scarcity-banner-text a {
  color: #58a6ff;
  text-decoration: underline;
  cursor: pointer;
}
.shape-duck-scarcity-banner-text a:hover {
  color: #79c0ff;
}

.shape-block-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.shape-block-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px 12px;
  transition: border-color 0.2s, background 0.2s;
}

.shape-block-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.shape-block-card-title {
  font-size: 0.8125rem;
  color: #b1bac4;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.shape-block-card-hours {
  color: #9da5b4;
  font-weight: 500;
  font-size: 0.75rem;
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
}

.shape-block-card-price {
  font-size: clamp(1.45rem, 2.4vw, 1.75rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.shape-block-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9375rem;
  color: #c9d1d9;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.shape-block-card-meta span {
  font-weight: 600;
}

.shape-block-card-range {
  font-size: 0.875rem;
  color: #b1bac4;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.shape-premium-positive {
  color: var(--positive);
}

.shape-premium-negative {
  color: var(--accent);
}

/* Block summary only — stronger contrast than global premium colours on charcoal cards */
.shape-block-card .shape-premium-positive {
  color: #4ade80;
}

.shape-block-card .shape-premium-negative {
  color: #79b8ff;
}

/* Forward curve table + inline backtest (Shape Swap Pricer) */
.shape-forward-section {
  margin-bottom: 16px;
}

.shape-forward-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.shape-forward-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 8px;
}

.shape-fwd-methodology {
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(13, 17, 23, 0.45);
  padding: 0 12px;
}

.shape-fwd-methodology-sum {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 0;
  list-style-position: outside;
}

.shape-fwd-methodology-body {
  font-size: var(--text-xs);
  color: var(--text-dim);
  line-height: 1.5;
  padding-bottom: 12px;
}

.shape-fwd-methodology-body p {
  margin: 0 0 8px;
}

.shape-fwd-consistency {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: var(--text-xs);
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.shape-fwd-consistency--ok {
  border-color: rgba(63, 185, 80, 0.35);
  background: rgba(63, 185, 80, 0.08);
  color: var(--text-muted);
}

.shape-fwd-consistency--warn {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.08);
  color: var(--text-muted);
}

.shape-fwd-consistency--bad {
  border-color: rgba(248, 81, 73, 0.45);
  background: rgba(248, 81, 73, 0.08);
  color: var(--text-muted);
}

.shape-fwd-consistency--na {
  border-color: var(--border);
  background: rgba(110, 118, 129, 0.08);
  color: var(--text-dim);
}

.shape-fwd-consistency-code {
  color: var(--text-dim);
  font-weight: 500;
}

.shape-forward-tas-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(88, 166, 255, 0.08);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.shape-forward-footnote {
  margin: 12px 0 0;
  font-size: var(--text-xs);
  color: var(--text-dim);
  line-height: 1.45;
}

.shape-forward-footnote code {
  font-size: 0.95em;
}

.shape-forward-curve-panel {
  min-height: 120px;
}

.shape-forward-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.shape-forward-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-xs);
}

.shape-forward-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-card);
  font-weight: 600;
  text-align: center;
  vertical-align: bottom;
  border-bottom: 1px solid var(--border);
  padding: 6px 4px;
  white-space: nowrap;
}

.shape-forward-table thead tr:first-child th.shape-fwd-th-grp {
  border-bottom: 1px solid rgba(48, 54, 61, 0.65);
}

.shape-fwd-th-grp.shape-fwd-th-asx {
  background: rgba(88, 166, 255, 0.14);
  color: var(--text-muted);
}

.shape-fwd-th-grp.shape-fwd-th-blocks {
  background: rgba(63, 185, 80, 0.12);
  color: var(--text-muted);
}

.shape-forward-table thead th.shape-fwd-th-tenor {
  text-align: left;
  vertical-align: middle;
  min-width: 6.5rem;
}

.shape-forward-table tbody td {
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid rgba(48, 54, 61, 0.45);
}

.shape-fwd-row-asx td:not(.shape-fwd-tenor-label) {
  background: rgba(88, 166, 255, 0.07);
}

.shape-fwd-row-blocks td {
  background: rgba(63, 185, 80, 0.07);
}

.shape-fwd-tenor-label {
  text-align: left !important;
  vertical-align: top;
  padding: 8px 10px !important;
  font-size: var(--text-sm);
  border-right: 1px solid rgba(48, 54, 61, 0.45);
}

.shape-fwd-tenor-code {
  margin-top: 4px;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-dim);
}

.shape-fwd-cell {
  position: relative;
  min-width: 4.25rem;
}

.shape-fwd-cell--clickable {
  cursor: pointer;
}

.shape-fwd-cell--clickable:hover {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.shape-fwd-cell--empty {
  color: var(--text-dim);
  font-style: italic;
}

.shape-fwd-price {
  display: block;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

.shape-fwd-prov {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.shape-fwd-prov--settled {
  background: rgba(63, 185, 80, 0.22);
  color: var(--positive);
}

.shape-fwd-prov--algebraic {
  background: rgba(210, 153, 34, 0.22);
  color: #e3b341;
}

.shape-fwd-prov--modelled {
  background: rgba(88, 166, 255, 0.22);
  color: #79b8ff;
}

.shape-fwd-conf {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-dim);
}

.shape-fwd-cell.nem-dim {
  opacity: 0.55;
}

.shape-fwd-cell.nem-stale {
  box-shadow: inset 0 0 0 1px rgba(210, 153, 34, 0.35);
}

.section-hdr-title .nem-tt,
.shape-label .nem-tt,
.shape-result-label .nem-tt,
.shape-risk-label .nem-tt,
.shape-stat-label .nem-tt,
.shape-forward-table thead th .nem-tt {
  display: inline-block;
  margin-left: 4px;
  vertical-align: baseline;
}

.shape-backtest-details {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px 12px;
  background: rgba(0, 0, 0, 0.12);
}

.shape-backtest-summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 10px 0;
  list-style: none;
  color: var(--text-muted);
}

.shape-backtest-summary::-webkit-details-marker {
  display: none;
}

.shape-backtest-summary-title {
  flex: 0 0 auto;
}

.shape-backtest-summary-hint {
  flex: 1 1 220px;
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--text-dim);
  line-height: 1.35;
}

.shape-pricer-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}

.shape-pricer-results-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.shape-simulate-this-prominent {
  font-weight: 600;
}

.shape-pricer-export-row {
  justify-content: flex-end;
}

.shape-risk-analytics-details {
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px 12px;
  background: rgba(0, 0, 0, 0.12);
}

.shape-risk-analytics-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 10px 0;
  list-style: none;
  color: var(--text-muted);
}

.shape-risk-analytics-summary::-webkit-details-marker {
  display: none;
}

.shape-risk-analytics-details .shape-risk-analytics-panel {
  margin-top: 0;
}

.shape-nested-panel.panel {
  box-shadow: none;
  border: none;
  padding-left: 0;
  padding-right: 0;
}

.shape-pricer-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shape-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.shape-pricer-results {
  min-height: 200px;
}

.shape-pricer-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.shape-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.shape-result-primary {
  border-color: var(--accent);
  background: rgba(88,166,255,0.05);
}

.shape-result-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.shape-result-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}

.shape-result-sub {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-top: 2px;
}

.shape-val-positive {
  color: var(--positive);
}

.shape-val-negative {
  color: var(--negative);
}

.shape-val-hot {
  color: var(--amber);
}

.shape-risk-metrics {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.shape-risk-title {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  font-weight: 600;
}

.shape-risk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.shape-risk-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shape-risk-label {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.shape-risk-val {
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
}

.shape-sim-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-bottom: 16px;
}

.shape-sim-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shape-sim-results {
  min-height: 100px;
}

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

.shape-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.shape-stat-positive {
  border-color: rgba(63,185,80,0.4);
  background: rgba(63,185,80,0.05);
}

.shape-stat-negative {
  border-color: rgba(248,81,73,0.4);
  background: rgba(248,81,73,0.05);
}

.shape-stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.shape-stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}

.shape-chg-up {
  color: var(--positive);
}

.shape-chg-down {
  color: var(--negative);
}

.shape-chg-flat {
  color: var(--text-dim);
}

.shape-data-table {
  width: 100%;
}

.shape-seasonal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.shape-seasonal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color 0.2s;
}

.shape-seasonal-card:hover {
  border-color: var(--border-light);
}

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

.shape-seasonal-region {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.shape-seasonal-block {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
}

.shape-seasonal-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shape-sparkline {
  flex-shrink: 0;
}

.shape-seasonal-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shape-seasonal-price {
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
}

.shape-custom-dates {
  transition: all 0.2s;
}

@media (max-width: 900px) {
  .shape-block-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .shape-pricer-layout {
    grid-template-columns: 1fr;
  }

  .shape-sim-layout {
    grid-template-columns: 1fr;
  }

  .shape-risk-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shape-sim-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .shape-pricer-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .shape-block-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .shape-form-row {
    grid-template-columns: 1fr;
  }

  .shape-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .shape-risk-grid {
    grid-template-columns: 1fr 1fr;
  }

  .shape-sim-stats {
    grid-template-columns: 1fr;
  }
}

.shape-asx-reference {
  margin-bottom: 12px;
}
.shape-asx-ref-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(88,166,255,0.08);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85em;
}
.shape-asx-ref-label {
  color: #8b949e;
  font-size: 0.85em;
}
.shape-asx-ref-price {
  color: #58a6ff;
  font-weight: 700;
  font-size: 1.1em;
}
.shape-asx-ref-contract {
  color: #6e7681;
  font-size: 0.8em;
}
.shape-asx-ref-compare {
  margin-top: 6px;
  font-size: 0.85em;
  color: #c9d1d9;
}

.shape-suggested-strikes,
.shape-sim-scenarios {
  margin: 8px 0 12px;
}
.shape-strike-suggestions,
.shape-sim-scenario-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.shape-strike-label {
  color: #8b949e;
  font-size: 0.82em;
  margin-right: 4px;
}
.shape-strike-btn {
  background: rgba(110,118,129,0.15);
  border: 1px solid rgba(110,118,129,0.3);
  color: #c9d1d9;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8em;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background 0.15s, border-color 0.15s;
}
.shape-strike-btn:hover {
  background: rgba(88,166,255,0.15);
  border-color: rgba(88,166,255,0.4);
}
.shape-strike-btn.shape-strike-fv {
  background: rgba(63,185,80,0.12);
  border-color: rgba(63,185,80,0.3);
  color: #3fb950;
}
.shape-strike-btn.shape-strike-fv:hover {
  background: rgba(63,185,80,0.2);
}

.shape-sim-explainer {
  background: rgba(88,166,255,0.06);
  border: 1px solid rgba(88,166,255,0.15);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.shape-sim-explainer p {
  color: #8b949e;
  font-size: 0.82em;
  line-height: 1.5;
  margin: 0;
}

.shape-product-badge {
  display: inline-block;
  background: rgba(88,166,255,0.12);
  border: 1px solid rgba(88,166,255,0.25);
  color: #58a6ff;
  font-size: 0.82em;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.shape-result-dollar {
  border-color: rgba(255,170,0,0.3);
  background: rgba(255,170,0,0.05);
}

.shape-overview-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  align-items: flex-end;
}

.shape-overview-group {
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.35);
  margin-bottom: 16px;
  overflow: hidden;
}
.shape-overview-group-summary {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text, #e6edf3);
  background: rgba(22, 27, 34, 0.85);
  border-bottom: 1px solid rgba(48, 54, 61, 0.45);
  user-select: none;
}
.shape-overview-group-summary::-webkit-details-marker {
  display: none;
}
.shape-overview-group-title::before {
  content: "\25b6";
  display: inline-block;
  margin-right: 8px;
  font-size: 0.65em;
  color: #8b949e;
  transition: transform 0.15s ease;
  vertical-align: middle;
}
.shape-overview-group[open] .shape-overview-group-title::before {
  transform: rotate(90deg);
}
.shape-overview-group-title {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.shape-overview-group-hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: #8b949e;
  flex: 1 1 100%;
}
@media (min-width: 640px) {
  .shape-overview-group-hint {
    flex: 0 1 auto;
    margin-left: auto;
  }
}
.shape-overview-group-body {
  padding: 12px 12px 4px;
}
.shape-overview-group-body > .shape-section.panel {
  margin-bottom: 12px;
}

.shape-risk-analytics-panel {
  margin-top: 20px;
}

.shape-risk-analytics {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.shape-analytics-title {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  font-weight: 600;
}

.shape-corr-table td {
  text-align: center;
  font-size: 0.8em;
  font-family: var(--font-mono);
}

.shape-corr-high { color: #f85149; }
.shape-corr-med { color: #ffaa00; }
.shape-corr-low { color: #3fb950; }

.shape-gen-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.shape-gen-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.shape-gen-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.shape-gen-card-stat {
  font-size: 0.82em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 3px;
}

.shape-gen-corr {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.shape-gen-corr-title {
  font-size: 0.72em;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.shape-gen-corr-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8em;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 1px 0;
}

.shape-gen-source {
  font-size: 0.72em;
  color: #6e7681;
  margin-top: 8px;
  text-transform: capitalize;
}

.shape-heatmap-fallback-note {
  font-size: var(--text-xs);
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.shape-heatmap-title {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.shape-heatmap-table {
  border-collapse: collapse;
}

.shape-heatmap-table td,
.shape-heatmap-table th {
  padding: 5px 8px;
}

@media (max-width: 900px) {
  .shape-gen-analysis-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .shape-gen-analysis-grid {
    grid-template-columns: 1fr;
  }
}

.shape-hm-clickable td.shape-hm-cell:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(88,166,255,0.2) !important;
}

.shape-pricer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.shape-simulate-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.shape-simulate-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(88,166,255,0.08);
}

.shape-quick-quote-panel {
  margin-top: 16px;
}

.shape-quick-quote-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.shape-qq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(88,166,255,0.04);
}

.shape-qq-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.shape-qq-copy-btn {
  background: var(--cta);
  color: #0d1117;
  border: none;
  padding: 5px 14px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  letter-spacing: 0.02em;
}

.shape-qq-copy-btn:hover {
  opacity: 0.85;
}

.shape-qq-actions {
  display: flex;
  gap: 6px;
}

.shape-qq-oneliner {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: rgba(88,166,255,0.04);
}

.shape-qq-text {
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-primary);
}

.shape-arb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.shape-arb-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.shape-arb-item:hover {
  border-color: var(--border-light);
}

.shape-arb-block {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: 6px;
}

.shape-arb-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.shape-arb-region {
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-mono);
}

.shape-arb-arrow {
  color: var(--text-dim);
  font-size: 1rem;
}

.shape-arb-spread {
  font-size: var(--text-xs);
  color: var(--amber);
  font-weight: 600;
  font-family: var(--font-mono);
}

.shape-has-tooltip,
.shape-result-label[title],
.shape-risk-label[title],
.shape-stat-label[title],
.shape-data-table th[title] {
  cursor: help;
  border-bottom: 1px dotted var(--text-dim);
}

.shape-extreme-row {
  background: rgba(255,85,85,0.08) !important;
}

.shape-extreme-badge {
  display: inline-block;
  background: rgba(255,85,85,0.15);
  color: #ff5555;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.shape-hm-dod {
  display: inline-block;
  font-size: 9px;
  line-height: 1;
  vertical-align: middle;
}

.shape-highlight-flash {
  animation: todFlash 1.5s ease-out;
}

@keyframes todFlash {
  0% { box-shadow: 0 0 0 3px rgba(74,158,255,0.6); }
  100% { box-shadow: none; }
}

@media (max-width: 600px) {
  .shape-arb-list {
    grid-template-columns: 1fr;
  }
  .shape-pricer-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

.shape-explainer-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(88,166,255,0.04);
  border: 1px solid rgba(88,166,255,0.12);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.shape-explainer-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}
.shape-explainer-text {
  font-size: 0.84em;
  color: #8b949e;
  line-height: 1.55;
}
.shape-explainer-text strong {
  color: #c9d1d9;
}

.shape-tenor-select {
  min-width: 200px;
}
.shape-tenor-select optgroup {
  font-weight: 700;
  font-size: 0.9em;
  color: #8b949e;
  background: #161b22;
  padding: 4px 0;
}
.shape-tenor-select option {
  font-weight: 400;
  color: #c9d1d9;
  padding: 3px 8px;
}
.shape-tenor-select option.shape-tenor-settled {
  color: #6e7681;
  font-style: italic;
}

.shape-block-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}
.shape-block-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
  background: var(--bg-card-hover);
}
.shape-block-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #b1bac4;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  line-height: 1.35;
}
.shape-block-card-price {
  font-size: clamp(1.45rem, 2.4vw, 1.75rem);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.shape-block-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9375rem;
  color: #c9d1d9;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
  line-height: 1.45;
}
.shape-block-card-meta span {
  font-weight: 600;
}
.shape-block-card-range {
  font-size: 0.875rem;
  color: #b1bac4;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.shape-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.2s;
}
.shape-result-card:hover {
  border-color: var(--border-light);
}
.shape-result-primary {
  border-color: rgba(63,185,80,0.3);
  background: rgba(63,185,80,0.04);
}
.shape-result-primary .shape-result-value {
  font-size: 1.3rem;
  color: #3fb950;
}

.shape-contract-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(88,166,255,0.08);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 0.78em;
  font-family: var(--font-mono);
  color: #58a6ff;
  margin-bottom: 10px;
}
.shape-contract-badge .shape-settled-tag {
  background: rgba(110,118,129,0.2);
  color: #8b949e;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}

.commodities-container {
  padding: 4px 0;
}
.commodity-groups {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  /* Without this, the shorter column (e.g. Environmental) stretches to the height of Fuel Inputs — big dead space under the last env cards */
  align-items: flex-start;
}
.commodity-group {
  flex: 1;
  min-width: min(280px, 100%);
}
.commodity-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(110,118,129,0.2);
}
.commodity-group-icon {
  font-size: 1.1em;
}
.commodity-group-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: var(--track-tight);
}
.commodity-cards {
  display: grid;
  /* auto-fit collapses empty tracks; auto-fill leaves phantom columns (right-side dead space on phones) */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  width: 100%;
}
.commodity-card {
  background: var(--surface-tint-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.2s;
}
.commodity-card:hover {
  border-color: rgba(110,118,129,0.35);
}
.commodity-card.commodity-stale {
  opacity: 0.6;
}
.commodity-card-name {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.commodity-stale-badge {
  background: rgba(248, 81, 73, 0.15);
  color: var(--state-bad);
  font-size: var(--text-xs);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.commodity-spot-badge {
  background: rgba(63, 185, 80, 0.15);
  color: var(--state-good);
  font-size: var(--text-2xs);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: var(--track-tight);
}
.commodity-card-price {
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  margin-bottom: 2px;
}
.commodity-card-price.commodity-up { color: var(--state-good); }
.commodity-card-price.commodity-down { color: var(--state-bad); }
.commodity-card-unit {
  font-size: var(--text-2xs);
  color: var(--text-dim);
  margin-bottom: 6px;
}
.commodity-card-change {
  margin-bottom: 4px;
}
.commodity-change {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}
.commodity-change.commodity-up { color: var(--state-good); }
.commodity-change.commodity-down { color: var(--state-bad); }
.commodity-change.commodity-flat { color: var(--text-muted); }
.commodity-card-updated {
  font-size: var(--text-2xs);
  color: var(--text-dim);
  margin-bottom: 4px;
  font-style: italic;
}
.commodity-trend-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}
.commodity-trend-badge {
  font-size: var(--text-2xs);
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.commodity-trend-up {
  background: rgba(63, 185, 80, 0.12);
  color: var(--state-good);
}
.commodity-trend-down {
  background: rgba(248, 81, 73, 0.12);
  color: var(--state-bad);
}
.commodity-trend-flat {
  background: rgba(139, 148, 158, 0.12);
  color: var(--text-muted);
}
.commodity-sparkline-wrap {
  margin-bottom: 4px;
  line-height: 0;
}
.commodity-sparkline {
  display: block;
}
.commodity-card-meta {
  font-size: var(--text-2xs);
  color: var(--border-light);
}

.renewable-chart-container {
  min-height: 560px;
}

@media (max-width: 768px) {
  .commodity-groups {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

  /* Avoid flex:1 stretching each group to equal height (dead space under 6 cards) */
  .commodity-group {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
  }

  .commodity-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  /* Desktop min-height leaves a tall empty band on small viewports before Plotly paints */
  .renewable-chart-container {
    min-height: 280px;
  }
}
.renewable-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.renewable-controls--nav {
  align-items: center;
}
.renewable-nav-btns,
.renewable-window-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.renew-mode-label {
  font-size: var(--text-xs);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  cursor: pointer;
  user-select: none;
}
.renew-mode-label input {
  cursor: pointer;
}
.renewable-controls--custom {
  align-items: center;
}
.renewable-custom-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-right: 4px;
}
.renewable-custom-sep {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin: 0 4px;
}
.renew-input-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
}
.renewable-region-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.renewable-summary-container {
  margin-top: 10px;
}
.renewable-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.renewable-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
}
.renewable-fuel-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.renewable-metric-block {
  margin-top: 2px;
}
.renewable-metric-block--secondary {
  margin-top: 12px;
}
.renewable-metric-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.renewable-metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.2;
}
.renewable-fc-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.renewable-avg-label {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 6px;
}
.renewable-shortfall {
  margin-top: 6px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
}
.shortfall-critical {
  background: rgba(255,68,68,0.12);
  color: #ff4444;
  border: 1px solid rgba(255,68,68,0.3);
}
.shortfall-warning {
  background: rgba(255,170,0,0.12);
  color: #ffaa00;
  border: 1px solid rgba(255,170,0,0.3);
}
.shortfall-mild {
  background: rgba(139,148,158,0.12);
  color: #8b949e;
  border: 1px solid rgba(139,148,158,0.3);
}
.shortfall-ok {
  background: rgba(63,185,80,0.12);
  color: #3fb950;
  border: 1px solid rgba(63,185,80,0.3);
}

.des-curves-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.des-product-toggles {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px;
}
.des-product-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  color: #8b949e;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.15s;
}
.des-product-btn.active {
  background: rgba(255,255,255,0.08);
  color: #e6edf3;
}
.des-product-btn:hover {
  background: rgba(255,255,255,0.06);
}

/* ===== GREEN CURVES TAB ===== */

.green-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px 10px;
  flex-wrap: wrap;
}
.green-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.green-date-label {
  color: #7d8796;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
.green-date-input {
  min-width: 145px;
}
.green-refresh-btn {
  font-size: 10px;
  padding: 6px 12px;
}
.green-comparison-note {
  margin: 0 4px 12px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  background: rgba(12,17,30,0.55);
  color: #7d8796;
  font-size: 11px;
  font-family: var(--font-mono);
}
.green-spot-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  padding: 0 4px 14px;
}
.green-spot-card {
  background: linear-gradient(145deg, rgba(12,17,30,0.92), rgba(18,25,42,0.88));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.green-spot-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gc-accent, #888);
  opacity: 0.7;
}
.green-spot-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.green-spot-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #8b949e;
  margin-bottom: 2px;
}
.green-spot-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(63,185,80,0.15);
  color: #3fb950;
  vertical-align: middle;
  margin-left: 4px;
}
.green-spot-desc {
  font-size: 9px;
  color: #556;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.green-spot-price {
  font-size: 20px;
  font-weight: 700;
  color: #e6edf3;
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 6px;
}
.green-spot-change {
  font-size: 11px;
  font-family: var(--font-mono);
}
.green-spot-change.up { color: #3fb950; }
.green-spot-change.down { color: #ff6b6b; }
.green-spot-change.flat { color: #8b949e; }
.green-spot-trends {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.green-spot-trend {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.green-spot-trend.up { color: #3fb950; background: rgba(63,185,80,0.1); }
.green-spot-trend.down { color: #ff6b6b; background: rgba(255,107,107,0.1); }
.green-spot-trend.flat { color: #8b949e; background: rgba(139,148,158,0.08); }
.green-spot-sparkline {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}
.green-spot-meta {
  font-size: 9px;
  color: #445;
  margin-top: 6px;
}

.green-curves-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(620px, 1fr));
  gap: 16px;
  padding: 0 4px;
}
.green-product-card {
  background: linear-gradient(145deg, rgba(12,17,30,0.95), rgba(18,25,42,0.9));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.green-product-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}
.green-product-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.015);
}
.green-product-name {
  display: flex;
  align-items: center;
  gap: 10px;
}
.green-product-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.green-product-label {
  font-size: 15px;
  font-weight: 700;
  color: #e0e8f0;
  letter-spacing: 0.3px;
}
.green-product-sublabel {
  font-size: 11px;
  color: #556;
  font-weight: 400;
  margin-left: 8px;
}
.green-product-unit {
  font-size: 9.5px;
  color: #556;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255,255,255,0.04);
  padding: 2px 8px;
  border-radius: 4px;
}
.green-product-chart {
  height: 220px;
  padding: 8px 12px 10px;
}
.green-toggle-table {
  text-align: center;
  padding: 8px 18px;
  font-size: 11px;
  font-weight: 600;
  color: #556;
  cursor: pointer;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: color 0.2s, background 0.2s;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.green-toggle-table:hover {
  color: #8b949e;
  background: rgba(255,255,255,0.02);
}
.green-table-wrap {
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.green-summary-table-wrap {
  border-top: 1px solid rgba(255,255,255,0.04);
}
.green-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10.5px;
  font-family: var(--font-mono);
}
.green-tbl th {
  text-align: left;
  padding: 8px 9px;
  background: rgba(10,14,24,0.95);
  color: #778899;
  font-weight: 600;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(41,128,185,0.2);
  position: sticky;
  top: 0;
  z-index: 2;
}
.green-tbl td {
  padding: 6px 9px;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  white-space: nowrap;
  color: #b0b8c8;
}
.green-summary-tbl th:not(:first-child),
.green-summary-tbl td:not(:first-child) {
  text-align: right;
}
.green-summary-tbl th:first-child,
.green-summary-tbl td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: rgba(12,17,30,0.98);
}
.green-summary-tbl th:first-child {
  z-index: 3;
  background: rgba(10,14,24,0.98);
}
.green-tbl tr:hover td {
  background: rgba(41,128,185,0.06);
}
.green-summary-tbl tr:hover td:first-child {
  background: rgba(21,31,48,0.98);
}
.green-tbl .green-tenor {
  font-weight: 600;
  color: #e0e8f0;
}
.green-tbl .green-price {
  font-weight: 700;
  color: #fff;
  font-size: 12px;
}
.green-change-up {
  color: #3fb950 !important;
}
.green-change-down {
  color: #ff6b6b !important;
}
.green-change-flat {
  color: #8b949e !important;
}
.green-change-na {
  color: #445 !important;
}

.green-compare-toggle-row {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}
.green-compare-btn {
  font-size: 11px;
  padding: 6px 18px;
  letter-spacing: 0.4px;
}
.green-combined-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 640px) {
  .green-toolbar {
    align-items: stretch;
  }
  .green-toolbar-controls {
    width: 100%;
  }
  .green-date-input {
    flex: 1;
  }
  .green-spot-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .green-curves-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .green-product-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* Cap Analysis */
.cap-confidence-banner {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
}
.cap-conf-high { background: rgba(52,211,153,0.15); color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
.cap-conf-medium { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.cap-conf-low { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

.cap-decomp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cap-decomp-table th,
.cap-decomp-table td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(48,54,61,0.5);
}
.cap-decomp-table th {
  text-align: right;
  color: #8b949e;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cap-decomp-table th:first-child,
.cap-decomp-table td:first-child {
  text-align: left;
}
.cap-decomp-table tfoot td {
  font-weight: 700;
  border-top: 2px solid rgba(48,54,61,0.8);
  border-bottom: none;
}
.cap-bucket-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.cap-methodology-note {
  font-size: 12.5px;
  line-height: 1.7;
  color: #8b949e;
  max-width: 720px;
}
.cap-methodology-note p { margin-bottom: 10px; }
.cap-methodology-note strong { color: #c9d1d9; }
.cap-decomp-grid { min-height: 80px; }

.cap-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}
.cap-kpi-card {
  text-align: left;
  padding: 11px 12px;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.cap-kpi-card:hover {
  transform: translateY(-1px);
  border-color: rgba(56,189,248,0.35);
}
.cap-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #8b949e;
  margin-bottom: 6px;
}
.cap-kpi-value {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 700;
  color: #e6edf3;
}
.cap-kpi-sub {
  margin-top: 6px;
  font-size: 11px;
  color: #8b949e;
}

.cap-kpi-card--cov-good {
  border-color: rgba(52, 211, 153, 0.35);
}

.cap-kpi-card--cov-warn {
  border-color: rgba(251, 191, 36, 0.4);
}

.cap-kpi-card--cov-bad {
  border-color: rgba(248, 113, 113, 0.45);
}

.cap-kpi-card--impl-ok {
  border-color: rgba(52, 211, 153, 0.35);
}

.cap-kpi-card--impl-warn {
  border-color: rgba(251, 191, 36, 0.45);
}

.cap-kpi-card--winsor-warn {
  border-color: rgba(251, 191, 36, 0.45);
}

.cap-decomp-meta-row td {
  font-size: 11px;
  color: #8b949e;
  font-style: italic;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
}

.cap-tenor-panel {
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 10px;
  padding: 10px;
  background: rgba(13, 17, 23, 0.35);
}
.cap-tenor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.cap-tenor-title {
  font-size: 12px;
  color: #c9d1d9;
  font-weight: 700;
}
.cap-tenor-sub {
  font-size: 11px;
  color: #8b949e;
}
.cap-tenor-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
}
.cap-tenor-matrix th {
  color: #8b949e;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}
.cap-tenor-year {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  min-width: 44px;
}
.cap-tenor-cell {
  width: 100%;
  border: 1px solid rgba(148,163,184,0.2);
  background: rgba(17, 24, 39, 0.72);
  border-radius: 8px;
  padding: 7px 6px;
  color: #d1d5db;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.2s ease;
}
.cap-tenor-cell:hover {
  border-color: rgba(56, 189, 248, 0.55);
  transform: translateY(-1px);
}
.cap-tenor-cell.is-active {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25) inset;
}
.cap-tenor-empty {
  opacity: 0.35;
  cursor: not-allowed;
}
.cap-tenor-cell-main {
  display: block;
  font-size: 12px;
  font-weight: 700;
}
.cap-tenor-cell-sub {
  display: block;
  font-size: 10px;
  margin-top: 2px;
  color: #94a3b8;
}

.cap-decomp-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(420px, 1.4fr);
  gap: 12px;
  align-items: stretch;
  overflow: visible;
}
.cap-donut-chart {
  min-height: 300px;
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.35);
  overflow: visible;
  padding: 8px 4px 12px;
  box-sizing: border-box;
}
.cap-donut-chart .js-plotly-plot,
.cap-donut-chart .plotly {
  overflow: visible;
}

.cap-confidence-detail {
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(13, 17, 23, 0.35);
}
.cap-confidence-head {
  margin-bottom: 8px;
}
.cap-confidence-title {
  font-weight: 700;
  color: #e5e7eb;
  font-size: 13px;
  margin-bottom: 6px;
}
.cap-confidence-bar {
  height: 7px;
  background: rgba(148,163,184,0.18);
  border-radius: 999px;
  overflow: hidden;
}
.cap-confidence-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ef4444 0%, #fbbf24 50%, #34d399 100%);
}
.cap-confidence-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}
.cap-confidence-meta div {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 8px;
  padding: 7px 8px;
}
.cap-confidence-meta span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: #94a3b8;
}
.cap-confidence-meta strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #e2e8f0;
}

.cap-pct-track {
  position: relative;
  width: 100%;
  min-width: 130px;
  height: 18px;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  overflow: hidden;
}
.cap-pct-track span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
}
.cap-pct-track em {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
  font-style: normal;
  line-height: 18px;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
}
.cap-decomp-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

.cap-history-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

/* Cap Analysis — merged Market context (regions + history) */
.cap-context-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.15fr);
  gap: 16px;
  align-items: start;
}
.cap-context-col-title {
  font-size: 12px;
  font-weight: 700;
  color: #e5e7eb;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.cap-context-col-hint {
  font-size: 11px;
  color: #94a3b8;
  margin: 0 0 10px;
  line-height: 1.35;
}
.cap-context-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-bottom: 10px;
}
.cap-context-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cap-context-toolbar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #94a3b8;
}
.cap-context-chart.shape-chart-container {
  min-height: 300px;
  overflow: visible;
}
.cap-context-chart.shape-chart-container .js-plotly-plot,
.cap-context-chart.shape-chart-container .plotly {
  overflow: visible;
}
.cap-context-footnote {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.45;
  margin: 10px 0 0;
  max-width: 52em;
}
.cap-regional-matrix-wrap {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.35);
  overflow: auto;
}
.cap-regional-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.cap-regional-matrix-table th,
.cap-regional-matrix-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.cap-regional-matrix-table th:first-child,
.cap-regional-matrix-table td:first-child {
  text-align: left;
}
.cap-regional-matrix-table thead th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.45);
}
.cap-reg-matrix-row {
  cursor: pointer;
  transition: background 0.15s ease;
}
.cap-reg-matrix-row:hover {
  background: rgba(56, 189, 248, 0.06);
}
.cap-reg-matrix-row.is-active {
  background: rgba(56, 189, 248, 0.1);
  box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0.75);
}
.cap-reg-matrix-cell {
  display: inline-block;
  min-width: 52px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(248, 113, 113, calc(0.04 + (var(--heat) * 0.2)));
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.cap-reg-matrix-spdev {
  font-size: 11px;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.cap-base-view-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.cap-base-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.cap-base-card {
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(
    180deg,
    rgba(13, 17, 23, 0.88),
    rgba(13, 17, 23, calc(0.65 + (var(--heat) * 0.22)))
  );
  color: #e5e7eb;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
.cap-base-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}
.cap-base-card.is-active {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25) inset;
}
.cap-base-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
}
.cap-base-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #cbd5e1;
  margin-top: 4px;
}

.cap-heat-cell {
  display: inline-block;
  min-width: 74px;
  text-align: right;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(56, 189, 248, calc(0.06 + (var(--heat) * 0.22)));
}
.cap-tenor-row-active td {
  background: rgba(56, 189, 248, 0.06);
}

@media (max-width: 1080px) {
  .cap-decomp-layout {
    grid-template-columns: 1fr;
  }
  .cap-context-grid {
    grid-template-columns: 1fr;
  }
}

.pin-freshness-line { font-size: 12px; color: #8892b0; margin: 0 0 10px 0; }

/* R1 F-7: stale-tape / critical-freshness warning (same advisory styling as the structmon tape banner) */
.pin-tape-banner {
  margin: 0 0 10px 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  line-height: 1.4;
  background: color-mix(in srgb, var(--warn, #c9a227) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn, #c9a227) 35%, var(--border));
  color: var(--text);
}
.pin-hhi-trend-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #667;
  margin-bottom: 6px;
}
.pin-hhi-trend-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.pin-hhi-trend-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  font-size: 11px;
}
.pin-hhi-spark { color: #58a6ff; margin: 0 4px; flex-shrink: 0; }
.pin-trend-good { color: #3fb950; }
.pin-trend-bad { color: #ff7b72; }
.pin-expiry-title { font-size: 12px; margin: 12px 0 10px 0; color: #c8d4f0; }
.pin-expiry-list { list-style: none; padding: 0; margin: 0; }
.pin-expiry-item { padding: 6px 10px; margin-bottom: 6px; border-radius: 4px; font-size: 12px; }
.pin-expiry-high { background: rgba(255, 80, 80, 0.12); border-left: 3px solid #ff4444; }
.pin-expiry-med { background: rgba(255, 180, 80, 0.1); border-left: 3px solid #ffaa00; }

/* =================================================================
   NEM Overview — unified design grammar (phase-0 PLAN §6)
   Single source of truth for NEM-card chrome, typography, colours.
   ================================================================= */
:root {
  --nem-radius: 10px;
  --nem-radius-sm: 6px;
  --nem-pad-card: 12px 14px;
  --nem-pad-card-tight: 8px 10px;
  --nem-gap-row: 12px;
  --nem-gap-inner: 8px;
  --nem-card-bg: var(--bg-card);
  --nem-card-border: 1px solid var(--border);
  --nem-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  --nem-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --nem-caption-size: 11px;
  --nem-caption-track: 0.04em;
  --nem-body-size: 12px;
  --nem-accent: var(--accent);
  --nem-accent-weak: rgba(88, 166, 255, 0.12);
  --nem-accent-mid: rgba(88, 166, 255, 0.22);
  --nem-accent-strong: rgba(88, 166, 255, 0.35);
  --nem-delta-up: #58c27d;
  --nem-delta-up-bg: rgba(88, 194, 125, 0.12);
  --nem-delta-up-border: rgba(88, 194, 125, 0.35);
  --nem-delta-down: #f87171;
  --nem-delta-down-bg: rgba(248, 113, 113, 0.12);
  --nem-delta-down-border: rgba(248, 113, 113, 0.35);
  --nem-price-cool: #4fa3d1;
  --nem-price-neutral: #e6edf3;
  --nem-price-warm: #f5a97f;
  --nem-price-hot: #ed6b6b;
  --nem-price-critical: #c13b3b;
}

/* Unified card chrome — every NEM surface that reads as a "card" picks this up */
.nem-lens-card,
.nem-lens-panel > .nem-lens-card,
.nem-pd-card,
.nem-ol-card,
.nem-demand-rolling,
.nem-events-toolbar,
.nem-supply-scada-fuel,
.nem-supply-fuel-extra,
.nem-ds-total,
.nem-ds-region-row,
.nem-ds-stacked,
.nem-ds-rooftop,
.nem-supply-ic .nem-ic-chip,
.nem-analysis-form,
.nem-an-chart,
.nem-transfer-card {
  background: var(--nem-card-bg);
  border: var(--nem-card-border);
  border-radius: var(--nem-radius);
  box-shadow: var(--nem-card-shadow);
}

.nem-lens-panel {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: var(--nem-gap-row);
}
.nem-lens-heading {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
}
.nem-lens-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.nem-lens-toolbar .btn-ghost {
  font-size: 11px;
  padding: 3px 8px;
  line-height: 1.3;
}
.nem-lens-toolbar .nem-lens-export-csv[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.nem-lens-subheading {
  font-size: var(--nem-caption-size);
  text-transform: uppercase;
  letter-spacing: var(--nem-caption-track);
  color: var(--text-muted);
  margin: 0 0 6px;
}
.nem-lens-card {
  padding: var(--nem-pad-card);
}
.nem-lens-card .nem-lens-card-title {
  font-size: var(--nem-caption-size);
  text-transform: uppercase;
  letter-spacing: var(--nem-caption-track);
  color: var(--text-muted);
  margin-bottom: var(--nem-gap-inner);
}
.nem-lens-card .nem-lens-card-body {
  font-family: var(--nem-mono);
  font-size: var(--nem-body-size);
}

/* Panels relocated into hero slots should not re-double chrome */
.nem-hero-relocated {
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* NEM Phase 0 — graceful degradation overlays (phase-0-brief 12) */
.nem-stale {
  opacity: 0.72;
  filter: saturate(0.85);
}
.nem-dim {
  opacity: 0.65;
}

.nem-phase0-shell {
  margin-bottom: 12px;
}
.nem-stale-banner {
  background: rgba(255, 170, 0, 0.12);
  border: 1px solid rgba(255, 170, 0, 0.35);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
/* --- L0 sticky status bar: Row 1 price tiles + Row 2 system strip --- */
.nem-l0-status {
  display: flex;
  flex-direction: column;
  gap: var(--nem-gap-inner);
  padding: var(--nem-pad-card);
  background: var(--nem-card-bg);
  border: var(--nem-card-border);
  border-radius: var(--nem-radius);
  box-shadow: var(--nem-card-shadow);
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.nem-l0-row-prices {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--nem-gap-row);
}
.nem-l0-row-system {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nem-gap-inner);
  padding-top: var(--nem-gap-inner);
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  font-size: var(--nem-caption-size);
}
.nem-l0-clocks,
.nem-l0-system-pills,
.nem-l0-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nem-gap-inner);
  align-items: center;
}
.nem-l0-pill {
  font-size: var(--nem-caption-size);
  padding: 3px 8px;
  border-radius: var(--nem-radius-sm);
  background: var(--nem-accent-weak);
  border: 1px solid var(--nem-accent-mid);
  color: var(--text);
  font-family: var(--nem-mono);
  letter-spacing: 0.02em;
}
button.nem-l0-pill {
  cursor: pointer;
}
button.nem-l0-pill:hover {
  border-color: var(--nem-accent);
}
.nem-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-rows: minmax(360px, auto) minmax(200px, auto);
  gap: var(--nem-gap-row);
  margin-bottom: 14px;
}
.nem-hero-map { grid-column: 1; grid-row: 1; }
.nem-hero-wmn { grid-column: 2; grid-row: 1; }
.nem-hero-traj { grid-column: 1; grid-row: 2; }
.nem-hero-demand { grid-column: 2; grid-row: 2; }
.nem-hero-cell {
  border: var(--nem-card-border);
  border-radius: var(--nem-radius);
  padding: var(--nem-pad-card);
  background: var(--nem-card-bg);
  box-shadow: var(--nem-card-shadow);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.nem-hero-label {
  font-size: var(--nem-caption-size);
  text-transform: uppercase;
  letter-spacing: var(--nem-caption-track);
  color: var(--text-muted);
  margin-bottom: var(--nem-gap-inner);
  flex-shrink: 0;
}
.nem-hero-slot {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.nem-hero-slot.nem-hero-slot--map {
  overflow: visible;
  height: 100%;
  min-height: 340px;
}
.nem-phase-tag {
  font-size: 10px;
  opacity: 0.7;
}
.nem-hero-placeholder {
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px;
}
.nem-lens-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.nem-lens-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.nem-lens-tab:hover { border-color: var(--nem-accent); }
.nem-lens-tab.active {
  border-color: var(--nem-accent);
  background: var(--nem-accent-weak);
  color: var(--text);
}
.nem-lens-tab--locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.nem-lens-tab--upgrade {
  border-color: rgba(210, 168, 255, 0.45);
  cursor: pointer;
}
.nem-lens-tab--upgrade:hover {
  background: rgba(210, 168, 255, 0.08);
}
.nem-upgrade-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(210, 168, 255, 0.2);
  color: #e6d2ff;
}
.nem-shortcut-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.nem-shortcut-panel {
  max-width: 420px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.nem-shortcut-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.nem-shortcut-list {
  margin: 0 0 16px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}
.nem-shortcut-list kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}
.nem-an-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 10px 0 14px;
  font-size: 12px;
}
.nem-an-saved-lbl select {
  margin-left: 6px;
  min-width: 160px;
}
.nem-cmp-chks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 10px;
}
.nem-cmp-lbl {
  font-size: 11px;
  color: var(--text-muted);
}
.nem-cmp-plot-host {
  min-height: 200px;
}
.nem-cmp-spark {
  margin-bottom: 12px;
}
.nem-an-bulk-upgrade {
  border-style: dashed;
}
.nem-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.nem-drawer[hidden] {
  display: none !important;
}
.nem-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.nem-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(440px, 100vw - 40px);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.nem-drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.nem-drawer-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}
.nem-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}
.nem-drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}
.nem-drawer-footer .btn-ghost {
  font-size: 12px;
  padding: 5px 10px;
}
.nem-drawer-footer .nem-drawer-spacer { flex: 1; }
.nem-drawer-tabs {
  display: flex;
  gap: 2px;
  margin-top: 10px;
}
.nem-drawer-tab {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.nem-drawer-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.nem-drawer-compare-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.nem-drawer-compare {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 4px;
}
.nem-drawer-title { margin: 0; font-size: 15px; }
.nem-drawer-bread { display: flex; align-items: center; gap: 10px; }
.nem-drawer-h4 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 6px;
}
.nem-drawer-chart {
  background: var(--surface-elevated);
  padding: 8px;
  border-radius: 6px;
  color: var(--accent);
}
.nem-drawer-kv {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 13px;
}
.nem-drawer-kv .up { color: var(--nem-delta-down); }
.nem-drawer-kv .down { color: var(--nem-delta-up); }
.nem-drawer-tbl {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 12px;
}
.nem-drawer-tbl th, .nem-drawer-tbl td {
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.nem-drawer-notices { display: flex; flex-direction: column; gap: 10px; }
.nem-drawer-notice {
  padding: 8px 10px;
  background: var(--surface-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
}
.nem-drawer-notice-msg { margin-top: 4px; color: var(--text-muted); }

/* --- L0 region price tiles (Row 1, five big uniform cards) --- */
.nem-region-pill {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--nem-pad-card-tight);
  text-align: left;
  border-radius: var(--nem-radius);
  border: var(--nem-card-border);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: var(--nem-mono);
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
  box-shadow: var(--nem-card-shadow);
}
.nem-region-pill:hover { border-color: var(--nem-accent); }
.nem-region-pill:focus-visible { outline: 2px solid var(--nem-accent); outline-offset: -2px; }
.nem-region-pill__head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.nem-region-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.15;
}
.nem-region-price {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nem-region-delta { font-size: var(--nem-caption-size); margin-left: auto; font-variant-numeric: tabular-nums; }
.nem-region-delta.up { color: var(--nem-delta-down); }
.nem-region-delta.down { color: var(--nem-delta-up); }
.nem-region-pill__spark,
.nem-region-pill__sparks {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--text-muted);
  min-height: 48px;
}
.nem-region-pill__sparks--dual {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}
.nem-l0-spark-col {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nem-l0-spark-empty { font-size: 11px; color: var(--text-muted); }
.nem-l0-spark-tooltip {
  display: none;
  position: fixed;
  z-index: 20000;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--surface-elevated);
  border: 1px solid var(--nem-card-border);
  pointer-events: none;
  box-shadow: var(--nem-card-shadow);
}
.nem-region-pill__spark .nem-spark,
.nem-region-pill__sparks .nem-spark { width: 100%; max-width: 100%; }

/* --- L0 pill detail rows (pre-upgrade parity stats) --- */
.nem-region-pill__stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.nem-region-stat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  line-height: 1.25;
}
.nem-region-stat-row--foot { color: var(--text-muted); opacity: 0.85; }
.nem-region-stat-label {
  color: var(--text-muted);
  opacity: 0.7;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nem-region-stat-val {
  color: var(--text);
  font-weight: 500;
}
.nem-region-stat-sep {
  color: var(--text-muted);
  opacity: 0.35;
  padding: 0 1px;
}
.nem-region-stat--peak .nem-region-stat-label { display: none; }
/* Stats + dual sparks always visible (legacy spot-card parity). */
.nem-region-pill--simple .nem-region-pill__stats,
.nem-view-simple .nem-region-pill__stats {
  display: flex;
}
.nem-view-simple .nem-region-pill { gap: 6px; }

.nem-dh-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.nem-dh-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  gap: 12px;
  align-items: start;
}
@media (max-width: 900px) {
  .nem-dh-grid { grid-template-columns: 1fr; }
}
.nem-dh-plot-host { min-height: 280px; }
.nem-dh-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.nem-drawer-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px 0;
}
.nem-drawer-stat-label { color: var(--text-muted); flex-shrink: 0; }
.nem-drawer-stat-val { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.nem-pd-period-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 8px;
}
.nem-pd-period-card { margin-bottom: 14px; }
.nem-pd-narr {
  white-space: pre-wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0;
  line-height: 1.45;
}
.nem-pd-period-spreads { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.nem-events-rebids-wrap { margin: 12px 0; }

.nem-cmp-corr { margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.nem-cmp-corr-row { margin-bottom: 4px; }

/* --- Sparkline --- */
.nem-spark { vertical-align: middle; }
.nem-spark.nem-spark-up { color: var(--nem-delta-down); }
.nem-spark.nem-spark-down { color: var(--nem-delta-up); }

/* --- APC gauge --- */
.nem-apc-bar {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  font-size: 9px;
}
.nem-apc-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #62d37a, #f5c451);
}
.nem-apc-bar.nem-apc-high .nem-apc-fill { background: #f09c45; }
.nem-apc-bar.nem-apc-projected .nem-apc-fill { background: linear-gradient(90deg, #f5c451, #f09c45); }
.nem-apc-bar.nem-apc-projected { box-shadow: 0 0 0 1px rgba(240, 156, 69, 0.35) inset; }
.nem-apc-bar.nem-apc-breach .nem-apc-fill { background: #e6514e; animation: nem-pulse 1.6s infinite; }
.nem-apc-text {
  position: absolute;
  left: 4px;
  top: -1px;
  font-size: 9px;
  color: var(--text-muted);
}
@keyframes nem-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

/* --- Hero map LOR / constraint outlines (phase-0 DoD 7: operational stress) --- */
#nem-map-container .nem-state.nem-state-lor1 {
  stroke: #f5c451 !important;
  stroke-width: 3 !important;
  stroke-dasharray: 6 3;
}
#nem-map-container .nem-state.nem-state-lor2 {
  stroke: #f09c45 !important;
  stroke-width: 3.5 !important;
  stroke-dasharray: 6 2;
  animation: nem-pulse 2s infinite;
}
#nem-map-container .nem-state.nem-state-lor3 {
  stroke: #e6514e !important;
  stroke-width: 4 !important;
  animation: nem-pulse 1.2s infinite;
}
#nem-map-container .nem-state.nem-state-constraint:not(.nem-state-lor2):not(.nem-state-lor3) {
  stroke: #e6514e !important;
  stroke-width: 3 !important;
  stroke-dasharray: 3 2;
}

/* --- Hero below-fold strips (gen-mix + FCAS summary) -------------------- */
.nem-hero-belowfold {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--nem-gap-cards);
  margin-top: var(--nem-gap-cards);
}
.nem-hero-strip {
  border: var(--nem-card-border);
  border-radius: var(--nem-radius);
  background: var(--surface-elevated);
  padding: var(--nem-pad-card-tight);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--nem-card-shadow);
}
.nem-hero-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.nem-hero-strip-title {
  font-size: var(--nem-caption-size);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--nem-caption-track);
  font-weight: 600;
}
.nem-hero-strip-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  opacity: 0.75;
}

/* Generation-mix rows */
.nem-hero-genmix-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nem-gm-row {
  display: grid;
  grid-template-columns: 48px 1fr 72px 64px;
  align-items: center;
  gap: 8px;
  font-family: var(--nem-mono);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  border-radius: 4px;
  transition: background 0.1s;
}
.nem-gm-row:hover { background: rgba(255,255,255,0.03); }
.nem-gm-region {
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.nem-gm-bar {
  display: flex;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}
.nem-gm-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1px;
  height: 100%;
  color: rgba(0,0,0,0.85);
  font-size: 9.5px;
  font-weight: 600;
  overflow: hidden;
  transition: filter 0.15s;
}
.nem-gm-seg:hover { filter: brightness(1.15); }
.nem-gm-seg--empty { background: rgba(255,255,255,0.05); width: 100%; }
.nem-gm-seg-pct { text-shadow: 0 0 2px rgba(255,255,255,0.35); }
.nem-gm-total {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.nem-gm-ren {
  color: var(--text-muted);
  font-size: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nem-gm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
}
.nem-gm-key { display: inline-flex; align-items: center; gap: 4px; }
.nem-gm-swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }

/* FCAS summary grid */
.nem-hero-fcas-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--nem-mono);
  font-size: 10.5px;
}
.nem-fcas-row {
  display: grid;
  grid-template-columns: 40px repeat(10, minmax(0, 1fr));
  gap: 2px;
  align-items: center;
  padding: 3px 0;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: center;
  border-radius: 3px;
  transition: background 0.1s;
}
.nem-fcas-row:hover { background: rgba(255,255,255,0.04); }
.nem-fcas-head {
  color: var(--text-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: default;
  background: transparent !important;
}
.nem-fcas-rlbl {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.nem-fcas-cell {
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.nem-fcas-cell--empty { color: var(--text-muted); opacity: 0.35; }

@media (max-width: 1024px) {
  .nem-hero-belowfold { grid-template-columns: 1fr; }
}

/* Cumulative tab chart container */
.nem-drawer-chart--cum { min-height: 170px; margin: 8px 0 12px; }
.nem-cumulative-svg { display: block; width: 100%; max-width: 100%; height: auto; }

/* --- WMN severity chips, resolved chip, share button (T1.7) -------------- */
.nem-wmn-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-right: 4px; }
.nem-wmn-chip {
  display: inline-flex;
  align-items: center;
  height: 14px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--nem-mono);
  border: 1px solid transparent;
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.nem-wmn-chip--spike    { background: rgba(230,81,78,0.15); border-color: rgba(230,81,78,0.4); color: #ffb4b2; }
.nem-wmn-chip--move     { background: rgba(245,196,81,0.15); border-color: rgba(245,196,81,0.4); color: #f5c451; }
.nem-wmn-chip--neg      { background: rgba(88,166,255,0.15); border-color: rgba(88,166,255,0.35); color: #8ab7ff; }
.nem-wmn-chip--low      { background: rgba(111,179,122,0.12); border-color: rgba(111,179,122,0.35); color: #8ad3a1; }
.nem-wmn-chip--trip     { background: rgba(230,81,78,0.1); border-color: rgba(230,81,78,0.3); color: #ffb4b2; }
.nem-wmn-chip--rebid    { background: rgba(184,136,214,0.12); border-color: rgba(184,136,214,0.3); color: #d2a8ff; }
.nem-wmn-chip--pasa     { background: rgba(240,156,69,0.12); border-color: rgba(240,156,69,0.3); color: #f09c45; }
.nem-wmn-chip--notice   { background: rgba(245,196,81,0.1); border-color: rgba(245,196,81,0.3); color: #f5c451; }
.nem-wmn-chip--resolved { background: rgba(111,179,122,0.2); border-color: rgba(111,179,122,0.5); color: #8ad3a1; }

.nem-wmn-row { position: relative; align-items: flex-start; }
.nem-wmn-share {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
  align-self: center;
}
.nem-wmn-row:hover .nem-wmn-share,
.nem-wmn-row:focus-within .nem-wmn-share { opacity: 1; }
.nem-wmn-share:hover { color: var(--nem-accent); background: rgba(88,166,255,0.08); }

/* Lightweight toast (shared with drawer / lens share actions) */
.nem-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface-elevated);
  color: var(--text);
  border: var(--nem-card-border);
  border-radius: var(--nem-radius);
  padding: 8px 14px;
  font-size: 12px;
  box-shadow: var(--nem-card-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10000;
}
.nem-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Dispatch age traffic light --- */
.nem-age-green { border-color: rgba(98, 211, 122, 0.4); background: rgba(98, 211, 122, 0.08); }
.nem-age-amber { border-color: rgba(245, 196, 81, 0.4); background: rgba(245, 196, 81, 0.1); }
.nem-age-red { border-color: rgba(230, 81, 78, 0.5); background: rgba(230, 81, 78, 0.12); color: #ffb4b2; }
.nem-age-unknown { opacity: 0.75; }

/* --- System margin pill --- */
.nem-margin-adequate { color: #8ad3a1; }
.nem-margin-tight { color: #f5c451; }
.nem-margin-low { color: var(--nem-delta-down); }
.nem-l0-notices.nem-has-notices { border-color: rgba(245, 196, 81, 0.5); color: #f5c451; cursor: pointer; }

/* --- WMN feed --- */
.nem-wmn-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  font-size: 12px;
  padding-right: 4px;
}
.nem-wmn-row {
  display: grid;
  grid-template-columns: 10px 48px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.nem-wmn-row:hover { background: var(--surface-elevated); }
.nem-sev-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-top: 5px;
}
.nem-sev-critical .nem-sev-dot { background: #e6514e; }
.nem-sev-high .nem-sev-dot { background: #f09c45; }
.nem-sev-medium .nem-sev-dot { background: #f5c451; }
.nem-sev-info .nem-sev-dot { background: #58a6ff; }
.nem-wmn-when {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.nem-wmn-title { font-weight: 600; }
.nem-wmn-sub { color: var(--text-muted); }
.nem-wmn-group { margin-bottom: 8px; }
.nem-wmn-group-head {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 2px 6px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
}
.nem-wmn-group-critical .nem-wmn-group-head { color: #e6514e; border-bottom-color: rgba(230, 81, 78, 0.35); }
.nem-wmn-group-high .nem-wmn-group-head { color: #f09c45; border-bottom-color: rgba(240, 156, 69, 0.35); }
.nem-wmn-group-medium .nem-wmn-group-head { color: #f5c451; }
.nem-wmn-count { font-weight: 600; }
.nem-traj-fc-band { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.nem-traj-fc { color: var(--accent); }

/* --- Phase 2 Prices detail --- */
.nem-prices-detail { margin-top: 12px; }
.nem-pd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 900px) { .nem-pd-row { grid-template-columns: 1fr; } }
.nem-pd-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.nem-pd-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.nem-pd-body { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 12px; }
.nem-pd-tbl { width: 100%; border-collapse: collapse; }
.nem-pd-tbl th, .nem-pd-tbl td {
  padding: 4px 6px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.nem-pd-tbl th:first-child, .nem-pd-tbl td:first-child { text-align: left; }
.nem-pd-tbl th { color: var(--text-muted); font-weight: 500; font-size: 10px; }
.nem-pd-region {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.nem-pd-matrix-card { margin-bottom: 10px; }
.nem-pd-fcas-strip { overflow-x: auto; }
.nem-pd-strip-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.nem-pd-strip-cell {
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  text-align: center;
}
.nem-pd-strip-reg {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.nem-pd-matrix { overflow-x: auto; }
.nem-pd-matrix-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.nem-pd-matrix-tbl th, .nem-pd-matrix-tbl td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.nem-pd-matrix-tbl th:first-child, .nem-pd-matrix-tbl td:first-child { text-align: left; }
.nem-pd-matrix-tbl th { color: var(--text-muted); font-weight: 500; font-size: 10px; }
.nem-pd-matrix-row { cursor: pointer; }
.nem-pd-matrix-row:hover { background: rgba(88, 166, 255, 0.08); }
.nem-pd-matrix-row:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.nem-pd-halfhour-wrap { max-height: 280px; overflow-y: auto; }

/* --- TOD heatmap --- */
.nem-tod-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 10px;
  table-layout: fixed;
}
.nem-tod-tbl th {
  padding: 2px;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 9px;
}
.nem-tod-cell {
  padding: 3px 2px;
  text-align: center;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.3);
}
.nem-tod-empty { background: rgba(255,255,255,0.02); }
.nem-tod-date { color: var(--text-muted); padding-right: 6px; text-align: right; }

/* --- Phase 2 Events list --- */
.nem-events-list { margin-top: 8px; min-height: 200px; }
.nem-events-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.nem-events-filter-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.nem-ev-filt { font-size: 12px; color: var(--text); margin-right: 4px; }
.nem-ev-filt input { margin-right: 4px; vertical-align: middle; }
.nem-ev-group { margin-bottom: 14px; }
.nem-ev-group-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.nem-ev-count { color: var(--text-muted); font-weight: 400; margin-left: 6px; }
.nem-events-rows { display: flex; flex-direction: column; gap: 4px; outline: none; }
.nem-ev-row {
  display: grid;
  grid-template-columns: 10px 60px 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
}
.nem-ev-row:hover { border-color: var(--accent); cursor: pointer; }
.nem-ev-acked { opacity: 0.55; }
.nem-ev-when {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  color: var(--text-muted);
  font-size: 11px;
}
.nem-ev-title { font-weight: 600; }
.nem-ev-sub { color: var(--text-muted); font-size: 12px; }
.nem-ev-actions { display: flex; gap: 6px; }
.nem-ev-ack, .nem-ev-share {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.nem-ev-ack:hover, .nem-ev-share:hover { border-color: var(--accent); color: var(--text); }
.nem-ev-acked-tag {
  padding: 2px 8px;
  background: rgba(98, 211, 122, 0.15);
  color: #62d37a;
  border: 1px solid rgba(98, 211, 122, 0.35);
  border-radius: 4px;
  font-size: 10px;
}

/* --- Trajectory tile --- */
.nem-traj-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.nem-traj-col {
  padding: 6px;
  border-radius: 6px;
  background: var(--surface-elevated);
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}
.nem-traj-head { display: flex; gap: 6px; align-items: baseline; font-size: 12px; margin-bottom: 4px; }
.nem-traj-reg { color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.nem-traj-price { font-weight: 600; }
.nem-traj-delta.up { color: var(--nem-delta-down); }
.nem-traj-delta.down { color: var(--nem-delta-up); }
.nem-traj-spark { color: var(--accent); margin: 2px 0; }
.nem-traj-band { font-size: 10px; color: var(--text-muted); }

/* --- Demand pulse tile --- */
.nem-demand-top { font-size: 13px; margin-bottom: 6px; font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; }
.nem-demand-top strong { font-size: 16px; }
.nem-demand-sub { color: var(--text-muted); font-size: 11px; }
.nem-demand-chart { color: var(--accent); margin-bottom: 6px; }
.nem-demand-deltas { display: flex; gap: 6px; flex-wrap: wrap; }
.nem-demand-chip {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.nem-demand-chip .nem-demand-reg { color: var(--text-muted); }
.nem-demand-chip.up { color: var(--nem-delta-down); }
.nem-demand-chip.down { color: var(--nem-delta-up); }

/* --- Empty state --- */
.nem-empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px;
  text-align: center;
  line-height: 1.5;
}
.nem-empty-state .nem-empty-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* --- Preset UI --- */
.nem-preset-wrap { position: relative; }
.nem-preset-btn {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.nem-preset-btn:hover { border-color: var(--accent); }
.nem-preset-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 150px;
  padding: 4px;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.nem-preset-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
}
.nem-preset-opt:hover { background: var(--surface-elevated); }
.nem-preset-opt[aria-selected="true"] { color: var(--accent); }
.nem-preset-banner {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}
.nem-preset-banner .nem-link { background: transparent; border: none; color: var(--accent); cursor: pointer; text-decoration: underline; }
.nem-preset-banner .nem-banner-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; }

/* --- Modal (custom reorder) --- */
.nem-modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; }
.nem-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.nem-modal-panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  width: min(380px, 92vw);
}
.nem-preset-list { list-style: none; padding: 0; margin: 10px 0; }
.nem-preset-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--surface-elevated);
  margin-bottom: 4px;
  cursor: grab;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.nem-preset-list li:focus { outline: 2px solid var(--nem-accent, #58a6ff); outline-offset: 1px; }
.nem-preset-list li.nem-preset-dragging { opacity: 0.5; cursor: grabbing; }
.nem-preset-list button {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}
.nem-preset-list button:hover { border-color: var(--border); color: var(--text); }
.nem-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.nem-modal-actions .btn-primary {
  background: var(--accent);
  color: #0b0f19;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* --- Tooltip --- */
.nem-tt {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: help;
  border-bottom: 1px dotted var(--text-muted);
  padding: 0 2px;
}
.nem-tooltip {
  position: absolute;
  z-index: 10000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  max-width: 320px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.nem-tooltip strong { color: var(--accent); display: block; margin-bottom: 4px; }
.nem-tooltip p { margin: 4px 0; }
.nem-tooltip .nem-tt-why { color: #f5c451; font-size: 11px; }
.nem-tooltip .nem-tt-src { color: var(--text-muted); font-size: 10px; }

/* --- Coachmarks --- */
.nem-coach-host {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nem-coach-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  max-width: 420px;
  font-size: 13px;
  line-height: 1.5;
}
.nem-coach-card h4 { margin: 0 0 8px; }
.nem-coach-card ol { padding-left: 18px; margin: 8px 0 14px; }
.nem-coach-actions { display: flex; justify-content: flex-end; }

/* --- Toasts --- */
.nem-toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nem-toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  max-width: 340px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  animation: nem-toast-in 0.15s ease-out;
}
.nem-toast.warn { border-color: #f09c45; color: #f5c451; }
.nem-toast--leave { opacity: 0; transition: opacity 0.3s; }
@keyframes nem-toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Lens tabs polish (merged) --- */
.nem-lens-tab { font-family: var(--nem-mono); letter-spacing: 0.02em; }
.nem-lock { font-size: 10px; margin-left: 4px; }

/* --- Hero tuning (map slot) --- */
.nem-hero-hint { font-size: 10px; color: var(--text-muted); margin-left: 6px; }
.nem-hero-relocated { margin: 0 !important; }
#nem-hero-map-slot {
  overflow: visible;
  height: 100%;
  min-height: 340px;
  flex: 1;
  display: flex;
}
#nem-hero-map-slot > * {
  flex: 1;
  min-height: 0;
}
#nem-hero-map-slot #nem-map-container,
#nem-hero-map-slot #panel-nem-map {
  max-height: none;
  height: 100%;
  min-height: 340px;
  width: 100%;
}
#nem-hero-map-slot #nem-map-container svg,
#nem-hero-map-slot #panel-nem-map svg {
  width: 100%;
  height: auto;
  max-height: 100%;
}
.nem-l0-renshare {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}
.nem-l0-ws {
  display: block;
  font-size: 9px;
  color: #8ad3a1;
  margin-top: 1px;
}
.nem-demand-dual-spark {
  display: block;
  max-width: 100%;
}
.nem-demand-poe {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
}
.nem-demand-dual-spark .nem-demand-poe-band { fill: var(--text-muted); }
.nem-demand-dual-spark .nem-demand-poe-band.nem-demand-poe-synth { opacity: 0.10; }

/* --- Phase 2 Outlook lens --- */
.nem-outlook-panel { margin-top: 12px; min-height: 320px; }
.nem-ol-toolbar { margin-bottom: 10px; }
.nem-ol-horizon-label { font-size: 12px; color: var(--text-muted); }
.nem-outlook-grid-2col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 900px) { .nem-outlook-grid-2col { grid-template-columns: 1fr; } }
.nem-ol-chart-host { min-height: 220px; width: 100%; }
.nem-ol-pd-summary { margin-top: 8px; }
.nem-ol-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.nem-ol-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 900px) { .nem-ol-row { grid-template-columns: 1fr; } }
.nem-ol-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.nem-ol-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.nem-ol-body { font-size: 12px; }
.nem-ol-meta { font-size: 10px; color: var(--text-muted); margin-top: 6px; }

.nem-ol-pd-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.nem-ol-pd-row:last-child { border-bottom: 0; }
.nem-ol-pd-region { font-weight: 600; }
.nem-ol-pd-spark { min-width: 0; }
.nem-ol-pd-stats { display: flex; gap: 10px; font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 11px; color: var(--text-muted); }

.nem-ol-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nem-ol-chip {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
}
.nem-ol-chip.nem-delta-down { color: var(--nem-delta-down); border-color: var(--nem-delta-down-border); }
.nem-ol-chip.nem-delta-up { color: var(--nem-delta-up); border-color: var(--nem-delta-up-border); }

.nem-ol-tbl { width: 100%; border-collapse: collapse; font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 11px; }
.nem-ol-tbl th, .nem-ol-tbl td { padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--border); }
.nem-ol-tbl th:first-child, .nem-ol-tbl td:first-child { text-align: left; color: var(--text-muted); }
.nem-ol-tbl th { color: var(--text-muted); font-weight: 500; font-size: 10px; }

.nem-ol-lor-row {
  display: grid;
  grid-template-columns: 10px 60px 50px 80px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  margin-bottom: 4px;
}
.nem-ol-lor-when { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; color: var(--text-muted); font-size: 11px; }
.nem-ol-lor-region { font-weight: 600; }
.nem-ol-lor-type { color: var(--text-muted); font-size: 11px; }
.nem-ol-lor-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nem-ol-lor-row.nem-sev-critical { border-color: rgba(248,113,113,0.5); }
.nem-ol-lor-row.nem-sev-high { border-color: rgba(251,146,60,0.5); }

/* --- Phase 3 Demand / Supply lenses --- */
.nem-demand-panel, .nem-supply-panel { margin-top: 12px; min-height: 280px; }
.nem-demand-nem-plot { margin: 8px 0 14px; min-height: 200px; }
.nem-ds-region-row--empty { grid-template-columns: 80px 1fr !important; }
.nem-empty-inline { padding: 4px 0; font-size: 12px; }
.nem-skel {
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(148,163,184,0.08) 25%, rgba(148,163,184,0.18) 50%, rgba(148,163,184,0.08) 75%);
  background-size: 200% 100%;
  animation: nem-skel-shimmer 1.2s ease-in-out infinite;
}
.nem-skel-line { height: 14px; margin-bottom: 8px; max-width: 420px; }
.nem-skel-chart { height: 180px; margin-bottom: 10px; }
@keyframes nem-skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.nem-supply-gauge { margin-bottom: 12px; }
.nem-supply-gauge-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 6px; }
.nem-supply-donut-wrap { position: relative; width: 120px; height: 120px; }
.nem-donut-svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.nem-donut-bg { stroke: rgba(148,163,184,0.2); }
.nem-donut-fill { stroke: var(--accent); stroke-linecap: round; }
.nem-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  pointer-events: none;
}
.nem-supply-ic { margin-top: 14px; }
.nem-supply-ic-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 8px; }
.nem-supply-ic-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.nem-ic-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 140px;
  font-size: 13px;
}
.nem-ic-name { font-weight: 600; }
.nem-ic-dir { font-size: 12px; color: var(--text-muted); margin: 2px 0; }
.nem-ic-mw { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; }
.nem-ds-total {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.nem-ds-total-head { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.nem-ds-meta { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }
.nem-ds-total-chart svg { width: 100%; height: auto; }
.nem-ds-regions { display: grid; grid-template-columns: 1fr; gap: 6px; }
.nem-ds-region-row {
  display: grid;
  grid-template-columns: 60px 220px 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.nem-ds-region-name { font-weight: 600; }
.nem-ds-region-stat { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 11px; line-height: 1.4; }
.nem-ds-poe-label { font-size: 10px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.04em; }
.nem-ds-poe-vals { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 11px; }
@media (max-width: 900px) {
  .nem-ds-region-row { grid-template-columns: 1fr; }
  .nem-ds-region-spark { max-width: 100%; overflow-x: auto; }
}

.nem-ds-region-select { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.nem-ds-region-select select {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.nem-ds-stacked, .nem-ds-rooftop {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.nem-ds-stacked-title, .nem-ds-rooftop-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.nem-ds-stacked-svg { width: 100%; height: 200px; display: block; }
.nem-ds-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: 10px; color: var(--text-muted); }
.nem-ds-legend-chip { display: inline-flex; align-items: center; gap: 4px; }
.nem-ds-legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.nem-ds-rooftop-chart svg { width: 100%; height: auto; }

/* --- Phase 4 Event drawer --- */
.nem-ev-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.nem-ev-badge-resolved { background: var(--nem-delta-up-bg); color: var(--nem-delta-up); border: 1px solid var(--nem-delta-up-border); }
.nem-ev-badge-active { background: var(--nem-delta-down-bg); color: var(--nem-delta-down); border: 1px solid var(--nem-delta-down-border); }
.nem-ev-badge-active.nem-ev-badge-warning { background: rgba(240,156,69,0.18); color: #f5c451; border-color: rgba(240,156,69,0.4); }
.nem-ev-badge-active.nem-ev-badge-info { background: rgba(88,166,255,0.15); color: #7aaef7; border-color: rgba(88,166,255,0.35); }
.nem-chip-notice-critical { background: rgba(248,81,73,0.15); color: #f8a29f; border: 1px solid rgba(248,81,73,0.4); }
.nem-chip-notice-warning { background: rgba(240,156,69,0.18); color: #f5c451; border: 1px solid rgba(240,156,69,0.4); }
.nem-chip-notice-info { background: rgba(88,166,255,0.15); color: #7aaef7; border: 1px solid rgba(88,166,255,0.35); }
.nem-notice-hl {
  background: rgba(251,191,36,0.25);
  color: #fde68a;
  padding: 0 3px;
  border-radius: 2px;
}
.nem-drawer-notice-full {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 11px;
  max-height: 320px;
  overflow-y: auto;
}

/* --- Phase 5 Analysis lens --- */
.nem-analysis-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.nem-analysis-form label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--text-muted);
  gap: 4px;
}
.nem-analysis-form select, .nem-analysis-form input[type="date"] {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
}
.nem-an-bulk-lock { font-size: 11px; color: var(--text-muted); margin-left: 8px; }
.nem-an-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; font-size: 12px; }
@media (max-width: 700px) { .nem-an-stats-grid { grid-template-columns: 1fr 1fr; } }
.nem-an-stats-grid strong { display: block; font-size: 14px; }
.nem-an-chart {
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  min-height: 240px;
}
.nem-an-chart svg { width: 100%; height: auto; }
.nem-an-table-wrap { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.nem-an-tbl { width: 100%; border-collapse: collapse; font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 11px; }
.nem-an-tbl th, .nem-an-tbl td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--border); }
.nem-an-tbl th:first-child, .nem-an-tbl td:first-child { text-align: left; color: var(--text-muted); }
.nem-an-tbl th { position: sticky; top: 0; background: var(--bg-card); font-weight: 500; font-size: 10px; color: var(--text-muted); }

/* NEM view density + demand rolling + fuel mode */
.nem-view-simple .nem-detail-only { display: none !important; }
.nem-view-simple .nem-ds-poe { display: none !important; }
.nem-demand-rolling {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 11px;
}
.nem-rolling-title { font-weight: 600; margin-bottom: 6px; }
.nem-rolling-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.nem-rolling-cell { background: var(--surface-elevated); border-radius: 6px; padding: 6px 8px; }
.nem-rolling-chip { display: inline-block; margin: 2px 6px 2px 0; color: var(--text-muted); font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 10px; }
.nem-supply-scada-fuel, .nem-supply-fuel-extra { margin: 8px 0; font-size: 11px; }
.nem-fuel-snap-title { font-weight: 600; margin-bottom: 4px; }
.nem-fuel-snap-pcts { display: flex; flex-wrap: wrap; gap: 6px; }
.nem-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  font-size: 10px;
}
.nem-drawer-notice-meta { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.nem-tod-mode-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.nem-tod-mode {
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}
.nem-tod-mode.nem-tod-mode--active,
.nem-tod-mode.active {
  border-color: var(--nem-accent);
  color: var(--text);
  background: var(--nem-accent-weak);
}
.nem-tod-mode-label {
  font-size: var(--nem-caption-size);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--nem-caption-track);
  align-self: center;
  margin-right: 4px;
}
.nem-ol-scroll-x { overflow-x: auto; max-width: 100%; }
.nem-pasa-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}
.nem-badge-ok,
.nem-pasa-badge.nem-badge-ok {
  background: var(--nem-delta-up-bg);
  color: var(--nem-delta-up);
  border-color: var(--nem-delta-up-border);
}
.nem-badge-low,
.nem-pasa-badge.nem-badge-low {
  background: rgba(245, 196, 81, 0.12);
  color: #f5c451;
  border-color: rgba(245, 196, 81, 0.35);
}
.nem-badge-lor1,
.nem-pasa-badge.nem-badge-lor1 {
  background: rgba(240, 156, 69, 0.14);
  color: #f09c45;
  border-color: rgba(240, 156, 69, 0.4);
}
.nem-badge-lor2,
.nem-pasa-badge.nem-badge-lor2 {
  background: var(--nem-delta-down-bg);
  color: var(--nem-delta-down);
  border-color: var(--nem-delta-down-border);
}
.nem-badge-lor3,
.nem-pasa-badge.nem-badge-lor3 {
  background: rgba(193, 59, 59, 0.18);
  color: var(--nem-price-critical);
  border-color: rgba(193, 59, 59, 0.45);
  font-weight: 700;
}

/* Semantic price colour classes (PLAN §6) */
.nem-price-cool { color: var(--nem-price-cool); }
.nem-price-neutral { color: var(--nem-price-neutral); }
.nem-price-warm { color: var(--nem-price-warm); }
.nem-price-hot { color: var(--nem-price-hot); }
.nem-price-critical { color: var(--nem-price-critical); }

/* Force-hide legacy panels when the NEM phase-0 shell is mounted.
   The new lens drill panels (nem-prices-detail, nem-demand-panel,
   nem-supply-panel, nem-outlook-panel, nem-transfer-panel, nem-events-list)
   replace them. JS toggles `.nem-legacy-hidden` on each. */
.nem-legacy-hidden {
  display: none !important;
}

/* Transfer lens panel (new canonical) */
.nem-transfer-panel { margin-top: 12px; min-height: 280px; }
.nem-transfer-card {
  padding: var(--nem-pad-card);
  margin-bottom: var(--nem-gap-row);
}
.nem-transfer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--nem-gap-inner);
}
.nem-transfer-row {
  padding: 8px 10px;
  border-radius: var(--nem-radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  font-family: var(--nem-mono);
  font-size: var(--nem-body-size);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nem-transfer-name { font-weight: 600; }
.nem-transfer-dir {
  font-size: var(--nem-caption-size);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--nem-caption-track);
}
.nem-transfer-mw { font-size: 14px; font-variant-numeric: tabular-nums; }
.nem-transfer-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.nem-transfer-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--nem-accent);
}
.nem-transfer-bar-fill.nem-at-limit {
  background: var(--nem-delta-down);
}
.nem-transfer-history-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--nem-mono);
  font-size: var(--nem-caption-size);
}
.nem-transfer-history-tbl th,
.nem-transfer-history-tbl td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.nem-transfer-history-tbl th:first-child,
.nem-transfer-history-tbl td:first-child {
  text-align: left;
  color: var(--text-muted);
}
.nem-transfer-history-tbl th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 10px;
}

/* Responsive: 1024px breakpoint fills the gap between 900 and desktop */
@media (max-width: 1024px) {
  .nem-l0-row-prices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .nem-traj-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .nem-ds-region-row {
    grid-template-columns: 60px minmax(120px, 180px) 1fr 1fr;
  }
  .nem-drawer-panel {
    width: min(420px, 100vw - 40px);
  }
}
@media (max-width: 900px) {
  .nem-hero-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .nem-hero-map,
  .nem-hero-wmn,
  .nem-hero-traj,
  .nem-hero-demand {
    grid-column: 1;
    grid-row: auto;
  }
  .nem-l0-row-prices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nem-traj-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nem-l0-row-system {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Mobile polish pass: shared touch targets, dense trading controls, and wide data surfaces. */
@media (max-width: 600px) {
  .sub-tab-bar {
    position: relative;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: 28px;
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }

  .sub-tab-bar::-webkit-scrollbar {
    display: none;
  }

  .sub-tab-bar::after {
    content: '';
    position: sticky;
    right: 0;
    width: 28px;
    flex: 0 0 28px;
    align-self: stretch;
    pointer-events: none;
    background: linear-gradient(to right, transparent, var(--bg-primary));
  }

  .hamburger-btn,
  .mobile-menu-close,
  .sub-tab-btn,
  .btn-segment,
  .welcome-banner-close,
  .welcome-tour-btn,
  .welcome-dismiss-btn,
  .daily-wrap-btn,
  .asx-refresh-btn,
  .trade-filter-select,
  .trade-filter-clear,
  .vol-region-actions .btn,
  .vol-action-btn,
  .vol-view-btn,
  .vol-axis-btn,
  .vol-dyn-btn,
  .vs-action-btn,
  .vs-hist-btn,
  .vs-play-btn,
  .sm-btn,
  .sm-select,
  .sm-input,
  .sm-action-btn,
  .shape-simulate-btn,
  .shape-reset-btn,
  .shape-control-group select,
  .shape-control-group input,
  .eod-input,
  .eod-product-btn,
  .eod-rebuild-btn,
  #eod-confirm-structures-btn,
  .account-link,
  .logout-link {
    min-height: 40px;
    box-sizing: border-box;
  }

  input[type="date"],
  input[type="number"],
  input[type="text"],
  select {
    min-height: 40px;
  }

  .sub-tab-btn {
    padding: 8px 12px;
    min-width: max-content;
  }

  .mobile-menu-close,
  .welcome-banner-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    width: 40px;
    padding: 0;
  }

  .welcome-tour-btn,
  .welcome-dismiss-btn,
  .vol-region-actions .btn,
  #eod-confirm-structures-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .trading-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .asx-refresh-btn-wrap,
  .asx-refresh-btn {
    width: 100%;
  }

  .asx-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .asx-freshness-badge {
    margin-left: 0;
    width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #section-snapshot.panel > h2.section-hdr.collapsible-toggle {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: visible;
  }

  #section-snapshot .section-hdr-left,
  #section-snapshot .snapshot-header-trailing,
  #section-snapshot .snapshot-header-right,
  #section-snapshot .date-picker-wrap {
    width: 100%;
    max-width: 100%;
  }

  #section-snapshot .snapshot-header-trailing,
  #section-snapshot .snapshot-header-right {
    margin-left: 0;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
  }

  #section-snapshot .snapshot-header-trailing {
    display: flex;
  }

  #section-snapshot .snapshot-header-trailing .collapse-icon {
    margin-left: auto;
    align-self: center;
  }

  #daily-wrap-btn,
  #section-snapshot .date-picker-wrap,
  #section-snapshot .trading-date-picker,
  .snapshot-filter-bar.filter-bar,
  .snapshot-toggle-label {
    width: 100%;
  }

  #section-snapshot .date-picker-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .snapshot-toggle-label {
    min-height: 40px;
    justify-content: flex-start;
  }

  .vol-region-tabs,
  .vol-table-actions,
  #panel-vol-heatmap .panel-title,
  .vs-hist-controls,
  .vs-hist-presets,
  .vs-hist-actions,
  .vs-hist-date-wrap,
  .vs-hist-playback,
  .vol-display-toggle,
  .vol-view-toggle,
  .vol-axis-toggle,
  .vol-dynamics-toggle,
  .vol-fwd-shift,
  .vol-region-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    margin-left: 0;
  }

  .vol-region-tabs {
    align-items: stretch;
  }

  .vol-region-tabs .vol-region-btn {
    flex: 1 1 72px;
  }

  .vol-region-actions .btn,
  .vol-display-toggle .btn-segment,
  .vol-view-toggle .btn-segment,
  .vol-axis-toggle .btn-segment,
  .vol-dynamics-toggle .btn-segment,
  .vs-hist-presets .btn-segment,
  .vs-hist-actions .vs-action-btn,
  .vol-action-btn,
  .fwd-shift-go {
    flex: 1 1 118px;
  }

  .vol-fwd-shift {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-tint-1);
  }

  .vol-view-toggle {
    float: none;
    margin-top: 8px;
  }

  #panel-vol-heatmap .panel-title {
    align-items: stretch;
  }

  .login-card input[type="text"],
  .login-card input[type="password"],
  .login-card input[type="email"],
  .login-card button,
  .login-card input[type="submit"],
  .forgot-link {
    min-height: 40px;
    box-sizing: border-box;
  }

  .forgot-link {
    display: inline-flex;
    align-items: center;
  }

  .fwd-shift-label {
    flex: 0 0 100%;
  }

  .fwd-shift-input {
    flex: 1 1 80px;
    width: auto;
  }

  .vol-table-container,
  .vol-fwd-shift-results,
  .live-pivot-container,
  .live-pivot-scroll,
  .eod-marks-table-container,
  .eod-state-table-wrap,
  .shape-forward-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .vol-table-container::before,
  .live-pivot-container::before,
  .live-pivot-scroll::before,
  .eod-marks-table-container::before,
  .eod-state-table-wrap::before,
  .shape-forward-table-wrap::before,
  .sm-table-wrap::before {
    content: 'Swipe sideways to view more';
    display: block;
    position: sticky;
    left: 0;
    z-index: 2;
    padding: 6px 10px;
    font-size: 0.68rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
  }

  .shape-forward-table {
    min-width: 760px;
  }

  .eod-header,
  .eod-header-left,
  .eod-header-controls,
  .eod-export-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .eod-product-toggle,
  .eod-input,
  .eod-rebuild-btn {
    width: 100%;
  }

  .eod-product-btn {
    flex: 1 1 0;
  }

  .live-pivot-tbl,
  .eod-marks-tbl,
  .eod-tbl {
    min-width: 620px;
  }

  .shape-forward-table thead th,
  .shape-forward-table tbody td {
    padding: 8px 6px;
  }
}

@media (max-width: 560px) {
  .sm-toolbar,
  .sm-filters,
  .sm-summary,
  .sm-pagination,
  .sm-page-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .sm-select,
  .sm-input,
  .sm-btn {
    width: 100%;
  }

  .sm-table-wrap {
    border: none;
    background: transparent;
    overflow: visible;
  }

  .sm-table-wrap::before {
    display: none;
  }

  .sm-table,
  .sm-table thead,
  .sm-table tbody,
  .sm-table tr,
  .sm-table th,
  .sm-table td {
    display: block;
  }

  .sm-table thead {
    display: none;
  }

  .sm-table tbody {
    width: 100%;
  }

  .sm-table tr {
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: hidden;
  }

  .sm-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    white-space: normal;
    border-bottom: 1px solid rgba(48,54,61,0.55);
    text-align: right;
  }

  .sm-table td:last-child {
    border-bottom: none;
  }

  .sm-table td::before {
    content: attr(data-label);
    flex: 0 0 34%;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .sm-table td:empty::after {
    content: '—';
  }

  .sm-type,
  .sm-actions,
  .sm-iv-changes,
  .sm-iv-cell,
  .sm-premium-cell,
  .sm-pnl-cell {
    justify-content: flex-end;
    max-width: 60%;
    text-align: right;
  }

  .sm-actions {
    flex-wrap: wrap;
  }

  .sm-actions .sm-action-btn {
    flex: 1 1 96px;
  }

  .sm-legs-row {
    display: none !important;
  }

  .sm-legs-row.is-open {
    display: block !important;
  }

  .sm-legs-row td {
    display: block;
    text-align: left;
  }

  .sm-legs-row td::before {
    display: none;
  }

  .sm-legs-table {
    min-width: 720px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Commission page — Management tab
   ═══════════════════════════════════════════════════════════════════════════ */

.comm-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.comm-kpi {
  background: var(--card-bg, #1c1c2e);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px;
  padding: 16px 20px;
}

.comm-kpi-label {
  font-size: 11px;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.comm-kpi-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary, #e8e8f0);
  line-height: 1.2;
}

.comm-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .comm-charts-row { grid-template-columns: 1fr; }
}

.comm-chart-card {
  background: var(--card-bg, #1c1c2e);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px;
  padding: 16px 20px;
}

.comm-chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #bbb);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
}

.comm-chart-area { min-height: 160px; }
.comm-chart-empty {
  color: var(--text-muted, #888);
  font-size: 13px;
  padding: 32px 0;
  text-align: center;
}

.comm-bar-list { display: flex; flex-direction: column; gap: 10px; }

.comm-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 130px;
  align-items: center;
  gap: 10px;
}

@media (max-width: 600px) {
  .comm-bar-row { grid-template-columns: 1fr; gap: 4px; }
}

.comm-bar-label {
  font-size: 12px;
  color: var(--text-secondary, #bbb);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comm-bar-track {
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  height: 10px;
  overflow: hidden;
}

.comm-bar-fill {
  height: 100%;
  border-radius: 3px;
  min-width: 2px;
  transition: width .3s ease;
}

.comm-bar-val {
  font-size: 12px;
  color: var(--text-primary, #e8e8f0);
  text-align: right;
  white-space: nowrap;
}

.comm-bar-pct { color: var(--text-muted, #888); }

.comm-section-hdr {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #bbb);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 20px 0 10px;
}

.comm-bro-cell { font-weight: 600; color: var(--accent, #2563eb); }

.comm-channel-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.comm-channel-badge--confirmed_block { background: rgba(37,99,235,.2); color: #60a5fa; }
.comm-channel-badge--likely_rfq_print { background: rgba(124,58,237,.2); color: #a78bfa; }
.comm-channel-badge--likely_direct_screen { background: rgba(107,114,128,.2); color: #9ca3af; }

.comm-leg-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, .18);
  color: #fbbf24;
}
.comm-leg-badge--single {
  background: rgba(107,114,128,.18);
  color: #9ca3af;
}

.comm-desc-cell {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--text-primary, #e8e8f0);
}

/* Lens B locked placeholder */
.comm-lens-b-placeholder {
  margin-top: 24px;
  background: var(--card-bg, #1c1c2e);
  border: 1px dashed var(--border, rgba(255,255,255,.12));
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted, #888);
}

.comm-lens-b-icon { font-size: 28px; margin-bottom: 8px; }

.comm-lens-b-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary, #bbb);
}

.comm-lens-b-desc { font-size: 12px; max-width: 420px; margin: 0 auto; }

/* Methodology footnote */
.comm-footnote {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-muted, #888);
  line-height: 1.6;
  border-top: 1px solid var(--border, rgba(255,255,255,.06));
  padding-top: 12px;
}

/* ── Commission date-control bar ────────────────────────────────────────── */

.comm-date-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.comm-quick-btns {
  display: flex;
  gap: 4px;
}

.comm-quick-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255,255,255,.10));
  background: transparent;
  color: var(--text-secondary, #bbb);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.comm-quick-btn:hover {
  background: rgba(255,255,255,.07);
  color: var(--text-primary, #e8e8f0);
}

.comm-quick-btn.active {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}

.comm-date-pickers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.comm-date-label {
  font-size: 11px;
  color: var(--text-muted, #888);
  white-space: nowrap;
}

.comm-date-input {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255,255,255,.10));
  background: var(--input-bg, rgba(255,255,255,.04));
  color: var(--text-primary, #e8e8f0);
  font-size: 12px;
  cursor: pointer;
}

/* ── Commission time-series chart card ──────────────────────────────────── */

.comm-ts-card {
  background: var(--card-bg, #1c1c2e);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px;
  padding: 16px 20px 8px;
  margin-bottom: 20px;
}

/* ── Commission scrollable table wrappers (10-row window) ───────────────── */

.comm-table-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 380px;  /* ~10 rows × 38px */
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 6px;
  margin-bottom: 24px;
}

/* Sticky header inside scrollable wrapper */
.comm-table-scroll-wrap .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card-bg, #1c1c2e);
}
