/* ═══ RESET & VARIABLES ═══ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:     #07090f; --bg2:    #0d1117; --bg3:    #151b28; --bg4:    #1c2436;
  --surface:#111722; --surface2:#182030;
  --border: rgba(255,255,255,.06); --border2: rgba(255,255,255,.1);
  --text:   #f1f5f9; --text2:  #a0aec0; --text3: #5a6577;
  --amber:  #f5a623; --amber-dim:  rgba(245,166,35,.12);
  --teal:   #2dd4bf; --teal-dim:   rgba(45,212,191,.1);
  --green:  #34d399; --green-dim:  rgba(52,211,153,.1);
  --red:    #f87171; --red-dim:    rgba(248,113,113,.12);
  --violet: #a78bfa; --violet-dim: rgba(167,139,250,.1);
  --sky:    #38bdf8; --sky-dim:    rgba(56,189,248,.1);
  --sidebar-w: 320px;
  --radius: 14px; --radius-sm: 10px;
}

[data-theme="light"] {
  --bg: #f4f5f7; --bg2: #fff; --bg3: #ebedf0; --bg4: #dfe1e5;
  --surface: #fff; --surface2: #f7f8fa;
  --border: rgba(0,0,0,.09); --border2: rgba(0,0,0,.13);
  --text: #111827; --text2: #4b5563; --text3: #6b7280;
  --amber: #b45309;   --amber-dim:  rgba(180,83,9,.1);
  --teal: #0f766e;    --teal-dim:   rgba(15,118,110,.08);
  --green: #047857;   --green-dim:  rgba(4,120,87,.08);
  --red:  #b91c1c;    --red-dim:    rgba(185,28,28,.08);
  --violet: #6d28d9;  --violet-dim: rgba(109,40,217,.07);
  --sky: #0369a1;     --sky-dim:    rgba(3,105,161,.08);
}

/* ═══ BASE ═══ */
html { font-size: 18px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; height: 100%; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: 0; overflow: hidden; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width .35s cubic-bezier(.4,0,.2,1);
  position: relative; z-index: 20;
}
.sidebar.open { width: var(--sidebar-w); }

.sidebar-head {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(245,166,35,.04) 0%, transparent 100%);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--amber), #e08d12);
  display: flex; align-items: center; justify-content: center;
  color: var(--bg); font-weight: 800; font-size: .85rem;
}
.sidebar-brand h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: -.03em; }
.sidebar-sub { font-size: .68rem; color: var(--text3); letter-spacing: .08em; text-transform: uppercase; margin-left: 48px; margin-top: -2px; }

.report-list { flex: 1; overflow-y: auto; padding: 12px; }
.rl-label { font-size: .6rem; color: var(--text3); letter-spacing: .1em; text-transform: uppercase; padding: 8px 12px 6px; font-weight: 600; }

.report-item {
  padding: 14px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all .2s ease; margin-bottom: 6px; border: 1px solid transparent;
}
.report-item:hover { background: var(--bg3); border-color: var(--border2); }
.report-item.active { background: var(--surface); border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber), 0 0 24px rgba(245,166,35,.06); }

.ri-datetime { font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ri-datetime span { color: var(--amber); margin-left: 6px; }
.ri-summary { font-size: .7rem; color: var(--text2); margin-top: 6px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ri-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.ri-badge { font-size: .55rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; letter-spacing: .02em; background: var(--bg4); color: var(--text3); border: 1px solid var(--border); }

/* ═══ MAIN LAYOUT ═══ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: 56px; background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px; gap: 16px; flex-shrink: 0;
  backdrop-filter: blur(12px);
}
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border2);
  background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: all .2s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--amber); }
.icon-btn svg { width: 18px; height: 18px; }
.topbar-title { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; }
.topbar-sep { width: 1px; height: 20px; background: var(--border2); }
.topbar-date { font-size: .78rem; color: var(--amber); font-weight: 600; font-variant-numeric: tabular-nums; }
.topbar-right { margin-left: auto; }

.content { flex: 1; overflow-y: auto; padding: 32px 40px 80px; max-width: 1340px; width: 100%; margin: 0 auto; }

/* ═══ REPORT HEADER ═══ */
.rpt-header { margin-bottom: 36px; padding-bottom: 24px; border-bottom: 1px solid var(--border); animation: fadeSlideIn .5s ease both; }
.rpt-header h2 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.2; }
.rpt-header .hl { color: var(--amber); }
.rpt-meta { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.rpt-tag { font-size: .65rem; padding: 4px 12px; border-radius: 20px; font-weight: 600; background: var(--bg4); color: var(--text2); border: 1px solid var(--border2); display: flex; align-items: center; gap: 5px; }
.rpt-tag svg { width: 12px; height: 12px; }

/* ═══ SECTIONS ═══ */
.sec { margin-bottom: 36px; animation: fadeSlideIn .5s ease both; }
.sec:nth-child(2) { animation-delay: .05s; }
.sec:nth-child(3) { animation-delay: .1s; }
.sec:nth-child(4) { animation-delay: .15s; }
.sec:nth-child(5) { animation-delay: .2s; }
.sec:nth-child(6) { animation-delay: .25s; }
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.sec-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sec-icon svg { width: 18px; height: 18px; }
.sec-head h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }
.sec-count { font-size: .62rem; color: var(--text3); background: var(--bg4); padding: 3px 10px; border-radius: 8px; font-weight: 600; margin-left: 4px; }
.sec-body { display: grid; gap: 14px; }

/* ═══ SIGNAL CARDS ═══ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; transition: all .25s cubic-bezier(.4,0,.2,1); position: relative; overflow: hidden;
}
.card::before { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .25s; pointer-events: none; border-radius: var(--radius); }
.card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.card:hover::before { opacity: 1; }

.card.score-high::before { background: linear-gradient(135deg, rgba(248,113,113,.04), transparent 60%); }
.card.score-mid::before  { background: linear-gradient(135deg, rgba(245,166,35,.04), transparent 60%); }
.card.score-low::before  { background: linear-gradient(135deg, rgba(52,211,153,.04), transparent 60%); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-title { font-size: .92rem; font-weight: 700; line-height: 1.45; flex: 1; letter-spacing: -.01em; }
.card-pill { font-size: .68rem; font-weight: 700; padding: 3px 12px; border-radius: 8px; white-space: nowrap; flex-shrink: 0; }
.score-high .card-pill { background: var(--red-dim); color: var(--red); }
.score-mid .card-pill  { background: var(--amber-dim); color: var(--amber); }
.score-low .card-pill  { background: var(--green-dim); color: var(--green); }

.card-desc { font-size: .82rem; color: var(--text2); line-height: 1.7; margin-bottom: 12px; }
.card-insight { font-size: .78rem; line-height: 1.65; padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; }
.card-insight.why   { background: var(--sky-dim); color: var(--sky); border: 1px solid rgba(56,189,248,.15); }
.card-insight.action { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,166,35,.15); }
.card-insight-label { font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; opacity: .7; }
.card-foot { font-size: .68rem; color: var(--text3); display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.card-foot a { color: var(--sky); text-decoration: none; font-weight: 500; }
.card-foot a:hover { text-decoration: underline; }

/* ═══ COMMUNITY CARDS ═══ */
.comm-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; transition: all .2s; }
.comm-card:hover { border-color: var(--border2); box-shadow: 0 4px 20px rgba(0,0,0,.3); }
.comm-topic { font-size: .85rem; font-weight: 700; line-height: 1.4; margin-bottom: 6px; }
.comm-signal { font-size: .76rem; color: var(--text2); line-height: 1.55; }
.comm-src { font-size: .62rem; color: var(--text3); margin-top: 8px; font-weight: 600; letter-spacing: .02em; }

/* ═══ ACTION GRID ═══ */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.action-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; transition: all .25s; position: relative; overflow: hidden; }
.action-card:hover { border-color: rgba(52,211,153,.3); box-shadow: 0 4px 24px rgba(52,211,153,.06); }
.ac-num { position: absolute; right: 16px; top: 12px; font-size: 2.2rem; font-weight: 800; color: var(--green); opacity: .1; line-height: 1; }
.ac-text { font-size: .82rem; font-weight: 600; line-height: 1.55; position: relative; }

.noise-section { margin-top: 20px; }
.noise-label { font-size: .72rem; color: var(--text3); font-weight: 700; margin-bottom: 10px; letter-spacing: .04em; }
.noise-item { font-size: .78rem; color: var(--text3); padding: 6px 0; display: flex; align-items: center; gap: 10px; line-height: 1.5; }
.noise-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex-shrink: 0; opacity: .5; }

.watch-section { margin-top: 20px; }
.watch-label { font-size: .72rem; color: var(--teal); font-weight: 700; margin-bottom: 10px; letter-spacing: .04em; }
.watch-item { font-size: .78rem; color: var(--teal); padding: 7px 0; display: flex; align-items: flex-start; gap: 10px; line-height: 1.55; }
.watch-arrow { flex-shrink: 0; margin-top: 2px; opacity: .6; }

/* ═══ EMPTY STATE ═══ */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 120px 40px; color: var(--text3); text-align: center; }
.empty-state .es-icon { font-size: 3rem; margin-bottom: 16px; opacity: .3; }
.empty-state p { font-size: .9rem; line-height: 1.6; }

/* ═══ ANIMATION ═══ */
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 280px; }
  .content { padding: 24px 24px 60px; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 85vw; }
  .content { padding: 16px 16px 40px; }
  .action-grid { grid-template-columns: 1fr; }
  .rpt-header h2 { font-size: 1.3rem; }
  .topbar { padding: 0 16px; gap: 10px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; box-shadow: 8px 0 32px rgba(0,0,0,.5); }
  .sidebar:not(.open) { box-shadow: none; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; display: none; }
  .sidebar-overlay.show { display: block; }
}
