:root{
  --bg:#f3f6fb;
  --bg2:#eaf0f8;
  --ink:#111827;
  --muted:#64748b;
  --card:#ffffff;
  --line:#e2e8f0;
  --line2:#cbd5e1;
  --blue:#2563eb;
  --blue2:#1d4ed8;
  --green:#15803d;
  --greenbg:#dcfce7;
  --red:#b91c1c;
  --redbg:#fee2e2;
  --amber:#b45309;
  --amberbg:#fef3c7;
  --dark:#0f172a;
  --dark2:#1e293b;
  --shadow:0 18px 45px rgba(15,23,42,.08);
  --shadow2:0 8px 24px rgba(15,23,42,.07);
  --radius:20px;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:Inter,Arial,Helvetica,sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(37,99,235,.10), transparent 32%),
    linear-gradient(180deg,var(--bg),#fff 58%);
  color:var(--ink);
}
a{color:var(--blue2);font-weight:700;text-decoration:none}
a:hover{text-decoration:underline}
.top{
  background:rgba(15,23,42,.97);
  color:white;
  padding:16px 24px;
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:center;
  position:sticky;
  top:0;
  z-index:20;
  box-shadow:0 10px 30px rgba(15,23,42,.18);
}
.top strong{font-size:17px;letter-spacing:.2px}
.top span{display:block;color:#cbd5e1;font-size:13px;margin-top:3px}
.top nav{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.top nav a{
  color:#eef2ff;
  text-decoration:none;
  font-size:14px;
  padding:9px 10px;
  border-radius:999px;
}
.top nav a:hover{background:rgba(255,255,255,.10)}
.wrap{max-width:1320px;margin:auto;padding:26px}
.hero{
  display:flex;
  justify-content:space-between;
  gap:20px;
  align-items:flex-start;
  margin-bottom:20px;
}
.hero h1{
  margin:0 0 8px;
  font-size:34px;
  letter-spacing:-.04em;
  line-height:1.05;
}
.hero p{margin:0;color:var(--muted);font-size:15px;line-height:1.5}
.actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.card{
  background:rgba(255,255,255,.94);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:18px;
  box-shadow:var(--shadow2);
}
.narrow{max-width:460px;margin:42px auto}
.stats,.grid.stats{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:20px;
}
.stats .card{min-height:92px}
.stats span{color:var(--muted);display:block;font-size:13px}
.stats strong{font-size:31px;line-height:1.1}
.danger{border-color:#fecaca;background:linear-gradient(180deg,#fff,#fff7f7)}
.filters{
  display:flex;
  gap:10px;
  margin-bottom:18px;
  align-items:center;
  flex-wrap:wrap;
  background:white;
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
  box-shadow:var(--shadow2);
}
.filters input,.filters select{min-width:230px;flex:1;margin-top:0}
input,select,textarea{
  width:100%;
  padding:11px 12px;
  border:1px solid #cfd6df;
  border-radius:12px;
  margin-top:7px;
  background:white;
  outline:none;
}
input:focus,select:focus,textarea:focus{
  border-color:var(--blue);
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}
textarea{min-height:92px;resize:vertical}
button,.btn{
  border:0;
  border-radius:12px;
  padding:11px 14px;
  background:#334155;
  color:white;
  text-decoration:none;
  cursor:pointer;
  font-weight:800;
  display:inline-block;
  box-shadow:0 7px 15px rgba(15,23,42,.10);
  white-space:nowrap;
}
button:hover,.btn:hover{filter:brightness(1.04);text-decoration:none}
.primary{background:var(--blue)!important}
.success{background:var(--green)!important}
.dangerbtn{background:var(--red)!important}
.secondary{background:#475569!important}
.table{overflow:auto;padding:0}
table{width:100%;border-collapse:separate;border-spacing:0}
th,td{
  padding:14px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top;
}
th{
  background:#eef3f9;
  color:#172033;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.04em;
  position:sticky;
  top:70px;
  z-index:3;
}
tr:hover td{background:#f8fbff}
.lead-name{font-size:16px}
.muted{color:var(--muted)}
.small{font-size:12px;color:var(--muted);line-height:1.45}
.url-cell{max-width:250px;word-break:break-word}
.pill,.badge{
  display:inline-block;
  padding:5px 9px;
  border-radius:999px;
  background:#e2e8f0;
  color:#334155;
  font-size:12px;
  font-weight:800;
  line-height:1;
}
.pill.green,.badge.ok,.quality-high{background:var(--greenbg);color:var(--green)}
.pill.red,.quality-blocked{background:var(--redbg);color:var(--red)}
.pill.amber,.badge.warn,.quality-medium{background:var(--amberbg);color:var(--amber)}
.quality-low{background:#e5e7eb;color:#374151}
.blocked{background:#fff1f2}
.flash{
  background:#fff7ed;
  border:1px solid #fed7aa;
  padding:12px 14px;
  border-radius:16px;
  margin-bottom:14px;
  box-shadow:var(--shadow2);
}
.flash p{margin:4px 0}
.scorebox{min-width:120px}
.scorebar{
  height:9px;
  width:100%;
  background:#e2e8f0;
  border-radius:999px;
  overflow:hidden;
  margin:7px 0 5px;
}
.scorebar span{
  display:block;
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg,#60a5fa,#2563eb);
}
.scorebar.high span{background:linear-gradient(90deg,#86efac,#16a34a)}
.scorebar.medium span{background:linear-gradient(90deg,#fde68a,#d97706)}
.scorebar.low span{background:linear-gradient(90deg,#cbd5e1,#64748b)}
.scorebar.blocked span{background:linear-gradient(90deg,#fecaca,#dc2626)}
.lead-grid{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:18px;
  align-items:start;
}
.panel-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:14px;
}
.info-list{display:grid;gap:8px;margin:0;padding:0;list-style:none}
.info-list li{
  background:#f8fafc;
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
}
.info-list strong{display:block;font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-bottom:4px}
.missing-list,.found-list,.reason-list{margin:10px 0 0;padding-left:18px;color:#334155}
.missing-list li{margin:4px 0;color:#92400e}
.found-list li{margin:4px 0;color:#166534}
.reason-list li{margin:4px 0}
.form label{display:block;font-weight:800;margin-bottom:12px;color:#1f2937}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.checks{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.checks label{
  background:#f8fafc;
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  font-weight:700;
}
.checks input{width:auto;margin-right:8px}
.inlineform{display:grid;grid-template-columns:1fr 2fr 2fr auto;gap:8px}
.section-title{
  margin:0 0 12px;
  font-size:18px;
  letter-spacing:-.02em;
}
.crm-alert{
  border:1px solid #bfdbfe;
  background:#eff6ff;
  color:#1e3a8a;
  border-radius:16px;
  padding:12px;
  margin-bottom:14px;
}
@media(max-width:980px){
  .stats,.grid.stats,.lead-grid,.panel-grid{grid-template-columns:1fr 1fr}
  .hero{display:block}
  .actions{justify-content:flex-start;margin-top:14px}
}
@media(max-width:760px){
  .top{display:block}
  .top nav{margin-top:12px}
  .wrap{padding:14px}
  .hero h1{font-size:28px}
  .stats,.grid.stats,.lead-grid,.panel-grid,.grid2,.checks,.inlineform{grid-template-columns:1fr}
  .filters{display:block}
  .filters>*{margin-bottom:8px}
  th{position:static}
  table{min-width:900px}
}

/* === Vista estratégica de leads en tarjetas === */
.hero-dashboard{
  align-items:flex-start;
}
.actions-dashboard{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  max-width:420px;
}
.actions-dashboard form{
  margin:0;
}
.stat-card{
  transition:transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow);
}
.lead-cards{
  display:grid;
  gap:18px;
  margin-top:18px;
}
.lead-card{
  background:rgba(255,255,255,.97);
  border:1px solid var(--line);
  border-radius:24px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.lead-card-top{
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding:20px 22px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(135deg,#ffffff,#f8fbff);
}
.lead-card-top h2{
  margin:10px 0 6px;
  font-size:24px;
  line-height:1.1;
  letter-spacing:-.03em;
}
.lead-card-top p{
  margin:0;
  color:var(--muted);
}
.lead-score{
  min-width:170px;
  text-align:right;
}
.lead-card-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:1px;
  background:var(--line);
}
.lead-panel{
  background:white;
  padding:16px;
  min-height:150px;
}
.lead-panel h3{
  margin:0 0 10px;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:#475569;
}
.lead-panel p{
  margin:6px 0;
  color:#334155;
  line-height:1.45;
}
.legal-panel{
  background:#f8fafc;
}
.next-panel{
  background:#eff6ff;
}
.web-link{
  display:inline-block;
  max-width:100%;
  word-break:break-word;
  font-weight:800;
}
.lead-card-footer{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:center;
  padding:16px 22px;
  background:#f8fafc;
}
.lead-blocked{
  border-color:#fecaca;
  background:#fff1f2;
}
.lead-blocked .lead-card-top{
  background:linear-gradient(135deg,#fff1f2,#ffffff);
}
@media(max-width:1100px){
  .lead-card-grid{
    grid-template-columns:repeat(2,1fr);
  }
  .lead-score{
    text-align:left;
  }
}
@media(max-width:760px){
  .actions-dashboard{
    max-width:none;
    justify-content:flex-start;
  }
  .lead-card-top,
  .lead-card-footer{
    display:block;
  }
  .lead-score{
    margin-top:14px;
  }
  .lead-card-grid{
    grid-template-columns:1fr;
  }
  .lead-card-footer .btn{
    margin-top:12px;
  }
}

/* === Tema oscuro profesional DGAIA === */
:root{
  --bg:#0b1120;
  --bg2:#111827;
  --ink:#e5edf8;
  --muted:#a8b3c7;
  --card:#182235;
  --card2:#1d293d;
  --line:#2e3b52;
  --line2:#3b4b65;
  --dark:#070b14;
  --dark2:#111827;
  --blue:#3b82f6;
  --blue2:#60a5fa;
  --green:#22c55e;
  --greenbg:#123821;
  --red:#ef4444;
  --redbg:#3a1518;
  --amber:#f59e0b;
  --amberbg:#3a2a10;
  --shadow:0 24px 70px rgba(0,0,0,.35);
  --shadow2:0 12px 32px rgba(0,0,0,.28);
}

body{
  color:var(--ink);
  background:
    radial-gradient(circle at 0% 22%, rgba(37,99,235,.28), transparent 34%),
    radial-gradient(circle at 100% 18%, rgba(14,165,233,.16), transparent 30%),
    linear-gradient(90deg,#060914 0%,#0d1526 20%,#172033 48%,#0d1526 78%,#060914 100%);
  min-height:100vh;
}

body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(90deg,rgba(0,0,0,.28),transparent 26%,transparent 74%,rgba(0,0,0,.34)),
    radial-gradient(circle at 50% 0%,rgba(255,255,255,.06),transparent 42%);
  z-index:-1;
}

.top{
  background:rgba(5,10,22,.92);
  backdrop-filter:blur(14px);
  border-bottom:1px solid rgba(148,163,184,.18);
  box-shadow:0 14px 45px rgba(0,0,0,.42);
}

.top .brand strong{
  color:#f8fafc;
}

.top .brand span{
  color:#94a3b8;
}

.top nav a{
  color:#cbd5e1;
  border:1px solid transparent;
  transition:.16s ease;
}

.top nav a:hover{
  background:rgba(59,130,246,.12);
  border-color:rgba(96,165,250,.25);
  color:#ffffff;
  text-decoration:none;
}

.top nav a.active{
  background:linear-gradient(135deg,#2563eb,#1d4ed8);
  color:#ffffff;
  border-color:rgba(191,219,254,.45);
  box-shadow:0 0 0 3px rgba(37,99,235,.22),0 12px 28px rgba(37,99,235,.28);
}

.wrap{
  max-width:1340px;
}

.hero h1{
  color:#f8fafc;
  text-shadow:0 2px 20px rgba(0,0,0,.28);
}

.hero p{
  color:#b6c3d8;
}

.card,
.lead-card,
.filters,
.flash{
  background:rgba(24,34,53,.94);
  border-color:rgba(148,163,184,.20);
  box-shadow:var(--shadow2);
}

.stat-card,
.stats .card{
  background:linear-gradient(180deg,rgba(30,41,59,.96),rgba(24,34,53,.96));
}

.stats span,
.small,
.muted,
.hero p,
.lead-card-top p{
  color:#a8b3c7;
}

.stats strong,
.lead-card-top h2,
.section-title,
.lead-name,
.lead-panel h3{
  color:#f8fafc;
}

.crm-alert{
  background:rgba(15,23,42,.78);
  border-color:rgba(96,165,250,.40);
  color:#dbeafe;
  box-shadow:var(--shadow2);
}

input,
select,
textarea{
  background:#101827;
  color:#e5edf8;
  border-color:#334155;
}

input::placeholder,
textarea::placeholder{
  color:#7f8da3;
}

input:focus,
select:focus,
textarea:focus{
  border-color:#60a5fa;
  box-shadow:0 0 0 4px rgba(59,130,246,.18);
}

button,
.btn{
  background:#293548;
  color:#f8fafc;
  box-shadow:0 10px 24px rgba(0,0,0,.26);
}

.primary{
  background:linear-gradient(135deg,#2563eb,#1d4ed8)!important;
}

.secondary{
  background:linear-gradient(135deg,#334155,#1e293b)!important;
}

.table,
.lead-card{
  border-color:rgba(148,163,184,.18);
}

th{
  background:#202b3e;
  color:#dbeafe;
}

td{
  border-bottom-color:#2e3b52;
}

tr:hover td{
  background:#1a263a;
}

.lead-card-top{
  background:linear-gradient(135deg,rgba(31,42,61,.96),rgba(20,29,45,.96));
  border-bottom-color:#2e3b52;
}

.lead-card-grid{
  background:#2e3b52;
}

.lead-panel{
  background:#182235;
}

.lead-panel:nth-child(even){
  background:#1b273b;
}

.legal-panel{
  background:#172033;
}

.next-panel{
  background:#13233a;
}

.lead-card-footer{
  background:#141e30;
  border-top:1px solid #2e3b52;
}

.found-list li{
  color:#86efac;
}

.missing-list li{
  color:#fbbf24;
}

.reason-list li,
.lead-panel p{
  color:#d5deec;
}

.pill,
.badge{
  background:#334155;
  color:#dbeafe;
}

.pill.green,
.badge.ok,
.quality-high{
  background:#123821;
  color:#86efac;
}

.pill.red,
.quality-blocked{
  background:#3a1518;
  color:#fecaca;
}

.pill.amber,
.badge.warn,
.quality-medium{
  background:#3a2a10;
  color:#fde68a;
}

.quality-low{
  background:#293548;
  color:#cbd5e1;
}

.scorebar{
  background:#334155;
}

.web-link,
a{
  color:#8ab4ff;
}

a:hover{
  color:#bfdbfe;
}

.checks label,
.info-list li{
  background:#131d2e;
  border-color:#2e3b52;
}

.blocked,
.lead-blocked{
  background:#2a151a;
}

.lead-blocked .lead-card-top{
  background:linear-gradient(135deg,#301820,#1b1420);
}

/* Ajuste de botones superiores para que no queden flotando raro */
.hero-dashboard{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:start;
}

.actions-dashboard{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  min-width:360px;
}

.actions-dashboard form{
  grid-column:1 / -1;
}

.actions-dashboard .btn,
.actions-dashboard button{
  width:100%;
  text-align:center;
}

@media(max-width:900px){
  .hero-dashboard{
    display:block;
  }
  .actions-dashboard{
    min-width:0;
    margin-top:16px;
    grid-template-columns:1fr;
  }
}

/* === Líneas y separadores más visibles === */
.card,
.lead-card,
.filters,
.crm-alert,
.flash{
  border-width:2px;
}

.lead-card{
  border-color:rgba(148,163,184,.34);
}

.lead-card-top{
  border-bottom:2px solid rgba(148,163,184,.28);
}

.lead-card-grid{
  gap:2px;
  background:rgba(148,163,184,.30);
}

.lead-panel{
  border:0;
}

.lead-card-footer{
  border-top:2px solid rgba(148,163,184,.28);
}

.stats .card,
.stat-card{
  border-width:2px;
  border-color:rgba(148,163,184,.26);
}

.filters{
  border-color:rgba(148,163,184,.30);
}

input,
select,
textarea{
  border-width:2px;
}

.crm-alert{
  border-width:2px;
  border-color:rgba(96,165,250,.55);
}

.top{
  border-bottom:2px solid rgba(148,163,184,.22);
}

.top nav a.active{
  border-width:2px;
}

.pill,
.badge{
  border:1px solid rgba(255,255,255,.10);
}

.scorebar{
  height:11px;
  border:1px solid rgba(255,255,255,.10);
}

table th,
table td{
  border-bottom-width:2px;
}

.checks label,
.info-list li{
  border-width:2px;
}

/* Resalte suave para separar visualmente cada tarjeta */
.lead-card{
  box-shadow:
    0 0 0 1px rgba(255,255,255,.035) inset,
    0 24px 70px rgba(0,0,0,.38);
}

.lead-panel h3{
  border-bottom:1px solid rgba(148,163,184,.20);
  padding-bottom:8px;
}

/* === Botón adicional de enriquecimiento web oficial === */
.actions-dashboard{
  grid-template-columns:1fr 1fr;
}
.actions-dashboard form{
  grid-column:1 / -1;
}
.actions-dashboard form + form{
  grid-column:1 / -1;
}
.success{
  background:linear-gradient(135deg,#16a34a,#15803d)!important;
}

/* === Auditoría legal web === */
.warningbtn{
  background:linear-gradient(135deg,#f59e0b,#b45309)!important;
}
.legal-audit-panel{
  background:#211b10;
}
.legal-audit-panel p{
  color:#f8e7b8;
}
.actions-dashboard form{
  grid-column:1 / -1;
}

/* === Informe legal preliminar ofrecible === */
.offer-box{
  margin-top:16px;
  background:rgba(34,28,16,.96);
  border-color:rgba(245,158,11,.42);
}
.offer-box h3{
  color:#fde68a;
}
.offer-box textarea[readonly]{
  background:#0f172a;
  color:#e5edf8;
  border-color:#475569;
  font-family:Consolas,Monaco,monospace;
  line-height:1.45;
}
.warningbtn{
  background:linear-gradient(135deg,#f59e0b,#b45309)!important;
}

/* === Corrección hueco gris en tarjetas === */
.next-panel{
  grid-column:1 / -1;
  min-height:120px;
}

.lead-card-grid{
  background:rgba(148,163,184,.34);
}

@media(max-width:1100px){
  .next-panel{
    grid-column:1 / -1;
  }
}

@media(max-width:760px){
  .next-panel{
    grid-column:auto;
  }
}

/* === Copiar informe / mensaje y registrar entrega === */
.copy-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:12px 0 14px;
}

.copy-actions .btn{
  min-width:220px;
  text-align:center;
}

.delivery-form{
  margin-top:16px;
  padding-top:16px;
  border-top:2px solid rgba(245,158,11,.35);
}

.delivery-form textarea{
  min-height:120px;
}

/* === Ficha demo de prueba === */
.demobtn{
  background:linear-gradient(135deg,#7c3aed,#5b21b6)!important;
}

.demo-warning{
  margin-bottom:18px;
  background:linear-gradient(135deg,rgba(76,29,149,.92),rgba(30,27,75,.94));
  border:2px solid rgba(196,181,253,.55);
  box-shadow:0 0 0 1px rgba(255,255,255,.04) inset,0 22px 60px rgba(76,29,149,.25);
}

.demo-warning h2{
  margin:0 0 8px;
  color:#ddd6fe;
}

.demo-warning p{
  margin:0;
  color:#ede9fe;
}

/* === Preparar contacto seguro === */
.contact-safe-box{
  background:rgba(12,31,42,.96);
  border-color:rgba(56,189,248,.42);
}

.contact-safe-box h2,
.contact-safe-box h3{
  color:#bae6fd;
}

.safecontactbtn{
  background:linear-gradient(135deg,#0ea5e9,#0369a1)!important;
}

.safe-result{
  margin-top:16px;
  padding-top:16px;
  border-top:2px solid rgba(56,189,248,.32);
}

.safe-result textarea[readonly]{
  margin-top:10px;
  background:#0f172a;
  color:#e5edf8;
  border-color:#475569;
  font-family:Consolas,Monaco,monospace;
  line-height:1.45;
}
