/* ============================================================
   Dashboard — shared module chrome
   Scoped vars live under .dashboard so the header keeps its own theme.
   ============================================================ */
.dashboard {
  --d-bg:           #06060c;
  --d-panel:        rgba(18, 22, 34, 0.68);
  --d-panel-soft:   rgba(16, 19, 30, 0.52);
  --d-panel-strong: rgba(22, 28, 42, 0.78);
  --d-border:       rgba(255, 255, 255, 0.09);
  --d-border-strong:rgba(0, 200, 255, 0.48);
  --d-cyan:         #00c8ff;
  --d-cyan-soft:    rgba(0, 200, 255, 0.12);
  --d-green:        #25e985;
  --d-red:          #ff4f67;
  --d-orange:       #ffae42;
  --d-text:         #f4f7fb;
  --d-muted:        #7f8797;
  --d-muted-2:      #4e5668;
  --d-arrow:        #a8b4c5;
  --d-shadow:       0 18px 60px rgba(0, 0, 0, 0.42);
  --d-radius:       18px;
  --d-mono:         'JetBrains Mono', monospace;
  --d-ui:           'Inter', system-ui, sans-serif;
}

.dashboard, .dashboard * { box-sizing: border-box; }

.dashboard button,
.dashboard input,
.dashboard select,
.dashboard label {
  font: inherit;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    opacity 180ms ease;
}

.dashboard .material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ============================================================
   Grid layout
   ============================================================ */
.terminal-grid {
  display: grid;
  grid-template-columns: minmax(370px, 410px) minmax(420px, 1fr);
  gap: 18px;
  width: 100%;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  /* Each column scrolls on its own — hovering one never scrolls the other.
     Header is 64px, .main padding is 28px top/bottom. */
  max-height: calc(100vh - 64px - 56px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.col::-webkit-scrollbar { width: 8px; }
.col::-webkit-scrollbar-track { background: transparent; }
.col::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.18);
  border-radius: 999px;
}
.col::-webkit-scrollbar-thumb:hover { background: rgba(0, 200, 255, 0.36); }

.market-column        { position: relative; min-width: 0; }
.stats-column         { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.grid-area-settings   { min-width: 0; }
.grid-area-trade      { min-width: 0; }
.grid-area-logs       { min-width: 0; }

.column { display: grid; gap: 18px; min-width: 0; }

/* ============================================================
   Panel base (shared by every module's outer card)
   ============================================================ */
.dashboard .panel,
.dashboard .market-card,
.dashboard .metric-card,
.dashboard .strategy-card,
.dashboard .log-panel {
  border: 1px solid var(--d-border);
  border-radius: var(--d-radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    var(--d-panel);
  box-shadow: var(--d-shadow);
  backdrop-filter: blur(20px);
  color: var(--d-text);
}

.dashboard .panel { padding: 18px; }

.dashboard .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard .panel-title,
.dashboard .settings-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(90deg, var(--d-cyan) 0%, #ffffff 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-family: var(--d-ui);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dashboard .panel-title .material-symbols-rounded,
.dashboard .settings-section-title .material-symbols-rounded {
  color: var(--d-cyan);
  -webkit-text-fill-color: var(--d-cyan);
  font-size: 20px;
}

/* ============================================================
   Form fields (native baseline)
   ============================================================ */
.dashboard .field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.dashboard .field label,
.dashboard .table-label,
.dashboard .tile-label {
  color: var(--d-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.dashboard select,
.dashboard input[type="number"],
.dashboard input[type="text"],
.dashboard input[type="password"] {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--d-text);
  background: rgba(9, 12, 20, 0.82);
  outline: none;
}

.dashboard select {
  appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--d-arrow) 50%),
    linear-gradient(135deg, var(--d-arrow) 50%, transparent 50%);
  background-position: calc(100% - 23px) 16px, calc(100% - 17px) 16px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.dashboard select:hover,
.dashboard input[type="number"]:hover,
.dashboard input[type="text"]:hover,
.dashboard input[type="password"]:hover {
  border-color: rgba(0, 200, 255, 0.32);
  background-color: rgba(12, 17, 28, 0.92);
}

.dashboard select:hover { --d-arrow: #00c8ff; }

.dashboard select:focus,
.dashboard input[type="number"]:focus,
.dashboard input[type="text"]:focus,
.dashboard input[type="password"]:focus {
  border-color: rgba(0, 200, 255, 0.78);
  box-shadow: 0 0 0 4px rgba(0, 200, 255, 0.09);
}

.dashboard input[type="number"] {
  appearance: textfield;
  padding-right: 38px;
}

.dashboard input[type="number"]::-webkit-outer-spin-button,
.dashboard input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.dashboard .native-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   Custom select widget
   ============================================================ */
.select-widget { position: relative; z-index: 1; }

.select-trigger {
  display: grid;
  grid-template-columns: 1fr 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--d-text);
  background: linear-gradient(180deg, rgba(18, 24, 38, 0.94), rgba(8, 12, 22, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  cursor: pointer;
  outline: none;
}

.select-trigger:hover,
.select-widget.open .select-trigger {
  border-color: rgba(0, 200, 255, 0.42);
  background: linear-gradient(180deg, rgba(20, 30, 46, 0.96), rgba(9, 15, 26, 0.94));
  box-shadow:
    0 0 0 4px rgba(0, 200, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.select-trigger:disabled { cursor: not-allowed; opacity: 0.58; }

.select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.select-chevron {
  color: var(--d-arrow);
  font-size: 18px;
  transition: transform 180ms ease, color 180ms ease;
}

.select-widget.open .select-chevron {
  color: var(--d-cyan);
  transform: rotate(180deg);
}

.select-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(0, 200, 255, 0.22);
  border-radius: 14px;
  background: rgba(9, 13, 23, 0.98);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px);
  transform: translateY(-5px) scale(0.98);
  transform-origin: top;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  z-index: 30;
}

.select-widget.open .select-menu {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.select-option {
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: #dbe5f1;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.select-option:hover,
.select-option.active {
  color: #f8fcff;
  background: rgba(0, 200, 255, 0.12);
}

/* Coin picker variant */
.coin-picker { flex: 1 1 auto; min-width: 0; }

.coin-select-widget { min-width: 0; }

.coin-select-widget .select-trigger {
  min-height: 48px;
  height: auto;
  padding: 4px 2px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  grid-template-columns: minmax(0, 1fr) 16px;
  gap: 6px;
}

.coin-select-widget .select-trigger:hover,
.coin-select-widget.open .select-trigger {
  border-color: rgba(0, 200, 255, 0.22);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
}

.coin-select-widget .select-value { min-width: 0; }
.coin-select-widget .select-chevron { font-size: 16px; }
.coin-select-widget .select-menu { min-width: 174px; }

.coin-select-widget .select-option {
  height: auto;
  min-height: 44px;
  padding: 7px 8px;
}

.coin-face {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
}

.coin-face-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.12);
}

.coin-face-copy { min-width: 0; }

.coin-face-name {
  display: block;
  overflow: hidden;
  color: var(--d-text);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coin-face-symbol {
  display: block;
  color: var(--d-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.coin-select-widget .select-option .coin-face-logo {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  box-shadow: none;
}

.coin-select-widget .select-option .coin-face-name { font-size: 12px; }

/* ============================================================
   Number stepper
   ============================================================ */
.number-shell { position: relative; min-width: 0; }
.number-shell input[type="number"] { padding-right: 38px; }

.number-stepper {
  position: absolute;
  top: 5px;
  right: 6px;
  bottom: 5px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  width: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.number-stepper button {
  display: grid;
  place-items: center;
  border: 0;
  color: #9eacbd;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.number-stepper button:hover {
  color: var(--d-cyan);
  background: rgba(0, 200, 255, 0.12);
}

.number-stepper button:first-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.number-stepper .material-symbols-rounded { font-size: 15px; }

.number-shell.disabled input[type="number"] { opacity: 0.58; }
.number-shell.disabled .number-stepper { opacity: 0.45; pointer-events: none; }

/* ============================================================
   Market card
   ============================================================ */
.market-card {
  position: relative;
  overflow: visible;
  padding: 16px;
}

.market-card.active {
  border-color: rgba(0, 200, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(0, 200, 255, 0.12),
    0 18px 60px rgba(0, 0, 0, 0.46),
    0 0 34px rgba(0, 200, 255, 0.11);
}

.market-card.primary-market.active { border-color: rgba(0, 200, 255, 0.32); }

.market-card:hover { border-color: rgba(0, 200, 255, 0.32); }
.market-card.primary-market:hover { border-color: rgba(0, 200, 255, 0.55); }

.market-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.coin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.market-interval-field {
  width: 104px;
  flex: 0 0 104px;
  align-self: center;
}

.coin-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.coin-logo {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.12);
}

.coin-name {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.1;
}

.coin-symbol {
  color: var(--d-muted);
  font-size: 11px;
  font-weight: 700;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.active { color: var(--d-green); border: 1px solid rgba(37, 233, 133, 0.32); background: rgba(37, 233, 133, 0.1); }
.badge.paper  { color: var(--d-cyan);  border: 1px solid rgba(0, 200, 255, 0.34); background: rgba(0, 200, 255, 0.1); }
.badge.live   { color: var(--d-red);   border: 1px solid rgba(255, 79, 103, 0.34); background: rgba(255, 79, 103, 0.1); }

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.dashboard .question {
  min-height: 40px;
  color: #cbd5e3;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 16px;
}

.dashboard .question a { color: inherit; text-decoration: none; }
.dashboard .question a:hover,
.dashboard .question a:focus-visible {
  color: var(--d-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================
   Timer
   ============================================================ */
.timer-wrap {
  display: grid;
  place-items: center;
  position: relative;
  overflow: visible;
  padding: 24px 0 18px;
  margin: -10px 0 3px;
  isolation: isolate;
}

.timer {
  position: relative;
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: visible;
}

.timer::before {
  content: "";
  position: absolute;
  inset: -48px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.34) 0%, rgba(0, 200, 255, 0.15) 35%, rgba(0, 200, 255, 0.05) 55%, transparent 74%);
  filter: blur(18px);
  opacity: 0.82;
  z-index: 0;
  pointer-events: none;
  animation: timerAuraPulse 1.65s ease-in-out infinite;
}

.timer::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 999px;
  box-shadow:
    0 0 34px rgba(0, 200, 255, 0.34),
    0 0 72px rgba(0, 200, 255, 0.15);
  z-index: 1;
  pointer-events: none;
}

.timer svg {
  width: 168px;
  height: 168px;
  transform: rotate(-90deg);
  position: relative;
  z-index: 2;
  overflow: visible;
}

.timer circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.timer .track { stroke: rgba(255, 255, 255, 0.08); }

.timer .progress {
  stroke: var(--d-cyan);
  stroke-dasharray: 408;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 600ms ease, stroke 250ms ease;
}

.timer.danger .progress { stroke: var(--d-red); }
.timer.danger::before {
  background: radial-gradient(circle, rgba(255, 79, 103, 0.38) 0%, rgba(255, 79, 103, 0.16) 35%, rgba(255, 79, 103, 0.06) 55%, transparent 74%);
}
.timer.danger::after {
  box-shadow: 0 0 34px rgba(255, 79, 103, 0.36), 0 0 72px rgba(255, 79, 103, 0.16);
}

.timer-core {
  position: absolute;
  inset: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(3, 6, 12, 0.72);
  z-index: 3;
  box-shadow:
    0 0 24px rgba(0, 200, 255, 0.28),
    inset 0 0 26px rgba(0, 200, 255, 0.12);
}

.timer.danger .timer-core {
  box-shadow: 0 0 24px rgba(255, 79, 103, 0.3), inset 0 0 26px rgba(255, 79, 103, 0.14);
}

.timer-value {
  color: #f8fbff;
  font: 800 30px/1.08 var(--d-mono);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.07ch;
  min-width: 5.55ch;
  min-height: 1.18em;
  text-shadow: 0 0 14px rgba(0, 200, 255, 0.34);
}

.timer.danger .timer-value { text-shadow: 0 0 14px rgba(255, 79, 103, 0.4); }

.timer-slot {
  position: relative;
  flex: 0 0 0.72em;
  width: 0.72em;
  height: 1.18em;
  display: inline-block;
  overflow: hidden;
}

.timer-slot.separator {
  flex-basis: 0.3em;
  width: 0.3em;
}

.timer-digit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.08;
  text-align: center;
  transform: translateY(0);
  opacity: 1;
  will-change: transform, opacity;
}

.timer-digit.incoming { animation: timerDigitInDown 360ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.timer-digit.outgoing { animation: timerDigitOutDown 360ms cubic-bezier(0.22, 1, 0.36, 1) both; }

.timer-label {
  margin-top: 7px;
  color: var(--d-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
}

/* ============================================================
   Detail/spread rows + side cards
   ============================================================ */
.details-table {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-row,
.spread-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.detail-row.highlight {
  border-color: rgba(0, 200, 255, 0.22);
  background: rgba(0, 200, 255, 0.08);
}

.table-value {
  font-family: var(--d-mono);
  font-weight: 800;
  color: #eaf2fb;
  text-align: right;
}

.table-value.large  { font-size: 18px; }
.table-value.orange { color: var(--d-orange); }
.table-value.gain   { color: var(--d-green); }
.table-value.loss   { color: var(--d-red); }

.side-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.side-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.032);
  min-height: 104px;
  grid-template-rows: 22px 22px 22px;
}

.side-card.up   { border: 1px solid rgba(37, 233, 133, 0.38); }
.side-card.down { border: 1px solid rgba(255, 79, 103, 0.38); }

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 900;
}

.side-card.up   .side-title { color: var(--d-green); }
.side-card.down .side-title { color: var(--d-red); }

.quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--d-muted);
  font-size: 13px;
  font-weight: 700;
}

.quote-row strong {
  font: 800 14px/1 var(--d-mono);
  min-width: 46px;
  text-align: right;
}

#upAsk, #downAsk { color: #ff9ca9; }
#upBid, #downBid { color: #93f0bd; }

/* ============================================================
   Strategy settings panel
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.settings-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.settings-section + .settings-section { margin-top: 12px; }

.settings-split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}

.settings-split .settings-section { height: 100%; }
.settings-split .settings-section + .settings-section { margin-top: 0; }

.filter-section { container-type: inline-size; }

.filter-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-items: stretch;
  gap: 10px;
}

.filter-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  color: #cdd7e4;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.filter-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-mark {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.07);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.toggle-mark::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #8f9bae;
  transition: transform 180ms ease, background 180ms ease;
}

.filter-row input[type="checkbox"]:checked + .toggle-mark,
.check input[type="checkbox"]:checked + .toggle-mark {
  border-color: rgba(0, 200, 255, 0.38);
  background: rgba(0, 200, 255, 0.16);
  box-shadow: 0 0 18px rgba(0, 200, 255, 0.08);
}

.filter-row input[type="checkbox"]:checked + .toggle-mark::after,
.check input[type="checkbox"]:checked + .toggle-mark::after {
  transform: translateX(14px);
  background: var(--d-cyan);
}

.filter-subfield {
  width: 100%;
  padding-left: 0;
  grid-column: 2;
  grid-row: 2;
}

.block-repeat-row  { grid-column: 1; grid-row: 1; }
.time-filter-row   { grid-column: 1; grid-row: 2; }
.spread-filter-row { grid-column: 2; grid-row: 1; }

@container (max-width: 360px) {
  .filter-stack { grid-template-columns: 1fr; }
}

.telegram-grid { grid-template-columns: minmax(0, 300px); }

.telegram-grid input[type="text"] {
  max-width: 300px;
  background: rgba(41, 47, 59, 0.82);
  font-family: var(--d-mono);
  font-size: 11px;
}

.icon-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.icon-label .material-symbols-rounded,
.icon-label .label-svg { color: var(--d-cyan); }
.icon-label .material-symbols-rounded { font-size: 16px; }

.label-svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  stroke: currentColor;
}

/* ============================================================
   Field hint (?) icon + tooltip
   ============================================================ */
.field-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--d-muted);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
  flex: 0 0 16px;
  transition: border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
  z-index: 1;
}

.field-hint:hover {
  border-color: var(--d-cyan);
  color: var(--d-cyan);
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.3);
}

/* Tooltip — fixed position so it renders above all layout elements */
.field-hint-tooltip {
  position: fixed;
  background: rgba(16, 19, 30, 0.96);
  border: 1px solid rgba(0, 200, 255, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  color: #cdd7e4;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.field-hint-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Start button
   ============================================================ */
.start-button-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  margin-top: 16px;
}

.start-button-row::before,
.start-button-row::after { content: ""; min-width: 0; }

.start-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 260px;
  max-width: 100%;
  height: 48px;
  border: 1px solid rgba(37, 233, 133, 0.5);
  border-radius: 14px;
  color: #f5fff9;
  background: linear-gradient(135deg, rgba(37, 233, 133, 0.82), rgba(0, 200, 255, 0.72));
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(37, 233, 133, 0.14);
  overflow: hidden;
}

.start-button::before {
  content: "";
  position: absolute;
  inset: -80% auto -80% -55%;
  width: 46%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent);
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.start-button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 200, 255, 0.72);
  color: #ffffff;
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.9), rgba(37, 233, 133, 0.76));
  box-shadow: 0 18px 42px rgba(0, 200, 255, 0.2);
}

.start-button:hover::before {
  opacity: 1;
  animation: buttonShine 740ms ease;
}

.start-button.stop {
  border-color: rgba(255, 82, 82, 0.5);
  background: linear-gradient(135deg, rgba(255, 82, 82, 0.82), rgba(255, 140, 0, 0.72));
  box-shadow: 0 16px 34px rgba(255, 82, 82, 0.14);
}

.start-button.stop:hover {
  border-color: rgba(255, 140, 0, 0.72);
  background: linear-gradient(135deg, rgba(255, 140, 0, 0.9), rgba(255, 82, 82, 0.76));
  box-shadow: 0 18px 42px rgba(255, 82, 82, 0.2);
}

/* ============================================================
   Trade panel + strategy cards
   ============================================================ */
.trade-list { display: grid; gap: 12px; }

.strategy-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.028)),
    rgba(3, 13, 24, 0.68);
}

.strategy-card.expanded {
  align-items: start;
  border-color: rgba(0, 200, 255, 0.36);
}

.strategy-card:hover { border-color: rgba(0, 200, 255, 0.28); }

.strategy-main { display: grid; gap: 8px; min-width: 0; }

.strategy-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.strategy-coin-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.12);
}

.strategy-heading { min-width: 0; }

.strategy-index {
  color: var(--d-text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
}

.strategy-coin {
  overflow: hidden;
  color: var(--d-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #b8c6d8;
  font-size: 12px;
  font-weight: 700;
}

.strategy-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  white-space: nowrap;
}

.strategy-pnl { color: var(--d-green); }

.strategy-mode.live  { color: var(--d-green); border-color: rgba(37, 233, 133, 0.34); background: rgba(37, 233, 133, 0.08); }
.strategy-mode.paper { color: var(--d-cyan);  border-color: rgba(0, 200, 255, 0.34);  background: rgba(0, 200, 255, 0.08); }

.strategy-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Live total PnL pill — sits between the strategy meta row and the
   Подробнее/Stop buttons. Default neutral; coloured by sign. */
.strategy-pnl-live {
  font: 800 13px/1 var(--d-mono);
  font-variant-numeric: tabular-nums;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--d-text);
  white-space: nowrap;
  cursor: help;
}

.strategy-pnl-live.positive {
  color: var(--d-green);
  border-color: rgba(37, 233, 133, 0.34);
  background: rgba(37, 233, 133, 0.08);
}

.strategy-pnl-live.negative {
  color: var(--d-red);
  border-color: rgba(255, 79, 103, 0.34);
  background: rgba(255, 79, 103, 0.08);
}

.strategy-details {
  grid-column: 1 / -1;
  display: none;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.strategy-card.expanded .strategy-details { display: flex; }

/* Top row inside the expanded card: mini-market on the left,
   locked settings snapshot on the right. Both panels stretch to the
   tallest of the two so they line up cleanly; internal content is
   space-distributed below. */
.strategy-details-top {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.strategy-card.expanded > .strategy-actions .small-button.details .material-symbols-rounded {
  transform: rotate(180deg);
}

/* Collapsible "Markets seen" / "Strategy logs" panels.
   Both share the same chrome — a header row with a toggle, and a
   body that we hide until .open. The body is empty until backend
   integration in stage 2B/2C. */
.strategy-collapsible {
  display: grid;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

/* The header itself is the click target for the collapsible. */
.collapsible-head {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  min-height: 32px;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
  transition: background 160ms ease, color 160ms ease;
}

.collapsible-head:hover {
  background: rgba(0, 200, 255, 0.06);
}

.collapsible-title {
  flex: 0 0 auto;
  color: var(--d-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.collapsible-head:hover .collapsible-title { color: var(--d-cyan); }

/* Right-edge chevron — flips when the section is open. */
.collapsible-chevron {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--d-arrow);
  font-size: 18px;
  transition: transform 200ms ease, color 200ms ease;
}

.collapsible-head:hover .collapsible-chevron { color: var(--d-cyan); }

.strategy-collapsible.open .collapsible-chevron { transform: rotate(180deg); color: var(--d-cyan); }

.collapsible-body {
  display: none;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px 4px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 8px;
}

.strategy-collapsible.open .collapsible-body { display: block; }

/* Markets seen carries inline trades drawers and tends to be tall;
   give it twice the height so the user doesn't have to scroll the
   inner container after opening one or two rounds. */
.strategy-markets-box .collapsible-body {
  max-height: 440px;
}

.collapsible-empty {
  color: var(--d-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 14px 8px;
}

/* ── Markets seen — list of rounds the strategy participated in ── */

.mh-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mh-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.024);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: border-color 160ms ease, background 160ms ease;
}

.mh-row-wrap.open .mh-row {
  border-color: rgba(0, 200, 255, 0.42);
  background: rgba(0, 200, 255, 0.08);
}

.mh-row:hover {
  border-color: rgba(0, 200, 255, 0.32);
  background: rgba(0, 200, 255, 0.06);
}

.mh-row-main { min-width: 0; }

.mh-row-question {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #eaf2fb;
  font-size: 12.5px;
  font-weight: 700;
}

.mh-row-slug {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--d-muted);
  font: 700 10.5px/1.3 var(--d-mono);
  margin-top: 2px;
}

.mh-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.mh-row-time {
  color: var(--d-muted);
  font: 700 10.5px/1 var(--d-mono);
}

.mh-row-caret {
  font-size: 18px;
  color: var(--d-arrow);
  opacity: 0.7;
  transition: transform 200ms ease, color 200ms ease;
}

.mh-row:hover .mh-row-caret { opacity: 1; color: var(--d-cyan); }

.mh-row-wrap.open .mh-row-caret {
  transform: rotate(180deg);
  color: var(--d-cyan);
  opacity: 1;
}

/* Polymarket icon button — separate target so the click goes to
   Polymarket without toggling the drawer. */
.mh-row-pm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(0, 200, 255, 0.24);
  background: rgba(0, 200, 255, 0.06);
  color: var(--d-cyan);
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.mh-row-pm:hover {
  background: rgba(0, 200, 255, 0.18);
  border-color: rgba(0, 200, 255, 0.62);
  color: #ffffff;
}

.mh-row-pm .material-symbols-rounded { font-size: 14px; }

/* ── Inline trades drawer (under each market row in Markets seen) ── */
.mh-row-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.td-drawer {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 200, 255, 0.18);
  background: rgba(0, 200, 255, 0.04);
}

.td-loading,
.td-empty {
  color: var(--d-muted);
  font-size: 12px;
  text-align: center;
  padding: 12px 8px;
}

.td-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.td-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.td-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font: 700 12px/1.3 var(--d-mono);
}

.td-dot { font-size: 13px; }
.td-id  { color: var(--d-muted); }
.td-side { font-weight: 800; }
.td-side-up    { color: var(--d-green); }
.td-side-down  { color: var(--d-red); }
.td-vol   { color: var(--d-muted); }
.td-price { color: #eaf2fb; }
.td-sep   { color: var(--d-muted-2); }
.td-time  { color: var(--d-muted); }

.td-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font: 600 11px/1.4 var(--d-mono);
  color: #c4cdd9;
}

.td-meta-cell {
  white-space: nowrap;
}

.td-pnl.pos { color: var(--d-green); }
.td-pnl.neg { color: var(--d-red); }

.td-separator {
  height: 1px;
  margin: 8px 0;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.18),
    transparent);
}

.td-total {
  text-align: right;
  font: 800 13px/1 var(--d-mono);
  color: #eaf2fb;
}

.td-total.pos { color: var(--d-green); }
.td-total.neg { color: var(--d-red); }

/* ── Strategy logs — narrative feed (Start, new markets, future
       entry/exit). Layout mirrors the global PMLogs panel: compact
       monospace lines with `time | level | message`. ── */
.sl-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font: 500 12px/1.55 var(--d-mono);
}

.sl-row {
  display: grid;
  grid-template-columns: 76px 56px 1fr;
  gap: 10px;
  padding: 3px 6px;
  border-radius: 6px;
  color: rgba(211, 220, 232, 0.82);
}

.sl-row:hover { background: rgba(255, 255, 255, 0.03); }

.sl-time {
  color: var(--d-muted-2);
  font-variant-numeric: tabular-nums;
}

.sl-level {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sl-msg {
  overflow-wrap: anywhere;
  color: #eaf2fb;
}

.sl-info  .sl-level { color: #8491a5; }
.sl-ok    .sl-level { color: var(--d-green); }
.sl-warn  .sl-level { color: var(--d-orange); }
.sl-error .sl-level { color: var(--d-red); }
.sl-debug .sl-level { color: var(--d-muted-2); }

.strategy-mini-market,
.strategy-settings-snapshot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
  height: 100%;
  padding: 11px;
  border: 1px solid rgba(0, 200, 255, 0.24);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    linear-gradient(135deg, rgba(0, 200, 255, 0.1), rgba(37, 233, 133, 0.045) 52%, rgba(255, 79, 103, 0.035)),
    rgba(5, 14, 25, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    inset 0 -1px 0 rgba(0, 200, 255, 0.055),
    0 18px 42px rgba(0, 0, 0, 0.24),
    0 0 28px rgba(0, 200, 255, 0.055);
}

.strategy-mini-market { position: relative; overflow: hidden; padding: 14px; gap: 12px; }

.strategy-mini-market::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, rgba(37, 233, 133, 0.82), rgba(0, 200, 255, 0.92), rgba(255, 79, 103, 0.72));
  opacity: 0.88;
  pointer-events: none;
}

/* ── Header: coin/tf chip on the left, countdown on the right ── */
.mm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mm-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(0, 200, 255, 0.32);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(0, 200, 255, 0.18), rgba(37, 233, 133, 0.08));
  box-shadow: 0 0 18px rgba(0, 200, 255, 0.12);
}

.mm-chip-coin {
  color: #f8fcff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.mm-chip-tf {
  color: rgba(0, 200, 255, 0.92);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.mm-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  color: #eaf6ff;
}

.mm-timer .material-symbols-rounded {
  font-size: 16px;
  color: var(--d-cyan);
}

.mm-timer-val {
  font: 800 13px/1 var(--d-mono);
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: right;
}

/* Danger state — under 30s. Driven by the timer code adding the class. */
.mm-timer.danger { border-color: rgba(255, 79, 103, 0.45); background: rgba(255, 79, 103, 0.1); }
.mm-timer.danger .material-symbols-rounded { color: var(--d-red); }

/* ── Question line ── */
.mm-question {
  margin: 0;
  color: #eaf2fb;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
}
.mm-question a { color: inherit; text-decoration: none; }
.mm-question a:hover { color: var(--d-cyan); text-decoration: underline; text-underline-offset: 3px; }

/* ── UP / DOWN side panels.
   `flex: 1` lets the pair stretch to fill any extra vertical space
   when the column is taller than the mini-market's natural height
   (i.e. when the settings snapshot column dictates total height).
   Inside each side, content distributes via space-between. */
.mm-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
}

.mm-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
  padding: 10px 11px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    rgba(5, 14, 25, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mm-side-up {
  border-color: rgba(37, 233, 133, 0.34);
  box-shadow: inset 0 0 0 1px rgba(37, 233, 133, 0.08), 0 0 20px rgba(37, 233, 133, 0.06);
}

.mm-side-down {
  border-color: rgba(255, 79, 103, 0.34);
  box-shadow: inset 0 0 0 1px rgba(255, 79, 103, 0.08), 0 0 20px rgba(255, 79, 103, 0.06);
}

.mm-side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.mm-side-up   .mm-side-head { color: var(--d-green); }
.mm-side-down .mm-side-head { color: var(--d-red); }

.mm-arrow { font-size: 13px; line-height: 1; }

.mm-quote {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 18px;
}

.mm-quote-label {
  color: var(--d-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mm-quote-value {
  font: 800 13px/1 var(--d-mono);
  font-variant-numeric: tabular-nums;
}

.mm-ask    { color: #ffb1bc; }
.mm-bid    { color: #9af1c1; }
.mm-spread { color: #d6e1ee; opacity: 0.78; font-size: 12px; }

/* ── Cross spread row ── */
.mm-cross-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 11px;
  border: 1px solid rgba(0, 200, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(0, 200, 255, 0.08), rgba(37, 233, 133, 0.04));
}

.mm-cross-label {
  color: var(--d-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mm-cross-val {
  font: 800 14px/1 var(--d-mono);
  color: #eaf6ff;
  font-variant-numeric: tabular-nums;
}

/* ── NEXT row — clickable button strip with hover animation ── */
.mm-next-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 174, 66, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 174, 66, 0.08), rgba(255, 79, 103, 0.04));
  color: #f4ddbb;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 200ms ease,
    background 200ms ease,
    transform 200ms ease,
    box-shadow 200ms ease;
}

/* Hover sheen — diagonal glow that sweeps across on hover. */
.mm-next-row::before {
  content: "";
  position: absolute;
  inset: -80% auto -80% -55%;
  width: 46%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.mm-next-row:hover {
  border-color: rgba(255, 174, 66, 0.62);
  background:
    linear-gradient(135deg, rgba(255, 174, 66, 0.16), rgba(255, 79, 103, 0.08));
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(255, 174, 66, 0.16);
}

.mm-next-row:hover::before {
  opacity: 1;
  animation: nextSheen 720ms ease;
}

.mm-next-row:active { transform: translateY(0); }

/* Disabled state — when there's no NEXT URL yet. */
.mm-next-row[aria-disabled="true"] {
  cursor: default;
  opacity: 0.55;
  pointer-events: none;
}

.mm-next-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 174, 66, 0.45);
  background: rgba(255, 174, 66, 0.12);
  color: var(--d-orange);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mm-next-badge .material-symbols-rounded { font-size: 14px; }

.mm-next-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #ecdfc8;
  font-size: 12px;
  font-weight: 700;
}

.mm-next-row:hover .mm-next-label { color: #ffffff; }

/* Trailing chevron — slides right on hover. */
.mm-next-chevron {
  flex: 0 0 auto;
  font-size: 18px;
  color: var(--d-orange);
  opacity: 0.78;
  transition: transform 220ms ease, opacity 220ms ease;
}

.mm-next-row:hover .mm-next-chevron {
  transform: translateX(4px);
  opacity: 1;
}

@keyframes nextSheen {
  from { transform: translateX(0)    skewX(-18deg); }
  to   { transform: translateX(420%) skewX(-18deg); }
}

/* ── Settings snapshot list.
   `flex: 1` so the grid takes the remaining height after the header,
   and `align-content: stretch` distributes rows so the panel matches
   the mini-market column's height without leaving a big gap at the
   bottom. */
.settings-snapshot-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  grid-auto-rows: 1fr;
  gap: 8px;
  flex: 1;
  align-content: stretch;
}

.settings-snapshot-row {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 3px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.028);
}

.settings-snapshot-row span {
  color: var(--d-muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-snapshot-row strong {
  overflow-wrap: anywhere;
  color: #eef5fc;
  font: 800 13px/1.2 var(--d-mono);
  text-align: left;
}

/* Empty state inside settings-snapshot stretches to fill the column,
   so the panel still matches the mini-market height. */
.settings-snapshot-empty {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px 8px;
}

.snapshot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #edf5ff;
  font-size: 12px;
  font-weight: 900;
}

/* ============================================================
   Small buttons
   ============================================================ */
.small-button {
  height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  color: #dce6f0;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.small-button.details {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: rgba(0, 200, 255, 0.34);
  color: #eaf8ff;
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.2), rgba(45, 107, 255, 0.18));
  box-shadow: 0 10px 26px rgba(0, 200, 255, 0.08);
}

.small-button.details:hover {
  border-color: rgba(0, 200, 255, 0.58);
  color: #ffffff;
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.28), rgba(45, 107, 255, 0.26));
}

.small-button.details .material-symbols-rounded { font-size: 16px; }

.small-button.stop {
  border-color: rgba(255, 82, 82, 0.5);
  color: #fff7f4;
  background: linear-gradient(135deg, rgba(255, 82, 82, 0.82), rgba(255, 140, 0, 0.72));
  box-shadow: 0 12px 26px rgba(255, 82, 82, 0.12);
}

.small-button:hover {
  color: var(--d-cyan);
  border-color: rgba(0, 200, 255, 0.35);
  background: rgba(0, 200, 255, 0.09);
}

.small-button.stop:hover {
  color: #ffffff;
  border-color: rgba(255, 140, 0, 0.72);
  background: linear-gradient(135deg, rgba(255, 140, 0, 0.9), rgba(255, 82, 82, 0.76));
  box-shadow: 0 14px 30px rgba(255, 82, 82, 0.18);
}

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  display: grid;
  place-items: center;
  min-height: 178px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: var(--d-muted);
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
  padding: 24px;
}

.empty-state .material-symbols-rounded {
  margin-bottom: 10px;
  color: rgba(0, 200, 255, 0.58);
  font-size: 30px;
}

/* ============================================================
   Stats column
   ============================================================ */
.pnl-card {
  padding: 17px;
  border-color: rgba(0, 200, 255, 0.42);
  box-shadow: 0 0 28px rgba(0, 200, 255, 0.1), var(--d-shadow);
}

.pnl-label {
  color: var(--d-muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.pnl-value {
  color: var(--d-cyan);
  font: 800 30px/1.1 var(--d-mono);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-card {
  min-height: 76px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.032);
}

.metric-card:hover { border-color: rgba(0, 200, 255, 0.24); }

.metric-value {
  margin-top: 8px;
  color: #eef5fc;
  font: 800 20px/1 var(--d-mono);
}

/* ============================================================
   Log panel
   ============================================================ */
.log-panel { margin: 0; overflow: hidden; }

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--d-border);
  background: rgba(255, 255, 255, 0.026);
}

.log-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--d-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.log-stream {
  max-height: 260px;
  overflow: auto;
  padding: 12px 16px 14px;
  font: 500 13px/1.6 var(--d-mono);
  background: rgba(0, 0, 0, 0.1);
}

.log-line {
  display: grid;
  grid-template-columns: 100px 64px 1fr;
  gap: 12px;
  min-height: 22px;
  color: rgba(211, 220, 232, 0.78);
}

.log-line .time  { color: var(--d-muted-2); }
.log-line.info  .level { color: #8491a5; }
.log-line.ok    .level { color: var(--d-green); }
.log-line.warn  .level { color: var(--d-orange); }
.log-line.error .level { color: var(--d-red); }
.log-line.debug .level { color: var(--d-muted-2); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes timerAuraPulse {
  0%, 100% { transform: scale(0.97); opacity: 0.56; }
  50%      { transform: scale(1.05); opacity: 0.92; }
}

@keyframes timerDigitInDown {
  from { transform: translateY(-115%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@keyframes timerDigitOutDown {
  from { transform: translateY(0);     opacity: 1; }
  to   { transform: translateY(115%);  opacity: 0; }
}

@keyframes buttonShine {
  from { transform: translateX(0)    skewX(-18deg); }
  to   { transform: translateX(420%) skewX(-18deg); }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1180px) {
  .terminal-grid {
    grid-template-columns: 390px minmax(420px, 1fr);
  }
}

@media (max-width: 840px) {
  .terminal-grid {
    grid-template-columns: 1fr;
  }
  .col {
    max-height: none;
    overflow: visible;
  }
  .settings-grid,
  .mode-row,
  .settings-split { grid-template-columns: 1fr; }
  .filter-stack { grid-template-columns: 1fr; }
  .strategy-card { grid-template-columns: 1fr; }
  .strategy-details,
  .settings-snapshot-list { grid-template-columns: 1fr; }
  .strategy-actions { justify-content: flex-start; flex-wrap: wrap; }
}

@media (max-width: 460px) {
  .market-controls,
  .side-grid,
  .stat-grid { grid-template-columns: 1fr; }
  .coin-row { align-items: stretch; flex-wrap: wrap; }
  .coin-picker,
  .market-interval-field { flex-basis: 100%; width: 100%; }
  .log-line { grid-template-columns: 1fr; gap: 0; padding: 6px 0; }
}
