:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4f1;
  --ink: #17201c;
  --muted: #63716b;
  --line: #d8e0dc;
  --primary: #176b5c;
  --primary-ink: #ffffff;
  --warn: #9a5b13;
  --danger: #b33939;
  --profit: #0f7a4d;
  --blue: #315f8c;
  --shadow: 0 18px 45px rgba(29, 45, 39, 0.09);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(23, 107, 92, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(49, 95, 140, 0.1), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header,
.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 36px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.subtitle {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

.header-actions,
.section-heading,
.upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-shell {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  gap: 18px;
  padding-bottom: 40px;
}

.control-panel,
.positions-section,
.rules-section,
.metric-card,
.plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel,
.positions-section,
.rules-section {
  padding: 20px;
}

.integration-section { margin-top: 24px; padding: 24px; background: var(--panel, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 18px; }
.market-dashboard { margin-bottom: 24px; padding: 24px; background: linear-gradient(135deg,#101827,#17253b); color: #e5edf7; border-radius: 22px; box-shadow: 0 18px 50px rgba(15,23,42,.16); }
.market-dashboard .section-heading h2,.market-dashboard h3 { color: #f8fafc; }
.market-cards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.market-card,.dashboard-panel { background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.1); border-radius:14px; padding:16px; }
.market-card span,.market-card small { display:block; color:#9fb0c4; font-size:12px; }.market-card strong { display:block; margin:8px 0; font-size:24px; color:#fff; }
.data-stamp { margin:6px 0 0; color:#7dd3fc; font-size:12px; }
.dashboard-grid { display:grid; grid-template-columns:1.2fr 1fr 1.2fr; gap:12px; margin-top:12px; }.dashboard-panel p { color:#b8c6d8; line-height:1.6; }.dashboard-panel textarea { width:100%; box-sizing:border-box; background:#0d1726; border:1px solid #334155; color:#e5edf7; border-radius:10px; padding:10px; margin-bottom:8px; }.phase-track { display:flex; gap:4px; margin:18px 0; }.phase-track span { flex:1; padding:8px 4px; text-align:center; font-size:11px; color:#bfd0e3; background:#22334b; border-radius:6px; }
@media (max-width: 820px) { .market-cards,.dashboard-grid { grid-template-columns:1fr 1fr; } }
@media (max-width: 560px) { .market-cards,.dashboard-grid { grid-template-columns:1fr; } }

/* Trading terminal visual refresh */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Fira+Sans:wght@400;500;600;700&display=swap');
:root { color-scheme: dark; --bg:#050914; --surface:#0d1422; --surface-soft:#121c2d; --ink:#edf4ff; --muted:#91a1b5; --line:#243247; --primary:#38bdf8; --primary-ink:#06111f; --warn:#f59e0b; --danger:#fb7185; --profit:#34d399; --shadow:0 18px 50px rgba(0,0,0,.28); font-family:'Fira Sans','Microsoft YaHei',sans-serif; }
body { background:radial-gradient(circle at 10% 0%,rgba(56,189,248,.09),transparent 30%),radial-gradient(circle at 90% 20%,rgba(52,211,153,.06),transparent 28%),var(--bg); color:var(--ink); }
.app-header,.app-shell { width:min(1380px,calc(100% - 40px)); }
.app-header { padding:30px 0 22px; align-items:center; border-bottom:1px solid var(--line); }
.eyebrow { color:#67e8f9; font-family:'Fira Code',monospace; letter-spacing:.12em; font-size:10px; }
h1 { font-size:clamp(28px,4vw,46px); letter-spacing:-.04em; }
h2 { font-size:20px; letter-spacing:-.02em; }
h3 { font-size:15px; }
.subtitle { color:var(--muted); max-width:720px; }
.control-panel,.positions-section,.plans-grid,.rules-section,.integration-section { background:linear-gradient(145deg,rgba(13,20,34,.96),rgba(9,15,26,.96)); border:1px solid var(--line); box-shadow:var(--shadow); }
.control-panel,.positions-section,.plans-grid,.rules-section,.integration-section { border-radius:18px; }
.section-heading { border-bottom:1px solid rgba(148,163,184,.12); padding-bottom:16px; margin-bottom:18px; }
.field span { color:#9db0c6; font-size:12px; }
input,select,textarea { background:#08111e; color:var(--ink); border:1px solid #2a3a51; border-radius:9px; transition:border-color .2s,box-shadow .2s; }
input:focus,select:focus,textarea:focus { outline:none; border-color:#38bdf8; box-shadow:0 0 0 3px rgba(56,189,248,.14); }
.ghost-button,.primary-button { border-radius:9px; min-height:40px; transition:transform .2s,background .2s,border-color .2s; }
.ghost-button { color:#cfe2f7; background:#101b2b; border:1px solid #2a3a51; }
.ghost-button:hover { border-color:#38bdf8; background:#13263a; }
.primary-button { background:#38bdf8; color:#06111f; border:0; font-weight:700; }
.primary-button:hover { transform:translateY(-1px); background:#67e8f9; }
.metric-card { background:linear-gradient(145deg,#0e1829,#0b1220); border:1px solid #25354b; border-radius:14px; box-shadow:none; }
.metric-card strong { color:#f7fbff; font-family:'Fira Code',monospace; }
.market-card strong { font-family:'Fira Code',monospace; }
.table-wrap { border:1px solid var(--line); border-radius:12px; overflow:auto; }
table th { background:#111d2f; color:#8fa5bd; font-family:'Fira Code',monospace; font-size:11px; letter-spacing:.04em; }
table td { border-bottom-color:#1e2c40; color:#dbe8f5; }
tr:hover td { background:rgba(56,189,248,.04); }
.plan-card,.review-panel { background:#0b1422; border:1px solid #243247; border-radius:12px; }
.rules-section li,.plan-card p,.review-panel p { color:#9eb0c3; }
.status-pill { background:rgba(52,211,153,.12); color:#6ee7b7; border:1px solid rgba(52,211,153,.3); }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { transition:none!important; animation:none!important; } }
.button-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.helper-text { color: #64748b; font-size: 13px; }
.review-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line, #e5e7eb); }
.review-panel h3 { margin-bottom: 6px; }
.review-panel input { width: 100%; min-width: 80px; }

.section-heading {
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading.full {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.status-pill,
.risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

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

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(23, 107, 92, 0.22);
  outline-offset: 2px;
}

.primary-button,
.ghost-button,
.upload-button {
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: var(--primary-ink);
}

.ghost-button,
.upload-button {
  background: transparent;
  color: var(--primary);
}

.upload-box {
  justify-content: space-between;
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.upload-box p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.upload-button input {
  display: none;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

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

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.positions-section,
.plans-grid,
.rules-section {
  grid-column: 1 / -1;
}

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

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

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

td input {
  min-width: 86px;
}

.stock-name {
  min-width: 118px;
}

.profit {
  color: var(--profit);
}

.loss,
.risk-serious {
  color: var(--danger);
}

.risk-warning {
  color: var(--warn);
}

.risk-profit {
  color: var(--profit);
}

.risk-watch {
  color: var(--blue);
}

.action-cell {
  min-width: 220px;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--danger);
  font-size: 22px;
  line-height: 1;
}

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

.plan-card {
  padding: 18px;
  min-height: 150px;
  border-top: 4px solid var(--primary);
}

.plan-card:nth-of-type(2) {
  border-top-color: var(--warn);
}

.plan-card:nth-of-type(3) {
  border-top-color: var(--danger);
}

.plan-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.rules-section ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 860px) {
  .app-header,
  .app-shell {
    width: min(100% - 20px, 720px);
  }

  .app-header,
  .app-shell,
  .summary-grid,
  .plans-grid,
  .rules-section ul {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: stretch;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .positions-section,
  .rules-section,
  .metric-card,
  .plan-card {
    padding: 14px;
  }

  .upload-box,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
