/* StockDocs — visual system.
   Dark by default, light theme via [data-theme="light"] on <html>. */

:root {
  color-scheme: dark;

  --bg: #070b12;
  --bg-elev: #0d131d;
  --bg-elev-2: #121a26;
  --surface: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #e9eef5;
  --text-dim: #93a1b5;
  --text-faint: #64748b;

  --accent: #4c8dff;
  --accent-soft: rgba(76, 141, 255, 0.14);
  --up: #2ecc8f;
  --up-soft: rgba(46, 204, 143, 0.14);
  --down: #ff5c72;
  --down-soft: rgba(255, 92, 114, 0.14);
  --warn: #ffb547;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --maxw: 1240px;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica,
    Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #ffffff;
  --surface: rgba(15, 23, 42, 0.02);
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f1a2b;
  --text-dim: #566579;
  --text-faint: #8593a6;
  --accent: #1f6feb;
  --accent-soft: rgba(31, 111, 235, 0.1);
  --up: #0f9d63;
  --up-soft: rgba(15, 157, 99, 0.12);
  --down: #d92b47;
  --down-soft: rgba(217, 43, 71, 0.1);
  --shadow: 0 16px 36px -28px rgba(15, 23, 42, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html[data-theme='dark'] body,
:root body {
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(76, 141, 255, 0.13), transparent 60%),
    radial-gradient(760px 460px at 92% 4%, rgba(46, 204, 143, 0.08), transparent 62%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}
html[data-theme='light'] body {
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(31, 111, 235, 0.09), transparent 60%),
    radial-gradient(760px 460px at 92% 4%, rgba(15, 157, 99, 0.06), transparent 62%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; }

.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.dim { color: var(--text-dim); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 62px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 680;
  letter-spacing: -0.03em;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), #7cf5c0);
  display: grid; place-items: center;
  box-shadow: 0 4px 14px -4px var(--accent);
}
.brand-mark svg { width: 15px; height: 15px; }
.topbar-spacer { flex: 1; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid; place-items: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--bg-elev-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* Attribution: readable on hover with a mouse, on tap with a finger. */
.attribution { position: relative; display: flex; }
.attribution-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  white-space: nowrap;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity .14s, transform .14s;
  z-index: 90;
}
.attribution:hover .attribution-tip,
.attribution:focus-within .attribution-tip,
.attribution.open .attribution-tip {
  opacity: 1;
  transform: translateY(0);
}
/* Touch devices get no hover state, so the tap toggle is the only affordance. */
@media (hover: none) {
  .attribution:hover .attribution-tip { opacity: 0; transform: translateY(-3px); }
  .attribution.open .attribution-tip { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------- search */

.search {
  position: relative;
  flex: 1;
  min-width: 0; /* without this the input's intrinsic width overflows the bar */
  max-width: 460px;
}
.search-hero { max-width: 620px; margin: 0 auto; }
.search input {
  width: 100%;
  min-width: 0;
  padding: 11px 14px 11px 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-hero input { padding: 16px 18px 16px 48px; font-size: 16.5px; border-radius: 14px; }
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search input::placeholder { color: var(--text-faint); }
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-hero .search-icon { left: 18px; width: 19px; height: 19px; }

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 80;
  max-height: 340px;
  overflow-y: auto;
}
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover, .suggestion.active { background: var(--accent-soft); }
.suggestion .tk {
  font-weight: 680;
  font-size: 13px;
  min-width: 58px;
  color: var(--accent);
}
.suggestion .nm {
  font-size: 13.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggestion .ex { margin-left: auto; font-size: 11px; color: var(--text-faint); }

/* ------------------------------------------------------------------- hero */

.hero { padding: 60px 0 34px; text-align: center; }
.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: -0.035em;
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 62%, transparent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--text-dim);
  max-width: 620px;
  margin: 0 auto 26px;
  font-size: 16px;
}
.pill-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  transition: .15s;
}
.pill:hover { border-color: var(--accent); color: var(--text); }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15.5px; }
.card-head .sub { font-size: 12.5px; color: var(--text-faint); }
.card-body { padding: 18px 20px; }

.section { margin: 30px 0; }
.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.section-title h2 { font-size: 19px; }
.section-title span { font-size: 13px; color: var(--text-faint); }

/* ------------------------------------------------------------------ table */

.table-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.table-tools input, .table-tools select {
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.table-tools input:focus, .table-tools select:focus { border-color: var(--accent); }
.table-tools .count { margin-left: auto; font-size: 12.5px; color: var(--text-faint); }

.table-scroll { overflow-x: auto; }
table.board { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.board th {
  text-align: right;
  padding: 11px 16px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-elev);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
table.board th:first-child, table.board th.left { text-align: left; }
table.board th:hover { color: var(--text); }
table.board th .arrow { opacity: .5; font-size: 9px; margin-left: 3px; }
table.board td {
  padding: 11px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.board td.left { text-align: left; }
table.board tbody tr { cursor: pointer; transition: background .12s; }
table.board tbody tr:hover { background: var(--surface); }
.rank { color: var(--text-faint); font-size: 12.5px; width: 46px; }
.co { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -.02em;
  flex-shrink: 0;
  color: #fff;
}
.co-name { display: flex; flex-direction: column; line-height: 1.25; }
.co-name b { font-size: 13.5px; font-weight: 620; }
.co-name small { color: var(--text-faint); font-size: 11.5px; }
.sector-tag {
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-block;
}
.chg { font-weight: 600; font-size: 13.5px; }

/* --------------------------------------------------------- company header */

.co-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding: 26px 0 20px;
}
.co-header .avatar { width: 52px; height: 52px; border-radius: 13px; font-size: 17px; }
.co-title { min-width: 0; flex: 1; }
.co-title h1 { font-size: 27px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.co-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 7px; }
.tag {
  font-size: 11.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.price-block { margin-left: auto; text-align: right; }
.price-block .px { font-size: 32px; font-weight: 660; letter-spacing: -.03em; }
.price-block .delta { font-size: 14.5px; font-weight: 600; margin-top: 2px; }
.price-block .asof { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

/* ------------------------------------------------------------------ stats */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  background: var(--bg-elev);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.stat {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.stat .k {
  font-size: 11.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
}
.stat .v { font-size: 17px; font-weight: 620; letter-spacing: -.02em; }
.stat .x { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.range-bar { margin-top: 8px; }
.range-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--down-soft), var(--surface), var(--up-soft));
  position: relative;
  border: 1px solid var(--border);
}
.range-dot {
  position: absolute;
  top: 50%;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.range-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); margin-top: 5px; }

/* ----------------------------------------------------------------- charts */

.chart-tabs { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; }
.chart-tab {
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 560;
  cursor: pointer;
  transition: .13s;
}
.chart-tab:hover { color: var(--text); background: var(--surface); }
.chart-tab.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .1s;
  z-index: 20;
  min-width: 108px;
}
.chart-tip.show { opacity: 1; }
.chart-tip .t-date { color: var(--text-faint); font-size: 11px; margin-bottom: 3px; }
.chart-tip .t-val { font-weight: 640; font-size: 14px; }
.chart-tip .t-row { display: flex; justify-content: space-between; gap: 14px; font-size: 11.5px; color: var(--text-dim); }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}
.mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.mini-head h3 { font-size: 14px; font-weight: 620; }
.mini-head .latest { font-size: 13px; font-weight: 620; }
.mini-sub { font-size: 11.5px; color: var(--text-faint); margin-bottom: 10px; }

/* --------------------------------------------------------------- briefing */

.briefing { display: grid; gap: 20px; }
.briefing .headline {
  font-size: 18.5px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.45;
}
.briefing h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  margin-bottom: 7px;
  font-weight: 640;
}
.briefing p { margin: 0; color: var(--text-dim); }
.briefing p.body { color: color-mix(in srgb, var(--text) 88%, transparent); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.driver-list { display: grid; gap: 10px; }
.driver {
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 12px;
}
.driver b { font-size: 13.5px; }
.driver span { display: block; font-size: 13px; color: var(--text-dim); }
.risk-list { display: grid; gap: 9px; }
.risk {
  display: flex;
  gap: 10px;
  font-size: 13.2px;
  color: var(--text-dim);
}
.risk .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warn);
  margin-top: 7px;
  flex-shrink: 0;
}
.risk b { color: var(--text); font-weight: 600; }
.fact-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fact-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 12.5px;
}
.fact-chip b { display: block; color: var(--text-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 620; }

.sources { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.source-link {
  font-size: 12px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--accent-soft);
  border-radius: 7px;
  padding: 4px 9px;
}
.source-link:hover { border-color: var(--accent); }

/* -------------------------------------------------------------- filings */

.filing-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.filing-row:last-child { border-bottom: 0; }
.filing-row:hover { background: var(--surface); }
.filing-group {
  padding: 12px 20px 8px;
  font-size: 11px;
  font-weight: 640;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.form-badge {
  font-size: 11px;
  font-weight: 660;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  min-width: 62px;
  text-align: center;
  flex-shrink: 0;
}
.form-badge.key {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
}
.filing-row .desc { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filing-row .date { margin-left: auto; color: var(--text-faint); font-size: 12.5px; }

/* --------------------------------------------------------------- states */

.skeleton {
  background: linear-gradient(90deg, var(--surface), color-mix(in srgb, var(--text) 8%, transparent), var(--surface));
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 7px;
}
@keyframes shimmer { 0% { background-position: 130% 0; } 100% { background-position: -30% 0; } }
.sk-line { height: 12px; margin-bottom: 9px; }

.empty, .loading-note {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13.5px;
}
.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
}
.banner.err { border-color: color-mix(in srgb, var(--down) 40%, transparent); background: var(--down-soft); color: var(--text); }

footer {
  margin-top: 54px;
  padding: 26px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
}
footer a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 3px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 18px 0 0;
}
.back-link:hover { color: var(--text); }

@media (max-width: 860px) {
  .topbar-inner { gap: 10px; padding: 0 14px; }
  .topbar-spacer { display: none; }
  .wrap { padding: 0 14px; }
  .co-header { gap: 14px; }
  .card-head { flex-wrap: wrap; }
  .two-col { grid-template-columns: 1fr; }
  .price-block { margin-left: 0; text-align: left; width: 100%; }
  .search { max-width: none; }
  .brand span.brand-text { display: none; }
  .hero { padding: 40px 0 26px; }
}
