:root {
  --bg: #0b0e11;
  --bg-elevated: #12161c;
  --bg-panel: #1e2329;
  --border: #2b3139;
  --text: #eaecef;
  --text-muted: #848e9c;
  --accent: #f0b90b;
  --accent-hover: #f8d12f;
  --up: #0ecb81;
  --down: #f6465d;
  --danger: #f6465d;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #1a2330 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1d1808 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #c99400);
  color: #0b0e11;
  font-weight: 800;
  font-size: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.brand-text span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.user-box.hidden {
  display: none;
}

.user-name {
  font-size: 0.85rem;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-level {
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-ghost {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.status-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.status-pill.ok {
  color: var(--up);
  border-color: rgba(14, 203, 129, 0.35);
}

.status-pill.bad {
  color: var(--down);
  border-color: rgba(246, 70, 93, 0.35);
}

.main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toolbar {
  background: rgba(18, 22, 28, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.query-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) auto;
  gap: 12px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input,
.field select {
  height: 42px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0 12px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 185, 11, 0.15);
}

.btn-primary {
  height: 42px;
  min-width: 110px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #0b0e11;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.meta {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chart-panel {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 520px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chart {
  width: 100%;
  height: 560px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(11, 14, 17, 0.72);
  color: var(--text);
  z-index: 30;
}

.overlay.hidden,
.error.hidden {
  display: none;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(240, 185, 11, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(246, 70, 93, 0.12);
  border: 1px solid rgba(246, 70, 93, 0.35);
  color: #ff8a9a;
  font-size: 0.9rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
}

.nav-link-active {
  color: var(--accent);
  border-color: rgba(240, 185, 11, 0.35);
}

/* 机器人炒股实录 */
.robot-app {
  max-width: 1600px;
}

.robot-version-fieldset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0;
  padding: 0.35rem 0;
  border: 0;
}

.robot-version-fieldset legend {
  padding: 0;
  margin-right: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted, #8b949e);
}

.robot-version-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.robot-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}

.robot-macd-check {
  height: 42px;
}

.robot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.robot-dynamic-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 12px;
}

.robot-dynamic-bar .dynamic-mine-timers {
  flex: 1 1 280px;
}

.robot-dynamic-bar .meta {
  margin: 0;
}

.robot-dynamic-bar #sseInfo.ok,
.robot-dynamic-bar #liveMarkInfo.ok {
  color: var(--up, #0ecb81);
}

body.robot-soft-refreshing .robot-charts {
  opacity: 0.82;
  transition: opacity 0.2s ease;
}

body.robot-soft-refreshing #modeBanner::after {
  content: " · 增量刷新中";
  color: var(--muted, #94a3b8);
  font-weight: 500;
}

.robot-backfill-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.robot-backfill-bar .field {
  min-width: 140px;
}

.robot-backfill-bar .meta {
  margin: 0;
  flex: 1 1 220px;
}

.robot-mode-banner {
  margin: 8px 0 0;
  color: var(--accent);
  font-weight: 600;
}

.robot-mode-banner.is-same {
  color: #f8d12f;
}

.robot-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.robot-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.robot-stat-label {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.robot-stat strong {
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 1.05rem;
}

.robot-stat strong.pct-up {
  color: var(--down);
}

.robot-stat strong.pct-down {
  color: var(--up);
}

.robot-timeline {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.timeline-speed-field {
  min-width: 100px;
  flex: 0 0 auto;
}

.timeline-track {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 1.35rem;
  padding-right: 4.25rem;
}

.timeline-date {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  margin-left: 0;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.timeline-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.robot-return-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 1.35rem;
}

.robot-return-text {
  color: var(--text-muted);
}

.robot-return-card strong {
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-weight: 700;
  font-size: 1.5rem;
}

.robot-return-card strong.pct-up {
  color: var(--down);
}

.robot-return-card strong.pct-down {
  color: var(--up);
}

.robot-return-sep {
  color: var(--text-muted);
  margin: 0 2px;
}

.robot-return-date {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
}

.robot-charts {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.robot-holding-strip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  min-height: 48px;
}

.robot-holding-strip-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.robot-holding-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel);
  font-size: 0.98rem;
  line-height: 1.3;
}

.robot-holding-chip-name {
  color: var(--text);
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.robot-holding-chip-code {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.85rem;
}

.robot-holding-chip-price {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.9rem;
}

.robot-holding-chip-pct {
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-weight: 700;
}

.robot-holding-chip-pct.pct-up {
  color: var(--down);
}

.robot-holding-chip-pct.pct-down {
  color: var(--up);
}

.robot-chart-panel {
  min-height: 320px;
  padding: 12px 14px 8px;
}

.robot-chart {
  height: 280px;
}

.robot-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.robot-table-wrap {
  max-height: 320px;
}

.mine-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 12px;
  align-items: end;
}

.filter-group {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.filter-group legend {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.mine-form .btn-primary {
  grid-column: 3;
  grid-row: 1;
}

.dynamic-mine-toolbar {
  grid-template-columns: 1fr;
}

.dynamic-mine-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.dynamic-mine-timers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.dynamic-mine-toolbar .btn-primary {
  grid-column: auto;
  grid-row: auto;
}

.table-panel {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 360px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow: auto;
  max-height: min(70vh, 720px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #181c23;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.data-table tbody tr:hover {
  background: rgba(240, 185, 11, 0.06);
}

.data-table .num,
.data-table .mono {
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
}

.data-table .indexes {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.data-table .empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 12px;
}

/* 个股诊断页 */
.diagnosis-app {
  max-width: 1600px;
}

.diagnosis-form {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
}

.diagnosis-ticker-field input {
  width: 100%;
}

.ticker-suggest {
  position: relative;
  width: 100%;
}

.ticker-suggest-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.ticker-suggest-list.hidden {
  display: none;
}

.ticker-suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.92rem;
}

.ticker-suggest-item:hover,
.ticker-suggest-item.is-active {
  background: var(--bg-panel);
}

.ticker-suggest-item .mono {
  color: var(--text-muted);
}

.diagnosis-macd-check {
  height: 42px;
  padding: 0 4px;
  white-space: nowrap;
}

.diagnosis-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.btn-secondary {
  height: 42px;
  min-width: 120px;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-secondary:hover {
  background: #60a5fa;
}

.btn-secondary:active {
  transform: translateY(1px);
}

.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolbar-meta,
.diagnosis-toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.toolbar-meta .meta,
.diagnosis-toolbar-meta .meta {
  margin: 0;
}

.stock-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.diagnosis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
}

.diagnosis-chart-panel {
  min-height: 640px;
}

.diagnosis-chart {
  position: relative;
  z-index: 0;
  height: 640px;
}

.quant-chart-wrap {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #fff;
  overflow: auto;
  pointer-events: auto;
}

.quant-chart-wrap.hidden {
  display: none;
}

.quant-chart-toolbar {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 20;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.quant-chart-toolbar.hidden {
  display: none;
}

.quant-chart-btn {
  position: relative;
  z-index: 1;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: rgba(11, 14, 17, 0.82);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.quant-chart-btn:hover {
  background: rgba(11, 14, 17, 0.94);
}

.quant-chart-img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 100%;
  object-fit: contain;
  background: #fff;
  pointer-events: none;
}

.diagnosis-chart-panel.is-quant .diagnosis-chart {
  pointer-events: none;
}

.diagnosis-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 640px;
}

.side-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.side-panel-trades {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 8px;
}

.side-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.stats-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(43, 49, 57, 0.85);
}

.stats-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stats-row dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.stats-row dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.95rem;
  color: var(--text);
}

.stats-row dd.pct-up {
  color: var(--down);
}

.stats-row dd.pct-down {
  color: var(--up);
}

.diagnosis-trade-wrap {
  flex: 1;
  max-height: none;
  overflow: auto;
}

.action-buy {
  color: var(--down);
  font-weight: 600;
}

.action-sell {
  color: var(--up);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .robot-stats-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .robot-charts,
  .robot-tables {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app {
    padding: 12px;
  }

  .query-form,
  .mine-form,
  .diagnosis-form {
    grid-template-columns: 1fr;
  }

  .robot-stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .robot-actions {
    width: 100%;
  }

  .robot-actions .btn-primary,
  .robot-actions .btn-secondary {
    flex: 1;
  }

  .robot-backfill-bar {
    align-items: stretch;
  }

  .robot-backfill-bar .field {
    flex: 1 1 calc(50% - 8px);
  }

  .robot-backfill-bar #backfillBtn {
    width: 100%;
  }

  .diagnosis-actions {
    flex-direction: column;
  }

  .diagnosis-actions .btn-primary,
  .diagnosis-actions .btn-secondary {
    width: 100%;
  }

  .diagnosis-layout {
    grid-template-columns: 1fr;
  }

  .diagnosis-side {
    min-height: 0;
  }

  .diagnosis-chart,
  .diagnosis-chart-panel {
    min-height: 420px;
    height: 420px;
  }

  .diagnosis-toolbar-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .mine-form .btn-primary {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
  }

  .btn-primary {
    width: 100%;
  }

  .chart,
  .chart-panel {
    min-height: 420px;
    height: 420px;
  }

  .brand-text strong {
    font-size: 1.05rem;
  }
}

.landing-body .landing-app {
  max-width: 1100px;
}

.landing-main {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 0 48px;
}

.landing-hero h1 {
  margin: 8px 0 12px;
  font-size: 2.1rem;
  letter-spacing: 0.02em;
}

.landing-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.landing-lead {
  margin: 0;
  max-width: 720px;
  color: var(--text-muted);
  line-height: 1.6;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.market-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 240px;
  padding: 22px 20px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(30, 35, 41, 0.96), rgba(18, 22, 28, 0.96));
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.market-card:hover {
  transform: translateY(-3px);
  border-color: rgba(240, 185, 11, 0.55);
}

.market-code {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.market-card strong {
  font-size: 1.55rem;
}

.market-en {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.market-card p {
  margin: 4px 0 0;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.market-enter {
  margin-top: 12px;
  color: var(--accent);
  font-weight: 700;
}

.market-card-usa {
  background: linear-gradient(180deg, rgba(24, 36, 48, 0.96), rgba(18, 22, 28, 0.96));
}

.market-card-hkg {
  background: linear-gradient(180deg, rgba(36, 28, 24, 0.96), rgba(18, 22, 28, 0.96));
}

.landing-login {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.landing-login.hidden {
  display: none;
}

@media (max-width: 900px) {
  .market-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar {
    flex-wrap: wrap;
  }

  .chart,
  .chart-panel {
    min-height: 360px;
    height: 360px;
  }
}

.watchlist-app {
  max-width: 880px;
}

.watch-pull-head h3,
.watch-title h2 {
  margin: 0;
}

.watch-pull-head h3 {
  font-size: 1rem;
  color: var(--text);
}

.watch-pull-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.watch-pull-btn {
  height: 36px;
}

.watch-hint {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.watch-add-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.watch-add-form input {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0 14px;
  font-size: 1rem;
  outline: none;
}

.watch-add-form input:focus {
  border-color: var(--up);
  box-shadow: 0 0 0 2px rgba(14, 203, 129, 0.18);
}

.btn-watch-add {
  height: 42px;
  min-width: 120px;
  border: none;
  border-radius: 8px;
  background: var(--up);
  color: #04140d;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-watch-add:hover {
  filter: brightness(1.08);
}

.btn-watch-add:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.watch-ex-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.watch-chip {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.watch-chip.is-active {
  color: var(--up);
  border-color: rgba(14, 203, 129, 0.45);
  background: rgba(14, 203, 129, 0.08);
}

.watch-panel {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 280px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.watch-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.watch-title,
.watch-monitor-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.watch-title h2 {
  color: var(--up);
  font-size: 1.05rem;
}

.watch-monitor-label {
  color: #63a4ff;
  font-size: 0.92rem;
}

.watch-badge {
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.watch-badge-up {
  background: rgba(14, 203, 129, 0.18);
  color: var(--up);
}

.watch-badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #63a4ff;
}

.watch-list {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
}

.watch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.watch-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.watch-ticker {
  color: #7dd3fc;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.92rem;
}

.watch-name {
  color: var(--text);
  font-size: 0.95rem;
}

.watch-ex {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.watch-actions button {
  height: 32px;
  min-width: 68px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
}

.watch-actions button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.btn-watch-del {
  background: #7a3b3b;
}

.btn-watch-on {
  background: #1d4f91;
}

.btn-watch-off {
  background: #3d4450;
}

.watch-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-muted);
}

.watch-suggest-ex {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

@media (max-width: 860px) {
  .watch-add-form {
    grid-template-columns: 1fr;
  }

  .btn-watch-add {
    width: 100%;
  }

  .watch-item {
    flex-direction: column;
    align-items: stretch;
  }

  .watch-actions {
    justify-content: stretch;
  }

  .watch-actions button {
    flex: 1;
  }
}

/* 持仓股页 */
.position-app .main {
  position: relative;
  min-height: 48vh;
}

.position-open-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) 140px auto;
  gap: 12px;
  align-items: end;
}

.position-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 10px 16px;
  background: rgba(18, 22, 28, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.position-summary strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  margin-left: 6px;
}

.position-summary strong.pct-up {
  color: var(--down);
}

.position-summary strong.pct-down {
  color: var(--up);
}

.position-app .panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.position-app .panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 8px;
}

.position-app .panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.position-app .panel-head .meta {
  margin: 0;
}

.position-table {
  min-width: 1360px;
}

.position-table .pct-up {
  color: var(--down);
}

.position-table .pct-down {
  color: var(--up);
}

.position-table tr.is-editing td {
  background: rgba(240, 185, 11, 0.06);
}

.position-edit {
  width: 96px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0 8px;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.85rem;
}

.position-edit:focus {
  border-color: var(--accent);
  outline: none;
}

.position-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.position-actions button {
  height: 32px;
  min-width: 68px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
}

.position-chart {
  height: 340px;
  margin: 0 8px 12px;
}

.position-pnl-panel .position-chart {
  margin-bottom: 4px;
}

.pnl-slider {
  padding: 4px 18px 18px;
}

.pnl-slider-selected {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 0.92rem;
  color: var(--accent);
  font-weight: 700;
}

.pnl-slider-sep {
  color: var(--text-muted);
  font-weight: 500;
}

.pnl-slider-track {
  position: relative;
  height: 28px;
}

.pnl-slider-rail,
.pnl-slider-fill {
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 99px;
  pointer-events: none;
}

.pnl-slider-rail {
  left: 0;
  right: 0;
  background: #2b3139;
}

.pnl-slider-fill {
  left: 0;
  width: 100%;
  background: var(--accent);
}

.pnl-slider-track input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.pnl-slider-track input[type="range"]:focus {
  outline: none;
}

.pnl-slider-track input[type="range"]:nth-of-type(1) {
  z-index: 4;
}

.pnl-slider-track input[type="range"]:nth-of-type(2) {
  z-index: 5;
}

.pnl-slider-track input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
  border: none;
}

.pnl-slider-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid #0b0e11;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(240, 185, 11, 0.45);
  cursor: grab;
}

.pnl-slider-track input[type="range"]::-moz-range-track {
  height: 4px;
  background: transparent;
  border: none;
}

.pnl-slider-track input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border: 2px solid #0b0e11;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(240, 185, 11, 0.45);
  cursor: grab;
}

.pnl-slider-track input[type="range"]:disabled::-webkit-slider-thumb {
  background: #5e6673;
  box-shadow: none;
  cursor: default;
}

.pnl-slider-track input[type="range"]:disabled::-moz-range-thumb {
  background: #5e6673;
  box-shadow: none;
  cursor: default;
}

.pnl-slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Segoe UI Mono", monospace;
}

@media (max-width: 860px) {
  .position-open-form {
    grid-template-columns: 1fr;
  }
}
