:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #66736f;
  --line: #dce5e1;
  --accent: #0f766e;
  --accent-dark: #0b5d56;
  --positive: #157347;
  --negative: #b42318;
  --watch: #8a5a00;
  --shadow: 0 18px 42px rgba(27, 49, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 20px;
  background: #102522;
  color: #f7fbfa;
}

.eyebrow {
  margin: 0 0 6px;
  color: #4aa79e;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.12;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.status-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 560px;
  color: #d9e9e6;
  font-size: 0.9rem;
}

.status-panel span {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 7px 10px;
}

.status-pill {
  background: #e7f6f3;
  color: var(--accent-dark);
  font-weight: 700;
}

.layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 34px) 42px;
}

.toolbar,
.summary-grid,
.content-grid {
  margin-bottom: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-group.compact {
  gap: 8px;
}

button,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

button {
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

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

select {
  padding: 0 34px 0 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.metric {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
  line-height: 1;
}

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

.news-section,
.side-panel section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.news-section {
  min-width: 0;
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

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

.loading {
  padding: 26px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

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

.news-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--watch);
  border-radius: 8px;
  background: #fff;
}

.news-card.positive {
  border-left-color: var(--positive);
}

.news-card.negative {
  border-left-color: var(--negative);
}

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

.news-title a {
  font-weight: 800;
  text-decoration: none;
}

.news-title a:hover {
  text-decoration: underline;
}

.impact-badge {
  flex: 0 0 auto;
  min-width: 82px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f8f0d8;
  color: var(--watch);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.impact-badge.positive {
  background: #e6f4ec;
  color: var(--positive);
}

.impact-badge.negative {
  background: #fae8e6;
  color: var(--negative);
}

.news-meta,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.83rem;
}

.tag-row span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf3f1;
  color: #33413e;
}

.news-desc {
  margin-bottom: 0;
  color: #40504c;
}

.original-news {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f6faf9;
  color: var(--muted);
  font-size: 0.9rem;
}

.original-news summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

.original-news p {
  margin: 8px 0 0;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.side-panel section {
  padding: 16px;
}

.focus-list {
  margin: 0;
  padding-left: 20px;
  color: #33413e;
}

.focus-list li + li {
  margin-top: 7px;
}

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

.symbol-grid a {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}

.symbol-grid a:hover {
  border-color: var(--accent);
  background: #edf8f6;
}

.note,
.error-box {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.error-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #f3b8b2;
  border-radius: 8px;
  background: #fff4f2;
  color: var(--negative);
}

@media (max-width: 980px) {
  .topbar,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-panel {
    justify-content: flex-start;
  }

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

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .layout {
    padding-inline: 10px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .news-title {
    display: grid;
  }

  .impact-badge {
    justify-self: start;
  }

  .symbol-grid {
    grid-template-columns: 1fr;
  }
}
