:root {
  --bg: #07080d;
  --bg-2: #0d0f17;
  --panel: rgba(20, 23, 35, 0.62);
  --panel-solid: #141723;
  --panel-hi: rgba(32, 36, 54, 0.75);
  --line: rgba(255, 255, 255, 0.08);
  --line-hi: rgba(255, 255, 255, 0.16);
  --text: #e8eaf2;
  --muted: #8b90a7;
  --faint: #5a5f78;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --pink: #f472b6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --grad: linear-gradient(120deg, var(--cyan), var(--violet) 60%, var(--pink));
  --radius: 16px;
  --radius-sm: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font-family: var(--mono); font-size: 0.9em; }
kbd {
  padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line-hi); background: rgba(255,255,255,0.04);
}
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: rgba(168, 85, 247, 0.4); }

/* ---------- Fondo animado ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35; animation: float 22s ease-in-out infinite alternate; }
.blob-a { width: 520px; height: 520px; background: var(--violet); top: -180px; left: -120px; }
.blob-b { width: 460px; height: 460px; background: var(--cyan); top: -140px; right: -140px; animation-delay: -8s; opacity: 0.25; }
.blob-c { width: 380px; height: 380px; background: var(--pink); bottom: -200px; left: 40%; animation-delay: -14s; opacity: 0.15; }
@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  backdrop-filter: blur(14px) saturate(140%);
  background: rgba(7, 8, 13, 0.55);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--grad); color: #0b0d14; font-weight: 800;
  box-shadow: 0 0 24px -4px rgba(168, 85, 247, 0.7);
}
.brand-name span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.privacy-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--green);
  padding: 5px 10px; border-radius: 999px;
  background: rgba(52, 211, 153, 0.08); border: 1px solid rgba(52, 211, 153, 0.25);
}
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); font-size: 18px; color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-hi); transform: rotate(30deg); }
.icon-btn.attn { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); }

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 140px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow);
}

/* ---------- Hero / dropzone ---------- */
.hero { text-align: center; padding: clamp(48px, 10vh, 110px) 0 40px; }
.hero h1 {
  font-size: clamp(32px, 5.4vw, 60px); line-height: 1.05; letter-spacing: -0.035em;
  margin: 0 0 18px; font-weight: 800;
}
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); max-width: 640px; margin: 0 auto 40px; font-size: clamp(15px, 1.6vw, 18px); }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: 680px; margin: 0 auto; padding: 56px 24px;
  border-radius: 24px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  transition: transform .25s, border-color .25s, background .25s;
  outline: none;
}
.dz-ring {
  position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--angle, 0deg), transparent 0 60%, var(--cyan), var(--violet), var(--pink), transparent 90%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.6; animation: spin 6s linear infinite;
}
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --angle: 360deg; } }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { transform: translateY(-2px); border-color: transparent; background: var(--panel-hi); }
.dropzone:hover .dz-ring, .dropzone.over .dz-ring, .dropzone:focus-visible .dz-ring { opacity: 1; animation-duration: 2.5s; }
.dropzone.over { transform: scale(1.015); }
.dz-icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; font-size: 28px;
  background: linear-gradient(135deg, rgba(34,211,238,.15), rgba(168,85,247,.15));
  border: 1px solid var(--line-hi); color: var(--cyan); margin-bottom: 8px;
}
.dz-title { font-size: 18px; font-weight: 700; }
.dz-sub { color: var(--muted); font-size: 13px; }
.hero-foot { margin-top: 18px; }

/* ---------- Botones ---------- */
.ghost-btn, .primary-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: background .2s, border-color .2s, transform .15s, opacity .2s, box-shadow .2s;
}
.ghost-btn { background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--text); }
.ghost-btn:hover { border-color: var(--line-hi); background: rgba(255,255,255,0.07); }
.ghost-btn.danger:hover { border-color: rgba(248,113,113,.5); color: var(--red); }
.primary-btn { background: var(--grad); border: 0; color: #0b0d14; box-shadow: 0 8px 30px -8px rgba(168,85,247,.8); }
.primary-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 34px -6px rgba(168,85,247,.95); }
.primary-btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.primary-btn svg { font-size: 16px; }

/* ---------- Resultados ---------- */
.results { padding-top: 32px; display: flex; flex-direction: column; gap: 16px; animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.summary { padding: 22px 24px; display: grid; gap: 18px; }
.summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.summary-file { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-family: var(--mono); }
.summary-subject { font-size: clamp(18px, 2.4vw, 24px); font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 0; word-break: break-word; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 24px; }
.meta { min-width: 0; }
.meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }
.meta dd { margin: 2px 0 0; font-family: var(--mono); font-size: 13px; word-break: break-all; color: var(--text); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--line-hi); background: rgba(255,255,255,0.04);
}
.badge b { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge.pass { color: var(--green); border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.08); }
.badge.fail { color: var(--red); border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.badge.warn { color: var(--amber); border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.badge.none { color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { padding: 8px 14px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.stat b { font-size: 18px; display: block; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* toolbar */
.toolbar {
  position: sticky; top: 72px; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px;
}
.search { position: relative; flex: 1 1 220px; min-width: 180px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px;
  background: rgba(0,0,0,0.25); border: 1px solid var(--line); color: var(--text); font: inherit; outline: none;
}
.search input:focus { border-color: rgba(34,211,238,.5); box-shadow: 0 0 0 3px rgba(34,211,238,.12); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted);
  transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--line-hi); }
.chip[aria-selected="true"] { color: #0b0d14; background: var(--text); border-color: var(--text); }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .75; }
.toolbar-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: rgba(255,255,255,0.1); border: 1px solid var(--line); transition: background .2s; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + .switch-track { background: rgba(168,85,247,.35); border-color: rgba(168,85,247,.6); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(14px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(168,85,247,.3); }

/* grupos */
.groups { display: grid; gap: 16px; }
.group { overflow: hidden; animation: rise .4s ease both; }
.group-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.015);
}
.group-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 17px;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.group-title { font-weight: 700; font-size: 15px; }
.group-count { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.05); }
.group-head .spacer { flex: 1; }
.group-head .mini-btn { font-size: 12px; color: var(--muted); background: none; border: 0; padding: 4px 8px; border-radius: 6px; }
.group-head .mini-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.ioc-list { list-style: none; margin: 0; padding: 6px; }
.ioc {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer; transition: background .15s;
}
.ioc:hover { background: rgba(255,255,255,0.035); }
.ioc.sel { background: color-mix(in srgb, var(--c) 9%, transparent); }
.ioc .val { font-family: var(--mono); font-size: 13.5px; word-break: break-all; min-width: 0; }
.ioc .val small { display: block; font-family: var(--sans); font-size: 11.5px; color: var(--faint); margin-top: 2px; word-break: normal; }
.ioc .tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid var(--line);
}
.tag.priv { color: var(--amber); border-color: rgba(251,191,36,.3); }
.tag.asn { color: var(--cyan); border-color: rgba(34,211,238,.3); font-family: var(--mono); }
.tag.org { color: var(--text); }
.tag.loading { color: var(--faint); animation: pulse 1.2s ease-in-out infinite; }
.tag.err { color: var(--red); border-color: rgba(248,113,113,.3); }
@keyframes pulse { 50% { opacity: .4; } }
.hash-kind { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--c); margin-right: 8px; }

.check {
  appearance: none; width: 18px; height: 18px; border-radius: 6px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--line-hi); background: rgba(0,0,0,0.2); display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.check::after { content: ""; width: 9px; height: 5px; border: 2px solid #0b0d14; border-top: 0; border-right: 0; transform: rotate(-45deg) scale(0); transition: transform .15s; margin-top: -2px; }
.check:checked { background: var(--c, var(--violet)); border-color: var(--c, var(--violet)); }
.check:checked::after { transform: rotate(-45deg) scale(1); }
.check:indeterminate { background: var(--c, var(--violet)); border-color: var(--c, var(--violet)); }
.check:indeterminate::after { width: 8px; height: 0; border-left: 0; transform: none; margin: 0; }
.check:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }

/* barra de selección */
.selbar {
  position: fixed; left: 50%; bottom: 20px; z-index: 30;
  transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 18px; padding: 10px 10px 10px 20px;
  border-radius: 16px; background: rgba(20, 23, 35, 0.85); border: 1px solid var(--line-hi);
  backdrop-filter: blur(18px) saturate(160%); box-shadow: 0 20px 60px -10px rgba(0,0,0,.8);
  transition: transform .35s cubic-bezier(.2,.9,.3,1.2);
  width: max-content; max-width: calc(100vw - 32px);
}
.selbar.show { transform: translate(-50%, 0); }
.selbar-info { font-size: 14px; color: var(--muted); white-space: nowrap; }
.selbar-info strong { color: var(--text); font-family: var(--mono); font-size: 16px; }
.selbar-actions { display: flex; gap: 8px; }

/* modal */
.modal {
  border: 1px solid var(--line-hi); border-radius: 20px; padding: 0; color: var(--text);
  background: var(--panel-solid); width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.modal-body { padding: 24px; display: grid; gap: 16px; }
.modal h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.modal p { margin: 0; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input {
  height: 42px; padding: 0 12px; border-radius: 10px; background: rgba(0,0,0,.3);
  border: 1px solid var(--line); color: var(--text); font: 14px var(--mono); outline: none;
}
.field input:focus { border-color: rgba(34,211,238,.5); box-shadow: 0 0 0 3px rgba(34,211,238,.12); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* toast */
.toast {
  position: fixed; top: 84px; left: 50%; transform: translate(-50%, -20px); z-index: 50;
  padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--panel-solid); border: 1px solid var(--line-hi); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(52,211,153,.45); color: var(--green); }
.toast.bad { border-color: rgba(248,113,113,.45); color: var(--red); }

.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 0 16px 100px; }

@media (max-width: 640px) {
  .privacy-pill { display: none; }
  .toolbar { position: static; }
  .group-head { flex-wrap: wrap; row-gap: 4px; }
  .group-head .spacer { flex-basis: 100%; height: 0; }
  .group-head .mini-btn { white-space: nowrap; padding-left: 0; }
  .selbar-info span { display: none; }
  .selbar-info::after { content: " sel."; }
  .ioc { grid-template-columns: auto minmax(0, 1fr); }
  .ioc .tags { grid-column: 2; justify-content: flex-start; }
  .selbar { left: 16px; right: 16px; transform: translateY(140%); width: auto; gap: 10px; padding-left: 14px; }
  .selbar.show { transform: none; }
  .selbar-actions .ghost-btn { padding: 0 10px; }
}
