/* Same original comic-hero-meets-treasure-map palette as the Android app
   (android/app/src/main/java/com/chanakya/app/ui/Theme.kt) — crimson + blue
   against deep ink navy, gold accent, Bangers display font. Dark-only. */

@font-face {
  font-family: "Bangers";
  src: url("/static/fonts/bangers_regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --red: #e4202b;
  --blue: #2e4fe0;
  --gold: #f5b942;
  --green: #2ecc71;
  --bg: #0a0e1a;
  --surface: #141a2e;
  --surface-variant: #1e2740;
  --surface-hover: #232c48;
  --on-surface: #edeef5;
  --on-surface-muted: #c7cbda;
  --outline: #3a4568;
  --sidebar-w: 236px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--on-surface);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, .badge, .brand-word, .btn {
  font-family: "Bangers", cursive;
  letter-spacing: 0.05em;
  font-weight: normal;
}

/* --- App shell: sidebar nav on desktop, bottom bar on mobile --- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--surface) 0%, #101526 100%);
  border-right: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-word {
  font-size: 22px;
  color: var(--on-surface);
}

.sidebar .tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.sidebar .tabs a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--on-surface-muted);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  transition: background 0.12s, color 0.12s;
}

.sidebar .tabs a svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.sidebar .tabs a:hover {
  background: var(--surface-hover);
  color: var(--on-surface);
}

.sidebar .tabs a.active {
  background: color-mix(in srgb, var(--red) 18%, var(--surface-variant));
  color: var(--on-surface);
  box-shadow: inset 3px 0 0 var(--red);
}

.sidebar-footer {
  padding: 10px 8px 0;
  border-top: 1px solid var(--outline);
  margin-top: 10px;
}

.market-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--on-surface-muted);
  margin-bottom: 6px;
}

.market-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--on-surface-muted);
  flex-shrink: 0;
}

.market-status.open .dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.market-status.closed .dot {
  background: var(--red);
}

.disclaimer {
  font-size: 11px;
  color: var(--on-surface-muted);
  opacity: 0.7;
}

.content-area {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 60px;
}

main#app {
  max-width: 1180px;
  margin: 0 auto;
}

h1 {
  font-size: 28px;
  margin: 0 0 6px;
}

h2 {
  font-size: 20px;
  margin: 0 0 4px;
}

p.subtitle {
  color: var(--on-surface-muted);
  margin: 0 0 18px;
  font-size: 14px;
  max-width: 62ch;
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  transition: border-color 0.15s, transform 0.15s;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  align-items: start;
  margin-bottom: 4px;
}

.card-grid > .card {
  margin-bottom: 0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Icon-then-text list item. Distinct from .row, whose space-between is for
   header bars (title left, button right) and would push the two apart. */
.icon-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 18px;
  border: 2px solid currentColor;
  background: color-mix(in srgb, currentColor 16%, transparent);
}

.badge-buy { color: var(--green); }
.badge-avoid { color: var(--red); }
.badge-watch { color: var(--gold); }

.move {
  font-family: "Bangers", cursive;
  font-size: 18px;
}

.move-up { color: var(--green); }
.move-down { color: var(--red); }

.price-levels {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-top: 4px;
}

.price-levels .stop { color: var(--red); }
.price-levels .target { color: var(--green); }
.risk-low { color: var(--green); }
.risk-medium { color: var(--gold); }
.risk-high { color: var(--red); }

.chip {
  background: transparent;
  color: var(--on-surface-muted);
  border: 1px solid var(--outline);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.chip.selected {
  background: color-mix(in srgb, var(--red) 20%, transparent);
  border-color: var(--red);
  color: var(--on-surface);
}

.btn {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 17px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: filter 0.12s, transform 0.08s;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-row .btn {
  width: auto;
  flex: 0 0 auto;
  padding: 12px 22px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--outline);
  color: var(--on-surface);
  padding: 12px;
  border-radius: 8px;
  font-size: 16px;
}

input:focus {
  outline: none;
  border-color: var(--blue);
}

label.field-label {
  display: block;
  font-size: 13px;
  color: var(--on-surface-muted);
  margin-bottom: 6px;
}

.field {
  margin-bottom: 16px;
}

.hint {
  font-size: 13px;
  color: var(--on-surface-muted);
  margin-top: 6px;
}

.error-text {
  color: var(--red);
}

.reasons {
  font-size: 14px;
  color: var(--on-surface-muted);
  margin-top: 6px;
}

.headline {
  font-size: 14px;
  margin: 4px 0;
}

.headline a {
  color: var(--on-surface);
}


/* Failure-mode breakdown on the Predictions panel. */
.miss-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  font-size: 13px;
}

.miss-bar-label {
  flex: 0 0 170px;
}

.miss-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-variant);
  overflow: hidden;
}

.miss-bar-fill {
  display: block;
  height: 100%;
  background: var(--gold);
}

.focus-box {
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 14px;
}

.focus-title {
  font-family: "Bangers", cursive;
  letter-spacing: 0.04em;
  color: var(--gold);
  font-size: 17px;
  margin-bottom: 2px;
}

.focus-tag {
  color: var(--gold);
  font-size: 12px;
  font-weight: bold;
}

.section-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  margin: 3px 6px 3px 0;
  border-radius: 6px;
}

.section-scan {
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 55%, transparent);
  background: color-mix(in srgb, var(--green) 16%, transparent);
}

.section-news {
  color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 55%, transparent);
  background: color-mix(in srgb, var(--blue) 16%, transparent);
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-variant);
  border-radius: 999px;
  transition: 0.15s;
  border: 1px solid var(--outline);
}

.slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  top: 2px;
  background: var(--on-surface-muted);
  border-radius: 50%;
  transition: 0.15s;
}

.switch input:checked + .slider {
  background: var(--red);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: #fff;
}

.loading {
  height: 3px;
  background: var(--surface-variant);
  border-radius: 2px;
  overflow: hidden;
  margin: 10px 0;
}

.loading::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: var(--red);
  animation: loading-sweep 1s infinite linear;
}

@keyframes loading-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(350%); }
}

.divider {
  border: none;
  border-top: 1px solid var(--outline);
  margin: 20px 0;
}

/* --- Live Scan trading desk (live.js) --- */
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-gold { color: var(--gold); }

.btn-small {
  width: auto;
  padding: 8px 14px;
  font-size: 14px;
}

.btn-row .btn.btn-small {
  padding: 8px 14px;
}

.btn-go { background: #1e9e57; }
.btn-danger { background: var(--red); }
.btn.btn-ghost {
  background: transparent;
  color: var(--on-surface);
  border: 1px solid var(--outline);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 480px) {
  .stat-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-value { font-size: 16px; }
}

.stat {
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid transparent;
}

.stat-live { border-color: var(--red); }

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-surface-muted);
}

.stat-value {
  font-size: 20px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-variant);
  margin-top: 8px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: var(--red);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mode-card {
  text-align: left;
  background: var(--surface);
  color: var(--on-surface);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.mode-card:hover { background: var(--surface-hover); }
.mode-card.selected { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.mode-card.mode-live.selected { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.mode-title { font-family: "Bangers", cursive; font-size: 22px; letter-spacing: 0.03em; }
.mode-blurb { font-size: 13.5px; color: var(--on-surface-muted); margin-top: 6px; line-height: 1.45; }

.engine-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.engine-bar > div { flex: 1 1 260px; }

.tab-row { margin: 4px 0 14px; }

.signal {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.signal-body { flex: 1; min-width: 0; }

.score {
  flex: 0 0 52px;
  text-align: center;
  cursor: help;
}

.score-num { font-size: 22px; font-variant-numeric: tabular-nums; }
.score-track { height: 4px; border-radius: 999px; background: var(--surface-variant); overflow: hidden; margin-top: 4px; }
.score-fill { height: 100%; background: currentColor; }
.score-high { color: var(--green); }
.score-mid { color: var(--gold); }
.score-low { color: var(--on-surface-muted); }

.check-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--surface-variant);
}

.check-mark {
  flex: 0 0 22px;
  font-size: 18px;
  color: var(--on-surface-muted);
}

.check-item.is-ok .check-mark { color: var(--green); }
.check-item .pill { margin-left: 6px; }
.ip-box { margin-top: 8px; font-size: 14px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 12px;
}

.form-grid-5 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.notice {
  border-color: var(--gold);
  font-size: 14px;
}

.notice-ok { border-color: var(--green); }
.notice-bad { border-color: var(--red); }

.pill {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.pill-long, .pill-ok { color: var(--green); }
.pill-short, .pill-bad { color: var(--red); }
.pill-muted { color: var(--on-surface-muted); }

.strategy-list { margin: 4px 0; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
}

.check-row span:nth-child(2) { flex: 1; }

.signal {
  border-top: 1px solid var(--outline);
  padding: 12px 0;
}

.signal:first-child { border-top: none; }
.signal-sym { cursor: pointer; font-size: 17px; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--outline);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-weight: 500;
  color: var(--on-surface-muted);
  white-space: nowrap;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--on-surface); }
.data-table tbody tr:hover { background: var(--surface-hover); }
.board a { color: var(--on-surface); }
.data-table .col-selected { background: color-mix(in srgb, var(--blue) 12%, transparent); }

/* Money in tables reads better in the body font than in Bangers. */
.data-table .move, .pnl, .stat-value .move {
  font-family: inherit;
  font-size: inherit;
}

.log {
  max-height: 320px;
  overflow-y: auto;
  font-size: 13px;
}

.log-row { padding: 4px 0; border-bottom: 1px solid var(--surface-variant); }
.log-ts { color: var(--on-surface-muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
.log-warn { color: var(--gold); }
.log-error { color: var(--red); }

code {
  background: var(--surface-variant);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  word-break: break-all;
}

.today-headline {
  font-size: 24px;
  margin: 10px 0 14px;
  font-variant-numeric: tabular-nums;
}

.today-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.today-story {
  margin: 8px 0;
  padding-left: 20px;
  line-height: 1.55;
  font-size: 15px;
}

.today-story li { margin: 6px 0; }

.today-verdict {
  border-left: 3px solid var(--gold);
  padding: 8px 12px;
  margin: 12px 0 6px;
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  font-size: 14.5px;
  line-height: 1.5;
}

/* --- Responsive: collapse sidebar into a bottom bar on narrow viewports,
   matching the Android app's bottom nav so the experience feels consistent
   across both. --- */
@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-top: 1px solid var(--outline);
    padding: 6px 4px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 50;
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .sidebar .tabs {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    gap: 0;
  }

  .sidebar .tabs a {
    flex-direction: column;
    gap: 2px;
    font-size: 10.5px;
    padding: 6px 4px;
    flex: 1;
    text-align: center;
    border-radius: 8px;
  }

  .sidebar .tabs a.active {
    box-shadow: none;
  }

  .content-area {
    padding: 16px 14px 92px;
  }

  main#app {
    max-width: 100%;
  }

  h1 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .sidebar .tabs a span:last-child {
    font-size: 10px;
  }
}
