/* ═══════════════════════════════════════════════════════════════
   NTWeb Agent Manager — Deep Command Aesthetic
   Fontes: Rajdhani (headings) + Barlow (body) + JetBrains Mono (terminal)
═══════════════════════════════════════════════════════════════ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --void:          #050810;
  --deep:          #080d1a;
  --surface:       #0c1424;
  --card:          #101c32;
  --card-hover:    #142240;
  --border:        #1a2e4a;
  --border-bright: #2a4870;

  --cyan:          #00cfff;
  --cyan-soft:     rgba(0, 207, 255, 0.10);
  --cyan-glow:     rgba(0, 207, 255, 0.30);
  --cyan-border:   rgba(0, 207, 255, 0.45);

  --green:         #00e07a;
  --amber:         #ffb300;
  --red:           #ff3a5e;
  --purple:        #8b5cf6;
  --sky:           #4ea8ff;

  --text-1:        #cde4f8;
  --text-2:        #6b90b5;
  --text-3:        #5a7a9a;

  --agent-researcher:  #00cfff;
  --agent-strategist:  #ffb300;
  --agent-analyst:     #00e07a;
  --agent-google:      #4ea8ff;
  --agent-meta:        #a78bfa;

  --font-display: 'Rajdhani', sans-serif;
  --font-body:    'Barlow', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius:  6px;
  --radius-lg: 10px;
  --shadow:  0 4px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(0, 207, 255, 0.15);

  --term-bg:     #030710;
  --term-text:   #9fc8e8;
  --dot-red:     #ff5f57;
  --dot-yellow:  #febc2e;
  --dot-green:   #28c840;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--void);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
textarea, input, select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
textarea:focus, input:focus, select:focus {
  border-color: var(--cyan-border);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}

/* ── Focus rings (keyboard nav / accessibility) ──────────────── */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* ── Animated Background ────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(0,100,200,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(0,180,255,0.05) 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255,255,255,0.012) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255,255,255,0.012) 40px);
  pointer-events: none;
  z-index: 0;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0%   { opacity: 0.8; }
  100% { opacity: 1; }
}

/* ── Layout ─────────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 58px;
  background: rgba(5, 8, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2.5rem;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  color: var(--text-1);
  text-transform: uppercase;
}

.brand-mark {
  width: 32px; height: 32px;
  background: var(--cyan);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--void);
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 80%, 100% { transform: translateX(-200%) rotate(0deg); opacity: 0; }
  40%           { transform: translateX(200%) rotate(0deg); opacity: 1; }
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-links a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--cyan);
  background: var(--cyan-soft);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.nav-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 224, 122, 0.4); }
  50%       { opacity: 0.7; box-shadow: 0 0 0 4px rgba(0, 224, 122, 0); }
}

main {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 1.5rem 3rem;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-1);
  line-height: 1;
}
.page-subtitle {
  color: var(--text-2); font-size: .85rem; margin-top: 4px;
}
code.accent { color: var(--cyan); }

.back {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.back:hover {
  color: var(--cyan);
  border-color: var(--cyan-border);
  background: var(--cyan-soft);
}

/* ── Grid ────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  align-items: start;
}

.grid-2 > section > h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1rem;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow);
}

/* ── Agent Grid ──────────────────────────────────────────────── */
.agent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.agent-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  padding: 1.1rem 1.1rem 1rem;
}

/* Left accent bar — agent-specific color */
.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--agent-accent, var(--cyan));
  transition: width 0.25s;
}

.agent-card:hover::before { width: 5px; }

.agent-card:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 20px rgba(0,207,255,0.06);
}

/* Agent color mapping */
.agent-card[data-agent="market-researcher"]   { --agent-accent: var(--agent-researcher); }
.agent-card[data-agent="campaign-strategist"] { --agent-accent: var(--agent-strategist); }
.agent-card[data-agent="performance-analyst"] { --agent-accent: var(--agent-analyst); }
.agent-card[data-agent="google-ads-manager"]  { --agent-accent: var(--agent-google); }
.agent-card[data-agent="meta-ads-manager"]    { --agent-accent: var(--agent-meta); }

.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.agent-icon {
  width: 34px; height: 34px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--agent-accent, var(--cyan));
  flex-shrink: 0;
}

.agent-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text-1);
  text-transform: uppercase;
  flex: 1;
}

.agent-desc {
  font-size: 0.83rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn:hover {
  color: var(--text-1);
  border-color: var(--border-bright);
  background: var(--card);
}

.btn-primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--void);
}

.btn-primary:hover {
  background: #22d9ff;
  border-color: #22d9ff;
  color: var(--void);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.btn-success {
  background: rgba(0, 224, 122, 0.12);
  border-color: rgba(0, 224, 122, 0.4);
  color: var(--green);
}

.btn-success:hover {
  background: rgba(0, 224, 122, 0.22);
  box-shadow: 0 0 12px rgba(0, 224, 122, 0.2);
}

.btn-danger {
  background: rgba(255, 58, 94, 0.1);
  border-color: rgba(255, 58, 94, 0.35);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(255, 58, 94, 0.2);
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.22rem 0.7rem;
  border-radius: 99px;
  border: 1px solid;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-pending   { color: var(--amber); border-color: rgba(255,179,0,0.35); background: rgba(255,179,0,0.08); }
.badge-running   { color: var(--cyan);  border-color: var(--cyan-border);   background: var(--cyan-soft);
                   animation: badge-pulse 1.8s ease-in-out infinite; }
.badge-completed { color: var(--green); border-color: rgba(0,224,122,0.35); background: rgba(0,224,122,0.08); }
.badge-failed    { color: var(--red);   border-color: rgba(255,58,94,0.35);  background: rgba(255,58,94,0.08); }
.badge-cancelled { color: var(--text-3);border-color: var(--border);         background: transparent; }
.badge-mcp       { color: var(--purple);border-color: rgba(139,92,246,0.4);  background: rgba(139,92,246,0.1); }

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--cyan-soft); }
  50%       { box-shadow: 0 0 0 4px var(--cyan-soft); }
}

/* ── Run Items ───────────────────────────────────────────────── */
.run-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  background: var(--surface);
  transition: all 0.2s;
  cursor: pointer;
}

.run-item:hover {
  background: var(--card);
  border-color: var(--border-bright);
  transform: translateX(3px);
}

.run-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.run-agent {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--cyan);
}

.run-task {
  font-size: 0.85rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.run-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
}

.empty {
  color: var(--text-3);
  font-size: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── Run Info Bar ────────────────────────────────────────────── */
.run-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-2);
}

.run-info-bar strong {
  color: var(--text-3);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 0.3rem;
}

.term-bg-pill {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 0.18rem 0.58rem;
}

.terminal-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* ── Terminal ────────────────────────────────────────────────── */
.terminal-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  background: #0a1020;
  border-bottom: 1px solid var(--border);
}

.terminal-dots {
  display: flex;
  gap: 0.4rem;
}

.terminal-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.terminal-dots .dot-r { background: var(--dot-red); }
.terminal-dots .dot-y { background: var(--dot-yellow); }
.terminal-dots .dot-g { background: var(--dot-green); }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
  margin-left: 0.5rem;
}

.terminal {
  position: relative;
  background: #040811;
  color: #a8d8a8;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.7;
  padding: 1.25rem 1.5rem;
  min-height: 300px;
  max-height: 600px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.terminal.error { color: var(--red); }

/* Custom scrollbar for terminal */
.terminal::-webkit-scrollbar { width: 6px; }
.terminal::-webkit-scrollbar-track { background: transparent; }
.terminal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.terminal::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* Scanline overlay on terminal */
.terminal::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.05) 2px,
    rgba(0,0,0,0.05) 4px
  );
  pointer-events: none;
}

/* ── Editor ──────────────────────────────────────────────────── */
.editor {
  width: 100%;
  min-height: 340px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.75;
  padding: 1rem;
  resize: vertical;
  background: #040811;
  color: var(--term-text);
  border-color: var(--border);
  border-radius: var(--radius);
}

.task-input {
  width: 100%;
  resize: vertical;
  min-height: 100px;
}

.create-agent-layout {
  max-width: 1000px;
}

.create-agent-card .info-note {
  margin-bottom: 0;
}

.editor-compact {
  min-height: 180px;
}

.create-agent-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.45rem;
  margin-top: 0.85rem;
}

label:first-child { margin-top: 0; }

input[type="text"] { width: 100%; }

/* ── Pipeline Cards ──────────────────────────────────────────── */
.pipeline-card {
  margin-bottom: 1rem;
}

.pipeline-card .card-header {
  margin-bottom: 0.75rem;
}

.pipeline-card .card-header strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pipeline-desc {
  font-size: 0.88rem;
  color: var(--text-2);
  margin-bottom: 0.85rem;
}

.pipeline-steps {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: var(--card);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  color: var(--cyan);
}

.arrow {
  color: var(--text-3);
  font-size: 0.85rem;
}

.run-pipeline-form {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

/* ── Pipeline Progress ───────────────────────────────────────── */
.pipeline-progress {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.step-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-3);
  transition: all 0.3s;
}

.step-circle.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-soft);
  box-shadow: 0 0 12px var(--cyan-glow);
  animation: step-pulse 1.8s ease-in-out infinite;
}

.step-circle.done {
  border-color: var(--green);
  color: var(--void);
  background: var(--green);
}

@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--cyan-glow); }
  50%       { box-shadow: 0 0 20px var(--cyan-glow); }
}

.step-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-2);
  text-align: center;
  max-width: 80px;
  overflow-wrap: break-word;
}

.progress-arrow {
  flex: 1;
  min-width: 24px;
  height: 2px;
  background: linear-gradient(90deg, var(--border) 0%, var(--border-bright) 100%);
  margin-bottom: 1.5rem;
  margin: 0 0.2rem 1.5rem;
  align-self: flex-start;
  margin-top: 19px;
}

/* ── History Table ───────────────────────────────────────────── */
.history-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.history-filters select {
  padding: 0.45rem 0.85rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.15s;
  cursor: pointer;
}

tbody tr:hover { background: var(--card); }

tbody td {
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  color: var(--text-2);
  vertical-align: middle;
}

tbody td:first-child {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
}

.td-agent {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cyan) !important;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* ── Step Form ───────────────────────────────────────────────── */
.step-row {
  display: grid;
  grid-template-columns: 28px 180px 1fr 36px;
  gap: 0.6rem;
  align-items: start;
  margin-bottom: 0.65rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-3);
  padding-top: 0.5rem;
}

.step-row select { height: 36px; }
.step-row textarea { min-height: 60px; font-family: var(--font-mono); font-size: 0.8rem; }

/* ── Utility ─────────────────────────────────────────────────── */
section > h2,
section > h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.85rem;
}

section > h3 {
  margin-top: 1.5rem;
  font-size: 0.78rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  color: var(--cyan);
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.agent-card  { animation: fadeUp 0.4s ease both; }
.agent-card:nth-child(1) { animation-delay: 0.05s; }
.agent-card:nth-child(2) { animation-delay: 0.10s; }
.agent-card:nth-child(3) { animation-delay: 0.15s; }
.agent-card:nth-child(4) { animation-delay: 0.20s; }
.agent-card:nth-child(5) { animation-delay: 0.25s; }

.run-item { animation: fadeUp 0.35s ease both; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .agent-grid { grid-template-columns: 1fr; }
  .nav-links a {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    letter-spacing: 0.04em;
  }
}

@media (max-width: 640px) {
  main { padding: 72px 1rem 2rem; }
  nav { padding: 0 1rem; gap: 1rem; }
  .nav-links { gap: 0; }
  .nav-links a { font-size: 0.7rem; padding: 0.35rem 0.5rem; }
  .nav-status span:last-child { display: none; }
}

/* ── Settings page ───────────────────────────────────────────── */
.settings-layout {
  display: grid; grid-template-columns: 200px 1fr; gap: 32px;
  max-width: 860px;
}
.settings-nav {
  display: flex; flex-direction: column; gap: 4px; padding-top: 4px;
}
.snav-item {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em;
  color: var(--text-2); padding: 7px 12px; border-radius: var(--radius);
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none; text-transform: uppercase;
  transition: background .15s, color .15s;
  min-height: 44px; display: flex; align-items: center;
}
.snav-item:hover, .snav-item.active {
  background: var(--card); color: var(--cyan); border-color: var(--border);
}
/* :target fallback — highlight section when navigated via URL hash */
.settings-section:target { border-color: var(--cyan-border); }
.snav-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 8px; flex-shrink: 0;
}
.settings-main { display: flex; flex-direction: column; gap: 28px; }
.settings-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: clip;
}
.section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.2);
}
.section-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
}
.section-icon.google { background: rgba(78,168,255,.15); }
.section-icon.meta   { background: rgba(167,139,250,.15); }
.section-icon.limits { background: rgba(0,224,122,.12); }
.section-title {
  font-family: var(--font-display); font-size: .95rem; font-weight: 600; flex: 1;
}
.section-status { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; }
.section-status.ok   { color: var(--green); }
.section-status.warn { color: var(--amber); }
.section-status.na   { color: var(--text-3); }
.field-list { padding: 4px 0; }
.field-row {
  display: grid; grid-template-columns: 210px 1fr 70px;
  align-items: center; gap: 12px;
  padding: 11px 20px; border-bottom: 1px solid rgba(26,46,74,.5);
}
.field-row:last-child { border-bottom: none; }
.field-label {
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-2);
  letter-spacing: .04em; text-transform: none; margin: 0;
}
.field-key { display: block; font-size: .7rem; color: var(--text-3); margin-top: 2px; }
.field-input-wrap { position: relative; width: 100%; }
.field-input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 36px 7px 10px;
  font-family: var(--font-mono); font-size: .73rem; color: var(--text-1);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field-input:focus {
  border-color: var(--cyan-border);
  box-shadow: 0 0 0 3px rgba(0,207,255,.15);
}
.field-input::placeholder { color: var(--text-3); }
.toggle-vis {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: .75rem; padding: 2px 4px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.toggle-vis:hover { color: var(--text-2); }
.field-badge {
  text-align: right; font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .06em; white-space: nowrap;
}
.field-badge.set     { color: var(--green); }
.field-badge.not-set { color: var(--text-3); }
.save-bar { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.btn-save {
  background: var(--cyan); color: var(--void); border: none;
  border-radius: var(--radius); padding: 9px 24px; min-height: 44px;
  font-family: var(--font-display); font-size: .85rem; font-weight: 700;
  letter-spacing: .05em; cursor: pointer; text-transform: uppercase;
  transition: opacity .15s;
}
.btn-save:hover { opacity: .85; }
.btn-save:disabled { opacity: .4; cursor: default; }
.save-msg { font-family: var(--font-mono); font-size: .75rem; transition: opacity .3s; }
.save-msg.ok   { color: var(--green); }
.save-msg.fail { color: var(--red); }
.info-note {
  font-family: var(--font-mono); font-size: .7rem; color: var(--text-3);
  padding: 0 0 4px; line-height: 1.6; margin-bottom: 20px;
}
@media (max-width: 768px) {
  .settings-layout { grid-template-columns: 1fr; gap: 20px; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; gap: 6px; }
  .field-badge { text-align: left; }
}

/* ── Diagnostics page ────────────────────────────────────────── */
.diag-banner {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,179,0,.06); border: 1px solid rgba(255,179,0,.25);
  border-radius: var(--radius); padding: 10px 16px; margin-bottom: 28px;
  font-family: var(--font-mono); font-size: .75rem; color: var(--amber);
}
.diag-banner svg { flex-shrink: 0; }
.diag-stats { display: flex; gap: 2px; margin-bottom: 32px; }
.diag-stat {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-key {
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .1em; color: var(--text-3); text-transform: uppercase;
}
.stat-val {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
  color: var(--text-1); line-height: 1;
}
.stat-val.ok   { color: var(--green); }
.stat-val.warn { color: var(--amber); }
.diag-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.diag-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: clip;
  transition: border-color .2s;
}
.diag-card:hover      { border-color: var(--border-bright); }
.diag-card.is-running { border-color: rgba(255,179,0,.4); }
.diag-card.is-ok      { border-color: rgba(0,224,122,.35); }
.diag-card.is-fail    { border-color: rgba(255,58,94,.35); }
.diag-card-top {
  padding: 16px 18px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-3); transition: background .3s;
}
.status-dot.running {
  background: var(--amber);
  animation: dot-pulse 1s ease-in-out infinite;
}
.status-dot.ok   { background: var(--green); }
.status-dot.fail { background: var(--red); }
@keyframes dot-pulse {
  0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,179,0,.5); }
  50%      { opacity: .7; box-shadow: 0 0 0 5px rgba(255,179,0,0); }
}
.diag-name {
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  color: var(--text-1); letter-spacing: .02em; flex: 1;
}
.badge-diag-mcp { background: rgba(0,207,255,.12); color: var(--cyan); border: 1px solid rgba(0,207,255,.3); font-size: .72rem; padding: 2px 6px; border-radius: 3px; font-family: var(--font-mono); letter-spacing: .08em; }
.badge-std      { background: rgba(107,144,181,.1); color: var(--text-2); border: 1px solid rgba(107,144,181,.2); font-size: .72rem; padding: 2px 6px; border-radius: 3px; font-family: var(--font-mono); }
.badge-temp     { background: rgba(255,58,94,.1); color: #ff6b85; border: 1px solid rgba(255,58,94,.3); font-size: .72rem; padding: 2px 6px; border-radius: 3px; font-family: var(--font-mono); letter-spacing: .06em; }
.diag-card-body { padding: 14px 18px; }
.diag-desc {
  font-size: .78rem; color: var(--text-2); line-height: 1.5;
  font-family: var(--font-mono); margin-bottom: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.diag-actions { display: flex; align-items: center; gap: 10px; }
.btn-run {
  flex: 1; background: rgba(0,207,255,.08); color: var(--cyan);
  border: 1px solid rgba(0,207,255,.25); border-radius: var(--radius);
  padding: 8px 14px; font-family: var(--font-mono); font-size: .75rem;
  font-weight: 500; letter-spacing: .06em; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background .2s, border-color .2s;
}
.btn-run:hover:not(:disabled) {
  background: rgba(0,207,255,.15); border-color: rgba(0,207,255,.45);
}
.btn-run:disabled { opacity: .5; cursor: default; }
.btn-run .run-icon { font-size: .9rem; }
.spin { display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.diag-terminal { border-top: 1px solid var(--border); background: var(--term-bg); }
.t-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.3);
}
.t-dot { width: 8px; height: 8px; border-radius: 50%; }
.t-dot-r { background: var(--dot-red); }
.t-dot-y { background: var(--dot-yellow); }
.t-dot-g { background: var(--dot-green); }
.t-title { flex: 1; font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); margin-left: 4px; }
.t-viewlink {
  font-family: var(--font-mono); font-size: .72rem; color: var(--cyan);
  text-decoration: none; opacity: .7;
}
.t-viewlink:hover { opacity: 1; }
.t-output {
  font-family: var(--font-mono); font-size: .73rem; color: var(--term-text);
  line-height: 1.55; padding: 12px 14px;
  min-height: 80px; max-height: 260px; overflow-y: auto;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.t-output::-webkit-scrollbar { width: 4px; }
.t-output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.t-statusbar {
  padding: 5px 14px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
}
.t-statusbar.ok   { color: var(--green); }
.t-statusbar.fail { color: var(--red); }
@media (max-width: 640px) {
  .diag-stats { flex-wrap: wrap; }
  .diag-stat  { min-width: calc(50% - 1px); }
  .diag-grid  { grid-template-columns: 1fr; }
}

/* ── Data page ──────────────────────────────────────────────── */
.data-stats-bar { margin-bottom: 20px; }

.data-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}
.data-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.data-block-title {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.data-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.data-badge {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.data-badge strong {
  font-size: .9rem;
  font-family: var(--font-display);
  font-weight: 700;
}
.data-badge-alta     { color: var(--cyan);   border-color: var(--cyan-border);           background: var(--cyan-soft); }
.data-badge-media    { color: var(--amber);  border-color: rgba(255,179,0,.35);           background: rgba(255,179,0,.08); }
.data-badge-baixa    { color: var(--text-2); border-color: var(--border);                 background: transparent; }
.data-badge-existente{ color: var(--green);  border-color: rgba(0,224,122,.35);           background: rgba(0,224,122,.08); }
.data-badge-novo     { color: var(--purple); border-color: rgba(139,92,246,.4);           background: rgba(139,92,246,.1); }

.data-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 10px;
}

.data-table-wrap { padding: 0; overflow: hidden; margin-bottom: 28px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead tr {
  background: rgba(0,0,0,.2);
}
.data-table th {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(26,46,74,.5);
  font-size: .88rem;
  color: var(--text-1);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--card-hover); }
.data-td-mono {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-2);
}

@media (max-width: 640px) {
  .data-split { grid-template-columns: 1fr; }
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   COVERAGE / TACTICAL OPS CONSOLE
   Breaks out of <main> container. Fullbleed below the fixed 58px nav.
   ═══════════════════════════════════════════════════════════════ */

[x-cloak] { display: none !important; }

/* Let .cov-page escape the centered 1280px <main> padding.
   Usa body class (mais confiável que :has() em browsers antigos). */
body.body-cov main {
  max-width: none;
  padding: 58px 0 0;
  height: 100vh;
  overflow: hidden;
}
body.body-cov { overflow: hidden; }

.cov-page {
  position: relative;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: calc(100vh - 58px);
  background: var(--void);
  color: var(--text-1);
  overflow: hidden;
  font-family: var(--font-body);
}

.cov-runtime-error {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1200;
  max-width: min(560px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid var(--red);
  background: rgba(255, 64, 96, 0.12);
  color: #ffd5df;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

/* ─── CONSOLE / SIDEBAR ──────────────────────────────────────── */
.cov-console {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(0, 207, 255, 0.025) 0%, transparent 60%),
    var(--deep);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}

.cov-console::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 207, 255, 0.018) 0px,
    rgba(0, 207, 255, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 0;
}

.cov-console > * { position: relative; z-index: 1; }

.cov-console::-webkit-scrollbar { width: 6px; }
.cov-console::-webkit-scrollbar-track { background: transparent; }
.cov-console::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}

/* ─── HEADER ─────────────────────────────────────────────────── */
.cov-head {
  padding: 1.75rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at top left, rgba(0, 207, 255, 0.08), transparent 70%);
}

.cov-head-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  margin-bottom: 0.75rem;
  color: var(--text-3);
}

.cov-head-tag .cov-head-pre { color: var(--text-3); }
.cov-head-tag .cov-head-id {
  color: var(--cyan);
  padding: 2px 6px;
  border: 1px solid var(--cyan-border);
  background: var(--cyan-soft);
  border-radius: 2px;
}

.cov-head-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.25rem;
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}

.cov-head-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--cyan);
}

.cov-head-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--text-3);
  text-transform: uppercase;
}

.cov-head-sub .cov-dash {
  flex: 1;
  color: var(--border-bright);
  letter-spacing: 0;
}

/* ─── BLOCKS ─────────────────────────────────────────────────── */
.cov-block {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cov-block-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.9rem;
}

.cov-block-label-text {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Corner-bracket decorations */
.cov-br {
  display: inline-block;
  width: 10px;
  height: 10px;
  position: relative;
  flex-shrink: 0;
}

.cov-br-l::before,
.cov-br-l::after,
.cov-br-r::before,
.cov-br-r::after {
  content: "";
  position: absolute;
  background: var(--cyan);
}

.cov-br-l::before { top: 0; left: 0; width: 6px; height: 1px; }
.cov-br-l::after  { top: 0; left: 0; width: 1px; height: 6px; }
.cov-br-r::before { top: 0; right: 0; width: 6px; height: 1px; }
.cov-br-r::after  { top: 0; right: 0; width: 1px; height: 6px; }

.cov-block-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}

/* ─── CEP RADAR ──────────────────────────────────────────────── */
.cov-radar {
  position: relative;
  display: flex;
  align-items: center;
  height: 52px;
  background: var(--void);
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  padding: 0 6px 0 18px;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.cov-radar::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 2px;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.cov-radar:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan-border), 0 0 18px rgba(0, 207, 255, 0.15);
}

.cov-radar.is-error {
  border-color: var(--red);
}
.cov-radar.is-error::before { background: var(--red); box-shadow: 0 0 8px rgba(255, 64, 96, 0.4); }

.cov-radar-rings {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.cov-radar.is-scanning .cov-radar-rings { opacity: 1; }

.cov-radar-rings span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  animation: cov-pulse 1.4s infinite ease-out;
}
.cov-radar-rings span:nth-child(2) { animation-delay: 0.45s; }
.cov-radar-rings span:nth-child(3) { animation-delay: 0.9s; }

@keyframes cov-pulse {
  0%   { transform: scale(0.3); opacity: 0.9; }
  100% { transform: scale(2.4); opacity: 0; }
}

.cov-radar-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  padding: 0;
  height: 100%;
}

.cov-radar-input::placeholder {
  color: var(--text-3);
  letter-spacing: 0.12em;
}

.cov-radar-go {
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--cyan-border);
  border-radius: 2px;
  color: var(--cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.cov-radar-go:hover:not(:disabled) {
  background: var(--cyan-soft);
  border-color: var(--cyan);
}
.cov-radar-go:active:not(:disabled) { transform: scale(0.94); }
.cov-radar-go:disabled { opacity: 0.4; cursor: not-allowed; }
.cov-radar-go svg { width: 18px; height: 18px; }

.cov-err {
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--red);
  letter-spacing: 0.05em;
  padding: 6px 10px;
  border-left: 2px solid var(--red);
  background: rgba(255, 64, 96, 0.06);
}

.cov-err::before { content: "ERR · "; opacity: 0.6; }

/* CEP result panel */
.cov-cep-result {
  margin-top: 0.8rem;
  padding: 12px 14px;
  border: 1px solid var(--border-bright);
  background: var(--card);
  border-radius: 2px;
  position: relative;
}

.cov-cep-result.is-covered  { border-color: rgba(0, 224, 122, 0.5); }
.cov-cep-result.is-uncovered { border-color: rgba(255, 64, 96, 0.5); }

.cov-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.cov-cep-result.is-covered  .cov-status-label { color: var(--green); }
.cov-cep-result.is-uncovered .cov-status-label { color: var(--red); }

.cov-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

.cov-cep-result.is-covered .cov-led {
  background: var(--green);
  box-shadow: 0 0 6px rgba(0, 224, 122, 0.8), 0 0 0 2px rgba(0, 224, 122, 0.15);
  animation: cov-led-pulse 2s infinite ease-in-out;
}
.cov-cep-result.is-uncovered .cov-led {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255, 64, 96, 0.8);
}

@keyframes cov-led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.cov-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.cov-dl > div { display: flex; flex-direction: column; gap: 2px; }
.cov-dl dt {
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  color: var(--text-3);
  text-transform: uppercase;
}
.cov-dl dd {
  margin: 0;
  color: var(--text-1);
  font-size: 0.8rem;
  word-break: break-word;
}

/* ─── FILTROS HIERÁRQUICOS ───────────────────────────────────── */
.cov-selects {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cov-sel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.2s;
}

.cov-sel.is-disabled { opacity: 0.4; }

.cov-sel label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  width: 42px;
  flex-shrink: 0;
}

.cov-sel-box {
  position: relative;
  flex: 1;
  background: var(--void);
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: border-color 0.15s;
}

.cov-sel-box:focus-within {
  border-color: var(--cyan-border);
  box-shadow: 0 0 0 1px var(--cyan-border);
}

.cov-sel-box select {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 9px 30px 9px 12px;
  cursor: pointer;
}

.cov-sel-box select:disabled { cursor: not-allowed; }
.cov-sel-box select option { background: var(--deep); color: var(--text-1); }

.cov-sel-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cyan);
  font-size: 0.75rem;
  pointer-events: none;
}

.cov-clear {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.cov-clear:hover {
  color: var(--cyan);
  border-color: var(--cyan-border);
}

/* ─── RESULTS LIST ───────────────────────────────────────────── */
.cov-block-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cov-block-list .cov-block-label::after { display: none; }

.cov-count {
  color: var(--cyan);
  font-weight: 500;
  margin-left: 2px;
}

.cov-csv {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s;
}
.cov-csv:hover:not(:disabled) { color: var(--cyan); border-color: var(--cyan-border); }
.cov-csv:disabled { opacity: 0.3; cursor: not-allowed; }
.cov-csv svg { width: 10px; height: 10px; }

.cov-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
  padding-right: 4px;
}

.cov-results::-webkit-scrollbar { width: 4px; }
.cov-results::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

.cov-ri {
  padding: 9px 12px;
  border: 1px solid transparent;
  border-left: 2px solid var(--border);
  background: rgba(16, 28, 50, 0.4);
  cursor: pointer;
  transition: all 0.15s;
  animation: cov-fade-in 0.3s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 12ms);
}

@keyframes cov-fade-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.cov-ri:hover {
  background: var(--card-hover);
  border-color: var(--cyan-border);
  border-left-color: var(--cyan);
}

.cov-ri.is-active {
  background: var(--cyan-soft);
  border-color: var(--cyan-border);
  border-left-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 207, 255, 0.1);
}

.cov-ri-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.cov-ri-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.cov-ri-uf {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: var(--text-3);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.cov-ri-loc {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-2);
  margin: 2px 0;
  line-height: 1.3;
}

.cov-ri-sep {
  color: var(--text-3);
  margin: 0 4px;
  opacity: 0.6;
}

.cov-ri-cep {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.cov-ri-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.8;
}

.cov-empty {
  padding: 16px 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.08em;
  font-style: italic;
}

/* ─── SELECTED DETAIL (terminal window) ──────────────────────── */
.cov-selected {
  margin: 0 1rem 1rem;
  border: 1px solid var(--cyan-border);
  background: var(--void);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 207, 255, 0.08);
  animation: cov-fade-in 0.4s ease-out;
}

.cov-sel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--deep);
  border-bottom: 1px solid var(--border);
}

.cov-sel-dots {
  display: inline-flex;
  gap: 5px;
  flex-shrink: 0;
}

.cov-sel-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-bright);
}

.cov-sel-dots i:first-child { background: var(--red); }
.cov-sel-dots i:nth-child(2) { background: var(--amber); }
.cov-sel-dots i:last-child   { background: var(--green); }

.cov-sel-title {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.08em;
}

.cov-sel-x {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 1.1rem;
  cursor: pointer;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}
.cov-sel-x:hover { color: var(--cyan); }

.cov-sel-body {
  padding: 14px;
}

.cov-sel-id-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
  font-family: var(--font-mono);
}

.cov-sel-prompt {
  color: var(--cyan);
  font-weight: 700;
}

.cov-sel-id-row code {
  color: var(--text-1);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.cov-sel-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.cov-btn {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-align: left;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s, transform 0.1s;
}
.cov-btn:hover { background: var(--cyan-soft); }
.cov-btn:active { transform: translateY(1px); }

.cov-btn-alt {
  border-color: var(--border-bright);
  color: var(--text-2);
}
.cov-btn-alt:hover {
  border-color: var(--cyan-border);
  color: var(--cyan);
  background: var(--cyan-soft);
}

/* ─── STATUS BAR ─────────────────────────────────────────────── */
.cov-statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--void);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: auto;
  position: sticky;
  bottom: 0;
}

.cov-sb-txt { white-space: nowrap; }
.cov-sb-sep { color: var(--border-bright); }

.cov-statusbar .cov-led.is-on {
  background: var(--green);
  box-shadow: 0 0 5px rgba(0, 224, 122, 0.7);
  animation: cov-led-pulse 2.4s infinite;
}
.cov-statusbar .cov-led.is-warn {
  background: var(--amber);
  box-shadow: 0 0 5px rgba(255, 184, 0, 0.7);
  animation: cov-led-pulse 0.9s infinite;
}

/* ─── MAP WRAP ───────────────────────────────────────────────── */
.cov-map-wrap {
  position: relative;
  height: 100%;
  background: var(--void);
  overflow: hidden;
}

#cov-map {
  width: 100%;
  height: 100%;
  background: #030610;
}

/* HUD corner brackets overlay */
.cov-map-hud {
  position: absolute;
  inset: 14px;
  pointer-events: none;
  z-index: 400;
}

.cov-hud-c {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid var(--cyan);
  opacity: 0.55;
}

.cov-hud-tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.cov-hud-tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.cov-hud-bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.cov-hud-br { bottom: 0; right: 0; border-left: none; border-top: none; }

.cov-hud-meta {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 4px 12px;
  background: var(--void);
  border: 1px solid var(--cyan-border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  white-space: nowrap;
}

/* ─── LEAFLET OVERRIDES ──────────────────────────────────────── */
.cov-page .leaflet-container {
  background: #030610;
  font-family: var(--font-body);
}

.cov-page .leaflet-control-zoom {
  border: 1px solid var(--cyan-border) !important;
  box-shadow: 0 0 12px rgba(0, 207, 255, 0.15) !important;
}

.cov-page .leaflet-control-zoom a {
  background: var(--deep) !important;
  color: var(--cyan) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  font-family: var(--font-mono) !important;
  font-size: 14px !important;
}

.cov-page .leaflet-control-zoom a:hover {
  background: var(--cyan-soft) !important;
}

.cov-page .leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

.cov-tip {
  background: var(--void) !important;
  color: var(--cyan) !important;
  border: 1px solid var(--cyan-border) !important;
  border-radius: 2px !important;
  padding: 4px 10px !important;
  font-family: var(--font-mono) !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  box-shadow: 0 0 12px rgba(0, 207, 255, 0.18) !important;
}

.cov-tip::before { display: none !important; }

/* ─── CEP MAP PIN ────────────────────────────────────────────── */
.cov-pin-wrap {
  background: transparent !important;
  border: none !important;
}

.cov-pin {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
}

.cov-pin-ring {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--cyan);
  border-radius: 50%;
  animation: cov-pin-pulse 1.8s infinite ease-out;
}
.cov-pin-ring-2 { animation-delay: 0.6s; }

.cov-pin.is-uncovered .cov-pin-ring { border-color: var(--red); }

.cov-pin-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cyan), 0 0 0 3px var(--void);
}

.cov-pin.is-covered .cov-pin-core {
  background: var(--green);
  box-shadow: 0 0 8px var(--green), 0 0 0 3px var(--void);
}
.cov-pin.is-uncovered .cov-pin-core {
  background: var(--red);
  box-shadow: 0 0 8px var(--red), 0 0 0 3px var(--void);
}

@keyframes cov-pin-pulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cov-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100vh - 58px);
  }
  .cov-console {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 65vh;
  }
  .cov-map-wrap { min-height: 55vh; }
  .cov-head-title { font-size: 1.7rem; }
}

/* ── Auth UI ────────────────────────────────────────────────────────────── */
nav .nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}
nav .nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  background: rgba(0, 207, 255, 0.08);
  border: 1px solid rgba(0, 207, 255, 0.2);
}
nav .user-email {
  color: #00cfff;
  font-family: monospace;
  font-size: 0.85rem;
}
nav .btn-logout {
  color: #888;
  font-size: 0.8rem;
  text-decoration: none;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  transition: all 0.15s;
}
nav .btn-logout:hover {
  color: #fff;
  background: rgba(255, 100, 100, 0.15);
}
