@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --ink: #0e1420;
  --ink-soft: #151d2e;
  --panel: #1a2338;
  --panel-raised: #202b45;
  --line: rgba(148, 163, 194, 0.14);
  --line-strong: rgba(148, 163, 194, 0.26);
  --text-hi: #eef1f7;
  --text-mid: #a9b3c9;
  --text-dim: #6b768f;
  --gold: #d4a24e;
  --gold-bright: #e8bc6e;
  --up: #3fb98a;
  --up-glow: rgba(63, 185, 138, 0.16);
  --down: #e05c5c;
  --down-glow: rgba(224, 92, 92, 0.16);
  --flat: #8a93a8;

  --font-display: 'Fraunces', serif;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; }

body {
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(212, 162, 78, 0.08), transparent),
    radial-gradient(900px 500px at 10% 110%, rgba(63, 185, 138, 0.06), transparent),
    var(--ink);
  color: var(--text-hi);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }

/* ============ SHELL & SIDEBAR (3-halaman) ============ */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--ink-soft), var(--ink));
  border-right: 1px solid var(--line);
  padding: 26px 18px; display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh;
}
.page-nav { display: flex; flex-direction: column; gap: 3px; }
.page-nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); padding: 0 10px; margin-bottom: 8px;
}
.page-nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-mid); font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out); position: relative;
}
.page-nav-item:hover { background: var(--panel); color: var(--text-hi); }
.page-nav-item.active { background: var(--panel-raised); color: var(--gold-bright); }
.page-nav-item.active::before {
  content: ''; position: absolute; left: -18px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--gold-bright); border-radius: 0 3px 3px 0;
}
.nav-num {
  width: 20px; height: 20px; border-radius: 6px; background: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--text-dim); flex-shrink: 0;
}
.page-nav-item.active .nav-num { background: rgba(212,162,78,0.18); color: var(--gold-bright); }
.sidebar-footer {
  margin-top: auto; padding: 13px; border-radius: var(--radius-md);
  background: var(--panel); border: 1px solid var(--line); font-size: 11px; color: var(--text-dim); line-height: 1.55;
}
.main { padding: 26px 34px 60px; max-width: 1200px; min-width: 0; overflow-x: hidden; }
.page-section { display: none; }
.page-section.active { display: block; }

.page-title-row { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 14px; }
.page-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.page-subtitle { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }

.stock-select {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 16px; color: var(--text-hi); font-size: 14px; font-family: var(--font-sans); cursor: pointer;
}
.stock-select:focus { outline: none; border-color: var(--gold); }

/* ============ SKOR KOMPOSIT & DETAIL SAHAM ============ */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.score-row { display: flex; align-items: center; gap: 13px; padding: 13px; border-radius: var(--radius-md); background: var(--panel-raised); border: 1px solid var(--line); margin-bottom: 10px; }
.score-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.score-icon svg { width: 18px; height: 18px; }
.score-icon.tek { background: rgba(212, 162, 78, 0.14); color: var(--gold-bright); }
.score-icon.fun { background: rgba(63, 185, 138, 0.14); color: var(--up); }
.score-icon.isu { background: rgba(224, 92, 92, 0.12); color: #e08a5c; }
.score-body { flex: 1; min-width: 0; }
.score-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.score-name { font-size: 12.5px; font-weight: 600; color: var(--text-hi); }
.score-verdict { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; }
.score-verdict.pos { color: var(--up); }
.score-verdict.neg { color: var(--down); }
.score-verdict.neu { color: var(--flat); }
.score-bar-track { height: 5px; background: var(--ink-soft); border-radius: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s var(--ease-out); }

.composite-block {
  padding: 18px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(212,162,78,0.1), rgba(138,147,168,0.06));
  border: 1px solid rgba(212, 162, 78, 0.22); text-align: center; margin-bottom: 14px;
}
.composite-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.composite-score { font-family: var(--font-display); font-size: 38px; font-weight: 600; color: var(--gold-bright); line-height: 1; }
.composite-tag { display: inline-block; margin-top: 9px; font-size: 11.5px; font-weight: 700; padding: 5px 13px; border-radius: 100px; letter-spacing: 0.02em; }

.news-feed { display: flex; flex-direction: column; gap: 2px; }
.news-item { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-sentiment { width: 6px; border-radius: 4px; flex-shrink: 0; margin-top: 2px; }
.news-sentiment.positif { background: var(--up); }
.news-sentiment.negatif { background: var(--down); }
.news-sentiment.netral { background: var(--flat); }
.news-body { flex: 1; min-width: 0; }
.news-title { font-size: 12px; font-weight: 600; color: var(--text-hi); line-height: 1.4; margin-bottom: 4px; }
.news-meta { font-size: 10px; color: var(--text-dim); display: flex; gap: 8px; align-items: center; }
.impact-tag { font-family: var(--font-mono); font-weight: 700; font-size: 9px; padding: 2px 6px; border-radius: 4px; }
.impact-tag.tinggi { background: rgba(224,92,92,0.14); color: #ef8080; }
.impact-tag.sedang { background: rgba(212,162,78,0.14); color: var(--gold-bright); }
.impact-tag.rendah { background: rgba(138,147,168,0.12); color: var(--flat); }

.conclusion-box {
  margin-top: 14px; padding: 15px 17px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(212,162,78,0.1), rgba(138,147,168,0.06)); border: 1px solid rgba(212, 162, 78, 0.22);
}
.conclusion-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-bright); margin-bottom: 7px; }
.conclusion-text { font-size: 12.5px; color: var(--text-hi); line-height: 1.6; }

.btn-copy-request {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel-raised); border: 1px solid var(--line); border-radius: 100px;
  padding: 10px 18px; color: var(--gold-bright); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all 0.2s var(--ease-out); margin-top: 8px;
}
.btn-copy-request:hover { border-color: var(--gold); }
.btn-copy-request svg { width: 15px; height: 15px; }

@media (max-width: 860px) {
  .grid-2col { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px; }
}

/* ============ HEADER ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold) 60%, #a9762e);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink);
  box-shadow: 0 4px 14px rgba(212, 162, 78, 0.35);
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.brand-sub { font-size: 10.5px; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.btn-reload {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 100px;
  padding: 10px 18px; color: var(--gold-bright); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.btn-reload:hover { border-color: var(--gold); background: rgba(212,162,78,0.08); }
.btn-reload:disabled { opacity: 0.5; cursor: wait; }
.btn-reload svg { width: 16px; height: 16px; transition: transform 0.6s var(--ease-out); }
.btn-reload.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ STATUS BAR ============ */
.status-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 16px; margin-bottom: 20px; font-size: 12.5px; color: var(--text-mid);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.ok { background: var(--up); box-shadow: 0 0 0 3px var(--up-glow); }
.status-dot.loading { background: var(--gold-bright); animation: pulse 1s ease-in-out infinite; }
.status-dot.error { background: var(--down); box-shadow: 0 0 0 3px var(--down-glow); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.status-bar strong { color: var(--text-hi); }

/* ============ CARDS ============ */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 12px 30px -18px rgba(0,0,0,0.5);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.card-head.collapsible { cursor: pointer; user-select: none; }
.card-title { font-size: 13.5px; font-weight: 700; }
.card-title .card-sub { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-dim); margin-top: 2px; }
.collapse-icon { width: 18px; height: 18px; color: var(--text-dim); transition: transform 0.25s var(--ease-out); flex-shrink: 0; }
.card.collapsed .collapse-icon { transform: rotate(-90deg); }
.card-body { overflow: hidden; }
.card.collapsed .card-body { display: none; }

.tab-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-btn {
  border: 1px solid var(--line); background: var(--panel-raised); color: var(--text-mid);
  font-size: 12.5px; font-weight: 600; padding: 8px 16px; border-radius: 100px; cursor: pointer;
  transition: all 0.18s var(--ease-out);
}
.tab-btn:hover { border-color: rgba(212,162,78,0.3); color: var(--text-hi); }
.tab-btn.active { background: rgba(212,162,78,0.14); border-color: rgba(212,162,78,0.4); color: var(--gold-bright); }

/* ============ TABLE ============ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); font-weight: 700; padding-bottom: 11px; border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.data-table th:not(:first-child), .data-table td:not(:first-child) { text-align: right; }
.data-table td { padding: 11px 8px 11px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.data-table tr:last-child td { border-bottom: none; }
.sym { font-weight: 700; font-family: var(--font-mono); }
.sym-name { font-size: 10px; color: var(--text-dim); font-weight: 500; }
.chg-up { color: var(--up); font-weight: 700; }
.chg-down { color: var(--down); font-weight: 700; }
.sector-tag { font-size: 10.5px; color: var(--text-dim); }

.rating-badge {
  font-size: 9.5px; font-weight: 700; padding: 3px 8px; border-radius: 100px; text-transform: uppercase; white-space: nowrap;
}
.rating-badge.strong-buy { background: var(--up-glow); color: var(--up); }
.rating-badge.buy { background: rgba(63,185,138,0.1); color: var(--up); }
.rating-badge.neutral { background: rgba(138,147,168,0.14); color: var(--flat); }
.rating-badge.sell,
.rating-badge.strong-sell { background: var(--down-glow); color: var(--down); }
.rating-badge.no-rating { background: rgba(138,147,168,0.08); color: var(--text-dim); }

.skeleton-row td { color: transparent !important; position: relative; }
.skeleton-row td::before {
  content: ''; position: absolute; left: 0; right: 8px; top: 50%; height: 12px;
  transform: translateY(-50%); border-radius: 4px;
  background: linear-gradient(90deg, var(--panel-raised) 25%, var(--line) 50%, var(--panel-raised) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-note { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.error-box {
  background: rgba(224,92,92,0.08); border: 1px solid rgba(224,92,92,0.28);
  color: #ef8080; padding: 13px 16px; border-radius: var(--radius-md); font-size: 12.5px; line-height: 1.6;
}

@media (max-width: 720px) {
  .wrap { padding: 20px 16px 40px; }
  .data-table { font-size: 11px; }
}
