:root {
  color-scheme: light;
  --bg: #edf2f6;
  --grid: rgba(35, 94, 126, 0.08);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel-2: #f4f7fa;
  --panel-3: #eef4f7;
  --ink: #16212b;
  --muted: #65717d;
  --line: #d7e1e8;
  --line-strong: #b9c9d4;
  --green: #16835f;
  --red: #b83a45;
  --amber: #b7791f;
  --blue: #256aa8;
  --cyan: #1c8fa3;
  --violet: #6959b8;
  --shadow: 0 18px 42px rgba(22, 33, 43, 0.09);
  --soft-shadow: 0 8px 22px rgba(22, 33, 43, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 8%, rgba(28, 143, 163, 0.13), transparent 28%),
    radial-gradient(circle at 92% 4%, rgba(105, 89, 184, 0.1), transparent 26%),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(0deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
  background-size: auto, auto, 36px 36px, 36px 36px, auto;
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input {
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.control-panel,
.workspace {
  min-width: 0;
}

.control-panel {
  position: sticky;
  top: 14px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  scrollbar-width: thin;
}

.brand-block,
.search-card,
.decision-card,
.watch-card,
.radar-panel,
.summary-panel,
.chart-card,
.module-card,
.layer-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(183, 201, 212, 0.82);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(247, 250, 252, 0.92)),
    var(--panel);
  box-shadow: var(--soft-shadow);
}

.brand-block::before,
.search-card::before,
.decision-card::before,
.watch-card::before,
.radar-panel::before,
.summary-panel::before,
.chart-card::before,
.module-card::before,
.layer-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent 36%, rgba(105, 89, 184, 0.45));
  pointer-events: none;
}

.brand-block {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid rgba(28, 143, 163, 0.46);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.23), transparent 30%),
    linear-gradient(135deg, #17212b, #28536f);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 0 0 4px rgba(28, 143, 163, 0.08);
  cursor: pointer;
}

.brand-mark img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-mark.has-image {
  border-color: rgba(28, 143, 163, 0.55);
  background: #fff;
}

.brand-mark.has-image img {
  display: block;
}

.brand-mark.has-image span {
  display: none;
}

.brand-avatar-input {
  display: none;
}

.brand-title-input {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.18;
}

.brand-title-input:focus {
  color: var(--cyan);
}

.brand-block p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.search-card,
.decision-card,
.watch-card {
  padding: 13px;
}

.search-card label,
.watch-card h2 {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 8px;
}

.search-row input,
.watchlist-name-row input,
.watchlist-add input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.search-row input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
}

.search-row input:focus,
.watchlist-name-row input:focus,
.watchlist-add input:focus,
.brand-title-input:focus {
  border-color: rgba(28, 143, 163, 0.7);
  box-shadow: 0 0 0 3px rgba(28, 143, 163, 0.12);
}

.search-row button,
.watchlist-tabs button,
.watch-stock button,
.watchlist-add button,
.view-tabs button,
.chart-tabs button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.search-row button {
  height: 38px;
  border-color: #17212b;
  background: linear-gradient(135deg, #17212b, #284963);
  color: #fff;
  font-weight: 800;
}

.data-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(215, 225, 232, 0.9);
  border-radius: 8px;
  background: rgba(244, 247, 250, 0.86);
}

.data-status span,
.quote-strip span {
  color: var(--muted);
  font-size: 11px;
}

.data-status strong {
  color: var(--blue);
  font-size: 12px;
}

.watchlist-panel {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(215, 225, 232, 0.9);
  border-radius: 9px;
  background: rgba(244, 247, 250, 0.74);
}

.watchlist-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.watchlist-tabs button {
  min-width: 0;
  height: 28px;
  padding: 0 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchlist-tabs button.active,
.view-tabs button.active,
.chart-tabs button.active {
  border-color: rgba(28, 143, 163, 0.78);
  background: linear-gradient(135deg, #17212b, #1c7184);
  color: #fff;
}

.watchlist-name-row,
.watchlist-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  align-items: center;
}

.watchlist-name-row input,
.watchlist-add input {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.watchlist-name-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.watchlist-stocks {
  display: grid;
  gap: 5px;
}

.watch-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.watch-stock {
  display: grid;
  grid-template-columns: 1fr 28px;
  gap: 5px;
}

.watch-stock button {
  height: 28px;
  font-size: 12px;
}

.watch-stock .stock-pick {
  padding: 0 8px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-stock .stock-pick:hover,
.watchlist-add button:hover,
.chart-tabs button:hover,
.view-tabs button:hover {
  border-color: rgba(28, 143, 163, 0.58);
  box-shadow: 0 0 0 3px rgba(28, 143, 163, 0.08);
}

.watch-stock .stock-remove {
  color: var(--muted);
}

.watchlist-add button {
  height: 30px;
  padding: 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.decision-topline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.decision-topline span {
  padding: 4px 8px;
  border: 1px solid rgba(183, 121, 31, 0.2);
  border-radius: 999px;
  background: rgba(183, 121, 31, 0.1);
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.decision-topline strong {
  color: #17212b;
  font-size: 48px;
  line-height: 0.95;
  letter-spacing: 0;
}

.score-meter {
  height: 8px;
  margin: 11px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf2;
}

.score-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
  transition: width 300ms ease;
}

.decision-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.decision-list div,
.price-grid div {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid rgba(215, 225, 232, 0.88);
  border-radius: 8px;
  background: rgba(244, 247, 250, 0.78);
}

.decision-list dt,
.price-grid span,
.signal-strip span,
.market-stamp span,
.eyebrow,
.section-head span {
  color: var(--muted);
  font-size: 11px;
}

.decision-list dd {
  margin: 0;
  color: #24313d;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.42;
}

.price-grid {
  display: grid;
  gap: 8px;
}

.price-grid strong {
  font-size: 14px;
}

.workspace {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.stock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 2px 4px 0;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.stock-header h2 {
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.04;
  letter-spacing: 0;
}

.stock-header h2 span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.market-stamp {
  display: grid;
  gap: 3px;
  min-width: 148px;
  padding: 9px 12px;
  border: 1px solid rgba(183, 201, 212, 0.8);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.68);
  text-align: right;
  box-shadow: var(--soft-shadow);
}

.quote-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.quote-strip div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 66px;
  padding: 10px 11px;
  border: 1px solid rgba(183, 201, 212, 0.8);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 250, 0.9));
  box-shadow: var(--soft-shadow);
}

.quote-strip strong {
  font-size: clamp(16px, 1.5vw, 21px);
  line-height: 1.08;
  word-break: break-word;
}

.quote-strip small {
  display: block;
  max-height: 30px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  word-break: break-word;
}

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

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

.flat {
  color: var(--ink);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(380px, 1.14fr);
  gap: 12px;
}

.radar-panel,
.summary-panel,
.chart-card,
.module-card,
.layer-card {
  padding: 13px;
}

.radar-panel,
.summary-panel {
  min-height: 292px;
}

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

.section-head h3 {
  font-size: 16px;
  line-height: 1.2;
}

.section-head span {
  font-weight: 800;
}

.radar-panel canvas {
  display: block;
  width: 100%;
  height: 236px;
}

.summary-panel {
  display: grid;
  align-content: start;
}

.summary-panel p {
  max-width: 800px;
  color: #23313c;
  font-size: clamp(15px, 1.35vw, 17px);
  line-height: 1.66;
}

.signal-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.signal-strip div {
  display: grid;
  gap: 6px;
  min-height: 74px;
  padding: 10px;
  border: 1px solid rgba(215, 225, 232, 0.9);
  border-radius: 8px;
  background: rgba(244, 247, 250, 0.82);
}

.signal-strip strong {
  color: #263541;
  font-size: 13px;
  line-height: 1.42;
}

.chart-card canvas {
  display: block;
  width: 100%;
  height: 318px;
}

.chart-tabs,
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chart-tabs button,
.view-tabs button {
  height: 28px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.layers-section,
.data-modules {
  min-width: 0;
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.82fr) minmax(420px, 1.18fr);
  gap: 10px;
}

.module-card {
  min-height: 0;
}

.module-card:nth-child(2),
.module-card:nth-child(3) {
  grid-row: span 2;
}

.module-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.module-card h4 {
  margin: 0;
  font-size: 14px;
}

.module-card header span {
  color: var(--muted);
  font-size: 11px;
}

.source-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid rgba(215, 225, 232, 0.9);
  border-radius: 8px;
  background: rgba(244, 247, 250, 0.82);
}

.source-list strong {
  font-size: 12px;
  line-height: 1.42;
}

.source-list span {
  color: var(--muted);
  font-size: 11px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.metric-grid div {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 66px;
  padding: 8px 8px 25px;
  border: 1px solid rgba(215, 225, 232, 0.9);
  border-radius: 8px;
  background: rgba(244, 247, 250, 0.82);
}

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

.metric-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
}

.metric-judge {
  position: absolute;
  right: 7px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e7eef3;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.35;
}

.metric-judge.normal {
  background: rgba(22, 131, 95, 0.12);
  color: var(--green);
}

.metric-judge.watch {
  background: rgba(183, 121, 31, 0.14);
  color: var(--amber);
}

.metric-judge.danger {
  background: rgba(184, 58, 69, 0.13);
  color: var(--red);
}

.metric-judge.neutral {
  background: #e7eef3;
  color: var(--muted);
}

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

.layer-card {
  min-height: 176px;
}

.layer-card header {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.layer-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(238, 244, 247, 0.95);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.layer-card h4 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-score {
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
}

.mini-bar {
  height: 6px;
  margin-bottom: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf2;
}

.mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.layer-card p {
  min-height: 0;
  color: #263541;
  font-size: 12px;
  line-height: 1.5;
}

.layer-card ul {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.layer-card li {
  display: flex;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.layer-card li::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-top: 6px;
  border-radius: 50%;
  background: currentColor;
}

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

.layers-grid.compact .layer-card {
  min-height: 0;
}

.layers-grid.compact .layer-card p {
  display: none;
}

.layers-grid.compact .layer-card ul {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .quote-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

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

  .control-panel {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .brand-block {
    grid-column: 1 / -1;
  }

  .overview-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-card:nth-child(2),
  .module-card:nth-child(3) {
    grid-row: auto;
  }

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

@media (max-width: 720px) {
  .app-shell {
    gap: 10px;
    padding: 10px;
  }

  .control-panel,
  .quote-strip,
  .overview-grid,
  .signal-strip,
  .layers-grid,
  .layers-grid.compact,
  .layers-grid.compact .layer-card ul,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .stock-header {
    align-items: stretch;
    flex-direction: column;
  }

  .market-stamp {
    text-align: left;
  }

  .chart-card canvas {
    height: 280px;
  }

  .radar-panel canvas {
    height: 230px;
  }
}
