/* Investment Patterns public site. Look from the design canvas: Inter body, Space Grotesk headings, blue accent. */
:root {
  color-scheme: light;
  --ink: #14171f;
  --muted: #4b5160;
  --faint: #8a909c;
  --line: #e3e6eb;
  --line-strong: #d5d9e0;
  --bg: #f6f7f9;
  --card: #ffffff;
  --blue: #1d4ed8;
  --blue-dark: #1e3a8a;
  --blue-soft: #eef2ff;
  --blue-tint: #f5f8ff;
  --orange: #c2410c;
  --warn-bg: #fff7ed;
  --warn-line: #fdba74;
  --warn-ink: #7c2d12;
  --radius: 12px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
button, input, select { font-family: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ top bar */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1200px; margin: 0 auto; padding: 14px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a, .nav span { padding: 8px 12px; border-radius: 8px; font-size: 14px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a[aria-current="page"] { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav span { color: var(--faint); }
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 4px; background: #16a34a; }

main { max-width: 1200px; margin: 0 auto; padding: 32px 32px 64px; display: flex; flex-direction: column; gap: 20px; }
footer { max-width: 1200px; margin: 0 auto; padding: 0 32px 48px; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ------------------------------------------------------------------ type */
h1 { margin: 0; font-family: var(--display); font-size: 36px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
h1 small { font-weight: 500; color: var(--muted); font-size: 20px; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
.lede { margin: 6px 0 0; font-size: 16px; color: var(--muted); max-width: 720px; line-height: 1.5; }
.muted { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.back { font-size: 13px; text-decoration: none; }

/* ------------------------------------------------------------------ blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--blue); color: var(--ink); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); color: #fff; }
.btn.big { min-height: 56px; font-size: 16px; flex: 1 1 180px; }
.btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.seg { display: inline-flex; background: #f1f3f6; border-radius: 10px; padding: 4px; gap: 4px; }
.seg button { min-height: 36px; padding: 6px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 23, 31, 0.12); }
.pill { min-height: 36px; padding: 6px 12px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--card); font-size: 13px; cursor: pointer; color: var(--ink); }
.pill:hover { border-color: var(--blue); }
.pill[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); font-weight: 600; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.callout svg { flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.callout.info { background: var(--blue-soft); border: 1px solid #c7d2fe; color: var(--blue-dark); }
.callout.plain { background: var(--card); border: 1px solid var(--line); color: var(--ink); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tile .k { font-size: 13px; color: var(--muted); }
.tile .v { font-family: var(--display); font-size: 30px; font-weight: 700; }
.tile .s { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ scan: ticker chips */
.picker { position: relative; flex: 999 1 520px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 56px; max-height: 168px; overflow-y: auto; padding: 8px 12px;
  border: 2px solid var(--blue); border-radius: 12px; background: var(--card); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--blue-soft); color: var(--blue-dark); font-size: 14px; font-weight: 600; }
.chip button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--blue-dark); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.chip button:hover { background: #dbe4ff; }
.chips input { flex: 1 1 160px; min-width: 120px; border: 0; font-size: 16px; padding: 8px 4px; background: transparent; color: var(--ink); }
.chips input:focus { outline: none; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20, 23, 31, 0.12); padding: 6px; display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.suggest button { display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: var(--card); padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 44px; color: var(--ink); }
.suggest button:hover, .suggest button.active { background: var(--blue-tint); }
.suggest .t { font-weight: 600; font-size: 14px; width: 120px; }
.suggest .n { font-size: 14px; color: var(--muted); flex: 1; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list > a, .list > div { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid #eef0f3; color: var(--ink); text-decoration: none; font-size: 14px; min-height: 44px; }
.list > :last-child { border-bottom: 0; }
.list > a:hover { background: var(--blue-tint); }

/* ------------------------------------------------------------------ results */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 44px; padding: 0 16px; border: 0; background: transparent; font-size: 14px; cursor: pointer; margin-bottom: -1px; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { font-weight: 700; color: var(--blue); border-bottom-color: var(--blue); }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.pcard .head { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pcard .win { font-family: var(--display); font-size: 22px; font-weight: 700; }
.pcard dl { flex: 3 1 420px; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.pcard dt { font-size: 12px; color: var(--muted); }
.pcard dd { margin: 2px 0 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pcard .flags { flex: 1 1 100%; font-size: 12px; color: #9a3412; margin-top: -8px; }
.spark { flex: 0 1 180px; min-width: 120px; display: flex; gap: 3px; align-items: center; height: 56px; }
.spark span { flex: 1; max-width: 16px; border-radius: 2px; }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
table { border-collapse: separate; font-size: 13px; }
.heat { border-spacing: 3px; min-width: 760px; width: 100%; }
.heat th { font-weight: 600; padding: 6px; }
.heat th[scope="row"] { text-align: left; white-space: nowrap; }
.heat td { padding: 8px 4px; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums; }
.data { width: 100%; border-spacing: 0; }
.data th, .data td { padding: 10px 12px; border-bottom: 1px solid #eef0f3; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data th { font-weight: 600; font-size: 12px; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
.data th button { all: unset; cursor: pointer; }
.data th button:focus-visible { outline: 2px solid var(--blue); }
.data td.num, .data th.num { text-align: right; }
.data tbody tr.link { cursor: pointer; }
.data tbody tr.link:hover { background: var(--blue-tint); }
.tall { max-height: 620px; overflow: auto; }
select { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); font-size: 14px; color: var(--ink); }

/* ------------------------------------------------------------------ compare */
.scards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.scard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-decoration: none; }
.scard:hover { border-color: var(--blue); color: var(--ink); }
.scard .tk { font-family: var(--display); font-size: 18px; font-weight: 700; }
.scard .pills { display: flex; gap: 4px; flex-wrap: wrap; }
.scard .badge { padding: 2px 7px; }
.map { min-width: 760px; display: grid; grid-template-columns: 120px repeat(12, minmax(0, 1fr)); gap: 4px; font-size: 12px; }
.map .m { text-align: center; font-weight: 600; padding: 4px 0; border-radius: 4px; color: var(--muted); }
.map .m.now { background: var(--ink); color: #fff; }
.map .t { font-weight: 600; font-size: 13px; align-self: center; color: var(--ink); text-decoration: none; }
.map .c { height: 30px; border-radius: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.cmp { width: 100%; min-width: 760px; border-spacing: 4px; }
.cmp th { text-align: left; padding: 6px; font-weight: 600; }
.cmp td { padding: 8px 10px; border-radius: 6px; vertical-align: top; }
.cmp td b, .cmp td span { display: block; }
.cmp td span { font-variant-numeric: tabular-nums; }
.loading { color: var(--muted); font-size: 14px; padding: 24px 0; }

@media (max-width: 640px) {
  .topbar .in, main, footer { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 28px; }
  .status { margin-left: 0; }
  .card { padding: 16px; }
}
@media print {
  .topbar, .no-print, .tabs, footer .no-print { display: none !important; }
  body, main { background: #fff; }
  .card, .pcard, .tile, .scroll { break-inside: avoid; }
}
