/* dashboard.css — Econiq.ai client dashboard */

html, body { height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; }

/* ── TOPBAR ─────────────────────────────────── */
.topbar {
  height: 52px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.2rem;
  gap: 2rem;
  flex-shrink: 0;
}
.brand img {
  width: 110px;
  height: auto;
  display: block;
  object-fit: contain;
}
.stat-pill { display: flex; align-items: center; gap: .4rem; font-size: .82rem; }
.stat-pill .dot  { width: 8px; height: 8px; border-radius: 50%; }
.dot.green  { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.stat-pill .val  { font-weight: 700; font-size: 1rem; margin-left: .2rem; }
.stat-pill .lbl  { color: var(--muted); }
.topbar-right    { margin-left: auto; display: flex; gap: .8rem; align-items: center; }
.icon-btn {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: .3rem; border-radius: 6px;
  font-size: 1rem; transition: .15s;
}
.icon-btn:hover { background: var(--border); color: var(--text); }

/* ── LAYOUT ──────────────────────────────────── */
.layout { display: flex; flex: 1; overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: 200px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: .8rem 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .7rem 1.1rem .3rem;
}
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1.1rem;
  font-size: .84rem;
  color: var(--muted);
  cursor: pointer;
  transition: .1s;
  border-left: 3px solid transparent;
  user-select: none;
}
.nav-item:hover  { background: #21262d; color: var(--text); }
.nav-item.active { background: #1f2d3d; color: var(--accent); border-left-color: var(--accent); }
.nav-item .icon  { font-size: .9rem; width: 16px; text-align: center; }
.nav-bottom      { margin-top: auto; border-top: 1px solid var(--border); padding-top: .5rem; }

/* ── MAIN ────────────────────────────────────── */
.main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.page { display: none; flex: 1; overflow-y: auto; padding: 1rem; flex-direction: column; gap: 1rem; }
.page.active { display: flex; }

/* ── TOP CARDS ───────────────────────────────── */
.top-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.top-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .8rem 1rem;
}
.top-card .tc-val { font-size: 1.5rem; font-weight: 700; }
.top-card .tc-lbl { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.top-card .tc-sub { font-size: .75rem; margin-top: .3rem; }
.top-card.green  .tc-val { color: var(--green); }
.top-card.orange .tc-val { color: var(--orange); }
.top-card.accent .tc-val { color: var(--accent); }
.top-card.yellow .tc-val { color: var(--yellow); }

/* ── PANEL ───────────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.panel-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
}
.panel-title  { font-size: .95rem; font-weight: 600; }
.filter-row   { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-left: auto; }

/* ── SIGNAL TABLE ────────────────────────────── */
.signal-table { width: 100%; border-collapse: collapse; }
.signal-table th {
  font-size: .75rem; color: var(--muted); font-weight: 500;
  padding: .55rem 1rem; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.signal-table td {
  font-size: .82rem; padding: .6rem 1rem;
  border-bottom: 1px solid #21262d; white-space: nowrap;
}
.signal-table tr:last-child td { border-bottom: none; }
.signal-table tr.clickable      { cursor: pointer; transition: .1s; }
.signal-table tr.clickable:hover td { background: #21262d; }
.signal-table tr.selected td        { background: #1f2d3d; }
.ago { color: var(--muted); font-size: .78rem; }

/* ── BOTTOM ROW ──────────────────────────────── */
.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── OPPORTUNITIES TABLE ─────────────────────── */
.opp-table { width: 100%; border-collapse: collapse; }
.opp-table th {
  font-size: .74rem; color: var(--muted); font-weight: 500;
  padding: .5rem .8rem; border-bottom: 1px solid var(--border); text-align: left;
}
.opp-table td { font-size: .82rem; padding: .55rem .8rem; border-bottom: 1px solid #21262d; }
.opp-table tr:last-child td { border-bottom: none; }
.rank-badge {
  width: 22px; height: 22px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: #fff;
}
.rank-1 { background: #d29922; }
.rank-2 { background: #8b949e; }
.rank-3 { background: #c96442; }

/* ── MARKET OVERVIEW ─────────────────────────── */
.overview-list { display: flex; flex-direction: column; gap: .5rem; padding: .5rem .8rem 1rem; }
.ov-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem .8rem; background: #21262d; border-radius: 8px;
}
.ov-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.ov-icon.green  { background: #3fb95018; }
.ov-icon.blue   { background: #58a6ff18; }
.ov-icon.orange { background: #f7816618; }
.ov-main { flex: 1; }
.ov-type    { font-size: .8rem; font-weight: 600; }
.ov-product { font-size: .73rem; color: var(--muted); }
.ov-val     { font-size: .82rem; font-weight: 700; margin-left: auto; }
.ov-val.up  { color: var(--orange); }
.ov-val.down{ color: var(--green); }

/* ── RIGHT PANEL ─────────────────────────────── */
.right-panel {
  width: 0;
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  flex-shrink: 0; overflow: hidden;
  display: flex; flex-direction: column;
  transition: width .2s ease;
}
.right-panel.open { width: 300px; }
.rp-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  white-space: nowrap;
}
.rp-title { font-size: .88rem; font-weight: 600; }
.rp-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1.1rem; padding: .2rem .4rem;
  border-radius: 4px; line-height: 1;
}
.rp-close:hover { background: var(--border); color: var(--text); }
.rp-body {
  padding: 1rem; display: flex; flex-direction: column;
  gap: 1rem; flex: 1; overflow-y: auto; min-width: 268px;
}
.rp-signal-type { font-size: .75rem; font-weight: 800; letter-spacing: .05em; }
.rp-product     { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.rp-metrics     { display: flex; flex-direction: column; gap: .5rem; }
.rp-metric      { display: flex; justify-content: space-between; font-size: .82rem; gap: .5rem; }
.rp-metric .mk  { color: var(--muted); flex-shrink: 0; }
.rp-metric .mv  { font-weight: 700; text-align: right; }
.mv.up      { color: var(--orange); }
.mv.down    { color: var(--green); }
.mv.neutral { color: var(--accent); }
.rp-section-title {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: .4rem; padding-top: .4rem;
  border-top: 1px solid var(--border);
}
.rp-actions { display: flex; flex-direction: column; gap: .4rem; }
.rp-action  { font-size: .8rem; color: var(--muted); display: flex; gap: .5rem; line-height: 1.4; }
.rp-action::before { content: "•"; color: var(--accent); }
.rp-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex: 1; color: var(--muted);
  font-size: .85rem; gap: .5rem; text-align: center; padding: 2rem;
}

/* ── SPARKLINE CHART ─────────────────────────── */
.chart-wrap        { position: relative; height: 80px; }
.chart-wrap svg    { width: 100%; height: 100%; }
.chart-label       { position: absolute; right: 4px; bottom: 4px; font-size: .68rem; color: var(--accent); }

/* ── PAGE: MARKET MAP ────────────────────────── */
.province-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; padding: .8rem; }
.prov-card     { background: #21262d; border-radius: 8px; padding: .7rem .9rem; }
.prov-name     { font-size: .83rem; font-weight: 600; margin-bottom: .4rem; }
.prov-items    { display: flex; flex-direction: column; gap: .2rem; }
.prov-item     { display: flex; justify-content: space-between; font-size: .76rem; }
.prov-item .pk { color: var(--muted); }
.prov-item .pv { font-weight: 600; }
.pv.high { color: var(--orange); }
.pv.med  { color: var(--yellow); }
.pv.low  { color: var(--green); }

/* ── PAGE: DATA EXPLORER ─────────────────────── */
.data-controls {
  display: flex; gap: .8rem; padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; align-items: center;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: .75rem; color: var(--muted); padding: .5rem .8rem; border-bottom: 1px solid var(--border); text-align: left; }
.data-table td { font-size: .82rem; padding: .5rem .8rem; border-bottom: 1px solid #21262d; }
.data-table tr:last-child td { border-bottom: none; }
.plat-tok { color: #03AC0B; }
.plat-sho { color: #EE4420; }
.plat-laz { color: #6366f1; }

/* ── PAGE: API USAGE ─────────────────────────── */
.usage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; padding: .8rem; }
.usage-card { background: #21262d; border-radius: 8px; padding: .9rem 1rem; }
.usage-val  { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.usage-lbl  { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.sub-list   { padding: .5rem .8rem 1rem; display: flex; flex-direction: column; gap: .4rem; }
.sub-item   { display: flex; justify-content: space-between; align-items: center; padding: .5rem .7rem; background: #21262d; border-radius: 6px; font-size: .82rem; }
.sub-badge  { font-size: .7rem; padding: .15rem .4rem; border-radius: 4px; background: #3fb95018; color: #3fb950; border: 1px solid #3fb95030; font-weight: 600; }

/* ── PAGE: ACCOUNT ───────────────────────────── */
.account-profile { padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.avatar {
  width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, #58a6ff, #a371f7);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
}
.profile-name  { font-size: 1.1rem; font-weight: 700; }
.profile-email { font-size: .82rem; color: var(--muted); }
.key-box {
  background: #21262d; border-radius: 8px; padding: .7rem .9rem;
  font-family: monospace; font-size: .75rem; color: var(--muted);
  word-break: break-all; cursor: pointer; border: 1px solid var(--border);
}
.key-box:hover { border-color: var(--accent); }

/* ── DEMAND CARDS (right panel) ──────────────── */
.demand-card { background: #21262d; border-radius: 8px; padding: .6rem .8rem; display: flex; flex-direction: column; gap: .3rem; }
.dc-header   { display: flex; align-items: center; gap: .5rem; }
.dc-source   { font-size: .68rem; font-weight: 700; padding: .15rem .4rem; border-radius: 4px; }
.src-tiktok   { background: #FE2C5522; color: #FE2C55; border: 1px solid #FE2C5544; }
.src-gtrends  { background: #4285F422; color: #4285F4; border: 1px solid #4285F444; }
.src-facebook { background: #1877F222; color: #1877F2; border: 1px solid #1877F244; }
.dc-author  { font-size: .78rem; font-weight: 600; flex: 1; }
.dc-intent  { font-size: .68rem; padding: .1rem .35rem; border-radius: 4px; }
.intent-beli  { background: #3fb95018; color: #3fb950; border: 1px solid #3fb95030; }
.intent-tanya { background: #58a6ff18; color: #58a6ff; border: 1px solid #58a6ff30; }
.intent-cari  { background: #a371f718; color: #a371f7; border: 1px solid #a371f730; }
.dc-text { font-size: .8rem; color: var(--text); line-height: 1.4; font-style: italic; }
.dc-loc  { font-size: .72rem; color: var(--muted); }
.dc-time { font-size: .68rem; color: #475569; }
.demand-load { text-align: center; color: var(--muted); font-size: .8rem; padding: .8rem; }
