:root {
  --bg0: #061018;
  --bg1: #0c1c24;
  --ink: #e8f2f4;
  --muted: #8aa4ad;
  --accent: #2ec4b6;
  --accent-dim: rgba(46, 196, 182, 0.18);
  --line: rgba(232, 242, 244, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg0);
  overflow-x: hidden;
}

.scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  isolation: isolate;
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 20%, rgba(46, 196, 182, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 45% at 88% 75%, rgba(56, 120, 140, 0.22), transparent 50%),
    linear-gradient(165deg, var(--bg0) 0%, var(--bg1) 55%, #07141c 100%);
  z-index: -2;
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, black 20%, transparent 75%);
  opacity: 0.45;
  z-index: -1;
  animation: gridDrift 28s linear infinite;
}

.orb {
  position: absolute;
  width: min(42vw, 420px);
  height: min(42vw, 420px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%);
  filter: blur(8px);
  animation: orbFloat 9s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
}

.orb-a { top: 8%; right: 12%; animation-delay: -2s; }
.orb-b { bottom: 6%; left: 8%; width: min(30vw, 280px); height: min(30vw, 280px); animation-delay: -5s; }

.panel {
  width: min(640px, 100%);
  text-align: left;
  animation: riseIn 0.7s ease-out both;
}

.brand {
  font-family: "Sora", "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(3.4rem, 12vw, 5.5rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--ink);
}

.brand span {
  color: var(--accent);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.35rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(46, 196, 182, 0.55);
  animation: pulse 2.2s ease-out infinite;
}

.dot.warn {
  background: #e2a34b;
  box-shadow: 0 0 0 0 rgba(226, 163, 75, 0.45);
}

.lead {
  margin-top: 0.85rem;
  max-width: 28rem;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  line-height: 1.55;
  color: var(--muted);
}

.db-error {
  margin-top: 0.75rem;
  max-width: 34rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(226, 163, 75, 0.35);
  background: rgba(226, 163, 75, 0.08);
  color: #f0c987;
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: break-word;
}

.db-error code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: inherit;
  color: inherit;
}

.meta {
  margin-top: 2rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.meta strong {
  color: var(--ink);
  font-weight: 500;
}

.foot {
  margin-top: 1.75rem;
  font-size: 0.78rem;
  color: rgba(138, 164, 173, 0.85);
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 196, 182, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(46, 196, 182, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 196, 182, 0); }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-12px, 18px) scale(1.06); }
}

@keyframes gridDrift {
  from { transform: translateY(0); }
  to { transform: translateY(56px); }
}

@media (prefers-reduced-motion: reduce) {
  .grid, .orb, .dot, .panel, .sync-card, .folder-block { animation: none; }
}

/* —— Panel actividad / archivos —— */
.panel-narrow { width: min(420px, 100%); }

.brand-sm { font-size: clamp(2rem, 8vw, 2.8rem); }

.eyebrow {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.eyebrow a {
  color: var(--muted);
  text-decoration: none;
}

.eyebrow a:hover { color: var(--accent); }

.auth-form { margin-top: 1.5rem; display: grid; gap: 0.55rem; }

.field-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.field {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f1a22;
  color: var(--ink);
  font: inherit;
}

.field:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.btn-primary {
  margin-top: 0.5rem;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #042f2e;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.06); }

.form-error {
  margin: 1rem 0;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.35);
  color: #f5b4b4;
  font-size: 0.9rem;
}

.panel-body {
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

.panel-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 40% at 8% 0%, rgba(46, 196, 182, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 35% at 100% 20%, rgba(40, 90, 110, 0.18), transparent 50%),
    linear-gradient(180deg, #061018 0%, #08141c 50%, #061018 100%);
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(6, 16, 24, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-brand {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.top-brand span { color: var(--accent); }

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.top-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid transparent;
  text-decoration: none;
}

.top-pill.is-active {
  color: var(--ink);
  border-color: rgba(46, 196, 182, 0.35);
  background: rgba(46, 196, 182, 0.1);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.panel-wrap {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.5rem;
  animation: riseIn 0.55s ease-out both;
}

.page-hero { margin-bottom: 1.5rem; }

.page-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.55rem;
}

.page-title {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.page-lead {
  margin-top: 0.65rem;
  max-width: 38rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.98rem;
}

.rev-mark { color: var(--accent); }

.inline-code,
.mono {
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-size: 0.86em;
}

.inline-code {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(46, 196, 182, 0.1);
  color: var(--accent);
}

.stats-row,
.stats-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
}

.stat {
  min-width: 108px;
  padding: 0.9rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 28, 36, 0.65);
}

.stat strong {
  display: block;
  font-family: "Sora", sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat span {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-latest {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #042f2e;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}

.kind {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid rgba(46, 196, 182, 0.35);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  vertical-align: middle;
}

.empty-state {
  padding: 2rem 1.25rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(12, 28, 36, 0.4);
}

.empty-title {
  font-family: "Sora", sans-serif;
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.empty {
  color: var(--muted);
  line-height: 1.5;
}

/* Timeline de sync */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sync-card {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  padding: 0.35rem 0 0.35rem;
  animation: riseIn 0.5s ease-out both;
}

.sync-card:nth-child(1) { animation-delay: 0.02s; }
.sync-card:nth-child(2) { animation-delay: 0.06s; }
.sync-card:nth-child(3) { animation-delay: 0.1s; }
.sync-card:nth-child(4) { animation-delay: 0.14s; }
.sync-card:nth-child(5) { animation-delay: 0.18s; }

.sync-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.sync-rail::before {
  content: "";
  position: absolute;
  top: 1.1rem;
  bottom: -0.7rem;
  width: 1px;
  background: linear-gradient(180deg, rgba(46, 196, 182, 0.45), var(--line));
}

.sync-card:last-child .sync-rail::before { display: none; }

.sync-dot {
  width: 10px;
  height: 10px;
  margin-top: 1.15rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(46, 196, 182, 0.15);
  z-index: 1;
}

.sync-body {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.15rem 0.95rem;
  background: rgba(12, 28, 36, 0.72);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.sync-card:hover .sync-body {
  border-color: rgba(46, 196, 182, 0.45);
  background: rgba(16, 36, 46, 0.9);
  transform: translateY(-1px);
}

.sync-card.is-latest .sync-body {
  border-color: rgba(46, 196, 182, 0.28);
  box-shadow: 0 0 0 1px rgba(46, 196, 182, 0.08);
}

.sync-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.sync-rev {
  font-family: "Sora", sans-serif;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
}

.sync-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.sync-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
}

.dot-sep { opacity: 0.5; }

.sync-foot {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  align-items: center;
  font-size: 0.84rem;
  color: var(--muted);
}

.sync-cta {
  margin-left: auto;
  color: var(--accent);
  font-weight: 500;
}

.sync-card:hover .sync-cta { text-decoration: underline; }

/* Detalle revisión */
.rev-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 28, 36, 0.65);
}

.rev-repo {
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.stats-compact { margin-bottom: 0; }

.rev-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.rev-link:hover { text-decoration: underline; }

.tree-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.tree-filter { flex: 1; min-width: 200px; }

.tree-search { margin: 0; }

.tree-count {
  font-size: 0.8rem;
  color: var(--muted);
}

.folder-block {
  margin-bottom: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 22, 30, 0.7);
  animation: riseIn 0.45s ease-out both;
}

.folder-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem;
  background: rgba(46, 196, 182, 0.06);
  border-bottom: 1px solid var(--line);
}

.folder-icon {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
  flex-shrink: 0;
}

.folder-path {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.folder-count {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.file-list { list-style: none; }

.file-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr) auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid rgba(232, 242, 244, 0.05);
  font-size: 0.88rem;
}

.file-row:last-child { border-bottom: 0; }

.file-row:hover { background: rgba(46, 196, 182, 0.05); }

.file-name { font-weight: 500; color: var(--ink); }

.file-path {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.cta-link {
  display: inline-block;
  margin-top: 1.25rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.cta-link:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .file-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name size"
      "path path";
  }
  .file-name { grid-area: name; }
  .file-size { grid-area: size; }
  .file-path { grid-area: path; }
  .sync-cta { margin-left: 0; width: 100%; }
  .top-title { display: none; }
}

