/* Lagoo Hub — design system (2026) */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

:root {
  --bg-base: #07080c;
  --bg-mesh-1: rgba(6, 182, 212, 0.07);
  --bg-mesh-2: rgba(99, 102, 241, 0.06);
  --surface: rgba(18, 20, 28, 0.78);
  --surface-hover: rgba(28, 32, 44, 0.92);
  --surface-solid: #12141c;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --muted: #9496a8;
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.14);
  --accent-glow: rgba(34, 211, 238, 0.35);
  --violet: #818cf8;
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --err: #fb7185;
  --err-bg: rgba(251, 113, 133, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse 80% 60% at 10% -10%, var(--bg-mesh-1), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 0%, var(--bg-mesh-2), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(34, 211, 238, 0.04), transparent);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: #67e8f9; }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 8, 12, 0.82);
  backdrop-filter: blur(16px) saturate(1.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0891b2, #6366f1);
  display: grid;
  place-items: center;
  box-shadow: 0 0 20px var(--accent-glow);
}

.brand-mark svg { width: 18px; height: 18px; color: #fff; }

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.site-nav a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.site-nav a.active { color: var(--accent); background: var(--accent-dim); }

.header-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sync-pill {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}

/* ── Main ── */
main {
  padding: 1.75rem 1.5rem 3rem;
  max-width: 1280px;
  margin: 0 auto;
}

main.wide { max-width: none; padding: 1.25rem 1.25rem 2rem; }

.page-head { margin-bottom: 1.75rem; }

.page-head h1, .page-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-head .lead { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ── Cards & surfaces ── */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  margin-bottom: 0.85rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.card:hover { border-color: var(--border-strong); background: var(--surface-hover); }

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card .detail {
  display: none;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--muted);
}

.card.open .detail { display: block; }

/* Bento home grid */
.bento {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.bento-card {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.bento-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-dim), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.bento-card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 0 1px rgba(34,211,238,0.1);
}

.bento-card:hover::before { opacity: 1; }

.bento-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  background: var(--accent-dim);
  color: var(--accent);
  position: relative;
  z-index: 1;
}

.bento-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.bento-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge.prod, .badge.production { background: var(--ok-bg); color: var(--ok); border-color: rgba(52,211,153,0.25); }
.badge.staging { background: var(--warn-bg); color: var(--warn); border-color: rgba(251,191,36,0.25); }
.badge.paused { background: var(--err-bg); color: var(--err); border-color: rgba(251,113,133,0.25); }
.badge.project { background: rgba(129,140,248,0.12); color: var(--violet); border-color: rgba(129,140,248,0.25); }

/* ── Buttons ── */
button, .btn {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #0891b2, #0e7490);
  color: #fff;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), opacity 0.12s;
  box-shadow: 0 2px 8px rgba(8,145,178,0.35);
}

button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(8,145,178,0.45); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

button.secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

button.warn {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 2px 8px rgba(217,119,6,0.35);
}

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

table.data td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: rgba(255,255,255,0.02); }

code, .mono {
  font-family: var(--mono);
  font-size: 0.82em;
  background: rgba(0,0,0,0.35);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

pre {
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  max-height: 420px;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.section-title {
  margin: 2rem 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ── Job row icon + tooltip ── */
.job-cell { display: flex; align-items: center; gap: 0.65rem; }

.job-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(34,211,238,0.2);
}

.job-icon.cat-ads { background: rgba(251,191,36,0.12); color: var(--warn); border-color: rgba(251,191,36,0.2); }
.job-icon.cat-backup { background: rgba(129,140,248,0.12); color: var(--violet); border-color: rgba(129,140,248,0.2); }
.job-icon.cat-catalog { background: rgba(52,211,153,0.12); color: var(--ok); border-color: rgba(52,211,153,0.2); }
.job-icon.cat-shield { background: rgba(251,113,133,0.12); color: var(--err); border-color: rgba(251,113,133,0.2); }
.job-icon.cat-prospector, .job-icon.cat-maintenance { background: rgba(34,211,238,0.1); color: #2dd4bf; border-color: rgba(45,212,191,0.2); }
.job-icon.cat-ai { background: rgba(167,139,250,0.12); color: #a78bfa; border-color: rgba(167,139,250,0.2); }

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: help;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.info-tip svg { width: 13px; height: 13px; }

.info-tip:hover,
.info-tip:focus-visible {
  color: var(--accent);
  border-color: rgba(34,211,238,0.4);
  background: var(--accent-dim);
  outline: none;
}

.tip-popover {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  width: min(300px, 85vw);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
  z-index: 100;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s;
  text-align: left;
  font-weight: 400;
}

.tip-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--border-strong);
}

.tip-popover .tip-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.tip-popover .tip-project {
  display: block;
  color: var(--violet);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.tip-popover .tip-desc { color: var(--muted); margin: 0; }

.info-tip:hover .tip-popover,
.info-tip:focus-within .tip-popover {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* flip tooltip if near top */
table.data tr:first-child .tip-popover {
  bottom: auto;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(-4px);
}

table.data tr:first-child .info-tip:hover .tip-popover,
table.data tr:first-child .info-tip:focus-within .tip-popover {
  transform: translateX(-50%) translateY(0);
}

table.data tr:first-child .tip-popover::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--border-strong);
}

/* ── Map layout ── */
.map-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1rem;
  min-height: calc(100vh - var(--header-h) - 2.5rem);
}

.map-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h) - 2.5rem);
}

.map-sidebar h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.map-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.stat-box {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
}

.stat-box .num {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.stat-box .lbl {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legend { display: flex; flex-direction: column; gap: 0.45rem; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.plane { background: #64748b; }
.legend-dot.production { background: var(--ok); box-shadow: 0 0 8px rgba(52,211,153,0.5); }
.legend-dot.staging { background: var(--warn); }
.legend-dot.unknown { background: #475569; }

.map-filters label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.35rem 0;
  cursor: pointer;
}

.map-filters input { accent-color: var(--accent); }

.map-canvas-wrap {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 50%, rgba(34,211,238,0.03), transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(255,255,255,0.02) 24px),
    repeating-linear-gradient(90deg, transparent, transparent 23px, rgba(255,255,255,0.02) 24px),
    rgba(0,0,0,0.35);
  overflow: hidden;
  min-height: 520px;
}

#graph {
  width: 100%;
  height: calc(100vh - var(--header-h) - 2.5rem);
  min-height: 520px;
}

.map-hint {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

/* Esconder nav nativa do vis-network (sprites ilegíveis) — usamos controles customizados */
div.vis-network div.vis-navigation {
  display: none !important;
}

.map-nav-controls {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 20;
}

.map-nav-controls button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #0891b2, #0e7490);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 2px 10px rgba(8, 145, 178, 0.4);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.map-nav-controls button:hover {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.5);
  transform: translateY(-1px);
}

.map-nav-controls button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.map-nav-row {
  display: flex;
  gap: 0.35rem;
}

#marquee-rect {
  display: none;
  position: absolute;
  border: 1px solid rgba(34, 211, 238, 0.85);
  background: rgba(34, 211, 238, 0.12);
  border-radius: 4px;
  pointer-events: none;
  z-index: 15;
}

.canvas-tools {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.canvas-mode-btn {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  text-align: left;
}

.canvas-mode-btn:hover { color: var(--text); border-color: var(--border-strong); }
.canvas-mode-btn.active {
  color: #fff;
  border-color: rgba(8, 145, 178, 0.6);
  background: linear-gradient(135deg, #0891b2, #0e7490);
}

#sel-count {
  font-size: 0.78rem;
  color: var(--accent);
  min-height: 1.1rem;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.view-btn {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.view-btn:hover { color: var(--text); border-color: var(--border-strong); }
.view-btn.active {
  color: var(--accent);
  border-color: rgba(34, 211, 238, 0.45);
  background: var(--accent-dim);
}

.map-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.map-actions button {
  width: 100%;
  font-size: 0.78rem;
}

/* ── Login / setup ── */
.auth-wrap {
  max-width: 400px;
  margin: 3rem auto;
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-wrap h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-wrap input[type="text"],
.auth-wrap input:not([type]) {
  font-family: var(--mono);
  font-size: 1.35rem;
  padding: 0.65rem 0.85rem;
  width: 100%;
  max-width: 10rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  letter-spacing: 0.15em;
  text-align: center;
}

.auth-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-form { display: flex; gap: 0.65rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }

.qr-box {
  background: #fff;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin: 1rem 0;
}

/* ── Run status icons ── */
.status-ok { color: var(--ok); }
.status-err { color: var(--err); }
.status-pause { color: var(--warn); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .map-shell { grid-template-columns: 1fr; }
  .map-sidebar { max-height: none; }
  #graph { height: 55vh; min-height: 360px; }
  .site-nav { display: none; }
  .sync-pill { display: none; }
}

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