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

:root {
  --bg: #04070E;
  --panel: #0A0F1C;
  --panel-2: #0E1424;
  --border: #1B2338;
  --text: #F0F5FF;
  --muted: #7C8AA8;
  --orange: #FF6B35;
  --cyan: #00D4FF;
  --green: #10B981;
  --purple: #A855F7;
  --red: #F0577A;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, rgba(255,107,53,0.08), transparent 40%),
                     radial-gradient(circle at 85% 20%, rgba(0,212,255,0.07), transparent 40%);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', monospace; }

.top-bar {
  text-align: center;
  padding: 8px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--orange);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 30px;
}
.brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 10px var(--orange); }
.brand span { color: var(--muted); font-weight: 500; }

.prompt-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--green);
  margin: 0 0 14px;
  opacity: 0.85;
}
.prompt-line .cursor { display: inline-block; width: 7px; height: 13px; background: var(--green); margin-left: 4px; animation: blink 1.1s steps(1) infinite; vertical-align: -2px; }
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: 32px; margin: 0 0 10px; font-weight: 800; line-height: 1.25;
  background: linear-gradient(90deg, #F0F5FF 30%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin: 0 0 28px; font-size: 15px; max-width: 640px; }

.grid-main {
  display: grid;
  grid-template-columns: 260px 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 1050px) and (min-width: 821px) {
  .grid-main { grid-template-columns: 1fr 1fr; }
  .grid-main .info-card { grid-column: 1 / -1; }
}

.info-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.info-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,107,53,0.10), transparent 55%);
  pointer-events: none;
}
.info-card .tag { font-family: 'JetBrains Mono', monospace; color: var(--orange); font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; }
.info-card h2 { font-size: 20px; line-height: 1.3; margin: 10px 0 12px; font-weight: 700; }
.info-card p { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 0 0 20px; }
.info-card .period-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}
.info-card .period-box b { color: var(--text); display: block; margin-bottom: 4px; font-size: 13.5px; font-family: 'Inter', sans-serif; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0 20px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chrome cửa sổ terminal - chữ ký thị giác của dashboard, khớp với block code trên trang cá nhân của Phong */
.term-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 -20px 16px; padding: 11px 16px;
  background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.term-dots { display: flex; gap: 6px; }
.term-dots span { width: 9px; height: 9px; border-radius: 50%; display: block; }
.term-dots .r { background: #F0577A; }
.term-dots .y { background: #FFC53D; }
.term-dots .g { background: #10B981; }
.term-label { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--muted); }

.mindshare-note {
  font-size: 11.5px; color: var(--muted); margin: 10px 2px 0; font-family: 'JetBrains Mono', monospace;
}

/* Leaderboard (thay treemap) */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 420px;
  overflow-y: auto;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
}
.rank-row:last-child { border-bottom: none; }
.rank-badge {
  width: 32px; flex-shrink: 0; text-align: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--muted); font-size: 15px;
}
.rank-body { flex: 1; min-width: 0; }
.rank-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.rank-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-pct { font-size: 12.5px; color: var(--text); font-weight: 600; }
.rank-bar-track { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.rank-bar-fill { height: 100%; border-radius: 4px; }
.rank-meta { font-size: 10.5px; color: var(--muted); }

/* Topics as grep-style output (thay word cloud) */
.grep-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 420px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
}
.grep-row {
  display: grid;
  grid-template-columns: 28px 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.grep-row:last-child { border-bottom: none; }
.grep-count { font-weight: 700; }
.grep-label { color: var(--text); }
.grep-bar-track { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.grep-bar-fill { display: block; height: 100%; border-radius: 3px; }

/* Moderation log */
.modlog { display: flex; flex-direction: column; gap: 8px; }
.modlog-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 12.5px;
}
.modlog-admin { font-weight: 700; color: var(--text); min-width: 140px; font-family: 'Inter', sans-serif; }
.modlog-tag { padding: 2px 8px; border-radius: 5px; }
.modlog-tag.approved { color: var(--green); background: rgba(16,185,129,0.1); }
.modlog-tag.declined { color: var(--red); background: rgba(240,87,122,0.1); }
.modlog-tag.removed { color: var(--muted); background: rgba(124,138,168,0.1); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
}
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px;
  background: var(--stat-color, var(--orange));
}
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 28px; font-weight: 800; margin: 8px 0 4px; font-family: 'JetBrains Mono', monospace; }
.stat-delta { font-size: 12.5px; font-weight: 600; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }
.stat-delta .period { color: var(--muted); font-weight: 500; display: block; margin-top: 2px; font-family: 'JetBrains Mono', monospace; font-size: 11px; }

.row-2col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.spotlight {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.spotlight-badge {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  background: rgba(255,107,53,0.12); border: 1px solid rgba(255,107,53,0.3); color: var(--orange);
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.spotlight-title { font-size: 16px; font-weight: 700; line-height: 1.4; }
.spotlight-meta { color: var(--muted); font-size: 12.5px; font-family: 'JetBrains Mono', monospace; display: flex; gap: 14px; flex-wrap: wrap; }
.spotlight-link { color: var(--cyan); font-size: 12.5px; text-decoration: none; font-family: 'JetBrains Mono', monospace; }
.spotlight-link:hover { text-decoration: underline; }

.weekday-chart { display: flex; align-items: flex-end; gap: 8px; height: 140px; margin-top: 6px; }
.weekday-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.weekday-bar { width: 100%; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--cyan), var(--purple)); min-height: 4px; }
.weekday-label { font-size: 10.5px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* Sparkline ASCII trong stat card */
.sparkline { font-family: 'JetBrains Mono', monospace; font-size: 15px; letter-spacing: 1px; margin-top: 6px; line-height: 1; }

/* Panel 3 cột: ngày cao điểm / thấp điểm / hiệu suất nội dung */
.pulse-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.pulse-col { padding: 4px 16px; border-left: 1px solid var(--border); }
.pulse-col:first-child { border-left: none; padding-left: 2px; }
.pulse-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.pulse-value { font-size: 20px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.pulse-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pulse-value.peak { color: var(--cyan); }
.pulse-value.quiet { color: var(--muted); }

.loading, .error-box { padding: 60px 20px; text-align: center; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.error-box { color: var(--red); }
.error-box code { background: var(--panel-2); padding: 2px 6px; border-radius: 4px; }

footer.foot {
  margin-top: 30px; text-align: center; color: var(--muted); font-size: 11.5px; font-family: 'JetBrains Mono', monospace;
}

.foot-brand {
  margin-top: 6px; color: var(--orange); letter-spacing: 0.04em;
}

.foot-update {
  margin-top: 4px; color: var(--muted); opacity: 0.7;
}

@media (max-width: 820px) {
  .grid-main { grid-template-columns: 1fr; }
  .row-2col { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
