:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --ink: #172033;
  --text: #172033;
  --muted: #637083;
  --line: #d9e2ec;
  --line-strong: #aebdca;
  --blue: #245b78;
  --blue-soft: #e7f1f7;
  --primary: #245b78;
  --primary-weak: #e7f1f7;
  --primary-soft: #e7f1f7;
  --green: #176b4d;
  --success: #176b4d;
  --success-soft: #e8f6ef;
  --red: #b42318;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --amber: #9a6100;
  --warning: #9a6100;
  --warning-soft: #fff4db;
  --soft: #eef3f7;
  --shadow: 0 12px 28px rgba(23, 32, 51, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 44%, #eef3f7 100%);
  font-family: "Aptos", "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

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

h1 {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.page {
  width: min(1440px, calc(100vw - 32px));
  max-width: none;
  margin: 0 auto;
  padding: 20px 0 34px;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 34px;
  gap: 14px;
  min-height: auto;
}

.topbar,
.hero,
.sidebar,
.panel,
.section,
.watchlist-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar,
.hero {
  padding: 20px;
  margin-bottom: 14px;
  color: var(--ink);
}

.hero {
  display: block;
  background: var(--panel);
}

.hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
}

.hero p,
.sub,
.muted,
.hint {
  color: var(--muted);
}

.hero p,
.sub {
  line-height: 1.6;
  margin-top: 8px;
  font-size: 14px;
}

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

.toolbar,
.actions,
.inline-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar { margin-top: 16px; }

button,
.btn,
.refresh,
.small-button,
.btn-primary,
.btn-secondary {
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

button:hover,
.btn:hover,
.refresh:hover,
.small-button:hover,
.btn-primary:hover,
.btn-secondary:hover {
  transform: none;
  border-color: var(--line-strong);
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.06);
  text-decoration: none;
}

button:disabled,
.btn:disabled,
.refresh:disabled,
.small-button:disabled {
  opacity: 0.6;
  cursor: wait;
  box-shadow: none;
}

.btn.primary,
.btn-primary,
.refresh,
.small-button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.btn.secondary,
.btn-secondary {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.btn.success {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.btn.danger {
  border-color: #e4aaa4;
  background: var(--red-soft, #fff0ee);
  color: var(--red);
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.shell .main {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar {
  background: var(--panel);
  padding: 18px;
}

.panel {
  overflow: hidden;
}

.panel-head,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.panel-head {
  min-height: 54px;
  padding: 14px 16px;
}

.section {
  padding: 16px;
  margin-bottom: 14px;
}

.section-head {
  padding-bottom: 12px;
  margin-bottom: 12px;
  background: transparent;
}

.panel-body {
  padding: 16px;
}

.subpanel,
.segment,
.segment-card,
.result-segment,
.tier-box,
.kv-item,
.industry,
.company-row,
.stat-card,
.stat,
.metric,
.output-summary,
.file-row,
.risk-card,
.heat-card,
.risk-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  box-shadow: none;
}

.subpanel,
.segment-card,
.result-segment {
  padding: 16px;
  margin-bottom: 14px;
}

.stat,
.stat-card,
.metric,
.kv-item,
.company-row {
  padding: 12px;
}

.metric .k,
.stat .k,
.stat-card .k,
.kv-item .k {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric .v,
.stat .v,
.stat-card .v,
.kv-item .v {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

label,
.field {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  min-height: 78px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid rgba(36, 91, 120, 0.25);
  outline-offset: 2px;
}

.badge,
.tag,
.tier-pill,
.recommendation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag,
.tier-pill,
.recommendation-badge {
  border-radius: 8px;
}

.badge.ok,
.badge.low,
.badge.cool,
.badge.buy,
.tier-opportunity,
.tone-positive {
  color: var(--green);
  border-color: #9acdb9;
  background: var(--green-soft);
}

.badge.warn,
.badge.medium,
.badge.watch,
.tier-watch,
.tone-watch {
  color: var(--amber);
  border-color: #dfc27b;
  background: var(--warning-soft);
}

.badge.critical,
.badge.high,
.badge.risk,
.badge.error,
.tier-core,
.tone-cautious,
.tone-negative {
  color: var(--red);
  border-color: #e4aaa4;
  background: var(--danger-soft);
}

.status,
.mini-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.status.info,
.status.show {
  border: 1px solid #b8ceda;
  border-radius: 8px;
  background: var(--blue-soft, #e7f1f7);
  color: var(--blue);
}

.status.error {
  border-color: #e4aaa4;
  background: var(--danger-soft);
  color: var(--red);
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  line-height: 1.7;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--panel-soft);
  color: #364253;
}

.source-link,
.link {
  color: var(--blue);
  font-weight: 900;
}

details.advanced-block {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
}

details.advanced-block > summary {
  color: var(--blue);
}

.recommendation-panel {
  background: var(--panel-soft);
  border-color: var(--line);
}

.industry-button.active {
  background: var(--blue);
  color: #ffffff;
}

.company-button:hover,
.company-button.active {
  border-color: var(--line-strong);
  background: var(--blue-soft, #e7f1f7);
}

@media (max-width: 1120px) {
  .shell {
    width: min(100vw - 20px, 1440px);
  }
}

@media (max-width: 680px) {
  .page,
  .shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 12px;
  }

  .topbar,
  .hero {
    display: grid;
    padding: 16px;
  }

  .toolbar,
  .actions {
    justify-content: stretch;
  }

  .toolbar > *,
  .actions > * {
    flex: 1 1 140px;
  }

  h1,
  .hero h1 {
    font-size: 24px;
  }
}
