:root {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.1);
  --panel: rgba(255, 255, 255, 0.88);
  --sea: #0f766e;
  --danger: #ef4444;
  --blue: #2563eb;
  --warn: #eab308;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 16% 12%, rgba(20, 184, 166, 0.16), transparent 30%),
    radial-gradient(circle at 80% 8%, rgba(37, 99, 235, 0.13), transparent 30%),
    linear-gradient(180deg, #f8fcff 0%, #eef8fb 44%, #f8fafc 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 118, 110, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 78%);
}

.top-shell {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(170px, 0.7fr) minmax(320px, 1.3fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 16px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  background: rgba(248, 252, 255, 0.82);
}

.brand-mark,
.weather-card,
.source-strip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.radar-dot {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(15, 118, 110, 0.42);
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, rgba(34, 197, 94, 0.8), transparent 38%),
    radial-gradient(circle, rgba(255,255,255,0.92) 0 20%, rgba(34,197,94,0.16) 21% 100%);
  box-shadow: 0 0 0 8px rgba(20, 184, 166, 0.08);
}

.search-radar {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.search-radar input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
}

.suggestions button {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: white;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.suggestions button:hover {
  background: #f0fdfa;
}

.suggestions small,
.subline {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.weather-card {
  min-width: 210px;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.weather-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
}

.weather-card.sunny .weather-icon {
  color: #16a34a;
  background: rgba(34, 197, 94, 0.12);
}

.weather-card.cloudy .weather-icon {
  color: #ca8a04;
  background: rgba(234, 179, 8, 0.14);
}

.weather-card.storm .weather-icon {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.13);
}

.source-strip {
  justify-content: flex-end;
  flex-wrap: wrap;
  font-size: 12px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.source-pill.live {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

.source-pill.mock {
  color: #0369a1;
  background: rgba(14, 165, 233, 0.12);
}

.voyage-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(310px, 0.42fr);
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 34px) 30px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.panel-head {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.compact-head {
  min-height: 72px;
}

.panel-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 780;
}

.eyebrow {
  margin: 0;
  color: var(--sea);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.chart {
  width: 100%;
}

.chart-panel {
  min-height: 680px;
}

.kline-chart {
  height: 560px;
}

.chart-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 12px;
}

.chart-status-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-status-row i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.green { background: #16a34a; }
.yellow { background: #eab308; }
.red { background: #ef4444; }
.blue { background: #2563eb; }

.period-tabs {
  display: inline-grid;
  grid-template-columns: repeat(4, 38px);
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.86);
}

.period-tabs button {
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.period-tabs button.active {
  background: #0f766e;
  color: white;
}

.command-panel {
  grid-row: span 3;
}

.gauge-chart {
  height: 200px;
}

.score-badge {
  min-width: 58px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0e7490;
  font-weight: 850;
  text-align: center;
}

.decision-box {
  display: grid;
  gap: 4px;
  margin: 0 18px 14px;
  padding: 13px 14px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.decision-box strong {
  font-size: 18px;
}

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

.decision-box.buy {
  background: rgba(34, 197, 94, 0.11);
  color: #047857;
}

.decision-box.watch {
  background: rgba(234, 179, 8, 0.12);
  color: #a16207;
}

.decision-box.risk {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.risk-form {
  display: grid;
  gap: 12px;
  padding: 4px 18px 16px;
}

.form-row {
  display: grid;
  gap: 7px;
}

.form-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.form-row input {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  background: white;
  font-size: 16px;
}

.form-row input:focus {
  border-color: rgba(14, 165, 233, 0.66);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

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

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

.price-grid div,
.quote-grid div,
.position-result {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.78);
}

.price-grid span,
.quote-grid span,
.position-result span,
.position-result small {
  color: var(--muted);
  font-size: 12px;
}

.price-grid strong,
.quote-grid strong,
.position-result strong {
  font-size: 22px;
}

.position-result strong {
  color: #0f766e;
}

.risk-note {
  margin: 0;
  padding: 11px 12px;
  border-left: 3px solid var(--danger);
  border-radius: 6px;
  background: rgba(254, 242, 242, 0.9);
  color: #991b1b;
  font-size: 13px;
  line-height: 1.55;
}

.risk-note:not(:empty) {
  min-height: 48px;
}

.side-module {
  padding: 14px 18px 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.side-title b {
  color: var(--sea);
  text-align: right;
}

.chips-chart,
.flow-chart {
  height: 190px;
}

.chips-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.drawdown-grid div {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.78);
}

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

.drawdown-grid strong {
  font-size: 18px;
}

.sectors-panel,
.prey-panel {
  min-height: 360px;
}

.sector-status-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px 0;
  color: var(--muted);
  font-size: 12px;
}

.treemap-chart {
  height: 252px;
}

.stock-list {
  height: 284px;
  overflow: auto;
  padding: 10px;
}

.stock-row {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.stock-row:hover,
.stock-row.active {
  border-color: rgba(14, 165, 233, 0.32);
  background: rgba(240, 249, 255, 0.9);
}

.stock-row strong,
.stock-row span,
.stock-metrics b,
.stock-metrics small {
  display: block;
}

.stock-row span,
.stock-metrics small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.stock-metrics {
  min-width: 88px;
  text-align: right;
}

.up {
  color: #dc2626;
}

.down {
  color: #16a34a;
}

.flow-chart {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(239,248,255,0.92)),
    radial-gradient(circle at 20% 8%, rgba(96,165,250,0.08), transparent 28%);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: white;
  color: #0f766e;
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(15, 118, 110, 0.32);
  background: #f0fdfa;
}

.log-panel {
  grid-column: 1 / -1;
}

.log-panel p {
  margin: 0;
  padding: 18px;
  color: #334155;
  font-size: 15px;
  line-height: 1.8;
}

.volume-pill {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.96);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 1180px) {
  .top-shell {
    grid-template-columns: 1fr 1fr;
  }

  .search-radar {
    grid-column: 1 / -1;
    order: 3;
  }

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

  .command-panel {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .top-shell {
    position: relative;
    grid-template-columns: 1fr;
  }

  .source-strip,
  .weather-card {
    justify-content: flex-start;
  }

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

  .chart-panel {
    min-height: 560px;
  }

  .kline-chart {
    height: 430px;
  }

  .period-tabs {
    width: 100%;
    grid-template-columns: repeat(4, 1fr);
  }
}
