:root {
  color-scheme: light;
  --ink: #14221d;
  --muted: #6b7872;
  --line: #e6ebe8;
  --surface: #ffffff;
  --canvas: #f5f7f5;
  --sidebar: #10271f;
  --sidebar-soft: #19382d;
  --green: #16845b;
  --green-bright: #42d49a;
  --green-pale: #e9f7f0;
  --amber: #d89024;
  --amber-pale: #fff4dd;
  --coral: #d96653;
  --violet: #745bd4;
  --shadow: 0 12px 40px rgba(27, 54, 43, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 248px;
  flex-direction: column;
  padding: 28px 18px 20px;
  overflow-y: auto;
  background: var(--sidebar);
  color: #d6e7df;
}
.brand { display: flex; align-items: center; gap: 11px; margin: 0 9px 38px; color: white; font-size: 21px; font-weight: 760; letter-spacing: -.5px; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: linear-gradient(145deg, #216b4e, #173d31); color: var(--green-bright); }
.brand-mark svg { width: 23px; }
.nav { display: grid; gap: 5px; }
.nav-label { margin: 0 11px 9px; color: #78968a; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; color: #a8c0b6; font-size: 13px; font-weight: 560; cursor: pointer; text-align: left; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.045); }
.nav-item.active { background: var(--sidebar-soft); color: white; box-shadow: inset 3px 0 var(--green-bright); }
.nav-item svg { width: 18px; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 10px; background: rgba(255,255,255,.1); color: #cfe3da; font-size: 10px; text-align: center; }
.process-card { margin: auto 3px 22px; padding: 16px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.035); }
.process-head { display: flex; justify-content: space-between; color: #dceae4; font-size: 11px; font-weight: 650; }
.process-head span:last-child { color: var(--green-bright); }
.process-track { height: 3px; margin: 11px 0 13px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.1); }
.process-track span { display: block; width: 50%; height: 100%; background: var(--green-bright); }
.process-card ol { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 0; padding: 0; color: #6e8c80; font-size: 10px; list-style: none; }
.process-card li::before { content: "○"; margin-right: 5px; }
.process-card li.done { color: #a8c3b7; }
.process-card li.done::before { content: "●"; color: var(--green-bright); }
.profile { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 13px 9px 0; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: #d7f2e5; color: #146244; font-size: 10px; font-weight: 800; }
.profile strong, .profile small { display: block; }
.profile strong { color: white; font-size: 11px; }
.profile small { margin-top: 3px; color: #759287; font-size: 9px; }
.profile button { border: 0; background: none; color: #66867a; cursor: pointer; }

.workspace { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: 68px; align-items: center; justify-content: space-between; gap: 20px; padding: 0 38px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(18px); }
.search { display: flex; width: min(420px, 46vw); align-items: center; gap: 10px; }
.search svg { width: 18px; color: #91a099; }
.search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search input::placeholder { color: #9aa6a0; }
kbd { padding: 2px 7px; border: 1px solid #dfe5e2; border-radius: 5px; color: #98a39e; background: #fafbfa; font-family: inherit; font-size: 10px; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.top-actions { display: flex; align-items: center; gap: 18px; }
.market-status { display: flex; align-items: center; gap: 7px; color: #718078; font-size: 11px; font-weight: 600; }
.market-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-pale); }
.icon-button, .menu-button { position: relative; display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; }
.icon-button svg, .menu-button svg { width: 17px; }
.icon-button > span { position: absolute; top: 7px; right: 7px; width: 5px; height: 5px; border: 1px solid white; border-radius: 50%; background: var(--coral); }
.menu-button { display: none; }

main { max-width: 1560px; margin: 0 auto; padding: 22px 38px 50px; }
.demo-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; padding: 9px 13px; border: 1px solid #f0dfb8; border-radius: 9px; color: #755a20; background: #fff9eb; font-size: 10px; }
.demo-banner svg { width: 15px; flex: 0 0 auto; }
.demo-banner button { margin-left: auto; border: 0; background: transparent; color: #a68b50; cursor: pointer; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: 1.2px; text-transform: uppercase; }
.hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 3vw, 40px); font-weight: 500; letter-spacing: -1.3px; }
.hero p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid var(--green); border-radius: 9px; background: var(--green); color: white; font-size: 11px; font-weight: 700; cursor: pointer; box-shadow: 0 5px 12px rgba(22,132,91,.14); transition: .18s ease; }
.primary-button:hover { background: #106f4b; transform: translateY(-1px); }
.primary-button svg { width: 15px; }
.primary-button.loading svg { animation: spin .8s linear infinite; }
.secondary-button { border-color: var(--line); background: white; color: var(--ink); box-shadow: none; }
.secondary-button:hover { background: #f8faf9; }
.wide { flex: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 34px; }
.metric-card { position: relative; display: flex; min-height: 102px; align-items: center; gap: 13px; overflow: hidden; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 3px 14px rgba(27,54,43,.03); }
.metric-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--green); background: var(--green-pale); }
.metric-icon.amber { color: var(--amber); background: var(--amber-pale); }
.metric-icon.violet { color: var(--violet); background: #f0edff; }
.metric-icon.coral { color: var(--coral); background: #fff0ed; }
.metric-icon svg { width: 17px; }
.metric-card div:nth-child(2) > span, .metric-card div:nth-child(2) > small { display: block; white-space: nowrap; }
.metric-card div:nth-child(2) > span { color: var(--muted); font-size: 10px; font-weight: 620; }
.metric-card div:nth-child(2) > strong { display: block; margin: 4px 0 3px; font-size: 23px; letter-spacing: -.6px; }
.metric-card strong em { color: #84918b; font-size: 11px; font-style: normal; font-weight: 550; }
.metric-card div:nth-child(2) > small { color: #9aa6a0; font-size: 8px; }
.metric-card small b { color: var(--green); }
.metric-spark { position: absolute; right: 9px; bottom: 13px; width: 68px; color: var(--green); opacity: .62; }
.metric-spark path { fill: none; stroke-width: 2; }

.content-section { border-radius: 14px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.3px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 700; cursor: pointer; }
.text-button span { margin-left: 4px; }
.filter-row { display: flex; align-items: center; gap: 6px; margin-bottom: 13px; }
.filter { min-height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #66756e; font-size: 9px; font-weight: 650; cursor: pointer; }
.filter.active { border-color: var(--sidebar); background: var(--sidebar); color: white; }
.filter span { margin-left: 5px; opacity: .65; }
.filter-icon { display: grid; width: 30px; height: 30px; margin-left: auto; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; color: #6e7d75; cursor: pointer; }
.filter-icon svg { width: 14px; }
.filter-icon.reversed svg { transform: scaleY(-1); }

.opportunity-grid { display: grid; grid-template-columns: minmax(600px, 1.55fr) minmax(310px, .78fr); gap: 13px; align-items: start; }
.opportunity-list, .detail-panel { border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.opportunity-list { overflow: hidden; }
.list-head, .opportunity-row { display: grid; grid-template-columns: minmax(205px, 1.65fr) .72fr .8fr .72fr 1fr; align-items: center; }
.list-head { min-height: 38px; padding: 0 18px; border-bottom: 1px solid var(--line); color: #9ba6a1; font-size: 8px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.opportunity-row { position: relative; width: 100%; min-height: 72px; padding: 0 18px; border: 0; border-bottom: 1px solid #edf0ee; background: white; cursor: pointer; text-align: left; transition: .15s ease; }
.opportunity-row::before { content: ""; position: absolute; inset: 10px auto 10px 0; width: 3px; border-radius: 2px; background: transparent; }
.opportunity-row:hover { background: #fafcfb; }
.opportunity-row.selected { background: #f7fbf9; }
.opportunity-row.selected::before { background: var(--green); }
.company-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.company-logo { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid #e5ebe8; border-radius: 9px; color: var(--logo-color, var(--green)); background: var(--logo-bg, #eff7f3); font-size: 11px; font-weight: 800; }
.company-logo.large { width: 40px; height: 40px; font-size: 13px; }
.company-lockup strong, .company-lockup span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-lockup strong { font-size: 10px; }
.company-lockup span { margin-top: 3px; color: #92a099; font-size: 8px; }
.company-lockup span b { color: #5e6f67; }
.price-cell strong, .price-cell small { display: block; }
.price-cell strong { font-size: 10px; }
.price-cell small { margin-top: 3px; font-size: 8px; }
.negative { color: var(--coral); }
.positive { color: var(--green); }
.drawdown-cell strong { display: block; color: var(--coral); font-size: 10px; }
.drawdown-cell small { color: #9ba6a1; font-size: 8px; }
.mini-bar { width: 47px; height: 3px; margin-top: 5px; border-radius: 2px; background: #f0f2f1; }
.mini-bar span { display: block; height: 100%; border-radius: 2px; background: var(--coral); }
.quality-cell { display: flex; align-items: center; gap: 7px; }
.score-circle { display: grid; width: 29px; height: 29px; place-items: center; border: 3px solid var(--score-color, var(--green)); border-radius: 50%; font-size: 8px; font-weight: 800; }
.quality-cell small { color: #8f9b95; font-size: 7px; }
.signal-pill { display: inline-flex; width: fit-content; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 6px; color: var(--pill-color); background: var(--pill-bg); font-size: 8px; font-weight: 700; white-space: nowrap; }
.signal-pill i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.load-more { display: block; width: 100%; min-height: 39px; border: 0; background: #fbfcfb; color: var(--green); font-size: 9px; font-weight: 700; cursor: pointer; }
.empty-state { display: grid; min-height: 240px; place-content: center; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 12px; }
.empty-state span { margin-top: 5px; font-size: 9px; }

.detail-panel { position: sticky; top: 81px; padding: 19px; }
.detail-top { display: flex; align-items: center; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.watch-button { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; color: #90a098; cursor: pointer; }
.watch-button.active { color: var(--amber); background: #fffaf0; }
.watch-button.active svg { fill: currentColor; }
.watch-button svg { width: 15px; }
.price-block { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; }
.price-block > div strong { display: block; font-size: 23px; letter-spacing: -.7px; }
.price-block > div span { display: block; margin-top: 4px; font-size: 9px; font-weight: 650; }
.quality-ring { display: grid; width: 49px; height: 49px; place-content: center; border: 4px solid var(--green); border-radius: 50%; text-align: center; box-shadow: inset 0 0 0 3px var(--green-pale); }
.quality-ring b { display: block; font-size: 12px; line-height: 1; }
.quality-ring small { display: block; margin-top: 3px; color: #7d8b84; font-size: 6px; text-transform: uppercase; }
.range-chart { padding: 12px; border-radius: 9px; background: #f7f9f8; }
.range-labels, .range-values { display: flex; justify-content: space-between; font-size: 7px; }
.range-labels { color: #85928c; }
.range-labels b { color: var(--coral); }
.range-values { color: #99a49f; }
.range-track { position: relative; height: 4px; margin: 12px 0 7px; border-radius: 4px; background: #dfe6e2; }
.range-track span { display: block; width: 18%; height: 100%; border-radius: 4px; background: var(--green); }
.range-track i { position: absolute; top: 50%; left: 18%; width: 10px; height: 10px; border: 2px solid white; border-radius: 50%; background: var(--green); box-shadow: 0 1px 4px rgba(0,0,0,.25); transform: translate(-50%,-50%); }
.diagnosis, .checks { padding-top: 16px; }
.diagnosis-head { display: flex; align-items: center; justify-content: space-between; }
.diagnosis h3, .checks h3 { margin: 0; font-size: 10px; }
.diagnosis-head > span { padding: 4px 6px; border-radius: 5px; color: #976b1d; background: var(--amber-pale); font-size: 7px; font-weight: 700; }
.diagnosis > p { margin: 9px 0 12px; color: #6b7972; font-size: 8px; line-height: 1.55; }
.evidence-row { display: grid; grid-template-columns: 58px 1fr 25px; align-items: center; gap: 8px; margin-top: 7px; font-size: 7px; }
.evidence-row span { color: #74827b; }
.evidence-row i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; }
.market-dot { background: #82a2cd; }.sector-dot { background: var(--amber); }.company-dot { background: var(--coral); }
.evidence-row div { height: 3px; border-radius: 3px; background: #edf0ef; }
.evidence-row div b { display: block; height: 100%; border-radius: 3px; background: #8ea39a; }
.evidence-row strong { text-align: right; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.check-grid > span { position: relative; padding: 9px 7px 8px 25px; border: 1px solid #edf0ef; border-radius: 7px; }
.check-grid i { position: absolute; top: 9px; left: 8px; display: grid; width: 12px; height: 12px; place-items: center; border-radius: 50%; font-size: 7px; font-style: normal; }
.check-grid i.pass { color: var(--green); background: var(--green-pale); }
.check-grid i.warn { color: var(--amber); background: var(--amber-pale); }
.check-grid small, .check-grid b { display: block; }
.check-grid small { color: #8b9892; font-size: 6px; }
.check-grid b { margin-top: 3px; font-size: 8px; }
.detail-actions { display: flex; gap: 7px; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; max-width: 320px; padding: 12px 16px; border-radius: 9px; background: var(--sidebar); color: white; font-size: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
dialog { width: min(480px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 30px 80px rgba(8,31,22,.28); }
dialog::backdrop { background: rgba(7,26,19,.52); backdrop-filter: blur(3px); }
dialog form { position: relative; padding: 30px; }
.dialog-close { position: absolute; top: 12px; right: 13px; border: 0; background: none; color: #87938e; font-size: 22px; cursor: pointer; }
.dialog-icon { display: grid; width: 38px; height: 38px; margin-bottom: 16px; place-items: center; border-radius: 10px; color: var(--green); background: var(--green-pale); }
.dialog-icon svg { width: 19px; }
dialog h2 { margin: 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
dialog form > p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.55; }
.score-method { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 19px 0; }
.score-method span { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.score-method b, .score-method small { display: block; }
.score-method b { color: var(--green); font-size: 16px; }
.score-method small { margin-top: 3px; color: var(--muted); font-size: 8px; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .opportunity-grid { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .workspace { grid-column: 1; }
  .sidebar { transform: translateX(-100%); transition: .2s ease; box-shadow: 12px 0 40px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: grid; }
  .topbar { padding: 0 22px; }
  main { padding-inline: 22px; }
  .search { margin-right: auto; }
}

@media (max-width: 760px) {
  .topbar { gap: 10px; }
  .market-status, kbd { display: none; }
  .search { width: auto; flex: 1; }
  main { padding: 16px 14px 35px; }
  .demo-banner { align-items: flex-start; line-height: 1.4; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero .primary-button { width: 100%; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 92px; padding: 13px; }
  .metric-icon { display: none; }
  .metric-spark { display: none; }
  .filter-row { overflow-x: auto; padding-bottom: 3px; }
  .filter { flex: 0 0 auto; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .opportunity-grid { display: block; }
  .detail-panel { margin-top: 12px; }
  .list-head { display: none; }
  .opportunity-row { grid-template-columns: minmax(155px, 1.5fr) .75fr .7fr; padding: 0 12px; }
  .opportunity-row > :nth-child(4), .opportunity-row > :nth-child(5) { display: none; }
  .toast { right: 14px; bottom: 14px; left: 14px; max-width: none; }
}

@media (max-width: 430px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-card div:nth-child(2) > span { white-space: normal; }
  .check-grid { grid-template-columns: 1fr; }
  .detail-actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
