:root {
  --ink: #17201d;
  --muted: #68736e;
  --paper: #f3f1e9;
  --panel: #faf9f4;
  --line: #d7d8cf;
  --green: #176b4d;
  --green-dark: #0e4634;
  --orange: #dc6a35;
  --shadow: 0 18px 50px rgba(33, 49, 42, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
a { color: inherit; }
.auth-pending { overflow: hidden; }
.auth-pending > :not(.auth-gate) { pointer-events: none; user-select: none; filter: blur(5px); }
.auth-gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 29, .72);
  backdrop-filter: blur(8px);
}
.login-card {
  display: grid;
  width: min(420px, 100%);
  padding: 38px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .24);
}
.login-mark { margin-bottom: 24px; }
.login-card h1 { font-size: 38px; }
.login-description { margin: 14px 0 24px; color: var(--muted); line-height: 1.6; }
.login-card label { margin: 12px 0 7px; font-size: 13px; font-weight: 800; }
.login-card input {
  width: 100%;
  padding: 13px 14px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  font: inherit;
}
.login-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 77, .12); }
.login-card button { margin-top: 22px; padding: 13px; color: white; background: var(--green); border: 0; border-radius: 7px; font-weight: 800; cursor: pointer; }
.login-card button:disabled { opacity: .65; cursor: wait; }
.login-error { min-height: 20px; margin: 12px 0 0; color: #a34224; font-size: 13px; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 6vw, 88px);
  border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.logout-button { padding: 7px 11px; color: var(--green); background: transparent; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.logout-button:hover { color: white; background: var(--green); border-color: var(--green); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: white; background: var(--green); border-radius: 50%; font-family: Georgia, serif; }
.environment { color: var(--muted); font-size: 13px; }
main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 76px 0 62px; max-width: 850px; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0; max-width: 800px; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(42px, 7vw, 78px); font-weight: 500; line-height: 1.06; letter-spacing: -.045em; }
.lead { max-width: 700px; margin: 26px 0 30px; color: var(--muted); font-size: 17px; line-height: 1.8; }
.search-box { display: flex; width: min(610px, 100%); padding: 7px; background: white; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 12px 16px; color: var(--ink); font: 700 17px/1 inherit; text-transform: uppercase; }
.search-box button { border: 0; padding: 13px 20px; color: white; background: var(--green); border-radius: 6px; font-weight: 700; cursor: pointer; }
.search-box button:hover { background: var(--green-dark); }
.search-box button:disabled { opacity: .65; cursor: wait; }
.search-box .history-button { margin-right: 7px; color: var(--green); background: #e8eee8; white-space: nowrap; }
.search-box .history-button:hover { color: white; background: var(--green-dark); }
.status { min-height: 22px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.results { padding-bottom: 60px; }
.hidden { display: none !important; }
.panel { padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.company-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h2, h3 { margin: 0; letter-spacing: -.025em; }
h2 { font-size: 28px; }
h3 { font-size: 20px; }
.muted, .company-meta { color: var(--muted); }
.company-meta { margin: 10px 0 0; }
.text-link { color: var(--green); font-weight: 700; text-decoration: none; white-space: nowrap; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
.metric { padding: 22px; background: var(--ink); color: white; border-radius: 10px; }
.metric span { display: block; margin-bottom: 12px; color: #abb6b1; font-size: 12px; }
.metric strong { font-size: 24px; }
.positive { color: #5bd29e !important; }
.negative { color: #ff8f73 !important; }
.chart-panel { margin-bottom: 12px; }
.analysis-panel { margin-bottom: 12px; }
.analysis-heading { margin-bottom: 18px; }
.secondary-button { border: 1px solid var(--green); padding: 11px 16px; color: var(--green); background: transparent; border-radius: 6px; font-weight: 800; cursor: pointer; }
.secondary-button:hover { color: white; background: var(--green); }
.secondary-button:disabled { opacity: .45; cursor: wait; }
.analysis-empty { padding: 34px 0; color: var(--muted); text-align: center; border-top: 1px solid var(--line); }
.analysis-overview { display: flex; align-items: center; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.rating { padding: 7px 11px; color: white; background: var(--muted); border-radius: 5px; font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.rating.bullish { background: var(--green); }
.rating.bearish { background: var(--orange); }
.analysis-overview strong { font-size: 20px; }
.analysis-overview .muted { margin-left: auto; font-size: 12px; }
.analysis-summary { margin: 8px 0 24px; font: 500 20px/1.7 Georgia, "Noto Serif SC", serif; }
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.analysis-grid section { padding: 20px; background: #eeede5; border-radius: 8px; }
.analysis-grid h4, .analysis-conclusion h4 { margin: 0 0 10px; font-size: 14px; }
.analysis-grid p, .analysis-grid li, .analysis-conclusion p, .data-gaps { color: #4f5b56; font-size: 14px; line-height: 1.75; }
.analysis-grid ul, .data-gaps ul { margin: 0; padding-left: 20px; }
.analysis-conclusion { margin-top: 12px; padding: 20px; color: white; background: var(--green-dark); border-radius: 8px; }
.analysis-conclusion p { margin: 0; color: #e4eee9; }
.data-gaps { margin-top: 18px; }
.data-gaps summary { color: var(--green); cursor: pointer; font-weight: 800; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
#price-chart { display: block; width: 100%; height: 280px; }
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.count { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; color: white; background: var(--green); border-radius: 20px; font-size: 12px; }
.feed { display: grid; gap: 0; }
.feed.empty { color: var(--muted); padding: 28px 0; }
.feed-item { padding: 16px 0; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: 0; padding-top: 0; }
.feed-item a { font-weight: 700; line-height: 1.45; text-decoration: none; }
.feed-item a:hover { color: var(--green); }
.feed-meta { display: flex; gap: 10px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.tag { color: var(--green); font-weight: 800; }
.warning { margin-top: 12px; padding: 16px 18px; color: #74351d; background: #f7dfd3; border: 1px solid #e8b69e; border-radius: 8px; font-size: 13px; line-height: 1.6; }
footer { padding: 26px 20px 40px; color: var(--muted); text-align: center; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .environment { display: none; }
  .hero { padding-top: 52px; }
  .search-box { flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .company-card { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 430px) {
  main { width: min(100% - 24px, 1180px); }
  .metric-grid { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
}
