:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #171b21;
  --muted: #68717c;
  --line: #dce1e6;
  --line-strong: #c9d0d7;
  --red: #d83a34;
  --red-soft: #fff1f0;
  --green: #15805a;
  --green-soft: #edf8f3;
  --amber: #aa7514;
  --amber-soft: #fff7df;
  --blue: #2e67a7;
  --dark: #191d22;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
}

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

.close-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  min-height: 50px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  color: #fff;
  border-bottom: 1px solid #343a42;
  background: rgba(23, 26, 31, 0.97);
  backdrop-filter: blur(12px);
}

.close-back {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  width: fit-content;
  color: #fff;
  font-size: 12px;
  text-decoration: none;
}

.close-brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid #2d6f9d;
  border-radius: 7px;
}

.close-topbar-title {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.close-topbar-title strong { font-size: 14px; }
.close-topbar-title span { color: #aeb6bf; font-size: 10px; }

.close-topbar-state {
  display: flex;
  justify-self: end;
  gap: 6px;
  align-items: center;
  color: #c8ced5;
  font-size: 10px;
}

.close-topbar-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d5a230;
}

.close-topbar-state.ready i { background: #49bd8d; }
.close-topbar-state.error i { background: #ff6c64; }

.close-shell {
  display: grid;
  gap: 12px;
  width: min(100%, 1880px);
  min-height: calc(100dvh - 50px);
  margin: 0 auto;
  padding: 14px max(14px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.close-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  min-width: 0;
  overflow: hidden;
  color: #fff;
  border-left: 5px solid var(--amber);
  background: var(--dark);
}

.close-command.positive { border-left-color: var(--red); }
.close-command.negative { border-left-color: #38a979; }

.close-command-main {
  min-width: 0;
  padding: 18px 20px;
}

.close-command-main > span {
  color: #efb953;
  font-size: 11px;
  font-weight: 800;
}

.close-command-main h1 {
  margin: 5px 0 7px;
  font-size: 28px;
  letter-spacing: 0;
}

.close-command-main p {
  max-width: 1180px;
  margin: 0 0 9px;
  color: #d1d6dc;
  font-size: 13px;
  line-height: 1.7;
}

.close-command-main small { color: #8f98a2; font-size: 10px; }

.close-score {
  display: grid;
  place-content: center;
  text-align: center;
  border-left: 1px solid #3a4048;
  background: #22272d;
}

.close-score span { color: #9fa8b2; font-size: 10px; }
.close-score strong { margin: 3px 0 2px; font-size: 40px; line-height: 1; }
.close-score b { color: #efb953; font-size: 12px; }
.close-command.positive .close-score b { color: #ff7169; }
.close-command.negative .close-score b { color: #53c595; }

.close-quality {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 12px;
  color: #52606d;
  font-size: 10px;
  border: 1px solid #d9c47d;
  background: var(--amber-soft);
}

.close-quality strong { flex: 0 0 auto; color: #7b5b12; }
.close-quality span { min-width: 0; overflow-wrap: anywhere; }

.close-metric-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.close-metric {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid var(--line);
}

.close-metric:last-child { border-right: 0; }
.close-metric span, .close-metric small { display: block; color: var(--muted); font-size: 9px; line-height: 1.35; }
.close-metric strong { display: block; margin: 4px 0 3px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }

.up { color: var(--red) !important; }
.down { color: var(--green) !important; }
.flat { color: var(--muted) !important; }

.close-layout-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.close-analysis-row { grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr); }

.close-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.close-panel > header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
}

.close-panel > header span { display: block; color: var(--muted); font-size: 9px; }
.close-panel > header h2 { margin: 2px 0 0; font-size: 14px; letter-spacing: 0; }
.close-panel > header b { color: var(--muted); font-size: 9px; text-align: right; }

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

.close-narrative {
  min-width: 0;
  padding: 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.close-narrative:nth-child(2n) { border-right: 0; }
.close-narrative:nth-last-child(-n+2) { border-bottom: 0; }
.close-narrative strong { display: block; margin-bottom: 6px; font-size: 12px; }
.close-narrative p { margin: 0; color: #4f5964; font-size: 11px; line-height: 1.75; }

.score-components { padding: 6px 13px; }

.score-component {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid #edf0f2;
}

.score-component:last-child { border-bottom: 0; }
.score-component span, .score-component small { min-width: 0; font-size: 10px; }
.score-component small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.score-component b { font-size: 11px; text-align: right; }

.close-table-wrap { max-width: 100%; overflow-x: auto; }

table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
  font-size: 11px;
}

th, td { padding: 9px 11px; text-align: right; border-bottom: 1px solid #edf0f2; white-space: nowrap; }
th { color: var(--muted); font-size: 9px; font-weight: 700; background: #f7f8f9; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }

.us-context {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 13px;
  color: #cfd5dc;
  font-size: 10px;
  border-top: 1px solid #343a42;
  background: #24292f;
}

.us-context strong { color: #fff; }
.us-context b { color: #efb953; }

.breadth-bars { padding: 9px 13px 12px; }

.breadth-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 54px;
  gap: 9px;
  align-items: center;
  min-height: 29px;
  font-size: 10px;
}

.breadth-track { height: 8px; overflow: hidden; background: #e9edf0; }
.breadth-fill { height: 100%; min-width: 2px; background: #78828d; }
.breadth-fill.strong-up, .breadth-fill.up, .breadth-fill.mild-up { background: var(--red); }
.breadth-fill.strong-down, .breadth-fill.down, .breadth-fill.mild-down { background: var(--green); }
.breadth-row b { text-align: right; }

.style-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 100%; }

.style-group { min-width: 0; padding: 17px 13px; border-right: 1px solid var(--line); }
.style-group:last-child { border-right: 0; }
.style-group > span { display: block; color: var(--muted); font-size: 10px; }
.style-group > strong { display: block; margin: 7px 0 10px; font-size: 22px; }
.style-group dl { display: grid; gap: 6px; margin: 0; }
.style-group dl div { display: flex; justify-content: space-between; gap: 8px; font-size: 9px; }
.style-group dt { color: var(--muted); }
.style-group dd { margin: 0; font-weight: 700; }

.sector-list { display: grid; }

.sector-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 68px 74px 82px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 12px;
  border-bottom: 1px solid #edf0f2;
}

.sector-row:last-child { border-bottom: 0; }
.sector-row > div { min-width: 0; }
.sector-row strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sector-row small { display: block; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.sector-row > span, .sector-row > b { font-size: 10px; text-align: right; }

.stock-rank-list, .event-list { display: grid; }

.stock-rank {
  display: grid;
  grid-template-columns: 26px minmax(110px, 1fr) 75px 80px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 6px 12px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #edf0f2;
}

.stock-rank:last-child { border-bottom: 0; }
.stock-rank > i { color: var(--muted); font-size: 9px; font-style: normal; }
.stock-rank > div { min-width: 0; }
.stock-rank strong, .stock-rank small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-rank strong { font-size: 11px; }
.stock-rank small { color: var(--muted); font-size: 8px; }
.stock-rank > span, .stock-rank > b { font-size: 10px; text-align: right; }
.stock-rank:hover { background: #f7f8f9; }

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

.scenario {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-top: 4px solid var(--amber);
}

.scenario:last-child { border-right: 0; }
.scenario.positive { border-top-color: var(--red); }
.scenario.negative { border-top-color: var(--green); }
.scenario-head { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; }
.scenario-head strong { font-size: 13px; }
.scenario-head b { flex: 0 0 auto; color: var(--amber); font-size: 16px; }
.scenario.positive .scenario-head b { color: var(--red); }
.scenario.negative .scenario-head b { color: var(--green); }
.scenario > p { min-height: 42px; margin: 9px 0; color: #4f5964; font-size: 10px; line-height: 1.6; }
.scenario ul { margin: 0; padding-left: 17px; color: #59636e; font-size: 9px; line-height: 1.65; }
.scenario > small { display: block; margin-top: 10px; padding-top: 9px; color: #313942; font-size: 9px; line-height: 1.55; border-top: 1px solid var(--line); }

.event-columns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.event-columns > div { min-width: 0; border-right: 1px solid var(--line); }
.event-columns > div:last-child { border-right: 0; }
.event-columns h3 { margin: 0; padding: 9px 12px; color: var(--muted); font-size: 10px; border-bottom: 1px solid var(--line); background: #f7f8f9; }

.event-item {
  display: block;
  min-width: 0;
  padding: 9px 12px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #edf0f2;
}

.event-item:last-child { border-bottom: 0; }
.event-item strong { display: block; margin-bottom: 3px; font-size: 10px; line-height: 1.45; }
.event-item span { display: block; color: var(--muted); font-size: 9px; line-height: 1.55; }
a.event-item:hover { background: #f7f8f9; }

.empty-row { padding: 18px 13px; color: var(--muted); font-size: 10px; }

.close-method {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid #323840;
  background: #20242a;
}

.close-method > div { min-width: 0; padding: 12px 14px; border-right: 1px solid #383f47; }
.close-method > div:last-child { border-right: 0; }
.close-method strong { color: #fff; font-size: 10px; }
.close-method p { margin: 5px 0 0; color: #adb5be; font-size: 9px; line-height: 1.65; }

@media (max-width: 1320px) {
  .close-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .close-metric:nth-child(4n) { border-right: 0; }
  .close-metric:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .event-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-columns > div:nth-child(2n) { border-right: 0; }
  .event-columns > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 920px) {
  .close-layout-two, .close-analysis-row { grid-template-columns: 1fr; }
  .close-command { grid-template-columns: minmax(0, 1fr) 120px; }
  .scenario-grid { grid-template-columns: 1fr; }
  .scenario { border-right: 0; border-bottom: 1px solid var(--line); }
  .scenario:last-child { border-bottom: 0; }
  .scenario > p { min-height: 0; }
  .close-method { grid-template-columns: 1fr; }
  .close-method > div { border-right: 0; border-bottom: 1px solid #383f47; }
  .close-method > div:last-child { border-bottom: 0; }
}

@media (max-width: 620px) {
  .close-topbar { grid-template-columns: auto minmax(0, 1fr) auto; padding-left: 10px; padding-right: 10px; }
  .close-back b, .close-topbar-title span { display: none; }
  .close-topbar-title { justify-self: center; }
  .close-topbar-state span { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .close-shell { gap: 9px; padding: 9px; }
  .close-command { grid-template-columns: 1fr; }
  .close-command-main { padding: 15px; }
  .close-command-main h1 { font-size: 20px; }
  .close-score { grid-template-columns: auto auto auto; gap: 9px; align-items: center; justify-content: start; padding: 10px 15px; text-align: left; border-top: 1px solid #3a4048; border-left: 0; }
  .close-score strong { font-size: 25px; }
  .close-quality { align-items: flex-start; }
  .close-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .close-metric:nth-child(2n) { border-right: 0; }
  .close-metric:nth-child(-n+6) { border-bottom: 1px solid var(--line); }
  .close-narratives { grid-template-columns: 1fr; }
  .close-narrative, .close-narrative:nth-child(2n), .close-narrative:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .close-narrative:last-child { border-bottom: 0; }
  .us-context { grid-template-columns: 1fr; gap: 4px; }
  .style-groups { grid-template-columns: 1fr; }
  .style-group { padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .style-group:last-child { border-bottom: 0; }
  .style-group > strong { margin: 4px 0 7px; font-size: 18px; }
  .sector-row { grid-template-columns: minmax(100px, 1fr) 58px 68px; }
  .sector-row > span:last-child { display: none; }
  .stock-rank { grid-template-columns: 22px minmax(100px, 1fr) 68px; }
  .stock-rank > b { display: none; }
  .event-columns { grid-template-columns: 1fr; }
  .event-columns > div, .event-columns > div:nth-child(2n), .event-columns > div:nth-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .event-columns > div:last-child { border-bottom: 0; }
}
