:root {
  --bg-main: #f7f8fa;
  --bg-card: #ffffff;
  --text-main: #1f2933;
  --text-muted: #6b7280;
  --brand-primary: #2b5cff;
  --brand-secondary: #0f172a;
  --border-soft: #e5e7eb;
  --ok: #0f766e;
  --warn: #b45309;
  --bad: #b91c1c;
  --ps-bg: #f7f8fa;
  --ps-card: #ffffff;
  --ps-text: #0f172a;
  --ps-muted: rgba(15,23,42,.65);
  --ps-border: rgba(15,23,42,.10);
  --ps-border-strong: rgba(15,23,42,.14);
  --ps-primary: #2b5cff;
  --ps-success: #16a34a;
  --ps-warn: #f59e0b;
  --ps-danger: #ef4444;
  --ps-radius-lg: 18px;
  --ps-radius-md: 14px;
  --ps-shadow-sm: 0 10px 26px rgba(15,23,42,0.06);
  --ps-shadow-md: 0 18px 50px rgba(15,23,42,0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.container {
  max-width: 1600px;
  width: calc(100% - 48px);
  margin: 0 auto;
}

@media (min-width: 1600px){
  .container{ max-width: 1760px; }
}

.header {
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  text-decoration: none;
  font-weight: 700;
  color: var(--brand-secondary);
}

.nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.93rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
}

.nav a:hover {
  background: rgba(43, 92, 255, 0.08);
  color: var(--brand-secondary);
}

.header-cta-group {
  display: inline-grid;
  gap: 0.25rem;
  justify-items: end;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.7rem 1.05rem;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 10px 24px rgba(43, 92, 255, 0.28);
}

.header-cta:hover {
  background: #1f4df2;
}

.header-cta-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  text-align: right;
}

.cta-primary-note {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.mobile-flow-cta {
  display: none;
}

.main {
  padding: 2.2rem 0 4rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.iei-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 1.25rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.iei-hero {
  padding: 0.35rem 0 0.25rem;
}

.iei-hero-head h1 {
  margin-bottom: 0.45rem;
}

.iei-hero-metrics {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.iei-score {
  font-size: 3rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand-secondary);
}

.iei-bar {
  margin-top: 0.8rem;
  height: 10px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.iei-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(43, 92, 255, 0.95), rgba(43, 92, 255, 0.55));
  transition: width 0.35s ease;
}

.iei-human {
  margin-top: 0.75rem;
}

.technical-priority-block {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid #e5e5e5;
  background: #fafafa;
  border-radius: 12px;
}

.priority-title {
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 10px;
}

.priority-level {
  font-weight: 600;
  margin-bottom: 6px;
}

.priority-deadline {
  margin-bottom: 6px;
}

.priority-justification {
  font-size: 0.9rem;
  color: #666;
}

.iei-section {
  display: grid;
  gap: 0.65rem;
}

.iei-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.iei-chips .chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: #f9fafb;
  border: 1px solid var(--border-soft);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--brand-secondary);
}

.iei-steps {
  display: grid;
  gap: 0.75rem;
}

.iei-steps .step-card {
  display: flex;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.iei-steps .step-n {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(43, 92, 255, 0.12);
  color: var(--brand-primary);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 2px;
}

.iei-steps .step-txt {
  color: var(--brand-secondary);
  font-weight: 700;
  line-height: 1.35;
}

.plan-closing {
  margin-top: 10px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.45;
}

.iei-tech {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: #ffffff;
}

.iei-tech summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--brand-secondary);
  list-style: none;
}

.iei-tech summary::-webkit-details-marker {
  display: none;
}

.iei-tech summary:focus-visible {
  outline: 3px solid rgba(43, 92, 255, 0.18);
  outline-offset: 2px;
  border-radius: 12px;
}

.iei-tech #risk-explanation {
  margin-top: 0.75rem;
  white-space: pre-wrap;
}

.iei-cta-trust {
  margin-top: -0.25rem;
  margin-bottom: 0;
  font-size: 0.88rem;
}

h1,
h2,
h3 {
  color: var(--brand-secondary);
  margin: 0 0 0.7rem;
  line-height: 1.2;
}

p {
  margin: 0 0 0.85rem;
}

.lead {
  color: var(--text-muted);
}

.stack {
  display: grid;
  gap: 1rem;
}

.grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-size: 0.93rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.optional-details {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}

.optional-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--brand-secondary);
  list-style: none;
}

.optional-details summary::-webkit-details-marker {
  display: none;
}

.optional-details summary:focus-visible {
  outline: 3px solid rgba(43, 92, 255, 0.18);
  outline-offset: 2px;
  border-radius: 12px;
}

.optional-details-body {
  margin-top: 0.85rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.actions-left {
  justify-content: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.7rem 1.05rem;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
}

.btn-primary:hover {
  background: #1f4df2;
}

.btn-secondary {
  background: #fff;
  border-color: var(--border-soft);
  color: var(--brand-secondary);
}

.btn-secondary:hover {
  background: #f4f6f8;
}

.btn-danger {
  background: var(--bad);
  color: #fff;
}

.btn-danger:hover {
  background: #a31313;
}

.btn-compact {
  min-height: 36px;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
}

.metrics-grid {
  margin-top: 1rem;
}

.section-title {
  font-size: 1.2rem;
}

.subsection-title {
  font-size: 1.05rem;
  margin: 0;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  width: auto;
  min-width: 180px;
}

.divider {
  height: 1px;
  background: var(--border-soft);
  border-radius: 999px;
  margin: 0.65rem 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-low {
  color: var(--ok);
  background: rgba(15, 118, 110, 0.14);
}

.badge-medium {
  color: var(--warn);
  background: rgba(180, 83, 9, 0.14);
}

.badge-high {
  color: var(--bad);
  background: rgba(185, 28, 28, 0.14);
}

.badge-deleted {
  color: rgba(15, 23, 42, 0.68);
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.kpi {
  display: grid;
  gap: 0.25rem;
}

.kpi strong {
  font-size: 1.5rem;
  line-height: 1;
}

.table-wrap {
  overflow: visible;
}

.table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  line-height: 1.2;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.table th {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: normal;
}

/* 1 Fecha */            .table th:nth-child(1), .table td:nth-child(1){ width: 120px; }
/* 2 Contacto */         .table th:nth-child(2), .table td:nth-child(2){ width: 210px; }
/* 3 Ubicación */        .table th:nth-child(3), .table td:nth-child(3){ width: 110px; }
/* 4 Exposición IEI */   .table th:nth-child(4), .table td:nth-child(4){ width: 120px; }
/* 5 Lead score */       .table th:nth-child(5), .table td:nth-child(5){ width: 90px; }
/* 6 Ticket */           .table th:nth-child(6), .table td:nth-child(6){ width: 95px; }
/* 7 Plazo */            .table th:nth-child(7), .table td:nth-child(7){ width: 90px; }
/* 8 Estado */           .table th:nth-child(8), .table td:nth-child(8){ width: 95px; }
/* 9 Proveedor */        .table th:nth-child(9), .table td:nth-child(9){ width: 170px; }
/* 10 Precio */          .table th:nth-child(10), .table td:nth-child(10){ width: 85px; }
/* 11 Acción */          .table th:nth-child(11), .table td:nth-child(11){ width: 110px; }

.table td:nth-child(2){
  word-break: break-word;
}

.notice {
  border-left: 4px solid var(--brand-primary);
  background: rgba(43, 92, 255, 0.08);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
}

.error {
  border-left-color: var(--bad);
  background: rgba(185, 28, 28, 0.08);
}

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

.list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.45rem;
}

.footer {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.8rem;
  padding: 2rem 1rem;
}

@media (max-width: 900px) {
  .grid,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.8rem 0;
  }

  .nav {
    justify-content: flex-start;
  }

  .header-cta-group {
    display: none;
  }

  .mobile-flow-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 80;
    min-height: 48px;
    padding: 0.78rem 1rem;
    border-radius: 999px;
    background: var(--brand-primary);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.84rem;
    box-shadow: 0 12px 30px rgba(43, 92, 255, 0.32);
  }

  .main {
    padding-bottom: 5.5rem;
  }
}

@media (max-width: 520px) {
  .iei-score {
    font-size: 2.4rem;
  }
}

/* ================================
   Punto Seguro Admin Premium UI
   (non-breaking; keeps all IDs)
================================= */

body{
  background: var(--ps-bg);
  color: var(--ps-text);
}

/* Hero */
.ps-admin-hero{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 1.25rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--ps-border);
  background: var(--ps-card);
  border-radius: var(--ps-radius-lg);
  box-shadow: var(--ps-shadow-sm);
}

.ps-admin-title{
  margin:0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.ps-admin-subtitle{
  margin:.35rem 0 0;
  color: var(--ps-muted);
  max-width: 60ch;
}

.ps-admin-view{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:.4rem;
}

.ps-admin-view-label{
  font-size:.78rem;
  color: var(--ps-muted);
  font-weight: 700;
  letter-spacing: .02em;
}

.ps-admin-toggle{
  display:inline-flex;
  padding: .25rem;
  border-radius: 999px;
  border: 1px solid var(--ps-border);
  background: rgba(15,23,42,.03);
}

.ps-admin-toggle-btn{
  appearance:none;
  border:0;
  background: transparent;
  color: rgba(15,23,42,.75);
  font-weight: 800;
  font-size: .85rem;
  padding: .55rem .85rem;
  border-radius: 999px;
  cursor:pointer;
}

.ps-admin-toggle-btn.is-active{
  background: var(--ps-primary);
  color: #fff;
  box-shadow: 0 10px 25px rgba(43,92,255,0.22);
}

/* Section titles */
.ps-section-h2{
  margin:0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* Lift existing cards */
.card{
  border-radius: var(--ps-radius-lg);
  border: 1px solid var(--ps-border);
  box-shadow: var(--ps-shadow-sm);
}

/* Metrics as KPI cards (JS injects content inside #metrics) */
#metrics{
  margin-top: 1rem;
}

#metrics .metric,
#metrics .kpi,
#metrics > div{
  border: 1px solid var(--ps-border);
  border-radius: var(--ps-radius-md);
  background: #fff;
  box-shadow: none;
  padding: 1rem 1rem;
  position: relative;
  overflow: hidden;
}

#metrics .metric::before,
#metrics .kpi::before,
#metrics > div::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width: 5px;
  background: rgba(43,92,255,.9);
  opacity: .9;
}

/* List head */
.ps-list-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 1rem;
  margin-bottom: .75rem;
}

.ps-subline{
  margin:.35rem 0 0;
}

/* Table premium */
.table-wrap{
  border: 1px solid var(--ps-border);
  border-radius: var(--ps-radius-lg);
  overflow: visible;
  background: #fff;
}

.table{
  width:100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th{
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  border-bottom: 1px solid var(--ps-border);
  color: rgba(15,23,42,.78);
  font-size: .78rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: normal;
}

.table tbody td{
  border-bottom: 1px solid rgba(15,23,42,.06);
  vertical-align: top;
}

.table tbody tr:hover{
  background: rgba(43,92,255,0.04);
}

/* Make “money” columns pop a bit (Ticket/Precio) */
.table tbody td:nth-child(6),
.table tbody td:nth-child(10){
  font-weight: 800;
  color: rgba(15,23,42,.92);
}

/* Badges (you can optionally add classnames from JS later; safe defaults) */
.ps-badge{
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  padding:.3rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--ps-border);
  font-weight: 800;
  font-size: .82rem;
  background: rgba(15,23,42,.03);
  color: rgba(15,23,42,.85);
  white-space: nowrap;
}

.ps-badge--ok{ background: rgba(22,163,74,.08); border-color: rgba(22,163,74,.20); color: rgba(22,163,74,.95); }
.ps-badge--warn{ background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.22); color: rgba(245,158,11,.95); }
.ps-badge--danger{ background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.22); color: rgba(239,68,68,.95); }

/* Detail area: make it feel premium */
#lead-detail .card{
  border: 1px solid var(--ps-border);
  box-shadow: var(--ps-shadow-sm);
}

.subsection-title{
  letter-spacing: -0.01em;
}

/* Inputs */
.field input,
.field select,
.field textarea{
  border-radius: 12px;
  border: 1px solid var(--ps-border);
  background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus{
  outline: none;
  border-color: rgba(43,92,255,.35);
  box-shadow: 0 0 0 4px rgba(43,92,255,.10);
}

/* Buttons: slightly more premium */
.btn{
  border-radius: 999px;
  font-weight: 800;
}

.btn-primary{
  box-shadow: 0 12px 30px rgba(43,92,255,.22);
}

.ps-smart-filters{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
  margin: 12px 0 6px;
}

.ps-filter{ display:flex; flex-direction:column; gap:6px; min-width: 220px; }
.ps-filter-inline{ min-width: 180px; }

#q-search, #ticket-min, #iei-filter{
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.12);
  padding: 0 12px;
  background:#fff;
}

.ps-check{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.12);
  background:#fff;
  font-weight: 700;
  color: rgba(15,23,42,.75);
}

/* Responsive */
@media (max-width: 900px){
  .ps-admin-hero{
    align-items:flex-start;
    flex-direction: column;
  }
  .ps-admin-view{
    align-items:flex-start;
  }
  .table-wrap{
    overflow: visible;
  }
}

/* Collaborators admin table */
#collaborators-table th:nth-child(1), #collaborators-table td:nth-child(1){ width: 180px; }
#collaborators-table th:nth-child(2), #collaborators-table td:nth-child(2){ width: 120px; }
#collaborators-table th:nth-child(3), #collaborators-table td:nth-child(3){ width: 150px; }
#collaborators-table th:nth-child(4), #collaborators-table td:nth-child(4){ width: 120px; }
#collaborators-table th:nth-child(5), #collaborators-table td:nth-child(5){ width: 100px; }
#collaborators-table th:nth-child(6), #collaborators-table td:nth-child(6){ width: 180px; }
#collaborators-table th:nth-child(7), #collaborators-table td:nth-child(7){ width: 150px; }
#collaborators-table th:nth-child(8), #collaborators-table td:nth-child(8){ width: 110px; }
#collaborators-table th:nth-child(9), #collaborators-table td:nth-child(9){ width: 220px; }

#collaborators-table td:nth-child(9){
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.ps-toolbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:1rem;
  flex-wrap:wrap;
}

.ps-modal{
  position: fixed;
  inset: 0;
  z-index: 80;
}

.ps-modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ps-modal-panel{
  position: relative;
  width: min(900px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  margin: 1rem auto;
  background: #fff;
  border: 1px solid var(--ps-border);
  border-radius: 16px;
  box-shadow: var(--ps-shadow-md);
  padding: 1.2rem;
}

.ps-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  margin-bottom: 0.8rem;
}
