/* ═══════════════════════════════════════════════════════════════
   E+ Tools — Global Styles
   Complements Tailwind utility classes
   ═══════════════════════════════════════════════════════════════ */

html { scroll-behavior: smooth }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale }

/* ── Prevent iOS auto-zoom on inputs (min 16px) ─────────────────── */
@media (max-width: 767px) {
  input, select, textarea { font-size: 16px !important; }
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ── Panel animation ─────────────────────────────────────────── */
.panel      { display: none; animation: panelIn .3s ease }
.panel.active { display: block }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px) }
  to   { opacity: 1; transform: translateY(0) }
}

/* ── Toast notifications ─────────────────────────────────────── */
#toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  max-width: calc(100vw - 32px);
  padding: 12px 20px; border-radius: 0.5rem;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(6,0,62,.15);
  transform: translateY(60px); opacity: 0;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none; font-family: Poppins, sans-serif;
}
#toast.show { transform: translateY(0); opacity: 1 }
#toast.ok   { background: #1b1464; color: #fff }
#toast.err  { background: #ba1a1a; color: #fff }

@media (max-width: 767px) {
  #toast { left: 16px; right: 16px; bottom: 24px; max-width: none; text-align: center; }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: #cccccc; border-radius: 3px }

/* ── Sidebar active link ─────────────────────────────────────── */
.nav-link.active {
  background: #fbff12;
  color: #1b1464;
  font-weight: 700;
}

/* ── Loading spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Word counter bar ────────────────────────────────────────── */
.wbar { height: 3px; border-radius: 2px; overflow: hidden; margin-top: 6px }
.wbar-fill { height: 100%; border-radius: 2px; transition: width .3s, background .3s }

/* ── Intake steps ────────────────────────────────────────────── */
.intake-step { display: none; animation: panelIn .3s ease }
.intake-step:first-of-type { display: block }

/* ── Select arrow fix ────────────────────────────────────────── */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%23787682' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

/* ── Form focus glow ─────────────────────────────────────────── */
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(6, 0, 62, 0.08);
}

/* ── Evaluator ───────────────────────────────────────────────── */
.eval-sec-chip { transition: all .2s ease }
.eval-sec-chip:hover { background: rgba(6,0,62,.06) }
.eval-sec-chip.active { background: #1b1464; color: #fff; font-weight: 700 }
.eval-sec-chip.active .eval-sec-dot { background: #fff !important }
.eval-q-item { transition: all .15s ease; border-left: 3px solid transparent }
.eval-q-item:hover { background: rgba(6,0,62,.05) }
.eval-q-item.active { border-left-color: #1b1464; background: rgba(6,0,62,.08); font-weight: 600 }
.eval-crit-card { transition: all .2s ease; border-left: 4px solid transparent }
.eval-crit-card:hover { box-shadow: 0 2px 8px rgba(6,0,62,.06) }
@keyframes critIn { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:translateY(0) } }
.eval-crit-card { animation: critIn .25s ease }

/* ── Field info tooltips ─────────────────────────────────────── */
.field-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(6,0,62,.08); color: #787682;
  cursor: pointer; transition: all .2s ease;
  flex-shrink: 0; vertical-align: middle; margin-left: 4px;
}
.field-info:hover { background: #1b1464; color: #fbff12 }
.field-info .material-symbols-outlined { font-size: 12px; line-height: 1 }

.field-info-overlay {
  position: fixed; inset: 0; z-index: 9997;
  background: rgba(0,0,0,.3);
  animation: overlayIn .15s ease;
}
.field-info-popup {
  position: fixed; z-index: 9998;
  background: #1e293b; color: #f1f5f9;
  border-radius: 14px; padding: 20px 24px;
  font-size: 13px; line-height: 1.7;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  max-width: 480px; min-width: 280px; width: 90vw;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 1;
  pointer-events: auto;
  max-height: 80vh; overflow-y: auto;
}
.field-info-popup h4 {
  font-size: 14px; font-weight: 700; color: #fbff12;
  margin: 0 0 10px 0; letter-spacing: .02em;
  padding-right: 24px;
}
.field-info-popup p { margin: 0 0 8px 0; color: #cbd5e1 }
.field-info-popup .tip-example {
  margin: 8px 0; padding: 10px 14px;
  background: rgba(255,255,255,.08); border-radius: 8px;
  font-size: 12px; color: #94d3a2; font-style: italic;
  border-left: 3px solid #22c55e;
}
.field-info-popup .tip-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: #94a3b8;
  cursor: pointer; font-size: 18px; line-height: 1;
  padding: 2px;
}
.field-info-popup .tip-close:hover { color: #fff }
@keyframes overlayIn { from { opacity:0 } to { opacity:1 } }

/* ── Per Diem cards ──────────────────────────────────────────── */
.perdiem-card { transition: transform .2s ease, box-shadow .2s ease }
.perdiem-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(6,0,62,.08) }

/* ── Responsive sidebar ──────────────────────────────────────── */
@media (max-width: 1023px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
}

@media (max-width: 767px) {
  #sidebar { width: 280px; }
}

/* ── Sidebar overlay (mobile) ────────────────────────────────── */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 39;
}
#sidebar-overlay.show { display: block; }

/* ── Partners grid responsive ────────────────────────────────── */
.partners-grid-header,
.partner-row {
  grid-template-columns: 28px 1fr 100px 110px 80px 32px;
}
@media (max-width: 767px) {
  .partners-grid-header { display: none; }
  .partner-row {
    grid-template-columns: 1fr 32px;
    grid-template-rows: auto auto;
  }
  .partner-row .partner-org  { grid-column: 1; grid-row: 1; font-weight: 600; }
  .partner-row .partner-meta { grid-column: 1; grid-row: 2; font-size: 12px; color: #787682; }
  .partner-row .partner-del  { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .partner-row .partner-city,
  .partner-row .partner-country,
  .partner-row .partner-role { display: none; }
}

/* ── Touch targets — min 44px ────────────────────────────────── */
@media (max-width: 767px) {
  button, [role="button"] { min-height: 44px; }
  .nav-link { min-height: 48px !important; padding-top: 12px !important; padding-bottom: 12px !important; }
  select { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
}

/* ── Admin tables scroll hint ────────────────────────────────── */
@media (max-width: 767px) {
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
  .overflow-x-auto::after {
    content: '';
    display: block;
  }
}

/* ── Admin tables → card view on mobile ─────────────────────── */
@media (max-width: 639px) {
  .admin-table-wrap thead { display: none; }
  .admin-table-wrap tbody tr {
    display: flex; flex-wrap: wrap;
    padding: 12px 16px; gap: 4px;
    border-bottom: 1px solid rgba(120,118,130,.15);
    position: relative;
  }
  .admin-table-wrap tbody td {
    display: inline-flex; align-items: center;
    padding: 2px 4px; font-size: 13px;
  }
  /* Action buttons always on their own line, right-aligned */
  .admin-table-wrap tbody td:last-child {
    width: 100%; justify-content: flex-end;
    padding-top: 8px; margin-top: 4px;
    border-top: 1px solid rgba(120,118,130,.1);
  }
  /* Primary name cell full width + bigger */
  .admin-table-wrap tbody td:nth-child(2) {
    width: 100%; font-weight: 600; font-size: 14px;
  }
}

/* ── Admin section nav wrap on mobile ───────────────────────── */
@media (max-width: 639px) {
  #admin-section-nav {
    flex-wrap: wrap;
    gap: 2px;
    padding-bottom: 0;
  }
  #admin-section-nav [data-section] {
    font-size: 11px;
    padding: 8px 10px;
    white-space: nowrap;
  }
}

/* ── Intake progress bar compact on mobile ───────────────────── */
@media (max-width: 639px) {
  .intake-progress-label { display: none; }
  .intake-progress-step  { min-width: 32px; }
}

/* ═══════════════════════════════════════════════════════════════
   Calculator
   ═══════════════════════════════════════════════════════════════ */

/* ── Step visibility ─────────────────────────────────────────── */
.calc-step { display: none; animation: panelIn .3s ease }
.calc-step.active { display: block }

/* ── Progress bar ────────────────────────────────────────────── */
.calc-prog-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid #cccccc; color: #787682;
  transition: all .2s ease; flex-shrink: 0;
}
.calc-prog-dot.active { background: #1b1464; border-color: #1b1464; color: #fff }
.calc-prog-dot.done   { background: #2d6a4f; border-color: #2d6a4f; color: #fff }
.calc-prog-dot.locked { opacity: .4; cursor: default }
.calc-prog-line { flex: 1; height: 2px; background: #cccccc; min-width: 12px }
.calc-prog-line.done  { background: #2d6a4f }

@media (max-width: 639px) {
  .calc-prog-label { display: none; }
  .calc-prog-dot   { width: 28px; height: 28px; font-size: 11px; }
}

/* ── WP section ──────────────────────────────────────────────── */
.calc-wp { border: 1px solid rgba(120,118,130,.15); border-radius: 12px; overflow: hidden; margin-bottom: 16px; border-left: 6px solid var(--wp-color, #787682); box-shadow: 0 2px 6px rgba(0,0,0,.08) }
.calc-wp-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  cursor: pointer; user-select: none; background: #f7f9fb;
  border-bottom: 1px solid rgba(120,118,130,.1);
  transition: background .15s;
}
.calc-wp-head:hover { background: #eceef0 }
.calc-wp-body { display: none; padding: 14px 16px; background: #fff }
.calc-wp.open .calc-wp-body { display: block }
.calc-wp-chevron { transition: transform .2s; font-size: 18px; color: #787682 }
.calc-wp.open .calc-wp-chevron { transform: rotate(180deg) }

/* ── WP title suggestion menu ────────────────────────────────── */
.wp-title-menu {
  position: absolute; top: 100%; right: 0; margin-top: 4px; z-index: 200;
  background: #1e293b; border-radius: 10px; padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  min-width: 280px; max-height: 320px; overflow-y: auto;
  animation: panelIn .15s ease;
}
.wp-title-group {
  padding: 8px 12px 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #94a3b8; border-top: 1px solid rgba(255,255,255,.06);
}
.wp-title-group:first-child { border-top: none }
.wp-title-item {
  display: block; width: 100%; text-align: left;
  padding: 7px 12px; border: none; background: transparent;
  color: #e2e8f0; font-size: 13px; font-family: Poppins, sans-serif;
  cursor: pointer; border-radius: 6px; transition: background .12s;
}
.wp-title-item:hover { background: rgba(255,255,255,.1); color: #fff }

/* ── Activity cards ──────────────────────────────────────────── */
.calc-act {
  border: 2px solid rgba(120,118,130,.25); border-radius: 10px;
  border-left: 5px solid var(--act-color, #787682);
  border-bottom: 4px solid var(--act-color, #787682);
  padding: 14px 16px; margin-bottom: 16px; background: #f7f9fb;
  position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.calc-act-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; letter-spacing: .03em;
}

/* ── Activity picker grid ────────────────────────────────────── */
.calc-act-picker {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px;
}
.calc-act-pick {
  padding: 8px 10px; border: 1px dashed rgba(120,118,130,.25);
  border-radius: 6px; background: transparent; cursor: pointer;
  text-align: left; transition: all .15s; font-family: inherit;
}
.calc-act-pick:hover { border-color: #1b1464; background: rgba(6,0,62,.04) }

/* ── Gantt ────────────────────────────────────────────────────── */
.calc-gantt-tip {
  display: none; position: fixed; z-index: 500;
  background: #1e293b; color: #fff; border-radius: 8px;
  padding: 10px 14px; font-size: 12px; line-height: 1.6;
  pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.3);
  max-width: 260px;
}

/* ── Result tabs ─────────────────────────────────────────────── */
.calc-res-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  border: none; background: transparent; color: #787682;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; font-family: inherit;
}
.calc-res-tab:hover { color: #191c1e }
.calc-res-tab.active { color: #1b1464; border-bottom-color: #1b1464; font-weight: 700 }

/* ── Print preview tab ───────────────────────────────────────── */
.print-tab-shell { display: flex; flex-direction: column; height: calc(100vh - 280px); min-height: 560px; }
.print-tab-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: #f8f8fc;
  border: 1px solid rgba(0,0,0,0.08); border-bottom: none;
  border-radius: 12px 12px 0 0;
}
.print-tab-frame-wrap {
  flex: 1; min-height: 0;
  background: #e9ebf3;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 0 0 12px 12px; overflow: hidden;
}
.print-tab-frame { width: 100%; height: 100%; border: 0; display: block; background: #e9ebf3; }

/* ── Save indicator ──────────────────────────────────────────── */
.calc-save {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 100; font-size: 12px; font-weight: 600;
  padding: 6px 16px; border-radius: 20px;
  transition: all .3s ease; pointer-events: none;
}
.calc-save.saving { background: #FEF3C7; color: #92400E; opacity: 1 }
.calc-save.saved  { background: #D1FAE5; color: #065F46; opacity: 1 }
.calc-save.error  { background: #FEE2E2; color: #991B1B; opacity: 1 }
.calc-save.hidden { opacity: 0 }

/* ── Tables inside calculator ────────────────────────────────── */
.calc-table { width: 100%; border-collapse: collapse; font-size: 13px }
.calc-table th { padding: 8px 10px; background: #eceef0; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #474551; border-bottom: 1px solid rgba(120,118,130,.2) }
.calc-table td { padding: 8px 10px; border-bottom: 1px solid rgba(120,118,130,.1); vertical-align: top }
.calc-table tr:last-child td { border-bottom: none }
.calc-table input[type="number"] { width: 90px; padding: 5px 8px; font-size: 13px; text-align: right }

/* ── Global rounded inputs across calculator & intake ────────── */
.calc-act input,
.calc-act select,
.calc-act textarea,
.calc-table input,
.calc-table select,
#intake-calc-container input,
#intake-calc-container select,
#intake-calc-container textarea,
#panel-intake input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
#panel-intake select,
#panel-intake textarea {
  border-radius: 8px;
  border: 1px solid rgba(120,118,130,.2);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.calc-act input:focus,
.calc-act select:focus,
.calc-act textarea:focus,
.calc-table input:focus,
.calc-table select:focus,
#intake-calc-container input:focus,
#intake-calc-container select:focus,
#intake-calc-container textarea:focus,
#panel-intake input:focus,
#panel-intake select:focus,
#panel-intake textarea:focus {
  border-color: #1b1464;
  box-shadow: 0 0 0 2px rgba(27,20,100,.1);
}

/* ── Larger text across intake & calculator ───────────────────── */
#panel-intake,
#intake-calc-container,
.calc-wp-body {
  font-size: 15px;
}
#panel-intake label,
#intake-calc-container label,
.calc-act label { font-size: 13px; }
#panel-intake input,
#panel-intake select,
#panel-intake textarea,
#intake-calc-container input,
#intake-calc-container select,
#intake-calc-container textarea,
.calc-act input,
.calc-act select,
.calc-act textarea { font-size: 14px; }
.calc-table { font-size: 14px; }
.calc-table th { font-size: 12px; }

@media (max-width: 639px) {
  .calc-table input[type="number"] { width: 70px; font-size: 14px }
}

/* ═══════════════════════════════════════════════════════════════
   Voice Input — Dictation button on textareas
   ═══════════════════════════════════════════════════════════════ */

.voice-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}
.voice-wrap textarea,
.voice-wrap input {
  padding-right: 44px;
}

/* Mic button */
.voice-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(120,118,130,.2);
  background: #f7f9fb;
  color: #787682;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  padding: 0;
}
.voice-btn:hover {
  background: #1b1464;
  color: #fbff12;
  border-color: #1b1464;
}
.voice-btn .material-symbols-outlined {
  font-size: 18px;
}

/* Active recording state */
.voice-btn.voice-active {
  background: #ba1a1a;
  border-color: #ba1a1a;
  color: #fff;
  animation: voicePulse 1.5s ease-in-out infinite;
}
.voice-btn.voice-active .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 24;
}

textarea.voice-recording {
  border-color: #ba1a1a !important;
  box-shadow: 0 0 0 2px rgba(186,26,26,.15) !important;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(186,26,26,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(186,26,26,0); }
}

/* Loading state (transcribing) */
.voice-btn.voice-loading {
  background: #f7f9fb;
  border-color: #1b1464;
  color: #1b1464;
  cursor: wait;
  pointer-events: none;
}
.voice-spin {
  animation: spin .8s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   Partner Engine (Entities) — estética Ana
   ═══════════════════════════════════════════════════════════════ */

/* Yellow hand-drawn underline (sobre una palabra clave) */
.yellow-underline {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.yellow-underline::after {
  content: '';
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 0.06em;
  height: 0.32em;
  background: #fbff12;
  z-index: -1;
  border-radius: 0.4em;
  transform: rotate(-1.2deg);
}

/* Splash amarillo decorativo (esquina superior derecha del hero) */
.splash-yellow {
  position: absolute;
  top: -40px;
  right: -60px;
  width: 280px;
  height: 280px;
  background: #fbff12;
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  filter: blur(4px);
  clip-path: polygon(20% 5%, 60% 0%, 100% 30%, 95% 70%, 70% 100%, 30% 95%, 5% 60%, 10% 25%);
}
.splash-yellow-sm {
  position: absolute;
  top: -20px;
  right: -30px;
  width: 160px;
  height: 160px;
  background: #fbff12;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  filter: blur(2px);
  clip-path: polygon(20% 5%, 60% 0%, 100% 30%, 95% 70%, 70% 100%, 30% 95%, 5% 60%, 10% 25%);
}

.entities-hero {
  background:
    radial-gradient(circle at 90% -20%, rgba(199,175,223,0.18), transparent 50%),
    linear-gradient(180deg, #f8f8f8 0%, transparent 100%);
}

/* Filtros sidebar */
.filter-group {
  border-bottom: 1px solid rgba(204,204,204,0.4);
  padding-bottom: 16px;
}
.filter-group:last-child {
  border-bottom: none;
}
.filter-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #474551;
  margin-bottom: 8px;
}
.filter-radio,
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #191c1e;
  transition: background-color 0.15s ease;
}
.filter-radio:hover,
.filter-toggle:hover {
  background: rgba(199,175,223,0.18);
}
.filter-radio input[type="radio"],
.filter-toggle input[type="checkbox"] {
  accent-color: #1b1464;
  cursor: pointer;
}
.filter-radio:has(input:checked),
.filter-toggle:has(input:checked) {
  background: #fbff12;
  color: #1b1464;
  font-weight: 700;
}
.filter-count {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #474551;
  margin-left: auto;
  font-weight: 600;
}

/* Tier badges */
.badge-tier {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-premium {
  background: #c7afdf;
  color: #1b1464;
}
.badge-good {
  background: rgba(251, 255, 18, 0.45);
  color: #1b1464;
  border: 1px solid #fbff12;
}
.badge-acceptable {
  background: #eeeeee;
  color: #474551;
}
.badge-minimal {
  background: transparent;
  color: #888888;
  border: 1px dashed #cccccc;
}

/* Card subtle yellow accent on hover */
.entity-card:hover h3 {
  background-image: linear-gradient(transparent 70%, rgba(251,255,18,0.5) 70%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* Ficha donut wrapper */
.ficha-donut-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Ficha overlay enter */
#entity-ficha-overlay:not(.hidden) #entity-ficha-panel {
  animation: slidein-right .28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slidein-right {
  from { transform: translateX(20px); opacity: 0.6; }
  to   { transform: translateX(0); opacity: 1; }
}

/* line-clamp utility (Tailwind plugin a veces no carga) */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-6 { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════
   S8 — Polish: animaciones, focus, accesibilidad
   ═══════════════════════════════════════════════════════════════ */

/* ── Card stagger fade-in ─────────────────────────────────── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.entity-card {
  animation: cardIn .45s cubic-bezier(.34,1.56,.64,1) backwards;
}
#entities-grid > .entity-card:nth-child(1) { animation-delay: .02s }
#entities-grid > .entity-card:nth-child(2) { animation-delay: .04s }
#entities-grid > .entity-card:nth-child(3) { animation-delay: .06s }
#entities-grid > .entity-card:nth-child(4) { animation-delay: .08s }
#entities-grid > .entity-card:nth-child(5) { animation-delay: .10s }
#entities-grid > .entity-card:nth-child(6) { animation-delay: .12s }
#entities-grid > .entity-card:nth-child(7) { animation-delay: .14s }
#entities-grid > .entity-card:nth-child(8) { animation-delay: .16s }
#entities-grid > .entity-card:nth-child(n+9) { animation-delay: .18s }

/* ── Focus visible on interactive elements ────────────────── */
.entity-card:focus-visible,
.shortlist-tab:focus-visible,
button:focus-visible,
a.nav-link:focus-visible,
.filter-radio:focus-within,
.filter-toggle:focus-within {
  outline: 3px solid #fbff12;
  outline-offset: 2px;
  border-radius: 12px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(251, 255, 18, 0.5);
}

/* ── KPI card subtle hover ────────────────────────────────── */
#stats-kpis > div {
  transition: transform .2s ease, box-shadow .2s ease;
}
#stats-kpis > div:hover {
  transform: translateY(-2px);
}

/* ── Map tooltip (D3) ─────────────────────────────────────── */
.map-tooltip {
  z-index: 10;
  box-shadow: 0 10px 24px rgba(27, 20, 100, 0.25);
}

/* ── Smooth scroll into chips ─────────────────────────────── */
#entities-active-chips {
  scroll-snap-type: x mandatory;
}
#entities-active-chips > * {
  scroll-snap-align: start;
}

/* ── Sticky filter sidebar shadow on scroll ───────────────── */
@media (min-width: 1024px) {
  #entities-filters {
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    padding-right: 4px;
  }
  #entities-filters::-webkit-scrollbar {
    width: 4px;
  }
}

/* ── Reduced motion respect ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .entity-card { animation: none !important; }
  .splash-yellow, .splash-yellow-sm { display: none; }
}

/* ── High contrast: ensure tier badges remain legible ─────── */
@media (prefers-contrast: more) {
  .badge-acceptable { border: 1px solid #474551; }
  .badge-minimal { color: #474551; }
}

/* ── Score bar polish ─────────────────────────────────────── */
.entity-card .filter-radio { /* ensure no leak */ display: none; }
.entity-card:hover .h-1\.5 > span {
  transition: filter .25s;
  filter: brightness(1.05);
}

/* ── Tablet & mobile: stack filters above grid ────────────── */
@media (max-width: 1023px) {
  #entities-filters {
    border-bottom: 1px solid rgba(204,204,204,0.4);
    padding-bottom: 16px;
    margin-bottom: 8px;
  }
}

/* ── Atlas globe tier-filter chips ───────────────────────── */
.tier-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: #f8f8f8; color: #1b1464;
  border: 1px solid rgba(204,204,204,0.5);
  cursor: pointer; transition: all .15s;
}
.tier-chip:hover { background: #eee; }
.tier-chip.active { background: #1b1464; color: #fff; border-color: #1b1464; }
.tier-chip .chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--chip, #888);
  box-shadow: 0 0 0 2px rgba(255,255,255,.4);
}
#stats-globe-container { cursor: grab; }
#stats-globe-container:active { cursor: grabbing; }

/* botones del toggle 2D/3D */
.atlas-mode-btn:not(.bg-primary):hover { background: rgba(27, 20, 100, 0.08); }

/* Popup MapLibre del Atlas — apariencia E+ */
.maplibregl-popup.atlas-popup .maplibregl-popup-content {
  border-radius: 14px;
  border: 1px solid rgba(204, 204, 204, 0.6);
  box-shadow: 0 10px 28px rgba(27, 20, 100, 0.18);
  padding: 0;
  background: #fff;
}
.maplibregl-popup.atlas-popup .maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button {
  font-size: 18px; padding: 4px 8px; color: #1b1464;
}
.atlas-popup-body { font-family: 'Poppins', sans-serif; min-width: 320px; }
.atlas-popup-body a { color: inherit; }
.atlas-popup-body a:hover { text-decoration: underline; }
/* Estilos del control de navegación */
.maplibregl-ctrl-group {
  border-radius: 10px !important;
  box-shadow: 0 2px 6px rgba(27, 20, 100, 0.15) !important;
}
.maplibregl-ctrl-attrib {
  font-size: 10px;
}

/* ── Project Summary rendered preview ──────────────────────────── */
.prose-summary p {
  margin: 0 0 0.9em 0;
}
.prose-summary p:last-child {
  margin-bottom: 0;
}
.prose-summary strong {
  font-weight: 700;
  color: #1b1464;
}
.prose-summary em {
  font-style: italic;
}
.prose-summary code {
  font-family: 'Fira Code', monospace;
  font-size: 0.85em;
  background: rgba(27,20,100,0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.prose-summary h2,
.prose-summary h3,
.prose-summary h4 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: #1b1464;
  line-height: 1.25;
}
.prose-summary h2 {
  font-size: 1.15rem;
  margin: 1.2em 0 0.5em 0;
}
.prose-summary h3 {
  font-size: 1rem;
  margin: 1em 0 0.4em 0;
}
.prose-summary h4 {
  font-size: 0.9rem;
  margin: 0.9em 0 0.3em 0;
}
.prose-summary h2:first-child,
.prose-summary h3:first-child,
.prose-summary h4:first-child {
  margin-top: 0;
}
.prose-summary ul {
  margin: 0 0 0.9em 0;
  padding-left: 1.2em;
  list-style: disc;
}
.prose-summary ul li {
  margin: 0.15em 0;
}
