:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #5d6871;
  --line: #d9e0e4;
  --accent: #126b65;
  --accent-strong: #0d4f4c;
  --positive: #147a3d;
  --warning: #9a6200;
  --negative: #b33131;
  --blue: #245a8d;
  --shadow: 0 18px 45px rgba(21, 35, 42, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.status,
.notice {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.status {
  min-width: 210px;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
}

.input-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.view-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(58px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f9;
}

.toggle-button {
  grid-column: auto;
  min-height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
}

.toggle-button:hover,
.toggle-button:focus {
  background: #eef6f5;
  color: var(--accent-strong);
}

.toggle-button.active {
  background: var(--accent);
  color: #fff;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 13px 14px;
  font-size: 16px;
  line-height: 1.45;
}

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

.symbol-list {
  display: grid;
  gap: 8px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
}

.symbol-list:empty::before {
  content: "暂无股票代码";
  display: grid;
  min-height: 74px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.symbol-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 5px;
}

.symbol-row.dragging {
  opacity: 0.56;
}

.symbol-row.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 107, 101, 0.12);
}

.drag-handle,
.remove-symbol-button {
  grid-column: auto;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 34px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.drag-handle {
  align-self: stretch;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: grab;
  letter-spacing: 1px;
  line-height: 1;
  padding: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: element;
  -webkit-user-select: none;
}

.drag-handle:hover,
.drag-handle:focus {
  background: transparent;
  color: var(--accent-strong);
}

.drag-handle:active {
  cursor: grabbing;
}

.remove-symbol-button {
  border: 0;
  border-radius: 8px;
  background: #f1f5f5;
  cursor: pointer;
}

.remove-symbol-button:hover,
.remove-symbol-button:focus {
  background: #f9eeee;
  color: var(--negative);
}

.symbol-row input {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.secondary-button {
  grid-column: auto;
  justify-self: start;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #f7f9f9;
  color: var(--accent-strong);
  padding: 0 12px;
  font-size: 13px;
}

.secondary-button:hover,
.secondary-button:focus {
  background: #eef6f5;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 107, 101, 0.14);
}

input[type="search"] {
  min-height: 44px;
  padding: 0 13px;
}

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

.search-field {
  position: relative;
}

.search-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(21, 35, 42, 0.16);
}

.search-option {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  text-align: left;
  font-weight: 700;
}

.search-option:hover,
.search-option:focus {
  background: #eef6f5;
  color: var(--ink);
}

.search-option:last-child {
  border-bottom: 0;
}

.search-option span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.search-option small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.search-option em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.search-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.controls {
  width: min(260px, 28vw);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: end;
}

button {
  grid-column: 1 / -1;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
}

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

.metric {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

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

.stock-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(21, 35, 42, 0.06);
}

.stock-card.error {
  border-color: rgba(179, 49, 49, 0.35);
}

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

.symbol {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.company-name {
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.source {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.buy {
  background: var(--positive);
}

.badge.watch {
  background: var(--warning);
}

.badge.wait {
  background: var(--negative);
}

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

.price-box {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.price-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.price-box strong {
  display: block;
  margin-top: 9px;
  font-size: 19px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.chart {
  width: 100%;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.detail-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.detail-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.indicator-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.indicator-grid div {
  border-radius: 8px;
  background: #f1f5f5;
  padding: 9px 10px;
}

.indicator-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
}

.empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .input-panel,
  .results {
    grid-template-columns: 1fr;
  }

  .controls {
    width: 100%;
  }

  .summary-grid,
  .price-row,
  .indicator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1360px);
    padding-top: 16px;
  }

  .toolbar,
  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .status {
    width: 100%;
  }

  .controls,
  .details {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .price-row,
  .indicator-grid {
    grid-template-columns: 1fr;
  }
}
