:root {
  color-scheme: dark;
  --ios-blue: #0a84ff;
  --ios-blue-hover: #2994ff;
  --ios-cyan: #5ac8fa;
  --ios-green: #30d158;
  --ios-red: #ff453a;
  --ios-bg: #070b12;
  --ios-card: rgba(22, 28, 40, 0.88);
  --ios-subcard: rgba(32, 41, 58, 0.72);
  --ios-input-bg: rgba(44, 55, 76, 0.72);
  --ios-input-hover: rgba(56, 70, 96, 0.84);
  --ios-input-focus: #111827;
  --ios-separator: rgba(255, 255, 255, 0.11);
  --ios-border-strong: rgba(255, 255, 255, 0.16);
  --ios-label: #f5f7fa;
  --ios-secondary: #cbd5e1;
  --ios-muted: #94a3b8;
  --radius-card: 20px;
  --radius-sub: 15px;
  --radius-input: 11px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  background-color: var(--ios-bg);
  background-image:
    radial-gradient(ellipse 55% 45% at 12% 10%, rgba(10, 132, 255, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 50% 45% at 88% 85%, rgba(90, 200, 250, 0.11) 0%, transparent 60%),
    linear-gradient(160deg, #05080f 0%, #0a111e 50%, #060a12 100%);
  background-attachment: fixed;
  color: var(--ios-label);
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Scrollbars estilo iOS Dark */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   PANTALLA DE LOGIN ESTILO APPLE iOS DARK
   ========================================================================== */

.login-screen {
  min-height: 100dvh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(10, 132, 255, 0.24) 0%, transparent 48%),
    radial-gradient(circle at 80% 80%, rgba(56, 211, 255, 0.16) 0%, transparent 50%),
    linear-gradient(145deg, #03070e 0%, #091528 52%, #040912 100%);
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: rgba(22, 28, 42, 0.88);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  padding: 34px 28px 28px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 28px 64px -12px rgba(0, 0, 0, 0.72);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-orb {
  width: 62px;
  height: 62px;
  border-radius: 17px;
  background: linear-gradient(145deg, #0d2240, #071428);
  border: 1px solid rgba(90, 200, 250, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 10px 26px -6px rgba(10, 132, 255, 0.5);
}

.login-eyebrow {
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ios-cyan);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.login-title {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--ios-label);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--ios-muted);
  margin-top: 3px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-ico {
  position: absolute;
  left: 13px;
  color: var(--ios-muted);
  pointer-events: none;
}

.login-input {
  padding-left: 38px !important;
  padding-right: 38px !important;
  height: 44px !important;
}

.login-pass-toggle {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--ios-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-pass-toggle:hover {
  color: var(--ios-cyan);
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ios-secondary);
  cursor: pointer;
  user-select: none;
}

.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--ios-blue);
}

.login-submit {
  margin-top: 4px;
  height: 45px;
}

.login-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 69, 58, 0.16);
  border: 1px solid rgba(255, 69, 58, 0.4);
  color: #ff8a84;
  font-size: 0.77rem;
  font-weight: 700;
  text-align: center;
}

/* ==========================================================================
   CONTENEDOR DE PANTALLA COMPLETA (100% VIEWPORT EN CUALQUIER DISPOSITIVO)
   ========================================================================== */

.app-shell {
  width: 100vw;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1080px) {
  .app-shell {
    height: 100dvh;
    overflow: hidden;
  }
}

/* ==========================================================================
   BARRA SUPERIOR (TOPBAR) FULL-WIDTH DARK
   ========================================================================== */

.topbar {
  width: 100%;
  flex-shrink: 0;
  z-index: 40;
  background: rgba(11, 17, 30, 0.86);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.topbar-inner {
  width: 100%;
  padding: 9px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 11px;
}

.att-globe-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(90, 200, 250, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #ffffff;
}

.topbar-user-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 13px 4px 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.topbar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38d3ff, #0a84ff);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.16;
  text-align: right;
}

.topbar-user-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: #ffffff;
}

.topbar-user-role {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--ios-cyan);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.topbar-logout-btn {
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topbar-logout-btn:hover {
  background: rgba(255, 69, 58, 0.22);
  border-color: rgba(255, 69, 58, 0.5);
  color: #ff6961;
}

/* ==========================================================================
   WORKSPACE ACOPLADO AL 100% DE LA PANTALLA
   ========================================================================== */

.workspace-grid {
  width: 100%;
  flex: 1;
  min-height: 0;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(480px, 1.02fr) minmax(520px, 1.08fr);
  gap: 14px;
  align-items: stretch;
  transition: grid-template-columns 0.22s cubic-bezier(0.25, 1, 0.5, 1);
}

.workspace-grid.expanded-preview {
  grid-template-columns: minmax(400px, 0.72fr) minmax(640px, 1.42fr);
}

@media (min-width: 1080px) {
  .form-column {
    height: 100%;
    overflow-y: auto;
    padding-right: 4px;
  }

  .preview-column {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .preview-shell {
    height: 100%;
    min-height: 0;
  }
}

@media (max-width: 1079px) {
  .workspace-grid,
  .workspace-grid.expanded-preview {
    grid-template-columns: 1fr;
    padding: 10px;
  }
}

#contractForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 8px;
}

/* ==========================================================================
   TARJETAS ESTILO APPLE iOS DARK (INSET GROUPED CARDS)
   ========================================================================== */

.glass-card {
  background: var(--ios-card);
  backdrop-filter: blur(22px) saturate(175%);
  -webkit-backdrop-filter: blur(22px) saturate(175%);
  border: 1px solid var(--ios-separator);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 32px rgba(0, 0, 0, 0.35);
  padding: 16px 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--ios-separator);
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(145deg, #38d3ff, #0a84ff);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(10, 132, 255, 0.35);
}

.card-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ios-label);
  letter-spacing: -0.015em;
}

.card-subtitle {
  font-size: 0.72rem;
  color: var(--ios-muted);
  margin-top: 1px;
}

/* ==========================================================================
   CUADRÍCULAS Y CAMPOS ESTILO iOS DARK
   ========================================================================== */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

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

.span-2 {
  grid-column: span 2;
}

@media (max-width: 680px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: span 1;
  }
}

.field-block {
  margin-bottom: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field label,
.field-label {
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--ios-secondary);
  letter-spacing: -0.005em;
}

.input {
  width: 100%;
  height: 36px;
  padding: 6px 11px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ios-label);
  background: var(--ios-input-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-input);
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  outline: none;
}

.input option {
  background-color: #161c28;
  color: #f5f7fa;
}

.input:hover:not(:disabled):not([readonly]) {
  background: var(--ios-input-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.input:focus {
  background: var(--ios-input-focus);
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 3.5px rgba(10, 132, 255, 0.25);
}

.input:disabled,
.input[readonly] {
  background: rgba(15, 23, 42, 0.55);
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.06);
  cursor: not-allowed;
}

.input.uppercase {
  text-transform: uppercase;
}

.input.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
}

.input.center {
  text-align: center;
}

.input.bold-input {
  font-weight: 800;
  color: #4ade80;
  background: rgba(48, 209, 88, 0.14) !important;
  border-color: rgba(48, 209, 88, 0.35);
}

/* ==========================================================================
   CONTROL SEGMENTADO ESTILO iOS DARK (UISegmentedControl)
   ========================================================================== */

.radio-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
  background: rgba(8, 12, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 3px;
  border-radius: 11px;
}

#esquemaFolioGroup,
#modalidadEquipoGroup {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

#tipoContratacionGroup {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 600px) {
  #tipoContratacionGroup {
    grid-template-columns: 1fr;
  }
}

.radio-pill {
  cursor: pointer;
  user-select: none;
  text-align: center;
  min-width: 0;
}

.radio-pill input {
  display: none;
}

.radio-pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 31px;
  padding: 0 8px;
  border-radius: 8.5px;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--ios-muted);
  background: transparent;
  transition: all 0.18s cubic-bezier(0.25, 1, 0.5, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-pill:hover span {
  color: var(--ios-label);
}

.radio-pill input:checked + span {
  background: var(--ios-blue);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(10, 132, 255, 0.42);
}

/* ==========================================================================
   SWITCH ESTILO iOS DARK (UISwitch — Persona Moral)
   ========================================================================== */

.ios-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.ios-switch-input {
  display: none;
}

.ios-switch-slider {
  position: relative;
  width: 44px;
  height: 25px;
  background: rgba(120, 120, 128, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background-color 0.22s ease, border-color 0.22s ease;
  flex-shrink: 0;
}

.ios-switch-slider::after {
  content: '';
  position: absolute;
  top: 1.5px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: transform 0.22s cubic-bezier(0.25, 1, 0.5, 1);
}

.ios-switch-input:checked + .ios-switch-slider {
  background: var(--ios-green);
  border-color: transparent;
}

.ios-switch-input:checked + .ios-switch-slider::after {
  transform: translateX(18px);
}

.ios-switch-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ios-label);
}

/* ==========================================================================
   DIVISORES Y SUB-BLOQUES ESTILO iOS DARK
   ========================================================================== */

.divider-label {
  margin-top: 15px;
  margin-bottom: 3px;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ios-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ios-separator);
}

.subcard {
  background: var(--ios-subcard);
  border: 1px solid var(--ios-separator);
  border-radius: var(--radius-sub);
  padding: 12px 14px;
}

.subcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.subcard-title {
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--ios-label);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-checks {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--ios-secondary);
  cursor: pointer;
  user-select: none;
}

.check-label input {
  width: 15px;
  height: 15px;
  accent-color: var(--ios-blue);
}

.check-box-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  height: 36px;
  padding: 0 11px;
  background: var(--ios-input-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-input);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ios-label);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.check-box-card:hover {
  background: var(--ios-input-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.check-box-card input {
  width: 15px;
  height: 15px;
  accent-color: var(--ios-blue);
}

.time-range {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ==========================================================================
   SECCIÓN 04: TARJETAS DE MODELADO POR LÍNEA
   ========================================================================== */

.lines-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.line-row-card {
  background: var(--ios-subcard);
  border: 1px solid var(--ios-separator);
  border-radius: var(--radius-sub);
  padding: 12px 14px;
}

.line-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--ios-separator);
}

.line-row-badge {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--ios-cyan);
  background: rgba(10, 132, 255, 0.18);
  border: 1px solid rgba(90, 200, 250, 0.28);
  padding: 3px 10px;
  border-radius: 999px;
}

.line-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-grid-main {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.line-grid-sub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 9px;
  margin-top: 9px;
  align-items: end;
}

@media (max-width: 680px) {
  .line-grid-main,
  .line-grid-sub {
    grid-template-columns: 1fr;
  }
}

.op-footer-grid {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ios-separator);
  display: grid;
  grid-template-columns: 120px 190px 1fr;
  gap: 10px;
  align-items: end;
}

@media (max-width: 680px) {
  .op-footer-grid {
    grid-template-columns: 1fr;
  }
}

.form-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 2px 0 10px;
}

/* ==========================================================================
   COLUMNA DERECHA: VISOR DEL EXPEDIENTE COMPLETO ACOPLADO AL 100%
   ========================================================================== */

.preview-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.preview-eyebrow {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ios-cyan);
  text-transform: uppercase;
}

.preview-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ios-label);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.zoom-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  background: var(--ios-input-bg);
  border: 1px solid var(--ios-separator);
  border-radius: 8px;
  color: var(--ios-label);
}

.preview-continuous-stage {
  width: 100%;
  flex: 1;
  min-height: 520px;
  background: #04070d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  overflow-y: auto;
  overflow-x: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6);
}

.preview-doc-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.canvas-sheet-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.doc-canvas {
  width: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.65);
  display: block;
  transform-origin: top center;
}

.preview-footer {
  flex-shrink: 0;
  padding-top: 2px;
}

.preview-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ==========================================================================
   BOTONES ESTILO iOS DARK
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.16s ease;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-xs {
  padding: 5px 11px;
  font-size: 0.72rem;
  border-radius: 8.5px;
}

.btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 0.84rem;
  font-weight: 700;
}

.btn-primary {
  background: var(--ios-blue);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.35);
}

.btn-primary:hover {
  background: var(--ios-blue-hover);
}

.btn-glass {
  background: var(--ios-input-bg);
  color: var(--ios-label);
  border: 1px solid var(--ios-border-strong);
}

.btn-glass:hover {
  background: var(--ios-input-hover);
  border-color: var(--ios-cyan);
  color: #ffffff;
}

.btn-danger-xs {
  background: rgba(255, 69, 58, 0.16);
  color: #ff6961;
  border: 1px solid rgba(255, 69, 58, 0.32);
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.btn-danger-xs:hover {
  background: rgba(255, 69, 58, 0.28);
}

.btn-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.plazo-mode-chip {
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(90, 200, 250, 0.35);
  background: rgba(10, 132, 255, 0.16);
  color: var(--ios-cyan);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.plazo-mode-chip:hover {
  background: rgba(10, 132, 255, 0.28);
  color: #ffffff;
}

.plazo-mode-chip.is-multi {
  background: rgba(255, 159, 10, 0.2);
  border-color: rgba(255, 159, 10, 0.5);
  color: #ffd60a;
}

/* ==========================================================================
   MODALS DE PANTALLA COMPLETA (ROJO: ERROR | ÁMBAR: CONFIRMACIÓN | VERDE: ÉXITO)
   ========================================================================== */

.fs-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  animation: fsModalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fsModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Tema ROJO (Error / Alerta) */
.fs-modal.fs-theme-red {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 69, 58, 0.32) 0%, transparent 55%),
    linear-gradient(160deg, rgba(28, 6, 8, 0.96) 0%, rgba(15, 5, 8, 0.98) 100%);
}

/* Tema ÁMBAR (Confirmación / Pregunta) */
.fs-modal.fs-theme-amber {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 159, 10, 0.30) 0%, transparent 55%),
    linear-gradient(160deg, rgba(28, 18, 4, 0.96) 0%, rgba(14, 10, 4, 0.98) 100%);
}

/* Tema VERDE (Éxito) */
.fs-modal.fs-theme-green {
  background:
    radial-gradient(circle at 50% 35%, rgba(48, 209, 88, 0.30) 0%, transparent 55%),
    linear-gradient(160deg, rgba(5, 26, 14, 0.96) 0%, rgba(4, 14, 9, 0.98) 100%);
}

.fs-modal-content {
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 38px 34px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
}

.fs-modal-icon-orb {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.fs-theme-red .fs-modal-icon-orb {
  background: rgba(255, 69, 58, 0.22);
  border: 2px solid #ff453a;
  color: #ff6961;
  box-shadow: 0 0 36px rgba(255, 69, 58, 0.45);
}

.fs-theme-amber .fs-modal-icon-orb {
  background: rgba(255, 159, 10, 0.22);
  border: 2px solid #ff9f0a;
  color: #ffd60a;
  box-shadow: 0 0 36px rgba(255, 159, 10, 0.45);
}

.fs-theme-green .fs-modal-icon-orb {
  background: rgba(48, 209, 88, 0.22);
  border: 2px solid #30d158;
  color: #4ade80;
  box-shadow: 0 0 36px rgba(48, 209, 88, 0.45);
}

.fs-modal-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.fs-theme-red .fs-modal-badge {
  background: rgba(255, 69, 58, 0.2);
  color: #ff8a84;
  border: 1px solid rgba(255, 69, 58, 0.4);
}

.fs-theme-amber .fs-modal-badge {
  background: rgba(255, 159, 10, 0.2);
  color: #ffd60a;
  border: 1px solid rgba(255, 159, 10, 0.4);
}

.fs-theme-green .fs-modal-badge {
  background: rgba(48, 209, 88, 0.2);
  color: #4ade80;
  border: 1px solid rgba(48, 209, 88, 0.4);
}

.fs-modal-title {
  font-size: 1.48rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 10px;
}

.fs-modal-message {
  font-size: 0.94rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
  margin-bottom: 28px;
}

.fs-modal-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.fs-btn {
  flex: 1 1 180px;
  height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffffff;
}

.fs-btn:active {
  transform: scale(0.98);
}

.fs-btn-red {
  background: linear-gradient(135deg, #ff453a, #d70015);
  box-shadow: 0 8px 24px rgba(255, 69, 58, 0.4);
}

.fs-btn-amber {
  background: linear-gradient(135deg, #ff9f0a, #d97706);
  color: #0b0f19;
  box-shadow: 0 8px 24px rgba(255, 159, 10, 0.4);
}

.fs-btn-green {
  background: linear-gradient(135deg, #30d158, #16a34a);
  color: #05180c;
  box-shadow: 0 8px 24px rgba(48, 209, 88, 0.4);
}

.fs-btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.fs-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Toast estilo notificación iOS Dark */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  background: rgba(30, 41, 59, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(90, 200, 250, 0.35);
  color: #ffffff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   ZOOM AUTOMÁTICO SOBRE LO QUE SE ESTÁ CAPTURANDO
   ========================================================================== */
.preview-doc-group {
  align-items: safe center;
}

.canvas-sheet-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  flex-shrink: 0;
  margin: 0 auto;
}

.doc-canvas {
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.focus-zoom-ring {
  position: absolute;
  pointer-events: none;
  border: 2.5px solid #0a84ff;
  border-radius: 6px;
  background: rgba(10, 132, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.24), 0 0 18px rgba(10, 132, 255, 0.38);
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.24s ease, top 0.24s ease, width 0.24s ease, height 0.24s ease;
  z-index: 2;
}

.focus-zoom-ring.visible {
  opacity: 1;
  transform: scale(1);
}

#btnToggleAutoZoom.is-active {
  background: rgba(10, 132, 255, 0.22);
  border-color: rgba(10, 132, 255, 0.6);
  color: #ffffff;
}

/* Títulos de formulario más claros */
.divider-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.field-hint {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: rgba(235, 235, 245, 0.55);
  margin-top: 2px;
}
