@import url("/css/glossary.css");
@import url("/css/brand.css");

/* Styles for the main page (index.html), also used by the practice and model training pages.
   Tokens live in tokens.css; the header in brand.css. */
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.locked { overflow: hidden; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; font-weight: 500;
  transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
a.btn { text-decoration: none; color: inherit; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.primary:hover { opacity: .88; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.quiet:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 34px; padding: 0; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }
.link:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
a.link { text-decoration: none; }
.ast { color: var(--accent); font-weight: 600; text-decoration: none; padding: 0 1px; }
.ast:hover { color: var(--accent-2); }

/* ---------- Account ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600;
  color: #d6a54a; background: #1d2433; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.menu { position: absolute; right: 0; top: 44px; width: 260px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; transform-origin: top right; animation: pop .16s var(--ease); }
.menu .me { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .me .email { font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.menu .me .badges { display: flex; gap: 6px; margin-top: 8px; }
.menu button.item { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.menu button.item:hover { background: var(--surface-2); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); }
.badge.premium { background: color-mix(in srgb, var(--conviction) 15%, transparent); color: color-mix(in srgb, var(--conviction) 80%, var(--text)); }
.badge.admin { background: var(--accent-soft); color: var(--accent); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 36px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2);
  padding: 4px 12px 4px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--strong) 20%, transparent); }
.hero h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.08; letter-spacing: -.035em; font-weight: 700; margin: 18px 0 14px; max-width: 760px; }
.hero h1 span { color: var(--text-3); }
.hero p { font-size: 17px; color: var(--text-2); margin: 0; max-width: 620px; line-height: 1.6; }
.figures { display: flex; flex-wrap: wrap; gap: 10px 36px; margin-top: 30px; }
.figure b { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.figure span { font-size: 13px; color: var(--text-2); }

/* ---------- Section heads ---------- */
.section { margin-top: 12px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font-size: 18px; font-weight: 650; letter-spacing: -.015em; margin: 0; }
.sec-head .aside { font-size: 13px; color: var(--text-2); }

/* ---------- Score ring ---------- */
.ring { --size: 44px; --w: 4px; --c: var(--mild); position: relative; width: var(--size); height: var(--size); flex: none;
  display: grid; place-items: center; }
.ring i { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--w) - .5px), #000 calc(100% - var(--w)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--w) - .5px), #000 calc(100% - var(--w))); }
.ring b { position: relative; font-size: calc(var(--size) * .34); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring.strong { --c: var(--strong); } .ring.notable { --c: var(--notable); }
.tier { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tier::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tier.strong { color: var(--strong); } .tier.notable { color: var(--notable); } .tier.mild { color: var(--text-3); }

/* ---------- Top picks ---------- */
.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 48px; }
.pick { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; min-height: 220px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.pick:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.pick .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pick .tk { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.pick .co { font-size: 13.5px; color: var(--text-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.pick .story { font-size: 15px; line-height: 1.5; margin: 0; flex: 1; }
.pick .foot { display: flex; gap: 8px; flex-wrap: wrap; }
.pick .rank-no { position: absolute; top: -10px; left: 18px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--text); color: var(--bg); padding: 2px 9px; border-radius: 999px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip i { width: 6px; height: 6px; border-radius: 50%; flex: none; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.search { position: relative; flex: 1 1 240px; }
.search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  padding: 0 40px 0 38px; font-size: 14.5px; transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input::placeholder { color: var(--text-3); }
.search .glass { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 500 11.5px var(--font); color: var(--text-3);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); }
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  padding: 0 32px 0 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-sm); cursor: pointer; }
.select::after { content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--text-2);
  border-bottom: 1.5px solid var(--text-2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.seg { display: inline-flex; height: 38px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 0 12px; border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--text-2); transition: color .15s, background .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.subbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 14px 2px 10px; font-size: 13px; color: var(--text-2); }
#legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 30px; height: 18px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(12px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- List ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.row { display: grid; grid-template-columns: 24px 44px minmax(0, 1fr) minmax(0, 1.75fr) 96px 88px 16px; align-items: center; gap: 16px;
  width: 100%; padding: 16px 22px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; transition: background .12s; }
.row:first-child { border-top: 0; }
.row:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.row.active { background: var(--accent-soft); }
.row .rk { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }
.row .id { min-width: 0; }
.row .tk { font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.row .co { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.row .amt, .row .when { text-align: right; font-variant-numeric: tabular-nums; }
.row .amt b { font-weight: 600; font-size: 15px; display: block; }
.row .when b { font-weight: 500; font-size: 14px; display: block; }
.row small { font-size: 12.5px; color: var(--text-3); }
.row .go { color: var(--text-3); transition: transform .15s, color .15s; }
.row:hover .go { color: var(--text); transform: translateX(2px); }
.flag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); letter-spacing: 0; }
.empty { padding: 64px 24px; text-align: center; }
.empty b { display: block; font-size: 16px; margin-bottom: 4px; }
.empty p { margin: 0 0 16px; color: var(--text-2); }

/* ---------- Loading ---------- */
.sk { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-card { padding: 28px; text-align: center; border-bottom: 1px solid var(--line); }
.loading-card b { display: block; font-size: 15px; font-weight: 600; }
.loading-card p { margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); }
.progress { width: 280px; max-width: 80%; height: 4px; margin: 16px auto 0; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s var(--ease); }
.error { padding: 56px 24px; text-align: center; }
.error b { display: block; font-size: 16px; margin-bottom: 4px; }
.error p { color: var(--text-2); margin: 0 0 16px; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10,10,12,.32); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); background: var(--surface);
  box-shadow: var(--shadow-lg); transform: translateX(104%); transition: transform .32s var(--ease); display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.d-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px 14px 26px; border-bottom: 1px solid var(--line); }
.d-head .crumb { font-size: 13px; color: var(--text-2); }
.d-head .spacer { flex: 1; }
.d-body { overflow-y: auto; padding: 26px 26px 48px; overscroll-behavior: contain; }
.d-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.d-title h2 { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 0; }
.d-title .co { color: var(--text-2); margin-top: 4px; }
.d-title .ring { --size: 68px; --w: 5px; }
.d-story { font-size: 17px; line-height: 1.55; margin: 20px 0 0; letter-spacing: -.005em; }
.d-story b { font-weight: 650; }
.d-sec { margin-top: 34px; }
.d-sec h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 0 0 14px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.d-sec h3 .link { font-size: 13px; text-transform: none; letter-spacing: 0; }
.factor { padding: 14px 0; border-top: 1px solid var(--line); }
.factor:first-of-type { border-top: 0; padding-top: 0; }
.factor .fh { display: flex; align-items: center; gap: 10px; }
.factor .name { font-weight: 600; font-size: 14.5px; }
.factor .qs { background: none; border: 0; padding: 0; color: var(--text-3); display: inline-grid; place-items: center; }
.factor .qs:hover { color: var(--accent); }
.factor .pts { margin-left: auto; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.factor .pts b { color: var(--text); font-size: 15px; font-weight: 650; }
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); margin: 10px 0 8px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 6px; transform-origin: left; animation: grow .7s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.factor p { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.callout { margin-top: 20px; display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--warn-line);
  font-size: 13.5px; line-height: 1.5; }
.people { display: grid; gap: 2px; }
.person { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.person:first-child { border-top: 0; }
.initials { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); }
.person .nm { font-weight: 550; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .rl { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .val { text-align: right; font-variant-numeric: tabular-nums; }
.person .links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; }
.person .links a { color: var(--accent); text-decoration: none; font-weight: 500; }
.person .links a:hover { text-decoration: underline; text-underline-offset: 2px; }
.person .links span { color: var(--text-3); font-weight: 400; }
.person .val b { display: block; font-weight: 600; font-size: 14.5px; }
.person .val small { font-size: 12.5px; color: var(--text-2); }
.person .val small.big { color: var(--strong); font-weight: 600; }
details.more-trades { margin-top: 12px; }
details.more-trades summary { list-style: none; cursor: pointer; color: var(--accent); font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
details.more-trades summary::-webkit-details-marker { display: none; }
details.more-trades summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
details.more-trades[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.trades { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.trades th { font-size: 12px; font-weight: 500; color: var(--text-3); text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.trades td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.trades .r { text-align: right; }
.trades a { color: var(--text-3); text-decoration: none; }
.trades a:hover { color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 22px; }
.facts div { background: var(--surface); padding: 12px 14px; }
.facts b { display: block; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.facts span { font-size: 12.5px; color: var(--text-2); }

/* News */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 16px; bottom: -2px; width: 1px; background: var(--line-2); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.timeline li.major::after { background: var(--conviction); }
.timeline li.during::after { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline .tmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-bottom: 2px; }
.timeline .src { font-weight: 600; color: var(--text-2); }
.timeline .pill { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.timeline .pill.before { background: var(--surface-2); color: var(--text-2); }
.timeline a, .timeline .evt { color: var(--text); text-decoration: none; font-size: 14.5px; line-height: 1.45; }
.timeline a:hover { color: var(--accent); }
.timeline li.minor a, .timeline li.minor .evt { color: var(--text-2); }
.timeline .evt b, .timeline a b { font-weight: 600; }

/* ---------- Dialogs ---------- */
dialog { padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
dialog[open] { animation: pop .2s var(--ease); }
dialog::backdrop { background: rgba(10,10,12,.4); backdrop-filter: blur(2px); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1; flex-wrap: wrap; }
.dlg-close { margin-left: auto; }
.dlg-tabs { display: flex; gap: 2px; flex-wrap: wrap; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.dlg-tabs button { border: 0; background: none; font-size: 13px; font-weight: 500; padding: 5px 11px; border-radius: 7px; color: var(--text-2); }
.dlg-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.dlg-body { padding: 8px 28px 28px; overflow-y: auto; }
.dlg-body h2 { font-size: 24px; letter-spacing: -.02em; margin: 20px 0 6px; display: flex; align-items: center; gap: 10px; }
.dlg-body h2 i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dlg-body .lead { font-size: 16px; color: var(--text-2); margin: 0 0 16px; }
.dlg-body h4 { margin: 24px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.dlg-body p, .dlg-body li { font-size: 14.5px; line-height: 1.7; }
.dlg-body ul { padding-left: 20px; margin: 6px 0; }
.analogy { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin: 14px 0; font-size: 14.5px; line-height: 1.65; }
.analogy b:first-child { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 4px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.compare div { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55; }
.compare .hi { border-color: var(--strong); }
.compare b { display: block; margin-bottom: 3px; }
.recipe { display: flex; height: 30px; border-radius: 8px; overflow: hidden; margin: 12px 0 6px; font-size: 12px; font-weight: 600; color: var(--on-accent); gap: 2px; }
.recipe span { display: grid; place-items: center; }
.scale { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0; }
.scale td, .scale th { padding: 7px 0; border-bottom: 1px solid var(--line); text-align: left; }
.scale td:last-child, .scale th:last-child { text-align: right; }
.note { font-size: 13px; color: var(--text-2); }

#auth { width: min(400px, calc(100vw - 32px)); }
#auth .dlg-head { border: 0; padding-bottom: 0; }
#auth form { display: grid; gap: 16px; padding: 0 32px 32px; }
#auth .intro { text-align: center; margin-bottom: 4px; }
#auth h2 { font-size: 22px; letter-spacing: -.02em; margin: 0; }
#auth .intro p { margin: 6px 0 0; color: var(--text-2); font-size: 14.5px; }
#auth label { display: grid; gap: 6px; font-size: 13px; font-weight: 550; }
#auth input { height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 12px; font-size: 15px; font-weight: 400; width: 100%;
  transition: border-color .15s, box-shadow .15s; }
#auth input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
#auth .hint { font-weight: 400; font-size: 12.5px; color: var(--text-3); }
#auth .err { color: var(--danger); font-size: 13.5px; margin: 0; }
#auth .err:empty { display: none; }
#auth .btn.primary { height: 44px; font-size: 15px; font-weight: 600; }
#auth .swap { text-align: center; font-size: 14px; color: var(--text-2); }
#auth .auth-benefits { padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); }
#auth .auth-benefits ul { list-style:none; padding:0; margin:0; display:grid; gap:12px; }
#auth .auth-benefits li { display:grid; gap:3px; font-size:12px; line-height:1.5; }
#auth .auth-benefits b { font-size:12.5px; font-weight:650; }
#auth .auth-benefits span { color:var(--text-2); }
#auth .auth-practice-soon { font-size:11px; line-height:1.5; color:var(--text-2); margin:12px 0 0; }
.practice-enabled #auth .auth-practice-soon { display:none; }

/* ---------- Positions ---------- */
.sec-note { margin: -6px 0 14px; max-width: 760px; }
.chip.dim { color: var(--text-3); }
.trow { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.2fr) 110px 120px auto; align-items: center; gap: 16px;
  padding: 14px 20px; border-top: 1px solid var(--line); cursor: pointer; }
.trow:first-child { border-top: 0; }
.trow:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.trow .tk { font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; }
.trow .co { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .num { text-align: right; font-variant-numeric: tabular-nums; }
.trow .num b { display: block; font-size: 14.5px; }
.trow .num small { font-size: 12px; color: var(--text-2); }
.trow .chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.trow .acts { display: flex; gap: 6px; justify-content: flex-end; }
.act { display: inline-flex; align-items: center; justify-content: center; height: 26px; min-width: 64px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.act.hold { background: var(--surface-2); color: var(--text-2); }
.act.soon { background: var(--warn-bg); color: var(--conviction); border: 1px solid var(--warn-line); }
.act.sell { background: var(--danger); color: var(--on-accent); }
.act.closed { background: transparent; color: var(--text-3); border: 1px solid var(--line-2); }
.up { color: var(--strong); } .down { color: var(--danger); }
.panel-msg { padding: 28px 24px; text-align: center; color: var(--text-2); }
.panel-msg b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.panel-msg .btn { margin-top: 12px; }
#position { width: min(440px, calc(100vw - 32px)); }
#position .dlg-head h3 { margin: 0; font-size: 16px; }
#position form { display: grid; gap: 14px; padding: 18px 24px 24px; }
#position label { display: grid; gap: 6px; font-size: 13px; font-weight: 550; }
#position input { height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); padding: 0 12px; font-size: 15px; font-weight: 400; width: 100%; }
#position input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
#position .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#position .err { color: var(--danger); font-size: 13.5px; margin: 0; }
#position .err:empty { display: none; }
#position .btn.primary { height: 42px; font-weight: 600; }
/* Fixed columns on wide screens so every row lines up whatever its buttons are. */
@media (min-width: 961px) {
  #positions .trow { grid-template-columns: 84px minmax(0, 1.4fr) minmax(0, 1fr) 140px 150px 180px; }
}
@media (max-width: 960px) {
  .trow { grid-template-columns: 52px minmax(0, 1fr) 100px auto; }
  .trow .chips, .trow .num.alt { display: none; }
}
@media (max-width: 640px) {
  .trow { grid-template-columns: 52px minmax(0, 1fr) auto; padding: 14px 16px; gap: 12px; }
  .trow .num:not(.keep) { display: none; }
  #position .two { grid-template-columns: 1fr; }
}

footer { padding: 48px 0 56px; font-size: 13px; color: var(--text-3); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

@media (max-width: 960px) {
  .picks { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .picks .pick:nth-child(3) { display: none; }
  .row { grid-template-columns: 44px minmax(0, 1fr) 100px 16px; gap: 14px; }
  .row .rk, .row .when { display: none; }
  .row .chips { grid-column: 2 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 36px 0 28px; }
  .hero p { font-size: 16px; }
  .figures { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar .search, .toolbar .seg { grid-column: 1 / -1; }
  .toolbar .select select { width: 100%; }
  .figure b { font-size: 22px; }
  .picks { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 36px; }
  .picks .pick:nth-child(3) { display: flex; }
  .pick { min-height: 0; padding: 18px; }
  .row { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 14px 16px; gap: 12px; }
  .row .ring { --size: 40px; }
  .row .go { display: none; }
  .search kbd { display: none; }
  .toolbar .seg button { flex: 1; padding: 0 8px; }
  .d-body { padding: 22px 20px 40px; }
  .d-head { padding-left: 20px; }
  .d-title h2 { font-size: 26px; }
  .facts { grid-template-columns: 1fr 1fr; } .facts div:nth-child(3) { grid-column: 1 / -1; }
  .compare { grid-template-columns: 1fr; }
  .dlg-body { padding: 4px 20px 24px; }
  .account .btn.quiet { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Glossary terms: dotted underline; definition bubble on hover, focus or tap ---------- */
/* ---------- Stock chart (drawer) ---------- */
.d-sec h3 .ranges { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2); gap: 2px; }
.ranges button { border: 0; background: none; font: 600 12px var(--font); letter-spacing: .02em; color: var(--text-2); padding: 3px 9px; border-radius: 6px; }
.ranges button:hover { color: var(--text); }
.ranges button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chart-sum { margin: 0 0 12px; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.chart-sum b { color: var(--text); font-size: 15.5px; }
.chart { position: relative; outline-offset: 4px; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }
.c-line { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.c-area { fill: var(--accent-soft); }
.c-vol { fill: var(--text-3); opacity: .45; }
.c-buy { fill: var(--strong); }
.c-sell { fill: var(--danger); }
.c-shade { fill: var(--accent-soft); }
.c-shade-label { fill: var(--accent); font: 600 10.5px var(--font); }
.c-grid, .c-mid { stroke: var(--line); stroke-width: 1; }
.c-axis { fill: var(--text-3); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.c-pane { fill: var(--text-3); font: 600 10.5px var(--font); letter-spacing: .02em; }
.c-empty { fill: var(--text-3); font: 12px var(--font); }
.cursor line { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.cursor circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-tip { position: absolute; top: 0; min-width: 170px; padding: 9px 11px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 12.5px; line-height: 1.55; pointer-events: none; }
.chart-tip b { font-weight: 650; }
.chart-tip .faint { margin-top: 3px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 10px; border-radius: 2px; flex: none; }
.sw.line { height: 2px; background: var(--accent); }
.sw.vol { background: var(--text-3); opacity: .45; }
.sw.buy { background: var(--strong); }
.sw.sell { background: var(--danger); }
.sw.shade { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.chart-help { margin: 6px 0 0; }
.hero .starter { font-size: 14.5px; margin-top: 12px; color: var(--text-2); }
.sec-intro { margin: -6px 0 10px; }

/* ---------- About the company (drawer) ---------- */
.co-desc { text-wrap: pretty; overflow-wrap: break-word; margin: 0 0 14px; font-size: 14.5px; line-height: 1.6; }
.co-desc a { color: var(--accent); text-decoration: none; font-weight: 500; white-space: nowrap; }
.co-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; background: var(--line);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.co-facts div { background: var(--surface); padding: 11px 14px; min-width: 0; }
.co-facts dt { font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.co-facts dd { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.45; overflow-wrap: break-word; }
.co-facts dd small { display: block; font-size: 12.5px; font-weight: 400; color: var(--text-2); margin-top: 1px; }
.co-timing, .co-source { margin: 12px 0 0; }
.person .track { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
#d-selling .note { margin: 12px 0 0; }
@media (max-width: 640px) { .co-facts { grid-template-columns: minmax(0, 1fr); } }

/* Personal tools stay compact; stock rows remain single keyboard targets. */
.watchlist { margin-bottom:18px; border:1px solid var(--line-2); border-radius:12px; padding:12px 16px; }
.watchlist summary { cursor:pointer; font-weight:600; }
.watchlist .note { margin:12px 0; }
.watch-item { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:12px 0; border-top:1px solid var(--line-2); }
.watch-item small { display:block; margin-top:5px; color:var(--text-2); }
.watch-item .co { display:inline; white-space:normal; }
.row .row-summary { flex-direction:column; align-items:flex-start; gap:6px; font-size:13px; line-height:1.5; color:var(--text-2); white-space:normal; }
.new-buying { color:var(--strong); font-size:12px; }
.score-caption { display:flex; flex-direction:column; align-items:center; gap:7px; flex-shrink:0; }
.score-caption small { font-size:11px; color:var(--text-2); }
.watch-save { margin:12px 0 0; }

[data-practice-entry] { display:none; }
.stock-practice-row { display:flex; align-items:center; border-bottom:1px solid var(--line); }
.stock-practice-row > .row { flex:1; min-width:0; border-bottom:0; }
.stock-practice-row > .practice-stock-link { flex-shrink:0; margin-right:16px; }
.watch-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.btn.practice-stock-link { background:var(--accent-soft); color:var(--accent); border-color:color-mix(in srgb,var(--accent) 22%,var(--line)); border-radius:10px; min-height:38px; gap:7px; font-weight:600; white-space:nowrap; }
.btn.practice-stock-link:hover { background:color-mix(in srgb,var(--accent) 15%,var(--surface)); border-color:var(--accent); }
.btn.practice-stock-link:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
@media(max-width:700px) {
  body.practice-enabled.practice-signed-in .stock-practice-row { flex-wrap:wrap; }
  body.practice-enabled.practice-signed-in .stock-practice-row > .row { flex-basis:100%; }
  .stock-practice-row > .practice-stock-link { margin:0 16px 12px auto; }
}
body.practice-enabled.practice-signed-in [data-practice-entry] { display:inline-block; }

p:has(> [data-practice-entry]) { display:none; }
body.practice-enabled.practice-signed-in p:has(> [data-practice-entry]) { display:block; }

/* Super-admin banner (views/adminBanner.js): points to /model-training. */
.admin-banner { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 10px 10px 10px 14px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); font-size: 14px; }
.admin-banner[hidden] { display: none; }
.admin-banner .badge.admin { background: var(--accent); color: var(--on-accent); flex: none; }
.admin-banner .ab-text { flex: 1; min-width: 0; color: var(--text-2); }
.admin-banner .ab-text b { color: var(--text); }
.admin-banner .ab-go { flex: none; text-decoration: none; }
.admin-banner .ab-close { flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 18px; cursor: pointer; }
.admin-banner .ab-close:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); }
@media (max-width: 640px) {
  .admin-banner { flex-wrap: wrap; }
  .admin-banner .ab-text { flex-basis: calc(100% - 50px); order: 1; }
  .admin-banner .badge.admin { order: 0; }
  .admin-banner .ab-close { order: 0; margin-left: auto; }
  .admin-banner .ab-go { order: 2; }
}
