:root {
  --bg: #031427;
  --surface: #0f172a;
  --surface-2: #1e293b;
  --text: #e8f0ff;
  --muted: #b7c3d9;
  --outline: #5b6578;
  --accent: #38bdf8;
  --accent-soft: #7dd3fc;
  --bull: #34d399;
  --bear: #f87171;
  --gold: #ffb95f;
  --radius: 8px;
  --line: rgba(255,255,255,.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}
a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: #fff; }

.data-mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 13px;
}
.label-caps {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.muted, .page-sub, .small { color: var(--muted); }
.small { font-size: .85rem; }
.bull { color: var(--bull); }
.bear { color: var(--bear); }
.fw { font-weight: 700; }
.mb { margin-bottom: .65rem; }
.mb-2 { margin-bottom: .75rem; }
.mb-3 { margin-bottom: 1rem; }
.pad { padding: 1rem 0; }

.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side-nav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex; flex-direction: column;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.brand-name { font-weight: 700; font-size: 18px; color: #fff; }
.brand-sub { font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.side-links { display: flex; flex-direction: column; gap: 4px; margin-top: 1.5rem; }
.side-nav .nav-link {
  color: #d5deef;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex; gap: 10px; align-items: center;
}
.side-nav .nav-link:hover,
.side-nav .nav-link.active {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.side-footer { margin-top: auto; }

.main-pane { display: flex; flex-direction: column; min-width: 0; }
.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(3,20,39,.92);
}
.user-chip { display: flex; gap: 10px; align-items: center; }
.badge-role {
  font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid var(--outline); border-radius: 4px;
  padding: 2px 8px; color: var(--accent-soft);
}
.content { padding: 24px; max-width: 1600px; }

.page-title {
  color: #fff;
  font-weight: 700;
  font-size: 1.6rem;
  margin: 0 0 .25rem;
}
.page-sub { margin: 0; font-size: .95rem; line-height: 1.5; }

.row-between { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.toggles { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.btn {
  display: inline-block; border: 1px solid var(--line); background: rgba(255,255,255,.04);
  color: var(--text); padding: .35rem .7rem; border-radius: 6px; cursor: pointer; font-size: .85rem;
}
.btn-primary { background: rgba(56,189,248,.18); border-color: rgba(56,189,248,.45); color: #fff; }
.btn-ghost, .btn-outline { background: transparent; border-color: rgba(255,255,255,.2); }
.btn-sm { font-size: .78rem; padding: .25rem .55rem; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 1rem 0 1.1rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.kpi .v, .kpi .value {
  font-size: 28px; font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  color: #fff;
}
.kpi .l, .kpi .label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.card-intel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-top: 2px solid var(--accent);
  padding: 16px;
  margin-bottom: 1rem;
}
.card-intel.gold { border-top-color: var(--gold); }
.card-intel.bull { border-top-color: var(--bull); }
.card-intel.bear { border-top-color: var(--bear); }

.sector-heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .65rem;
}
.sector-tile, .sector-heat-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem .75rem;
  background: rgba(255,255,255,.03);
}
.tone-hot { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.07); }
.tone-cold { border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.07); }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.table-wrap { overflow: auto; }
table.table-darkish, .card table, .card-intel table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.table-darkish th, .card table th, .card-intel table th,
table.table-darkish td, .card table td, .card-intel table td {
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.table-darkish th, .card table th, .card-intel table th {
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
tr.hot td { background: rgba(52,211,153,.07); }

.chip {
  display: inline-flex; align-items: center; border-radius: 4px;
  padding: 2px 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px; font-weight: 600;
}
.chip-buy { background: rgba(52,211,153,.18); color: #6ee7b7; }
.chip-hold, .chip-watch { background: rgba(125,208,255,.16); color: #7dd3fc; }
.chip-bear, .chip-avoid { background: rgba(248,113,113,.18); color: #fca5a5; }

.alert {
  margin: .75rem 0; padding: .65rem .8rem; border-radius: 8px;
  border: 1px solid rgba(251,191,36,.35); background: rgba(251,191,36,.08); color: #fde68a;
}
.alert-bad { border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.1); color: #fecaca; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: 100%; max-width: 380px; padding: 1.4rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.login-card label { display: block; margin: .7rem 0 .25rem; font-size: .8rem; color: var(--muted); }
.login-card input {
  width: 100%; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--line);
  background: #031427; color: var(--text);
}
.login-card .btn { width: 100%; margin-top: 1rem; text-align: center; }

.codeblock {
  margin: 0;
  padding: .85rem 1rem;
  overflow: auto;
  background: #070b14;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: .78rem;
  line-height: 1.45;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-all;
}
.pad-card { padding: 1rem 1.1rem; }
.block { margin: 1.25rem 0; }
.hero .sub { margin-top: .35rem; }
.rule {
  border-left: 3px solid var(--accent);
  padding: .55rem .8rem;
  background: rgba(56,189,248,.08);
  border-radius: 0 8px 8px 0;
  margin: .75rem 0;
}
.h5 { font-size: 1.05rem; font-weight: 600; margin: .15rem 0 .35rem; }
.kpis { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin: .9rem 0; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-nav { border-right: 0; border-bottom: 1px solid var(--line); }
  .side-links { flex-direction: row; flex-wrap: wrap; }
  .side-footer { margin-top: .75rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
}

/* Recommendation Details */
.detail-page { max-width: 1100px; }
.detail-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 80% 120% at 0% 0%, rgba(56, 189, 248, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--line);
}
.detail-symbol {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0;
  line-height: 1.1;
}
.detail-hero-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}
.detail-company { color: var(--muted); margin: 0 0 1rem; font-size: 0.95rem; }
.detail-plan-banner {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: rgba(0, 0, 0, 0.25);
}
.detail-plan-banner strong { font-size: 1.05rem; color: #fff; }
.detail-plan-banner.tone-ok { border-left-color: var(--bull); background: rgba(52, 211, 153, 0.1); }
.detail-plan-banner.tone-soft { border-left-color: #7dd3fc; background: rgba(125, 211, 252, 0.08); }
.detail-plan-banner.tone-warn { border-left-color: var(--gold); background: rgba(255, 185, 95, 0.1); }
.detail-plan-banner.tone-bad { border-left-color: var(--bear); background: rgba(248, 113, 113, 0.12); }
.detail-hero-price { text-align: right; align-self: center; }
.detail-cmp {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  color: #fff;
  line-height: 1.1;
}
.detail-chg { font-size: 1.05rem; margin-top: 0.25rem; }
.detail-price-meta { margin-top: 0.35rem; }

.detail-plan {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.detail-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.detail-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.detail-plan-tile {
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.detail-plan-tile.focus {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.08);
}
.detail-plan-tile.stop { border-color: rgba(248, 113, 113, 0.28); }
.detail-plan-tile.target { border-color: rgba(255, 185, 95, 0.28); }
.detail-plan-val {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin: 0.35rem 0 0.25rem;
  word-break: break-word;
}
.detail-plan-tile.focus .detail-plan-val { color: #6ee7b7; }
.detail-plan-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.detail-plan-meta .data-mono { font-size: 0.95rem; color: #fff; }

.detail-score { font-size: 2rem; font-weight: 600; color: #fff; }
.detail-score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.progress {
  height: 6px;
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #34d399);
}
.detail-ai-why { margin: 1rem 0; line-height: 1.55; color: var(--text); }
.detail-ai-list { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.detail-ai-list li { margin-bottom: .35rem; }

.tios-chart {
  width: 100%;
  height: 380px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15,23,42,.55), rgba(2,6,23,.35));
}
.btn.active { background: rgba(56,189,248,.22); border-color: rgba(56,189,248,.5); color: #fff; }

.journal-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .65rem;
  align-items: end;
}
.journal-form label { display: flex; flex-direction: column; gap: .25rem; }
.form-control {
  width: 100%;
  padding: .45rem .55rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #031427;
  color: var(--text);
}
.detail-journal .btn { height: 2.35rem; }

.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: end;
}
.report-filters label { display: flex; flex-direction: column; gap: .25rem; min-width: 8rem; }

.brief-hero {
  padding: 1.25rem 1.35rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 70% 100% at 0% 0%, rgba(56,189,248,.12), transparent 55%),
    var(--surface);
}
.brief-posture {
  padding: .75rem .9rem;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: rgba(0,0,0,.25);
  font-size: 1.02rem;
  color: #fff;
}
.brief-pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
}
.brief-step {
  padding: .85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}
.brief-step-num { color: var(--accent-soft); font-size: 1.1rem; margin-bottom: .25rem; }
.brief-step-title { font-weight: 650; margin-bottom: .25rem; }
.brief-client-bar {
  padding: .65rem .85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.3);
}

@media (max-width: 900px) {
  .detail-hero { grid-template-columns: 1fr; }
  .detail-hero-price { text-align: left; }
  .detail-plan-grid { grid-template-columns: 1fr 1fr; }
  .detail-score-row { grid-template-columns: 1fr; }
  .journal-form { grid-template-columns: 1fr 1fr; }
}
