/* Stock Dashboard styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- Colour tokens ---------- */
:root {
  --bg: #f3f5fb; --bg2: #e6eaf7; --card: #ffffff; --muted: #f0f2f8; --border: #e2e6f0;
  --text: #131722; --text2: #555d70; --text3: #8a91a3;
  --accent: #4654e0; --accent2: #0ea5a4; --on-accent: #ffffff;
  --pos: #0f7b46; --posbg: #e3f5ec;
  --neg: #c62828; --negbg: #fdeaea;
  --warn: #8a5200; --warnbg: #fff1d6;
  --best: #eef0ff;
  --accent-soft: rgba(70,84,224,.10); --accent-strong: #2f3bc4;   /* hover tint and hover text */
  --neg-soft: rgba(198,40,40,.12);
  /* chart lines: price, 50-day average, 200-day average (checked for colour-blind separation) */
  --line-1: #4654e0; --line-2: #c2570a; --line-3: #008f86;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 28px rgba(16,24,40,.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0a0d16; --bg2: #101528; --card: #141929; --muted: #1c2236; --border: #262d45;
  --text: #eef0f7; --text2: #a6adc2; --text3: #727a92;
  --accent: #8b96ff; --accent2: #3fd0c9; --on-accent: #0a0d16;
  --pos: #4ade80; --posbg: rgba(74,222,128,.13);
  --neg: #ff7b7b; --negbg: rgba(255,123,123,.13);
  --warn: #fbbf24; --warnbg: rgba(251,191,36,.13);
  --best: rgba(139,150,255,.15);
  --accent-soft: rgba(139,150,255,.16); --accent-strong: #c3c9ff;
  --neg-soft: rgba(255,123,123,.16);
  --line-1: #7a86f5; --line-2: #cf7d30; --line-3: #16a69e;
  --shadow: 0 10px 30px rgba(0,0,0,.4);
}

body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 500px at 10% -10%, var(--bg2), transparent 60%), var(--bg);
  min-height: 100vh;
}
.sd-root { max-width: 1140px; margin: 0 auto; padding: 0 16px 48px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ---------- Top bar ---------- */
.sd-top { display: flex; align-items: center; gap: 12px; padding: 14px 0; flex-wrap: wrap; }
.sd-brand {
  display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; letter-spacing: -.01em;
  padding: 4px 6px 4px 0;
}
.sd-brand img { width: 28px; height: 28px; display: block; }
/* Main menu: Home / Compare */
.sd-nav { display: flex; gap: 4px; padding: 4px; background: var(--muted); border-radius: 12px; margin-right: auto; }
.sd-nav a {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px;
  color: var(--text2); font-size: 14px; font-weight: 650; text-decoration: none;
}
.sd-nav a[aria-current="page"] { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.sd-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sd-navcount { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.sd-navcount:empty { display: none; }
@media (max-width: 640px) {
  .sd-brand { margin-right: auto; }
  .sd-nav { order: 3; width: 100%; margin: 0; }
  .sd-nav a { flex: 1; justify-content: center; }
}
/* Signed out: only the logo, the theme button and the sign-in card */
.sd-root.signed-out .sd-nav, .sd-root.signed-out .sd-search { display: none; }
.sd-root.signed-out .sd-brand { margin-right: auto; }
.sd-userbtn { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-userbtn[hidden] { display: none; }
.sd-search { display: flex; gap: 6px; }
.sd-search input {
  width: 200px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); font-size: 14px; outline: none;
}
.sd-search input::placeholder { color: var(--text3); }
.sd-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(70,84,224,.2); }
.sd-btn {
  padding: 9px 14px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent);
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.sd-btn:focus-visible, .sd-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sd-btn.ghost { background: var(--card); color: var(--text2); border: 1px solid var(--border); }

/* ---------- Stock header ---------- */
.sd-hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 22px 24px; color: #fff;
  box-shadow: var(--shadow);
  background: linear-gradient(125deg, #2b36b8 0%, #5a3fd6 48%, #0f8f96 115%);
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center;
  transition: opacity .15s;
}
.sd-hero::after {
  content: ""; position: absolute; right: -80px; top: -120px; width: 340px; height: 340px;
  border-radius: 50%; background: rgba(255,255,255,.08); pointer-events: none;
}
.sd-hero.loading { opacity: .6; }
/* While a stock is loading from another page: just the message */
.sd-hero.empty ~ .sd-tabs, .sd-hero.empty ~ .sd-panel { display: none; }
.sd-hero.empty .sd-logo, .sd-hero.empty .sd-hrow, .sd-hero.empty .sd-hmeta { display: none; }
.sd-hero.empty .sd-hname { font-size: 20px; font-weight: 700; opacity: 1; padding: 10px 0; }
.sd-logo {
  min-width: 56px; height: 56px; padding: 0 8px; border-radius: 16px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; letter-spacing: .02em;
}
.sd-hmain { flex: 1; min-width: 240px; position: relative; z-index: 1; }
.sd-hname { font-size: 15px; font-weight: 600; opacity: .9; }
.sd-hrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0; }
.sd-hprice { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sd-badge { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: rgba(255,255,255,.94); font-variant-numeric: tabular-nums; }
.sd-badge.up { color: #0f7b46; }
.sd-badge.dn { color: #c62828; }
.sd-hmeta { font-size: 12.5px; opacity: .8; }
.sd-range { width: 230px; font-size: 11.5px; position: relative; z-index: 1; }
.sd-range .cap { opacity: .8; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.sd-range .bar { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 10px 0 8px; }
.sd-range .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: rgba(255,255,255,.75); }
.sd-range .dot { position: absolute; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transform: translateX(-50%); }
.sd-range .lab { display: flex; justify-content: space-between; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Watch / watching button in the stock header */
.sd-watch {
  padding: 4px 11px; border-radius: 999px; border: 1px solid rgba(255,255,255,.55); background: rgba(255,255,255,.12);
  color: #fff; font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.sd-watch[aria-pressed="true"] { background: rgba(255,255,255,.94); color: #2b36b8; border-color: transparent; }
.sd-watch:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sd-watch:disabled { opacity: .6; cursor: progress; }

/* Ticker picker under the stock header's list button */
.sd-jump { width: min(320px, calc(100vw - 16px)); }
.sd-jump .rows { max-height: min(340px, 55vh); overflow-y: auto; }
.sd-jump .row {
  display: grid; grid-template-columns: 70px 1fr auto; align-items: baseline; gap: 8px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: var(--text);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.sd-jump .row b { font-weight: 800; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-jump .row .nm { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-jump .row .yl { font-size: 12px; font-weight: 700; color: var(--text2); font-variant-numeric: tabular-nums; }
.sd-jump .row:hover, .sd-jump .row:focus-visible { background: var(--muted); outline: none; }
.sd-jump .row.here { background: var(--accent-soft); }
.sd-jump .row.here b::after { content: " •"; }
.sd-jump .none { padding: 6px 8px; font-size: 13px; }
.sd-jump .others { margin-top: 6px; padding: 8px 4px 2px; border-top: 1px solid var(--muted); }
.sd-jump .others h4 { padding: 0 4px 6px; }
.sd-jump .chip {
  margin: 0 4px 6px 0; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: none; color: var(--text2); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.sd-jump .chip:hover { border-color: var(--accent); color: var(--accent); }
.sd-jump .chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Watchlist (home view) ---------- */
.sd-watchcard { margin-top: 12px; }
#viewHome > .sd-watchcard:first-child { margin-top: 0; }
.sd-watchcard[hidden] { display: none; }
.sd-asof { font-size: 12px; color: var(--text3); margin-right: auto; }
.sd-input {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  color: var(--text); font-size: 14px; font-family: inherit; outline: none; width: 140px; min-width: 0;
}
.sd-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(70,84,224,.2); }
.sd-input::placeholder { color: var(--text3); }
.sd-input.grow { flex: 1 1 180px; }
.sd-input.small { width: 92px; padding: 5px 8px; font-size: 13px; text-align: right; }
.sd-input.note { width: 100%; min-width: 140px; padding: 5px 8px; font-size: 13px; }
.sd-watchtbl .tk { text-transform: uppercase; }
.sd-watchform { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
#holdTotals { margin-bottom: 14px; }
#holdTotals:empty { display: none; }
#holdCostNote { margin: -6px 0 12px; }
#holdCostNote:empty { display: none; }
#holdCost { width: 190px; }
#holdIncome { margin-top: 6px; }
.sd-watchtbl { border-top: 1px solid var(--muted); }
.sd-watchtbl th { font-size: 12px !important; font-weight: 700 !important; color: var(--text3); padding: 10px 8px !important; }
.sd-watchtbl td { padding: 10px 8px; vertical-align: top; }
.sd-watchtbl td:first-child { color: var(--text); }
.sd-watchtbl .tk { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--accent); cursor: pointer; }
.sd-watchtbl .tk:hover { text-decoration: underline; }
.sd-watchtbl .nm { display: block; font-size: 12px; color: var(--text2); max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.sd-watchtbl .sub { display: block; font-size: 12px; color: var(--text2); font-weight: 400; }
.sd-watchtbl .sub.hit { color: var(--pos); font-weight: 700; }
.sd-watchtbl tr.flag td { background: var(--posbg); }
.sd-watchtbl td.note { text-align: left; white-space: normal; min-width: 110px; max-width: 220px; color: var(--text2); font-size: 13px; }
.sd-watchtbl .act { display: block; margin: 4px 0 0 -4px; }
.sd-also { display: inline-block; margin: 0 0 3px 4px; padding: 1px 8px; border-radius: 999px; background: var(--muted); color: var(--text2); font-size: 11.5px; font-weight: 650; }
.sd-watchtbl td.also { white-space: normal; min-width: 90px; }
/* Column headings that sort */
.sd-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.sd-sort::after { content: " ↕"; opacity: .4; }
.sd-sort:hover { color: var(--text); }
.sd-sort.asc, .sd-sort.desc { color: var(--accent); }
.sd-sort.asc::after { content: " ↑"; opacity: 1; }
.sd-sort.desc::after { content: " ↓"; opacity: 1; }
.sd-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* List chips and the bar under them */
.sd-lists { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.sd-listchip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.sd-listchip b { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--muted); color: var(--text2); line-height: 17px; }
.sd-listchip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sd-listchip.on b { background: rgba(255,255,255,.25); color: inherit; }
.sd-listchip.new { border-style: dashed; color: var(--accent); }
.sd-listchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sd-lists .full { font-size: 12px; color: var(--text3); margin-left: 4px; }
.sd-listbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; min-height: 34px; }
.sd-listbar:empty { display: none; }
.sd-listbar strong { font-size: 18px; letter-spacing: -.01em; margin-right: 2px; }
.sd-listbar .ask { font-size: 13px; color: var(--text2); }
.sd-listbar .sd-input { width: 220px; }
.sd-btn.small { padding: 7px 12px; }
.sd-btn.danger { background: var(--neg); color: #fff; }
/* "In 2 lists" menu on the stock header */
.sd-menu { width: min(260px, calc(100vw - 16px)); padding: 8px; }
.sd-menu h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); padding: 4px 8px 6px; }
.sd-menu label { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.sd-menu label:hover { background: var(--muted); }
.sd-menu input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.sd-menu form { display: flex; gap: 6px; margin-top: 6px; padding: 8px 4px 2px; border-top: 1px solid var(--muted); }
.sd-menu form .sd-input { flex: 1; width: auto; min-width: 0; padding: 6px 9px; font-size: 13px; }
.sd-menu .err { padding: 6px 8px 0; color: var(--neg); font-size: 12px; font-weight: 600; }
.sd-menu .err:empty { display: none; }
.sd-link { border: 0; background: none; padding: 2px 4px; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; }
.sd-link.danger { color: var(--neg); }

/* Suggestions under a ticker box while typing a company name */
.sd-suggest { width: auto; padding: 6px; }
.sd-suggest .opt { display: grid; grid-template-columns: 62px 1fr auto; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.sd-suggest .opt b { font-weight: 800; color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.sd-suggest .opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-suggest .opt em { font-style: normal; font-size: 11.5px; color: var(--text3); white-space: nowrap; }
.sd-suggest .opt.on, .sd-suggest .opt:hover { background: var(--muted); }
.sd-suggest .msg { padding: 8px 10px; color: var(--text2); }

/* ---------- Sign in and account ---------- */
.sd-auth { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 6vh 0 24px; }
.sd-auth[hidden] { display: none; }
.sd-auth .sd-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; }
.sd-auth h2 { font-size: 22px; letter-spacing: -.02em; }
.sd-auth .sd-desc { margin: 0; }
.sd-auth .sd-desc:empty, .sd-auth .sd-note:empty { display: none; }
.sd-auth .sd-note { margin: 0; }
.sd-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text2); }
.sd-field[hidden] { display: none; }
.sd-field .sd-input { width: 100%; padding: 10px 12px; font-size: 15px; }
#passwordForm, #emailForm { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
#passwordForm h3, #emailForm h3 { margin: 0; }
#passwordForm .sd-field, #emailForm .sd-field { width: 100%; }
#passwordForm .sd-note, #emailForm .sd-note { margin: 0; }
.sd-formerr, .sd-formok { font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 8px; }
.sd-formerr { color: var(--neg); background: var(--negbg); }
.sd-formok { color: var(--pos); background: var(--posbg); }
.sd-formerr:empty, .sd-formok:empty { display: none; }
#usersDone { margin-bottom: 12px; overflow-wrap: anywhere; }
#usersDone code { font-size: 14px; padding: 1px 6px; border-radius: 6px; background: var(--card); user-select: all; }
#usersTable td { vertical-align: middle; }
#usersTable td:first-child { white-space: normal; min-width: 160px; }
#usersTable .em { display: block; font-size: 12px; color: var(--text2); overflow-wrap: anywhere; }
#usersTable .acts { text-align: left; white-space: normal; min-width: 210px; }
#usersTable .acts .sd-input { width: 170px; padding: 5px 8px; font-size: 13px; }
#usersTable .acts .sd-input[data-newemail] { width: 220px; max-width: 100%; }
#usersTable tr.off td { color: var(--text3); }
.sd-menu .who { padding: 4px 8px 8px; font-size: 12px; color: var(--text2); overflow-wrap: anywhere; border-bottom: 1px solid var(--muted); margin-bottom: 4px; }
.sd-menu .item { display: block; width: 100%; text-align: left; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; }
.sd-menu .item:hover { background: var(--muted); }

/* ---------- Error message ---------- */
.sd-error { margin: 0 2px; font-size: 13px; font-weight: 600; color: var(--neg); }
.sd-error:not(:empty) { padding: 9px 12px; margin-bottom: 12px; border-radius: 10px; background: var(--negbg); }

/* ---------- Price chart ---------- */
.sd-chart { margin-top: 12px; transition: opacity .15s; }
.sd-chart.loading { opacity: .6; }
.sd-chead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.sd-chead h3 { margin: 0; }
.sd-pchg { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: auto; }
.sd-seg { display: flex; gap: 2px; background: var(--muted); padding: 3px; border-radius: 9px; max-width: 100%; overflow-x: auto; }
.sd-seg button {
  padding: 4px 10px; font-size: 12px; font-weight: 600; border: 0; border-radius: 7px; background: none;
  color: var(--text2); cursor: pointer; white-space: nowrap; font-family: inherit;
}
.sd-seg button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
/* legend and on/off switches for the chart's overlays */
.sd-chartopts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; font-size: 12.5px; color: var(--text2); }
.sd-chartopts:empty { display: none; }
.sd-leg, .sd-tog { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; font-weight: 600; }
.sd-tog { border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.sd-tog[aria-pressed="false"] { background: none; color: var(--text3); }
.sd-tog[aria-pressed="false"] .sw { opacity: .35; }
.sd-tog:disabled { cursor: not-allowed; opacity: .55; }
.sd-tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sd-chartopts .sw { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--line-1); }
.sd-chartopts .sw.s2 { border-top-color: var(--line-2); }
.sd-chartopts .sw.s3 { border-top: 2px dashed var(--line-3); }
.sd-chartopts .sw.vol { width: 10px; height: 10px; border: 0; border-radius: 2px; background: var(--text3); opacity: .6; }
.sd-chartopts .push { margin-left: auto; display: inline-flex; align-items: center; }
.sd-readout { min-height: 20px; font-size: 12.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; text-align: center; }
.sd-readout span { color: var(--text2); font-weight: 500; }
#chartTrend:empty { display: none; }
.sd-chartbody { position: relative; }
.sd-chartbody svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.sd-chartbody .axis text { font-size: 11px; fill: var(--text3); }
.sd-chartbody .grid line { stroke: var(--border); stroke-width: 1; }
.sd-chartmsg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text2); text-align: center; padding: 0 16px;
}
.sd-chartmsg[hidden] { display: none; }
.sd-tip {
  position: absolute; pointer-events: none; padding: 6px 9px; border-radius: 8px; background: var(--text);
  color: var(--card); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  white-space: nowrap; transform: translate(-50%, -135%); display: none; z-index: 5;
}

/* ---------- Bar charts (annual figures) ---------- */
.sd-bars { position: relative; min-height: 150px; margin-bottom: 8px; }
.sd-bars svg { display: block; width: 100%; overflow: visible; }
.sd-bars .axis text { font-size: 11px; fill: var(--text3); }
/* value axis: round amounts down the left, a gridline at each, and the two axis lines */
.sd-bars .yaxis text { font-size: 10px; fill: var(--text3); font-variant-numeric: tabular-nums; }
.sd-bars .yaxis .grid { stroke: var(--border); stroke-width: 1; }
.sd-bars .yaxis .edge { stroke: var(--text3); stroke-width: 1; }
/* two-row axis: the quarter under each bar, the fiscal year under each group of quarters */
.sd-bars .axis text.q { font-size: 10px; }
.sd-bars .axis text.q.tight { font-size: 9px; }
.sd-bars .axis text.grp { font-weight: 700; fill: var(--text2); }
.sd-bars .axis line { stroke: var(--border); stroke-width: 1; }
.sd-bars .val { font-size: 12px; font-weight: 700; fill: var(--text); }
.sd-bars .val.est { font-weight: 600; fill: var(--text2); }
/* analyst estimates: same colour as reported bars, drawn as a dashed outline */
.sd-bars .est-bar { fill: var(--accent); fill-opacity: .12; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.sd-bars .est-bar.neg { fill: var(--neg); stroke: var(--neg); }
.sd-bars .val.neg, .sd-bars .yaxis text.neg { fill: var(--neg); }
.sd-bars .sd-tip { white-space: pre-line; text-align: left; max-width: min(260px, 92%); width: max-content; }
/* Quarterly / Yearly switch and the key, above the Financials charts */
.sd-finbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.sd-finkey { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; color: var(--text2); }
.sd-finkey span { display: inline-flex; align-items: center; gap: 6px; }
.sd-finkey i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sd-finkey i.act { background: var(--accent); }
.sd-finkey i.two { background: var(--line-2); }
.sd-finkey i.ln { height: 3px; width: 16px; border-radius: 2px; }
.sd-finkey i.l1 { background: var(--line-1); } .sd-finkey i.l2 { background: var(--line-2); } .sd-finkey i.l3 { background: var(--line-3); }
.sd-bars .guide { stroke: var(--text3); stroke-width: 1; }
.sd-bars .ref { stroke: var(--text2); stroke-width: 1.5; }
.sd-bars circle.capped { stroke: var(--card); stroke-width: 1.5; }
/* the Charts tab: wider cards than the other tabs, so sixteen bars have room */
.sd-grid.sd-charts { grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); }
.sd-charts .sd-bars { min-height: 170px; }
.sd-charts .sd-barsmsg { height: 170px; }
.sd-charts .sd-card .sd-note { margin: 0; }
.sd-charts .sd-card .sd-finkey { margin-bottom: 6px; }
.sd-finkey i.est { background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1.5px dashed var(--accent); }
.sd-finbar .sd-note { margin: 0; flex: 1 1 260px; }
.sd-sub { font-size: 12px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; margin: 18px 0 8px; }
.sd-paylist { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 16px; }
.sd-paylist div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--muted); font-variant-numeric: tabular-nums; }
.sd-paylist span:first-child { color: var(--text2); }
.sd-paylist span:last-child { font-weight: 650; }
/* Earnings reports */
.sd-chipx { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.sd-chipx.beat { background: var(--posbg); color: var(--pos); }
.sd-chipx.miss { background: var(--negbg); color: var(--neg); }
.sd-chipx.flat { background: var(--muted); color: var(--text2); }
.sd-yh > div { min-width: 0; }                 /* let grid columns shrink instead of overflowing */
.sd-scrollx { overflow-x: auto; }
.sd-qtbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.sd-qtbl th, .sd-qtbl td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-qtbl th { font-size: 12px; font-weight: 700; color: var(--text3); }
.sd-qtbl th:first-child, .sd-qtbl td:first-child { text-align: left; padding-left: 0; color: var(--text2); }
.sd-qtbl tr:last-child td { border-bottom: 0; }
.sd-watchtbl .soon { display: block; font-size: 12px; font-weight: 700; color: var(--warn); }

/* Yield compared with its own history */
.sd-yh { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(280px, 1.5fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .sd-yh { grid-template-columns: 1fr; } }
.sd-yh .sd-target { margin: 34px 0 34px; }
.sd-line { position: relative; }
.sd-line svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.sd-line .axis text { font-size: 11px; fill: var(--text3); }
.sd-line .grid line { stroke: var(--border); stroke-width: 1; }
.sd-bars.tall { min-height: 190px; }
.sd-bars.tall .sd-barsmsg { height: 190px; }
.sd-barsmsg { height: 150px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--text3); padding: 0 8px; }

/* ---------- Tabs ---------- */
.sd-tabs {
  display: flex; gap: 4px; margin: 14px 0 16px; padding: 4px; background: var(--muted);
  border-radius: 14px; overflow-x: auto; width: fit-content; max-width: 100%;
}
.sd-tab {
  padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--text2); background: none;
  border: 0; border-radius: 10px; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.sd-tab.active { color: var(--text); background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.sd-panel { display: none; }
.sd-panel.active { display: block; }

/* ---------- Cards ---------- */
.sd-full { grid-column: 1 / -1; }
.sd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.sd-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.sd-card h3 { font-size: 12px; font-weight: 700; color: var(--text3); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .07em; }
.sd-kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--muted); }
.sd-kv:last-child { border-bottom: 0; }
.sd-kv span:first-child { color: var(--text2); }
.sd-kv span:last-child { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.sd-kv span.sd-kvsub { font-weight: 400; font-size: 12px; color: var(--text2); }
.sd-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sd-chip { padding: 4px 10px; border-radius: 999px; background: var(--muted); font-size: 12px; font-weight: 600; color: var(--text2); }
.sd-desc { font-size: 13.5px; color: var(--text2); margin-bottom: 10px; }
.sd-note { font-size: 12px; color: var(--text3); margin-top: 10px; }
.sd-note.inline { margin: 0; }
.sd-empty { font-size: 14px; color: var(--text2); }

/* Scorecard */
.sd-score { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--muted); }
.sd-score:last-of-type { border-bottom: 0; }
.sd-score .n { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.sd-score .t { flex: 1; font-size: 14px; font-weight: 650; }
.sd-score .s { font-size: 12px; color: var(--text2); font-weight: 400; }
.sd-score .pips { display: flex; gap: 3px; }
.sd-score .pips i { width: 16px; height: 6px; border-radius: 3px; background: var(--muted); }
.sd-score.good .n { background: var(--posbg); color: var(--pos); }
.sd-score.mid .n { background: var(--warnbg); color: var(--warn); }
.sd-score.bad .n { background: var(--negbg); color: var(--neg); }
.sd-score.good .pips i.f { background: var(--pos); }
.sd-score.mid .pips i.f { background: var(--warn); }
.sd-score.bad .pips i.f { background: var(--neg); }

/* Headline number and stat tiles */
.sd-big { font-size: 38px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sd-big small { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--text2); margin-top: 4px; }
.sd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.sd-tile { background: var(--muted); border-radius: 12px; padding: 11px 13px; transition: transform .15s; }
.sd-tile:hover { transform: translateY(-2px); }
.sd-tile .l { font-size: 11.5px; color: var(--text2); font-weight: 600; }
/* "i" button and its explanation popover */
.sd-info {
  text-transform: none; letter-spacing: 0;      /* stays a lowercase "i" inside uppercase headings */
  position: relative; width: 16px; height: 16px; margin-left: 6px; padding: 0; vertical-align: -2px;
  border: 1px solid var(--text3); border-radius: 50%; background: none; color: var(--text2);
  font: italic 700 10px/1 Georgia, "Times New Roman", serif; cursor: pointer;
}
.sd-info::after { content: ""; position: absolute; inset: -7px; }      /* larger click and tap area */
.sd-info:hover, .sd-info[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sd-info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sd-pop {
  position: absolute; z-index: 50; width: min(300px, calc(100vw - 16px)); padding: 12px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.5; color: var(--text2);
}
.sd-pop[hidden] { display: none; }
.sd-pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; font-size: 14px; color: var(--text); }
.sd-pop-close { border: 0; background: none; color: var(--text2); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; font-family: inherit; }
.sd-pop p + p { margin-top: 8px; }
.sd-pop .guide { color: var(--text); }
.sd-tile .v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; text-transform: capitalize; }

/* Analyst target bar */
.sd-target { position: relative; height: 8px; border-radius: 4px; margin: 30px 0 30px; background: linear-gradient(90deg, var(--muted), var(--accent)); opacity: .9; }
.sd-target .mk { position: absolute; top: -5px; width: 3px; height: 18px; border-radius: 2px; background: var(--text); transform: translateX(-50%); }
.sd-target .lb { position: absolute; font-size: 11.5px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.sd-target .lb.now { top: -24px; transform: translateX(-50%); color: var(--text); }
.sd-target .lb.lo { top: 14px; left: 0; }
.sd-target .lb.hi { top: 14px; right: 0; }

/* ---------- Compare ---------- */
.sd-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 12px; }
.sd-title h2 { font-size: 24px; letter-spacing: -.02em; }
.sd-title span { color: var(--text2); font-size: 14px; }
.sd-cmpmsg { margin: 0 0 10px; }
.sd-cmpmsg:empty { display: none; }
.sd-tblwrap thead th a { color: var(--accent); text-decoration: none; }
.sd-tblwrap thead th a:hover { text-decoration: underline; }
.sd-cmpload { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; font-weight: 600; color: var(--text2); }
.sd-cmpload[hidden] { display: none; }
.sd-cmpload select { width: auto; max-width: 220px; padding: 8px 9px; }
@media (max-width: 640px) { .sd-cmpload { margin-left: 0; } }
.sd-cmpbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sd-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; margin-right: 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700; }
.sd-pill button { border: 0; background: var(--muted); color: var(--text2); cursor: pointer; width: 20px; height: 20px; border-radius: 50%; font-size: 14px; line-height: 1; font-family: inherit; }
.sd-tblwrap { overflow-x: auto; padding: 0; }
.sd-tblwrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sd-tblwrap th, .sd-tblwrap td { padding: 10px 16px; text-align: right; border-bottom: 1px solid var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-tblwrap th:first-child, .sd-tblwrap td:first-child { text-align: left; color: var(--text2); }
.sd-tblwrap thead th { font-size: 15px; font-weight: 800; padding: 14px 16px; }
.sd-tblwrap tbody tr:last-child td { border-bottom: 0; }
.sd-tblwrap td.empty { text-align: left; padding: 28px 16px; color: var(--text2); white-space: normal; }
.sd-tblwrap td.cap { text-transform: capitalize; }
.sd-tblwrap tr.grp td { background: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); padding: 7px 16px; }
.sd-tblwrap td.best { background: var(--best); font-weight: 800; }
.sd-tblwrap td.best::after { content: " ★"; font-size: 11px; color: var(--accent); }
.sd-tblwrap td.na { color: var(--text3); }

/* ---------- Buttons: one set of states for every kind ----------
   Hover: the edge turns the accent colour and thickens (an inset shadow, so nothing changes size),
   the text darkens and is drawn a touch heavier (a thin text stroke: real bold would widen the
   button and nudge its neighbours), and the background takes a light tint. Pressed: a 1px dip.
   Keyboard focus: a clear ring. Hover only applies on devices with a mouse, so a tap on a phone
   doesn't leave a button looking hovered. */
.sd-btn, .sd-btn.ghost, .sd-seg button, .sd-tab, .sd-nav a, .sd-listchip, .sd-link, .sd-tog, .sd-watch,
.sd-pill button, .sd-pop-close {
  transition: background-color .12s, border-color .12s, box-shadow .12s, color .12s, filter .12s;
}
@media (hover: hover) {
  /* filled buttons: a little deeper, with a halo */
  .sd-btn:not(.ghost):not(:disabled):hover { filter: brightness(.93); box-shadow: 0 0 0 3px var(--accent-soft); }
  :root[data-theme="dark"] .sd-btn:not(.ghost):not(:disabled):hover { filter: brightness(1.1); }
  .sd-btn.danger:not(:disabled):hover { box-shadow: 0 0 0 3px var(--neg-soft); }

  /* outlined and plain buttons: accent edge, accent text, light tint */
  .sd-btn.ghost:not(:disabled):hover, .sd-listchip:not(.on):hover, .sd-tog:not(:disabled):hover {
    border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
    color: var(--accent-strong); background: var(--accent-soft); -webkit-text-stroke: .35px currentColor;
  }
  .sd-listchip.on:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
  .sd-seg button:not(.active):hover, .sd-tab:not(.active):hover, .sd-nav a:not([aria-current="page"]):hover {
    box-shadow: inset 0 0 0 1.5px var(--accent);
    color: var(--accent-strong); background: var(--accent-soft); -webkit-text-stroke: .35px currentColor;
  }
  .sd-link:hover { background: var(--accent-soft); color: var(--accent-strong); text-decoration: underline;
    text-underline-offset: 3px; -webkit-text-stroke: .3px currentColor; }
  .sd-link.danger:hover { background: var(--neg-soft); color: var(--neg); }
  .sd-pill button:hover, .sd-pop-close:hover { background: var(--accent-soft); color: var(--accent-strong); }
  /* on the coloured stock header */
  .sd-watch:not([aria-pressed="true"]):hover { background: rgba(255,255,255,.26); border-color: #fff;
    box-shadow: inset 0 0 0 1px #fff; -webkit-text-stroke: .35px currentColor; }
  .sd-watch[aria-pressed="true"]:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
}
.sd-link { border-radius: 6px; }
.sd-btn:not(:disabled):active, .sd-seg button:active, .sd-tab:active, .sd-listchip:active, .sd-link:active,
.sd-tog:not(:disabled):active, .sd-watch:active { transform: translateY(1px); }
.sd-btn:disabled { opacity: .55; cursor: not-allowed; }
.sd-seg button:focus-visible, .sd-link:focus-visible, .sd-pill button:focus-visible, .sd-pop-close:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Demo: the offer on the sign-in screen, and the banner while a demo runs ---------- */
.sd-democard h3 { margin: 0; }
.sd-democard #demoWidget:empty { display: none; }
.sd-democard .sd-btn { align-self: flex-start; }
.sd-demobar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 14px; padding: 10px 14px;
  border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: 13px;
}
.sd-demobar[hidden] { display: none; }
.sd-demobar strong { color: var(--accent-strong); }
.sd-demobar .tks { display: flex; flex-wrap: wrap; gap: 4px; }
.sd-demobar .tk { display: inline-flex; align-items: center; border-radius: 999px; background: var(--card);
  border: 1px solid var(--border); overflow: hidden; }
.sd-demobar .tk a { padding: 2px 4px 2px 9px; color: var(--text); font-weight: 700; font-size: 12px; text-decoration: none; }
.sd-demobar .tk button { border: 0; background: none; color: var(--text3); font: inherit; font-size: 15px; line-height: 1;
  padding: 1px 8px 3px 4px; cursor: pointer; }
@media (hover: hover) {
  .sd-demobar .tk:hover { border-color: var(--accent); }
  .sd-demobar .tk a:hover { color: var(--accent-strong); text-decoration: underline; }
  .sd-demobar .tk button:hover { color: var(--neg); background: var(--neg-soft); }
}
.sd-demobar .tk button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sd-demobar .tks:empty { display: none; }
.sd-demobar .ends { color: var(--text2); }
.sd-demobar .sd-btn { margin-left: auto; }
