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

:root {
  --bg: #05050a;
  --bg-soft: #08080f;
  --panel: #0c0c16;
  --panel-soft: #10101c;
  --panel-strong: #0a0a12;
  --line: #1c1c38;
  --line-soft: #14142a;
  --text: #c8c8e8;
  --muted: #5a5a80;
  --accent: #00e5ff;
  --accent-2: #ea00ff;
  --accent-3: #7b61ff;
  --accent-light: rgba(0, 229, 255, 0.06);
  --green: #39ff14;
  --red: #ff0040;
  --blue: #00a8ff;
  --yellow: #ffe600;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 0 20px rgba(0, 229, 255, 0.1);
  --shadow-accent-2: 0 0 20px rgba(234, 0, 255, 0.1);
  --radius: 2px;
  --radius-sm: 1px;
  --radius-lg: 4px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
strong { font-weight: 600; }

.app-shell {
  min-height: 100vh;
  padding: 12px;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.018) 1px, transparent 1px);
  background-size: 36px 36px;
}

.topbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
}

.top-status {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  flex: 1;
  min-width: 0;
}
.top-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(57, 255, 20, 0.5), 0 0 12px rgba(57, 255, 20, 0.2);
  flex-shrink: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-radius: 0;
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #0c0c16, #10081e, #0c0c16);
  border-color: var(--accent);
  border-top-color: var(--accent);
  border-bottom-color: var(--accent-2);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.08), 0 0 60px rgba(234, 0, 255, 0.04);
}

.brand-block { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 0;
  background: linear-gradient(135deg, #00e5ff, #7b61ff);
  color: #05050a;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35), 0 0 4px rgba(123, 97, 255, 0.5);
}
.brand-title { font-weight: 700; font-size: 16px; color: var(--accent); text-shadow: 0 0 10px rgba(0, 229, 255, 0.3); }
.brand-subtitle { color: var(--muted); font-size: 12px; }

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.top-actions .btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 0;
  border: 1px solid rgba(0, 229, 255, 0.2);
  background: linear-gradient(180deg, #14142a 0%, #0a0a18 100%);
  box-shadow:
    0 3px 0 0 #050510,
    0 0 12px rgba(0, 229, 255, 0.06),
    inset 0 1px 0 rgba(0, 229, 255, 0.06);
  transform: translateY(0);
  transition: transform .08s ease, box-shadow .08s ease, background .12s ease;
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
}
.top-actions .btn:hover {
  background: linear-gradient(180deg, #1c1c3a 0%, #14142a 100%);
  box-shadow:
    0 3px 0 0 #050510,
    0 0 20px rgba(0, 229, 255, 0.12),
    inset 0 1px 0 rgba(0, 229, 255, 0.1);
}
.top-actions .btn:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 0 #050510,
    0 0 6px rgba(0, 229, 255, 0.05),
    inset 0 1px 0 rgba(0, 229, 255, 0.03);
}
.top-actions .btn-primary {
  background: linear-gradient(180deg, #00e5ff 0%, #00a0b8 100%);
  border-color: rgba(0, 229, 255, 0.4);
  box-shadow:
    0 3px 0 0 #004a54,
    0 0 20px rgba(0, 229, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #05050a;
  font-weight: 800;
}
.top-actions .btn-primary:hover {
  background: linear-gradient(180deg, #33eeff 0%, #00c8e0 100%);
  box-shadow:
    0 3px 0 0 #004a54,
    0 0 30px rgba(0, 229, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.top-actions .btn-primary:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 0 #004a54,
    0 0 10px rgba(0, 229, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.top-actions .btn-accent {
  background: linear-gradient(180deg, #39ff14 0%, #28b80e 100%);
  border-color: rgba(57, 255, 20, 0.3);
  box-shadow:
    0 3px 0 0 #0f4a06,
    0 0 20px rgba(57, 255, 20, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #05050a;
  font-weight: 800;
}
.top-actions .btn-accent:hover {
  background: linear-gradient(180deg, #60ff40 0%, #39ff14 100%);
  box-shadow:
    0 3px 0 0 #0f4a06,
    0 0 30px rgba(57, 255, 20, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.top-actions .btn-accent:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 0 #0f4a06,
    0 0 10px rgba(57, 255, 20, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.top-actions .btn-danger {
  background: linear-gradient(180deg, #ff0040 0%, #c00030 100%);
  border-color: rgba(255, 0, 64, 0.3);
  box-shadow:
    0 3px 0 0 #500018,
    0 0 20px rgba(255, 0, 64, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 800;
}
.top-actions .btn-danger:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 0 #500018,
    0 0 10px rgba(255, 0, 64, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.desk-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 10px;
  align-items: start;
}
.app-shell.filters-collapsed .desk-layout {
  grid-template-columns: minmax(0, 1fr) 300px;
}
.app-shell.filters-collapsed .filters-panel { display: none; }

.panel {
  border-radius: 0;
  padding: 12px;
  border-left: 2px solid rgba(0, 229, 255, 0.15);
}
.panel-header,
.rail-head,
.compact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.compact-header,
.rail-head { margin-bottom: 10px; }
.subtle { color: var(--muted); font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace; }

.filters-panel {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 88px);
  overflow: auto;
}
.filters-form { display: grid; gap: 10px; }
.center-column,
.right-column { display: grid; gap: 10px; }

.side-panel { min-height: 0; }
.positions-panel { position: static; }
.signals-panel .list-root {
  max-height: 320px;
  overflow: auto;
  overscroll-behavior: contain;
}
.positions-panel[open] > .list-root {
  max-height: 38vh;
  overflow: auto;
  overscroll-behavior: contain;
}
.strategy-panel { position: static; }
.strategy-panel[open] > #strategyRoot {
  max-height: 50vh;
  overflow: auto;
  overscroll-behavior: contain;
}

.panel-actions-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.positions-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.command-panel {
  padding: 12px;
  background: var(--panel);
}
.panel-header h2,
.rail-head h2 {
  margin: 0 0 4px;
  font-size: 15px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.field-group,
.advanced-group {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-strong);
  border-left: 2px solid rgba(0, 229, 255, 0.12);
}
.field-group { padding: 12px; }
.field-group > h3 {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.quick-group,
.toolbar-group { display: grid; gap: 8px; }
.toolbar-row { display: grid; gap: 6px; }
.toolbar-row > label,
.field label { color: var(--muted); font-size: 11px; }
.field,
.field-inline { display: grid; gap: 6px; }
.wallet-manager-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.wallet-manager-field { gap: 8px; }
.address-copy-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.address-copy-row .mono { min-width: 0; }

.segmented,
.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.segment-btn,
.check-pill {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1;
  transition: .15s ease;
}
.segment-btn:hover,
.check-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.1);
}
.segment-btn.active,
.check-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #05050a;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
  text-shadow: none;
}

.grid-2, .grid-3, .ranges-grid, .mini-grid, .strategy-grid, .stats-grid, .portfolio-grid {
  display: grid;
  gap: 10px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ranges-grid { grid-template-columns: 1fr; }
.mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.strategy-grid { grid-template-columns: 1fr; }
.strategy-grid .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.strategy-grid .field {
  overflow-wrap: break-word;
  word-break: break-word;
}
.strategy-grid .address-copy-row { flex-wrap: wrap; }

.input, .select {
  width: 100%;
  min-width: 60px;
  min-height: 36px;
  font-size: 13px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  transition: .15s ease;
}
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.15), 0 0 12px rgba(0, 229, 255, 0.08);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

.input:focus-visible,
.select:focus-visible,
.btn:focus-visible,
.check-pill:focus-visible,
.segment-btn:focus-visible,
summary:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
  border-color: var(--accent);
}

.toggle-list,
.toggle-grid { display: grid; gap: 8px; }
.toggle-grid { grid-template-columns: 1fr; }
.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-soft);
  transition: .15s ease;
}
.toggle-item:hover { border-color: rgba(0, 229, 255, 0.25); }
.toggle-item label { font-size: 12px; color: var(--text); }
.compact-group { padding: 10px; }

.advanced-group,
.collapse-panel { overflow: hidden; }
.advanced-group summary,
.collapse-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  transition: .15s ease;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: .02em;
}
.advanced-group summary:hover,
.collapse-summary:hover {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
}
.advanced-group summary::-webkit-details-marker,
.collapse-summary::-webkit-details-marker { display: none; }
.advanced-group[open] summary,
.collapse-panel[open] .collapse-summary { border-bottom: 1px solid var(--line); }
.advanced-group > *:not(summary),
.collapse-panel > *:not(summary) { padding: 12px 14px 14px; }
.collapse-panel.panel { padding: 0; }
.collapse-panel.side-panel:not([open]) { min-height: 0; }
.collapse-panel.side-panel:not([open]) .list-root { display: none; }
.preview-panel { background: var(--panel); }

.status-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 0;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(0, 229, 255, 0.15);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.toolbar-value { font-size: 12px; color: var(--text); }

.btn {
  min-height: 36px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 14px;
  transition: .15s ease;
  font-weight: 500;
}
.btn:hover { background: var(--accent-light); border-color: rgba(0, 229, 255, 0.3); color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #05050a;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.25);
}
.btn-primary:hover { box-shadow: 0 0 24px rgba(0, 229, 255, 0.35); }
.btn-secondary { background: transparent; }
.btn-secondary:hover { background: var(--accent-light); }
.btn-accent {
  background: rgba(57, 255, 20, 0.08);
  border-color: rgba(57, 255, 20, 0.25);
  color: var(--green);
}
.btn-accent:hover {
  background: rgba(57, 255, 20, 0.15);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.15);
}
.btn-danger {
  background: rgba(255, 0, 64, 0.08);
  border-color: rgba(255, 0, 64, 0.25);
  color: var(--red);
}
.btn-danger:hover {
  background: rgba(255, 0, 64, 0.15);
  box-shadow: 0 0 12px rgba(255, 0, 64, 0.15);
}
.btn-small {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 0;
}

/* ---- Toggle Switches ---- */
.action-group { margin-bottom: 10px; }
.switch-list { display: grid; gap: 8px; }
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}
.switch-label {
  font-size: 12px;
  color: var(--text);
  user-select: none;
  cursor: pointer;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform .18s ease, background .18s ease;
}
.toggle-switch input:checked + .toggle-track {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
}
.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--accent);
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}
.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
  border-color: var(--accent);
}
.switch-row-buttons {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}
.pill-btn {
  height: 24px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s ease;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.pill-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.12);
}
.pill-btn-accent {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--accent);
}
.pill-btn-accent:hover {
  background: rgba(0, 229, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}
.show-filters-btn {
  font-size: 12px;
}

.stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 10px;
  min-height: auto;
  transition: .15s ease;
  border-left: 2px solid rgba(0, 229, 255, 0.2);
}
.stat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}
.stat-label {
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.stat-value { font-size: 14px; font-weight: 700; }

.toast-root {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}
.toast {
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}
.toast-success {
  border-color: rgba(57, 255, 20, 0.3);
  color: var(--green);
  background: rgba(57, 255, 20, 0.06);
  border-left: 3px solid var(--green);
}
.toast-error {
  border-color: rgba(255, 0, 64, 0.3);
  color: var(--red);
  background: rgba(255, 0, 64, 0.06);
  border-left: 3px solid var(--red);
}

.results-panel { padding: 0; overflow: hidden; }
.results-head { padding: 10px 12px 0; }
.results-root { display: grid; gap: 10px; padding: 10px; }
.section-block {
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  background: var(--panel-strong);
  border-top: 2px solid var(--accent);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1020px;
}
th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 12px;
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  border-bottom: 1px solid var(--accent);
}
tbody tr { transition: .1s ease; }
tbody tr:hover { background: rgba(0, 229, 255, 0.04); }

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
}
.contract-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.copy-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 1px 6px;
  font-size: 10px;
  line-height: 1.5;
  cursor: pointer;
  flex: 0 0 auto;
  transition: .12s ease;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}
.col-token { min-width: 150px; }
.col-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--panel-strong);
}
th.col-actions {
  z-index: 4;
  background: var(--panel);
}
tbody tr:hover .col-actions {
  background: #0e0e1c;
}
.token-main { display: grid; gap: 2px; }
.token-sub { color: var(--muted); font-size: 10px; line-height: 1.25; }
.link { color: var(--blue); text-decoration: none; }
.link:hover { text-decoration: underline; }
.action-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.wrap-actions { min-width: 0; white-space: normal; }

.buy-reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  max-width: 180px;
  white-space: normal;
}
.buy-state {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.buy-state-ready {
  background: rgba(57, 255, 20, 0.1);
  border-color: rgba(57, 255, 20, 0.3);
  color: var(--green);
  box-shadow: 0 0 6px rgba(57, 255, 20, 0.1);
}
.buy-state-block {
  background: rgba(255, 0, 64, 0.06);
  border-color: rgba(255, 0, 64, 0.2);
  color: var(--red);
}

.list-root { display: grid; gap: 10px; }
.signal-card,
.position-card {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-strong);
  padding: 12px;
  transition: .15s ease;
  border-left: 2px solid rgba(0, 229, 255, 0.15);
}
.signal-card:hover,
.position-card:hover {
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: var(--shadow-accent);
}
.signal-sell { border-color: rgba(255, 0, 64, 0.3); border-left-color: var(--red); }
.signal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.signal-pnl {
  margin: 6px 0 10px;
  font-size: 12px;
  font-weight: 700;
}
.position-card { display: grid; gap: 10px; }
.position-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.position-title-block { min-width: 0; display: grid; gap: 6px; }
.position-title-row,
.position-summary-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.position-summary-row { color: var(--muted); font-size: 11px; }
.position-ratio { font-weight: 700; color: var(--text); }
.position-toggle { flex: 0 0 auto; }
.position-body { display: grid; gap: 10px; }
.position-body.hidden { display: none; }
.position-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-positive { color: var(--green); font-weight: 700; }
.metric-negative { color: var(--red); font-weight: 700; }
.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.section-title { font-size: 13px; margin: 0 0 8px; }
.portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.empty,
.error {
  border-radius: 0;
  padding: 14px;
}
.empty { color: var(--muted); background: var(--panel-soft); border: 1px dashed var(--line); }
.error {
  color: var(--red);
  border: 1px solid rgba(255, 0, 64, 0.3);
  background: rgba(255, 0, 64, 0.04);
  border-left: 3px solid var(--red);
}

.code-box {
  margin: 0;
  overflow: auto;
  max-height: 260px;
  padding: 0;
  color: #6a6a9e;
  background: transparent;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.55;
}

@media (max-width: 1600px) {
  .desk-layout { grid-template-columns: 230px minmax(0, 1fr) 280px; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1280px) {
  .wallet-manager-row { grid-template-columns: 1fr; }
  .desk-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .right-column {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .positions-panel,
  .filters-panel { position: static; max-height: none; }
  .positions-panel[open] > .list-root,
  .strategy-panel[open] > #strategyRoot,
  .signals-panel .list-root { max-height: 28vh; }
  .table-wrap { max-height: none; }
}

@media (max-width: 1040px) {
  .desk-layout { grid-template-columns: 1fr; }
  .app-shell.filters-collapsed .desk-layout { grid-template-columns: 1fr; }
  .filters-panel,
  .positions-panel { position: static; max-height: none; }
  .right-column { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .top-status { justify-content: flex-start; }
  .portfolio-grid,
  .toggle-grid,
  .ranges-grid,
  .grid-2,
  .grid-3,
  .stats-grid,
  .position-metrics { grid-template-columns: 1fr; }
  .positions-panel[open] > .list-root,
  .strategy-panel[open] > #strategyRoot,
  .signals-panel .list-root { max-height: 24vh; }
}

@media (max-width: 640px) {
  .app-shell { padding: 8px; }
  .top-actions { justify-content: stretch; }
  .wrap-actions { min-width: 0; }
  table { min-width: 880px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}

.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.modal-root:empty { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.8); pointer-events: auto; backdrop-filter: blur(4px); }
.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: 0;
  padding: 18px;
  pointer-events: auto;
  box-shadow: var(--shadow), 0 0 40px rgba(0, 229, 255, 0.06);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.mnemonic-box {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.wallet-transfer-grid { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.wallet-transfer-address { grid-column: 1 / -1; }
.wallet-transfer-token-row { grid-template-columns: 1fr; }
@media (max-width: 1280px) {
  .wallet-transfer-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column; }
}
