/* VARIABLES DE DISEÑO (CSS CUSTOM PROPERTIES) */
:root {
  --page-width: 8.5in;
  --page-height: 11in;
  
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-family-serif: 'Merriweather', Georgia, "Times New Roman", serif;
  --font-family: var(--font-family-sans);
  
  --font-size-base: 10.5pt;
  --line-height: 1.4;
  
  --margin-top: 2.5cm;
  --margin-bottom: 2.5cm;
  --margin-left: 3cm;
  --margin-right: 3cm;
  
  --accent-color: #111827; /* Charcoal por defecto */
}

/* ESTILOS DE INTERFAZ DE USUARIO (SOLO PANTALLA) */
@media screen {
  body {
    margin: 0;
    padding-top: 56px;
    display: flex;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
    background-color: #0b0f19;
    background-image: 
      radial-gradient(rgba(255, 255, 255, 0.05) 1.5px, transparent 0),
      radial-gradient(rgba(255, 255, 255, 0.05) 1.5px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    font-family: var(--font-family-sans);
    color: #f1f5f9;
  }

  /* Barra Lateral de Ajustes */
  .sidebar {
    width: 450px;
    max-width: 38vw;
    min-width: 350px;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
    z-index: 100;
  }

  .sidebar-header {
    padding: 16px 20px 14px 20px;
    border-bottom: 1px solid #1e293b;
  }

  .sidebar-header h1,
  .sidebar-header .sidebar-brand {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
  }

  .sidebar-header p {
    font-size: 12px;
    color: #94a3b8;
    margin: 6px 0 0 0;
    line-height: 1.4;
  }

  .sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .settings-group label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
  }

  .settings-control {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13.5px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .settings-control:hover {
    border-color: #475569;
    background-color: #243249;
  }

  .settings-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  }

  .actions-group {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .btn {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
  }

  .btn-primary {
    background-color: #b0f2ae;
    color: #0f172a;
    font-weight: 800;
    border: 1px solid #86efac;
    box-shadow: 0 4px 12px rgba(176, 242, 174, 0.4);
  }

  .btn-primary:hover {
    background-color: #a0ec9d;
    color: #020617;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(176, 242, 174, 0.6);
  }

  .btn-secondary {
    background-color: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
  }

  .btn-secondary:hover {
    background-color: #334155;
    border-color: #475569;
  }

  .btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
  }

  .btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
  }

  .info-box {
    background-color: rgba(30, 41, 59, 0.5);
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 14px;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
  }

  .info-box h3 {
    margin: 0 0 6px 0;
    color: #f1f5f9;
    font-size: 13px;
    font-weight: 600;
  }

  .info-box ul {
    margin: 0;
    padding-left: 16px;
  }

  .info-box li {
    margin-bottom: 4px;
  }

  /* ── ESTILOS DEL ARTÍCULO GUÍA SEO Y SEMÁNTICO EN SIDEBAR ────────────────── */
  .seo-article-box {
    margin-top: 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 16px;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.6;
  }

  .seo-article-header h1,
  .seo-article-header h2 {
    font-size: 14.5px;
    font-weight: 800;
    color: #60a5fa;
    margin: 0 0 4px 0;
    line-height: 1.35;
  }

  .seo-subtitle {
    font-size: 11.5px;
    color: #94a3b8;
    font-style: italic;
    margin: 0 0 12px 0;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 8px;
  }

  .seo-section {
    margin-bottom: 14px;
  }

  .seo-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 12px 0 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    padding-bottom: 3px;
  }

  .seo-substep {
    margin-top: 8px;
    padding-left: 6px;
    border-left: 2px solid #3b82f6;
  }

  .seo-substep h4 {
    font-size: 12px;
    font-weight: 700;
    color: #93c5fd;
    margin: 6px 0 4px 0;
  }

  .seo-section p {
    margin: 0 0 6px 0;
    font-size: 11.5px;
  }

  .seo-section ul,
  .seo-section ol {
    margin: 4px 0 8px 0;
    padding-left: 18px;
  }

  .seo-section li {
    margin-bottom: 3px;
    font-size: 11.5px;
  }

  .seo-quote-bad {
    border-left: 3px solid #ef4444;
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
    padding: 6px 10px;
    margin: 6px 0;
    font-size: 11px;
    border-radius: 0 4px 4px 0;
  }

  .seo-quote-good {
    border-left: 3px solid #10b981;
    background: rgba(16, 185, 129, 0.08);
    color: #6ee7b7;
    padding: 6px 10px;
    margin: 6px 0;
    font-size: 11px;
    border-radius: 0 4px 4px 0;
  }

  .seo-section code {
    background: rgba(30, 41, 59, 0.9);
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    font-family: monospace;
  }

  /* Tabla comparativa SEO */
  .table-responsive {
    overflow-x: auto;
    margin: 10px 0;
  }

  .seo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    text-align: left;
  }

  .seo-table th {
    background: rgba(30, 41, 59, 0.9);
    color: #60a5fa;
    padding: 7px 9px;
    border: 1px solid #334155;
    font-weight: 700;
  }

  .seo-table td {
    padding: 6px 9px;
    border: 1px solid #334155;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.4);
  }

  /* FAQ Accordions en Sidebar */
  .faq-container {
    margin-top: 14px;
  }

  .faq-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    transition: background 0.2s ease;
  }

  .faq-item[open] {
    background: rgba(30, 41, 59, 0.8);
    border-color: #3b82f6;
  }

  .faq-item summary {
    cursor: pointer;
    font-size: 11.5px;
    color: #38bdf8;
    outline: none;
  }

  .faq-item summary:hover {
    color: #60a5fa;
  }

  .faq-item p {
    margin: 6px 0 0 0;
    font-size: 11px;
    color: #cbd5e1;
  }

  .seo-article-footer {
    border-top: 1px solid #1e293b;
    padding-top: 10px;
    margin-top: 12px;
    font-size: 11px;
    color: #94a3b8;
  }

  /* Area de Trabajo */
  .workspace {
    flex-grow: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    box-sizing: border-box;
  }

  /* Alerta de Desbordamiento */
  .warning-banner {
    background-color: rgba(127, 29, 29, 0.9);
    backdrop-filter: blur(8px);
    color: #fecaca;
    border: 1px solid #991b1b;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    max-width: var(--page-width);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
  }

  @keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .warning-icon {
    font-size: 16px;
    flex-shrink: 0;
  }

  /* Contenedor Físico de la Página */
  .page-shadow-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-bottom: 40px;
  }

  .page {
    width: var(--page-width);
    height: var(--page-height);
    min-height: var(--page-height);
    background-color: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    position: relative;
    box-sizing: border-box;
    padding-top: var(--margin-top);
    padding-bottom: var(--margin-bottom);
    padding-left: var(--margin-left);
    padding-right: var(--margin-right);
    overflow: hidden;
    transition: outline 0.15s ease;
  }

  /* Línea indicadora / Separador de salto de página en pantalla */
  .page-break-divider {
    width: var(--page-width);
    height: 38px;
    background-color: #0b0f19;
    background-image: 
      radial-gradient(rgba(255, 255, 255, 0.05) 1.5px, transparent 0),
      radial-gradient(rgba(255, 255, 255, 0.05) 1.5px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    pointer-events: auto;
    z-index: 10;
    border: 1px solid #1e293b;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
  }

  .page-break-divider span {
    background-color: #1e293b;
    color: #94a3b8;
    font-size: 9.5px;
    font-weight: 700;
    padding: 3px 10px;
    border: 1px solid #334155;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  .indicator-add-page-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .indicator-add-page-btn:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.5);
  }

  .indicator-del-page-btn {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: #fecaca;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border: 1px solid #ef4444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .indicator-del-page-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.5);
  }

  .indicator-add-pdf-btn {
    background: linear-gradient(135deg, #4c1d95, #5b21b6);
    color: #ddd6fe;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border: 1px solid #7c3aed;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .indicator-add-pdf-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.5);
  }

  /* Botón de añadir hoja en sidebar */
  .btn-sidebar-add-page {
    width: 100%;
    font-size: 12px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .btn-sidebar-add-page:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: #3b82f6;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  }

  /* Botón de eliminar hoja en sidebar */
  .btn-sidebar-del-page {
    width: 100%;
    font-size: 12px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .btn-sidebar-del-page:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
  }

  /* Grid de añadir secciones dentro del área de trabajo */
  .workspace-add-sections-grid {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
    flex-wrap: wrap;
  }

  .btn-workspace-action {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .btn-workspace-action:hover {
    background-color: #2b374e;
    border-color: #475569;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  }

  /* Botones del área de trabajo al final */
  .workspace-add-page-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
  }

  .btn-workspace-preview,
  .btn-workspace-add-page,
  .btn-workspace-reorder,
  .btn-workspace-add-pdf,
  .btn-workspace-del-page {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .btn-workspace-preview:hover,
  .btn-workspace-add-page:hover,
  .btn-workspace-reorder:hover,
  .btn-workspace-add-pdf:hover,
  .btn-workspace-del-page:hover {
    background-color: #2b374e;
    border-color: #475569;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  }
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .btn-workspace-add-page:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-style: solid;
    border-color: #60a5fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
  }

  .btn-workspace-add-pdf {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px dashed #a855f7;
    color: #c084fc;
    padding: 11px 26px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .btn-workspace-add-pdf:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #ffffff;
    border-style: solid;
    border-color: #c084fc;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.4);
  }

  .btn-workspace-del-page {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px dashed #ef4444;
    color: #f87171;
    padding: 11px 26px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .btn-workspace-del-page:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
    border-style: solid;
    border-color: #f87171;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
  }

  /* Controles flotantes en hover sobre bloques */
  .resume-block {
    position: relative;
    transition: all 0.2s ease;
    border-radius: 4px;
  }

  .resume-block:hover {
    background-color: rgba(59, 130, 246, 0.04);
    outline: 1px dashed rgba(59, 130, 246, 0.35);
    outline-offset: 4px;
  }

  .block-controls {
    position: absolute;
    top: -28px;
    right: 20px;
    left: auto;
    background-color: #1e293b;
    border: 1px solid #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 2px;
    display: flex;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(2px);
    z-index: 50;
  }

  .resume-block:hover .block-controls {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .resume-section {
    position: relative;
  }

  .section-controls {
    position: absolute;
    top: -28px;
    right: -4px;
    background-color: #1e293b;
    border: 1px solid #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 2px;
    display: flex;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(2px);
    z-index: 50;
  }

  .resume-section:hover .section-controls {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  /* Estilo activo para el botón de salto de página */
  .force-page-break > .block-controls .page-break-btn,
  .force-page-break > .section-controls .page-break-btn {
    background-color: #3b82f6 !important;
    color: white !important;
  }

  .ctrl-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #94a3b8;
    transition: all 0.1s ease;
  }

  .ctrl-btn:hover {
    background-color: #334155;
    color: #f8fafc;
  }

  .ctrl-btn.delete:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
  }

  /* Botones de acción en secciones */
  .section-footer {
    position: absolute;
    bottom: -10px;
    right: 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
  }

  .resume-section:hover .section-footer {
    opacity: 1;
    pointer-events: auto;
  }

  .add-block-btn {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .add-block-btn:hover {
    background-color: #e2e8f0;
    color: #1e293b;
    border-color: #94a3b8;
  }

  .add-bullet-btn {
    background-color: transparent;
    border: 1px dashed #94a3b8;
    color: #64748b;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .add-bullet-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
  }
}

/* ESTILOS DEL DOCUMENTO (PARA IMPRESIÓN LIMPIA) */
.page {
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  padding-top: var(--margin-top);
  padding-bottom: var(--margin-bottom);
  padding-left: var(--margin-left);
  padding-right: var(--margin-right);
}

.page-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 78px;
  font-weight: 900;
  color: rgba(17, 24, 39, 0.22);
  letter-spacing: 3px;
  text-transform: lowercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 99;
  text-align: center;
}

.page-content {
  width: 100%;
  min-height: 100%;
  color: #111827; /* Negro carbón amigable */
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  box-sizing: border-box;
  text-align: left;
}

/* Encabezado */
.resume-header {
  text-align: center;
  margin-bottom: 18px;
}

.resume-name {
  font-size: 1.9em;
  font-weight: 800;
  color: var(--accent-color);
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  line-height: 1.1;
  outline: none;
}

.resume-contact {
  font-size: 0.9em;
  color: #4b5563;
  margin: 0;
  line-height: 1.3;
  outline: none;
}

/* Títulos de sección */
.resume-section {
  margin-bottom: 14px;
}

.section-title {
  font-size: 1.05em;
  font-weight: 700;
  color: var(--accent-color);
  text-transform: uppercase;
  border-bottom: 1px solid var(--accent-color);
  padding-bottom: 2px;
  margin-top: 14px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  outline: none;
}

/* Bloques de contenido */
.block-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.item-title {
  font-weight: 700;
  color: #111827;
  outline: none;
}

.item-date {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.95em;
  white-space: nowrap;
  text-align: right;
  outline: none;
}

.item-subtitle {
  font-style: italic;
  color: #4b5563;
  margin-bottom: 4px;
  outline: none;
}

.section-text {
  margin: 0;
  color: #1f2937;
  text-align: justify;
  outline: none;
}

/* Viñetas */
.item-bullets {
  margin: 0 0 4px 0;
  padding-left: 20px;
  list-style-type: disc;
}

.item-bullets li {
  margin-bottom: 3px;
  color: #1f2937;
  outline: none;
}

/* Utilitarios */
.italic {
  font-style: italic;
  font-weight: normal;
}

/* SECCIÓN FIRMA */
.signature-section {
  margin-top: 24px;
  margin-bottom: 0;
}

/* SECCIÓN REFERENCIAS */
.references-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reference-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ref-name {
  margin: 0;
  font-weight: 700;
  color: #111827;
  outline: none;
}

.ref-role {
  margin: 0;
  font-style: italic;
  color: #374151;
  outline: none;
}

.ref-phone {
  margin: 0;
  font-style: italic;
  color: #374151;
  outline: none;
}

.signature-block {

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 8px;
}

/* Área de imagen de firma (visible solo en pantalla) */
.signature-image-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 4px;
  min-height: 52px;
  width: 300px;
}

.signature-img-placeholder {
  width: 300px;
  height: 52px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  background: rgba(241, 245, 249, 0.5);
  user-select: none;
}

.signature-img-placeholder:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.signature-img-preview {
  max-height: 65px;
  max-width: 300px;
  object-fit: contain;
  display: block;
}

.signature-line {
  width: 300px;
  border: none;
  border-top: 1.5px solid #111827;
  margin: 6px 0 4px 0;
}

.signature-name {
  margin: 0;
  font-weight: 700;
  font-size: 1em;
  color: #111827;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  outline: none;
}

.signature-cc {
  margin: 0;
  font-weight: 600;
  font-size: 0.95em;
  color: #111827;
  text-align: center;
  outline: none;
}

.signature-preview-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  width: 300px;
}

.btn-remove-signature {
  align-self: flex-end;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.15s ease;
  font-family: var(--font-family-sans);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.btn-remove-signature:hover {
  background: #ef4444;
  color: #ffffff;
}

.signature-img-preview:hover {
  outline: 1.5px dashed #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Ocultar el placeholder y mostrar solo imagen al generar PDF */
.signature-img-placeholder.has-image {
  display: none;
}

/* SECCIÓN FOTO */
.photo-section {
  margin-bottom: 14px;
}

.photo-block {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.photo-upload-area {
  position: relative;
  width: 110px;
  height: 130px;
  cursor: pointer;
}

/* Círculo placeholder (sin foto) */
.photo-placeholder {
  width: 110px;
  height: 130px;
  border-radius: 8px;
  border: 2.5px dashed #cbd5e1;
  background: rgba(241, 245, 249, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  user-select: none;
}

.photo-placeholder:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.06);
}

.photo-placeholder-icon {
  font-size: 22px;
  line-height: 1;
}

/* Foto cargada: superpuesta sobre el placeholder sin mover el layout */
.photo-img-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  display: none;
  border: 2px solid #e2e8f0;
}

/* Botón de cambio de foto (aparece al hacer hover sobre la imagen) */
.photo-change-overlay {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  gap: 4px;
  flex-direction: column;
  cursor: pointer;
  transition: background 0.2s;
}

.photo-upload-area:hover .photo-change-overlay {
  display: flex;
}

/* Al tener imagen: ocultar el placeholder con visibility para no colapsar el espacio */
.photo-placeholder.has-image {
  visibility: hidden;
}

/* ESTILOS DE IMPRESIÓN (MEDIOS FÍSICOS) */
@media print {
  @page {
    size: letter;
    margin-top: var(--margin-top);
    margin-bottom: var(--margin-bottom);
    margin-left: var(--margin-left);
    margin-right: var(--margin-right);
  }
  
  body {
    background: none;
    color: black;
    margin: 0;
    padding: 0;
    height: auto;
    overflow: visible;
    font-size: var(--font-size-base);
  }
  
  .sidebar, .warning-banner, .no-print, .block-controls, .section-footer, .page-watermark {
    display: none !important;
  }
  
  .workspace {
    background: none;
    padding: 0;
    margin: 0;
    height: auto;
    width: auto;
    overflow: visible;
    display: block;
  }
  
  .page-shadow-wrapper {
    padding: 0;
  }

  .page {
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 0 !important; /* Los márgenes los maneja @page para todas las páginas */
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    page-break-after: auto;
    page-break-inside: auto;
    overflow: visible;
  }

  .page-content {
    height: auto !important;
    min-height: 0 !important;
  }

  /* Evitar saltos de página huérfanos y roturas dentro de bloques */
  .resume-section, .resume-block, .item-bullets > li {
    margin-top: 0 !important;
  }

  .section-title {
    page-break-after: avoid;
    break-after: avoid;
  }

  .resume-block {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Forzar salto de página nativo al imprimir */
  .force-page-break {
    margin-top: 0 !important;
    page-break-before: always !important;
    break-before: page !important;
  }

  /* Forzar salto de página DESPUÉS de la sección al imprimir */
  .force-page-break-after {
    page-break-after: always !important;
    break-after: page !important;
  }
  
  /* Forzar que el texto sea negro puro para mejor contraste e impresión */
  #print-area *, .document-name, .section-title, .item-title, .item-date, .item-bullets li, .section-text {
    color: #000000;
  }
  
  .item-subtitle {
    color: #374151;
  }
}

/* OVERLAY DE CARGA – GENERACIÓN DE PDF */
#pdf-loading-overlay {
  display: none; /* se activa por JS */
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(7, 12, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

#pdf-loading-overlay.active {
  display: flex;
}

.pdf-loading-card {
  background: linear-gradient(160deg, #0f172a, #1e293b);
  border: 1px solid #334155;
  border-radius: 20px;
  padding: 44px 56px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.pdf-spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.pdf-loading-title {
  margin: 0;
  color: #f1f5f9;
  font-family: var(--font-family-sans);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.pdf-loading-sub {
  margin: 0;
  color: #94a3b8;
  font-family: var(--font-family-sans);
  font-size: 13px;
  font-weight: 400;
  min-height: 18px;
  transition: opacity 0.2s;
}

/* Botón generando: deshabilitar visualmente */
#btn-generate-pdf:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Botón PDF en sidebar ────────────────────────────────────────────────── */
.btn-sidebar-add-pdf {
  width: 100%;
  font-size: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 8px;
  font-family: var(--font-family-sans);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sidebar-add-pdf:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.3);
}

/* ── Hojas normales del PDF Anexado ───────────────────────────────────────── */
.pdf-attached-page-section {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.pdf-attached-page-container {
  width: 100%;
  box-sizing: border-box;
}

.pdf-attached-page-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5pt;
  color: #64748b;
  font-family: var(--font-family-sans);
  margin-bottom: 6px;
  user-select: none;
}

.pdf-attached-page-title {
  font-weight: 600;
  color: #475569;
}

.pdf-attached-page-body {
  width: 100%;
  background: #ffffff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pdf-attached-page-img {
  display: block;
  width: 100%;
  max-height: 860px;
  object-fit: contain;
  height: auto;
  border: none;
}

/* ── BARRA FLOTANTE CONTEXTUAL DE ACCIÓN UNIVERSAL (DESKTOP Y MÓVIL) ────────── */

/* Ocultar toolbars estáticos flotantes para dejar el documento 100% limpio y sin solapar texto ni fechas */
.section-controls,
.block-controls {
  display: none !important;
}

/* Resaltado suave del elemento seleccionado al hacer clic o tocar */
.selected-target {
  outline: 2px solid #3b82f6 !important;
  outline-offset: 3px !important;
  border-radius: 4px !important;
  background-color: rgba(59, 130, 246, 0.04) !important;
  transition: outline 0.15s ease, background 0.15s ease;
}

/* Barra flotante contextual de acciones (Tooltip Dinámico sobre elemento seleccionado) */
.context-bar {
  display: flex;
  position: fixed;
  z-index: 1250;
  transition: opacity 0.2s ease, transform 0.15s ease-out;
  opacity: 0;
  pointer-events: none;
  max-width: calc(100vw - 24px);
  touch-action: manipulation;
}

.context-bar.active {
  opacity: 1;
  pointer-events: auto;
}

.context-content {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(59, 130, 246, 0.3);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}

.context-content::-webkit-scrollbar {
  display: none;
}

.ctx-btn {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.ctx-btn:hover {
  background: #3b82f6;
  border-color: #60a5fa;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.ctx-btn:active {
  transform: scale(0.95);
}

.ctx-btn-delete {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

.ctx-btn-delete:hover {
  background: #dc2626;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.ctx-btn-delete:active {
  transform: scale(0.95);
}

/* ── NAVEGACIÓN Y COMPONENTES MÓVILES (RESPONSIVE DESIGN) ───────────────── */

/* Botón cerrar sidebar (Oculto en escritorio) */
.sidebar-close-btn {
  display: none;
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN SUPERIOR UNIVERSAL (DESKTOP Y MÓVIL)
   ========================================================================== */
.mobile-navbar,
.app-navbar {
  display: flex !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 56px !important;
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid #1e293b !important;
  z-index: 500 !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 16px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  box-sizing: border-box !important;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  margin-left: auto;
}

/* Botón Hamburguesa (Oculto en desktop, visible solo en móvil <= 900px) */
.navbar-menu-toggle-btn {
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  width: 38px !important;
  height: 38px !important;
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.navbar-menu-toggle-btn:hover,
.navbar-menu-toggle-btn.active {
  background: #334155 !important;
  border-color: #60a5fa !important;
  color: #60a5fa !important;
}

/* En Desktop (> 900px): Menú de acciones visible en línea horizontal */
.navbar-actions-menu {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  position: static !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  min-width: auto !important;
  box-sizing: border-box !important;
}

.navbar-actions-menu .navbar-action-btn {
  width: auto !important;
  justify-content: center !important;
  padding: 7px 12px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
}

.navbar-menu-divider {
  width: 1px !important;
  height: 20px !important;
  background: #334155 !important;
  margin: 0 4px !important;
}

@keyframes navbarMenuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.navbar-brand-title,
.mobile-brand,
.navbar-brand {
  font-size: 15px !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  letter-spacing: 0.4px !important;
  white-space: nowrap !important;
  margin-right: 8px !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
}

@media screen and (max-width: 440px) {
  .navbar-brand-title,
  .mobile-brand,
  .navbar-brand {
    display: none !important;
  }
}

.navbar-blog-link {
  color: #3b82f6 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  white-space: nowrap !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  background: rgba(59, 130, 246, 0.1) !important;
  transition: all 0.2s ease !important;
}

.navbar-blog-link:hover {
  color: #60a5fa !important;
  background: rgba(59, 130, 246, 0.2) !important;
}

.mobile-actions,
.navbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
}

.mobile-action-btn,
.navbar-action-btn {
  border-radius: 8px !important;
  padding: 7px 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  border: 1px solid #334155 !important;
  box-sizing: border-box !important;
  color: #f8fafc !important;
  background: #1e293b !important;
  text-decoration: none !important;
}

.mobile-action-btn:hover,
.navbar-action-btn:hover {
  background: #334155 !important;
  border-color: #60a5fa !important;
  transform: translateY(-1px) !important;
}

.mobile-action-btn:active,
.navbar-action-btn:active {
  transform: scale(0.96) !important;
}

.btn-nav-pay,
.mobile-btn-pay,
.navbar-btn-pay {
  background: #b0f2ae !important;
  color: #0f172a !important;
  border: 1px solid #86efac !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(134, 239, 172, 0.25) !important;
}

.btn-nav-pay:hover,
.mobile-btn-pay:hover,
.navbar-btn-pay:hover {
  background: #a0ec9d !important;
  border-color: #4ade80 !important;
  box-shadow: 0 4px 12px rgba(134, 239, 172, 0.4) !important;
}

.sidebar-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px 16px;
  border-bottom: 1px solid #1e293b;
}

.sidebar-top-title {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Telón de fondo (Oculto por defecto) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media screen and (max-width: 360px) {
  .mobile-navbar,
  .app-navbar {
    padding: 0 8px;
  }

  .mobile-brand,
  .navbar-brand {
    font-size: 12.5px;
    margin: 0 3px;
  }

  .mobile-action-btn,
  .navbar-action-btn {
    padding: 6px 8px;
    font-size: 11.5px;
    gap: 3px;
  }

  .mobile-hamburger-btn,
  .navbar-hamburger-btn {
    width: 35px;
    height: 35px;
  }
}

/* ── ESTILOS DEL MODAL DE REORDENAMIENTO DE HOJAS (MOBILE-FIRST) ────────────────── */
.btn-sidebar-reorder,
.btn-sidebar-add-pdf {
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.btn-sidebar-reorder:hover,
.btn-sidebar-add-pdf:hover {
  background-color: #2b374e;
  border-color: #475569;
  color: #ffffff;
  transform: translateY(-1px);
}

.reorder-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.reorder-modal:not(.open) {
  display: none !important;
}

.reorder-modal.open {
  opacity: 1;
  pointer-events: auto;
  display: flex !important;
}

.reorder-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.reorder-card-dialog {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.reorder-modal-header {
  padding: 16px 20px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reorder-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reorder-icon {
  font-size: 20px;
}

.reorder-modal-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.reorder-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.reorder-close-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.1);
}

.reorder-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.reorder-help-text {
  margin: 0 0 14px 0;
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.4;
}

.reorder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reorder-card-item {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.reorder-card-item:hover {
  border-color: #60a5fa;
  background: rgba(30, 41, 59, 0.95);
  transform: translateY(-1px);
}

.reorder-card-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.reorder-card-info {
  flex-grow: 1;
  min-width: 0;
}

.reorder-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #f1f5f9;
}

.reorder-pdf-chip {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #a78bfa;
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.reorder-card-sub {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.reorder-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.reorder-btn-move {
  width: 38px;
  height: 34px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.reorder-btn-move:not(:disabled):active {
  transform: scale(0.92);
  background: #3b82f6;
  border-color: #3b82f6;
}

.reorder-btn-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: #334155;
}

.reorder-modal-footer {
  padding: 14px 20px;
  background: #1e293b;
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.reorder-empty-state {
  text-align: center;
  padding: 24px 12px;
  color: #94a3b8;
  font-size: 13px;
}

/* ── ESTILOS DEL MODAL DE VISTA PREVIA DE DOCUMENTO EN PÁGINA (IN-APP) ────── */
.pdf-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.pdf-preview-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.pdf-preview-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pdf-preview-card-dialog {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10006;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pdf-preview-header {
  padding: 16px 20px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pdf-preview-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdf-preview-icon {
  font-size: 20px;
}

.pdf-preview-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.pdf-preview-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.pdf-preview-close-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.1);
}

.pdf-preview-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex-grow: 1;
  background: #0b1120;
}

.pdf-preview-help-text {
  margin: 0 0 16px 0;
  font-size: 12.5px;
  color: #94a3b8;
  text-align: center;
}

.pdf-preview-pages-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.pdf-preview-page-card {
  width: 100%;
  max-width: 540px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.pdf-preview-page-header {
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 10px;
  width: 100%;
  text-align: left;
}

.pdf-preview-page-img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: #ffffff;
}

.pdf-preview-footer {
  padding: 14px 20px;
  background: #1e293b;
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 600px) {
  .pdf-preview-card-dialog {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
  .pdf-preview-modal {
    padding: 0;
    align-items: flex-end;
  }
  .pdf-preview-footer {
    flex-direction: column;
    gap: 8px;
  }
  .pdf-preview-footer button {
    width: 100%;
  }
}

.pdf-preview-modal:not(.open) {
  display: none !important;
}

/* ── ESTILOS DEL MODAL DE PAGO Y CÓDIGO DE RECUPERACIÓN (MOBILE-FIRST) ────── */
.payment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10008;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.payment-modal:not(.open) {
  display: none !important;
}

.payment-modal.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  display: flex !important;
}

.payment-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.payment-card-dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10009;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.payment-modal-header {
  padding: 16px 20px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.payment-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.payment-icon {
  font-size: 20px;
}

.payment-modal-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.payment-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.payment-close-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.1);
}

.payment-modal-body {
  padding: 20px;
  background: #0b1120;
}

.payment-instructions {
  margin: 0 0 16px 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: #cbd5e1;
}

.recovery-code-box {
  background: #1e293b;
  border: 1.5px dashed #86efac;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.recovery-code-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 22px;
  font-weight: 800;
  color: #b0f2ae;
  letter-spacing: 3px;
}

.btn-copy-code {
  background: #b0f2ae;
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-copy-code:hover {
  background: #a0ec9d;
  transform: translateY(-1px);
}

.payment-info-box {
  background: rgba(30, 41, 59, 0.6);
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 12px 14px;
}

.info-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #f59e0b;
  margin-bottom: 4px;
}

.payment-info-box p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #94a3b8;
}

.payment-modal-footer {
  padding: 14px 20px;
  background: #1e293b;
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 600px) {
  .payment-card-dialog {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
  .payment-modal {
    padding: 0;
    align-items: flex-end;
  }
  .payment-modal-footer {
    flex-direction: column;
    gap: 8px;
  }
  .payment-modal-footer button {
    width: 100%;
  }
  .recovery-code-box {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
}

.mobile-hamburger-btn {
  color: #ffffff !important;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-hamburger-btn svg {
  stroke: #ffffff !important;
}

/* ==========================================================================
   ESTILOS PARA EL FORMULARIO INTERACTIVO EN BARRA LATERAL
   ========================================================================== */
.sidebar-tab-switcher {
  display: flex;
  background-color: #0f172a;
  border-bottom: 1px solid #1e293b;
  padding: 6px;
  gap: 6px;
}

.sidebar-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-tab-btn:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-tab-btn.active {
  color: #3b82f6;
  background-color: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tab-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-accordion {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.form-accordion:hover {
  border-color: #475569;
}

.form-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background-color: #1e293b;
  cursor: pointer;
  user-select: none;
}

.form-accordion-header h4,
.runt-section-header h4,
.form-card-item-header h4,
#form-container h4,
.sidebar h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase !important;
  letter-spacing: 0.5px;
}

.form-accordion-chevron {
  font-size: 11px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.form-accordion.open .form-accordion-chevron {
  transform: rotate(180deg);
}

.form-accordion-body {
  display: none;
  padding: 14px;
  border-top: 1px solid #334155;
  background-color: rgba(15, 23, 42, 0.6);
  flex-direction: column;
  gap: 12px;
}

.form-accordion.open .form-accordion-body {
  display: flex;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-row {
  display: flex;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.form-col {
  flex: 1;
  min-width: 0;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  box-sizing: border-box;
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  color: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.form-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 28px;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-textarea {
  min-height: 75px;
  resize: vertical;
}

.form-radio-group {
  display: flex;
  gap: 12px;
  align-items: center;
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  box-sizing: border-box;
}

.form-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #f1f5f9;
  cursor: pointer;
  user-select: none;
}

.form-radio-label input[type="radio"],
.form-radio-label input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.form-signature-upload {
  background-color: #0f172a;
  border: 1px dashed #334155;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-signature-upload:hover {
  border-color: #3b82f6;
}

.form-signature-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
}

.form-signature-preview img {
  max-height: 40px;
  max-width: 140px;
  object-fit: contain;
  background-color: #ffffff;
  border-radius: 4px;
  padding: 2px 4px;
}

.form-font-adjuster {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(30, 41, 59, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #334155;
}

.form-font-adjuster-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 3px;
  padding: 1px 5px;
  cursor: pointer;
  font-weight: 700;
  font-size: 10.5px;
  line-height: 1.2;
  transition: opacity 0.15s ease;
}

.form-font-adjuster-btn.btn-minus {
  background: #ef4444;
}

.form-font-adjuster-btn:hover {
  opacity: 0.85;
}

.form-font-adjuster-val {
  font-size: 11px;
  color: #f8fafc;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.form-card-item {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.form-card-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-card-item-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #60a5fa;
}

.form-btn-delete {
  background: transparent;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.form-btn-delete:hover {
  background-color: rgba(248, 113, 113, 0.15);
}

.form-btn-add {
  background-color: #1e293b;
  border: 1px dashed #3b82f6;
  color: #60a5fa;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  width: 100%;
}

.form-btn-add:hover {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: #60a5fa;
}

.form-bullet-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.form-bullet-row .form-input {
  flex: 1;
}

.form-sub-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-top: 4px;
}

.mobile-page-header,
.mobile-sheet-handle,
.mobile-preview-backdrop {
  display: none !important;
}

.workspace-scroll-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ── MÓVIL Y TABLET (<= 900px): Formulario como contenido principal + Bottom Sheet deslizable para Documento ────── */
@media screen and (max-width: 900px) {
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    position: relative !important;
  }

  body {
    display: block !important;
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    background-color: #0f172a !important;
    padding-top: 58px !important;
    padding-bottom: 76px !important;
  }

  /* Encabezado H1 visible exclusivamente en móvil */
  .mobile-page-header {
    display: block !important;
    text-align: center !important;
    padding: 14px 10px 10px 10px !important;
    margin: 0 auto !important;
  }

  .mobile-h1-title {
    font-size: 21px !important;
    font-weight: 800 !important;
    background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    margin: 0 0 2px 0 !important;
    letter-spacing: -0.3px !important;
    line-height: 1.25 !important;
  }

  .mobile-h1-subtitle {
    font-size: 12px !important;
    color: #94a3b8 !important;
    margin: 0 !important;
    font-weight: 500 !important;
  }

  /* Evitar que elementos del formulario desborden horizontalmente */
  .sidebar,
  .sidebar-content,
  .form-group,
  .form-control,
  input,
  select,
  textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Navbar móvil superior */
  .mobile-navbar {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 58px !important;
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid #1e293b !important;
    z-index: 500 !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }

  /* En móvil: botón hamburguesa a la derecha para desplegar las acciones */
  .navbar-menu-toggle-btn {
    display: flex !important;
    margin-left: auto !important;
  }

  .mobile-brand {
    font-size: 14px !important;
    font-weight: 800 !important;
    background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    letter-spacing: 0.3px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 6px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }

  /* En móvil: el menú de acciones se abre como desplegable flotante sin tapar ni alterar el formulario */
  .navbar-actions-menu {
    display: none !important;
    position: fixed !important;
    top: 60px !important;
    right: 12px !important;
    background: rgba(15, 23, 42, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;
    padding: 10px !important;
    flex-direction: column !important;
    gap: 8px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6) !important;
    z-index: 999 !important;
    min-width: 220px !important;
    box-sizing: border-box !important;
    animation: navbarMenuFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  }

  .navbar-actions-menu.open {
    display: flex !important;
  }

  .navbar-actions-menu .navbar-action-btn {
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
  }

  @keyframes navbarMenuFadeIn {
    from {
      opacity: 0;
      transform: translateY(-8px) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  .mobile-action-btn {
    border-radius: 8px !important;
    padding: 7px 12px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    border: none !important;
    box-sizing: border-box !important;
  }

  .mobile-action-btn:active {
    transform: scale(0.96) !important;
  }

  .mobile-btn-preview {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
  }

  .mobile-btn-preview:hover {
    background: #334155 !important;
    border-color: #475569 !important;
  }

  .mobile-btn-pay {
    background: #b0f2ae !important;
    color: #0f172a !important;
    border: 1px solid #86efac !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 8px rgba(134, 239, 172, 0.25) !important;
  }

  .mobile-btn-pay:hover {
    background: #a0ec9d !important;
  }

  /* El Formulario (Sidebar) es el contenido principal visible en pantalla */
  .sidebar {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 10px !important;
    height: auto !important;
    min-height: auto !important;
    transform: none !important;
    box-shadow: none !important;
    border-right: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
    z-index: 10 !important;
    display: block !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .sidebar-header {
    padding: 16px 14px 12px 14px !important;
    border-bottom: 1px solid #1e293b !important;
    background: rgba(15, 23, 42, 0.8) !important;
    border-radius: 12px !important;
  }

  .sidebar-header .actions-group-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .sidebar-header .btn {
    display: flex !important;
  }

  .sidebar-close-btn {
    display: none !important;
  }

  .sidebar-content {
    padding: 16px 4px 24px 4px !important;
    overflow: visible !important;
    height: auto !important;
    gap: 14px !important;
  }

  /* Telón de fondo oscuro al desplegar la vista previa */
  .mobile-preview-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 7, 18, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }

  .mobile-preview-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  /* El Espacio de Trabajo (Workspace) como Bottom Sheet Deslizable (70vh de altura) */
  .workspace {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 70vh !important;
    max-height: 70vh !important;
    background: #0f172a !important;
    border-top: 2px solid #86efac !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.8) !important;
    z-index: 1200 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateY(calc(100% - 56px)) !important;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .workspace.preview-open {
    transform: translateY(0) !important;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.95) !important;
  }

  /* Pestaña / Asa de agarre del Bottom Sheet con estilo Pagar y Descargar */
  .mobile-sheet-handle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 56px !important;
    min-height: 56px !important;
    background: #b0f2ae !important;
    border-bottom: 1px solid #86efac !important;
    color: #0f172a !important;
    padding: 0 18px !important;
    margin: 0 !important;
    cursor: pointer !important;
    user-select: none !important;
    box-shadow: 0 -2px 14px rgba(134, 239, 172, 0.35) !important;
    flex-shrink: 0 !important;
    border-radius: 18px 18px 0 0 !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
  }

  .mobile-sheet-handle:hover,
  .mobile-sheet-handle:active {
    background: #a0ec9d !important;
  }

  .mobile-sheet-title {
    font-weight: 800 !important;
    font-size: 15px !important;
    color: #0f172a !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    flex: 1 !important;
    margin: 0 auto !important;
    letter-spacing: 0.2px !important;
  }

  .mobile-sheet-circle-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: #0f172a !important;
    color: #b0f2ae !important;
    font-size: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.35s ease !important;
  }

  .workspace.preview-open .mobile-sheet-circle-icon {
    transform: rotate(180deg) !important;
  }

  /* Área de scroll interna del workspace en móvil */
  .workspace-scroll-area {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior: contain !important;
    padding: 12px 10px 80px 10px !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background-color: #0f172a !important;
  }

  .page-shadow-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* La hoja en móvil mantiene la proporción mínima Carta y se expande con el contenido completo */
  .page {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    min-height: calc((100vw - 20px) * 1.2941) !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 24px 18px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
    border-radius: 6px !important;
    margin: 0 0 16px 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
    position: relative !important;
    background: #ffffff !important;
  }

  .page-break-divider {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 12px 0 16px 0 !important;
    border-radius: 8px !important;
    border-left: none !important;
    border-right: none !important;
    height: auto !important;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
  }

  .page-break-divider span {
    font-size: 11px !important;
  }

  /* En móvil, ocultar el bloque de añadir secciones del formulario (ahora vive dentro de la vista previa) */
  .sidebar-add-sections-group {
    display: none !important;
  }

  /* Botones de acción ubicados inmediatamente debajo de las hojas */
  .workspace-add-page-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 16px 14px 32px 14px !important;
    box-sizing: border-box !important;
    background: #0f172a !important;
  }

  .workspace-add-sections-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 2px !important;
  }

  .btn-workspace-action {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  .btn-workspace-preview {
    display: none !important;
  }

  .btn-workspace-add-page,
  .btn-workspace-reorder,
  .btn-workspace-add-pdf,
  .btn-workspace-del-page {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    text-align: center !important;
  }

  /* Barra flotante contextual en móvil */
  .context-bar {
    z-index: 1250 !important;
    max-width: calc(100vw - 16px) !important;
  }
  .context-content {
    padding: 6px 10px !important;
    gap: 6px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(59, 130, 246, 0.4) !important;
  }
  .ctx-btn {
    padding: 7px 11px !important;
    font-size: 12px !important;
    gap: 4px !important;
  }
}

/* ==========================================================================
   ESTRUCTURAS / PLANTILLAS DE CUENTA DE COBRO (10 ESTILOS PROFESIONALES)
   ========================================================================== */

/* ── Estructura 1: Clásica Formal (classic) ────────────────────────────── */
.page[data-template="classic"] {
  border-top: none;
}
.page[data-template="classic"] .section-title {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--accent-color);
}
.page[data-template="classic"] h1.section-title {
  font-size: 16pt;
  display: inline-block;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.page[data-template="classic"] .signature-block {
  text-align: center;
  margin: 0 auto;
}

/* ── Estructura 2: Ejecutiva Corporativa (executive) ─────────────────────── */
.page[data-template="executive"] {
  border-top: 6px solid var(--accent-color);
}
.page[data-template="executive"] h1.section-title {
  background-color: rgba(15, 23, 42, 0.04);
  border: 1px solid #e2e8f0;
  border-left: 5px solid var(--accent-color);
  padding: 8px 16px;
  border-radius: 4px;
  letter-spacing: 1px;
}
.page[data-template="executive"] .resume-section[data-section-type="text"]:has(strong) {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3.5px solid var(--accent-color);
  border-radius: 6px;
  padding: 10px 14px;
}
.page[data-template="executive"] .item-bullets {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 14px 10px 30px;
}

/* ── Estructura 3: Minimalista Elegante (minimalist) ─────────────────────── */
.page[data-template="minimalist"] {
  border-top: none;
}
.page[data-template="minimalist"] h1.section-title {
  font-size: 15pt;
  font-weight: 300;
  letter-spacing: 4px;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 8px;
}
.page[data-template="minimalist"] h2.section-title {
  font-size: 9.5pt;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: #64748b;
  text-transform: uppercase;
}
.page[data-template="minimalist"] .item-bullets {
  list-style-type: square;
}

/* ── Estructura 4: Comercial con Recibo (tech) ──────────────────────────── */
.page[data-template="tech"] {
  border: 1.5px solid #cbd5e1;
}
.page[data-template="tech"] h1.section-title {
  background: #0f172a;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 4px;
  letter-spacing: 1px;
}
.page[data-template="tech"] h1.section-title span {
  color: #ffffff !important;
}
.page[data-template="tech"] .resume-section[data-section-type="text"]:has(strong) {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 6px;
  padding: 8px 12px;
}
.page[data-template="tech"] .item-bullets {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 14px 10px 30px;
  background: #f8fafc;
}

/* ── Estructura 5: Legal / Notarial (harvard) ────────────────────────────── */
.page[data-template="harvard"] h1.section-title {
  border-top: 1.5px solid var(--accent-color);
  border-bottom: 1.5px solid var(--accent-color);
  padding: 6px 0;
  letter-spacing: 2px;
}
.page[data-template="harvard"] h2.section-title {
  letter-spacing: 1.5px;
  border-bottom: 1px solid #94a3b8;
  padding-bottom: 2px;
}
.page[data-template="harvard"] .section-text {
  text-align: justify;
}

/* ── Estructura 6: Compacta de Alto Impacto (compact) ────────────────────── */
.page[data-template="compact"] h1.section-title {
  background-color: var(--accent-color);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 14pt;
  letter-spacing: 1px;
}
.page[data-template="compact"] h1.section-title span {
  color: #ffffff !important;
}
.page[data-template="compact"] .resume-section {
  margin-bottom: 14px !important;
}

/* ── Estructura 7: Corporativa Premium (corporate) ───────────────────────── */
.page[data-template="corporate"] {
  border-top: 8px solid var(--accent-color);
}
.page[data-template="corporate"] h1.section-title {
  background-color: var(--accent-color);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 4px;
  letter-spacing: 1.2px;
}
.page[data-template="corporate"] h1.section-title span {
  color: #ffffff !important;
}
.page[data-template="corporate"] .resume-section[data-section-type="text"]:has(strong) {
  background-color: #f1f5f9;
  border-left: 4px solid var(--accent-color);
  padding: 10px 14px;
  border-radius: 4px;
}

/* ── Estructura 8: Creativa Freelance (creative) ─────────────────────────── */
.page[data-template="creative"] {
  border-left: 6px solid var(--accent-color);
}
.page[data-template="creative"] h1.section-title {
  display: inline-block;
  border-bottom: 3.5px solid var(--accent-color);
  padding-bottom: 3px;
  letter-spacing: 1px;
}
.page[data-template="creative"] h2.section-title {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent-color);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 9pt;
  letter-spacing: 1px;
}

/* ── Estructura 9: Internacional / Bilingüe (international) ──────────────── */
.page[data-template="international"] h1.section-title {
  border-top: 1px solid var(--accent-color);
  border-bottom: 1px solid var(--accent-color);
  padding: 8px 0;
  font-variant: small-caps;
  letter-spacing: 3px;
}
.page[data-template="international"] h2.section-title {
  font-variant: small-caps;
  letter-spacing: 2px;
  border-bottom: 1px solid #d1d5db;
  padding-bottom: 2px;
}

/* ── Estructura 10: Contable / Financiera (analytics) ────────────────────── */
.page[data-template="analytics"] {
  border: 1px solid #0f172a;
}
.page[data-template="analytics"] h1.section-title {
  background: #0f172a;
  color: #ffffff;
  padding: 6px 12px;
  letter-spacing: 1.5px;
  font-family: monospace, monospace;
}
.page[data-template="analytics"] h1.section-title span {
  color: #ffffff !important;
}
.page[data-template="analytics"] .resume-section[data-section-type="text"]:has(strong) {
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
}
.page[data-template="analytics"] .item-bullets {
  border: 1px solid #e2e8f0;
  padding: 8px 12px 8px 26px;
  background: #fafafa;
}

/* ── Estilos del selector visual de plantillas en la barra lateral ───────── */
.template-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 14px;
}

.template-card-btn {
  background-color: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 8px 6px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  outline: none;
}

.template-card-btn:hover {
  border-color: #60a5fa;
  color: #f8fafc;
  background-color: #243249;
  transform: translateY(-1px);
}

.template-card-btn.active {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.15);
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.template-card-btn span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.template-mini-preview {
  width: 100%;
  height: 38px;
  background: #ffffff;
  border-radius: 4px;
  padding: 5px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* Previews de Cuenta de Cobro */
.preview-classic { align-items: center; }
.preview-classic .mini-head { width: 55%; height: 5px; background: #111827; border-bottom: 1px solid #3b82f6; }
.preview-classic .mini-title { width: 80%; height: 3px; background: #cbd5e1; margin-top: 2px; }
.preview-classic .mini-line { width: 60%; height: 2px; background: #94a3b8; }

.preview-executive { border-top: 2.5px solid #3b82f6; }
.preview-executive .mini-head-bar { width: 70%; height: 5px; background: #1e293b; border-left: 2px solid #3b82f6; }
.preview-executive .mini-title-side { width: 90%; height: 5px; background: #f1f5f9; border-left: 2px solid #3b82f6; }
.preview-executive .mini-line { width: 75%; height: 2px; background: #cbd5e1; }

.preview-minimalist .mini-head { width: 65%; height: 3px; background: #475569; letter-spacing: 2px; }
.preview-minimalist .mini-title-spaced { width: 85%; height: 2px; background: #cbd5e1; margin-top: 3px; }
.preview-minimalist .mini-line-none { width: 70%; height: 2px; background: #e2e8f0; }

.preview-tech { border: 1px solid #94a3b8; }
.preview-tech .mini-head { width: 100%; height: 5px; background: #0f172a; }
.preview-tech .mini-box-tag { width: 90%; height: 5px; background: #f8fafc; border: 0.5px dashed #94a3b8; }
.preview-tech .mini-line { width: 75%; height: 2px; background: #cbd5e1; }

.preview-harvard { align-items: center; }
.preview-harvard .mini-head-center { width: 70%; height: 5px; background: #ffffff; border-top: 1px solid #111827; border-bottom: 1px solid #111827; }
.preview-harvard .mini-title-double { width: 85%; height: 3px; background: #1e293b; }
.preview-harvard .mini-line { width: 70%; height: 2px; background: #cbd5e1; }

.preview-compact .mini-head-compact { width: 100%; height: 6px; background: #3b82f6; border-radius: 1px; }
.preview-compact .mini-ribbon { width: 90%; height: 3px; background: #111827; }
.preview-compact .mini-line { width: 80%; height: 2px; background: #cbd5e1; }

.preview-corporate { border-top: 3px solid #1e293b; }
.preview-corporate .mini-head-full { width: 100%; height: 7px; background: #1e293b; border-radius: 1px; }
.preview-corporate .mini-title-bg { width: 90%; height: 5px; background: #f1f5f9; border-left: 2px solid #3b82f6; }
.preview-corporate .mini-line { width: 75%; height: 2px; background: #cbd5e1; }

.preview-creative { border-left: 2.5px solid #3b82f6; }
.preview-creative .mini-head-underline { width: 60%; height: 4px; background: #111827; border-bottom: 1.5px solid #3b82f6; }
.preview-creative .mini-chips { width: 50%; height: 3px; background: #e0f2fe; border-radius: 4px; }
.preview-creative .mini-line { width: 80%; height: 2px; background: #cbd5e1; }

.preview-international { align-items: center; }
.preview-international .mini-head-double { width: 80%; height: 5px; background: #ffffff; border-top: 1px solid #111827; border-bottom: 1px solid #111827; }
.preview-international .mini-title-caps { width: 85%; height: 3px; background: #475569; }
.preview-international .mini-line { width: 75%; height: 2px; background: #cbd5e1; }

.preview-analytics { border: 1px solid #0f172a; }
.preview-analytics .mini-head-mono { width: 100%; height: 5px; background: #0f172a; }
.preview-analytics .mini-title-prompt { width: 90%; height: 4px; background: #e2e8f0; border-left: 2px solid #0f172a; }
.preview-analytics .mini-line { width: 80%; height: 2px; background: #cbd5e1; }









