/* ============================================================
   ControlDoc — Sistema visual
   Concepto: laboratorio forense de documentos. Paleta fría tipo
   papel/tinta de seguridad, acento "sello de verificación" en
   verde-azulado profundo. Tipografía: display editorial serif
   para títulos, sans utilitaria para UI, mono para datos/scores
   (los números de un análisis deben leerse como datos de instrumento).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,500;0,600;0,700;1,500&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    /* Paleta */
    --paper: #F1EFE9;
    --paper-deep: #E7E3D9;
    --ink: #1C2521;
    --ink-soft: #4A554F;
    --line: #CFC8B8;
    --verify: #1F6F5C;
    --verify-deep: #154B3F;
    --verify-glow: #2F8E76;
    --alert: #B5482F;
    --alert-soft: #E7C9BC;
    --amber: #B9842B;
    --white: #FFFDF8;

    --font-display: 'Source Serif 4', Georgia, serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

    --radius-sm: 3px;
    --radius-md: 6px;
    --shadow-card: 0 1px 2px rgba(28, 37, 33, 0.06), 0 8px 24px -12px rgba(28, 37, 33, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Textura sutil tipo papel: ruido fino vía gradiente repetido */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(28,37,33,0.035) 1px, transparent 0);
    background-size: 22px 22px;
    opacity: 0.5;
}

a { color: inherit; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0 0 0.5em;
    letter-spacing: -0.01em;
}

.mono { font-family: var(--font-mono); }

/* ---------------- Layout shell ---------------- */
.shell {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 28px;
}

/* ---------------- Topbar ---------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(241, 239, 233, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.22rem;
    text-decoration: none;
    color: var(--ink);
}
.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--verify-deep);
    position: relative;
    flex-shrink: 0;
}
.brand-mark::after {
    content: '';
    position: absolute;
    inset: 7px;
    border: 1.6px solid var(--paper);
    border-radius: 2px;
}
.brand-mark::before {
    content: '';
    position: absolute;
    left: 11px; top: 14px;
    width: 8px; height: 4px;
    border-left: 1.6px solid var(--paper);
    border-bottom: 1.6px solid var(--paper);
    transform: rotate(-45deg);
}
.brand small {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--verify);
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-links a {
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink-soft);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: color .15s ease, background .15s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--paper-deep); }
.nav-links a.active { color: var(--verify-deep); }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, background .15s ease, border-color .15s ease;
    line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--verify-deep);
    color: var(--white);
}
.btn-primary:hover { background: var(--verify); box-shadow: 0 4px 14px -4px rgba(21,75,63,0.45); }
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper-deep); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.84rem; }
.btn-danger { background: var(--alert); color: var(--white); }
.btn-danger:hover { opacity: 0.92; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}
.card-pad { padding: 28px; }

/* ---------------- Hero ---------------- */
.hero {
    padding: 86px 0 64px;
    position: relative;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 56px;
    align-items: center;
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--verify-deep);
    background: rgba(31, 111, 92, 0.08);
    border: 1px solid rgba(31, 111, 92, 0.25);
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 22px;
}
.eyebrow .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--verify-glow);
    box-shadow: 0 0 0 3px rgba(47,142,118,0.18);
}
.hero h1 {
    font-size: clamp(2.3rem, 4vw, 3.4rem);
    line-height: 1.06;
    color: var(--ink);
}
.hero h1 em {
    font-style: italic;
    color: var(--verify-deep);
}
.hero p.lead {
    font-size: 1.1rem;
    color: var(--ink-soft);
    max-width: 46ch;
    margin: 18px 0 30px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------------- Document scan visual (signature element) ---------------- */
.scan-doc {
    position: relative;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 26px 24px;
    transform: rotate(1.2deg);
}
.scan-doc::before {
    content: 'ANÁLISIS · 04';
    position: absolute;
    top: -11px; left: 20px;
    background: var(--verify-deep);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    padding: 4px 10px;
    border-radius: 3px;
}
.scan-line {
    height: 11px;
    border-radius: 2px;
    margin-bottom: 9px;
    background: var(--paper-deep);
    position: relative;
    overflow: hidden;
}
.scan-line.w-92 { width: 92%; }
.scan-line.w-78 { width: 78%; }
.scan-line.w-100 { width: 100%; }
.scan-line.w-60 { width: 60%; }
.scan-line.w-85 { width: 85%; }
.scan-line.flag {
    background: rgba(181, 72, 47, 0.16);
    outline: 1px solid rgba(181, 72, 47, 0.4);
}
.scan-line.safe {
    background: rgba(31, 111, 92, 0.1);
    outline: 1px solid rgba(31, 111, 92, 0.3);
}
.scan-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
}
.scan-score {
    font-family: var(--font-mono);
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--alert);
    line-height: 1;
}
.scan-score span { font-size: 1rem; font-weight: 600; }
.scan-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

/* ---------------- Sections ---------------- */
.section { padding: 64px 0; }
.section-head { max-width: 640px; margin: 0 0 40px; }
.section-head .eyebrow { margin-bottom: 14px; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.section-head p { color: var(--ink-soft); font-size: 1.02rem; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

.feature-card {
    padding: 26px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--white);
}
.feature-card .num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--verify);
    margin-bottom: 14px;
    display: block;
}
.feature-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.feature-card p { color: var(--ink-soft); font-size: 0.93rem; margin: 0; }

/* ---------------- Dropzone (uploader) ---------------- */
.dropzone {
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-md);
    background: var(--white);
    padding: 56px 28px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--verify);
    background: rgba(31, 111, 92, 0.04);
}
.dropzone-icon {
    width: 52px; height: 52px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: rgba(31,111,92,0.08);
    display: flex; align-items: center; justify-content: center;
    color: var(--verify-deep);
}
.dropzone h3 { font-size: 1.05rem; margin-bottom: 6px; }
.dropzone p { color: var(--ink-soft); font-size: 0.88rem; margin: 0 0 18px; }
.dropzone .formats {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-soft);
    letter-spacing: 0.04em;
}

/* ---------------- Progress / states ---------------- */
.progress-track {
    height: 6px;
    background: var(--paper-deep);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--verify-deep), var(--verify-glow));
    width: 0%;
    transition: width .3s ease;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}
.badge-flag { background: rgba(181,72,47,0.12); color: var(--alert); }
.badge-warn { background: rgba(185,132,43,0.14); color: var(--amber); }
.badge-safe { background: rgba(31,111,92,0.12); color: var(--verify-deep); }
.badge-neutral { background: var(--paper-deep); color: var(--ink-soft); }

/* ---------------- Result paragraph blocks ---------------- */
.parrafo-bloque {
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 12px;
    background: var(--white);
}
.parrafo-bloque.score-alto { border-left-color: var(--alert); }
.parrafo-bloque.score-medio { border-left-color: var(--amber); }
.parrafo-bloque.score-bajo { border-left-color: var(--verify); }
.parrafo-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}
.parrafo-score {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.parrafo-texto {
    font-size: 0.92rem;
    color: var(--ink);
    line-height: 1.6;
    margin: 0 0 8px;
}
.parrafo-motivo {
    font-size: 0.85rem;
    color: var(--ink-soft);
    font-style: italic;
    margin: 0;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
}

/* ---------------- Forms ---------------- */
.form-field { margin-bottom: 18px; }
.form-field label {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--ink);
}
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: var(--font-ui);
    font-size: 0.94rem;
    color: var(--ink);
    transition: border-color .15s ease;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--verify);
    box-shadow: 0 0 0 3px rgba(31,111,92,0.12);
}
.form-hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 6px; }
.form-error {
    background: rgba(181,72,47,0.08);
    border: 1px solid rgba(181,72,47,0.3);
    color: var(--alert);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 18px;
}
.form-success {
    background: rgba(31,111,92,0.08);
    border: 1px solid rgba(31,111,92,0.3);
    color: var(--verify-deep);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 18px;
}

.auth-shell {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card p.sub { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 28px; }
.auth-foot { text-align: center; margin-top: 22px; font-size: 0.88rem; color: var(--ink-soft); }
.auth-foot a { color: var(--verify-deep); font-weight: 600; text-decoration: none; }

/* ---------------- Table ---------------- */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
table.data-table th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-soft);
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}
table.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--paper-deep);
    vertical-align: middle;
}
table.data-table tr:hover td { background: rgba(31,111,92,0.03); }

/* ---------------- Stat tiles (used in dashboards) ---------------- */
.stat-tile {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px 22px;
}
.stat-tile .label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 10px;
}
.stat-tile .value {
    font-family: var(--font-mono);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--ink);
}
.stat-tile .value.accent { color: var(--verify-deep); }
.stat-tile .delta { font-size: 0.8rem; color: var(--ink-soft); margin-top: 6px; }

/* ---------------- Mode banner (modo prueba) ---------------- */
.mode-banner {
    background: var(--verify-deep);
    color: var(--white);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 16px;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}

/* ---------------- Footer ---------------- */
footer.site-footer {
    border-top: 1px solid var(--line);
    padding: 40px 0;
    margin-top: 40px;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

/* ---------------- Sidebar (panel / admin) ---------------- */
.app-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: var(--white);
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
}
.sidebar-nav { margin-top: 30px; display: flex; flex-direction: column; gap: 3px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 500;
}
.sidebar-nav a:hover { background: var(--paper-deep); color: var(--ink); }
.sidebar-nav a.active { background: rgba(31,111,92,0.1); color: var(--verify-deep); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.main-content { padding: 32px 38px; max-width: 1100px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 1.6rem; margin-bottom: 4px; }
.page-head p { color: var(--ink-soft); margin: 0; font-size: 0.94rem; }

/* ---------------- Utility ---------------- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-22 { gap: 22px; }
.mt-8{margin-top:8px} .mt-16{margin-top:16px} .mt-24{margin-top:24px} .mt-32{margin-top:32px}
.mb-8{margin-bottom:8px} .mb-16{margin-bottom:16px} .mb-24{margin-bottom:24px}
.text-soft { color: var(--ink-soft); }
.text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ---------------- Responsive ---------------- */
@media (max-width: 880px) {
    .hero-grid { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { padding: 22px 18px; }
    .nav-links { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Focus visibility (accessibility) */
a:focus-visible, button:focus-visible, input:focus-visible, .dropzone:focus-visible {
    outline: 2px solid var(--verify);
    outline-offset: 2px;
}
