:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-2: #20232a;
  --text: #f4f5f7;
  --muted: #9aa3af;
  --line: #30343d;
  --green: #37d38a;
  --yellow: #e8c24a;
  --red: #ff6961;
  --blue: #65a9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.side-nav {
  display: flex;
  flex-direction: column;
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: #14161a;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  font-weight: 800;
  font-size: 16px;
}

.side-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 12px rgba(101, 169, 255, 0.65);
}

.side-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  flex: 1;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: auto;
  padding: 12px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.side-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.side-nav-item:hover {
  background: var(--panel-2);
  color: var(--text);
}

.side-nav-item.active {
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  border-radius: 999px 0 0 999px;
  margin-right: -13px;
  padding-right: 29px;
}

.side-nav-item.active:hover {
  background: var(--text);
}

.side-nav-footer {
  display: grid;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.side-nav-footer button {
  width: 100%;
}

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  background: #14161a;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

p {
  color: var(--muted);
}

main {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.account-copy span,
.account-copy small,
.user-card span,
.user-card small,
.client-card span,
.client-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-copy strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.account-copy small {
  margin-top: 4px;
}

.view-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #14161a;
}

.view-tab {
  min-width: 110px;
  border-color: transparent;
}

.view-tab.active {
  background: var(--blue);
  color: #08111f;
  font-weight: 800;
}

.view-section {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none !important;
}

.test-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.test-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.test-card.active {
  border-color: rgba(101, 169, 255, 0.75);
  background: rgba(101, 169, 255, 0.08);
}

.test-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.test-card-head span,
.test-card small,
.test-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.test-card-head strong {
  font-size: 20px;
  text-align: right;
}

.test-card small {
  line-height: 1.35;
}

.test-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.test-metrics div {
  min-height: 60px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.test-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
}

button,
select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

button {
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #4b5563;
}

.primary {
  background: var(--blue);
  color: #08111f;
  border-color: var(--blue);
  font-weight: 800;
}

.danger {
  color: var(--red);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

/* Bento grid del Dashboard */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(88px, auto);
  gap: 14px;
}

.bento-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}

.bento-label {
  color: var(--muted);
  font-size: 13px;
}

.bento-value {
  font-size: 22px;
  font-weight: 800;
}

.bento-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.bento-hero {
  grid-column: span 2;
  grid-row: span 2;
  justify-content: flex-end;
  gap: 10px;
  padding: 26px;
  border-color: rgba(101, 169, 255, 0.4);
  background: linear-gradient(135deg, rgba(101, 169, 255, 0.14), rgba(168, 85, 247, 0.08));
}

.bento-hero .bento-value {
  font-size: 42px;
}

.bento-hero.positive .bento-value {
  color: var(--green);
}

.bento-hero.negative .bento-value {
  color: var(--red);
}

.bento-ring-tile {
  grid-column: span 2;
  grid-row: span 2;
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

.bento-ring-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.bento-ring {
  --pct: 0;
  --ring-color: var(--blue);
  position: relative;
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.09) 0);
  display: grid;
  place-items: center;
}

.bento-ring::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--panel);
}

.bento-ring span {
  position: relative;
  font-size: 17px;
  font-weight: 800;
}

.bento-small {
  grid-column: span 1;
}

.bento-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.bento-icon svg {
  width: 18px;
  height: 18px;
}

.bento-icon-blue {
  color: var(--blue);
  background: rgba(101, 169, 255, 0.14);
}

.bento-icon-violet {
  color: #a855f7;
  background: rgba(168, 85, 247, 0.14);
}

.bento-icon-amber {
  color: var(--yellow);
  background: rgba(232, 194, 74, 0.14);
}

.bento-icon-green {
  color: var(--green);
  background: rgba(55, 211, 138, 0.14);
}

.bento-icon-red {
  color: var(--red);
  background: rgba(255, 105, 97, 0.14);
}

.diagnosis-panel {
  display: grid;
  gap: 14px;
}

.wallet-panel {
  display: grid;
  gap: 14px;
}

.real-mode-panel {
  display: grid;
  gap: 14px;
  border-color: rgba(232, 194, 74, 0.35);
}

.user-grid,
.client-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.client-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.user-card,
.client-card {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.user-card strong,
.client-card strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 22px;
}

.user-card small,
.client-card small {
  margin-top: 8px;
  line-height: 1.35;
}

.user-card.ready,
.client-card.ready {
  border-color: rgba(55, 211, 138, 0.35);
}

.user-card.locked,
.client-card.locked {
  border-color: rgba(232, 194, 74, 0.35);
  background: rgba(232, 194, 74, 0.06);
}

.strategy-panel {
  display: grid;
  gap: 14px;
}

.wallet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
}

.real-mode-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
}

.real-safety-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(240px, 1fr) minmax(220px, 0.8fr);
  gap: 10px;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
}

.strategy-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.strategy-card.active {
  border-color: rgba(55, 211, 138, 0.55);
  background: rgba(55, 211, 138, 0.08);
}

.strategy-card.locked {
  border-color: rgba(255, 105, 97, 0.35);
  background: rgba(255, 105, 97, 0.06);
}

.strategy-card span,
.strategy-rules small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.strategy-card strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.strategy-card p {
  margin: 7px 0 0;
  line-height: 1.4;
}

.strategy-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.strategy-rules small {
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.wallet-card {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.real-card {
  min-height: 106px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.wallet-card span,
.real-card span,
.real-limits span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.wallet-card strong,
.real-card strong,
.real-limits strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.wallet-card small,
.real-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.wallet-card.ready {
  border-color: rgba(55, 211, 138, 0.35);
}

.wallet-card.locked,
.real-card.locked {
  border-color: rgba(255, 105, 97, 0.4);
  background: rgba(255, 105, 97, 0.07);
}

.wallet-card.locked strong,
.real-card.locked strong {
  color: var(--red);
}

.real-card.ready {
  border-color: rgba(55, 211, 138, 0.4);
  background: rgba(55, 211, 138, 0.07);
}

.real-card.ready strong {
  color: var(--green);
}

.real-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 105, 97, 0.45);
  border-radius: 8px;
  color: var(--red);
  background: rgba(255, 105, 97, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.real-status.ready {
  border-color: rgba(55, 211, 138, 0.45);
  color: var(--green);
  background: rgba(55, 211, 138, 0.08);
}

.real-checks,
.real-limits,
.real-next {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.real-checks {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.real-check,
.real-limits div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.real-check strong,
.real-check span,
.real-check em {
  display: block;
  font-style: normal;
}

.real-check strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.real-check span,
.real-check em {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.real-check.ok strong {
  color: var(--green);
}

.real-check.wait strong {
  color: var(--yellow);
}

.real-limits h3,
.real-next h3 {
  margin: 0;
  font-size: 16px;
}

.real-limits strong {
  font-size: 15px;
}

.real-next {
  align-content: start;
  border-color: rgba(101, 169, 255, 0.35);
  background: rgba(101, 169, 255, 0.06);
}

.real-next p {
  margin: 0;
  line-height: 1.45;
}

.emergency-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 105, 97, 0.3);
  border-radius: 8px;
  background: rgba(255, 105, 97, 0.04);
}

.emergency-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.emergency-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.emergency-head p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.emergency-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(55, 211, 138, 0.14);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.emergency-status.killed {
  background: rgba(255, 105, 97, 0.18);
  color: var(--red);
}

.emergency-reason {
  font-size: 13px;
  color: var(--red);
}

.emergency-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.emergency-actions input {
  flex: 1;
  min-width: 180px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

.emergency-stop-btn {
  background: rgba(255, 105, 97, 0.18);
  border-color: rgba(255, 105, 97, 0.55);
  font-weight: 800;
}

.emergency-limits {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
}

.emergency-limits label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.emergency-limits input {
  width: 140px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

.bot-wallet-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(101, 169, 255, 0.3);
  border-radius: 8px;
  background: rgba(101, 169, 255, 0.04);
}

.bot-wallet-panel h3 {
  margin: 0;
  font-size: 16px;
}

.bot-wallet-panel > p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.bot-wallet-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bot-wallet-form input {
  flex: 1;
  min-width: 220px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.bot-wallet-info {
  display: grid;
  gap: 12px;
}

.bot-wallet-address {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.bot-wallet-address span {
  color: var(--muted);
  font-size: 12px;
}

.bot-wallet-address strong {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.bot-wallet-address small {
  color: var(--muted);
  line-height: 1.4;
}

.bot-wallet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bot-wallet-balance {
  font-size: 13px;
  color: var(--muted);
}

.real-enable-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(232, 194, 74, 0.4);
  border-radius: 8px;
  background: rgba(232, 194, 74, 0.06);
}

.real-enable-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.real-enable-toggle input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.real-enable-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 105, 97, 0.14);
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.real-enable-status.on {
  background: rgba(55, 211, 138, 0.16);
  color: var(--green);
}

.real-trades-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.real-trades-list {
  display: grid;
  gap: 10px;
}

.test-controls-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notify-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.notify-form input {
  flex: 1;
  min-width: 220px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

.money-panel {
  display: grid;
  gap: 16px;
}

.money-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.flow-card,
.position-card,
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.flow-card {
  min-height: 104px;
  padding: 14px;
}

.flow-card span,
.history-numbers span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.flow-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.flow-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.flow-card.positive,
.position-card.positive {
  border-color: rgba(55, 211, 138, 0.35);
}

.flow-card.positive strong {
  color: var(--green);
}

.flow-card.negative,
.position-card.negative {
  border-color: rgba(255, 105, 97, 0.4);
}

.flow-card.negative strong {
  color: var(--red);
}

.positions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.positions-head h2 {
  margin-bottom: 0;
}

.positions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.position-card {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.position-money {
  display: grid;
  gap: 3px;
}

.position-money span,
.position-money em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.position-money strong {
  font-size: 20px;
}

.diagnosis-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.diagnosis-head h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.diagnosis-head p {
  margin-bottom: 0;
}

.diagnosis-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.readiness {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.readiness.positive {
  background: rgba(55, 211, 138, 0.16);
  color: var(--green);
}

.readiness.warning {
  background: rgba(232, 194, 74, 0.16);
  color: var(--yellow);
}

.readiness.negative {
  background: rgba(255, 105, 97, 0.16);
  color: var(--red);
}

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

.diagnosis-grid div,
.check {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.diagnosis-grid span,
.check span,
.check em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.diagnosis-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.check strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.check.ok strong {
  color: var(--green);
}

.check.wait strong {
  color: var(--yellow);
}

.workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
}

.panel {
  padding: 16px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.status-box,
.events {
  display: grid;
  gap: 8px;
}

.status-row,
.event {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.status-row span,
.event span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
}

.history-item.open {
  border-color: rgba(232, 194, 74, 0.42);
  box-shadow: inset 4px 0 0 var(--yellow);
}

.history-item.closed {
  border-color: rgba(101, 169, 255, 0.24);
}

.history-token {
  display: grid;
  align-content: start;
  gap: 6px;
}

.history-token .sim-badge {
  width: fit-content;
}

.history-numbers {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
}

.history-numbers div {
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.history-numbers strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.history-reason {
  grid-column: 2;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.token-name {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #2a2e37;
  font-size: 12px;
  font-weight: 800;
}

.pill.candidato {
  background: rgba(55, 211, 138, 0.15);
  color: var(--green);
}

.pill.observable {
  background: rgba(101, 169, 255, 0.16);
  color: var(--blue);
}

.pill.alto-riesgo {
  background: rgba(232, 194, 74, 0.16);
  color: var(--yellow);
}

.pill.bloqueado {
  background: rgba(255, 105, 97, 0.16);
  color: var(--red);
}

.pill.contract-muted {
  background: rgba(154, 163, 175, 0.12);
  color: var(--muted);
}

.sim-open-row {
  background: rgba(232, 194, 74, 0.08);
  box-shadow: inset 4px 0 0 var(--yellow);
}

.sim-closed-row {
  background: rgba(101, 169, 255, 0.06);
}

.sim-badge {
  margin-right: 6px;
  white-space: nowrap;
}

.sim-buy {
  background: rgba(232, 194, 74, 0.2);
  color: var(--yellow);
}

.sim-sold {
  background: rgba(101, 169, 255, 0.16);
  color: var(--blue);
}

.stress-test {
  width: fit-content;
  background: rgba(232, 194, 74, 0.14);
  color: var(--yellow);
}

.strategy-pill {
  width: fit-content;
  background: rgba(154, 163, 175, 0.12);
  color: var(--muted);
}

.sim-empty {
  color: var(--muted);
}

.profit {
  color: var(--green);
}

.loss {
  color: var(--red);
}

@media (max-width: 980px) {
  .app-shell {
    flex-direction: column;
  }

  .side-nav {
    position: relative;
    top: auto;
    height: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .side-nav-brand {
    padding: 12px 16px;
  }

  .side-nav-links {
    flex-direction: row;
    flex: none;
    padding: 8px;
  }

  .side-nav-item {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .side-nav-item.active {
    border-radius: 999px;
    margin-right: 0;
    padding-right: 16px;
  }

  .side-nav-footer {
    flex-direction: row;
    align-items: center;
    margin-left: auto;
    border-top: none;
    padding: 8px 16px;
    white-space: nowrap;
  }

  .side-nav-footer button {
    width: auto;
  }

  .topbar,
  .workspace,
  .account-strip,
  .panel-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

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

  .bento-hero,
  .bento-ring-tile {
    grid-column: span 2;
  }

  .diagnosis-head {
    flex-direction: column;
  }

  .diagnosis-grid,
  .test-breakdown,
  .user-grid,
  .client-grid,
  .wallet-grid,
  .real-mode-grid,
  .real-safety-grid,
  .strategy-grid,
  .money-flow,
  .positions-grid,
  .check-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .history-reason {
    grid-column: auto;
  }

  .history-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Home */

.home {
  --home-a: #22d3ee;
  --home-b: #a855f7;
  --home-bg: #05060a;
  --home-panel: #0d0f18;
  --home-line: rgba(148, 163, 184, 0.16);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(560px 320px at 82% -8%, rgba(168, 85, 247, 0.16), transparent),
    radial-gradient(480px 280px at 6% 8%, rgba(34, 211, 238, 0.10), transparent),
    var(--home-bg);
}

.home .eyebrow {
  color: var(--home-a);
}

.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--home-line);
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.home-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--home-a), var(--home-b));
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.65);
}

.home-nav-links {
  display: flex;
  gap: 24px;
  margin-right: auto;
  margin-left: 40px;
}

.home-nav-links a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.home-nav-links a:hover {
  color: var(--text);
}

.home-cta {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.home-cta-primary {
  background: linear-gradient(135deg, var(--home-a), var(--home-b));
  color: #050510;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(168, 85, 247, 0.35);
}

.home-secondary {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-main {
  flex: 1;
  display: grid;
  gap: 84px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 56px 28px 48px;
  width: 100%;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

.home-hero-copy {
  display: grid;
  gap: 18px;
  max-width: 520px;
}

.home-hero h1 {
  font-size: 44px;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.home-lead {
  font-size: 16px;
  line-height: 1.6;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 4px;
}

.home-stats {
  display: flex;
  gap: 32px;
  margin-top: 14px;
}

.home-stats div {
  display: grid;
  gap: 2px;
}

.home-stats strong {
  font-size: 24px;
  background: linear-gradient(135deg, var(--home-a), var(--home-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-stats span {
  color: var(--muted);
  font-size: 12px;
}

/* Visual del hero: grafico con brillo + tarjetas flotantes */

.home-hero-visual {
  position: relative;
  min-height: 380px;
}

.hero-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(closest-side, rgba(168, 85, 247, 0.28), transparent 70%);
  filter: blur(10px);
  z-index: 0;
}

.hero-chart-card {
  position: relative;
  z-index: 1;
  padding: 18px 18px 8px;
  border: 1px solid var(--home-line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--home-panel), #08090f);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.hero-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.hero-chart-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--home-a);
  font-weight: 700;
  font-size: 11px;
}

.hero-chart-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--home-a);
  box-shadow: 0 0 8px var(--home-a);
}

.hero-chart-svg {
  width: 100%;
  height: 180px;
  display: block;
}

.hero-float-card {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--home-line);
  border-radius: 12px;
  background: rgba(13, 15, 24, 0.9);
  backdrop-filter: blur(6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 12px;
}

.hero-float-card strong {
  display: block;
  font-size: 13px;
}

.hero-float-card small {
  color: var(--muted);
}

.hero-float-gauge {
  top: -18px;
  right: 4%;
  transform: rotate(-2deg);
}

.hero-float-signal {
  display: grid;
  gap: 4px;
  left: -6%;
  bottom: 18%;
  transform: rotate(2deg);
  max-width: 220px;
}

.hero-float-list {
  display: grid;
  gap: 6px;
  right: -4%;
  bottom: -22px;
  transform: rotate(-1deg);
}

.hero-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.gauge {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(var(--home-a) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.1) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.gauge::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #0d0f18;
}

.gauge span {
  position: relative;
  font-weight: 800;
  font-size: 15px;
}

/* Features */

.home-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
}

.home-feature {
  padding: 20px;
  border: 1px solid var(--home-line);
  border-radius: 12px;
  background: var(--home-panel);
}

.home-feature-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(168, 85, 247, 0.18));
  color: var(--home-a);
  font-weight: 800;
  font-size: 12px;
}

.home-feature h2 {
  font-size: 17px;
}

.home-feature p {
  margin: 0;
  line-height: 1.5;
}

/* Estrategias */

.home-strategies-head {
  display: grid;
  gap: 8px;
  max-width: 620px;
  margin-bottom: 24px;
}

.home-strategies-head h2 {
  font-size: 24px;
  line-height: 1.3;
}

.home-strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: 16px;
}

.home-strategy-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--home-line);
  border-radius: 12px;
  background: var(--home-panel);
}

.home-strategy-card .pill {
  width: fit-content;
}

.home-strategy-card p {
  margin: 0;
  line-height: 1.5;
}

.home-cta-block {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 32px;
  border: 1px solid var(--home-line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(168, 85, 247, 0.08));
}

.home-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--home-line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Login */

.login-body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-card h1 {
  margin: 6px 0 8px;
  font-size: 26px;
}

.login-card label {
  display: block;
  margin: 14px 0 7px;
  color: #b7c5d8;
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.login-card button {
  width: 100%;
  height: 44px;
  margin-top: 18px;
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--red);
  font-size: 14px;
}

.login-back {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Comparador de estrategias */

.comparator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.comparator-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.comparator-card.leader {
  border-color: rgba(55, 211, 138, 0.55);
  background: rgba(55, 211, 138, 0.08);
}

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

.comparator-head strong {
  font-size: 18px;
}

.comparator-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.comparator-metrics div {
  min-height: 56px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.comparator-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.comparator-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

/* Grafico de PnL */

.pnl-chart {
  display: grid;
  gap: 12px;
}

.pnl-svg {
  width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #14161a;
}

.pnl-zero-line {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.pnl-line {
  fill: none;
  stroke-width: 2;
}

.pnl-line.positive {
  stroke: var(--green);
}

.pnl-line.negative {
  stroke: var(--red);
}

.pnl-area.positive {
  fill: rgba(55, 211, 138, 0.12);
}

.pnl-area.negative {
  fill: rgba(255, 105, 97, 0.12);
}

.pnl-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.pnl-summary strong {
  font-size: 20px;
}

/* Alertas */

.alerts-feed {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.alert-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.alert-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.alert-item.warning {
  border-color: rgba(232, 194, 74, 0.4);
  box-shadow: inset 4px 0 0 var(--yellow);
}

.alert-item.error {
  border-color: rgba(255, 105, 97, 0.45);
  box-shadow: inset 4px 0 0 var(--red);
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #191b20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.toast strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.toast span {
  color: var(--muted);
  font-size: 13px;
}

.toast.warning strong {
  color: var(--yellow);
}

.toast.error strong {
  color: var(--red);
}


/* Sparklines por posicion */

.position-spark {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}

.spark-svg {
  width: 100%;
  height: 36px;
}

.spark-svg polyline {
  fill: none;
  stroke-width: 1.6;
}

.spark-svg.positive polyline {
  stroke: var(--green);
}

.spark-svg.negative polyline {
  stroke: var(--red);
}

.spark-empty {
  color: var(--muted);
  font-size: 11px;
}

/* Barra de resultado en historial */

.history-bar-track {
  width: 100%;
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.history-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.history-bar-fill.positive {
  background: var(--green);
}

.history-bar-fill.negative {
  background: var(--red);
}

@media (max-width: 980px) {
  .home-features {
    grid-template-columns: 1fr;
  }

  .home-strategy-grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    grid-template-columns: 1fr;
  }

  .home-hero-copy {
    max-width: none;
  }

  .home-hero-visual {
    min-height: 320px;
  }

  .home-nav-links {
    display: none;
  }

  .comparator-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .home-nav {
    padding: 16px 18px;
  }

  .home-main {
    padding: 40px 18px 32px;
    gap: 56px;
  }

  .home-hero h1 {
    font-size: 32px;
  }

  .home-hero-visual {
    min-height: 0;
  }

  .hero-float-card,
  .hero-glow {
    display: none;
  }

  .home-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .home-stats {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .topbar {
    padding: 20px;
  }

  main {
    padding: 12px;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .bento-hero,
  .bento-ring-tile,
  .bento-small {
    grid-column: 1;
    grid-row: auto;
  }

  .bento-ring-tile {
    flex-direction: column;
    align-items: flex-start;
  }

  .diagnosis-grid,
  .test-breakdown,
  .user-grid,
  .client-grid,
  .wallet-grid,
  .real-mode-grid,
  .real-safety-grid,
  .real-checks,
  .strategy-grid,
  .money-flow,
  .positions-grid,
  .check-list {
    grid-template-columns: 1fr;
  }

  .positions-head {
    align-items: start;
    flex-direction: column;
  }

  .history-numbers {
    grid-template-columns: 1fr;
  }
}
