:root {
  --bg-deep: #060a12;
  --bg: #0a0f19;
  --panel: #131c2a;
  --panel-2: #182234;
  --panel-3: #1f2d43;
  --border: #223145;
  --border-soft: #2e4058;
  --text: #edf4f7;
  --muted: #8b98a9;
  --faint: #5f6e82;
  --green: #00e676;
  --green-dim: rgba(0, 230, 118, 0.16);
  --cyan: #00c2ff;
  --cyan-dim: rgba(0, 194, 255, 0.16);
  --amber: #ffb300;
  --amber-dim: rgba(255, 179, 0, 0.16);
  --red: #ff1744;
  --red-dim: rgba(255, 23, 68, 0.16);
  --radius: 8px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(0, 194, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 194, 255, 0.04) 1px, transparent 1px);
  background-size: 54px 54px;
}

.scanline {
  position: fixed;
  top: -2px;
  left: 0;
  right: 0;
  height: 2px;
  z-index: -1;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0.12;
  animation: scanline 10s linear infinite;
}

@keyframes scanline {
  from { transform: translateY(0); }
  to { transform: translateY(100vh); }
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: 58px minmax(0, 1fr);
  height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 25, 0.96);
  backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  white-space: nowrap;
}

.brand-mark {
  color: var(--green);
  font-weight: 800;
  letter-spacing: 0.28em;
  text-shadow: 0 0 18px var(--green-dim);
}

.brand-sub {
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.mode-pill {
  border: 1px solid rgba(0, 194, 255, 0.38);
  border-radius: 999px;
  padding: 5px 13px;
  background: var(--cyan-dim);
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.mode-pill.live {
  border-color: rgba(255, 23, 68, 0.52);
  background: var(--red-dim);
  color: var(--red);
}

.top-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex: 1;
  min-width: 0;
}

.top-stats div {
  display: grid;
  gap: 2px;
  text-align: center;
}

.top-stats span {
  color: var(--faint);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.top-stats strong {
  font-size: 0.82rem;
}

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

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

.kill-btn {
  border: 0;
  border-radius: 7px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #b7112e, var(--red));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow: 0 0 20px var(--red-dim);
}

.kill-btn.killed {
  background: #2c3340;
  color: var(--faint);
  box-shadow: none;
}

.icon-btn {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

.icon-btn span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 4px auto;
  background: var(--text);
}

.sidebar {
  grid-row: 2;
  padding: 12px 8px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: rgba(10, 15, 25, 0.96);
}

.nav-section {
  padding: 10px 12px 6px;
  color: var(--faint);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(90deg, var(--green-dim), transparent);
  color: var(--green);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.main {
  min-width: 0;
  overflow-y: auto;
  padding: 18px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.stat-card,
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(24, 34, 52, 0.95), rgba(18, 27, 42, 0.95));
  box-shadow: var(--shadow);
}

.stat-card {
  position: relative;
  display: grid;
  gap: 5px;
  overflow: hidden;
  min-height: 94px;
  padding: 17px;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--green);
}

.stat-card.cyan::before { background: var(--cyan); }
.stat-card.amber::before { background: var(--amber); }
.stat-card.red::before { background: var(--red); }

.stat-card span,
.card-title {
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 1.42rem;
}

.stat-card small,
.muted,
.fineprint {
  color: var(--muted);
}

.card {
  padding: 16px;
}

.card-title {
  margin-bottom: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 14px;
}

.wide {
  grid-column: 1 / 2;
}

.chart-card {
  min-height: 340px;
}

#equityChart {
  width: 100% !important;
  height: 280px !important;
}

.status-list,
.rule-list,
.deploy-steps {
  display: grid;
  gap: 10px;
}

.status-list div,
.rule-list div,
.deploy-steps div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.deploy-steps div {
  align-items: flex-start;
}

.deploy-steps span {
  color: var(--muted);
  text-align: right;
  max-width: 520px;
}

.log-box {
  height: 330px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: rgba(6, 10, 18, 0.56);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  line-height: 1.7;
}

.log-box div + div {
  margin-top: 6px;
}

.log-time {
  color: var(--faint);
  margin-right: 8px;
}

.log-good {
  color: var(--green);
}

.log-warn {
  color: var(--amber);
}

.log-bad {
  color: var(--red);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
}

.dot.green { background: var(--green); box-shadow: 0 0 12px var(--green-dim); }
.dot.cyan { background: var(--cyan); box-shadow: 0 0 12px var(--cyan-dim); }
.dot.amber { background: var(--amber); box-shadow: 0 0 12px var(--amber-dim); }
.dot.red { background: var(--red); box-shadow: 0 0 12px var(--red-dim); }

.empty,
.locked-panel {
  border: 1px dashed var(--border-soft);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.toolbar h1,
.live-warning h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.toolbar p,
.live-warning p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.btn {
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 10px 14px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  border-color: rgba(0, 230, 118, 0.4);
  background: var(--green);
  color: #03120a;
}

.btn.danger {
  border-color: rgba(255, 23, 68, 0.4);
  background: var(--red);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn.full {
  width: 100%;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

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

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--faint);
  font-size: 0.62rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

td {
  font-size: 0.86rem;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.018);
}

.center {
  text-align: center;
}

.token-symbol {
  display: grid;
  gap: 2px;
  font-weight: 800;
}

.token-symbol small {
  color: var(--faint);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag.watch { background: var(--green-dim); color: var(--green); }
.tag.review { background: var(--amber-dim); color: var(--amber); }
.tag.avoid { background: var(--red-dim); color: var(--red); }

.paper-grid,
.wallet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span,
.check-row {
  color: var(--muted);
  font-size: 0.76rem;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 12px;
  outline: none;
  background: var(--panel-3);
  color: var(--text);
}

input:focus {
  border-color: var(--cyan);
}

.live-warning {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 20px;
  align-items: start;
  border-color: rgba(255, 23, 68, 0.35);
  margin-bottom: 14px;
}

.live-lock {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 23, 68, 0.06);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.check-row input {
  width: auto;
  margin-top: 3px;
}

.jupiter-shell {
  min-height: 680px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #080b12;
}

.wallet-card {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
  word-break: break-all;
}

.safety-copy {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

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

.risk-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
}

.risk-item strong {
  display: block;
  margin-bottom: 6px;
}

.risk-item span {
  color: var(--muted);
  line-height: 1.5;
}

.risk-item.good { border-color: rgba(0, 230, 118, 0.25); }
.risk-item.warn { border-color: rgba(255, 179, 0, 0.3); }
.risk-item.bad { border-color: rgba(255, 23, 68, 0.3); }

.toast-stack {
  position: fixed;
  top: 72px;
  right: 16px;
  display: grid;
  gap: 8px;
  z-index: 10;
  width: min(380px, calc(100vw - 32px));
}

.toast {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(19, 28, 42, 0.96);
  box-shadow: var(--shadow);
  color: var(--text);
}

.toast.success { border-color: rgba(0, 230, 118, 0.35); }
.toast.error { border-color: rgba(255, 23, 68, 0.35); }
.toast.warning { border-color: rgba(255, 179, 0, 0.35); }

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-wrap: wrap;
    height: auto;
    padding: 12px;
  }

  .icon-btn {
    display: inline-block;
  }

  .top-stats {
    order: 3;
    width: 100%;
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 66px;
    bottom: 0;
    left: 0;
    z-index: 6;
    width: min(280px, 86vw);
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    display: block;
  }

  .main {
    overflow: visible;
  }

  .stat-grid,
  .dashboard-grid,
  .paper-grid,
  .wallet-grid,
  .live-warning,
  .risk-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  html {
    font-size: 13px;
  }

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

  .brand-sub {
    display: none;
  }

  .kill-btn {
    padding: 8px 12px;
  }

  .main {
    padding: 12px;
  }

  #equityChart {
    height: 240px !important;
  }
}
