/* Estilos de la capa SaaS (tema claro). Complementa style.css. */

/* ===== Landing (hero + beneficios) ===== */
.hero { margin: 36px 0 8px; text-align: center; }
.hero-title { font-size: 34px; line-height: 1.15; margin: 0 auto 14px; max-width: 720px; letter-spacing: -.5px; }
.hero-title span { color: var(--accent); }
.hero-sub { color: var(--muted); font-size: 16px; max-width: 620px; margin: 0 auto 26px; }
.hero-upload { max-width: 620px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.hero-upload .dropzone { width: 100%; }
.dropzone.dz-over { border-color: var(--accent); background: var(--surface-2); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.hero-actions .btn-primary { flex: 1; min-width: 180px; }
.btn-convert { background: var(--pass); }
.hero-hint { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.hero-hint a { color: var(--accent); }

.benefits { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin: 40px 0 12px; }
.benefit { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.benefit-ico { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 10px; background: var(--surface-2); color: var(--accent); font-size: 20px; margin-bottom: 12px; }
.benefit h3 { margin: 0 0 6px; font-size: 16px; }
.benefit p { margin: 0; color: var(--muted); font-size: 14px; }


.site-foot {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    padding: 28px 20px; margin-top: 40px; border-top: 1px solid var(--border);
    color: var(--muted); font-size: 13px;
}
.site-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--accent); }

.inline-form { display: inline; margin: 0; }
.linklike {
    background: none; border: 1px solid transparent; color: var(--muted);
    cursor: pointer; font: inherit; font-size: 13.5px; padding: 8px 14px; border-radius: 8px;
}
.linklike:hover { color: var(--text); border-color: var(--border); background: var(--surface); }
.nav-cta { background: var(--accent); color: #fff !important; border-radius: 8px; }
/* Specificity mayor que `.topnav a:hover` para no heredar el fondo blanco
   (que dejaba el texto blanco ilegible). Mantiene el CTA azul en hover. */
.topnav a.nav-cta:hover { background: var(--accent) !important; color: #fff !important; border-color: transparent !important; filter: brightness(1.08); }

/* Tarjeta / formularios de autenticación */
.auth-card {
    max-width: 440px; margin: 32px auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 32px;
    box-shadow: 0 1px 3px rgba(16,24,40,.05);
}
.auth-card h2 { margin: 0 0 6px; font-size: 22px; }
.auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password] {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px;
    background: #fff; color: var(--text); font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,255,.15); }
.field-check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.field-check a { color: var(--accent); }

.btn-primary {
    width: 100%; padding: 12px; border: none; border-radius: 10px; background: var(--accent);
    color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.07); }

.auth-alt { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { color: var(--accent); text-decoration: none; }

.oauth-list { display: grid; gap: 10px; margin: 4px 0 20px; }
.oauth-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
    color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px;
}
.oauth-btn:hover { background: var(--surface-2); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Alertas */
.alert { padding: 13px 16px; border-radius: 10px; margin: 16px 0; font-size: 14px; }
.alert-success { background: rgba(30,158,84,.12); border: 1px solid var(--pass); color: #176b3a; }
.alert-error   { background: rgba(210,59,59,.10); border: 1px solid var(--fail); color: #9b2222; }
.alert-info    { background: rgba(47,127,181,.10); border: 1px solid var(--info); color: #1d567a; }

/* Cabeceras de sección */
.page-head { margin: 28px 0 18px; }
.page-head h2 { margin: 0; font-size: 24px; }
.page-head p { color: var(--muted); margin: 6px 0 0; }

/* Planes */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.plan {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; display: flex; flex-direction: column;
}
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan h3 { margin: 0 0 4px; font-size: 18px; }
.plan .price { font-size: 30px; font-weight: 800; margin: 8px 0; }
.plan .price small { font-size: 14px; font-weight: 600; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 20px; font-size: 14px; color: var(--muted); }
.plan ul li { padding: 5px 0; border-bottom: 1px solid var(--border); }
.plan .btn-primary { margin-top: auto; text-align: center; text-decoration: none; display: block; }

/* Dashboard / documentos */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.panel h3 { margin: 0 0 14px; font-size: 16px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.doc-table th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.doc-table td { padding: 10px; border-bottom: 1px solid var(--border); }
/* Enlaces de acción en tablas: coherentes con el resto (sin subrayado por defecto). */
.doc-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.doc-table a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* Documento legal */
.legal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 36px; max-width: 820px; }
.legal h1 { font-size: 26px; margin-top: 0; }
.legal h2 { font-size: 18px; margin-top: 28px; }
.legal p, .legal li { color: var(--text); font-size: 14.5px; }
.legal .ver { color: var(--muted); font-size: 12.5px; }

/* ===== Panel de administración ===== */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.admin-nav a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; }
.admin-nav a:hover { color: var(--text); }
.admin-nav a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.kpi .num { font-size: 26px; font-weight: 800; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-ok    { background: rgba(30,158,84,.14); color: #176b3a; }
.badge-warn  { background: rgba(185,121,27,.14); color: #8a5a12; }
.badge-fail  { background: rgba(210,59,59,.12); color: #9b2222; }
.badge-muted { background: rgba(107,114,128,.16); color: #4b5563; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-on  { background: var(--pass); }
.dot-off { background: var(--fail); }

.adm-actions form { display: inline; }
.adm-actions button, .adm-actions select { font: inherit; font-size: 12.5px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px; background: #fff; cursor: pointer; }

/* ===== Pantalla única de resultado (/documento/{id}) ===== */
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 26px 0 18px; }
.doc-head .dh-left { min-width: 220px; }
.doc-head .dh-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.doc-title { margin: 0; font-size: 22px; word-break: break-word; }
.btn-dl-primary { display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
    font-weight: 700; font-size: 14.5px; padding: 12px 20px; border-radius: 10px; white-space: nowrap;
    box-shadow: 0 2px 6px rgba(47,107,255,.25); }
.btn-dl-primary:hover { filter: brightness(1.06); }
.score-transition { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 20px; }
.st-num { font-size: 30px; font-weight: 800; line-height: 1; }
.st-num.ba-pass { color: var(--pass); } .st-num.ba-warning { color: var(--warn); }
.st-num.ba-fail { color: var(--fail); } .st-num.ba-na { color: var(--na); }
.st-arrow { color: var(--muted); font-size: 22px; }
.st-lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

.tabbar { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { font: inherit; font-size: 14px; padding: 10px 16px; background: none; border: none; cursor: pointer;
    color: var(--muted); border-bottom: 2px solid transparent; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.cmp-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.dl-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* CTA prominente para convertir tras auditar (no escondido en una pestaña). */
.convert-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    margin: 4px 0 22px; padding: 20px 24px; border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(30,158,84,.10), rgba(47,107,255,.08));
    border: 1px solid var(--pass); }
.convert-banner .cb-text { flex: 1; min-width: 240px; }
.convert-banner h3 { margin: 0 0 4px; font-size: 18px; }
.convert-banner p { margin: 0; color: var(--muted); font-size: 14px; max-width: 620px; }
.cb-action { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-cta-convert { display: inline-block; background: var(--pass); color: #fff; border: none; cursor: pointer;
    font: inherit; font-size: 15px; font-weight: 700; padding: 13px 24px; border-radius: 10px; text-decoration: none;
    box-shadow: 0 2px 6px rgba(30,158,84,.25); }
.btn-cta-convert:hover { filter: brightness(1.06); }
.cb-alt { color: var(--accent); text-decoration: none; font-size: 13.5px; }
.cb-alt:hover { text-decoration: underline; }

/* ===== Comparación visual (PDF.js) dentro del shell ===== */
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 26px 0 14px; }
.cmp-head-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cmp-sync { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
/* Rompe el ancho del .wrap sin 100vw (evita scroll horizontal por la barra). */
.cmp-fullbleed { position: relative; width: calc(100% + 40px); max-width: none; margin-left: -20px; margin-right: -20px; padding: 0 20px; }
.cmp-grid { display: flex; gap: 14px; height: calc(100vh - 220px); min-height: 420px; max-width: 1600px; margin: 0 auto; }
.cmp-col { flex: 1 1 50%; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cmp-label { padding: 9px 14px; font-size: 13px; font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cmp-label small { font-weight: 400; color: var(--muted); }
.cmp-label-new { color: var(--pass); }
.pane { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px; background: var(--surface-2); }
.pane canvas { display: block; margin: 0 auto 12px; max-width: 100%; box-shadow: 0 1px 6px rgba(16,24,40,.18); background: #fff; }
.pane .err { color: var(--fail); padding: 20px; text-align: center; }
.pane .loading { color: var(--muted); padding: 20px; text-align: center; font-size: 13px; }
@media (max-width: 800px) { .cmp-grid { flex-direction: column; height: auto; } .cmp-col { height: 70vh; } }

/* ===== Responsive (móvil / tablet estrecha) ===== */
@media (max-width: 680px) {
    .hero { margin: 22px 0 4px; }
    .hero-title { font-size: 26px; letter-spacing: -.35px; }
    .hero-sub { font-size: 15px; margin-bottom: 20px; }
    .hero-upload { padding: 16px; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn-primary { min-width: 0; width: 100%; }

    .benefits { margin-top: 28px; gap: 14px; }
    .benefit { padding: 18px 20px; }

    .site-foot { flex-direction: column; align-items: flex-start; padding: 22px 16px; margin-top: 28px; }
    .site-foot nav { gap: 12px 16px; }

    .page-head { margin: 18px 0 14px; }
    .page-head h2 { font-size: 21px; }
    .page-head p { font-size: 14px; line-height: 1.55; }

    .auth-card { margin: 20px auto; padding: 22px 18px; }

    .legal { padding: 22px 18px; }
    .legal h1 { font-size: 22px; }

    .doc-head { flex-direction: column; align-items: stretch; margin: 18px 0 14px; gap: 12px; }
    .doc-head .dh-left { min-width: 0; }
    .doc-head .dh-right { flex-direction: column; align-items: stretch; width: 100%; }
    .doc-title { font-size: 19px; }
    .score-transition { justify-content: center; width: 100%; }
    .btn-dl-primary { display: block; text-align: center; width: 100%; }

    .convert-banner { flex-direction: column; align-items: stretch; padding: 16px 18px; gap: 14px; }
    .convert-banner .cb-text { min-width: 0; }
    .convert-banner h3 { font-size: 16px; }
    .cb-action { flex-direction: column; align-items: stretch; width: 100%; }
    .btn-cta-convert { display: block; width: 100%; text-align: center; box-sizing: border-box; }
    .cb-alt { text-align: center; }

    .tabbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0;
        scrollbar-width: none; margin-left: -4px; margin-right: -4px; padding: 0 4px; }
    .tabbar::-webkit-scrollbar { display: none; }
    .tab-btn { flex: 0 0 auto; white-space: nowrap; padding: 9px 14px; font-size: 13.5px; }

    .cmp-cta { flex-direction: column; align-items: stretch; }
    .cmp-cta .btn-primary { width: 100%; text-align: center; box-sizing: border-box; }

    .cmp-head { flex-direction: column; align-items: stretch; margin: 18px 0 12px; gap: 12px; }
    .cmp-head-tools { flex-direction: column; align-items: stretch; gap: 10px; }
    .cmp-head-tools .btn-ghost { text-align: center; }

    .admin-nav { gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap;
        scrollbar-width: none; padding-bottom: 2px; }
    .admin-nav::-webkit-scrollbar { display: none; }
    .admin-nav a { flex: 0 0 auto; white-space: nowrap; font-size: 13px; padding: 8px 12px; }

    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi { padding: 12px 14px; }
    .kpi .num { font-size: 22px; }

    .panel { padding: 16px 18px; }

    .cmp-fullbleed { width: calc(100% + 32px); margin-left: -16px; margin-right: -16px; padding: 0 16px; }
    .cmp-col { height: 55vh; min-height: 280px; }

    .cookie-banner { padding: 12px 16px !important; font-size: 12.5px !important; }
    .cookie-banner-inner { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
    .cookie-banner button { width: 100%; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 23px; }
    .plans-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}
