:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-muted: #f3f3f3;
  --ink: #0a0c0c;
  --text: #141414;
  --muted: #6b6b6b;
  --border: #e4e4e4;
  --border-strong: #d0d0d0;
  --red: #f01f01;
  --red-hover: #d41a01;
  --red-soft: rgba(240, 31, 1, 0.08);
  --sidebar-bg: #0a0c0c;
  --sidebar-text: #f5f5f5;
  --sidebar-muted: #a3a3a3;
  --shadow: 0 1px 3px rgba(10, 12, 12, 0.06), 0 4px 16px rgba(10, 12, 12, 0.04);
  --shadow-lg: 0 8px 32px rgba(10, 12, 12, 0.12);
  --sidebar-w: 232px;
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.nav-open { overflow: hidden; }

#app-screen[hidden],
#auth-screen[hidden],
#reset-screen[hidden] {
  display: none !important;
}

#app-screen {
  height: 100%;
  height: 100dvh;
  display: flex;
}

/* ——— Sidebar (чёрная полоса как на эмблеме) ——— */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: none;
  padding: calc(16px + env(safe-area-inset-top)) 0 calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar-brand {
  padding: 4px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
}

.brand-logo {
  display: block;
  width: auto;
  max-width: min(220px, calc(100vw - 4rem));
  height: auto;
  margin: 0 auto 12px;
}

.brand-logo--sidebar {
  max-width: calc(var(--sidebar-w) - 40px);
  margin: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--sidebar-muted);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item--action {
  color: var(--sidebar-text);
  font-size: 0.9rem;
}

.nav-item--action[data-enabled="1"] {
  color: #ffb4a8;
}

/* Push toggle — компактная строка в footer */
.push-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 8px 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.push-toggle__info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.push-toggle__label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--sidebar-text);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.push-toggle__status {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  position: relative;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.push-toggle__status::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 5px;
  height: 9px;
  border: solid transparent;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.6);
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.push-toggle.is-on .push-toggle__status {
  border-color: rgba(74, 222, 128, 0.85);
  background: rgba(74, 222, 128, 0.12);
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.15);
}

.push-toggle.is-on .push-toggle__status::after {
  border-color: #4ade80;
  opacity: 1;
  transform: translate(-50%, -50%) rotate(45deg) scale(1);
}

.push-toggle.is-off .push-toggle__status {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.push-toggle__btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.push-toggle__btn[hidden] {
  display: none !important;
}

.push-toggle__btn span {
  display: block;
  margin-top: -1px;
}

.push-toggle__btn:active:not(:disabled) {
  transform: scale(0.94);
}

.push-toggle__btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.push-toggle__btn--off {
  color: #ffb4a8;
  background: rgba(240, 31, 1, 0.12);
}

.push-toggle__btn--off:hover {
  background: rgba(240, 31, 1, 0.22);
  color: #ffd4cc;
}

.push-toggle__btn--on {
  color: #86efac;
  background: rgba(74, 222, 128, 0.12);
}

.push-toggle__btn--on:hover {
  background: rgba(74, 222, 128, 0.22);
  color: #bbf7d0;
}

.push-toggle.is-busy {
  opacity: 0.72;
  pointer-events: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
}

.nav-item.active {
  background: rgba(240, 31, 1, 0.14);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--red);
}

.nav-item--secondary {
  color: #7a7a7a;
  font-size: 0.88rem;
  opacity: 0.85;
}

.nav-item--secondary:hover {
  opacity: 1;
  color: var(--sidebar-muted);
}

.nav-item--secondary.active {
  opacity: 1;
  color: #e5e5e5;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.28);
}

/* ——— Main area ——— */
.app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.view-scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.view-scroller-inner {
  will-change: transform;
}

.pull-refresh {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  height: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  pointer-events: none;
  transition: height 0.2s ease;
}

.pull-refresh.is-pulling {
  transition: none;
}

.pull-refresh.is-refreshing {
  height: 52px !important;
}

.pull-refresh__spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--red);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s;
}

.pull-refresh.is-ready .pull-refresh__spinner,
.pull-refresh.is-refreshing .pull-refresh__spinner {
  opacity: 1;
}

.pull-refresh.is-refreshing .pull-refresh__spinner {
  animation: pull-spin 0.7s linear infinite;
}

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

.pull-refresh.is-ready .pull-refresh__label {
  color: var(--red);
  font-weight: 600;
}

.pull-refresh.is-refreshing .pull-refresh__label {
  color: var(--muted);
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px calc(14px + env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.top-title { flex: 1; min-width: 0; }

.top-title #status {
  margin: 0;
}

.orch-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.orch-toolbar[hidden] {
  display: none !important;
}

.orch-toolbar__btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.orch-toolbar__btn span {
  display: block;
  margin-top: -1px;
}

.orch-toolbar__btn--run {
  color: #bbf7d0;
  background: #16a34a;
}

.orch-toolbar__btn--run:hover {
  background: #15803d;
  color: #ecfdf5;
}

.orch-toolbar__btn--purge {
  color: #ffb4a8;
  background: rgba(240, 31, 1, 0.12);
}

.orch-toolbar__btn--purge:hover {
  background: rgba(240, 31, 1, 0.22);
  color: #ffd4cc;
}

.orch-toolbar__btn:active:not(:disabled) {
  transform: scale(0.94);
}

.orch-toolbar__btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

body.orch-purge-modal-open,
body.orch-run-modal-open {
  overflow: hidden;
}

.orch-run-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 4px;
}

.orch-run-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg);
}

.orch-run-option:has(input:checked) {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

.orch-run-option input {
  margin-top: 3px;
  flex-shrink: 0;
}

.orch-run-option__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
}

.orch-run-option__hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
}

.orch-purge-modal__btn--run {
  background: #16a34a;
  color: #fff;
  border: none;
}

.orch-purge-modal__btn--run:hover {
  background: #15803d;
}

.orch-purge-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.orch-purge-modal[hidden] {
  display: none !important;
}

.orch-purge-modal__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.orch-purge-modal__sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
}

@media (min-width: 520px) {
  .orch-purge-modal {
    align-items: center;
    padding: 16px;
  }

  .orch-purge-modal__sheet {
    border-radius: var(--radius-lg);
    padding: 22px 20px;
  }
}

.orch-purge-modal__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.orch-purge-modal__text {
  margin: 0 0 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.orch-purge-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 18px;
  font-size: 0.82rem;
}

.orch-purge-modal__label {
  font-weight: 600;
  color: var(--ink);
}

.orch-purge-modal__date {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}

.orch-purge-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.orch-purge-modal__btn {
  flex: 1 1 40%;
  min-width: 7rem;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.orch-purge-modal__btn--ghost {
  background: var(--bg);
  color: var(--ink);
}

.orch-purge-modal__btn--danger {
  background: rgba(240, 31, 1, 0.12);
  border-color: rgba(240, 31, 1, 0.35);
  color: #c41e00;
}

.orch-purge-modal.is-busy {
  pointer-events: none;
  opacity: 0.85;
}

.orch-purge-modal__modes {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.orch-purge-modal__mode {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  cursor: pointer;
}

.orch-purge-modal__mode--active {
  border-color: var(--accent);
  background: rgba(240, 31, 1, 0.08);
  font-weight: 600;
}

.orch-purge-modal__panel[hidden] {
  display: none;
}

.orch-purge-cycle-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.orch-purge-cycle-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.82rem;
  cursor: pointer;
}

.orch-purge-cycle-item__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.orch-purge-cycle-item__when {
  font-weight: 600;
  color: var(--ink);
}

.orch-purge-cycle-item__id {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}

.orch-purge-cycle-list__empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.orch-cycles {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orch-cycle-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 4px 0 8px;
  background: var(--surface);
}

.orch-cycle-filter__btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.78rem;
  cursor: pointer;
}

.orch-cycle-filter__btn--active {
  border-color: var(--accent);
  background: rgba(240, 31, 1, 0.08);
  font-weight: 600;
}

.orch-cycle {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.orch-cycle__summary {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.orch-cycle__summary-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
}

.orch-cycle__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  width: 100%;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.orch-cycle__stat strong {
  color: var(--ink);
  font-weight: 600;
}

.orch-cycle__stat--time {
  flex: 1 1 100%;
  font-size: 0.72rem;
  opacity: 0.9;
}

.orch-cycle__stat--status {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.orch-cycle__summary::-webkit-details-marker {
  display: none;
}

.orch-cycle__when {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.orch-cycle__id {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.orch-cycle__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}

.orch-cycle__stat--live {
  color: var(--accent, #2563eb);
  font-weight: 600;
}

.orch-cycle__stat--error {
  color: #b91c1c;
  font-weight: 600;
}

.orch-cycle__stat--prompt-down {
  color: var(--accent, #3fb950);
}

.orch-cycle__stat--prompt-up {
  color: #b45309;
}

.orch-cycle__badge--running {
  border-color: color-mix(in srgb, var(--accent, #2563eb) 45%, var(--border));
  background: color-mix(in srgb, var(--accent, #2563eb) 10%, var(--bg));
}

.orch-cycle__badge--error {
  border-color: color-mix(in srgb, #dc2626 50%, var(--border));
  background: color-mix(in srgb, #dc2626 12%, var(--bg));
  color: #b91c1c;
}

.orch-cycle__badge-state {
  font-style: normal;
  font-weight: 700;
  font-size: 0.72rem;
}

.orch-role-panel__state {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.orch-role-panel__state--run {
  color: var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent);
}

.orch-role-panel__state--err {
  color: #b91c1c;
  background: color-mix(in srgb, #dc2626 12%, transparent);
}

.orch-role-panel--error {
  border-color: color-mix(in srgb, #dc2626 40%, var(--border));
}

.orch-phase-card--running {
  border-left: 3px solid var(--accent, #2563eb);
}

.orch-phase-card--error {
  border-left: 3px solid #dc2626;
}

.orch-phase-card__alert {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #b91c1c;
  background: color-mix(in srgb, #dc2626 10%, var(--bg));
  border: 1px solid color-mix(in srgb, #dc2626 35%, var(--border));
}

.orch-chat__tag--run {
  background: color-mix(in srgb, var(--accent, #2563eb) 18%, var(--bg));
  color: var(--accent, #1d4ed8);
}

.orch-chat__tag--err {
  background: color-mix(in srgb, #dc2626 15%, var(--bg));
  color: #b91c1c;
}

.orch-cycle__badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.orch-cycle__body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--border);
}

.orch-role-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 8px;
  background: var(--bg);
  overflow: hidden;
}

.orch-role-panel__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.orch-role-panel__summary::-webkit-details-marker {
  display: none;
}

.orch-role-panel__label {
  flex: 0 0 auto;
}

.orch-role-panel__hint {
  flex: 1 1 100%;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.3;
}

.orch-role-panel__body {
  padding: 0 10px 10px;
  border-top: 1px solid var(--border);
}

.orch-role-panel__body .orch-chat {
  margin-top: 8px;
}

.orch-role-panel__body .orch-phase-card {
  margin-top: 8px;
}

.orch-role-panel--outcome {
  border-color: color-mix(in srgb, #f59e0b 35%, var(--border));
  background: color-mix(in srgb, #f59e0b 6%, var(--bg));
}

.orch-feed__progress {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, #60a5fa 40%, var(--border));
  background: color-mix(in srgb, #60a5fa 10%, var(--surface, var(--bg)));
}

.orch-feed__progress-title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.orch-feed__progress-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.orch-feed__progress-log {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.orch-feed__progress-log code {
  font-size: 0.76rem;
}

.orch-outcome {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.orch-outcome__block {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface, var(--bg));
  border: 1px solid var(--border);
}

.orch-outcome__block--rating {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.orch-outcome__kicker {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.orch-outcome__rating {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.orch-outcome__rating--ok {
  color: #059669;
}

.orch-outcome__rating--bad {
  color: #dc2626;
}

.orch-outcome__block--finance {
  border: 2px solid color-mix(in srgb, #f59e0b 55%, var(--border));
  background: color-mix(in srgb, #f59e0b 12%, var(--surface, var(--bg)));
  box-shadow: 0 1px 0 rgba(245, 158, 11, 0.15);
}

.orch-outcome__block--finance-missing {
  border-color: color-mix(in srgb, #f97316 45%, var(--border));
  background: color-mix(in srgb, #f97316 8%, var(--surface, var(--bg)));
}

.orch-outcome__finance-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #b45309;
  letter-spacing: 0.01em;
}

.orch-outcome__finance-lead {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.orch-outcome__finance-body {
  font-size: 0.95rem;
}

.orch-outcome__section-title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.orch-outcome__block--owner {
  border-color: color-mix(in srgb, var(--accent, #60a5fa) 25%, var(--border));
}

.orch-outcome__para {
  margin: 0 0 8px;
}

.orch-outcome__para:last-child {
  margin-bottom: 0;
}

.orch-outcome__para--lead {
  font-weight: 600;
}

.orch-outcome__para--muted {
  color: var(--muted);
  font-style: italic;
}

.orch-cycle__badge--outcome,
.orch-cycle__badge--outcome-pending {
  border-color: color-mix(in srgb, #f59e0b 40%, var(--border));
  color: #b45309;
}

.orch-cycle__badge--outcome-pending {
  border-style: dashed;
  opacity: 0.92;
}

.orch-orch-sub {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, var(--bg));
}

.orch-orch-sub__summary {
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.orch-orch-sub__summary::-webkit-details-marker {
  display: none;
}

.orch-orch-sub__body {
  padding: 0 8px 8px;
}

.orch-orch-sub__pending {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--muted);
  border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.top h1, #page-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.top p, #status {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 12, 0.45);
  z-index: 25;
}

.view { flex: 1; min-height: 0; }
.view[hidden] { display: none !important; }

/* ——— Buttons ——— */
.auth-card button[type="submit"], #auth-submit {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-top: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.auth-card button[type="submit"]:hover, #auth-submit:hover {
  background: var(--red-hover);
}

.auth-card button[type="submit"]:active, #auth-submit:active {
  transform: scale(0.99);
}

.link-btn {
  background: none;
  border: none;
  color: var(--red);
  padding: 8px 0;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--red-hover);
  text-decoration: underline;
}

/* ——— Auth ——— */
.auth-screen {
  position: relative;
  z-index: 40;
  min-height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(240, 31, 1, 0.07), transparent),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1, .auth-card .auth-heading {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.auth-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-card label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.auth-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  touch-action: manipulation;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.auth-message {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-message.error { color: var(--red); }

/* ——— TradeBotUI notifications ——— */
.chat {
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: min(100%, calc(100dvh - 120px));
  max-width: 720px;
}

.msg {
  max-width: 92%;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow);
}

.msg__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.msg-push {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.msg-push--delivered {
  background: rgba(46, 204, 113, 0.14);
  color: #1a8f4a;
}

.msg-push--pending {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.msg-push--failed {
  background: rgba(240, 31, 1, 0.12);
  color: var(--red);
}

.msg time {
  display: block;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.msg p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

/* ——— Echo (сводка + консультация) ——— */
.app-main--echo .view-scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.app-main--echo .view-scroller-inner {
  min-height: min-content;
}

.app-main--echo .echo-view.view-active {
  display: block;
  min-height: auto;
}

.app-main--echo-chat .view-scroller {
  overflow: hidden;
}

.app-main--echo-chat .view-scroller-inner {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-main--echo-chat .echo-view.view-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.echo-chat-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.echo-chat-panel .echo-chat__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.echo-chat-panel .echo-chat__compose {
  position: relative;
  max-width: none;
  margin: 0;
}

.echo-dashboard {
  padding: 8px 16px 0;
}

.echo-plan-panel,
.echo-goals-panel,
.echo-tickets-panel {
  padding: 16px;
}

.echo-panel__loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.echo-panel__loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: echo-panel-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.echo-panel__refresh-hint {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: normal;
}

.echo-plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.echo-plan-card__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.echo-plan-card__title {
  color: #1a4fd6;
  font-size: 1rem;
  font-weight: 700;
}

.echo-plan-card__meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.echo-plan-card__h {
  margin: 14px 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.echo-plan-card--roadmap {
  margin-bottom: 14px;
}

.roadmap-panel__hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.roadmap-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.roadmap-filter__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.roadmap-filter__btn--active {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.roadmap-filter__btn--active.roadmap-filter__btn--active {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.roadmap-filter__btn--active.roadmap-filter__btn--done {
  border-color: color-mix(in srgb, #22c55e 45%, var(--border));
  background: color-mix(in srgb, #22c55e 10%, var(--surface));
}

.roadmap-filter__btn--active.roadmap-filter__btn--proposed {
  border-color: color-mix(in srgb, #6366f1 45%, var(--border));
  background: color-mix(in srgb, #6366f1 10%, var(--surface));
}

.roadmap-filter__btn--active.roadmap-filter__btn--abandoned {
  border-color: color-mix(in srgb, #94a3b8 45%, var(--border));
  background: color-mix(in srgb, #94a3b8 12%, var(--surface));
}

.roadmap-filter__count {
  min-width: 1.2em;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.roadmap-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.roadmap-pagination__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.roadmap-pagination__size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.roadmap-pagination__select {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
}

.roadmap-pagination__btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.roadmap-pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.roadmap-pagination__page {
  min-width: 4.5em;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}

.roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.roadmap-item {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
}

.roadmap-item--focus {
  border-color: rgba(20, 184, 166, 0.45);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.15);
}

.roadmap-item--active { border-left: 3px solid #14b8a6; }
.roadmap-item--proposed { border-left: 3px solid #6366f1; }
.roadmap-item--done { border-left: 3px solid #22c55e; opacity: 0.85; }
.roadmap-item--abandoned { border-left: 3px solid #94a3b8; opacity: 0.65; }

.roadmap-item__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: space-between;
}

.roadmap-item__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.35;
}

.roadmap-item__badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0f766e;
  background: rgba(20, 184, 166, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
}

.roadmap-item__meta {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.roadmap-item__body,
.roadmap-item__evidence {
  margin: 8px 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
}

.roadmap-item__evidence {
  color: var(--muted);
  font-size: 0.78rem;
}

.roadmap-create {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.roadmap-create__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  width: 100%;
}

.roadmap-create__input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
}

.roadmap-create__btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: #1a4fd6;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.roadmap-create__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.echo-plan-card--goals {
  margin-bottom: 0;
}

.echo-plan-card--research {
  margin-bottom: 12px;
}

.research-flow-hint,
.research-scheduler {
  margin: 0 0 10px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.orch-presence {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
}
.orch-presence--ok { border-color: color-mix(in srgb, #22c55e 40%, var(--border)); }
.orch-presence--attention { border-color: color-mix(in srgb, #f59e0b 50%, var(--border)); }
.orch-presence--critical { border-color: color-mix(in srgb, #ef4444 55%, var(--border)); }
.orch-presence__title { margin-right: 8px; }
.orch-presence__trend { color: var(--muted); font-size: 0.8rem; }
.orch-presence__timing { margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; }
.orch-presence__signals { margin: 6px 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.78rem; }

.orch-chain-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.orch-chain-banner__steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.orch-chain__step {
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

.orch-chain__step--current {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

.orch-chain__step--next {
  color: var(--text);
  border-color: color-mix(in srgb, #f59e0b 50%, var(--border));
  background: color-mix(in srgb, #f59e0b 12%, var(--surface));
}

.orch-chain__step--done {
  opacity: 0.72;
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.orch-chain__arrow {
  color: var(--muted);
  font-weight: 400;
  user-select: none;
}

.orch-chain-banner__primary {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.orch-chain-banner__primary strong {
  font-weight: 650;
}

.orch-chain-banner__reason {
  color: var(--muted);
  font-size: 0.85rem;
}

.orch-chain-banner__meta-line {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.orch-chain-banner__hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.echo-history__empty,
.echo-history__meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.echo-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.echo-history-session {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.echo-history-session__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.echo-history-session__summary::-webkit-details-marker {
  display: none;
}

.echo-history-session__when {
  font-size: 0.9rem;
  color: var(--text);
}

.echo-history-session__label {
  flex: 1 1 auto;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.echo-history-session__count {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--muted);
}

.echo-history-session__body {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.echo-history-item {
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 40%, var(--surface));
}

.echo-history-item__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.echo-history-item__summary::-webkit-details-marker {
  display: none;
}

.echo-history-item__badge {
  font-size: 0.75rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.echo-history-item--research .echo-history-item__badge {
  background: color-mix(in srgb, #8b5cf6 18%, transparent);
}

.echo-history-item--strategy .echo-history-item__badge,
.echo-history-item--planner .echo-history-item__badge {
  background: color-mix(in srgb, #0ea5e9 18%, transparent);
}

.echo-history-item--work .echo-history-item__badge {
  background: color-mix(in srgb, #22c55e 16%, transparent);
}

.echo-history-item--decision .echo-history-item__badge {
  background: color-mix(in srgb, #f59e0b 18%, transparent);
}

.echo-history-item__when {
  font-size: 0.8rem;
  color: var(--muted);
}

.echo-history-item__status {
  font-size: 0.75rem;
  color: var(--muted);
}

.echo-history-item__status--error {
  color: #ef4444;
}

.echo-history-item__excerpt {
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1 1 100%;
}

.echo-history-item__meta {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.85;
}

.echo-history-item__body {
  padding: 0 10px 10px;
}

.echo-history-item__cycle .orch-cycle-filter {
  display: none;
}

.echo-history-item__cycle .orch-cycles {
  gap: 0;
}

.echo-history-item__cycle .orch-cycle {
  border: none;
  border-radius: 8px;
  margin: 0;
}

.echo-history-child {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 6px;
  background: var(--surface);
}

.echo-history-child--error {
  border-color: color-mix(in srgb, #ef4444 35%, var(--border));
  background: color-mix(in srgb, #ef4444 6%, var(--surface));
}

.echo-history-child__summary {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  list-style: none;
}

.echo-history-child__summary::-webkit-details-marker {
  display: none;
}

.echo-history-child__body {
  padding: 0 10px 10px;
  font-size: 0.85rem;
}

.research-run-row {
  margin: 12px 0 8px;
}

.research-goal-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.research-artifact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.research-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
}

.research-status--needs_decision {
  background: color-mix(in srgb, #f59e0b 22%, transparent);
}

.research-status--error,
.research-status--parse_error {
  background: color-mix(in srgb, #ef4444 20%, transparent);
}

.research-narrative-banner {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.research-narrative-banner__title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.research-narrative-banner__body {
  font-size: 0.95rem;
  line-height: 1.55;
}

.research-owner-lead {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.research-owner-situation {
  margin: 0 0 14px;
  line-height: 1.5;
  color: var(--text-muted, var(--muted));
}

.research-owner-rec {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.research-owner-rec__h {
  margin: 0 0 6px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.research-owner-card-list {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.research-owner-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.research-owner-card__title {
  display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.research-owner-card__body {
  margin: 4px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.research-owner-card__meta {
  margin: 6px 0 0;
  font-size: 0.82rem;
}

.research-owner-card__badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.75rem;
}

.research-proposal-kind {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  margin-right: 4px;
}

.research-hypothesis-list,
.research-hypothesis-li {
  margin: 0;
}

.research-cycle-role-list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.research-cycle-role {
  font-size: 0.84rem;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.research-cycle-role strong {
  display: block;
  margin-bottom: 4px;
}

.research-cycle-current {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, #8b5cf6 25%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, #8b5cf6 5%, var(--surface));
}

.research-cycle-current__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.research-cycle-badge {
  font-size: 0.72rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.research-cycle-badge--merge {
  background: color-mix(in srgb, #f59e0b 22%, transparent);
}

.research-cycle-badge--sm {
  font-size: 0.68rem;
  padding: 1px 6px;
}

.research-cycle-path-list,
.research-cycle-hyp-list,
.research-cycle-ticket-list,
.research-cycle-history-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.research-cycle-path {
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.86rem;
}

.research-cycle-path--selected {
  border-color: color-mix(in srgb, #22c55e 45%, var(--border));
  background: color-mix(in srgb, #22c55e 8%, var(--surface));
}

.research-cycle-check {
  color: #22c55e;
  margin-right: 6px;
  font-weight: 700;
}

.research-cycle-score {
  float: right;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.research-cycle-hyp {
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  font-size: 0.86rem;
}

.research-cycle-hyp__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
}

.research-cycle-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.research-cycle-tag--ticket {
  background: color-mix(in srgb, #3b82f6 18%, transparent);
}

.research-cycle-tag--boost {
  background: color-mix(in srgb, #22c55e 18%, transparent);
}

.research-cycle-ticket {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  font-size: 0.84rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.research-cycle-ticket__kind {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 650;
}

.research-cycle-history-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  margin-bottom: 6px;
}

.research-cycle-history-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.echo-plan-card--listing-snipe.research-listing-card--warn {
  border-color: color-mix(in srgb, #f59e0b 45%, var(--border));
}

.research-listing-stats {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.86rem;
}

.research-error-block {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, #ef4444 35%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, #ef4444 8%, var(--surface));
}

.research-error-block__title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 650;
}

.research-error-block__msg {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.research-in-progress {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, #8b5cf6 40%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, #8b5cf6 8%, var(--surface));
}

.research-in-progress__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.research-in-progress__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, #8b5cf6 25%, transparent);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: research-spin 0.9s linear infinite;
  flex-shrink: 0;
}

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

.research-in-progress__title {
  margin: 0;
  font-weight: 650;
}

.research-strategy-list,
.research-proposal-list,
.research-history-list,
.research-ticket-list {
  margin: 0;
  padding-left: 1.15rem;
}

.research-strategy-li,
.research-proposal-li,
.research-history-li,
.research-ticket-li {
  margin: 8px 0;
  line-height: 1.45;
}

.research-raw-details {
  margin-top: 16px;
}

.research-raw-pre {
  margin: 8px 0 0;
  padding: 10px;
  max-height: 240px;
  overflow: auto;
  font-size: 0.78rem;
  border-radius: 8px;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.echo-plan-card--research-decision {
  margin-top: 12px;
}

.research-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.research-option {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.research-option__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.research-option__title {
  margin: 0;
  font-size: 0.95rem;
}

.research-option__badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.research-option__summary {
  margin: 0 0 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.research-option__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.research-option__note {
  flex: 1 1 180px;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.goal-story__headline {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.goal-story-list {
  margin: 0 0 8px;
  padding-left: 1.15rem;
}

.goal-story-list__item {
  margin: 6px 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}

.goals-panel__hint {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.goals-panel__h {
  margin: 20px 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.goals-panel__count {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.goals-save-status {
  margin-left: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #16a34a;
}

.goal-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.goal-item--empty {
  grid-template-columns: 1fr;
}

.goal-item__moves {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.goal-item__move {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}

.goal-item__move:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent, #2563eb);
}

.goal-item__move:disabled {
  opacity: 0.35;
  cursor: default;
}

.goal-item__text {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.35;
  background: var(--surface);
  color: var(--text);
}

.goal-item__delete {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: #dc2626;
  font-size: 1.1rem;
  cursor: pointer;
}

.goal-create {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.goal-create__input {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--text);
}

.goal-create__btn {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  background: #6366f1;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.goal-create__btn:disabled {
  opacity: 0.55;
}

.goal-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.goal-suggestion {
  padding: 7px 12px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
}

.goal-suggestion:hover {
  border-color: #6366f1;
  color: var(--text);
}

.goal-regenerate {
  margin-top: 20px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.goal-regenerate--pending {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.06);
}

.goal-regenerate__hint {
  margin: 0 0 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.goal-regenerate__hint--muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.goal-regenerate__btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius);
  background: #6366f1;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.goal-regenerate--pending .goal-regenerate__btn {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.goal-regenerate__btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.echo-subnav {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.echo-subnav__btn {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-muted);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.echo-subnav__btn--active {
  background: rgba(26, 79, 214, 0.1);
  border-color: rgba(26, 79, 214, 0.35);
  color: #1a4fd6;
}

.echo-panel[hidden] {
  display: none !important;
}

.echo-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.echo-timeline__item {
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.echo-timeline__item--focus {
  border-color: rgba(212, 160, 23, 0.45);
  background: rgba(212, 160, 23, 0.08);
}

.echo-timeline__item--outcome {
  border-color: rgba(46, 204, 113, 0.4);
  background: rgba(46, 204, 113, 0.07);
}

.echo-timeline__when {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.echo-timeline__label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.echo-timeline__body {
  font-size: 0.9rem;
  line-height: 1.48;
}

.echo-timeline__body--task {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.echo-self-modify {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.45;
}

.echo-self-modify__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.echo-self-modify__label {
  opacity: 0.65;
}

.echo-view {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding: 0 0 12px;
}

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

.echo-chat__messages {
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.echo-chat__messages .empty {
  margin-top: 10vh;
}

.echo-chat__compose {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(250, 250, 250, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 25;
  box-shadow: 0 -4px 16px rgba(10, 12, 12, 0.06);
  transition: transform 0.2s ease;
}

.echo-chat__field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.echo-chat__attach {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.echo-chat__attach:has(~ .echo-chat__field .echo-chat__attachment-preview:not([hidden])) {
  border-color: var(--red);
}

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

.echo-chat__attach-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.echo-chat__attachment-preview {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--muted);
}

.echo-chat__attachment-preview:not([hidden]) {
  display: flex;
}

.echo-chat__attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 6px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
}

.echo-chat__attachment-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.echo-chat__attachment-fileicon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 1.25rem;
}

.echo-chat__attachment-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.8rem;
}

.echo-chat__attachment-clear {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
}

.echo-chat__attachment-clear:hover {
  color: var(--red);
  background: rgba(240, 31, 1, 0.08);
}

.echo-chat__msg-attachment {
  margin-top: 8px;
  font-size: 0.85rem;
}

.echo-chat__msg-attachment a {
  color: var(--red);
  text-decoration: none;
}

.echo-chat__msg-attachment img {
  display: block;
  max-width: min(100%, 280px);
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.echo-chat__compose[hidden] {
  display: none !important;
}

.echo-chat__input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.4;
  background: var(--surface);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.echo-chat__compose button[type="submit"],
.echo-chat__send {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  width: auto;
  max-width: none;
  margin-top: 0;
  padding: 0 14px;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.echo-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.echo-chat__progress {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255, 251, 235, 0.95);
}

.echo-chat__progress-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.echo-chat__progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #92400e;
}

.echo-chat__progress-elapsed {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.echo-chat__progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(146, 64, 14, 0.12);
  overflow: hidden;
  margin-bottom: 10px;
}

.echo-chat__progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  transition: width 0.35s ease;
}

.echo-chat__progress-bar--indeterminate {
  width: 100% !important;
  opacity: 0.5;
  animation: echo-chat-progress-opacity 1.2s ease-in-out infinite;
}

@keyframes echo-chat-progress-opacity {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

.echo-chat__cancel-btn {
  width: 100%;
  border: 1px solid rgba(146, 64, 14, 0.25);
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.echo-chat__cancel-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.08);
}

.echo-chat__cancel-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.echo-chat__running-hint {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 767px) {
  .app-main--echo .echo-chat__compose {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: stretch;
    gap: 8px;
    max-width: none;
    padding-left: 12px;
    padding-right: 12px;
  }

  .app-main--echo .echo-chat__field {
    grid-column: 1 / -1;
  }

  .app-main--echo .echo-chat__attach {
    grid-column: 1;
    grid-row: 2;
    align-self: stretch;
  }

  .app-main--echo .echo-chat__compose button[type="submit"],
  .app-main--echo .echo-chat__send {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    align-self: stretch;
  }

  .echo-view {
    max-width: none;
  }
}

.lb-msg {
  max-width: 94%;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  word-break: break-word;
}

.lb-msg--user {
  align-self: flex-end;
  margin-left: auto;
  border-radius: 16px 16px 4px 16px;
  background: rgba(240, 31, 1, 0.06);
}

.lb-msg--assistant {
  align-self: flex-start;
  border-radius: 16px 16px 16px 4px;
}

.lb-msg--pending {
  opacity: 0.75;
  font-style: italic;
}

.lb-msg__meta {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 6px;
}

.lb-msg__body {
  margin: 0;
  line-height: 1.5;
  font-size: 0.92rem;
}

.lb-msg__status {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.lb-msg__status--running { color: #b45309; }
.lb-msg__status--cancelled { color: #6b7280; }
.lb-msg__status--failed { color: var(--red); }
.lb-msg__status--done { color: #1a8f4a; }

.empty {
  color: var(--muted);
  text-align: center;
  margin-top: 28vh;
  font-size: 0.95rem;
}

/* ——— Grid idle diagnostics ——— */
.bal-panel--grid-idle .bal-grid-idle__kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.bal-grid-idle__list {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ——— Orchestration status (Статус tab) ——— */
.orch-status-panel {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.orch-status-panel__heading {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.orch-status-panel__sub {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.orch-status-panel__error {
  margin: 0;
  color: var(--red);
  font-size: 0.9rem;
}

.orch-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .orch-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.orch-status-card {
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.orch-status-card--ok {
  border-color: rgba(22, 163, 74, 0.35);
}

.orch-status-card--critical {
  border-color: rgba(240, 31, 1, 0.4);
  background: linear-gradient(180deg, rgba(240, 31, 1, 0.06) 0%, var(--surface) 55%);
}

.orch-status-card--warn {
  border-color: rgba(234, 179, 8, 0.45);
}

.orch-status-card--idle,
.orch-status-card--disabled {
  opacity: 0.92;
}

.orch-status-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.orch-status-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.orch-status-card__label {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 600;
}

.orch-status-card__detail {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.orch-status-card__time {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.orch-status-infra {
  margin-top: 12px;
  font-size: 0.82rem;
}

.orch-status-infra summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.orch-status-infra__list {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
}

.orch-status-infra__list li {
  margin: 4px 0;
  line-height: 1.35;
}

.orch-status-infra__list code {
  font-size: 0.78em;
}

/* ——— Prompt editor ——— */
.prompt-panel {
  padding: 16px 20px 24px;
  max-width: 960px;
}

.prompt-panel__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.prompt-panel__select {
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.prompt-message {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.prompt-message.error {
  color: var(--red);
}

.prompt-editor {
  position: relative;
}

.prompt-editor__actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.prompt-editor__fab {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.prompt-editor__fab[hidden] {
  display: none !important;
}

.prompt-editor__fab:active:not(:disabled) {
  transform: scale(0.96);
}

.prompt-editor__fab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.prompt-editor__fab--edit {
  font-size: 1.05rem;
}

.prompt-editor__fab--cancel {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.prompt-editor__fab--save {
  color: #fff;
  background: #1a8f4a;
  border-color: #1a8f4a;
}

.prompt-editor__body {
  display: block;
  width: 100%;
  min-height: min(70vh, 640px);
  margin: 0;
  padding: 14px 14px 52px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 0.88rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  box-sizing: border-box;
}

.prompt-editor__body:focus {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 0;
}

.prompt-editor__body[readonly] {
  cursor: default;
}

.prompt-editor__body.is-editing {
  border-color: var(--border-strong);
}

/* ——— Status dashboard ——— */
.status-admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 16px 20px 0;
  max-width: 960px;
}

.status-restart-btn {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-text-fill-color: var(--ink);
}

.status-restart-btn:hover:not(:disabled) {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--ink);
}

.status-restart-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status-dashboard {
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  max-width: 960px;
}

.status-dashboard h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.status-dashboard h2 {
  font-size: 1.05rem;
  margin: 28px 0 10px;
  color: var(--ink);
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--red);
  display: inline-block;
}

.status-dashboard h3 {
  font-size: 0.95rem;
  margin: 16px 0 8px;
  color: var(--muted);
  font-weight: 600;
}

.status-dashboard p {
  margin: 8px 0;
  color: var(--text);
}

.status-dashboard blockquote {
  margin: 12px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--red);
  background: var(--surface-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
}

.status-dashboard ul {
  margin: 8px 0;
  padding-left: 1.2rem;
}

.status-dashboard li { margin: 6px 0; }

.status-dashboard code {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--ink);
}

.md-table-wrap {
  overflow-x: auto;
  margin: 10px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 520px;
}

.md-table th,
.md-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.md-table th {
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 600;
}

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

.status-raw {
  white-space: pre-wrap;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ——— Balance dashboard ——— */
.balance-dashboard {
  padding: 16px clamp(14px, 2vw, 28px) calc(24px + env(safe-area-inset-bottom));
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

.bal-dash {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.bal-skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(
    90deg,
    var(--surface-muted, #ececec) 0%,
    #f8f8f8 45%,
    var(--surface-muted, #ececec) 90%
  );
  background-size: 200% 100%;
  animation: bal-skeleton-shimmer 1.2s ease-in-out infinite;
}

.bal-skeleton--hero {
  min-height: 168px;
}

.bal-skeleton--bar {
  min-height: 56px;
}

@keyframes bal-skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.bal-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1a1d1d 55%, #2a1512 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.bal-hero::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 31, 1, 0.22), transparent 70%);
  pointer-events: none;
}

.bal-hero--split {
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}

.bal-hero__equity-groups {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bal-hero__equity-groups--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bal-hero__equity-groups--multi {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.bal-hero__equity-groups--tiles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

@media (min-width: 900px) {
  .bal-hero__equity-groups--tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.bal-hero__equity-groups--tiles .bal-tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.bal-tile__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  min-height: 2.75rem;
}

.bal-tile__head .bal-hero__label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.bal-tile__earn {
  min-height: 6.5rem;
  margin-bottom: 2px;
}

.bal-tile__earn .bal-hero__headline-row {
  min-height: 2.4rem;
  align-items: baseline;
  margin-bottom: 0;
}

.bal-tile__earn .bal-hero__pct {
  min-width: 3.5rem;
  text-align: right;
}

.bal-tile--live {
  border-color: rgba(240, 31, 1, 0.55);
  background: linear-gradient(180deg, rgba(240, 31, 1, 0.12) 0%, rgba(0, 0, 0, 0.2) 100%);
  box-shadow: inset 0 0 0 1px rgba(240, 31, 1, 0.12);
}

.bal-tile--live .bal-tile__badge {
  color: #ff8a75;
}

.bal-tile__earn-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
}

.bal-tile__earn-hint {
  margin: 2px 0 6px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
}

.bal-tile__closed {
  margin: 4px 0 0;
  min-height: 1rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.2;
}

.bal-tile__closed--empty {
  visibility: hidden;
}

.bal-earn-detail {
  margin: 8px 0 0;
  font-size: 0.78rem;
}
.bal-earn-detail summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}
.bal-earn-detail summary:hover {
  color: var(--text);
}
.bal-earn-detail__list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bal-earn-detail__item {
  display: grid;
  grid-template-columns: minmax(88px, 1.1fr) minmax(110px, 1.4fr) minmax(72px, 0.9fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.bal-earn-detail__pair { font-weight: 600; }
.bal-earn-detail__prices { color: var(--muted); font-variant-numeric: tabular-nums; }
.bal-earn-detail__reason { color: var(--muted); font-size: 0.72rem; }
.bal-earn-detail__pnl { justify-self: end; font-weight: 700; font-variant-numeric: tabular-nums; }

.bal-spot-dust {
  margin-top: 10px;
  padding: 10px 10px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 180, 80, 0.25);
  background: rgba(255, 180, 80, 0.06);
}
.bal-spot-dust__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.bal-spot-dust__label { font-size: 0.78rem; color: var(--muted); }
.bal-spot-dust__val { font-variant-numeric: tabular-nums; }
.bal-spot-dust__hint,
.bal-spot-dust__micro {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.bal-spot-dust__btn {
  margin-top: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 180, 80, 0.45);
  background: rgba(255, 180, 80, 0.12);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.bal-spot-dust__btn:hover:not(:disabled) { background: rgba(255, 180, 80, 0.2); }
.bal-spot-dust__btn:disabled { opacity: 0.6; cursor: wait; }

.bal-tile__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 5.5rem;
  align-items: start;
}

.bal-tile__stat {
  min-height: 4.5rem;
}

.bal-tile__stat-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.58);
}

.bal-tile__stat-hint {
  margin: 2px 0 4px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.38);
}

.bal-tile__stat-value {
  margin: 0;
  font-size: clamp(1.2rem, 2.8vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #fff;
}

.bal-tile__stat-value.positive {
  color: #6ee7b7;
}

.bal-tile__stat-value.negative {
  color: #fca5a5;
}

.bal-tile__stat-value--muted {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
}

.bal-tile__funds {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

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

.bal-tile__funds-label {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.bal-tile__funds-total {
  font-size: 1.05rem;
  color: #fff;
}

.bal-tile__bar {
  height: 8px;
  margin-bottom: 8px;
}

.bal-tile__funds-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bal-tile__funds-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
}

.bal-tile__funds-row strong {
  color: #fff;
  font-weight: 600;
}

.bal-tile__funds-eq {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.42);
  text-align: center;
}

.bal-tile__open {
  margin: 8px 0 0;
  min-height: 1.85rem;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.2;
}

.bal-tile__open--empty {
  visibility: hidden;
  background: transparent;
  padding: 0;
  margin-top: 8px;
}

.bal-tile__open.positive {
  color: #6ee7a0;
}

.bal-tile__open.negative {
  color: #f87171;
}

@media (min-width: 1100px) {
  .bal-hero__equity-groups--multi {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.bal-hero__breakdown {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bal-hero__equity-total {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
}

.bal-hero__equity-total strong {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.bal-hero__breakdown .bal-breakdown__bar {
  height: 8px;
  margin-bottom: 8px;
}

.bal-breakdown__legend--compact {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  gap: 4px;
}

.bal-breakdown__legend--compact li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.bal-hero__pool-summary {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.bal-hero__pool-summary-label {
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.bal-hero__pool-summary-muted {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

.bal-hero__equity--grid {
  border-color: rgba(251, 191, 36, 0.35);
}

.bal-hero__equity-groups--tiles .bal-hero__equity {
  height: 100%;
  align-self: stretch;
}

.bal-hero__equity-groups--multi .bal-hero__equity {
  height: auto;
  align-self: start;
}

.bal-hero__paper-total {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.bal-hero__paper-total strong {
  color: #fff;
  font-weight: 700;
}

.bal-hero__equity {
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
}

.bal-hero__equity--live {
  border-color: rgba(240, 31, 1, 0.35);
}

.bal-hero__equity--paper {
  border-color: rgba(96, 165, 250, 0.35);
}

.bal-hero__equity--spot {
  border-color: rgba(52, 211, 153, 0.35);
}

.bal-hero__equity--futures {
  border-color: rgba(167, 139, 250, 0.35);
}

.bal-hero__equity--volscalp {
  border-color: rgba(234, 88, 12, 0.35);
}

.bal-hero__equity--listingsnipe {
  border-color: rgba(20, 184, 166, 0.35);
}

.bal-hero__equity-kind {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}

.bal-hero__metric-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 8px 0 10px;
}

.bal-hero__metric-block {
  min-width: 0;
}

.bal-hero__metric-block .bal-hero__value {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
}

.bal-hero__headline {
  margin: 10px 0 2px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
}

.bal-hero__headline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 0 0 6px;
}

.bal-hero__headline-value {
  font-size: clamp(1.65rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.bal-hero__headline-row.positive .bal-hero__headline-value {
  color: #6ee7b7;
}

.bal-hero__headline-row.negative .bal-hero__headline-value {
  color: #fca5a5;
}

.bal-hero__mtm {
  margin: 2px 0 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.62);
}

.bal-hero__mtm-label {
  margin-right: 6px;
}

.bal-hero__mtm-value {
  font-weight: 650;
}

.bal-hero__mtm.positive .bal-hero__mtm-value {
  color: #86efac;
}

.bal-hero__mtm.negative .bal-hero__mtm-value {
  color: #fca5a5;
}

.bal-hero__brutto {
  margin: 0 0 8px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}

.bal-hero__sim-box {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.bal-hero__sim-title {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fcd34d;
}

.bal-hero__sim-equity {
  margin: 0 0 4px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
}

.bal-hero__sim-equity strong {
  font-weight: 700;
  color: #fff;
}

.bal-hero__sim-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
}

.bal-hero__sim-cash {
  margin: 0 0 6px;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.6);
}

.bal-hero__sim-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.4;
}

.bal-hero__sim-box--live {
  background: rgba(240, 31, 1, 0.08);
  border-color: rgba(240, 31, 1, 0.35);
}

.bal-hero__sim-box--live .bal-hero__sim-title {
  color: #fecaca;
}

.bal-hero__sim-box--live .bal-hero__sim-tag {
  background: rgba(240, 31, 1, 0.22);
  color: #fecaca;
}

.bal-hero__paper-total-muted {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
}

@media (max-width: 520px) {
  .bal-hero__equity-groups--triple .bal-hero__metric-pair {
    grid-template-columns: 1fr;
  }
}

.bal-hero__link {
  margin: 10px 0 0;
  font-size: 0.8rem;
}

.bal-inline-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent, #60a5fa);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.bal-panel--explainer .bal-panel__subtitle {
  margin: 0 0 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.bal-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 720px) {
  .bal-breakdown-grid {
    grid-template-columns: 1fr;
  }
}

.bal-breakdown {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
}

.bal-breakdown--spot {
  border-left: 3px solid #34d399;
}

.bal-breakdown--futures {
  border-left: 3px solid #a78bfa;
}

.bal-breakdown--volscalp {
  border-left: 3px solid #ea580c;
}

.bal-breakdown--listingsnipe {
  border-left: 3px solid #14b8a6;
}

.bal-breakdown__head {
  margin-bottom: 10px;
}

.bal-breakdown__title {
  margin: 0;
  font-size: 0.95rem;
}

.bal-breakdown__figures {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 6px;
}

.bal-breakdown__equity {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.bal-breakdown__tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
}

.bal-breakdown__bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 8px;
}

.bal-breakdown__seg--cash {
  background: #94a3b8;
}

.bal-breakdown__seg--pos {
  background: linear-gradient(90deg, #34d399, #60a5fa);
}

.bal-breakdown--futures .bal-breakdown__seg--pos {
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
}

.bal-breakdown__legend {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}

.bal-breakdown__legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.bal-breakdown__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bal-breakdown__dot--cash { background: #94a3b8; }
.bal-breakdown__dot--pos { background: #34d399; }
.bal-breakdown--futures .bal-breakdown__dot--pos { background: #a78bfa; }
.bal-breakdown__dot--unreal { background: #fbbf24; }

.bal-breakdown__metrics {
  margin: 0 0 10px;
  font-size: 0.82rem;
}

.bal-breakdown__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.bal-breakdown__row dt {
  margin: 0;
  color: var(--muted);
}

.bal-breakdown__row dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
}

.bal-breakdown__note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.wins-dash__title {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.wins-dash__filter {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.bal-hero__badge {
  margin: -2px 0 8px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.bal-hero__equity .bal-hero__value {
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
}

.bal-hero__details {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1.45;
}

.bal-hero__details li + li {
  margin-top: 4px;
}

.bal-hero__main {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.bal-hero__label {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}

.bal-hero__value {
  margin: 0;
  font-size: clamp(1.85rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.bal-hero__pnl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.bal-hero__pnl.positive {
  color: #7dffb0;
  background: rgba(46, 204, 113, 0.16);
}

.bal-hero__pnl.negative {
  color: #ff9b8a;
  background: rgba(240, 31, 1, 0.2);
}

.bal-hero__pnl.neutral {
  color: rgba(255, 255, 255, 0.85);
}

.bal-hero__pct {
  opacity: 0.9;
  font-weight: 600;
}

.bal-hero__pct--na {
  opacity: 0.55;
}

.bal-hero__baseline {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
}

.bal-hero__stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.bal-hero__stats-groups {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 280px;
  min-width: 0;
}

.bal-hero__stats-group {
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bal-hero__stats-group--live {
  border-color: rgba(240, 31, 1, 0.28);
}

.bal-hero__stats-group--paper {
  border-color: rgba(96, 165, 250, 0.28);
}

.bal-hero__stats-heading {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bal-hero__stats-group--live .bal-hero__stats-heading {
  color: #ff9b8a;
}

.bal-hero__stats-group--paper .bal-hero__stats-heading {
  color: #93c5fd;
}

.bal-hero__stats-group--spot .bal-hero__stats-heading {
  color: #6ee7b7;
}

.bal-hero__stats-group--futures .bal-hero__stats-heading {
  color: #c4b5fd;
}

.bal-hero__stats-group--volscalp .bal-hero__stats-heading {
  color: #fdba74;
}

.bal-hero__stats-group--listingsnipe .bal-hero__stats-heading {
  color: #5eead4;
}

.bal-hero__stats-subgroups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.bal-hero__stats--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bal-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 74px;
  padding: 10px 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

button.bal-stat-pill:hover,
button.bal-stat-pill:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  outline: none;
}

button.bal-stat-pill:active {
  transform: scale(0.97);
}

.bal-stat-pill--live {
  border-color: rgba(240, 31, 1, 0.35);
}

.bal-stat-pill--paper {
  border-color: rgba(96, 165, 250, 0.35);
}

button.bal-stat-pill--live:hover,
button.bal-stat-pill--live:focus-visible {
  border-color: rgba(240, 31, 1, 0.55);
  background: rgba(240, 31, 1, 0.12);
}

button.bal-stat-pill--paper:hover,
button.bal-stat-pill--paper:focus-visible {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.12);
}

.bal-subsection {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.bal-subsection:first-of-type {
  margin-top: 0;
}

.bal-subsection--live {
  border-left: 3px solid rgba(240, 31, 1, 0.55);
}

.bal-subsection--paper {
  border-left: 3px solid rgba(37, 99, 235, 0.55);
}

.bal-subsection__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.bal-jump-target.bal-section--highlight {
  animation: bal-section-flash 1.4s ease;
}

@keyframes bal-section-flash {
  0%, 100% {
    box-shadow: var(--shadow);
    border-color: var(--border);
  }
  20%, 45% {
    box-shadow: 0 0 0 3px rgba(240, 31, 1, 0.28);
    border-color: rgba(240, 31, 1, 0.45);
  }
}

.bal-stat-pill__val {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.bal-stat-pill__lbl {
  margin-top: 4px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

.bal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bal-kpi-grid--live .bal-kpi--live {
  border-left: 3px solid rgba(240, 31, 1, 0.45);
}

.bal-kpi-grid--paper .bal-kpi--paper {
  border-left: 3px solid rgba(37, 99, 235, 0.45);
}

.bal-kpi--paper.bal-kpi--primary {
  border-left-width: 4px;
  border-left-color: rgba(37, 99, 235, 0.85);
  background: rgba(37, 99, 235, 0.04);
}

.bal-flow {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(37, 99, 235, 0.05);
}

.bal-flow__title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.bal-flow__note {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.bal-flow__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .bal-flow__grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

.bal-flow__card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.bal-flow__card--primary {
  border-color: rgba(37, 99, 235, 0.35);
}

.bal-flow__card-label {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

.bal-flow__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.bal-flow__label {
  color: var(--muted);
}

.bal-flow__value {
  font-weight: 600;
  text-align: right;
}

.bal-flow__hint,
.bal-flow__transfer {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.bal-flow__wallets {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.bal-panel--kpi .bal-panel__title {
  margin-bottom: 12px;
}

.bal-kpi {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.bal-kpi__label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bal-kpi__value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.bal-kpi__hint {
  margin: 6px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.35;
}

.bal-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.bal-panel__title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--red);
  display: inline-block;
}

.bal-panel__subtitle {
  margin: -6px 0 14px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.bal-glossary {
  margin-bottom: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.bal-glossary summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  user-select: none;
  list-style: none;
}

.bal-glossary summary::-webkit-details-marker {
  display: none;
}

.bal-glossary summary::before {
  content: "▸ ";
  color: var(--red);
}

.bal-glossary[open] summary::before {
  content: "▾ ";
}

.bal-glossary__body {
  padding: 0 14px 14px;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.5;
}

.bal-glossary__lead {
  margin: 10px 0 6px;
  font-weight: 700;
  color: var(--ink);
}

.bal-glossary__lead:first-child {
  margin-top: 0;
}

.bal-glossary__list {
  margin: 0 0 8px;
  padding-left: 18px;
}

.bal-glossary__list li {
  margin-bottom: 6px;
}

.bal-glossary__note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.82rem;
}

.bal-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 400;
}

.bal-term {
  min-width: 0;
  flex: 1;
  padding-right: 8px;
}

.bal-mode-pnl__title-wrap {
  min-width: 0;
  flex: 1;
}

.bal-mode-pnl__desc {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  font-weight: 400;
}

.bal-panel--pnl {
  border-color: rgba(240, 31, 1, 0.18);
}

.bal-mode-pnl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.bal-course-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.bal-panel--course {
  margin-top: 0.5rem;
}

.bal-course-card .bal-mode-pnl__head {
  align-items: flex-start;
  gap: 0.5rem;
}

.bal-mode-pnl {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.bal-mode-pnl--total {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(240, 31, 1, 0.06), rgba(240, 31, 1, 0.02));
  border-color: rgba(240, 31, 1, 0.22);
}

.bal-mode-pnl__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.bal-mode-pnl__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.bal-mode-pnl__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bal-mode-pnl__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.88rem;
}

.bal-mode-pnl__row--now {
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px dashed var(--border);
}

.bal-mode-pnl__row--now .bal-pnl {
  font-size: 1.05rem;
}

.bal-mode-pnl__lbl {
  color: var(--muted);
  font-weight: 500;
}

.bal-mode-pnl__count {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.bal-pos-card__pnl {
  margin-bottom: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.bal-pos-card__pnl-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.bal-pos-card__pnl-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bal-pos-card__pnl-value {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bal-pos-card__pnl-main.positive .bal-pos-card__pnl-value {
  color: #1a8f4a;
}

.bal-pos-card__pnl-main.negative .bal-pos-card__pnl-value {
  color: var(--red);
}

.bal-pos-card__pnl-main.neutral .bal-pos-card__pnl-value {
  color: var(--ink);
}

.bal-pos-card__pnl-move {
  font-size: 0.78rem;
  color: var(--muted);
}

.bal-pos-card__pnl-scenarios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bal-pos-card__pnl-scenario {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.bal-pos-card__pnl-scenario-lbl {
  color: var(--muted);
  font-weight: 500;
}

.bal-pos-card__details {
  margin-top: 4px;
}

.bal-pos-card__details summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.bal-pos-card__details .bal-pos-card__stats {
  margin-top: 10px;
}

.bal-alloc__bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-muted);
  margin-bottom: 14px;
}

.bal-alloc__seg {
  min-width: 4px;
  transition: width 0.3s ease;
}

.bal-alloc__seg--grid { background: #f01f01; }
.bal-alloc__seg--live { background: #059669; }
.bal-alloc__seg--spot { background: #2563eb; }
.bal-alloc__seg--futures { background: #7c3aed; }
.bal-alloc__seg--volscalp { background: #ea580c; }
.bal-alloc__seg--listingsnipe { background: #14b8a6; }

.bal-strategies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.bal-strategy {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
}

.bal-strategy--spot { border-left: 3px solid #34d399; }
.bal-strategy--futures { border-left: 3px solid #a78bfa; }
.bal-strategy--volscalp { border-left: 3px solid #ea580c; }
.bal-strategy--listingsnipe { border-left: 3px solid #14b8a6; }
.bal-strategy--grid { border-left: 3px solid #f01f01; }

.bal-strategy__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.bal-strategy__title {
  margin: 0;
  font-size: 0.95rem;
}

.bal-strategy__desc {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
}

.bal-strategy__equity {
  margin: 0;
  font-size: 0.88rem;
}

.bal-alloc__legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bal-alloc__item {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 0.88rem;
}

.bal-alloc__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.bal-alloc__dot--grid { background: #f01f01; }
.bal-alloc__dot--spot { background: #2563eb; }
.bal-alloc__dot--futures { background: #7c3aed; }
.bal-alloc__dot--volscalp { background: #ea580c; }
.bal-alloc__dot--listingsnipe { background: #14b8a6; }

.bal-alloc__name {
  color: var(--text);
  font-weight: 500;
}

.bal-alloc__val {
  font-weight: 700;
  color: var(--ink);
}

.bal-alloc__pct {
  color: var(--muted);
  font-size: 0.82rem;
  min-width: 3.5rem;
  text-align: right;
}

.bal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bal-meta__item {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.bal-lazy-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  background: var(--surface-muted);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.bal-segment {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.bal-segment__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.bal-segment__titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bal-segment__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.bal-segment__hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.bal-segment__status {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.bal-segment__chev {
  font-size: 1.2rem;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.bal-segment.is-open .bal-segment__chev {
  transform: rotate(90deg);
}

.bal-segment__body {
  padding: 0 12px 14px;
  border-top: 1px solid var(--border);
}

.bal-segment__loading {
  margin: 12px 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.bal-segment__body .bal-panel {
  margin-top: 12px;
  box-shadow: none;
  border: none;
  padding-left: 0;
  padding-right: 0;
}

.bal-pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.bal-pos-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.bal-pos-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.bal-pos-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.bal-pos-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0;
}

.bal-pos-card__stats div {
  min-width: 0;
}

.bal-pos-card__stats dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bal-pos-card__stats dd {
  margin: 2px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.bal-pair {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.bal-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bal-badge--mode {
  background: var(--surface-muted);
  color: var(--ink);
}

.bal-badge--live {
  background: rgba(240, 31, 1, 0.12);
  color: var(--red);
}

.bal-badge--paper {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.bal-badge--side-long,
.bal-badge--side-buy {
  background: rgba(46, 204, 113, 0.14);
  color: #1a8f4a;
}

.bal-badge--side-short,
.bal-badge--side-sell {
  background: rgba(240, 31, 1, 0.12);
  color: var(--red);
}

.bal-grid-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bal-grid-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--ink);
}

.bal-grid-chip em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.bal-grid-chip--grid {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.bal-grid-chip--sell-only {
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
}

.bal-panel__count {
  font-weight: 500;
  font-size: 0.85em;
  color: var(--muted);
}

.bal-badge--side-close {
  background: var(--surface-muted);
  color: var(--muted);
}

.bal-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.bal-table-wrap--scroll {
  max-height: 420px;
  overflow-y: auto;
}

.bal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 560px;
}

.bal-table th,
.bal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.bal-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.bal-table tbody tr:hover {
  background: rgba(240, 31, 1, 0.03);
}

.bal-ts {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.bal-pnl.positive {
  color: #1a8f4a;
  font-weight: 700;
}

.bal-pnl.negative {
  color: var(--red);
  font-weight: 700;
}

.bal-pnl.neutral {
  color: var(--muted);
}

.bal-empty-inline {
  margin: 0;
  padding: 12px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ——— Transaction journal ——— */
.journal-dashboard {
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
}

.journal-dash {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.journal-filters {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--surface-2, #f3f4f6);
  border-radius: 12px;
}

.journal-filter {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.journal-filter--active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.journal-filter__count {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.65;
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.journal-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.journal-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.journal-card--buy .journal-card__icon {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
}

.journal-card--sell .journal-card__icon {
  background: rgba(240, 31, 1, 0.1);
  color: #f01f01;
}

.journal-card--close .journal-card__icon {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
}

.journal-card--pending .journal-card__icon {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.journal-card__row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.journal-card__row--meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2px;
}

.journal-card__coin {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.journal-card__action {
  font-size: 0.875rem;
  color: var(--text);
}

.journal-card__pending {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.journal-card__pnl {
  margin-left: auto;
  font-weight: 600;
}

.journal-card__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 52px;
}

.journal-card__badge {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 6px;
  border-radius: 6px;
}

.journal-card__badge--live {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
}

.journal-card__badge--paper {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.journal-card__time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.journal-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.journal-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 4px;
  flex-wrap: wrap;
}

.journal-pager__btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border, #e5e7eb);
  background: #fff;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.journal-pager__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.journal-pager__btn:not(:disabled):active {
  background: var(--surface-2, #f3f4f6);
}

.journal-pager__info {
  font-weight: 700;
  font-size: 0.9375rem;
  min-width: 4rem;
  text-align: center;
}

.journal-pager__total {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ——— Успехи (round-trip PnL) ——— */
.wins-dashboard {
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  max-width: 640px;
}

.wins-dash {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wins-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.wins-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.wins-summary__item {
  padding: 12px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.wins-summary__label {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.wins-summary__value {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.wins-summary__value.positive { color: #15803d; }
.wins-summary__value.negative { color: var(--red); }

.wins-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wins-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.wins-filter--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wins-filter__count {
  font-size: 0.75rem;
  opacity: 0.85;
}

.wins-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.win-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.win-card--gain {
  border-left: 4px solid #15803d;
}

.win-card--loss {
  border-left: 4px solid var(--red);
}

.win-card__main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.win-card__pnl {
  font-size: 1.375rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.win-card__pnl.positive { color: #15803d; }
.win-card__pnl.negative { color: var(--red); }

.win-card__result {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
}

.win-card__time {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.win-card__meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.wins-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
}

.wins-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 8px;
}

.wins-pager__btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.125rem;
}

.wins-pager__btn:disabled {
  opacity: 0.4;
}

.wins-pager__info {
  font-weight: 700;
  min-width: 4rem;
  text-align: center;
}

.wins-pager__total {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ——— ML / Neural network dashboard ——— */
.ml-dashboard {
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  max-width: 1040px;
}

.ml-dash {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ml-hero {
  padding: 24px;
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.ml-hero--excellent {
  background: linear-gradient(135deg, #0f3d2e 0%, #14532d 45%, #166534 100%);
}

.ml-hero--good {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 55%, #2563eb 100%);
}

.ml-hero--bad {
  background: linear-gradient(135deg, #713f12 0%, #b45309 55%, #d97706 100%);
}

.ml-hero--very_bad {
  background: linear-gradient(135deg, #450a0a 0%, #991b1b 55%, #dc2626 100%);
}

.ml-hero__eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.ml-hero__verdict {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.15;
}

.ml-hero__emoji {
  margin-right: 8px;
}

.ml-hero__summary,
.ml-hero__training {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  opacity: 0.92;
}

.ml-hero__training {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.88rem;
  opacity: 0.85;
}

.ml-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
}

.ml-panel__title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 700;
}

.ml-reasons {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text);
  line-height: 1.5;
}

.ml-reasons li + li {
  margin-top: 8px;
}

.ml-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ml-kpi-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ml-kpi {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.ml-kpi__label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.ml-kpi__value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.ml-kpi__hint {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.ml-trend--ok { color: #15803d; }
.ml-trend--info { color: #1d4ed8; }
.ml-trend--warn { color: #b45309; }

.ml-models {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ml-model {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.ml-model--active {
  border-color: #86efac;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.ml-model__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ml-model__head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.ml-model__subtitle {
  margin: 4px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 500;
}

.ml-model__purpose {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.ml-model__goal {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.ml-model__goal strong {
  color: var(--text);
  font-weight: 600;
}

.ml-model__metric {
  margin: 0 0 6px;
  font-size: 0.92rem;
}

.ml-model__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.ml-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.ml-badge--ok {
  background: #dcfce7;
  color: #166534;
}

.ml-badge--active {
  background: #bbf7d0;
  color: #14532d;
}

.ml-badge--warn {
  background: #fef3c7;
  color: #92400e;
}

.ml-badge--muted {
  background: var(--muted-bg, rgba(128, 128, 128, 0.15));
  color: var(--muted-fg, #888);
}

.ml-badge--bootstrap {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.ml-model--bootstrap {
  border-color: rgba(245, 158, 11, 0.35);
}

.ml-model__grid-status {
  margin: 0.65rem 0 0.5rem;
}

.ml-model__grid-label {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.ml-model__grid-hint,
.ml-model__grid-warn {
  font-size: 0.78rem;
  line-height: 1.35;
  margin: 0.35rem 0 0;
  color: var(--text-muted, #8a8a8a);
}

.ml-model__grid-warn {
  color: #b45309;
}

.ml-grid-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.2);
  overflow: hidden;
}

.ml-grid-progress__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.3s ease;
}

.ml-grid-progress--ok .ml-grid-progress__fill {
  background: #22c55e;
}

.ml-grid-progress--bootstrap .ml-grid-progress__fill {
  background: #f59e0b;
}

.ml-grid-progress--warn .ml-grid-progress__fill {
  background: #ef4444;
}

.ml-panel--grid-status .ml-grid-hero {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.ml-grid-hero__hint {
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0;
  color: var(--text-muted, #8a8a8a);
}

.ml-panel__hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.ml-hero__training--sub {
  margin-top: 6px;
  font-size: 0.82rem;
  opacity: 0.85;
}

.ml-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.ml-mode-grid--summary {
  grid-template-columns: 1fr;
}

.ml-mode-card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.ml-mode-card__title {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.ml-mode-card__purpose {
  margin: -4px 0 8px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--muted);
}

.ml-mode-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 0.78rem;
}

.ml-mode-card__stats span {
  display: block;
  color: var(--muted);
}

.ml-mode-card__stats strong {
  font-size: 0.86rem;
}

.ml-pnl--pos { color: #15803d; }
.ml-pnl--neg { color: #b91c1c; }

.ml-glossary {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(240, 31, 1, 0.06);
  border: 1px solid rgba(240, 31, 1, 0.12);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.ml-glossary p {
  margin: 0;
}

@media (min-width: 640px) {
  .bal-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .balance-dashboard {
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
  }

  .ml-dashboard {
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
  }

  .ml-models {
    grid-template-columns: 1fr;
  }

  .bal-hero {
    padding: 18px;
  }

  .bal-hero__equity-groups,
  .bal-hero__equity-groups--triple,
  .bal-hero__equity-groups--multi {
    grid-template-columns: 1fr;
  }

  .bal-hero__stats-subgroups {
    grid-template-columns: 1fr;
  }

  .bal-hero__stats {
    width: 100%;
  }

  .bal-stat-pill {
    min-height: 70px;
  }

  .bal-hero__stats-groups {
    width: 100%;
  }

  .bal-panel {
    padding: 14px;
  }

  .bal-mode-pnl-grid {
    grid-template-columns: 1fr;
  }

  .bal-pos-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  #app-screen {
    display: flex;
    flex-direction: row;
  }
  .app-main {
    flex: 1;
    min-height: 0;
  }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-backdrop:not([hidden]) { display: block; }
  .sidebar-brand { display: block; }
  .brand-logo--sidebar { max-width: 160px; }
}

@media (min-width: 768px) {
  .nav-toggle { display: none !important; }
  .sidebar-brand { display: block; }
}

/* ——— Orchestration feeds (tabs) ——— */
.feedback-dashboard {
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
}

.orch-dashboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orch-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}

.orch-tabs::-webkit-scrollbar {
  display: none;
  height: 0;
}

.orch-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 40px;
}

.orch-tab--active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.orch-tab__count {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.orch-panels {
  min-width: 0;
}

.orch-feed-panel--hidden {
  display: none;
}

.orch-feed__hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.orch-feed__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orch-feed__empty {
  margin: 0;
  padding: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  line-height: 1.45;
}

/* ——— Inquiry chat (orchestrator ↔ system) ——— */

.orch-chat {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}

.orch-chat__cycle-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--muted);
}

.orch-chat__thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.orch-chat__row {
  display: flex;
  width: 100%;
}

.orch-chat__row--orchestrator {
  justify-content: flex-end;
}

.orch-chat__row--system {
  justify-content: flex-start;
}

.orch-chat__bubble {
  max-width: min(92%, 520px);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.orch-chat__row--orchestrator .orch-chat__bubble {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-bottom-right-radius: 4px;
}

.orch-chat__row--system .orch-chat__bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.orch-chat__who {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.orch-chat__body {
  word-break: break-word;
}

.orch-chat__body .fb-card__section {
  font-size: 0.82rem;
}

.orch-chat__sys .orch-phase__pre {
  max-height: none;
  font-size: 0.7rem;
}

.orch-chat__details {
  margin-top: 8px;
  font-size: 0.72rem;
}

.orch-chat__details summary {
  cursor: pointer;
  color: var(--muted);
}

.orch-chat__tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(74, 222, 128, 0.15);
  color: #166534;
}

.orch-chat__tag--warn {
  background: rgba(251, 191, 36, 0.2);
  color: #92400e;
}

.orch-phase-card {
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.orch-phase-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.orch-phase-card__time {
  font-size: 0.8rem;
  color: var(--muted);
}

.orch-phase-card__meta {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

.orch-phase-card__cycle {
  margin: 0 0 8px;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.orch-phase-card__block {
  margin-top: 8px;
}

.orch-phase-card__block summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.orch-phase__pre {
  margin: 0;
  padding: 10px;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: visible;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
}

.orch-phase__empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.orch-phase-card__out {
  overflow: visible;
}

.orch-phase-card__chars {
  margin: 4px 0 0;
  font-size: 0.68rem;
  color: var(--muted);
}

/* ——— Feedback iterations (legacy cards) ——— */

.fb-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fb-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.fb-card--cursor {
  border-color: rgba(22, 163, 74, 0.25);
}

.fb-card--offline,
.fb-card--skipped {
  border-color: rgba(234, 179, 8, 0.35);
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.05) 0%, var(--surface) 40%);
}

.fb-card--failed {
  border-color: rgba(240, 31, 1, 0.3);
}

.fb-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.fb-card__time {
  font-size: 0.82rem;
  color: var(--muted);
}

.fb-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fb-badge {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.fb-badge--cursor {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
  color: #15803d;
}

.fb-badge--offline,
.fb-badge--skipped {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.35);
  color: #a16207;
}

.fb-badge--failed {
  background: var(--red-soft);
  border-color: rgba(240, 31, 1, 0.3);
  color: #b91c1c;
}

.fb-badge--task {
  background: var(--sidebar-bg);
  color: #fff;
  border-color: transparent;
}

.fb-badge--muted {
  color: var(--muted);
  background: transparent;
}

.fb-card__headline {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.fb-card__net {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.fb-pipeline {
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--accent, #3b82f6);
  background: rgba(59, 130, 246, 0.06);
  border-radius: 0 6px 6px 0;
}

.fb-pipeline__title {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.9;
}

.fb-pipeline__body {
  font-size: 0.9rem;
}

.fb-full-advice {
  margin-top: 0.75rem;
  font-size: 0.88rem;
}

.fb-full-advice summary {
  cursor: pointer;
  opacity: 0.85;
}

.fb-card__reason {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.25);
  font-size: 0.85rem;
  color: #92400e;
}

.fb-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fb-card__section {
  margin: 10px 0 4px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
}

.fb-card__section:first-child {
  margin-top: 0;
}

.fb-card__line,
.fb-card__lead {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.fb-card__empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.fb-card__foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

.fb-card__commit {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.fb-card__commit code {
  font-family: ui-monospace, monospace;
  font-size: 0.76rem;
}

/* Chain simulation view */
.chain-dashboard-inner { padding: 4px 0 24px; }
.chain-mode { margin: 0 0 12px; font-size: 0.88rem; color: var(--muted); }
.chain-hint { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.chain-kpi {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
@media (min-width: 520px) {
  .chain-kpi { grid-template-columns: repeat(4, 1fr); }
}
.chain-kpi__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chain-kpi__card--accent { border-color: var(--red); background: var(--red-soft); }
.chain-kpi__lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.chain-kpi__val { font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.chain-meta { margin: 0 0 16px; font-size: 0.8rem; color: var(--muted); }
.chain-section-title { margin: 20px 0 10px; font-size: 1rem; font-weight: 600; }
.chain-opp-list { display: flex; flex-direction: column; gap: 10px; }
.chain-opp {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.chain-opp--pos { border-left: 3px solid #0a7a3e; }
.chain-opp--neg { border-left: 3px solid var(--muted); }
.chain-opp__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.chain-opp__rank { font-size: 0.75rem; color: var(--muted); }
.chain-opp__path { flex: 1; font-size: 0.92rem; }
.chain-opp__bps { font-weight: 600; font-variant-numeric: tabular-nums; }
.chain-opp--pos .chain-opp__bps { color: #0a7a3e; }
.chain-opp__pnl { margin: 0 0 8px; font-size: 0.82rem; color: var(--muted); }
.chain-opp__legs {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--text);
}
.chain-opp__legs li { margin-bottom: 4px; }
.chain-sim-list { list-style: none; margin: 0; padding: 0; }
.chain-sim__item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.chain-sim__item .pos { color: #0a7a3e; font-weight: 600; }
.chain-sim__item .neg { color: var(--red); font-weight: 600; }

/* === Активность сейчас (balance tab) === */
.act-panel { display: flex; flex-direction: column; gap: 16px; }
.act-block { display: flex; flex-direction: column; gap: 8px; }

.act-pulse {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 0.86rem;
  color: var(--text);
}
.act-pulse__text { flex: 1; min-width: 0; }
.act-pulse__auto {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.act-pulse__dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  flex: none;
  background: var(--muted);
}
.act-pulse--live { border-color: rgba(46, 204, 113, 0.4); background: rgba(46, 204, 113, 0.08); }
.act-pulse--live .act-pulse__dot {
  background: #1a8f4a;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6);
  animation: actPulse 1.8s ease-out infinite;
}
.act-pulse--idle .act-pulse__dot { background: var(--muted); opacity: 0.6; }
@keyframes actPulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.act-table .act-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-table .act-age { color: var(--muted); white-space: nowrap; font-size: 0.8rem; }
.act-row--buy td:first-child { box-shadow: inset 3px 0 0 rgba(46, 204, 113, 0.5); }
.act-row--sell td:first-child { box-shadow: inset 3px 0 0 rgba(240, 31, 1, 0.45); }

.act-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.act-feed__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.act-feed__item:last-child { border-bottom: none; }
.act-feed__dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.act-feed__dot.bal-badge--side-buy, .act-feed__dot.bal-badge--side-long { background: #1a8f4a; }
.act-feed__dot.bal-badge--side-sell, .act-feed__dot.bal-badge--side-short { background: var(--red); }
.act-feed__dot.bal-badge--side-close { background: var(--muted); }
.act-feed__age { color: var(--muted); font-size: 0.78rem; white-space: nowrap; min-width: 76px; }
.act-feed__main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-feed__pnl { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.act-feed__pnl--muted { color: var(--muted); font-weight: 500; font-size: 0.78rem; }

.act-fills-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.act-fills-pager__btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
.act-fills-pager__btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.act-fills-pager__btn:hover:not(:disabled) { background: var(--surface-2, rgba(255,255,255,0.04)); }
.act-fills-pager__btn:disabled { opacity: 0.35; cursor: default; }
.act-fills-pager__page { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }

/* === Нейросеть: простой светофор (redesign) === */
.ml-dash--simple { display: flex; flex-direction: column; gap: 16px; }

.ml-light {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface);
}
.ml-light__emoji { font-size: 2.4rem; line-height: 1; flex: none; }
.ml-light__label { font-size: 1.15rem; font-weight: 800; margin: 0 0 4px; letter-spacing: 0.01em; }
.ml-light__headline { margin: 0; color: var(--text); font-size: 0.95rem; line-height: 1.45; }
.ml-light--green  { border-color: rgba(46,204,113,0.45); background: rgba(46,204,113,0.08); }
.ml-light--green  .ml-light__label { color: #1a8f4a; }
.ml-light--yellow { border-color: rgba(212,160,23,0.5);  background: rgba(212,160,23,0.10); }
.ml-light--yellow .ml-light__label { color: #b27d05; }
.ml-light--red    { border-color: rgba(240,31,1,0.45);   background: var(--red-soft); }
.ml-light--red    .ml-light__label { color: var(--red); }
.ml-light--grey   { border-color: var(--border); background: var(--surface-muted); }
.ml-light--grey   .ml-light__label { color: var(--muted); }

.ml-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; white-space: nowrap;
}
.ml-chip--green  { background: rgba(46,204,113,0.14); color: #1a8f4a; }
.ml-chip--yellow { background: rgba(212,160,23,0.16); color: #b27d05; }
.ml-chip--red    { background: var(--red-soft); color: var(--red); }
.ml-chip--grey   { background: var(--surface-muted); color: var(--muted); }

.ml-explain { margin: 0; color: var(--text); font-size: 0.92rem; line-height: 1.5; }

.ml-comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.ml-comp { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.ml-comp__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ml-comp__head h3 { margin: 0; font-size: 1rem; }
.ml-comp__text { margin: 0 0 10px; font-size: 0.88rem; color: var(--text); line-height: 1.45; }

.echo-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.echo-summary__status {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  font-size: 0.88rem;
  color: var(--muted);
}

.echo-summary__status--run {
  background: rgba(212, 160, 23, 0.12);
  color: #9a6b00;
  font-weight: 600;
}

.echo-summary__card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: var(--surface);
}

.echo-summary__card--plan {
  border-color: rgba(46, 120, 255, 0.35);
  background: rgba(46, 120, 255, 0.04);
}

.echo-summary__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.echo-summary__subtitle {
  margin: 14px 0 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.echo-summary__meta {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.echo-summary__body {
  font-size: 0.92rem;
  line-height: 1.5;
}

.echo-summary__p {
  margin: 0 0 6px;
}

.echo-summary__empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.echo-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.echo-step {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.echo-step__when {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.echo-step__text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.echo-logs-fold {
  margin: 8px 0 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0 12px 12px;
}

.echo-logs-fold__summary {
  cursor: pointer;
  padding: 12px 4px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.echo-logs-fold__body {
  margin-top: 4px;
}

.echo-chat-section__hint {
  flex-shrink: 0;
  margin: 0;
  padding: 12px 16px 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.bal-hero--compact {
  margin-bottom: 8px;
}

.listings-panel {
  margin: 0 0 16px;
}

.listings-panel__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.listings-panel__head {
  margin-bottom: 10px;
}

.listings-panel__title-main {
  margin: 0 0 4px;
  font-size: 1rem;
}

.listings-panel__meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.listings-panel__health {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.listings-panel__health--warn {
  color: #b45309;
}

.listings-panel__health--ok {
  color: var(--muted);
}

.listings-panel__table-wrap {
  overflow-x: auto;
}

.listings-panel__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.listings-panel__table th,
.listings-panel__table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.listings-panel__table th {
  color: var(--muted);
  font-weight: 600;
}

.listings-panel__title {
  max-width: 280px;
  color: var(--muted);
}

.listings-panel__hint {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.ml-comp__stats { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; color: var(--muted); }
.ml-comp__stats strong { color: var(--text); }

.ml-foot { margin: 0; font-size: 0.78rem; color: var(--muted); text-align: center; }

/* ——— Money cockpit ——— */
.money-dashboard {
  padding: 0 0 28px;
}

.money-cockpit {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
  padding: 4px 14px 0;
}

.money-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}

.money-hero__eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.money-hero__title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
}

.money-hero__sub {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.money-hero__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.money-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.money-pill--ok {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.25);
  color: #15803d;
}

.money-pill--warn {
  background: rgba(180, 83, 9, 0.1);
  border-color: rgba(180, 83, 9, 0.28);
  color: #b45309;
}

.money-pill--off {
  background: var(--surface-muted);
  color: var(--muted);
}

.money-risk {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.money-risk--halted {
  border-color: rgba(240, 31, 1, 0.45);
  background: var(--red-soft);
}

.money-risk__main {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.money-risk__cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.money-risk__label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.money-risk__cell strong {
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}

.money-halt-on {
  color: var(--red);
}

.money-risk__reason {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--red);
}

.money-ack-btn {
  margin-top: 12px;
  border: none;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
}

.money-ack-btn:hover {
  background: var(--red-hover);
}

.money-ack-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.money-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.money-flag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
}

.money-flag--off {
  color: var(--muted);
}

.money-flag--on {
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.3);
}

.money-flag--warn {
  color: var(--red);
  border-color: rgba(240, 31, 1, 0.35);
  background: var(--red-soft);
}

.money-pulse {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.money-pulse__row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 0.88rem;
}

.money-pulse__label {
  color: var(--muted);
  font-size: 0.78rem;
}

.money-pulse__value {
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.money-events,
.money-check {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.money-section-head,
.money-check__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.money-section-head h3,
.money-check__title {
  margin: 0;
  font-size: 0.95rem;
}

.money-check__progress {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.money-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.money-table th,
.money-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.money-table th {
  color: var(--muted);
  font-weight: 600;
}

.money-side-tracks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.money-check__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.money-check__item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.84rem;
  color: var(--text);
}

.money-check__item.is-done {
  color: var(--muted);
}

.money-check__mark {
  flex-shrink: 0;
  width: 1.1em;
  color: var(--muted);
  font-weight: 700;
}

.money-check__item.is-done .money-check__mark {
  color: #15803d;
}

@media (max-width: 640px) {
  .money-risk__main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .money-pulse__row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .money-side-tracks {
    grid-template-columns: 1fr;
  }
}
