@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:       #07070f;
  --surface:  #0d0d18;
  --surface2: #111120;
  --border:   #1a1a2e;
  --border2:  #232340;
  --text:     #d4d4e8;
  --muted:    #52527a;
  --faint:    #0f0f1e;
  --teal:     #34d09a;
  --purple:   #a78bfa;
  --pink:     #f472b6;
  --blue:     #60a5fa;
  --orange:   #fb923c;
  --red:      #f87171;
  --mono:     'IBM Plex Mono', monospace;
  --sans:     'IBM Plex Sans', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--sans); }

/* ── TOPBAR ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 100;
  background: rgba(7,7,15,.97); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 0;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--text); white-space: nowrap; margin-right: 32px;
}
.topbar-brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pink); flex-shrink: 0; }

/* ── TABS ── */
.tabs { display: flex; align-items: stretch; height: 52px; flex: 1; }
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 0 20px; height: 100%;
  font-size: 12px; font-weight: 500;
  color: var(--muted); border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--pink); }
.tab .num {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 4px; padding: 1px 5px; color: var(--muted);
}
.tab.active .num { color: var(--pink); border-color: rgba(244,114,182,.3); }

/* ── USER MENU ── */
.topbar-user {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
}
.topbar-user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
}
.btn-logout {
  background: none; border: 1px solid var(--border2);
  color: var(--muted); font-size: 10px; font-family: var(--mono);
  padding: 4px 10px; border-radius: 5px;
  transition: border-color .15s, color .15s;
}
.btn-logout:hover { border-color: var(--border); color: var(--text); }

/* ── LAYOUT ── */
.page { padding: 80px 24px 40px; max-width: 1280px; margin: 0 auto; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 20px; font-weight: 600; }
.page-header .sub { font-size: 12px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }

/* ── CARDS ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.card-title {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .15em; color: var(--muted);
  margin-bottom: 16px;
}

/* ── GRID ── */
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
@media (max-width: 900px) { .grid-3,.grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-3,.grid-2,.grid-4 { grid-template-columns: 1fr; } }

/* ── SENTIMENT GAUGE ── */
.gauge-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 20px 16px;
  position: relative; overflow: hidden;
}
.gauge-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--c, var(--teal));
}
.gauge-type {
  font-family: var(--mono); font-size: 8px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--c, var(--teal)); margin-bottom: 4px;
}
.gauge-name { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.gauge-wrap { display: flex; align-items: center; gap: 16px; }
.gauge-svg { flex-shrink: 0; }
.gauge-info { flex: 1; }
.gauge-score {
  font-family: var(--mono); font-size: 28px; font-weight: 600; line-height: 1;
  color: var(--c, var(--teal));
}
.gauge-score span { font-size: 14px; color: var(--muted); font-weight: 400; }
.gauge-label { font-size: 10px; color: var(--muted); margin-top: 2px; }
.gauge-targets { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.gauge-target-row { display: flex; justify-content: space-between; align-items: center; }
.gauge-target-label { font-size: 10px; color: var(--muted); }
.gauge-target-val {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
}
.gauge-bar {
  height: 3px; background: var(--border2); border-radius: 2px; margin-top: 3px;
  position: relative; overflow: hidden;
}
.gauge-bar-fill {
  position: absolute; top: 0; left: 0; height: 100%; border-radius: 2px;
  background: var(--c, var(--teal));
}
.gauge-bar-target {
  position: absolute; top: -1px; height: 5px; width: 2px;
  background: var(--muted); border-radius: 1px;
}

/* ── FAN GROEI ── */
.fan-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.fan-row:last-child { border-bottom: none; }
.fan-name { font-size: 12px; font-weight: 500; width: 160px; flex-shrink: 0; }
.fan-bar-wrap { flex: 1; }
.fan-bar-bg { height: 6px; background: var(--border2); border-radius: 3px; position: relative; }
.fan-bar-fill { height: 6px; border-radius: 3px; background: var(--c); }
.fan-bar-doel {
  position: absolute; top: -2px; height: 10px; width: 2px; border-radius: 1px;
  background: var(--muted);
}
.fan-nums {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  white-space: nowrap; width: 130px; text-align: right;
}
.fan-nums strong { color: var(--text); }

/* ── MERKASSOCIATIES ── */
.assoc-grid {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
}
.assoc-tag {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 4px 12px;
  font-size: var(--fs); color: var(--text);
  transition: border-color .15s;
}
.assoc-tag:hover { border-color: var(--pink); }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.stat-label { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.stat-val { font-family: var(--mono); font-size: 22px; font-weight: 600; margin: 4px 0 2px; }
.stat-sub { font-size: 10px; color: var(--muted); }
.stat-badge {
  display: inline-block; font-family: var(--mono); font-size: 9px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px; margin-top: 6px;
}
.badge-teal { background: rgba(52,208,154,.1); color: var(--teal); border: 1px solid rgba(52,208,154,.2); }
.badge-purple { background: rgba(167,139,250,.1); color: var(--purple); border: 1px solid rgba(167,139,250,.2); }
.badge-blue { background: rgba(96,165,250,.1); color: var(--blue); border: 1px solid rgba(96,165,250,.2); }
.badge-orange { background: rgba(251,146,60,.1); color: var(--orange); border: 1px solid rgba(251,146,60,.2); }
.badge-pink { background: rgba(244,114,182,.1); color: var(--pink); border: 1px solid rgba(244,114,182,.2); }
.badge-red { background: rgba(248,113,113,.1); color: var(--red); border: 1px solid rgba(248,113,113,.2); }

/* ── INSIGHTS ── */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center;
}
.filter-bar select, .filter-bar input {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--sans); font-size: 12px;
  padding: 7px 12px; border-radius: 7px;
  outline: none; transition: border-color .15s;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--purple); }
.filter-bar option { background: var(--surface); }

.bericht-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 12px;
  transition: border-color .15s;
}
.bericht-card:hover { border-color: var(--border2); }
.bericht-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.bericht-type {
  font-family: var(--mono); font-size: 8px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 2px 8px; border-radius: 4px;
}
.type-eigen  { background: rgba(52,208,154,.1); color: var(--teal); }
.type-media  { background: rgba(96,165,250,.1); color: var(--blue); }
.type-extern { background: rgba(167,139,250,.1); color: var(--purple); }
.bericht-bron { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.bericht-datum { font-size: 10px; color: var(--muted); margin-left: auto; font-family: var(--mono); }
.bericht-tekst { font-size: 13px; line-height: 1.55; margin-bottom: 14px; }
.bericht-stats {
  display: flex; gap: 20px; margin-bottom: 14px; flex-wrap: wrap;
}
.b-stat { display: flex; flex-direction: column; gap: 1px; }
.b-stat-label { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.b-stat-val { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.score-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.score-dg-label { font-size: 10px; color: var(--muted); width: 160px; flex-shrink: 0; }
.score-bar-wrap { flex: 1; background: var(--border2); border-radius: 3px; height: 5px; }
.score-bar-fill { height: 5px; border-radius: 3px; }
.score-val { font-family: var(--mono); font-size: 10px; font-weight: 500; width: 28px; text-align: right; }
.score-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.score-tag {
  font-size: 9px; padding: 1px 7px; border-radius: 10px;
}
.tag-mh { background: rgba(52,208,154,.08); color: var(--teal); border: 1px solid rgba(52,208,154,.2); }
.tag-sa { background: rgba(248,113,113,.08); color: var(--red); border: 1px solid rgba(248,113,113,.2); }

/* ── ASSISTANT ── */
.assistant-wrap { display: flex; gap: 20px; height: calc(100vh - 140px); min-height: 500px; }
.chat-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.chat-sidebar-title { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 4px; }
.chat-session-item {
  font-size: 11px; padding: 7px 9px; border-radius: 7px;
  border: 1px solid transparent; cursor: pointer;
  transition: background .12s, border-color .12s;
  line-height: 1.4;
}
.chat-session-item:hover { background: var(--surface2); }
.chat-session-item.active { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.btn-new-chat {
  margin-top: auto; padding: 8px; border-radius: 7px;
  background: none; border: 1px solid var(--border2); color: var(--muted);
  font-size: 11px; transition: all .12s;
}
.btn-new-chat:hover { border-color: var(--purple); color: var(--purple); }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 8px 0 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.chat-msg { display: flex; gap: 10px; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
}
.msg-ai .chat-avatar { background: linear-gradient(135deg, var(--purple), var(--pink)); color: #fff; }
.msg-user .chat-avatar { background: var(--surface2); border: 1px solid var(--border2); color: var(--muted); }
.chat-bubble {
  max-width: 72%; padding: 10px 14px; border-radius: 12px;
  font-size: 13px; line-height: 1.65;
}
.msg-ai .chat-bubble {
  background: var(--surface2); border: 1px solid var(--border2);
  border-top-left-radius: 4px;
}
.msg-user .chat-bubble {
  background: rgba(167,139,250,.12); border: 1px solid rgba(167,139,250,.2);
  border-top-right-radius: 4px; color: var(--text);
}
.chat-bubble p { margin-bottom: 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble strong { color: var(--text); font-weight: 600; }
.chat-bubble ul, .chat-bubble ol { padding-left: 18px; margin-bottom: 8px; }
.chat-bubble li { margin-bottom: 3px; }
.chat-bubble h3 { font-size: 13px; font-weight: 600; margin-bottom: 6px; }

.chat-input-wrap {
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}
.chat-suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chat-suggestion {
  font-size: 10px; padding: 4px 10px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--border2); color: var(--muted);
  cursor: pointer; transition: all .12s;
}
.chat-suggestion:hover { border-color: var(--purple); color: var(--purple); }
.chat-form { display: flex; gap: 8px; }
.chat-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--sans); font-size: 13px;
  padding: 10px 14px; border-radius: 9px; outline: none; resize: none;
  transition: border-color .15s; max-height: 120px;
}
.chat-input:focus { border-color: var(--purple); }
.chat-send {
  background: var(--purple); border: none; color: #fff;
  padding: 0 16px; border-radius: 9px; font-size: 16px;
  transition: opacity .15s; flex-shrink: 0;
}
.chat-send:hover { opacity: .85; }
.chat-send:disabled { opacity: .4; cursor: not-allowed; }
.chat-typing { display: flex; gap: 4px; align-items: center; padding: 6px 4px; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: bounce .9s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

.api-notice {
  padding: 14px 16px; border-radius: 9px; font-size: 12px;
  background: rgba(251,146,60,.07); border: 1px solid rgba(251,146,60,.2); color: var(--orange);
  margin-bottom: 16px;
}
.api-notice strong { display: block; margin-bottom: 4px; }
.api-notice code {
  background: rgba(0,0,0,.3); padding: 1px 5px; border-radius: 3px;
  font-family: var(--mono); font-size: 11px;
}

/* ── LOGIN ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-box {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 32px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .dot-row { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.login-logo .dot-row span { width: 8px; height: 8px; border-radius: 50%; }
.login-logo h1 { font-size: 18px; font-weight: 600; }
.login-logo p { font-size: 11px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-bottom: 6px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.form-group input {
  width: 100%; background: var(--bg); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--sans); font-size: 13px;
  padding: 10px 13px; border-radius: 8px; outline: none;
  transition: border-color .15s;
}
.form-group input:focus { border-color: var(--pink); }
.btn-primary {
  width: 100%; padding: 11px; border-radius: 8px; border: none;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff; font-size: 13px; font-weight: 600;
  transition: opacity .15s; margin-top: 6px;
}
.btn-primary:hover { opacity: .9; }
.login-error {
  background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2);
  color: var(--red); font-size: 12px; padding: 9px 12px; border-radius: 7px; margin-bottom: 14px;
}
.login-creds {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 10px; color: var(--muted); font-family: var(--mono);
}
.login-creds table { width: 100%; }
.login-creds td { padding: 2px 0; }
.login-creds td:last-child { color: var(--text); text-align: right; }

/* ── SECTION DIVIDER ── */
.section { margin-bottom: 28px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-family: var(--mono); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .15em; color: var(--muted); }

/* ── UTILITY ── */
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-mono { font-family: var(--mono); }
.text-teal { color: var(--teal); }
.text-purple { color: var(--purple); }
.text-pink { color: var(--pink); }
.text-blue { color: var(--blue); }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
