:root {
  color-scheme: dark;
  --bg: #050607;
  --panel: #090b0c;
  --panel-soft: #101315;
  --panel-hot: #191306;
  --line: #2a3236;
  --line-hot: #7d5a18;
  --text: #f4f1e8;
  --muted: #8b9498;
  --amber: #ffb000;
  --amber-soft: #d08a00;
  --green: #00d46a;
  --red: #ff355d;
  --cyan: #36c8ff;
  --blue: #6aa4ff;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --panel-soft: #f3f6f8;
  --panel-hot: #fff3d1;
  --line: #b9c2c9;
  --line-hot: #b07400;
  --text: #101417;
  --muted: #5f6a70;
  --amber: #8a5a00;
  --amber-soft: #a66a00;
  --green: #087d3e;
  --red: #ba173d;
  --cyan: #006b9a;
  --blue: #265fd6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
}

body {
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

.terminal {
  min-height: 100vh;
  padding: 4px;
  background:
    linear-gradient(180deg, rgba(255, 176, 0, 0.05), transparent 220px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 22px),
    var(--bg);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 1px;
  border: 1px solid var(--line-hot);
  background: color-mix(in srgb, var(--panel) 94%, var(--amber) 6%);
  padding: 5px 6px;
}

.topbar-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-button {
  height: 27px;
  min-height: 0;
  padding: 0 10px;
  border: 1px solid #5b4719;
  background: #211703;
  color: var(--amber);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
}

.account-button:hover {
  background: var(--amber);
  color: #090600;
}

.settings-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.setting-group {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.setting-group > span {
  padding: 0 7px;
  color: var(--muted);
  background: var(--panel);
  font-size: 10px;
  font-weight: 900;
  line-height: 25px;
}

.setting-btn {
  min-width: 46px;
  height: 25px;
  padding: 0 8px;
  border: 0;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
}

.setting-btn.is-active {
  background: var(--amber);
  color: var(--bg);
}

.setting-btn:hover {
  color: var(--bg);
  background: var(--amber-soft);
}

.command-row,
.panel {
  border: 1px solid var(--line);
  background: rgba(9, 11, 12, 0.98);
}

html[data-theme="light"] .command-row,
html[data-theme="light"] .panel {
  background: color-mix(in srgb, var(--panel) 96%, var(--bg) 4%);
}

.command-form button,
.quick-button {
  border: 1px solid #5b4719;
  background: #211703;
  color: var(--amber);
  cursor: pointer;
  height: 100%;
  min-height: 36px;
  font-weight: 900;
}

.command-form button:hover,
.quick-button:hover {
  background: var(--amber);
  color: #090600;
}

.command-row {
  margin-bottom: 1px;
  border-color: var(--line-hot);
  background: #080806;
}

.command-row {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(220px, 340px);
  align-items: stretch;
  overflow: hidden;
}

.command-form {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) 72px 94px 58px;
  gap: 6px;
  align-items: center;
  padding: 6px;
  min-width: 0;
}

.panel-add-form {
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr) 50px;
  gap: 4px;
  align-items: center;
  padding: 6px;
  border-left: 1px solid var(--line);
  min-width: 0;
}

.panel-add-form > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.panel-add-form select,
.panel-add-form button {
  height: 28px;
  min-height: 0;
  font-size: 11px;
  min-width: 0;
}

.panel-add-form button {
  border: 1px solid #5b4719;
  background: #211703;
  color: var(--amber);
  cursor: pointer;
  font-weight: 900;
}

.panel-add-form.is-empty {
  opacity: 0.48;
}

.exchange-clock-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.exchange-clock {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 7px;
  background: #050607;
  font-size: 11px;
}

.exchange-clock strong {
  color: var(--amber);
}

.exchange-clock span {
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.exchange-clock em {
  font-style: normal;
  color: var(--muted);
}

.prompt {
  color: var(--amber);
  font-weight: 900;
  padding-left: 4px;
}

input,
select {
  height: 34px;
  border: 1px solid var(--line);
  background: #020303;
  color: var(--text);
  padding: 0 9px;
}

#command-input {
  color: var(--amber);
  text-transform: uppercase;
  font-size: 18px;
  font-weight: 900;
}

select {
  color: var(--cyan);
}

.workspace {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  grid-auto-rows: 8px;
  grid-auto-flow: dense;
  align-items: start;
  gap: 6px;
  /* Match the page background so the ragged bottoms of the masonry columns blend
     in instead of showing as stray gray blocks. Panels keep their own outline. */
  background: var(--bg);
}

.panel {
  resize: both;
  min-width: 0;
  min-height: 220px;
  height: 300px;
  overflow: hidden;
  outline: 1px solid var(--line);
  border: 0;
}

.panel.is-hidden {
  display: none !important;
}

.panel[draggable="true"] .panel-header {
  cursor: grab;
  user-select: none;
}

.panel.dragging {
  opacity: 0.55;
}

.panel.drop-target {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}

.security-panel {
  grid-column: span 2;
  grid-row-end: span 64;
  height: 520px;
  min-height: 520px;
}

.quote-matrix-panel {
  grid-row-end: span 64;
  height: 520px;
  min-height: 520px;
}

.watch-panel {
  grid-row-end: span 40;
  height: 320px;
  min-height: 320px;
}

.volatility-panel {
  grid-row-end: span 32;
  height: 260px;
  min-height: 260px;
}

.news-panel {
  grid-row-end: span 38;
  height: 300px;
  min-height: 300px;
}

.fundamentals-panel {
  grid-row-end: span 37;
  height: 300px;
  min-height: 300px;
}

.macro-panel {
  grid-row-end: span 35;
  height: 280px;
  min-height: 280px;
}

.portfolio-panel {
  grid-row-end: span 31;
  height: 250px;
  min-height: 250px;
}

.ai-panel {
  grid-row-end: span 44;
  height: 360px;
  min-height: 360px;
}

.console-panel {
  grid-column: span 2;
  grid-row-end: span 31;
  height: 250px;
  min-height: 250px;
}

.news-panel {
  display: grid;
  grid-template-rows: 28px auto auto minmax(0, 1fr);
  overflow: hidden;
}

.news-impact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-hot);
  background: var(--panel-soft);
}

.news-impact-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.news-impact-main span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.news-impact-main strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.news-impact-main.positive strong {
  color: var(--green);
}

.news-impact-main.negative strong {
  color: var(--red);
}

.news-impact-main em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.news-impact-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
}

.news-impact-stats em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.news-tag.muted-tag,
.news-impact-stats .muted-tag {
  color: var(--muted) !important;
}

.fundamentals-panel,
.macro-panel,
.portfolio-panel,
.console-panel {
  display: grid;
  grid-template-rows: 28px minmax(0, 1fr);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  height: 28px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: #11100b;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.panel-header > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-header > span:last-of-type {
  color: var(--muted);
  font-weight: 700;
}

.panel-tools {
  display: inline-flex;
  gap: 3px;
  margin-left: auto;
}

.panel-move,
.panel-close {
  width: 22px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 1px solid #5b4719;
  background: #1b1305;
  color: var(--amber);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.panel-move:hover,
.panel-close:hover {
  background: var(--amber);
  color: #090600;
}

.panel-close {
  color: var(--red);
}

.security-top {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 10px;
  padding: 9px 10px 7px;
  border-bottom: 1px solid var(--line);
}

.ticker {
  color: var(--amber);
  font-size: clamp(46px, 5vw, 78px);
  line-height: 0.92;
  font-weight: 900;
}

.company {
  margin-top: 4px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.descriptor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.descriptor-row span,
.micro-tape span {
  border: 1px solid var(--line);
  background: #050607;
  color: var(--muted);
  padding: 3px 6px;
  font-size: 11px;
}

.price-tile {
  display: grid;
  justify-items: end;
  align-content: center;
  padding: 8px;
  border: 1px solid var(--line-hot);
  background: var(--panel-hot);
}

.price-tile span {
  color: var(--muted);
  font-size: 11px;
}

.price-tile strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1.1;
}

.price-tile em {
  font-style: normal;
  font-size: 15px;
  font-weight: 900;
}

.micro-tape {
  display: flex;
  gap: 5px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.indicator-tape {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.indicator-tape span {
  min-width: 0;
  padding: 4px 6px;
  background: #060809;
  color: var(--cyan);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-shell {
  position: relative;
  width: 100%;
  height: calc(100% - 176px);
  background: #040506;
}

.tv-chart,
.fallback-chart {
  width: 100%;
  height: 100%;
}

.tv-chart {
  display: block;
}

.fallback-chart {
  display: none;
  background: #040506;
}

.chart-shell.use-fallback .tv-chart {
  display: none;
}

.chart-shell.use-fallback .fallback-chart {
  display: block;
}

.chart-status {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  padding: 3px 6px;
  border: 1px solid rgba(255, 176, 0, 0.45);
  background: rgba(4, 5, 6, 0.82);
  color: var(--amber);
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.quote-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  height: calc(100% - 28px);
  background: var(--line);
}

.technical-panel {
  display: grid;
  grid-template-rows: 28px minmax(0, 1fr) auto;
  overflow: hidden;
}

.technical-panel .compact-matrix {
  height: auto;
  max-height: 210px;
}

.technical-analysis {
  min-height: 0;
  overflow: auto;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.technical-headline {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line-hot);
  background: #0b0c09;
}

.technical-headline strong {
  color: var(--amber);
  font-size: 18px;
}

.technical-headline p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.technical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.technical-block {
  min-width: 0;
  border: 1px solid var(--line);
  background: #07090a;
}

.technical-block h3 {
  margin: 0;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--cyan);
  font-size: 11px;
  text-transform: uppercase;
}

.level-row,
.signal-row,
.scenario-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  min-height: 30px;
  padding: 6px 8px;
  border-bottom: 1px solid #171d20;
  font-size: 12px;
}

.scenario-row {
  grid-template-columns: 86px 1fr;
  align-items: start;
}

.scenario-row p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.level-row span,
.signal-row span,
.scenario-row span {
  color: var(--muted);
}

.level-row strong,
.signal-row strong,
.scenario-row strong {
  color: var(--text);
}

.quote-matrix div {
  display: grid;
  align-content: center;
  min-height: 52px;
  padding: 8px;
  background: var(--panel-soft);
}

.quote-matrix span,
.fund-row span,
.portfolio-row span,
.macro-row span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.quote-matrix strong {
  margin-top: 5px;
  color: var(--text);
  font-size: 19px;
  overflow-wrap: anywhere;
}

.table-head,
.watch-row {
  display: grid;
  grid-template-columns: 72px 1fr 70px 36px;
  gap: 6px;
  align-items: center;
}

.table-head {
  height: 24px;
  padding: 0 8px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
}

.watchlist {
  min-height: 0;
  overflow: auto;
}

.watch-panel {
  display: grid;
  grid-template-rows: 28px 36px 24px minmax(0, 1fr);
}

.watch-add-form {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 5px;
  padding: 5px;
  border-bottom: 1px solid var(--line);
}

.watch-add-form input {
  height: 26px;
  color: var(--amber);
  text-transform: uppercase;
  font-size: 12px;
}

.watch-add-form button,
.watch-remove {
  min-height: 24px;
  border: 1px solid #5b4719;
  background: #211703;
  color: var(--amber);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.watch-remove {
  width: 26px;
  justify-self: end;
}

.watch-row {
  min-height: 34px;
  padding: 0 8px;
  border-bottom: 1px solid #171d20;
  cursor: pointer;
  font-size: 12px;
}

.watch-row:hover {
  background: #151403;
}

.watch-symbol {
  color: var(--cyan);
  font-weight: 900;
}

.watch-price,
.watch-change,
.watch-signal {
  text-align: right;
}

.sentiment-panel {
  display: grid;
  grid-template-rows: 28px auto 24px minmax(0, 1fr);
  min-height: 320px;
}

.sentiment-gauges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.sentiment-gauge {
  min-width: 0;
  padding: 7px;
  background: #060809;
}

.sentiment-gauge-top,
.sentiment-gauge-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.sentiment-gauge-top span,
.sentiment-gauge-bottom span,
.sentiment-gauge-bottom em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sentiment-gauge-top span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.sentiment-gauge-top strong {
  color: var(--text);
  font-size: 14px;
}

.sentiment-meter {
  height: 5px;
  margin: 6px 0;
  border: 1px solid #1b2428;
  background: #020303;
}

.sentiment-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
}

.sentiment-gauge-bottom {
  color: var(--muted);
  font-size: 10px;
}

.sentiment-gauge-bottom em {
  font-style: normal;
  text-align: right;
}

.sentiment-index-head,
.sentiment-index-row {
  grid-template-columns: minmax(92px, 1.4fr) minmax(70px, 0.85fr) minmax(62px, 0.75fr) minmax(86px, 1fr);
}

.sentiment-index-list {
  min-height: 0;
  overflow: auto;
}

.sentiment-index-row {
  display: grid;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  border-bottom: 1px solid #171d20;
  font-size: 12px;
}

.sentiment-index-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.sentiment-index-row > span:first-child {
  display: grid;
  gap: 1px;
  text-align: left;
}

.sentiment-index-row strong {
  color: var(--cyan);
  font-size: 12px;
}

.sentiment-index-row em {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sentiment-index-row em:empty {
  display: none;
}

.volatility-panel {
  display: grid;
  grid-template-rows: 28px auto 24px minmax(0, 1fr);
  overflow: hidden;
}

.volatility-header {
  height: 28px;
}

.volatility-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
}

.volatility-summary div {
  min-width: 0;
  padding: 6px 8px;
  background: #0d1112;
}

.volatility-summary span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.volatility-summary strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: clamp(12px, 1.15vw, 15px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.volatility-summary em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.volatility-head,
.volatility-row {
  display: grid;
  grid-template-columns: 56px 1fr 1fr 1fr;
  gap: 6px;
  align-items: center;
}

.volatility-head {
  height: 24px;
  padding: 0 8px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
}

.volatility-chain {
  min-height: 0;
  overflow: auto;
}

.volatility-row {
  min-height: 30px;
  padding: 0 8px;
  border-bottom: 1px solid #171d20;
  font-size: 12px;
}

.volatility-row span {
  text-align: right;
}

.volatility-row .term {
  color: var(--amber);
  font-weight: 900;
  text-align: left;
}

.empty-row {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* ---- Fair Value panel ---- */
.valuation-board { padding: 8px; display: grid; gap: 8px; align-content: start; }
.val-head { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.val-fair, .val-upside {
  border: 1px solid var(--line-hot); background: var(--panel-soft);
  padding: 8px 10px; display: grid; gap: 2px;
}
.val-fair span, .val-upside span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.val-fair strong { color: var(--amber); font-size: 22px; }
.val-upside strong { font-size: 22px; color: var(--text); }
.val-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.val-cell { background: var(--panel); padding: 6px 8px; display: grid; gap: 2px; min-width: 0; }
.val-cell span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.val-cell strong { color: var(--text); font-size: 14px; }
.val-foot { color: var(--muted); font-size: 10px; }

/* ---- Social Buzz panel ---- */
.social-panel { display: grid; grid-template-rows: var(--head-h, 28px) auto minmax(0, 1fr); overflow: hidden; }
.social-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line); border-bottom: 1px solid var(--line);
}
.social-summary div { background: var(--panel); padding: 6px 8px; display: grid; gap: 2px; }
.social-summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.social-summary strong { font-size: 15px; }
.social-list { min-height: 0; overflow: auto; }
.social-item {
  display: block; padding: 7px 9px; border-bottom: 1px solid var(--line-soft, #171d20);
  color: var(--text); text-decoration: none;
}
.social-item:hover { background: #151403; }
.social-body { font-size: 12px; line-height: 1.4; display: flex; gap: 6px; }
.social-tag { flex: 0 0 auto; font-weight: 800; }
.social-user { margin-top: 4px; color: var(--muted); font-size: 11px; }
.social-disc { padding: 7px 9px; color: var(--muted); font-size: 10px; }
.muted-tag { color: var(--muted) !important; }

/* ---- Analyst Ratings panel ---- */
.ratings-board { padding: 8px; display: grid; gap: 8px; align-content: start; }
.rating-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.rating-consensus span, .rating-score span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; display: block; }
.rating-consensus strong { font-size: 22px; font-weight: 900; }
.rating-score { text-align: right; }
.rating-score strong { font-size: 18px; color: var(--text); }
.rating-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--panel-soft); }
.rating-bar i { display: block; height: 100%; }
.seg-sb { background: var(--green); }
.seg-b { background: color-mix(in srgb, var(--green) 60%, var(--amber) 40%); }
.seg-h { background: var(--amber); }
.seg-s { background: color-mix(in srgb, var(--red) 55%, var(--amber) 45%); }
.seg-ss { background: var(--red); }
.rating-rows { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.rating-row { display: flex; justify-content: space-between; align-items: center; background: var(--panel); padding: 6px 9px; font-size: 12px; }
.rating-row span { color: var(--muted); display: flex; align-items: center; gap: 7px; }
.rating-row strong { color: var(--text); }
.rating-row .dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.dot.strongBuy { background: var(--green); }
.dot.buy { background: color-mix(in srgb, var(--green) 60%, var(--amber) 40%); }
.dot.hold { background: var(--amber); }
.dot.sell { background: color-mix(in srgb, var(--red) 55%, var(--amber) 45%); }
.dot.strongSell { background: var(--red); }

/* ---- Earnings & Events panel ---- */
.events-board { padding: 8px; display: grid; gap: 8px; align-content: start; }
.events-label, .events-history-head { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.events-next { border: 1px solid var(--line-hot); background: var(--panel-soft); padding: 9px 10px; display: grid; gap: 8px; }
.events-date { display: flex; align-items: baseline; gap: 8px; }
.events-date strong { color: var(--amber); font-size: 18px; }
.events-date em { font-style: normal; color: var(--muted); font-size: 11px; }
.events-est { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.events-est span { color: var(--muted); font-size: 10px; text-transform: uppercase; display: block; }
.events-est strong { color: var(--text); font-size: 14px; }
.events-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 5px 2px; border-bottom: 1px solid var(--line-soft, #171d20); font-size: 11px; }
.events-row span { color: var(--text); }
.events-row em { font-style: normal; color: var(--muted); text-align: right; }
.events-row strong { font-weight: 800; }

/* ---- Alerts panel ---- */
.alerts-panel { display: grid; grid-template-rows: var(--head-h, 28px) auto minmax(0, 1fr); overflow: hidden; }
.alert-add-form {
  display: grid; grid-template-columns: 1.2fr 0.9fr 0.5fr 0.9fr auto; gap: 4px;
  padding: 6px; border-bottom: 1px solid var(--line);
}
.alert-add-form input, .alert-add-form select {
  height: 28px; min-width: 0; border: 1px solid var(--line); background: var(--input-bg, #020303);
  color: var(--text); padding: 0 6px; font-size: 11px;
}
.alert-add-form #alert-symbol { color: var(--amber); text-transform: uppercase; }
.alert-add-form button {
  height: 28px; min-height: 0; border: 1px solid var(--line-hot); background: var(--amber);
  color: var(--bg); font-weight: 900; font-size: 11px; cursor: pointer; padding: 0 8px;
}
.alerts-list { min-height: 0; overflow: auto; }
.alert-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
  padding: 7px 9px; border-bottom: 1px solid var(--line-soft, #171d20); font-size: 12px;
}
.alert-desc { color: var(--text); }
.alert-status { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.alert-row.is-triggered { background: rgba(255, 176, 0, 0.08); }
.alert-row.is-triggered .alert-status { color: var(--amber); font-weight: 800; }
.alert-remove {
  width: 22px; height: 20px; min-height: 0; padding: 0; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 11px;
}
.alert-remove:hover { border-color: var(--red); color: var(--red); }
.alert-note { padding: 7px 9px; color: var(--muted); font-size: 10px; }

/* ---- Insider Activity panel ---- */
.insider-panel { display: grid; grid-template-rows: var(--head-h, 28px) auto minmax(0, 1fr); overflow: hidden; }
.insider-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.insider-summary div { background: var(--panel); padding: 7px 9px; display: grid; gap: 1px; }
.insider-summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.insider-summary strong { font-size: 15px; font-weight: 900; }
.insider-summary em { font-style: normal; color: var(--muted); font-size: 11px; }
.insider-list { min-height: 0; overflow: auto; }
.insider-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name chg" "date date"; gap: 1px 8px; padding: 6px 9px; border-bottom: 1px solid var(--line-soft, #171d20); font-size: 12px; }
.insider-name { grid-area: name; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insider-chg { grid-area: chg; text-align: right; font-weight: 800; }
.insider-date { grid-area: date; color: var(--muted); font-size: 10px; }
.insider-disc { padding: 7px 9px; color: var(--muted); font-size: 10px; }

/* ---- Account plan / billing (in auth modal) ---- */
.auth-plan { display: grid; gap: 8px; margin: 4px 0 6px; }
.plan-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--line); background: var(--panel-soft); }
.plan-row span { color: var(--muted); font-size: 12px; }
.plan-row strong { color: var(--amber); }
.plan-offers { display: grid; gap: 6px; }
.plan-offer, .plan-manage {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-hot); background: var(--amber);
  color: var(--bg); font-weight: 800; font-size: 13px; cursor: pointer; border-radius: 8px;
}
.plan-offer:hover, .plan-manage:hover { background: var(--amber-soft); }
.plan-manage { background: transparent; color: var(--text); border-color: var(--line); }

/* ---- AI support / feedback widget ---- */
.support-widget { position: fixed; right: 16px; bottom: 16px; z-index: 60; }
.support-fab {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line-hot);
  background: var(--amber); color: var(--bg); font-size: 22px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.support-fab:hover { background: var(--amber-soft); }
.support-panel {
  position: absolute; right: 0; bottom: 60px; width: 320px; max-width: 84vw; height: 420px; max-height: 70vh;
  display: grid; grid-template-rows: auto 1fr auto;
  border: 1px solid var(--line); background: var(--panel); border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.support-head {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: var(--header-bg, #11100b); color: var(--amber); font-weight: 800; font-size: 13px;
}
.support-close { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.support-msgs { overflow: auto; padding: 12px; display: grid; gap: 8px; align-content: start; }
.support-msg { max-width: 85%; padding: 8px 11px; border-radius: 10px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.support-msg.assistant { justify-self: start; background: var(--panel-soft); color: var(--text); border: 1px solid var(--line); }
.support-msg.user { justify-self: end; background: var(--amber); color: var(--bg); font-weight: 600; }
.support-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.support-form input { height: 36px; min-width: 0; border: 1px solid var(--line); background: var(--input-bg, #020303); color: var(--text); padding: 0 10px; border-radius: 8px; }
.support-form button { height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--amber); color: var(--bg); font-weight: 800; cursor: pointer; }
.support-form button:disabled { opacity: 0.6; cursor: default; }

.news,
.fundamentals,
.macro-board,
.portfolio-board,
.console {
  min-height: 0;
  height: auto;
  overflow: auto;
}

.sentiment-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.sentiment-strip div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 6px 7px;
  background: #060809;
}

.sentiment-strip span {
  color: var(--muted);
  font-size: 10px;
}

.sentiment-strip strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-mode-toggle {
  display: flex;
  gap: 1px;
  padding: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.news-mode-toggle .setting-btn {
  flex: 1;
}

.news-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 1px;
  padding: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.news-search-form input,
.news-search-form button {
  height: 28px;
  min-height: 0;
  border: 0;
  font-size: 11px;
}

.news-search-form input {
  min-width: 0;
  background: #020303;
  color: var(--text);
}

.news-search-form button {
  background: #211703;
  color: var(--amber);
  cursor: pointer;
  font-weight: 900;
}

.news-search-form button:hover {
  background: var(--amber);
  color: #090600;
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] .exchange-clock,
html[data-theme="light"] .descriptor-row span,
html[data-theme="light"] .micro-tape span,
html[data-theme="light"] .indicator-tape span,
html[data-theme="light"] .technical-headline,
html[data-theme="light"] .technical-block,
html[data-theme="light"] .sentiment-gauge,
html[data-theme="light"] .sentiment-strip div {
  background: var(--panel-soft);
}

html[data-theme="light"] .chart-shell,
html[data-theme="light"] .fallback-chart {
  background: #ffffff;
}

html[data-theme="light"] .command-row,
html[data-theme="light"] .panel-header {
  background: color-mix(in srgb, var(--panel) 86%, var(--amber) 14%);
}

html[data-theme="light"] .watch-row:hover,
html[data-theme="light"] .sentiment-index-row:hover,
html[data-theme="light"] .news a:hover,
html[data-theme="light"] .social-item:hover {
  background: #fff4cf;
}

.news a {
  display: block;
  padding: 8px 10px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid #171d20;
}

.news a:hover {
  background: #151403;
}

.news-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.35;
}

.news-title span {
  flex: 0 0 auto;
  max-width: 92px;
  padding: 1px 4px;
  border: 1px solid #29343a;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-title strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-source {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.fund-row,
.macro-row,
.portfolio-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 34px;
  padding: 0 9px;
  border-bottom: 1px solid #171d20;
}

.fund-row strong,
.macro-row strong,
.portfolio-row strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.macro-row em,
.portfolio-row em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}

.console {
  display: grid;
  align-content: start;
}

.console-line {
  padding: 7px 9px;
  border-bottom: 1px solid #171d20;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.console-line strong {
  color: var(--amber);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .security-panel,
  .console-panel {
    grid-column: span 2;
  }
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .settings-strip {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .command-row {
    grid-template-columns: 1fr;
  }

  .panel-add-form {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .terminal {
    padding: 5px;
  }

  .command-form {
    grid-template-columns: auto minmax(0, 1fr) 58px;
  }

  #provider-select,
  .command-form button {
    grid-column: span 1;
  }

  #range-select {
    grid-column: 2;
  }

  .indicator-tape,
  .sentiment-strip,
  .exchange-clock-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .panel,
  .security-panel,
  .console-panel {
    grid-column: span 1;
    resize: none;
    width: auto !important;
    min-height: 260px;
  }

  .security-panel {
    min-height: 460px;
  }

  .security-top {
    grid-template-columns: 1fr;
  }

  .price-tile {
    justify-items: start;
  }
}

/* ---------------------------------------------------------------------------
   Accounts: sign-in modal + authenticated state
   --------------------------------------------------------------------------- */

.account-button.is-authed {
  color: var(--green);
  border-color: var(--green);
  background: color-mix(in srgb, var(--panel) 86%, var(--green) 14%);
}

.account-button.is-authed:hover {
  background: var(--green);
  color: var(--bg);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 4, 6, 0.66);
  backdrop-filter: blur(3px);
}

html[data-theme="light"] .auth-overlay {
  background: rgba(40, 44, 50, 0.4);
}

.auth-overlay[hidden] {
  display: none;
}

.auth-modal {
  position: relative;
  width: min(384px, 94vw);
  max-height: 92vh;
  overflow: auto;
  padding: 24px 22px 18px;
  border: 1px solid var(--line-hot);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.auth-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.auth-close:hover {
  color: var(--text);
  border-color: var(--line-hot);
}

.auth-brand {
  color: var(--amber);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.auth-brand span {
  margin-left: 4px;
  color: var(--muted);
}

.auth-title {
  margin: 6px 0 16px;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--line);
}

.auth-tab {
  height: 30px;
  border: 0;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.auth-tab.is-active {
  background: var(--amber);
  color: var(--bg);
}

.auth-tabs[hidden],
.auth-form[hidden],
.auth-switch[hidden],
.auth-divider[hidden],
.auth-google[hidden] {
  display: none;
}

.auth-form {
  display: grid;
  gap: 11px;
}

.auth-field {
  display: grid;
  gap: 4px;
}

.auth-field[hidden] {
  display: none;
}

.auth-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-field input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 11px;
  font-size: 13px;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--amber);
}

.auth-error {
  color: var(--red);
  font-size: 12px;
  line-height: 1.4;
}

.auth-error[hidden] {
  display: none;
}

.auth-submit {
  height: 40px;
  border: 1px solid var(--line-hot);
  background: var(--amber);
  color: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.auth-submit:hover {
  background: var(--amber-soft);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.auth-switch {
  margin-top: 10px;
  text-align: center;
}

.auth-switch button {
  border: 0;
  background: none;
  color: var(--cyan);
  cursor: pointer;
  font-size: 12px;
}

.auth-switch button:hover {
  text-decoration: underline;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 14px 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-google {
  display: grid;
  justify-items: center;
  min-height: 40px;
}

.auth-google-hint {
  width: 100%;
  padding: 9px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.auth-account {
  display: grid;
  gap: 12px;
}

.auth-account[hidden] {
  display: none;
}

.auth-account-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.auth-account-row span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-account-row strong {
  color: var(--text);
  font-size: 14px;
  word-break: break-all;
}

.auth-foot {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   AI analyst desk
   --------------------------------------------------------------------------- */

.ai-panel {
  display: grid;
  grid-template-rows: 28px auto minmax(0, 1fr);
  overflow: hidden;
}

.ai-analyst-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.ai-run-btn {
  height: 24px;
  min-height: 0;
  padding: 0 11px;
  border: 1px solid #5b4719;
  background: #211703;
  color: var(--amber);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.ai-run-btn:hover:not(:disabled) {
  background: var(--amber);
  color: #090600;
}

.ai-run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-consensus {
  display: flex;
  gap: 9px;
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
}

.neutral-tag,
.ai-consensus .neutral-tag {
  color: var(--amber);
}

.ai-analyst-board {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 6px;
}

.ai-card {
  display: grid;
  gap: 6px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.ai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-card-head strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-action {
  flex: 0 0 auto;
  padding: 2px 8px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.ai-action.positive {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--panel) 80%, var(--green) 20%);
}

.ai-action.negative {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  background: color-mix(in srgb, var(--panel) 80%, var(--red) 20%);
}

.ai-action.neutral-tag {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 40%, var(--line));
}

.ai-action.muted-tag {
  color: var(--muted);
}

.ai-conviction {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
}

.ai-conviction span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-conviction i {
  display: block;
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.ai-conviction i b {
  display: block;
  height: 100%;
  background: var(--amber);
}

.ai-conviction em {
  color: var(--text);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}

.ai-thesis {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
}

.ai-risk {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.ai-horizon {
  justify-self: start;
  padding: 1px 6px;
  border: 1px solid var(--line);
  color: var(--cyan);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-error {
  color: var(--red);
  font-size: 10px;
  line-height: 1.4;
}

.ai-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.ai-empty p {
  margin: 0 0 10px;
}

.ai-key-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin: 0 auto 8px;
  max-width: 320px;
}

.ai-key-form input {
  height: 30px;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}

.ai-key-form input:focus {
  outline: none;
  border-color: var(--amber);
}

.ai-key-form button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-hot);
  background: var(--amber);
  color: var(--bg);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.ai-key-form button:hover {
  background: var(--amber-soft);
}

.ai-key-link {
  color: var(--cyan);
  font-size: 10px;
  text-decoration: none;
}

.ai-key-link:hover {
  text-decoration: underline;
}

.ai-key-clear {
  height: 24px;
  min-height: 0;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.ai-key-clear[hidden] {
  display: none;
}

.ai-key-clear:hover {
  border-color: var(--red);
  color: var(--red);
}

.ai-disclaimer {
  padding: 4px 2px 0;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
  opacity: 0.8;
}
