@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --ink: #0d1117; --ink2: #1c2433; --ink3: #2e3d52;
  --muted: #5a6a7e; --dim: #8999ab; --rule: #d4dce8;
  --surface: #f6f9fc; --white: #ffffff; --accent: #1e5fa8; --gold: #c9961a;
  --sb: #0d6e3f; --sb-bg: #e6f4ed; --sb-border: #6fcf9a;
  --b:  #1a5c2a; --b-bg:  #eef7f1; --b-border:  #a8d9b8;
  --w:  #7a5500; --w-bg:  #fdf6e3; --w-border:  #f4c842;
  --p:  #8b3a00; --p-bg:  #fdf0e6; --p-border:  #f4a261;
  --av: #7a1020; --av-bg: #fde8eb; --av-border: #e8546a;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--surface); color: var(--ink); min-height: 100vh; }

/* MASTHEAD */
.masthead { background: var(--ink); padding: 28px 40px 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.masthead-eyebrow { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .18em; color: var(--dim); text-transform: uppercase; margin-bottom: 6px; }
.masthead-title { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 900; color: #fff; line-height: 1.1; }
.masthead-sub { font-size: 13px; color: #8ba3c0; margin-top: 4px; }
.masthead-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.mstat { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 6px; padding: 8px 14px; text-align: center; min-width: 64px; }
.mstat-n { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; color: #fff; line-height: 1; }
.mstat-l { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-top: 3px; }
.mstat.sb .mstat-n { color: #6fcf9a; } .mstat.b .mstat-n { color: #a8d9b8; } .mstat.w .mstat-n { color: #f4c842; } .mstat.av .mstat-n { color: #e8546a; }

/* CONTROLS */
.controls { background: var(--white); border-bottom: 1px solid var(--rule); padding: 14px 40px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--dim); width: 14px; height: 14px; pointer-events: none; }
#search { width: 100%; padding: 8px 10px 8px 32px; border: 1px solid var(--rule); border-radius: 6px; font-size: 13px; font-family: 'DM Sans', sans-serif; background: var(--surface); color: var(--ink); outline: none; }
#search:focus { border-color: var(--accent); }
select { padding: 8px 28px 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a6a7e'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; font-family: 'DM Sans', sans-serif; font-size: 12px; outline: none; }
.pill-group { display: flex; gap: 4px; flex-wrap: wrap; }
.pill { padding: 5px 10px; border-radius: 20px; border: 1.5px solid var(--rule); cursor: pointer; font-size: 11px; font-weight: 500; font-family: 'DM Sans', sans-serif; background: var(--white); color: var(--muted); white-space: nowrap; transition: all .15s; }
.pill.active { color: #fff; border-color: transparent; }
.pill[data-v="Strong Buy"].active { background: var(--sb); } .pill[data-v="Buy"].active { background: var(--b); } .pill[data-v="Watch"].active { background: var(--w); color: var(--ink); } .pill[data-v="Pass"].active { background: var(--p); } .pill[data-v="Avoid"].active { background: var(--av); } .pill[data-v="all"].active { background: var(--accent); } .pill[data-v="dividend"].active { background: var(--gold); }
.sort-group { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.sort-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sort-btn { padding: 6px 10px; border-radius: 5px; border: 1px solid var(--rule); background: var(--surface); cursor: pointer; font-size: 11px; font-family: 'DM Sans', sans-serif; color: var(--muted); }
.sort-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* CHARTS */
.charts { padding: 20px 40px 0; display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin-bottom: 20px; }
.chart-box { background: var(--white); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px; }
.chart-title { font-size: 11px; font-family: 'DM Mono', monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-legend { flex: 1; }
.legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; color: var(--ink2); }
.legend-val { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); font-weight: 500; }
.scatter-container { position: relative; height: 200px; }

/* RESULTS BAR */
.results-bar { padding: 10px 40px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.results-count { font-weight: 500; color: var(--ink); }

/* GRID */
.grid { padding: 0 40px 60px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* CARD */
.card-link { text-decoration: none; display: block; }
.card { background: var(--white); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: 0 8px 30px rgba(0,0,0,.1); transform: translateY(-2px); }
.card-accent { height: 3px; width: 100%; }
.card-body { padding: 16px 18px 14px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.card-left { flex: 1; margin-right: 10px; }
.card-name { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.card-sector { font-size: 10px; color: var(--muted); margin-top: 2px; font-family: 'DM Mono', monospace; letter-spacing: .05em; }
.verdict-badge { padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; flex-shrink: 0; }
.v-sb { background: var(--sb-bg); color: var(--sb); border: 1px solid var(--sb-border); }
.v-b  { background: var(--b-bg);  color: var(--b);  border: 1px solid var(--b-border); }
.v-w  { background: var(--w-bg);  color: var(--w);  border: 1px solid var(--w-border); }
.v-p  { background: var(--p-bg);  color: var(--p);  border: 1px solid var(--p-border); }
.v-av { background: var(--av-bg); color: var(--av); border: 1px solid var(--av-border); }
.pillars { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.pillar-row { display: flex; align-items: center; gap: 8px; }
.p-label { font-size: 10px; color: var(--muted); width: 62px; flex-shrink: 0; font-family: 'DM Mono', monospace; }
.p-track { flex: 1; height: 5px; background: #eaeef3; border-radius: 3px; overflow: hidden; }
.p-fill { height: 100%; border-radius: 3px; }
.p-score { font-size: 10px; font-weight: 600; font-family: 'DM Mono', monospace; width: 18px; text-align: right; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 0; border-top: 1px solid #eaeef3; margin-top: 2px; }
.bottom-label { font-size: 10px; color: var(--muted); margin-bottom: 1px; font-family: 'DM Mono', monospace; }
.overall-score { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; line-height: 1; }
.score-denom { font-size: 14px; color: var(--muted); }
.buy-price { font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500; color: var(--accent); }
.div-badge { display: inline-block; font-size: 9px; padding: 2px 6px; background: #fff8e1; border: 1px solid #f4c842; color: #7a5500; border-radius: 10px; font-weight: 600; letter-spacing: .04em; margin-left: 4px; }
.thesis-snippet { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eaeef3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }


/* RESPONSIVE */

/* FOOTER LINKS */
.footer { text-align: center; padding: 28px 40px 24px; font-size: 13px; color: var(--dim); border-top: 1px solid var(--rule); font-family: "DM Mono", monospace; }
.footer-links { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 10px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 13px; transition: color .15s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 12px; }

/* FOOTER LOGO */
.footer-logo { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; }
.footer-logo-text { font-family: "Playfair Display", serif; font-size: 15px; font-weight: 700; color: var(--muted); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .charts { grid-template-columns: 1fr; }
  .masthead { padding: 20px 16px 16px; }
  .controls { padding: 10px 16px; }
  .grid { padding: 0 16px 40px; }
  .charts { padding: 12px 16px 0; }
  .results-bar { padding: 8px 16px; }
  .footer { padding: 20px 16px; }
}
@media (max-width: 700px) {
  .masthead-stats { display: none; }
  .masthead { padding: 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .masthead-title { font-size: 22px; }
  .controls { flex-direction: column; align-items: stretch; padding: 10px 12px; gap: 8px; }
  .search-wrap { max-width: 100%; }
  .sort-group { margin-left: 0; flex-wrap: wrap; }
  .grid { grid-template-columns: 1fr; padding: 0 12px 40px; gap: 10px; }
  .charts { display: none; }
  .results-bar { padding: 8px 12px; }
  .footer-links { gap: 14px; }
  .pill-group { gap: 4px; }
  .pill { font-size: 11px; padding: 4px 8px; }
}
