/* Get Money — the dashboard stylesheet.
 *
 * No framework. No webfont. CSS custom properties for the palette.
 * The look: dark, rounded, generous padding, few words.
 */

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --buy: #3fb950;
  --sell: #f85149;
  --hold: #d29922;
  --accent: #58a6ff;
  --violet: #bc8cff;
  --radius: 14px;
  --radius-sm: 9px;
  --gap: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; letter-spacing: -0.02em; }
h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 18px 0 8px;
}
h3:first-child { margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ */
/* The honesty banner                                                  */
/* ------------------------------------------------------------------ */

.honesty {
  background: linear-gradient(90deg, rgba(210,153,34,.16), rgba(210,153,34,.06));
  border-bottom: 1px solid rgba(210,153,34,.35);
  padding: 8px 20px;
  font-size: 12.5px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}
.honesty strong { color: #f0c674; }
.honesty span { color: var(--muted); }

/* ------------------------------------------------------------------ */
/* The top bar                                                         */
/* ------------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex: 0 0 auto;
}

.brand { display: flex; align-items: center; gap: 9px; }
.logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: #08131f;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.brand-name { font-weight: 600; letter-spacing: -0.01em; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.clock {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ------------------------------------------------------------------ */
/* Pills                                                               */
/* ------------------------------------------------------------------ */

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(88,166,255,.14);
  color: var(--accent);
  white-space: nowrap;
}
.pill.ok      { background: rgba(63,185,80,.15);  color: var(--buy); }
.pill.warn    { background: rgba(210,153,34,.16); color: var(--hold); }
.pill.bad     { background: rgba(248,81,73,.15);  color: var(--sell); }
.pill.muted   { background: rgba(139,148,158,.13); color: var(--muted); }
.pill.buy     { background: rgba(63,185,80,.15);  color: var(--buy); }
.pill.sell    { background: rgba(248,81,73,.15);  color: var(--sell); }
.pill.hold    { background: rgba(210,153,34,.16); color: var(--hold); }
.pill.source  { background: rgba(188,140,255,.13); color: var(--violet); font-weight: 500; }

/* ------------------------------------------------------------------ */
/* Search                                                              */
/* ------------------------------------------------------------------ */

.search-wrap { position: relative; width: min(320px, 40vw); }
.search-wrap input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 11px;
  font: inherit;
  font-size: 13px;
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.14);
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 12px 34px rgba(0,0,0,.55);
}
.search-results button {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: baseline;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(48,54,61,.5);
  color: var(--text);
  padding: 8px 11px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  border-radius: 0;
}
.search-results button:hover,
.search-results button.active { background: rgba(88,166,255,.12); }
.search-results .sym { font-weight: 700; }
.search-results .desc { color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ */
/* The layout                                                          */
/* ------------------------------------------------------------------ */

.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "chart side"
    "bottom bottom";
  gap: var(--gap);
  padding: var(--gap);
  min-height: 0;
  /* The rows size to their content. A fixed 1fr row made the chart pane
     overflow its track and cover the tabs underneath it. */
  grid-template-rows: auto auto;
  align-items: start;
}

.chart-pane { grid-area: chart; }
.side-pane  { grid-area: side; }
.bottom-pane { grid-area: bottom; }

.pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  margin-bottom: 12px;
}
.card:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ */
/* The chart pane                                                      */
/* ------------------------------------------------------------------ */

.symbol-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.symbol-id { display: flex; align-items: baseline; gap: 10px; }
.symbol-price { display: flex; align-items: baseline; gap: 10px; }
#last-price { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
#last-change { font-size: 13px; font-variant-numeric: tabular-nums; }
.up   { color: var(--buy); }
.down { color: var(--sell); }

.timeframes { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.timeframes button {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 4px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.timeframes button:hover { color: var(--text); border-color: var(--muted); }
.timeframes button.active {
  background: rgba(88,166,255,.14);
  border-color: var(--accent);
  color: var(--accent);
}
.timeframes button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chart-wrap {
  position: relative;
  height: clamp(280px, 40vh, 460px);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--panel);
}
#chart { display: block; width: 100%; height: 100%; cursor: crosshair; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(22,27,34,.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  white-space: nowrap;
}
.tooltip b { color: var(--accent); font-weight: 600; }

.chart-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.overlay-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

/* the ticker strip */
.ticker-strip {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.ticker-item {
  flex: 0 0 auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  min-width: 122px;
  cursor: pointer;
}
.ticker-item:hover { border-color: var(--accent); }
.ticker-item.active { border-color: var(--accent); background: rgba(88,166,255,.09); }
.ticker-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ticker-sym { font-weight: 700; font-size: 13px; }
.ticker-price { font-variant-numeric: tabular-nums; font-size: 13px; }
.ticker-chg { font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ */
/* The side pane                                                       */
/* ------------------------------------------------------------------ */

.signal-card { font-size: 13px; }
.signal-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.signal-row span:first-child { color: var(--muted); }
.signal-row span:last-child { font-variant-numeric: tabular-nums; }
.signal-reasons { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.signal-reasons li { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.signal-reasons { margin: 8px 0 0; padding-left: 16px; }

.agent-steps { margin-bottom: 10px; }
.agent-step {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 5px;
  background: var(--panel);
}
.agent-step > summary {
  cursor: pointer;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-step > summary::-webkit-details-marker { display: none; }
.agent-step > summary::before { content: "▸"; color: var(--muted); }
.agent-step[open] > summary::before { content: "▾"; }
.agent-step-body { padding: 0 10px 9px 10px; font-size: 12px; color: var(--muted); }
.agent-step-body ul { margin: 4px 0; padding-left: 16px; }
.agent-role { color: var(--accent); }

.chat-log {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
}
.chat-msg.user {
  background: rgba(88,166,255,.12);
  align-self: flex-end;
  max-width: 88%;
}
.chat-msg.bot {
  background: var(--panel);
  border: 1px solid var(--border);
}
.chat-msg .who {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 3px;
}
.chat-msg .degraded {
  color: var(--hold);
  font-size: 11px;
  margin-top: 5px;
  display: block;
}

.chat-form { display: flex; gap: 7px; }
.chat-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  min-width: 0;
}
.chat-form input:focus { outline: none; border-color: var(--accent); }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

button {
  background: var(--accent);
  color: #08131f;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font: inherit;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: default; filter: none; }
button.danger {
  background: transparent;
  border: 1px solid var(--sell);
  color: var(--sell);
}
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* The bottom pane                                                     */
/* ------------------------------------------------------------------ */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  background: none;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
}
.tab:hover { color: var(--text); filter: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel { display: none; }
.panel.active { display: block; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.kpi .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 3px;
}
.kpi .value {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.split { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; }
.split-side { min-width: 0; }

.spark-wrap { height: 90px; background: var(--panel-2); border-radius: var(--radius-sm); border: 1px solid var(--border); }
#sparkline { display: block; width: 100%; height: 100%; }

.risk-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
}
.risk-box .row { display: flex; justify-content: space-between; padding: 2px 0; }
.risk-box .row span:last-child { font-variant-numeric: tabular-nums; }
.risk-box.danger { border-color: var(--sell); background: rgba(248,81,73,.08); }
.risk-box.warn   { border-color: var(--hold); background: rgba(210,153,34,.08); }

.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
th {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  white-space: nowrap;
}
tbody tr:hover { background: rgba(88,166,255,.05); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
table.wide { font-size: 12px; }

/* ------------------------------------------------------------------ */
/* The leaderboard explainer                                           */
/* ------------------------------------------------------------------ */

.explain {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 14px;
  max-width: 90ch;
}
.explain strong { color: var(--text); }
.explain em { color: var(--accent); font-style: normal; font-weight: 600; }

/* ------------------------------------------------------------------ */
/* The strategy lab                                                    */
/* ------------------------------------------------------------------ */

.panel-toolbar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.panel-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.panel-toolbar select,
.panel-toolbar input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
}
.panel-toolbar select:focus,
.panel-toolbar input:focus { outline: none; border-color: var(--accent); }

.heatmap {
  display: grid;
  gap: 3px;
  overflow-x: auto;
  padding: 4px 0;
}
.hm-cell {
  min-width: 62px;
  padding: 8px 6px;
  border-radius: 6px;
  text-align: center;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.hm-cell.best { border-color: var(--accent); font-weight: 700; }
.hm-cell .p { color: var(--muted); font-size: 10px; }
.hm-head {
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.hm-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* News                                                                */
/* ------------------------------------------------------------------ */

.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li {
  border-bottom: 1px solid var(--border);
  padding: 9px 0;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.news-list .sentiment {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.news-list .sentiment.pos { background: rgba(63,185,80,.15); color: var(--buy); }
.news-list .sentiment.neg { background: rgba(248,81,73,.15); color: var(--sell); }
.news-list .sentiment.neu { background: rgba(139,148,158,.13); color: var(--muted); }
.news-list .headline { flex: 1; }
.news-list .src { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }

/* ------------------------------------------------------------------ */
/* The system panel                                                    */
/* ------------------------------------------------------------------ */

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.health-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.health-item .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.health-item .value { font-size: 14px; margin-top: 3px; word-break: break-word; }
.health-item pre {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow: auto;
}

/* ------------------------------------------------------------------ */
/* The toast                                                           */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 12px 34px rgba(0,0,0,.55);
  max-width: 80vw;
}
.toast.bad { border-color: var(--sell); color: var(--sell); }
.toast.ok  { border-color: var(--buy); color: var(--buy); }

/* ------------------------------------------------------------------ */
/* Narrow screens                                                      */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chart" "side" "bottom";
  }
  .split { grid-template-columns: minmax(0, 1fr); }
  .side-pane { order: 2; }
}

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .search-wrap { width: 100%; order: 3; }
  .honesty { font-size: 12px; }
  .chart-wrap { height: 260px; }
  .panel-toolbar { gap: 8px; }
}

@media (prefers-reduced-motion: no-preference) {
  .pill, .toast { transition: opacity .15s ease; }
}
