/* IDX Quant Bot — public dashboard styles.
   Designed for prospects: clean, professional, non-flashy. Light theme
   is safer than dark for business/finance audiences. Mobile-first.    */

:root {
  --bg: #fafaf9;
  --panel: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #1f4e79;
  --green: #1e7a3b;
  --green-soft: #ecfdf5;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --orange: #c2410c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- header ---- */
header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  margin-bottom: 32px;
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.brand h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.brand .tagline {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 540px;
}

.badge {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.badge-operational {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(30, 122, 59, 0.2);
}
.badge-degraded {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(185, 28, 28, 0.2);
}
.badge-unknown {
  background: #f3f4f6;
  color: var(--text-muted);
  border-color: var(--border);
}

/* ---- main sections ---- */
main { padding-bottom: 64px; }
section { margin-bottom: 48px; }
section h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.005em;
}
section .section-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 24px;
  max-width: 720px;
}
section .meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 16px;
}

/* ---- hero metrics ---- */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.metric-value {
  font-size: 1.6rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
.metric-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.metric-sub.up { color: var(--green); }
.metric-sub.down { color: var(--red); }

/* ---- chart ---- */
.chart-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.chart-wrap canvas { width: 100% !important; max-height: 360px; }

/* ---- signal cards ---- */
.signals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.signal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.signal-card .symbol {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
}
.signal-card .symbol .badge-small {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  background: #fef3c7;
  color: #92400e;
}
.signal-card .signal-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.signal-card .signal-row .v {
  font-family: var(--mono);
  color: var(--text);
}

/* ---- portfolio (open + pending) ---- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.portfolio-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.portfolio-block h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.count-pill {
  background: #eef2ff;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.portfolio-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
  font-style: italic;
}
.portfolio-rows { display: flex; flex-direction: column; gap: 8px; }
.portfolio-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
}
.portfolio-row .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.portfolio-row .sym {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
}
.portfolio-row .date {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.portfolio-row .detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.portfolio-row .extended-badge {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  background: #fef3c7;
  color: #92400e;
}
.portfolio-row.is-sell { border-left: 3px solid var(--orange); }
.portfolio-row.is-buy  { border-left: 3px solid var(--green); }

/* ---- trades table ---- */
.trades-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.trades {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.trades th, .trades td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.trades th {
  background: #f9fafb;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.trades td.num, .trades th.num { text-align: right; font-family: var(--mono); }
.trades tr:last-child td { border-bottom: none; }
.trades .pnl-pos { color: var(--green); font-weight: 500; }
.trades .pnl-neg { color: var(--red); font-weight: 500; }

/* ---- caveat ---- */
.caveat {
  background: #fef9c3;
  border: 1px solid #fef08a;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.9rem;
  color: #713f12;
}

/* ---- footer ---- */
footer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
footer p { margin: 4px 0; }
footer .disclaimer { font-size: 0.78rem; max-width: 720px; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .portfolio-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .metric-value { font-size: 1.3rem; }
  .brand h1 { font-size: 1.3rem; }
  section h2 { font-size: 1.15rem; }
}
@media (max-width: 480px) {
  .hero-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}
