/* Ruta: wp-content/themes/wellonly/contratos/assets/css/wizard.css */
/* TEMA OSCURO PREMIUM - INSTANET CONTRATOS */

:root {
  /* Colores del tema oscuro */
  --instc-bg-primary: #0f172a;
  --instc-bg-card: rgba(30, 41, 59, 0.7);
  --instc-card: rgba(30, 41, 59, 0.9);
  --instc-line: rgba(255, 255, 255, 0.1);
  --instc-muted: #94a3b8;
  
  /* Textos */
  --instc-text-primary: #f8fafc;
  --instc-text-secondary: #cbd5e1;
  --instc-text-muted: #94a3b8;

  /* Acentos */
  --instc-brand: #3b82f6;
  --instc-ok: #10b981;
  --instc-accent: #3b82f6;
  --instc-warning: #f59e0b;
  --instc-danger: #ef4444;

  --instc-radius-xl: 20px;
  --instc-radius-lg: 16px;
  --instc-radius-md: 12px;

  --instc-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  --instc-shadow-soft: 0 12px 24px rgba(0, 0, 0, 0.2);
  
  /* Glassmorphism */
  --instc-glass-blur: blur(12px);
}

/* Base */
.instc-app-root {
  width: 100%;
}

.instc-btn {
  border: 1px solid var(--instc-line);
  background: #fff;
  color: #0f172a;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease, opacity .12s ease;
  user-select: none;
}

.instc-btn:hover {
  box-shadow: var(--instc-shadow-soft);
  border-color: #d1d5db;
}

.instc-btn:active {
  transform: translateY(1px);
}

.instc-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}

.instc-btn-primary {
  background: linear-gradient(180deg, #ff8d3a, var(--instc-brand));
  border-color: rgba(255, 122, 26, .25);
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 122, 26, .25);
}

.instc-btn-success {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  border-color: rgba(22, 163, 74, .25);
  color: #fff;
  box-shadow: 0 14px 26px rgba(22, 163, 74, .22);
  padding: 12px 18px;
}

.instc-btn-ghost {
  background: rgba(255, 255, 255, .08);
  color: #0f172a;
}

/* SEARCH CARD */
.instc-search-container {
  width: min(720px, calc(100% - 48px));
  margin: 26px auto 28px;
  background: var(--instc-card);
  border-radius: var(--instc-radius-xl);
  box-shadow: var(--instc-shadow);
  padding: 22px 22px 18px;
}

.instc-search-container h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.instc-search-container p {
  margin: 8px 0 14px;
  color: var(--instc-muted);
  font-size: 13px;
  font-weight: 500;
}

.instc-search-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.instc-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--instc-line);
  outline: none;
  font-size: 14px;
}

.instc-input:focus {
  border-color: #cbd5e1;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .08);
}

.instc-search-status {
  min-height: 18px;
  color: var(--instc-muted);
  font-size: 12px;
  font-weight: 600;
}

/* SEARCH RESULTS - DARK THEME FIX (MATCHING APP.JS) */
#instc-search-results,
.instc-search-results {
  margin-top: 12px;
  border: 1px solid rgba(51, 65, 85, 0.5) !important;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.95) !important;
  /* Dark opaque background */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* Container for the list */
.client-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Individual Result Item */
.client-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5) !important;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #f8fafc !important;
  /* White text forces */
}

.client-item:hover {
  background: rgba(59, 130, 246, 0.2) !important;
  /* Blue accent on hover */
}

.client-item:last-child {
  border-bottom: none !important;
}

/* Avatar Circle */
.client-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Client Info Container */
.client-info {
  flex: 1;
  min-width: 0;
  /* Text truncation fix */
}

/* Client Name */
.client-name {
  font-weight: 700;
  font-size: 14px;
  color: #f8fafc !important;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Client Meta (DNI, Plan) */
.client-meta {
  font-size: 12px;
  color: #94a3b8 !important;
  /* Slate-400 */
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Arrow Icon */
.client-arrow {
  width: 18px;
  height: 18px;
  color: #64748b;
  flex-shrink: 0;
}

.client-item:hover .client-arrow {
  color: #f8fafc;
}

/* Empty State */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state__title {
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 4px;
}

/* Loading State */
.loading {
  padding: 30px;
  text-align: center;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.loading__spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.instc-importar-btn-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

/* FIX: GLOBAL SVG CONSTRAINT FOR GIANT ICONS */
svg {
  max-width: 100%;
  height: auto;
}

.consent-checkbox svg {
  width: 100%;
  height: 100%;
  display: block;
}

.consent-checkbox {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* FIX: Constrain SVGs in toast/notification containers */
#toast-container svg,
.toast svg,
.toast-warning svg,
.toast-error svg,
.toast-info svg,
.toast-success svg,
.warning-icon svg,
.info-box svg,
.info-box__icon {
  width: 24px !important;
  height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  flex-shrink: 0;
}

/* FIX: Prevent any SVG from taking over the screen */
body svg {
  max-width: 100% !important;
}

/* Specific fix for cookie consent warning icons */
[class*="cookie"] svg,
[class*="consent"] svg,
[class*="banner"] svg {
  max-width: 48px;
  max-height: 48px;
}

/* WIZARD SHELL */
.instc-wizard-container {
  width: 100%;
}

.instc-shell {
  min-height: 100vh;
  min-height: 100dvh;
  /* móvil */
  display: flex;
  flex-direction: column;
}

.instc-topbar {
  height: 92px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.instc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.instc-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.instc-brand-name {
  font-weight: 800;
  letter-spacing: .5px;
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.instc-brand-name .net {
  color: var(--instc-brand);
}

.instc-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 999px;
  color: #fff;
  min-width: 220px;
  justify-content: flex-end;
}

.instc-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--instc-brand);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  color: #fff;
  flex: 0 0 auto;
}

.instc-user-name {
  font-weight: 600;
  font-size: 13px;
  opacity: .95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* STEPPER */
.instc-stepper {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
  flex: 1;
}

.instc-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, .85);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.instc-step-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 2px solid transparent;
  box-shadow: 0 8px 18px rgba(2, 6, 23, .25);
}

.instc-step.is-done .instc-step-dot {
  background: var(--instc-ok);
  color: #fff;
}

.instc-step.is-active .instc-step-dot {
  background: var(--instc-brand);
  color: #fff;
}

.instc-step.is-next .instc-step-dot {
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .55);
  border-color: rgba(255, 255, 255, .08);
}

.instc-connector {
  width: 70px;
  height: 2px;
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
}

.instc-connector.is-done {
  background: rgba(34, 197, 94, .75);
}

.instc-connector.is-active {
  background: rgba(34, 197, 94, .45);
}

/* MAIN CARD */
.instc-page {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto 28px;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.instc-card {
  width: 100%;
  background: var(--instc-card);
  border-radius: var(--instc-radius-xl);
  box-shadow: var(--instc-shadow);
  overflow: hidden;
}

.instc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--instc-line);
  gap: 16px;
}

.instc-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.instc-doc-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 122, 26, .12);
  display: grid;
  place-items: center;
  color: var(--instc-brand);
  border: 1px solid rgba(255, 122, 26, .18);
  flex: 0 0 auto;
}

.instc-hgroup {
  min-width: 0;
}

.instc-hgroup h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.02em;
}

.instc-hgroup p {
  margin: 6px 0 0;
  color: var(--instc-muted);
  font-size: 13px;
  font-weight: 500;
}

/* Grid panes */
.instc-content {
  display: grid;
  grid-template-columns: 1.75fr 1fr;
  min-height: 520px;
}

.instc-pane {
  padding: 18px 20px 20px;
}

.instc-pane+.instc-pane {
  border-left: 1px solid var(--instc-line);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

/* Preview header row */
.instc-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 12px;
  gap: 12px;
}

.instc-kicker {
  font-size: 12px;
  letter-spacing: .12em;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
}

.instc-tools {
  display: flex;
  gap: 8px;
}

.instc-tool {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--instc-line);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.instc-tool:hover {
  box-shadow: var(--instc-shadow-soft);
}

.instc-tool svg {
  width: 16px;
  height: 16px;
  opacity: .8;
}

/* Preview box */
.instc-preview-wrap {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  box-shadow: 0 18px 35px rgba(2, 6, 23, .08);

  /* IMPORTANTE en móvil: scroll interno para leer el contrato */
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  height: 420px;
}

.instc-preview-inner {
  width: 100%;
  height: 100%;
  transform-origin: top left;
}

.instc-preview-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

/* Signature side */
.instc-sig-title {
  margin: 10px 0 6px;
  font-size: 16px;
  font-weight: 800;
}

.instc-sig-sub {
  margin: 0 0 14px;
  color: var(--instc-muted);
  font-size: 12px;
  font-weight: 500;
}

.instc-client-card {
  background: rgba(59, 130, 246, .10);
  border: 1px solid rgba(59, 130, 246, .18);
  border-left: 4px solid var(--instc-accent);
  border-radius: 12px;
  padding: 12px 12px;
  margin-bottom: 14px;
}

.instc-client-name {
  font-weight: 800;
  font-size: 13px;
  margin: 0 0 4px;
}

.instc-client-meta {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.instc-sig-kicker {
  font-size: 12px;
  letter-spacing: .12em;
  color: #94a3b8;
  font-weight: 800;
  text-transform: uppercase;
  margin: 6px 0 8px;
}

.instc-sig-box {
  position: relative;
  border-radius: 14px;
  border: 2px dashed rgba(59, 130, 246, .8);
  background: linear-gradient(180deg, #fff, #f7fbff);
  height: 210px;
  overflow: hidden;
}

#instc-signature-canvas {
  width: 100%;
  height: 100%;
  display: block;

  /* evita scroll/zoom del navegador durante firma */
  touch-action: none;
  -ms-touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;

  cursor: crosshair;
}

.instc-sig-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: #64748b;
  font-weight: 700;
  gap: 8px;
  text-align: center;
}

.instc-sig-overlay .emoji {
  font-size: 32px;
  opacity: .9;
}

.instc-sig-overlay .hint {
  font-size: 12px;
  font-weight: 700;
  opacity: .9;
}

.instc-sig-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Footer inside card */
.instc-card-footer {
  border-top: 1px solid var(--instc-line);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.instc-secure-note {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
}

.instc-footer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

/* =========================
   RESPONSIVE (mejorado)
   ========================= */

@media (max-width: 980px) {
  .instc-topbar {
    height: auto;
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .instc-stepper {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .instc-page {
    width: calc(100% - 24px);
  }

  .instc-content {
    grid-template-columns: 1fr;
  }

  .instc-pane+.instc-pane {
    border-left: none;
    border-top: 1px solid var(--instc-line);
  }
}

@media (max-width: 820px) {
  .instc-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .instc-card-header .instc-btn {
    width: 100%;
    justify-content: center;
  }

  .instc-user-pill {
    width: 100%;
    min-width: unset;
    justify-content: flex-start;
  }

  .instc-brand {
    min-width: unset;
  }

  .instc-connector {
    width: 42px;
  }
}

@media (max-width: 560px) {
  .instc-topbar {
    padding: 10px 12px;
    gap: 10px;
  }

  .instc-brand {
    min-width: unset;
    gap: 8px;
  }

  .instc-brand-text {
    display: none;
  }

  .instc-logo {
    width: 36px;
    height: 36px;
  }

  .instc-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .instc-user-pill {
    padding: 8px 10px;
    gap: 6px;
  }

  .instc-user-name {
    max-width: 80px;
    font-size: 12px;
  }

  .instc-search-container {
    width: calc(100% - 20px);
    margin: 14px auto;
    padding: 16px 14px;
  }

  .instc-search-container h3 {
    font-size: 17px;
  }

  .instc-search-container p {
    font-size: 12px;
    margin: 6px 0 12px;
  }

  .instc-search-box {
    flex-direction: column;
    gap: 8px;
  }

  .instc-page {
    width: calc(100% - 18px);
    margin-bottom: 18px;
  }

  .instc-card-header {
    padding: 16px 14px;
  }

  .instc-pane {
    padding: 14px 14px 16px;
  }

  .instc-stepper {
    gap: 8px;
  }

  .instc-step {
    gap: 8px;
    font-size: 12px;
  }

  .instc-step-dot {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .instc-connector {
    width: 26px;
  }

  .instc-preview-wrap {
    height: 360px;
  }

  .instc-sig-box {
    height: 260px;
  }

  .instc-sig-actions {
    justify-content: stretch;
  }

  .instc-sig-actions .instc-btn {
    flex: 1;
    justify-content: center;
  }

  .instc-card-footer {
    padding: 12px 14px;
  }

  .instc-footer-actions {
    width: 100%;
    justify-content: stretch;
  }

  .instc-footer-actions .instc-btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 380px) {

  /* Evita que el texto del step rompa el layout */
  .instc-step.is-active>div:last-child {
    display: none;
  }

  .instc-connector {
    width: 18px;
  }
}

/* =========================
   CONSENTIMIENTOS SECTION (MÓVIL)
   ========================= */
.instc-consentimientos-section {
  margin: 20px 0;
  padding: 20px;
  border: 2px solid #2271b1;
  border-radius: 8px;
  background: #f8fafc;
}

@media (max-width: 560px) {
  .instc-consentimientos-section {
    margin: 15px 0;
    padding: 15px 12px;
  }

  .instc-consentimientos-section h3 {
    font-size: 16px;
  }

  .consent-item {
    padding: 12px !important;
  }

  .consent-item label {
    flex-direction: column;
    gap: 10px;
  }

  .consent-item input[type="checkbox"] {
    margin-right: 0 !important;
    margin-bottom: 5px;
  }
}

/* =========================
   FIRMA SECTION (MÓVIL)
   ========================= */
.instc-firma-section {
  margin: 20px 0;
  padding: 20px;
  border: 2px solid #10b981;
  border-radius: 8px;
  background: #f0fdf4;
}

@media (max-width: 560px) {
  .instc-firma-section {
    margin: 15px 0;
    padding: 15px 12px;
  }

  .instc-firma-section h3 {
    font-size: 16px;
  }

  #cliente-firma-canvas {
    width: 100% !important;
    max-width: 320px;
    height: 140px !important;
  }

  .instc-firma-section button {
    width: 100%;
    margin: 5px 0 !important;
    padding: 12px 20px !important;
  }
}

/* =========================
   PREVIEW IFRAME MÓVIL
   ========================= */
@media (max-width: 560px) {
  .instc-preview-wrap {
    height: 320px;
  }

  .instc-preview-iframe {
    transform: scale(0.65);
    transform-origin: top left;
    width: 154%;
    height: 154%;
  }
}

@media (max-width: 380px) {
  .instc-preview-wrap {
    height: 280px;
  }

  .instc-preview-iframe {
    transform: scale(0.55);
    width: 182%;
    height: 182%;
  }
}

/* =========================
   CONSENTIMIENTOS & RADIO BUTTONS - DARK THEME
   ========================= */

/* Contenedor de grupo (flex row/column) */
.consent-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Cada item individual (label contenedor) */
.consent-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.5) !important;
  border: 1px solid rgba(51, 65, 85, 0.5) !important;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #f8fafc !important;
  margin-bottom: 0;
}

.consent-item:hover {
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
}

/* Checkbox visual (el cuadrado/círculo) */
.consent-checkbox {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  border: 2px solid rgba(148, 163, 184, 0.6);
  border-radius: 6px;
  display: grid !important;
  place-items: center;
  background: rgba(15, 23, 42, 0.8);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.consent-checkbox svg {
  width: 16px !important;
  height: 16px !important;
  opacity: 0;
  color: white;
  transition: opacity 0.15s ease;
}

/* Estado marcado - usando clase .is-checked */
.consent-item.is-checked .consent-checkbox {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
}

.consent-item.is-checked .consent-checkbox svg {
  opacity: 1 !important;
}

/* Estado marcado - usando :has() para navegadores modernos */
.consent-item:has(input:checked) .consent-checkbox {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
}

.consent-item:has(input:checked) .consent-checkbox svg {
  opacity: 1 !important;
}

/* Labels y texto */
.consent-item label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
  color: inherit;
}

.consent-item span {
  color: #f8fafc !important;
  font-weight: 500;
  font-size: 14px;
}

.consent-item strong {
  display: block;
  margin-bottom: 4px;
  color: #f8fafc;
}

/* Variantes de consentimiento */
.consent-required {
  background: rgba(245, 158, 11, 0.15) !important;
  border-left: 3px solid #f59e0b !important;
}

.consent-required strong {
  color: #fbbf24 !important;
}

.consent-required .consent-text {
  color: #fde68a !important;
  font-size: 13px;
  line-height: 1.5;
}

.consent-optional {
  background: rgba(30, 41, 59, 0.6) !important;
}

.consent-optional strong {
  color: #e2e8f0 !important;
}

.consent-optional .consent-text {
  color: #94a3b8 !important;
  font-size: 13px;
  line-height: 1.5;
}

/* Badges */
.consent-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.consent-badge-required {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.consent-badge-optional {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Aviso legal */
.consent-legal-notice {
  margin-top: 20px;
  padding: 14px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  font-size: 12px;
  color: #93c5fd;
}

.consent-legal-notice strong {
  display: inline;
  margin-bottom: 0;
  color: #60a5fa;
}



/* =========================
   FIRMA DIGITAL - ESTILOS EXTRAÍDOS
   ========================= */
.instc-firma-canvas-container {
  text-align: center;
}

.instc-firma-canvas-wrapper {
  display: inline-block;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#cliente-firma-canvas {
  border: 2px dashed #cbd5e1;
  border-radius: 4px;
  touch-action: none;
}

.instc-firma-buttons {
  text-align: center;
  margin-top: 20px;
}

.instc-firma-btn-limpiar {
  padding: 10px 25px;
  margin-right: 15px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  cursor: pointer;
  font-size: 14px;
}

.instc-firma-btn-firmar {
  padding: 10px 30px;
  background: #10b981;
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.instc-firma-btn-firmar:hover {
  background: #059669;
}

.instc-firma-btn-firmar:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.instc-firma-legal-notice {
  margin-top: 20px;
  padding: 12px;
  background: #dcfce7;
  border-radius: 4px;
  font-size: 12px;
  color: #166534;
}

/* =========================
   CAMPOS OCULTOS METADATA
   ========================= */
.consent-hidden-fields {
  display: none;
}

/* =========================
   ELEMENTOS ADICIONALES
   ========================= */
.instc-section-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  background: #2271b1;
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 24px;
  margin-right: 10px;
  font-size: 14px;
}

.instc-firma-section .instc-section-icon {
  background: #10b981;
}

.instc-section-intro {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 20px;
}

.consent-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.consent-optional-intro {
  color: #64748b;
  font-size: 13px;
  margin: 20px 0 15px;
  padding-left: 5px;
  border-left: 3px solid #e2e8f0;
}

.consent-link {
  color: #2271b1;
  text-decoration: underline;
}

.consent-link:hover {
  color: #135e96;
}

/* =========================
   MODALES
   ========================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  background: white;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal__header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__close:hover {
  background: #e2e8f0;
}

.modal__body {
  padding: 20px;
  flex: 1;
  overflow: auto;
}

.modal__footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Client item styles for app.js */
.client-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.client-item {
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}

.client-item:hover {
  background: #fbfdff;
}

.client-item:last-child {
  border-bottom: none;
}

.client-item__name {
  font-weight: 800;
  font-size: 13px;
  color: #0f172a;
}

.client-item__info {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

/* FIX: SVG Overflow Protection (Giant Checkmark Fix) */
svg {
  max-width: 100%;
  height: auto;
}

.wizard-success-icon svg,
.step-icon svg {
  width: 64px !important;
  height: 64px !important;
  display: block;
}

/* =========================
   FIX CRÍTICO: SVG Gigante en Signature Preview (Step 4)
   ========================= */
.signature-preview {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  border: 2px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  padding: 20px;
  overflow: hidden;
}

.signature-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.signature-preview__status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #10b981;
  font-weight: 700;
  font-size: 14px;
}

/* FIX CRÍTICO: Limitar SVG en signature-preview__status */
.signature-preview__status svg {
  width: 24px !important;
  height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  min-width: 24px;
  flex-shrink: 0;
}

.signature-preview__change {
  background: transparent;
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.signature-preview__change:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
}

.signature-preview__img {
  background: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.signature-preview__img img {
  max-width: 100%;
  max-height: 180px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Signature Card (cuando no hay firma) */
.signature-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.03));
  border: 2px dashed rgba(59, 130, 246, 0.4);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  transition: all 0.3s ease;
}

.signature-card:hover {
  border-color: rgba(59, 130, 246, 0.6);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.06));
}

.signature-card__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
}

.signature-card__icon svg {
  width: 32px !important;
  height: 32px !important;
}

.signature-card__title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 8px;
}

.signature-card__desc {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 20px;
}

/* Info Box - Warning/Error Messages */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  font-size: 14px;
}

.info-box--warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.info-box__icon {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  flex-shrink: 0;
}

.info-box__text {
  flex: 1;
  line-height: 1.5;
}

/* Fix for modern inputs compatibility */
.instc-input,
input[type="text"],
input[type="email"],
select {
  box-sizing: border-box;
  max-width: 100%;
}

/* =========================
   TEMA OSCURO - TÍTULOS Y TEXTOS VISIBLES
   ========================= */

/* Títulos principales del wizard */
.instc-title,
.instc-wizard-container h1,
.instc-wizard-container h2,
.instc-wizard-container h3,
.instc-search-container h1,
.instc-search-container h2,
.instc-search-container h3 {
  color: #f8fafc !important;
  font-weight: 700;
}

/* Card headers y títulos */
.card__title,
.card h3,
.card h4,
.card__header h3,
.card__header h4 {
  color: #f8fafc !important;
  font-weight: 800;
}

/* Subtítulos y descripciones */
.instc-subtitle,
.card__subtitle,
.card p,
.form-group p {
  color: #94a3b8 !important;
}

/* Labels de formularios */
.form-label,
.instc-label,
label {
  color: #cbd5e1 !important;
  font-weight: 600;
}

/* Inputs en tema oscuro */
.form-input,
.form-select,
.instc-input,
.instc-wizard-container input[type="text"],
.instc-wizard-container input[type="email"],
.instc-wizard-container input[type="number"],
.instc-wizard-container input[type="tel"],
.instc-wizard-container select,
.instc-wizard-container textarea {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #f8fafc !important;
  border-radius: 12px;
  padding: 12px 16px;
}

.instc-wizard-container input::placeholder,
.instc-wizard-container textarea::placeholder {
  color: #64748b !important;
}

.instc-wizard-container input:focus,
.instc-wizard-container select:focus,
.instc-wizard-container textarea:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
  outline: none;
}

/* Textos generales */
.instc-wizard-container,
.instc-wizard-container p,
.instc-wizard-container span,
.instc-wizard-container div {
  color: #e2e8f0;
}

/* Info boxes */
.info-box--primary {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  border-radius: 12px;
  padding: 16px;
}

.info-box--primary svg {
  color: #3b82f6;
  width: 20px !important;
  height: 20px !important;
}

/* Consent groups */
.consent-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.consent-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #cbd5e1 !important;
}

.consent-group label:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.1);
}

.consent-group input[type="radio"]:checked + span,
.consent-group input[type="checkbox"]:checked + span {
  color: #f8fafc !important;
}

/* Botones del wizard */
.btn--primary,
.instc-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
}

.btn--success,
.instc-btn-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.btn--secondary,
.instc-btn-secondary {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #cbd5e1 !important;
}

.btn--secondary:hover,
.instc-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #f8fafc !important;
}

/* =========================
   MEJORAS MÓVILES CRÍTICAS
   ========================= */

/* Contenedor principal del wizard - full viewport */
@media (max-width: 768px) {
  .instc-wizard-container,
  .wizard-container {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .instc-page,
  .wizard-page {
    width: 100% !important;
    margin: 0 !important;
    padding: 10px !important;
  }
  
  .instc-card,
  .card {
    border-radius: 12px !important;
    margin: 0 0 16px 0 !important;
  }
}

/* Formularios móviles - inputs más grandes para touch */
@media (max-width: 560px) {
  .form-input,
  .instc-input,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px !important; /* Previene zoom en iOS */
    padding: 14px 16px !important;
    min-height: 50px !important;
  }
  
  .form-label {
    font-size: 14px !important;
    margin-bottom: 8px !important;
  }
  
  /* Grid de 2 columnas → 1 columna en móvil */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Botones de navegación fijos en la parte inferior */
  .wizard-nav-buttons,
  .instc-nav-buttons,
  .wizard-form > div:last-child,
  #instc-wizard-container > div:last-child {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--instc-card, rgba(30, 41, 59, 0.95));
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
  }
  
  .wizard-nav-buttons .btn,
  .instc-nav-buttons .btn,
  .wizard-form > div:last-child .btn,
  #instc-wizard-container > div:last-child .btn {
    flex: 1;
    justify-content: center;
    padding: 14px 20px;
    font-size: 14px;
  }
  
  /* Espacio para botones fijos */
  .instc-pane,
  .wizard-form,
  #instc-wizard-content {
    padding-bottom: 90px !important;
  }
  
  /* Cards más compactas */
  .card__body {
    padding: 16px !important;
  }
  
  .card__header {
    padding: 16px 16px 0 16px !important;
  }
}

/* Firma móvil - canvas más alto */
@media (max-width: 560px) {
  .instc-sig-box,
  .signature-box {
    height: 280px !important;
    min-height: 250px !important;
  }
  
  #instc-signature-canvas,
  .signature-canvas {
    min-height: 260px;
  }
}

/* Stepper compacto en móvil */
@media (max-width: 480px) {
  .instc-stepper {
    gap: 4px !important;
    padding: 0 8px !important;
  }
  
  .instc-step {
    flex-direction: column;
    gap: 4px;
  }
  
  .instc-step > div:last-child,
  .instc-step-label {
    font-size: 9px !important;
    max-width: 55px;
    text-align: center;
    line-height: 1.2;
  }
  
  .instc-step-dot {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
  }
  
  .instc-connector {
    width: 16px !important;
  }
}

/* Cards con consentimientos */
@media (max-width: 560px) {
  .consent-item {
    padding: 12px !important;
    flex-direction: row !important;
    align-items: flex-start !important;
  }
  
  .consent-checkbox {
    margin-top: 2px;
    flex-shrink: 0;
  }
  
  .consent-item span {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }
  
  .consent-group {
    gap: 10px !important;
  }
}

/* Preview del contrato en móvil */
@media (max-width: 560px) {
  .instc-preview-wrap,
  .preview-container {
    height: 45vh !important;
    min-height: 280px;
  }
  
  /* Escalar el iframe para que quepa */
  .instc-preview-iframe,
  .preview-iframe {
    transform: scale(0.45);
    transform-origin: top left;
    width: 222%;
    height: 222%;
  }
}

/* Toast notifications móvil */
@media (max-width: 560px) {
  #toast-container,
  .toast-container {
    bottom: 100px !important; /* Arriba de los botones fijos */
    left: 10px !important;
    right: 10px !important;
  }
  
  .toast {
    width: 100% !important;
    max-width: none !important;
  }
}

/* Info boxes móvil */
@media (max-width: 560px) {
  .info-box {
    padding: 12px !important;
    font-size: 13px !important;
  }
  
  .info-box__icon {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
  }
}

/* Radio buttons y checkboxes más grandes en touch */
@media (max-width: 560px) {
  .consent-checkbox {
    width: 24px !important;
    height: 24px !important;
  }
  
  .consent-checkbox svg {
    width: 14px !important;
    height: 14px !important;
  }
}

/* =========================
   MODALES FULLSCREEN MÓVIL
   ========================= */

/* Signature modal: canvas area fills available space */
.modal__content--signature {
  display: flex;
  flex-direction: column;
}

.modal__body--signature {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px !important;
}

.modal__body--signature .signature-pad-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.modal__body--signature #signature-canvas {
  flex: 1;
  width: 100%;
  min-height: 200px;
  border-radius: 12px;
  cursor: crosshair;
  touch-action: none;
}

/* Signature footer: 3 buttons row */
.modal__footer--signature {
  display: flex;
  gap: 8px;
  padding: 12px 16px !important;
}

.modal__footer--signature .btn {
  flex: 1;
  justify-content: center;
  padding: 14px 12px;
  font-size: 14px;
  font-weight: 700;
}

/* Contract content readable */
#contract-content {
  font-size: 14px;
  line-height: 1.7;
  color: #1e293b;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
}

#contract-content h1,
#contract-content h2,
#contract-content h3 {
  color: #0f172a !important;
}

#contract-content p,
#contract-content li,
#contract-content td {
  color: #334155 !important;
}

/* Mobile: modals go fullscreen */
@media (max-width: 768px) {
  .modal {
    padding: 0 !important;
  }

  .modal .modal__content {
    max-width: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  .modal .modal__header {
    padding: 12px 16px !important;
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.99)) !important;
  }

  .modal .modal__header h2 {
    font-size: 16px !important;
  }

  .modal .modal__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal .modal__footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: rgba(15, 23, 42, 0.98) !important;
    backdrop-filter: blur(10px);
    padding: 10px 12px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .modal .modal__footer .btn {
    flex: 1;
    justify-content: center;
    padding: 14px 10px !important;
    font-size: 13px !important;
  }

  /* Signature: canvas fills the screen */
  .modal__body--signature {
    padding: 8px !important;
  }

  .modal__body--signature .signature-pad-container {
    flex: 1;
    padding: 8px;
    border-radius: 12px;
  }

  .modal__body--signature #signature-canvas {
    min-height: calc(100vh - 180px);
    min-height: calc(100dvh - 180px);
  }

  /* Contract: readable text on mobile */
  #contract-content {
    font-size: 15px !important;
    line-height: 1.8 !important;
    padding: 16px !important;
    transform: none !important;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .modal .modal__footer--signature .btn {
    padding: 12px 6px !important;
    font-size: 12px !important;
    gap: 4px !important;
  }

  .modal .modal__footer--signature .btn svg {
    width: 16px !important;
    height: 16px !important;
  }
}

/* =========================
   FIRMA HORIZONTAL EN MÓVIL
   Rota el modal de firma 90° cuando el teléfono está en portrait
   para que el canvas ocupe todo el largo de la pantalla.
   ========================= */
@media (orientation: portrait) and (max-width: 768px) {
  #modal-signature.is-open .modal__content--signature {
    position: fixed;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    transform: rotate(90deg);
    transform-origin: center center;
    /* Swap dimensions after rotation */
    width: 100vh !important;
    width: 100dvh !important;
    height: 100vw !important;
    /* Center after rotation */
    left: calc((100vw - 100vh) / 2);
    left: calc((100vw - 100dvh) / 2);
    top: calc((100vh - 100vw) / 2);
    top: calc((100dvh - 100vw) / 2);
  }

  #modal-signature.is-open .modal__header {
    padding: 8px 12px !important;
  }

  #modal-signature.is-open .modal__header h2 {
    font-size: 14px !important;
  }

  #modal-signature.is-open .modal__body--signature {
    flex: 1;
    padding: 6px !important;
  }

  #modal-signature.is-open .signature-pad-container {
    flex: 1;
    padding: 4px;
  }

  #modal-signature.is-open #signature-canvas {
    min-height: unset !important;
    height: 100% !important;
    width: 100% !important;
  }

  #modal-signature.is-open .signature-pad-placeholder {
    transform: none;
  }

  #modal-signature.is-open .modal__footer--signature {
    padding: 8px 12px !important;
  }

  #modal-signature.is-open .modal__footer--signature .btn {
    padding: 10px 8px !important;
    font-size: 13px !important;
  }
}