/* ══════════════════════════════════════════════════════
   Lupa World — design system
   ══════════════════════════════════════════════════════ */
:root {
  color-scheme: dark;
  --bg: #02040a;
  --panel: rgba(10, 14, 24, 0.74);
  --panel-strong: rgba(12, 17, 29, 0.92);
  --panel-solid: #0b101b;
  --raise: rgba(255, 255, 255, 0.04);
  --raise-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eef2f8;
  --text-2: #c3cad6;
  --muted: #8a94a7;
  --faint: #5d6678;
  --gold: #f5c451;
  --gold-soft: rgba(245, 196, 81, 0.14);
  --eco: #3ddc97;
  --eco-soft: rgba(61, 220, 151, 0.13);
  --geo: #ff6b7d;
  --geo-soft: rgba(255, 107, 125, 0.13);
  --other: #94a3b8;
  --other-soft: rgba(148, 163, 184, 0.12);
  --danger: #ff5d6c;
  --success: #3ddc97;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--line);
  --blur: saturate(160%) blur(22px);
  --top-h: 64px;
  --ticker-h: 34px;
  --panel-top: calc(var(--top-h) + var(--ticker-h) + 14px);
  --gap: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.16); }
::-webkit-scrollbar-track { background: transparent; }

/* ── Buttons & primitives ─────────────────────────────── */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 11px;
  color: var(--text-2);
  transition: background .2s, color .2s, transform .15s;
}
.icon-btn:hover { background: var(--raise-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.small { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.small .icon { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255, 93, 108, .1); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 12px;
  background: var(--raise-2); color: var(--text);
  border: 1px solid var(--line);
  font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background .2s, border-color .2s, transform .15s, opacity .2s;
}
.btn:hover { background: rgba(255,255,255,.11); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { background: var(--text); color: #05070d; border-color: transparent; }
.btn.primary:hover { background: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--raise-2); }
.btn.small { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 38px; padding: 0; }
.btn.active { border-color: var(--gold); color: var(--gold); }

.chip-btn {
  height: 32px; padding: 0 11px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--raise);
  font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--text-2);
}
.chip-btn:hover { border-color: var(--line-2); color: var(--text); }

.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.14); border-top-color: var(--gold);
  animation: spin .8s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px;
}
.muted { color: var(--muted); }
.dim { color: var(--faint); }

.chip-topic {
  --c: var(--other); --s: var(--other-soft);
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 99px;
  background: var(--s); color: var(--c);
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.chip-topic::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Topic colours (defined after component defaults, so higher specificity wins) */

.lean {
  height: 22px; padding: 0 8px; border-radius: 6px; display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; background: var(--raise-2); color: var(--text-2);
}
.lean[data-lean="left"] { color: #fca5a5; background: rgba(248, 113, 113, .1); }
.lean[data-lean="right"] { color: #93c5fd; background: rgba(96, 165, 250, .1); }

/* ── Globe ────────────────────────────────────────────── */
.globe { position: fixed; inset: 0; z-index: 0; }
.globe-canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1.4s var(--ease); touch-action: none; cursor: grab; }
.globe.ready .globe-canvas { opacity: 1; }
.globe.ready .globe-loader { opacity: 0; pointer-events: none; }
.globe-loader {
  position: absolute; inset: 0; display: grid; place-items: center;
  transition: opacity .8s;
}
.loader-orb {
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(124,196,255,.35), rgba(20,50,100,.15) 55%, transparent 70%);
  box-shadow: 0 0 80px rgba(80,150,255,.18);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.06); opacity: .7; } }
.no-webgl-msg { display: none; }
.globe.no-webgl .no-webgl-msg { display: block; position: absolute; top: 45%; width: 100%; text-align: center; color: var(--muted); }
.globe.no-webgl .globe-loader { display: none; }
.globe.picking::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--gold);
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(2,4,10,.55) 100%),
    linear-gradient(to bottom, rgba(2,4,10,.85), transparent 160px);
}

/* Markers */
.marker-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.marker {
  --c: var(--other);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  pointer-events: auto; display: grid; place-items: center;
  will-change: transform, opacity;
}
.marker-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px rgba(2,4,10,.65), 0 0 12px 2px var(--c);
  transition: transform .2s var(--ease);
}
.marker-ring {
  position: absolute; inset: 3px; border-radius: 50%;
  border: 1.5px solid var(--c); opacity: 0;
}
.marker.fresh .marker-ring { animation: ping 2.4s var(--ease) infinite; }
.marker:hover .marker-dot, .marker.highlight .marker-dot { transform: scale(1.7); }
.marker.highlight { z-index: 2; }
.marker.highlight .marker-ring { animation: ping 1.2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(2.2); opacity: 0; } }

.country-label {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 5;
  padding: 7px 14px; border-radius: 99px;
  background: var(--panel); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); color: var(--text-2);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  pointer-events: none;
}

.hover-card {
  position: fixed; left: 0; top: 0; z-index: 30; width: 300px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--panel-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow); pointer-events: none;
}
.hc-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.hc-time { margin-left: auto; color: var(--muted); }
.hc-title { margin: 8px 0 12px; font-family: var(--serif); font-size: 20px; line-height: 1.15; }
.hc-foot { display: flex; align-items: center; justify-content: space-between; }
.hc-cta { font-size: 12px; color: var(--gold); font-weight: 500; }

.globe-controls {
  position: fixed; z-index: 6; bottom: 22px;
  left: calc(var(--radar-w, 0px) + 36px);
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}

/* ── Top bar ──────────────────────────────────────────── */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 20px; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, rgba(245,196,81,.22), rgba(245,196,81,.04));
  border: 1px solid rgba(245,196,81,.35); color: var(--gold);
  box-shadow: 0 0 24px rgba(245,196,81,.12);
}
.brand-mark .icon { width: 20px; height: 20px; stroke-width: 2.2; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 24px; letter-spacing: .01em; }
.brand-name em { font-style: italic; color: var(--gold); }
.brand-tag { font-size: 11px; color: var(--muted); letter-spacing: .02em; white-space: nowrap; }

.topics {
  display: flex; gap: 2px; padding: 4px; margin: 0 auto;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.topic {
  --c: var(--gold);
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap;
  transition: color .2s, background .2s;
}
.topic[data-topic="economia"] { --c: var(--eco); }
.topic[data-topic="geopolitica"] { --c: var(--geo); }
.topic[data-topic="all"] { --c: var(--other); }
.topic-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); opacity: .5; transition: opacity .2s, box-shadow .2s; }
.topic[data-topic="focus"] .topic-dot { background: linear-gradient(135deg, var(--eco) 50%, var(--geo) 50%); }
.topic:hover { color: var(--text); }
.topic.active { color: var(--text); background: var(--raise-2); box-shadow: inset 0 0 0 1px var(--line); }
.topic.active .topic-dot { opacity: 1; box-shadow: 0 0 10px var(--c); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.live-status {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: 10px; font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  white-space: nowrap;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 0 rgba(255,93,108,.6); animation: live 1.8s infinite; }
.live-status.busy .live-dot { background: var(--gold); }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(255,93,108,0); } 100% { box-shadow: 0 0 0 0 rgba(255,93,108,0); } }
.live-label { color: var(--text); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.live-sep { width: 1px; height: 14px; background: var(--line-2); }

/* ── Ticker ───────────────────────────────────────────── */
.ticker {
  position: fixed; top: var(--top-h); left: 0; right: 0; z-index: 19; height: var(--ticker-h);
  overflow: hidden; border-block: 1px solid var(--line);
  background: rgba(5, 8, 15, .66); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker-track {
  display: flex; width: max-content; height: 100%; align-items: center;
  animation: ticker var(--ticker-duration, 120s) linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }
.tick {
  --c: var(--other);
  display: inline-flex; align-items: center; gap: 8px; padding: 0 22px;
  height: 100%; font-size: 12.5px; color: var(--text-2); white-space: nowrap;
  border-right: 1px solid var(--line);
}
.tick:hover { color: var(--text); }
.tick-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tick-source { font-weight: 600; color: var(--text); text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em; }
.tick[data-topic="economia"] { --c: var(--eco); }
.tick[data-topic="geopolitica"] { --c: var(--geo); }

/* ── Panels ───────────────────────────────────────────── */
.panel {
  position: fixed; z-index: 10;
  top: var(--panel-top); bottom: var(--gap);
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px 18px; border-bottom: 1px solid var(--line);
}
.panel-titles { min-width: 0; flex: 1; }
.panel-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.05; }
.panel-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px; }

/* Radar */
.radar { left: var(--gap); width: 360px; }
.radar-icon { color: var(--gold); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); }
.back-btn { display: none; margin-left: -8px; }
.radar.country-mode .back-btn { display: inline-grid; }
.radar.country-mode .radar-icon { display: none; }

.feed-item {
  --c: var(--other);
  display: block; width: 100%; text-align: left;
  padding: 12px 12px 12px 14px; border-radius: 12px;
  position: relative;
  transition: background .18s;
}
.feed-item::before {
  content: ''; position: absolute; left: 4px; top: 16px; bottom: 16px; width: 2px; border-radius: 2px;
  background: var(--c); opacity: .0; transition: opacity .2s;
}
.feed-item:hover { background: var(--raise-2); }
.feed-item:hover::before { opacity: 1; }
.feed-item + .feed-item { margin-top: 2px; }
.feed-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.feed-flag { font-size: 13px; }
.feed-source { color: var(--text-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-country { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-country::before { content: '·'; margin-right: 6px; }
.feed-time { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.feed-main { display: flex; gap: 12px; margin-top: 6px; }
.feed-title {
  flex: 1; font-size: 14.5px; font-weight: 500; line-height: 1.38; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; background: var(--raise); }
.feed-foot { margin-top: 8px; }

/* ── Lupa ─────────────────────────────────────────────── */
.lupa {
  right: var(--gap); width: 420px;
  transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none;
  transition: transform .45s var(--ease), opacity .3s;
}
.lupa.open { transform: none; opacity: 1; pointer-events: auto; }
.lupa-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--line);
}
.lupa-avatar, .msg-avatar, .lupa-orb, .fab-orb {
  display: grid; place-items: center; flex: none; border-radius: 50%;
  color: #0b0f18;
  background: radial-gradient(circle at 30% 25%, #fff3cf, var(--gold) 45%, #b8811d);
  box-shadow: 0 0 18px rgba(245,196,81,.35);
}
.lupa-avatar { width: 34px; height: 34px; }
.lupa-avatar .icon { width: 18px; height: 18px; stroke-width: 2.3; }
.lupa-name { font-weight: 600; font-size: 15px; }
.lupa-role { font-size: 12px; color: var(--muted); }
.lupa-head-actions { margin-left: auto; display: flex; gap: 2px; }

.lupa-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 8px; }
.lupa-messages { display: flex; flex-direction: column; gap: 18px; min-height: 100%; }

.lupa-empty { margin: auto 0; padding: 10px 4px 20px; }
.lupa-orb { width: 52px; height: 52px; margin-bottom: 16px; animation: orb 4s ease-in-out infinite; }
.lupa-orb .icon { width: 26px; height: 26px; stroke-width: 2.2; }
@keyframes orb { 50% { box-shadow: 0 0 34px rgba(245,196,81,.55); } }
.lupa-empty h3 { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.05; }
.lupa-empty p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.suggestions { display: flex; flex-direction: column; gap: 6px; }
.suggestion {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--raise);
  color: var(--text-2); font-size: 13px; line-height: 1.4;
  transition: border-color .2s, background .2s, color .2s;
}
.suggestion .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--gold); }
.suggestion:hover { border-color: var(--line-2); background: var(--raise-2); color: var(--text); }

.msg.user { align-self: flex-end; max-width: 86%; }
.msg.user .bubble {
  padding: 10px 14px; border-radius: 16px 16px 4px 16px;
  background: #f1f4f9; color: #0b0f18; white-space: pre-wrap; word-wrap: break-word;
  font-size: 14px;
}
.msg.assistant { display: flex; gap: 10px; align-items: flex-start; }
.msg-avatar { width: 26px; height: 26px; margin-top: 1px; }
.msg-avatar .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.msg-content { flex: 1; min-width: 0; }
.msg-status { font-size: 13px; color: var(--muted); padding: 3px 0; }
.shimmer {
  background: linear-gradient(90deg, var(--muted) 20%, var(--text) 50%, var(--muted) 80%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.msg-error {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 6px;
  padding: 10px 12px; border-radius: 12px; font-size: 13px;
  background: rgba(255,93,108,.08); color: #ffb3bb; border: 1px solid rgba(255,93,108,.2);
}
.msg-error .icon { width: 16px; height: 16px; margin-top: 1px; }
.msg-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--faint); }
.msg-model { font-size: 11px; }
.web-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.web-sources-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.web-source {
  font-size: 11.5px; padding: 3px 9px; border-radius: 99px; text-decoration: none;
  background: var(--raise-2); color: var(--text-2); border: 1px solid var(--line);
}
.web-source:hover { color: var(--text); border-color: var(--line-2); }

.md { font-size: 14px; line-height: 1.62; color: var(--text-2); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .75em; }
.md strong { color: var(--text); font-weight: 600; }
.md h1, .md h2, .md h3, .md h4 { color: var(--text); line-height: 1.25; margin: 1.1em 0 .45em; }
.md h1 { font-family: var(--serif); font-weight: 400; font-size: 1.9em; }
.md h2 { font-size: 1.12em; }
.md h3, .md h4 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.25em; }
.md li { margin: .25em 0; }
.md li::marker { color: var(--gold); }
.md a { color: var(--gold); text-decoration-color: rgba(245,196,81,.4); text-underline-offset: 2px; }
.md blockquote { margin: .8em 0; padding: .2em 0 .2em 1em; border-left: 2px solid var(--gold); color: var(--text); font-family: var(--serif); font-size: 1.2em; }
.md code { font-size: .88em; padding: .15em .4em; border-radius: 6px; background: var(--raise-2); }
.md pre { overflow-x: auto; padding: 12px; border-radius: 10px; background: rgba(0,0,0,.35); }
.md table { border-collapse: collapse; width: 100%; font-size: .92em; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.md img { max-width: 100%; border-radius: 12px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }

/* Composer (AI input) */
.composer-wrap { padding: 8px 12px 12px; }
.composer {
  position: relative;
  border-radius: 20px;
  background: rgba(20, 26, 40, .9);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: rgba(245,196,81,.45); box-shadow: 0 0 0 4px rgba(245,196,81,.08), 0 10px 30px -12px rgba(0,0,0,.6); }
.composer-input {
  display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent;
  padding: 14px 16px 6px; min-height: 48px; max-height: 180px;
  font-size: 14.5px; line-height: 1.5; color: var(--text);
}
.composer-input::placeholder { color: var(--faint); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cbtn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line-2); color: var(--text-2);
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.cbtn:hover { background: var(--raise-2); color: var(--text); transform: rotate(90deg); }
.toggle {
  --c: #7cc4ff;
  display: inline-flex; align-items: center; height: 34px; padding: 0 9px; border-radius: 99px;
  border: 1px solid var(--line-2); color: var(--muted);
  transition: background .25s, color .25s, border-color .25s, padding .3s var(--ease);
}
.toggle + .toggle { --c: var(--gold); }
.toggle .icon { width: 16px; height: 16px; }
.toggle-label {
  max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0;
  font-size: 12.5px; font-weight: 500;
  transition: max-width .35s var(--ease), opacity .25s, margin .35s var(--ease);
}
.toggle:hover { color: var(--text); background: var(--raise); }
.toggle:hover .toggle-label, .toggle.on .toggle-label { max-width: 110px; opacity: 1; margin-left: 6px; }
.toggle.on {
  color: var(--c); border-color: color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.toggle.on .icon { filter: drop-shadow(0 0 6px var(--c)); }

.model-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px 0 5px; border-radius: 99px;
  color: var(--text-2); font-size: 12.5px; font-weight: 500; min-width: 0;
  transition: background .2s, color .2s;
}
.model-btn:hover { background: var(--raise-2); color: var(--text); }
.model-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.model-btn .chev { width: 14px; height: 14px; color: var(--muted); }
.key-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.provider-mark {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; flex: none;
  font-size: 12px; font-weight: 700; color: #fff; background: #444;
}
.provider-mark[data-provider="gemini"] { background: linear-gradient(135deg, #4285f4, #9b72cb 60%, #d96570); }
.provider-mark[data-provider="anthropic"] { background: #d97757; color: #1f1208; }
.provider-mark[data-provider="openai"] { background: #f4f4f4; color: #0b0f18; }
.provider-mark[data-provider="free"] { background: #4d6bfe; }
.badge[data-state="free"] { color: var(--eco); background: var(--eco-soft); }
.key-row.free-row { background: var(--eco-soft); }
.key-free-note { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--text-2); }

.send-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--text); color: #05070d;
  transition: transform .15s, background .2s, opacity .2s;
}
.send-btn:hover { background: #fff; }
.send-btn:active { transform: scale(.92); }
.send-btn .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.send-btn .i-stop, .composer.busy .send-btn .i-send { display: none; }
.composer.busy .send-btn .i-stop { display: block; }
.composer.busy .send-btn { background: var(--raise-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* Menus */
.menu {
  position: absolute; bottom: calc(100% + 8px); z-index: 5;
  max-height: min(520px, 62vh); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; border-radius: 16px;
  background: var(--panel-solid); box-shadow: var(--shadow);
  animation: pop .18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.model-menu { right: 0; width: 330px; }
.quick-menu { left: 0; width: 320px; }
.menu-title {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.menu-title.with-back { padding-left: 2px; }
.menu-hint { margin: 0 10px 8px; font-size: 12px; color: var(--muted); }
.menu-group + .menu-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.menu-group-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.menu-group-name { font-weight: 600; }
.menu-group-vendor { font-size: 12px; color: var(--faint); }
.badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
  color: var(--gold); background: var(--gold-soft);
}
.badge[data-state="server"] { color: var(--eco); background: var(--eco-soft); }
.badge[data-state="own"] { color: #7cc4ff; background: rgba(124,196,255,.12); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px 8px 42px; border-radius: 10px; color: var(--text-2);
}
.menu-item:hover { background: var(--raise-2); color: var(--text); }
.menu-item.active { color: var(--text); }
.menu-item .icon { width: 16px; height: 16px; margin-left: auto; color: var(--gold); }
.menu-item-note { font-size: 12px; color: var(--faint); }
.menu-item.wrap { padding-left: 10px; line-height: 1.4; font-size: 13px; }
.menu-item.menu-action { padding-left: 10px; font-weight: 500; }
.menu-item.menu-action .icon { margin-left: 0; color: var(--muted); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.key-row { padding: 10px; border-radius: 12px; }
.key-row + .key-row { border-top: 1px solid var(--line); }
.key-row.focus { background: var(--gold-soft); }
.key-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.key-link { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gold); text-decoration: none; }
.key-link .icon { width: 13px; height: 13px; }
.key-row-input { display: flex; gap: 6px; align-items: center; }
.key-input, .inline-form input, .field input, .field select, .search {
  flex: 1; min-width: 0; height: 34px; padding: 0 11px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line-2); outline: 0;
  font-size: 13px;
}
.key-input:focus, .inline-form input:focus, .field input:focus, .field select:focus, .search:focus { border-color: rgba(245,196,81,.5); }

/* Lupa floating button */
.lupa-fab {
  position: fixed; z-index: 12; right: 22px; bottom: 22px;
  display: flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 20px 0 8px; border-radius: 99px;
  background: var(--panel-strong); box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  color: var(--muted); font-size: 13.5px;
  transition: transform .35s var(--ease), opacity .25s, color .2s;
}
.lupa-fab:hover { color: var(--text); transform: translateY(-2px); }
.fab-orb { width: 38px; height: 38px; }
.fab-orb .icon { width: 19px; height: 19px; stroke-width: 2.3; }
.lupa-open .lupa-fab { opacity: 0; pointer-events: none; transform: translateY(20px); }

/* ── Suggest ──────────────────────────────────────────── */
.suggest { position: fixed; z-index: 6; bottom: 22px; left: calc(var(--radar-w, 0px) + 92px); }
.suggest-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-2); font-size: 13px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.suggest-btn:hover { color: var(--text); border-color: var(--line-2); }
.suggest-btn .icon { width: 16px; height: 16px; }
.popover {
  position: absolute; bottom: calc(100% + 10px); left: 0; width: 340px;
  padding: 16px; border-radius: 16px; background: var(--panel-solid); box-shadow: var(--shadow);
  animation: pop .18s var(--ease);
}
.popover p { margin: 4px 0 12px; color: var(--muted); font-size: 12.5px; }
.inline-form { display: flex; gap: 6px; }

/* ── Article drawer ───────────────────────────────────── */
.article-drawer { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: rgba(2,4,10,.45); opacity: 0; transition: opacity .3s; }
.drawer-panel {
  position: absolute; top: var(--gap); right: var(--gap); bottom: var(--gap);
  width: min(560px, calc(100% - 2 * var(--gap)));
  overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--radius); background: var(--panel-strong);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 40px)); transition: transform .45s var(--ease);
}
.article-drawer.open .scrim { opacity: 1; }
.article-drawer.open .drawer-panel { transform: none; }
.drawer-close {
  position: sticky; top: 12px; float: right; margin: 12px 12px -48px 0; z-index: 2;
  background: rgba(5,8,15,.7); backdrop-filter: blur(8px);
}
.article-hero { margin: 0; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--raise); }
.article-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-inner { padding: 24px 28px 36px; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.article-meta .source { color: var(--text); font-weight: 600; }
.article-meta .flag { font-size: 16px; }
.article-title { margin: 14px 0 10px; font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.08; letter-spacing: -.005em; }
.article-sub { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.article-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.article-text p { margin: 0 0 1em; font-size: 15.5px; line-height: 1.7; color: var(--text-2); }
.article-text p.muted { font-size: 13px; color: var(--muted); }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--raise) 0%, var(--raise-2) 50%, var(--raise) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.short { width: 60%; }
.article-history { margin-top: 32px; }
.article-history h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.history-item {
  display: flex; gap: 12px; align-items: baseline; width: 100%; text-align: left;
  padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text-2);
}
.history-item:hover { color: var(--text); }
.history-title { flex: 1; font-size: 13.5px; }
.history-time { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ── Admin ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: rgba(2,4,10,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(400px, 100%); padding: 22px; border-radius: 20px;
  background: var(--panel-solid); box-shadow: var(--shadow);
  animation: pop .25s var(--ease);
}
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; flex: 1; font-size: 17px; font-weight: 600; }
.modal-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--gold-soft); color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; flex: 1; min-width: 0; }
.field span { font-size: 12px; color: var(--muted); }
.field input, .field select { flex: none; height: 38px; }
.field select { appearance: none; background-image: none; }
.form-error { min-height: 18px; margin: 0 0 8px; color: var(--danger); font-size: 13px; }
.blog-preview { width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.blog-body { overflow-y: auto; padding-right: 6px; }

.admin-dock {
  position: fixed; z-index: 30; left: var(--gap); top: var(--panel-top); bottom: var(--gap);
  width: 400px; display: flex; flex-direction: column;
  border-radius: var(--radius); background: var(--panel-strong); box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  animation: pop .25s var(--ease);
}
.admin-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 18px; }
.admin-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--gold); }
.admin-actions { display: flex; align-items: center; gap: 4px; }
.admin-tabs { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.admin-tabs button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px;
  color: var(--muted); font-size: 13px;
}
.admin-tabs button .icon { width: 15px; height: 15px; }
.admin-tabs button.active { background: var(--raise-2); color: var(--text); }
.admin-body { flex: 1; overflow-y: auto; padding: 16px 18px 20px; }
.admin-body h3 { margin: 0 0 12px; font-size: 14px; }
.admin-form { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row > .btn { margin-bottom: 12px; height: 38px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.admin-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.admin-list-head h3 { margin: 0; white-space: nowrap; }
.search { max-width: 170px; }
.admin-row { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.row-flag { font-size: 16px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main strong, .row-main a { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.blog-option {
  height: 64px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--raise);
  font-weight: 600; font-size: 13px;
}
.blog-option[data-lean="esquerda"] { color: #fca5a5; }
.blog-option[data-lean="direita"] { color: #93c5fd; }
.blog-option:hover { background: var(--raise-2); }
.blog-option:disabled { opacity: .45; }
.is-admin .radar { visibility: visible; }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed; z-index: 80; left: 50%; bottom: 90px;
  transform: translate(-50%, 12px); opacity: 0;
  max-width: min(440px, calc(100% - 32px));
  padding: 11px 16px; border-radius: 12px;
  background: var(--panel-solid); box-shadow: var(--shadow);
  font-size: 13.5px; transition: opacity .25s, transform .25s var(--ease);
}
.chip-topic[data-topic="economia"], .feed-item[data-topic="economia"], .marker[data-topic="economia"] { --c: var(--eco); --s: var(--eco-soft); }
.chip-topic[data-topic="geopolitica"], .feed-item[data-topic="geopolitica"], .marker[data-topic="geopolitica"] { --c: var(--geo); --s: var(--geo-soft); }

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { color: #ffb3bb; box-shadow: var(--shadow), inset 3px 0 0 var(--danger); }
.toast[data-kind="success"] { box-shadow: var(--shadow), inset 3px 0 0 var(--success); }

.mobile-tabs { display: none; }

/* ── Responsive ───────────────────────────────────────── */
body { --radar-w: 376px; }

@media (max-width: 1379px) {
  .live-updated { display: none; }
  .radar { width: 330px; }
  body { --radar-w: 346px; }
}

/* Medium: Lupa becomes an overlay */
@media (max-width: 1179px) {
  .brand-tag { display: none; }
  .live-status .live-count, .live-sep { display: none; }
  .lupa { width: min(420px, calc(100% - 2 * var(--gap))); z-index: 25; }
}

@media (max-width: 980px) {
  .topic { padding: 0 10px; }
  .topic-dot { display: none; }
}

/* Mobile */
@media (max-width: 820px) {
  :root { --top-h: 56px; --ticker-h: 30px; --gap: 10px; }
  body { --radar-w: 0px; }
  .topbar { padding: 0 12px; gap: 10px; flex-wrap: wrap; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-name { font-size: 21px; }
  .topics {
    position: fixed; top: calc(var(--top-h) + var(--ticker-h) + 8px); left: 10px; right: 10px;
    margin: 0; justify-content: space-between; overflow-x: auto; scrollbar-width: none;
  }
  .topic { flex: 1; justify-content: center; padding: 0 8px; font-size: 12.5px; }
  .top-actions { margin-left: auto; }
  .live-status { padding: 0 10px; }

  .panel { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .radar {
    left: var(--gap); right: var(--gap); width: auto; top: auto; height: 58vh;
    transform: translateY(110%); transition: transform .4s var(--ease);
  }
  body[data-tab="radar"] .radar { transform: none; }
  .lupa {
    left: var(--gap); right: var(--gap); width: auto;
    top: calc(var(--top-h) + 8px); z-index: 25;
    transform: translateY(110%);
  }
  .lupa.open { transform: none; }
  .lupa-fab { display: none; }
  .lupa-head-actions .icon-btn:last-child { display: none; }
  .model-menu, .quick-menu { width: min(330px, calc(100vw - 50px)); }

  /* Phones pinch to zoom, so only the weather toggle stays. */
  .globe-controls {
    flex-direction: row; left: 62px; bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .globe-controls .icon-btn:not(#weather-btn):not(#flights-btn):not(#routes-btn):not(#radio-btn):not(#cameras-btn) { display: none; }
  body:not([data-tab="globe"]) .globe-controls { display: none; }
  .suggest { left: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:not([data-tab="globe"]) .suggest, body:not([data-tab="globe"]) .country-label { display: none; }
  .suggest-btn span { display: none; }
  .suggest-btn { width: 40px; padding: 0; justify-content: center; }
  .popover { width: calc(100vw - 24px); }
  .country-label { bottom: calc(80px + env(safe-area-inset-bottom)); }

  .drawer-panel { top: 40px; right: 0; bottom: 0; left: 0; width: 100%; border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .article-inner { padding: 20px 20px 40px; }
  .admin-dock { left: var(--gap); right: var(--gap); width: auto; z-index: 45; }

  .mobile-tabs {
    display: flex; position: fixed; z-index: 30; left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    height: 54px; padding: 5px; gap: 4px; border-radius: 18px;
    background: var(--panel-strong); box-shadow: var(--shadow);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  }
  .mobile-tabs button {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
    border-radius: 13px; color: var(--muted); font-size: 13px; font-weight: 500;
  }
  .mobile-tabs button.active { background: var(--raise-2); color: var(--text); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .brand-text { display: none; }
  .live-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .ticker-track { animation: none; }
}

/* ── API key connection ───────────────────────────────── */
.model-menu.keys-view { width: 360px; }
.security-note {
  margin: 0 6px 8px; border-radius: 12px;
  background: rgba(61, 220, 151, .06); border: 1px solid rgba(61, 220, 151, .18);
}
.security-note summary {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 600; color: var(--eco);
}
.security-note summary::-webkit-details-marker { display: none; }
.security-note summary::after { content: '+'; margin-left: auto; font-weight: 400; font-size: 16px; line-height: 1; }
.security-note[open] summary::after { content: '−'; }
.security-note summary .icon { width: 15px; height: 15px; }
.security-note ul { margin: 0; padding: 0 14px 10px 30px; font-size: 12px; color: var(--text-2); }
.security-note li { margin: 5px 0; line-height: 1.45; }
.security-note li::marker { color: var(--eco); }
.badge { display: inline-flex; align-items: center; gap: 3px; }
.badge .icon { width: 11px; height: 11px; margin: 0; stroke-width: 2.6; color: currentColor; }
.key-row-head .badge { margin-left: auto; }
.key-masked {
  flex: 1; height: 32px; display: flex; align-items: center; padding: 0 10px; border-radius: 9px;
  background: var(--raise); border: 1px solid var(--line); font-size: 12.5px; letter-spacing: .06em; color: var(--text-2);
}
.key-where { font-size: 11px; color: var(--muted); white-space: nowrap; }
.key-status { margin: 6px 2px 0; font-size: 12px; color: var(--gold); min-height: 0; }
.key-status:empty { display: none; }
.key-status.error { color: #ffb3bb; }
.remember {
  display: flex; gap: 10px; align-items: flex-start; margin: 4px 6px 4px; padding: 10px;
  border-radius: 12px; background: var(--raise); cursor: pointer;
}
.remember input { margin-top: 2px; accent-color: var(--gold); width: 16px; height: 16px; flex: none; }
.remember span { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.remember small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.menu-item.menu-action.danger { color: #ffb3bb; }
.menu-item.menu-action.danger .icon { color: currentColor; }

.connect-card {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
  margin: 0 0 16px; padding: 14px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(245,196,81,.12), rgba(245,196,81,.03));
  border: 1px solid rgba(245,196,81,.3);
}
.connect-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--gold-soft); color: var(--gold); }
.connect-card strong { font-size: 14px; }
.connect-card p { margin: 2px 0 0 !important; font-size: 12.5px; }
.connect-card .btn { grid-column: 1 / -1; margin-top: 10px; }

/* ── Morning briefing ─────────────────────────────────── */
.briefing-card {
  display: block; width: 100%; text-align: left; margin: 2px 0 8px; padding: 14px;
  border-radius: 14px; border: 1px solid rgba(245,196,81,.32);
  background: linear-gradient(140deg, rgba(245,196,81,.16), rgba(245,196,81,.03) 60%);
  transition: border-color .2s, transform .2s var(--ease);
}
.briefing-card:hover { border-color: rgba(245,196,81,.6); transform: translateY(-1px); }
.briefing-head { display: flex; align-items: center; gap: 10px; }
.briefing-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); flex: none; }
.briefing-title { font-family: var(--serif); font-size: 21px; line-height: 1.1; }
.briefing-time { font-size: 11.5px; color: var(--muted); }
.briefing-summary {
  margin: 10px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.briefing-reader { padding-top: 28px; }
.briefing-reader .md { font-size: 15px; }
.briefing-reader .md h2 { font-family: var(--serif); font-weight: 400; font-size: 1.6em; margin-top: 1.3em; }
.briefing-note { font-size: 12px; margin-top: 24px; }

.admin-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); border-color: rgba(245,196,81,.35); background: var(--gold-soft); }
.admin-chip .icon { width: 15px; height: 15px; }
.admin-chip:hover { color: var(--gold); border-color: rgba(245,196,81,.6); }
@media (max-width: 480px) { .admin-chip span { display: none; } }
.md th, .md td:not(:last-child) { white-space: nowrap; }
.md td:last-child { min-width: 180px; }

.globe-credit {
  position: fixed; z-index: 5; bottom: 6px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; color: var(--faint); letter-spacing: .02em; pointer-events: none;
  animation: fade .4s;
}
@media (max-width: 820px) { .globe-credit { display: none; } }

/* ── Weather layer ────────────────────────────────────── */
.icon-btn.active { color: var(--gold); background: var(--gold-soft); }
.layer-huds {
  /* Sits above the globe controls and the "suggest a source" button. */
  position: fixed; z-index: 6; bottom: 76px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(430px, calc(100vw - 32px)); pointer-events: none;
}
.layer-huds > * { pointer-events: auto; }
.layer-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  animation: pop .25s var(--ease);
}
.layer-pill .icon { width: 15px; height: 15px; color: #7cc4ff; }
.weather-hud {
  width: 100%; padding: 12px 14px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  animation: pop .25s var(--ease);
}
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-title { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.hud-time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text); }
.hud-badge { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--gold-soft); color: var(--gold); }
.hud-track { height: 3px; margin: 9px 0 8px; border-radius: 3px; background: var(--raise-2); overflow: hidden; }
#hud-progress { height: 100%; width: 0; border-radius: 3px; background: var(--gold); transition: width .2s linear; }
.hud-legend { font-size: 11px; color: var(--muted); }
.rain-scale {
  width: 66px; height: 7px; border-radius: 4px; flex: none;
  background: linear-gradient(90deg, #6ee7ff, #2f7cf6 45%, #f0d43a 70%, #ff5d5d);
}
.hud-alerts { margin-left: auto; color: var(--text-2); }
@media (max-width: 820px) {
  /* Above the weather/flights/suggest buttons, which sit above the tab bar. */
  .layer-huds { bottom: calc(126px + env(safe-area-inset-bottom)); }
  body:not([data-tab="globe"]) .layer-huds { display: none; }
}

.alert-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  background: rgba(255, 213, 74, .14); color: #ffd54a;
}
.alert-badge .icon { width: 14px; height: 14px; }
.alert-badge[data-severity="severe"] { background: rgba(255, 157, 61, .14); color: #ff9d3d; }
.alert-badge[data-severity="extreme"] { background: rgba(255, 77, 77, .16); color: #ff6b6b; }
.alert-section { margin-top: 22px; }
.alert-section h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.alert-section p { margin: 0; white-space: pre-wrap; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }

/* Flight details card */
.flight-card { width: 214px; padding: 12px 14px; }
.fc-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.fc-flight { font-weight: 600; font-size: 15px; letter-spacing: .02em; }
.fc-type { font-size: 12px; color: var(--muted); }
.fc-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); padding: 2px 0; }
.fc-row strong { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── Maritime chokepoints ─────────────────────────────── */
.chokepoint-layer { z-index: 2; }
.chokepoint {
  position: absolute; left: 0; top: 0; margin: -9px 0 0 -9px;
  width: 18px; height: 18px; display: grid; place-items: center;
  pointer-events: auto; will-change: transform;
}
.cp-dot {
  width: 9px; height: 9px; border-radius: 2px; transform: rotate(45deg);
  background: #7cc4ff; box-shadow: 0 0 0 2px rgba(2,4,10,.7), 0 0 10px 2px rgba(124,196,255,.7);
  transition: transform .2s var(--ease);
}
.cp-ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid #7cc4ff; opacity: 0; }
.chokepoint.hot .cp-dot { background: var(--gold); box-shadow: 0 0 0 2px rgba(2,4,10,.7), 0 0 12px 3px rgba(245,196,81,.8); }
.chokepoint.hot .cp-ring { border-color: var(--gold); animation: ping 2.6s var(--ease) infinite; }
.cp-label {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 99px; white-space: nowrap;
  background: rgba(5,8,15,.72); backdrop-filter: blur(6px);
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em; color: var(--text-2);
  opacity: 0; transition: opacity .2s;
}
.chokepoint:hover { z-index: 3; }
.chokepoint:hover .cp-dot { transform: rotate(45deg) scale(1.4); }
.chokepoint:hover .cp-label, .chokepoint.hot .cp-label { opacity: 1; }
.chokepoint.hot .cp-label { color: var(--gold); }
.route-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: rgba(124,196,255,.14); color: #7cc4ff;
}
.route-badge .icon { width: 14px; height: 14px; }

/* ── Admin analytics ──────────────────────────────────── */
.admin-dock.wide { width: min(620px, calc(100vw - 2 * var(--gap))); }
.admin-tabs { flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line); min-width: 0; }
.kpi-label { font-size: 11.5px; color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-hint { font-size: 11px; color: var(--faint); }
.analytics-block { margin-top: 22px; }
.analytics-block h3 { margin: 0 0 10px; font-size: 13px; }
.chart-wrap {
  --series-1: #3987e5; --series-2: #d95926;
  position: relative; padding: 12px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line);
}
.legend { display: flex; gap: 14px; margin-bottom: 6px; font-size: 12px; color: var(--text-2); }
.key { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; flex: none; }
.bar-swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--series-1); }
.line-swatch { width: 14px; height: 2px; border-radius: 1px; background: var(--series-2); }
.visits-chart { display: block; width: 100%; height: auto; overflow: visible; }
.visits-chart .grid { stroke: rgba(255,255,255,.08); stroke-width: 1; }
.visits-chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.visits-chart .bar { fill: var(--series-1); transition: opacity .15s; }
.visits-chart .bar.dim { opacity: .35; }
.visits-chart .line { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.visits-chart .dot { fill: var(--series-2); stroke: #0c111d; stroke-width: 2; }
.visits-chart .cursor { stroke: rgba(255,255,255,.25); stroke-width: 1; }
.visits-chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip {
  position: absolute; top: 34px; transform: translateX(-50%); pointer-events: none;
  padding: 8px 10px; border-radius: 10px; background: var(--panel-solid); box-shadow: var(--shadow);
  font-size: 12px; color: var(--text-2); white-space: nowrap;
}
.chart-tip strong { display: block; margin-bottom: 4px; color: var(--text); }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.table-view { margin-top: 10px; font-size: 12.5px; }
.table-view summary { cursor: pointer; color: var(--muted); }
.data-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.data-table th, .data-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.data-table tr.group th { padding-top: 14px; text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.lists { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-list h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.mini-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.mini-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analytics-note { margin-top: 20px; font-size: 11.5px; line-height: 1.5; }
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .lists { grid-template-columns: 1fr; }
}

/* ── Sky labels (Moon and planets) ────────────────────── */
.sky-labels { z-index: 1; }
.sky-label {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  padding: 2px 7px 2px 16px; margin: -24px 0 0 -8px; border-radius: 99px; white-space: nowrap;
  font-size: 10.5px; font-weight: 500; letter-spacing: .03em; color: var(--text-2);
  background: rgba(5,8,15,.55); backdrop-filter: blur(4px);
  pointer-events: none;
}
.sky-label::before {
  content: ''; position: absolute; left: 6px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px;
  border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 6px var(--c, #fff);
}

/* ── Live radio player ────────────────────────────────── */
.radio-player {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border-radius: 14px; background: var(--panel-strong); border: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  animation: pop .25s var(--ease);
}
.rp-icon { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: var(--raise); flex: none; }
.rp-main { flex: 1; min-width: 0; }
.rp-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 11.5px; color: var(--muted); }
.rp-state { font-weight: 600; color: var(--text-2); }
.rp-state[data-state="playing"] { color: var(--eco); }
.rp-state[data-state="playing"]::before { content: '●'; margin-right: 4px; animation: live 1.6s infinite; }
.rp-state[data-state="error"] { color: #ffb3bb; }
.rp-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--gold); color: #1a1408;
}
.rp-btn .icon { width: 16px; height: 16px; }
.rp-volume { width: 70px; accent-color: var(--gold); }
@media (max-width: 480px) { .rp-volume { display: none; } }

/* ── Live cameras ─────────────────────────────────────── */
.camera-layer { z-index: 2; }
.camera-marker {
  position: absolute; left: 0; top: 0; margin: -10px 0 0 -10px;
  width: 20px; height: 20px; display: grid; place-items: center;
  pointer-events: auto; will-change: transform;
}
.cam-dot {
  width: 10px; height: 10px; border-radius: 3px; background: #ff5d6c;
  box-shadow: 0 0 0 2px rgba(2,4,10,.7), 0 0 12px 2px rgba(255,93,108,.8);
  transition: transform .2s var(--ease);
}
.cam-ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid #ff5d6c; animation: ping 2.2s var(--ease) infinite; }
.camera-marker.offline .cam-dot { background: #6b7280; box-shadow: 0 0 0 2px rgba(2,4,10,.7); }
.camera-marker.offline .cam-ring { display: none; }
.camera-marker.iss .cam-dot { background: #fff; border-radius: 50%; box-shadow: 0 0 0 2px rgba(2,4,10,.7), 0 0 14px 4px rgba(255,255,255,.9); }
.camera-marker.iss .cam-ring { border-color: #fff; }
.cam-label {
  position: absolute; top: 17px; left: 50%; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 99px; white-space: nowrap;
  background: rgba(5,8,15,.72); backdrop-filter: blur(6px);
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em; color: var(--text-2);
  opacity: 0; transition: opacity .2s;
}
.camera-marker:hover { z-index: 3; }
.camera-marker:hover .cam-dot { transform: scale(1.4); }
.camera-marker:hover .cam-label, .camera-marker.iss .cam-label { opacity: 1; }
.cam-state { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.cam-state[data-live="true"] { color: var(--eco); }
.cam-state[data-live="true"]::before { content: '●'; margin-right: 4px; animation: live 1.6s infinite; }
.camera-frame { margin: 18px 0 6px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.camera-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
