:root {
  --bg: #f7f9fb; --card: #ffffff; --ink: #15202b; --muted: #5b6b7b;
  --line: #e3e9f0; --accent: #0f7a5c; --accent-soft: #e6f4ef;
  --good: #15803d; --mid: #b45309; --bad: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.02em; }
.brand .tag { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.ghost-btn { background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; color: var(--ink); font-size: 0.9rem; }
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }
.meta-line { color: var(--muted); font-size: 0.85rem; margin: 12px 0; }

.tabs { display: flex; gap: 8px; margin: 16px 0 4px; }
.tab { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); font-size: 1rem; cursor: pointer; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
#search { flex: 2 1 180px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 1rem; }
.slider-lab { flex: 1 1 140px; display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; color: var(--muted); }
#sector { flex: 1 1 140px; padding: 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 0.95rem; background: var(--card); }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.04em; }
th.r, td.r { text-align: right; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--accent-soft); }
.sym { font-weight: 700; }
.nm { color: var(--muted); font-size: 0.85rem; display: block; }
.up { color: var(--good); } .down { color: var(--bad); }
.pill { display: inline-block; min-width: 52px; text-align: center; padding: 4px 10px;
  border-radius: 999px; font-weight: 700; color: #fff; }
.pill.g { background: var(--good); } .pill.m { background: var(--mid); }
.pill.b { background: var(--bad); }

#detail-view { margin-top: 8px; }
.d-head { display: flex; align-items: center; gap: 16px; margin: 12px 0; }
.dial { width: 110px; height: 110px; flex: none; }
.d-title h2 { margin: 0; font-size: 1.4rem; }
.d-title p { margin: 2px 0 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin: 12px 0; }
.card h3 { margin: 0 0 10px; font-size: 1rem; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 48px; gap: 10px;
  align-items: center; margin: 8px 0; font-size: 0.9rem; }
.bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 6px; }
.explain li { margin: 8px 0; }

/* v2 reason cards */
.score-label { display: inline-block; font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 3px 10px;
  margin-bottom: 6px; }
.rankline { font-weight: 600; color: var(--ink) !important; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; font-size: 0.85rem; font-weight: 600; }
.dots { display: flex; gap: 6px; margin-top: 8px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--accent); }
.checks-head { display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 4px; }
.checks-head .trend { font-size: 0.85rem; color: var(--muted); }
.reasons { list-style: none; margin: 0; padding: 0; }
.reasons li { position: relative; margin: 0; padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.reasons li:last-child { border-bottom: none; }
.reasons li::before { content: ""; position: absolute; left: 0; top: 12px;
  bottom: 12px; width: 4px; border-radius: 2px; background: var(--muted); }
.reasons li.tone-positive::before { background: var(--good); }
.reasons li.tone-negative::before { background: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; }
.stat { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.stat .k { font-size: 0.75rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; }
.stat .v { font-weight: 700; font-size: 1.05rem; }
.src { font-size: 0.8rem; color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; z-index: 50; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-card { background: var(--card); border-radius: 14px; max-width: 680px;
  width: 100%; padding: 22px; }
.modal-card h2 { margin-top: 0; }
.modal-card table { font-size: 0.85rem; }

.foot { margin: 32px auto 48px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 0.9rem; color: var(--muted); }

@media (max-width: 560px) {
  th:nth-child(3), td:nth-child(3) { display: none; } /* hide price on phones */
  .bar-row { grid-template-columns: 104px 1fr 44px; }
}
