/* StockLeader - professional financial research, without the intimidation.
   Colour is never the only signal: every positive or negative is also carried
   by a word or a symbol, so the interface works for colour-blind users. */

:root {
  --bg: #0e1116;
  --surface: #161b23;
  --surface-2: #1d242e;
  --border: #2a323e;
  --text: #e6eaf0;
  --text-dim: #9aa6b8;
  --text-faint: #6b7789;

  --positive: #3fb950;
  --positive-dim: #1c3d24;
  --negative: #f85149;
  --negative-dim: #45211f;
  --caution: #d29922;
  --caution-dim: #3d3018;
  --info: #58a6ff;
  --info-dim: #17293f;
  --accent: #4c8dff;

  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-2: #f0f3f6;
    --border: #d8dee4;
    --text: #1c2128;
    --text-dim: #57606a;
    --text-faint: #848d97;
    --positive: #1a7f37;
    --positive-dim: #dafbe1;
    --negative: #cf222e;
    --negative-dim: #ffebe9;
    --caution: #9a6700;
    --caution-dim: #fff8c5;
    --info: #0969da;
    --info-dim: #ddf4ff;
    --accent: #0969da;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* --- Top bar ------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 9px; }

.brand .mark {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 6px;
  letter-spacing: .5px;
}

.brand .name { font-weight: 650; font-size: 16px; letter-spacing: -.2px; }

.search { display: flex; gap: 8px; flex: 1; max-width: 420px; }

.search input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 14px;
  text-transform: uppercase;
  font-family: var(--mono);
}

.search input::placeholder {
  font-family: inherit;
  text-transform: none;
  color: var(--text-faint);
}

.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 15px;
  transition: background .12s, border-color .12s;
}

button:hover { background: var(--border); }

.search button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.search button:hover { filter: brightness(1.1); }
.search button:disabled { opacity: .5; cursor: not-allowed; }

.levels { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 9px; }

.levels .level {
  border: none;
  background: transparent;
  padding: 6px 13px;
  font-size: 13px;
  color: var(--text-dim);
  border-radius: 7px;
}

.levels .level.active { background: var(--accent); color: #fff; font-weight: 600; }

/* --- Layout -------------------------------------------------------------- */

main { max-width: 1080px; margin: 0 auto; padding: 22px 20px 80px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.card h2 { font-size: 16px; margin: 0 0 14px; letter-spacing: -.2px; }
.card h3 { font-size: 14px; margin: 0 0 10px; }

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.hint { color: var(--text-dim); font-size: 13px; margin: 0 0 12px; }

/* --- Home ---------------------------------------------------------------- */

.home { padding: 40px 0; text-align: center; }
.home h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.5px; }
.lead { color: var(--text-dim); margin: 0 0 30px; }

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  text-align: left;
  margin-bottom: 30px;
}

.action {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 17px;
  background: var(--surface);
  align-items: flex-start;
}

.action strong { font-size: 14.5px; }
.action span { color: var(--text-dim); font-size: 13px; font-weight: 400; }

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--caution);
  border-radius: var(--radius);
  padding: 15px 18px;
  color: var(--text-dim);
  font-size: 13.5px;
  text-align: left;
}

.notice strong { color: var(--text); display: block; margin-bottom: 4px; }

/* --- Loading / error ----------------------------------------------------- */

.loading { text-align: center; padding: 70px 0; color: var(--text-dim); }

.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-panel {
  background: var(--surface);
  border: 1px solid var(--negative);
  border-radius: var(--radius);
  padding: 26px;
}

.error-panel h2 { margin: 0 0 10px; color: var(--negative); font-size: 17px; }
.error-panel p { white-space: pre-wrap; color: var(--text-dim); }
.secondary { margin-top: 14px; }

/* --- Headline ------------------------------------------------------------ */

.headline { display: flex; justify-content: space-between; gap: 26px; flex-wrap: wrap; }

.ticker-row { display: flex; align-items: baseline; gap: 11px; flex-wrap: wrap; }
.ticker-row h1 { margin: 0; font-size: 30px; letter-spacing: -.7px; font-family: var(--mono); }
.company { color: var(--text-dim); font-size: 14px; }

.price-row { display: flex; align-items: baseline; gap: 11px; margin-top: 7px; flex-wrap: wrap; }
.price { font-size: 24px; font-weight: 600; font-family: var(--mono); }
.change { font-size: 15px; font-weight: 600; font-family: var(--mono); }
.change.up { color: var(--positive); }
.change.down { color: var(--negative); }

.badge {
  font-size: 10.5px;
  letter-spacing: .6px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.badge.stale { background: var(--caution-dim); color: var(--caution); border-color: var(--caution); }
.badge.unavailable { background: var(--negative-dim); color: var(--negative); border-color: var(--negative); }

.asof { color: var(--text-faint); font-size: 12px; margin-top: 6px; }

.headline-right { display: flex; gap: 26px; align-items: flex-start; }

.grade { font-size: 42px; font-weight: 700; line-height: 1; letter-spacing: -2px; }
.score, .confidence { font-size: 27px; font-weight: 650; line-height: 1.3; font-family: var(--mono); }
.grade-label, .score-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; margin-top: 5px; }
.grade-block, .score-block, .confidence-block { text-align: center; }

/* --- Recommendation ------------------------------------------------------ */

.recommendation-bar {
  border-radius: var(--radius);
  padding: 13px 20px;
  margin-bottom: 16px;
  font-weight: 650;
  letter-spacing: .4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.recommendation-bar.positive { background: var(--positive-dim); color: var(--positive); border-color: var(--positive); }
.recommendation-bar.negative { background: var(--negative-dim); color: var(--negative); border-color: var(--negative); }
.recommendation-bar.caution  { background: var(--caution-dim);  color: var(--caution);  border-color: var(--caution); }

/* --- Issues -------------------------------------------------------------- */

.issues {
  background: var(--caution-dim);
  border: 1px solid var(--caution);
  border-radius: var(--radius);
  padding: 13px 18px;
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--text);
}

.issues ul { margin: 6px 0 0; padding-left: 20px; }

/* --- Summary grid -------------------------------------------------------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 11px;
  margin-bottom: 16px;
}

.summary-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
}

.summary-item .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.summary-item .value { font-size: 15px; font-weight: 650; margin-top: 3px; }

.plain { font-size: 14.5px; line-height: 1.65; margin: 0; color: var(--text); }

/* --- Why ----------------------------------------------------------------- */

details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline-block; margin: 0; }
details.card > summary::after { content: " ▾"; color: var(--text-dim); }
details.card[open] > summary::after { content: " ▴"; }
details.card > summary h2 + * { margin-top: 14px; }

.why-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 14px; }
@media (max-width: 760px) { .why-columns { grid-template-columns: 1fr; } }

h3.positive { color: var(--positive); }
h3.negative { color: var(--negative); }
h3.positive::before { content: "▲ "; }
h3.negative::before { content: "▼ "; }

.why-columns ul, #couldGoRight, #couldGoWrong { margin: 0; padding-left: 18px; }
.why-columns li, #couldGoRight li, #couldGoWrong li { margin-bottom: 9px; font-size: 13.5px; line-height: 1.55; }
.why-columns li .label { font-weight: 650; }

.conflicts { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

.conflict {
  background: var(--caution-dim);
  border-left: 3px solid var(--caution);
  border-radius: 6px;
  padding: 11px 14px;
  margin-bottom: 9px;
  font-size: 13.5px;
}

.conflict .type { font-weight: 650; text-transform: capitalize; display: block; margin-bottom: 3px; }

.not-scored {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}

.change-list { padding-left: 18px; }
.change-list li { margin-bottom: 8px; font-size: 13.5px; }
.change-list li.better::marker { content: "▲ "; color: var(--positive); }
.change-list li.worse::marker { content: "▼ "; color: var(--negative); }

/* --- Chart --------------------------------------------------------------- */

canvas { width: 100%; display: block; border-radius: 6px; }

.chart-controls { display: flex; gap: 3px; }
.chart-controls button { padding: 5px 11px; font-size: 12.5px; }
.chart-controls button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
  margin: 10px 0 4px;
}

.chart-legend span { display: flex; align-items: center; gap: 5px; }
.swatch { width: 13px; height: 3px; border-radius: 2px; display: inline-block; }

/* --- Plan ---------------------------------------------------------------- */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 11px;
  margin-bottom: 15px;
}

.plan-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
}

.plan-item.entry { border-left: 3px solid var(--info); }
.plan-item.stop { border-left: 3px solid var(--negative); }
.plan-item.target { border-left: 3px solid var(--positive); }

.plan-item .label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); }
.plan-item .value { font-size: 17px; font-weight: 650; font-family: var(--mono); margin: 3px 0; }
.plan-item .detail { font-size: 12px; color: var(--text-dim); }

.rr-banner {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.rr-banner.good { background: var(--positive-dim); border-color: var(--positive); }
.rr-banner.bad { background: var(--caution-dim); border-color: var(--caution); }

.reason { font-size: 13px; color: var(--text-dim); margin: 8px 0; }

/* --- Category breakdown -------------------------------------------------- */

.cat-row { display: flex; align-items: center; gap: 13px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: none; }
.cat-name { width: 118px; font-size: 13.5px; text-transform: capitalize; flex-shrink: 0; }
.cat-bar { flex: 1; height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 4px; }
.cat-score { width: 74px; text-align: right; font-family: var(--mono); font-size: 13.5px; font-weight: 600; flex-shrink: 0; }
.cat-weight { width: 52px; text-align: right; font-size: 11.5px; color: var(--text-faint); flex-shrink: 0; }
.cat-row.unavailable .cat-name, .cat-row.unavailable .cat-score { color: var(--text-faint); }

/* --- Horizons ------------------------------------------------------------ */

.horizon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 11px; }

.horizon {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px;
  text-align: center;
  background: var(--surface-2);
}

.horizon .h-label { font-size: 12px; color: var(--text-dim); }
.horizon .h-days { font-size: 11px; color: var(--text-faint); margin-bottom: 7px; }
.horizon .h-grade { font-size: 23px; font-weight: 700; }
.horizon .h-score { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }

/* --- Scenarios ----------------------------------------------------------- */

.scenario { border-left: 3px solid var(--border); padding: 11px 15px; margin-bottom: 11px; background: var(--surface-2); border-radius: 0 8px 8px 0; }
.scenario.bull { border-left-color: var(--positive); }
.scenario.base { border-left-color: var(--info); }
.scenario.bear { border-left-color: var(--negative); }
.scenario .s-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.scenario .s-name { font-weight: 650; font-size: 14px; }
.scenario .s-range { font-family: var(--mono); font-weight: 650; }
.scenario ul { margin: 8px 0 6px; padding-left: 18px; font-size: 13px; color: var(--text-dim); }
.scenario .s-invalid { font-size: 12.5px; color: var(--text-faint); font-style: italic; }

/* --- Tables -------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--text-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; padding: 7px 9px; border-bottom: 1px solid var(--border); }
td { padding: 8px 9px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
td.num { font-family: var(--mono); text-align: right; }
.table-wrap { overflow-x: auto; }

/* --- Patterns ------------------------------------------------------------ */

.pattern { border: 1px solid var(--border); border-radius: 8px; padding: 13px 15px; margin-bottom: 10px; background: var(--surface-2); }
.pattern .p-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pattern .p-name { font-weight: 650; }
.pattern .p-dir { font-size: 11px; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.p-dir.bullish { background: var(--positive-dim); color: var(--positive); }
.p-dir.bearish { background: var(--negative-dim); color: var(--negative); }
.p-dir.neutral { background: var(--surface); color: var(--text-dim); }
.pattern .p-plain { font-size: 13px; margin: 7px 0; }
.pattern ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-dim); }

/* --- Raw indicators ------------------------------------------------------ */

.raw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 9px; }
.raw-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; }
.raw-item .r-label { font-size: 11px; color: var(--text-dim); }
.raw-item .r-value { font-family: var(--mono); font-size: 14px; font-weight: 600; }

/* --- Sources ------------------------------------------------------------- */

.sources { font-size: 13px; }
.source-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.source-row:last-of-type { border-bottom: none; }
.source-row .s-name { font-weight: 600; }
.source-row .s-meta { color: var(--text-dim); font-size: 12px; font-family: var(--mono); }

.disclaimer { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 12.5px; line-height: 1.6; }

/* --- Explain button + modal ---------------------------------------------- */

.explain-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  width: 17px; height: 17px;
  border-radius: 50%;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  margin-left: 4px;
  vertical-align: middle;
}

.explain-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-inner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; max-width: 540px; position: relative; max-height: 80vh; overflow-y: auto; }
.modal-inner h3 { margin: 0 0 12px; font-size: 17px; }
.modal-inner p { font-size: 14px; line-height: 1.65; color: var(--text); }
.modal-inner details { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.modal-inner summary { cursor: pointer; color: var(--accent); font-size: 13.5px; }
.modal-inner details p { color: var(--text-dim); font-size: 13px; margin-top: 10px; }
.modal-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 24px; color: var(--text-dim); padding: 0 6px; line-height: 1; }

/* --- Analysis level visibility ------------------------------------------- */

body[data-level="beginner"] .level-investor,
body[data-level="beginner"] .level-professional { display: none; }
body[data-level="investor"] .level-professional { display: none; }

/* ===========================================================================
   Navigation, account, and the watchlist / portfolio / alerts / backtest views
   =========================================================================== */

.mainnav { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 9px; }

.navtab {
  border: none;
  background: transparent;
  padding: 6px 13px;
  font-size: 13px;
  color: var(--text-dim);
  border-radius: 7px;
  position: relative;
}

.navtab.active { background: var(--accent); color: #fff; font-weight: 600; }

.badge-count {
  display: inline-block;
  min-width: 16px;
  padding: 1px 5px;
  margin-left: 5px;
  border-radius: 9px;
  background: var(--negative);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

.account { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.account .who { font-size: 12.5px; color: var(--text-dim); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ghost { background: transparent; border-color: var(--border); font-size: 13px; padding: 7px 12px; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.primary:hover { filter: brightness(1.1); background: var(--accent); }
.danger { color: var(--negative); border-color: var(--border); }
.danger:hover { background: var(--negative-dim); border-color: var(--negative); }
.tiny { padding: 3px 9px; font-size: 11.5px; }
.wide { width: 100%; margin-top: 6px; }

/* --- signed-out prompts --------------------------------------------------- */

.signed-out {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 26px;
  text-align: center;
}

.signed-out h2 { margin: 0 0 8px; font-size: 18px; }
.signed-out p { color: var(--text-dim); margin: 0 0 18px; }

/* --- inline forms --------------------------------------------------------- */

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.inline-form input[type="text"],
.inline-form input[type="number"],
.inline-form input[type="date"],
.inline-form select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 11px;
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  max-width: 200px;
}

.inline-form input:focus, .inline-form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.inline-form .field { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.inline-form .field input { max-width: 90px; }
.checkline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.add-position { margin: 14px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.add-position input { max-width: 130px; }

/* --- chips ---------------------------------------------------------------- */

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 13px;
}

.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip.static { cursor: default; }
.chip-count { opacity: .65; font-size: 11.5px; margin-left: 3px; }

/* --- tables in the new views ---------------------------------------------- */

td .hint { font-size: 11.5px; margin: 2px 0 0; }
td.up, .up { color: var(--positive); }
td.down, .down { color: var(--negative); }
tr.failed td { opacity: .6; }
tr.inactive td { opacity: .55; }
.link-analyse { color: var(--accent); text-decoration: none; font-weight: 600; }
.link-analyse:hover { text-decoration: underline; }

/* --- concentration bars --------------------------------------------------- */

.conc-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.conc-name { width: 70px; font-family: var(--mono); font-size: 13px; }
.conc-pct { width: 48px; text-align: right; font-family: var(--mono); font-size: 13px; }

/* --- alert events --------------------------------------------------------- */

.alert-event {
  display: flex;
  gap: 14px;
  padding: 10px 13px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  margin-bottom: 8px;
  font-size: 13.5px;
  align-items: baseline;
}

.alert-event.read { border-left-color: var(--border); opacity: .7; }
.alert-when { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }

/* --- sign-in dialog ------------------------------------------------------- */

label.stacked { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text-dim); }

label.stacked input {
  display: block;
  width: 100%;
  margin-top: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
}

label.stacked input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.auth-error {
  background: var(--negative-dim);
  border: 1px solid var(--negative);
  color: var(--negative);
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  margin: 0 0 10px;
}

.switch { text-align: center; margin-top: 14px; }
.switch a { color: var(--accent); }

/* --- toasts --------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px 20px;
  font-size: 13.5px;
  box-shadow: 0 6px 24px rgba(0,0,0,.32);
  opacity: 0;
  transition: opacity .22s, transform .22s;
  z-index: 200;
  max-width: 88vw;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: var(--positive); }
.toast.bad { border-color: var(--negative); }

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  .topbar { gap: 12px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; }
  .account { order: 2; }
  .levels { order: 4; }
}

/* --- Ideas tab ------------------------------------------------------------ */

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin-right: 4px;
  flex-shrink: 0;
}

.rank-badge.danger { background: var(--negative); }

#ideasBody .headline h1 a { color: var(--text); text-decoration: none; }
#ideasBody .headline h1 a:hover { color: var(--accent); }
#ideasBody .two-col ul { margin: 0; padding-left: 18px; }
#ideasBody .two-col li { margin-bottom: 8px; font-size: 13.5px; line-height: 1.55; }

#ideasScreenControls .field select,
#ideasScreenControls .field input { max-width: 120px; }

/* --- Briefing ------------------------------------------------------------- */

#briefText {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  min-height: 180px;
}

#briefText:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.brief-row {
  border-left: 3px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
}

.brief-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brief-head a { font-family: var(--mono); font-weight: 700; font-size: 16px;
                color: var(--accent); text-decoration: none; }
.brief-head a:hover { text-decoration: underline; }
.brief-row ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.brief-row li { margin-bottom: 5px; }

.brief-quote {
  font-size: 12.5px;
  color: var(--text-faint);
  font-style: italic;
  margin: 8px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

h2.positive { color: var(--positive); }
h2.negative { color: var(--negative); }

/* Freshness strip on the Ideas tab.
   The scores shown there come from a background job, so how old they are is
   part of the answer rather than a footnote. */
.freshness-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}
.freshness-bar button { padding: 5px 11px; font-size: 12.5px; }
.freshness-bar .badge.fresh {
  background: var(--positive-dim); color: var(--positive); border-color: var(--positive);
}
.freshness-bar .badge.working {
  background: var(--info-dim); color: var(--info); border-color: var(--info);
}
.freshness-bar .progress {
  flex-basis: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.freshness-bar .progress > div {
  height: 100%;
  background: var(--info);
  transition: width .4s ease;
}
