/* =====================================================================
   ORIGINALIS AI v3 — Sistema visual "Glacier Blue"
   Blanco + azul eléctrico, rejilla técnica sutil, paneles de vidrio.
   ===================================================================== */
:root {
    --navy-950: #050d24;
    --navy-900: #0a1a3f;
    --navy-800: #102a5c;
    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-400: #60a5fa;
    --blue-100: #dbeafe;
    --blue-50:  #eff6ff;
    --blue-900: #1e3a8a;
    --cyan-500: #06b6d4;
    --cyan-400: #22d3ee;
    --ai-blue:  #0ea5e9;
    --ice:      #f5f8ff;
    --line:     #e2e9f7;
    --line-2:   #cfdaf0;
    --text:     #0b1630;
    --muted:    #5b6b8c;
    --ok:       #059669;
    --warn:     #d97706;
    --bad:      #dc2626;
    --radius:   14px;
    --shadow:   0 1px 2px rgba(10,26,63,.06), 0 8px 24px -12px rgba(29,78,216,.25);
    --glow:     0 0 0 1px rgba(37,99,235,.18), 0 10px 30px -10px rgba(37,99,235,.45);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    --font-display: "Space Grotesk", "Inter", "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(59,130,246,.10), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(6,182,212,.08), transparent 60%),
        linear-gradient(rgba(37,99,235,.035) 1px, transparent 1px) 0 0/28px 28px,
        linear-gradient(90deg, rgba(37,99,235,.035) 1px, transparent 1px) 0 0/28px 28px,
        var(--ice);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }
code, .mono { font-family: var(--mono); font-size: .85em; }
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -.01em; }

/* ---------------- Barra superior ---------------- */
.top-navbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 1rem;
    padding: .65rem 1.4rem;
    background: rgba(255,255,255,.82);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.top-navbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--blue-500), var(--cyan-400), transparent);
    opacity: .55;
}
.brand-logo { display: flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--navy-900); letter-spacing: .04em; white-space: nowrap; }
.brand-icon-box {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
    background: conic-gradient(from 210deg, var(--blue-700), var(--cyan-500), var(--blue-600), var(--blue-700));
    box-shadow: var(--glow);
}
.brand-badge { font-family: var(--mono); font-size: .68rem; font-weight: 600; color: var(--blue-700); background: var(--blue-50); border: 1px solid var(--blue-100); padding: .12rem .45rem; border-radius: 999px; }
.nav-links { display: flex; gap: .15rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-item {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    padding: .5rem .75rem; border-radius: 10px; font-size: .84rem; font-weight: 500; color: var(--muted);
    transition: background .15s, color .15s;
}
.nav-item i { color: var(--blue-500); font-size: .9em; }
.nav-item:hover { background: var(--blue-50); color: var(--navy-900); }
.nav-item.active { background: linear-gradient(180deg, #fff, var(--blue-50)); color: var(--blue-700); box-shadow: inset 0 0 0 1px var(--blue-100); font-weight: 600; }
.user-pill { display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--navy-800); white-space: nowrap; }
.role-tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 600; padding: .22rem .55rem; border-radius: 999px; background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }

.main-container { max-width: 1480px; margin: 0 auto; padding: 1.6rem 1.4rem 3rem; }
.main-container.wide { max-width: none; padding: 0; }

/* ---------------- Tarjetas ---------------- */
.card {
    background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.25rem 1.35rem; margin-bottom: 1.25rem; position: relative;
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--navy-900); display: flex; align-items: center; gap: .55rem; }
.card-title i { color: var(--blue-600); }
.card-sub { color: var(--muted); font-size: .85rem; margin: -.4rem 0 1rem; line-height: 1.5; }
.page-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--navy-900); margin: 0 0 .2rem; }
.page-sub { color: var(--muted); margin: 0 0 1.4rem; }
.eyebrow { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--blue-600); }

/* ---------------- KPI ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--blue-600), var(--cyan-400)); }
.kpi-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--navy-900); line-height: 1.1; }
.kpi-label { font-size: .78rem; color: var(--muted); margin-top: .25rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi-icon { position: absolute; right: 1rem; top: 1rem; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue-600); }

/* ---------------- Botones ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .6rem 1rem; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .86rem;
    cursor: pointer; transition: transform .08s, box-shadow .15s, background .15s; text-decoration: none; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { color: #fff; background: linear-gradient(180deg, var(--blue-500), var(--blue-700)); box-shadow: 0 6px 18px -8px rgba(37,99,235,.8), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { color: #fff; box-shadow: var(--glow); }
.btn-outline { background: #fff; color: var(--navy-800); border-color: var(--line-2); }
.btn-outline:hover { border-color: var(--blue-400); color: var(--blue-700); background: var(--blue-50); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--blue-50); color: var(--blue-700); }
.btn-danger { background: #fff; color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sim-pdf { color: #fff; background: linear-gradient(180deg, #ef4444, #b91c1c); }
.btn-sim-pdf:hover { color: #fff; filter: brightness(1.05); }
.btn-ai-pdf { color: #fff; background: linear-gradient(180deg, var(--cyan-500), var(--blue-700)); }
.btn-ai-pdf:hover { color: #fff; filter: brightness(1.05); }
.btn-sm { padding: .38rem .65rem; font-size: .78rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------------- Tablas ---------------- */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.data-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .65rem .75rem; border-bottom: 1px solid var(--line); background: #fafcff; position: sticky; top: 0; }
.data-table td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:hover td { background: #f8fbff; }

/* ---------------- Píldoras / alertas ---------------- */
.metric-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-weight: 700; font-size: .8rem; font-family: var(--mono); }
.pill-sim-low { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.pill-sim-med { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.pill-sim-high { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.pill-ai-cyan { background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; }
.pill-muted { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.alert-banner { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; font-size: .88rem; margin-bottom: 1rem; line-height: 1.5; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: var(--blue-50); color: var(--blue-900); border: 1px solid var(--blue-100); }
.alert-warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---------------- Formularios ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.form-label { font-size: .78rem; font-weight: 600; color: var(--navy-800); }
.form-hint { font-size: .74rem; color: var(--muted); }
.form-control { width: 100%; padding: .62rem .75rem; border: 1px solid var(--line-2); border-radius: 10px; font: inherit; font-size: .88rem; background: #fff; color: var(--text); transition: border .15s, box-shadow .15s; }
.form-control:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(59,130,246,.15); }
textarea.form-control { resize: vertical; min-height: 110px; }
.check { display: flex; align-items: center; gap: .55rem; font-size: .86rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue-600); }

/* ---------------- Zona de carga ---------------- */
.dropzone {
    display: block; position: relative;
    border: 1.5px dashed var(--blue-400); border-radius: 18px; padding: 2.4rem 1.5rem; text-align: center; cursor: pointer;
    background: linear-gradient(180deg, rgba(239,246,255,.75), rgba(255,255,255,.9)); transition: border-color .15s, box-shadow .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--blue-600); box-shadow: var(--glow); }
.dropzone .dz-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto .8rem; display: grid; place-items: center; font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, var(--blue-600), var(--cyan-500)); box-shadow: var(--glow); }

/* ---------------- Pantalla de procesamiento ---------------- */
.proc-wrap { max-width: 880px; margin: 2rem auto; }
.scan-ring { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 1.2rem; position: relative; display: grid; place-items: center;
    background: conic-gradient(var(--blue-600) calc(var(--p) * 1%), var(--blue-100) 0); transition: --p .4s; }
.scan-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.scan-ring span { position: relative; font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--navy-900); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: .75rem; padding: .6rem .2rem; border-bottom: 1px dashed var(--line); font-size: .9rem; color: var(--muted); }
.steps li .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; border: 1px solid var(--line-2); background: #fff; flex: 0 0 auto; }
.steps li.done { color: var(--navy-900); }
.steps li.done .dot { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.steps li.run { color: var(--blue-700); font-weight: 600; }
.steps li.run .dot { border-color: var(--blue-500); animation: pulse 1.2s infinite; }
.steps li .ms { margin-left: auto; font-family: var(--mono); font-size: .75rem; color: var(--muted); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,.45); } 50% { box-shadow: 0 0 0 6px rgba(59,130,246,0); } }

/* ---------------- Visor de informe ---------------- */
.viewer-shell { display: grid; grid-template-rows: auto 1fr; height: calc(100vh - var(--topbar-h)); }
.viewer-toolbar {
    display: flex; align-items: center; gap: .9rem; padding: .6rem 1rem; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.viewer-toolbar .doc-title { font-weight: 700; color: var(--navy-900); max-width: 34vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-toolbar .doc-meta { font-size: .76rem; color: var(--muted); font-family: var(--mono); }
.score-chip { display: inline-flex; align-items: center; gap: .55rem; padding: .35rem .7rem .35rem .4rem; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .78rem; color: var(--muted); }
.score-chip.active { box-shadow: var(--glow); border-color: var(--blue-400); }
.score-chip b { font-family: var(--font-display); font-size: 1.15rem; color: var(--navy-900); }
.score-chip .ring { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: #fff; }
.score-chip.sim .ring { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.score-chip.ai .ring { background: linear-gradient(135deg, var(--cyan-400), var(--blue-700)); }
.viewer-layout { display: grid; grid-template-columns: 1fr 420px; min-height: 0; }
.viewer-layout.panel-hidden { grid-template-columns: 1fr 0; }
.viewer-layout.panel-hidden .sidebar-inspector { display: none; }
.document-canvas-wrapper { overflow: auto; padding: 1.6rem; background: linear-gradient(180deg, #e9eff9, #dfe7f5); position: relative; }
.page-box { position: relative; margin: 0 auto 1.4rem; background: #fff; box-shadow: 0 2px 6px rgba(10,26,63,.08), 0 18px 40px -20px rgba(10,26,63,.35); border-radius: 2px; }
.page-box canvas { display: block; }
.page-box .page-num { position: absolute; top: -1.15rem; right: 0; font-size: .68rem; color: var(--muted); font-family: var(--mono); }
.hl-layer { position: absolute; inset: 0; pointer-events: none; }
.hl { position: absolute; mix-blend-mode: multiply; border-radius: 2px; pointer-events: auto; cursor: pointer; transition: filter .12s; }
.hl:hover { filter: saturate(1.6) brightness(.92); }
.hl.focus { outline: 2px solid var(--navy-900); outline-offset: 1px; }
.hl-badge { position: absolute; transform: translate(-100%, -55%); min-width: 16px; height: 16px; padding: 0 3px; border-radius: 4px; color: #fff; font: 700 10px/16px var(--font); text-align: center; pointer-events: auto; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.a4-page-sheet { max-width: 820px; margin: 0 auto 1.4rem; background: #fff; padding: 3.2rem 3.6rem; box-shadow: 0 2px 6px rgba(10,26,63,.08), 0 18px 40px -20px rgba(10,26,63,.35); font-family: "Times New Roman", Georgia, serif; font-size: 15.5px; line-height: 1.75; color: #111; position: relative; }
.a4-page-header { position: absolute; top: .8rem; right: 1.2rem; font: 600 .68rem var(--mono); color: var(--muted); }
.doc-paragraph { margin: 0 0 .9rem; text-align: justify; }
.doc-paragraph.is-heading { font-weight: 700; text-align: left; margin-top: 1.2rem; }
.w { border-radius: 2px; }
.w.m { cursor: pointer; }
.docx-host .docx-wrapper { background: transparent !important; padding: 0 !important; }
.docx-host .docx-wrapper > section.docx { box-shadow: 0 2px 6px rgba(10,26,63,.08), 0 18px 40px -20px rgba(10,26,63,.35); margin-bottom: 1.4rem !important; }

.sidebar-inspector { background: rgba(255,255,255,.96); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inspector-tabs { display: flex; gap: .1rem; padding: .5rem .5rem 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; flex: 0 0 auto; }
.inspector-tab-btn { border: 0; background: none; padding: .55rem .7rem; font: 600 .76rem var(--font); color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.inspector-tab-btn.active { color: var(--blue-700); border-bottom-color: var(--blue-600); }
.inspector-body { padding: 1rem; overflow-y: auto; flex: 1; min-height: 0; }
.inspector-pane { display: none; }
.inspector-pane.active { display: block; }
.big-score { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-radius: 14px; background: linear-gradient(135deg, var(--navy-900), var(--blue-700)); color: #fff; margin-bottom: 1rem; }
.big-score .val { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.big-score .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; opacity: .85; }
.cat-row { display: flex; align-items: center; gap: .6rem; font-size: .83rem; padding: .35rem 0; }
.cat-row .bar { flex: 1; height: 6px; border-radius: 6px; background: var(--blue-50); overflow: hidden; }
.cat-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-500), var(--cyan-400)); }
.cat-row b { font-family: var(--mono); min-width: 3.2em; text-align: right; }
.source-list-item { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .6rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s; }
.source-list-item:hover { background: #f8fbff; border-color: var(--line); }
.source-list-item.excluded { opacity: .45; }
.source-num-square { width: 26px; height: 26px; border-radius: 7px; color: #fff; display: grid; place-items: center; font: 700 .76rem var(--font); flex: 0 0 auto; }
.source-main { flex: 1; min-width: 0; }
.source-title { font-weight: 600; font-size: .85rem; color: var(--navy-900); word-break: break-word; }
.source-meta { font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.source-pct { font-family: var(--mono); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.side-by-side-box { display: grid; gap: .6rem; }
.compare-col { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; font-size: .84rem; line-height: 1.55; background: #fff; }
.compare-col h5 { margin: 0 0 .4rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.compare-col mark { background: rgba(239,68,68,.22); padding: 0 1px; border-radius: 2px; }
.group-card { border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; margin-bottom: .6rem; cursor: pointer; }
.group-card:hover { border-color: var(--blue-400); }
.group-card.active { box-shadow: var(--glow); border-color: var(--blue-500); }
.group-card .gtitle { font-weight: 700; font-size: .86rem; display: flex; justify-content: space-between; }
.group-card .gdesc { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.page-dist { display: flex; gap: 2px; align-items: flex-end; height: 46px; margin: .6rem 0 1rem; }
.page-dist i { flex: 1; background: var(--blue-100); border-radius: 2px 2px 0 0; min-height: 3px; cursor: pointer; }
.page-dist i.on { background: linear-gradient(180deg, var(--cyan-400), var(--blue-600)); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; font-size: .8rem; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { font-family: var(--mono); text-align: right; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.hr { height: 1px; background: var(--line); margin: 1rem 0; }
.nav-arrows { display: inline-flex; gap: .3rem; }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); font-size: .88rem; }
.empty-state i { font-size: 1.8rem; color: var(--blue-400); display: block; margin-bottom: .6rem; }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--navy-900); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; font-size: .86rem; box-shadow: var(--glow); z-index: 100; }

/* Grids genéricos */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 1100px) {
    .viewer-layout { grid-template-columns: 1fr; }
    .sidebar-inspector { border-left: 0; border-top: 1px solid var(--line); max-height: 55vh; }
    .viewer-shell { height: auto; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media print { .top-navbar, .viewer-toolbar, .sidebar-inspector { display: none !important; } }

/* ---------------- v3.1: carga, cursos, sospecha ---------------- */
.stepper { display: flex; gap: .6rem; margin: 0 0 1.2rem; flex-wrap: wrap; }
.stepper .st { display: flex; align-items: center; gap: .5rem; padding: .45rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.stepper .st b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue-700); font-size: .72rem; }
.stepper .st.on { border-color: var(--blue-400); color: var(--navy-900); box-shadow: var(--glow); }
.stepper .st.on b { background: var(--blue-600); color: #fff; }
.file-card { display: none; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-top: 1rem; box-shadow: var(--shadow); }
.file-card.show { display: flex; }
.file-card .ficon { width: 46px; height: 54px; border-radius: 8px; display: grid; place-items: center; color: #fff; font: 700 .72rem var(--mono); background: linear-gradient(160deg, #ef4444, #b91c1c); flex: 0 0 auto; }
.file-card .ficon.docx { background: linear-gradient(160deg, #3b82f6, #1d4ed8); }
.file-card .ficon.txt { background: linear-gradient(160deg, #64748b, #334155); }
.file-card .fname { font-weight: 700; color: var(--navy-900); word-break: break-all; }
.file-card .fmeta { font-size: .78rem; color: var(--muted); font-family: var(--mono); margin-top: .2rem; }
.progress-line { height: 6px; border-radius: 6px; background: var(--blue-50); overflow: hidden; margin-top: .55rem; }
.progress-line i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue-500), var(--cyan-400)); transition: width .25s; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem; }
.choice { border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; cursor: pointer; background: #fff; display: flex; gap: .7rem; align-items: flex-start; }
.choice:hover { border-color: var(--blue-400); }
.choice input { margin-top: .2rem; accent-color: var(--blue-600); }
.choice.sel { border-color: var(--blue-500); box-shadow: var(--glow); background: linear-gradient(180deg, #fff, var(--blue-50)); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.course-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.course-card .band { height: 74px; padding: .9rem 1rem; color: #fff; background: linear-gradient(135deg, var(--navy-900), var(--blue-700) 60%, var(--cyan-500)); position: relative; }
.course-card .band .code { font: 700 .72rem var(--mono); opacity: .85; }
.course-card .band .per { position: absolute; right: 1rem; top: .9rem; font-size: .72rem; background: rgba(255,255,255,.18); padding: .15rem .5rem; border-radius: 999px; }
.course-card .body { padding: 1rem; flex: 1; }
.course-card .title { font-weight: 700; color: var(--navy-900); font-size: 1rem; }
.course-card .stats { display: flex; gap: 1rem; margin-top: .6rem; font-size: .8rem; color: var(--muted); }
.lvl { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font: 700 .7rem var(--font); }
.lvl.ALTO { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.lvl.MEDIO { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.lvl.BAJO { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.sig-bar { height: 5px; background: var(--blue-50); border-radius: 5px; overflow: hidden; }
.sig-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #dc2626); }
.tag-soft { font-size: .7rem; padding: .12rem .45rem; border-radius: 6px; background: var(--blue-50); color: var(--blue-700); font-weight: 600; }

/* =====================================================================
   v3.2 — CAPA DE DISEÑO «Aurora Glacier»
   Menú lateral colapsable con iconos, barra superior compacta,
   tarjetas con profundidad suave, controles redondeados y estados claros.
   ===================================================================== */
:root {
    --sb-w: 252px;
    --sb-w-min: 74px;
    --topbar-h: 60px;
    --surface: #ffffff;
    --surface-2: #f7f9ff;
    --ring: 0 0 0 3px rgba(37,99,235,.18);
    --shadow-1: 0 1px 2px rgba(10,26,63,.05), 0 4px 14px -6px rgba(10,26,63,.10);
    --shadow-2: 0 2px 6px rgba(10,26,63,.06), 0 18px 40px -18px rgba(29,78,216,.30);
    --grad-brand: linear-gradient(135deg, #1d4ed8 0%, #2563eb 40%, #06b6d4 100%);
}
body.app { display: block; }
.top-navbar { display: none; }

/* ---------- Menú lateral ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 60;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, #07142f 0%, #0a1d45 55%, #0b2557 100%);
    color: #c9d6f5; border-right: 1px solid rgba(255,255,255,.06);
    transition: width .22s ease, transform .22s ease;
}
.sidebar::before { content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(420px 260px at 0% 0%, rgba(59,130,246,.25), transparent 70%), radial-gradient(300px 240px at 100% 100%, rgba(6,182,212,.18), transparent 70%); }
.sb-brand { position: relative; display: flex; align-items: center; gap: .7rem; padding: 1.05rem 1.05rem .9rem; color: #fff; }
.sb-brand-text { font-family: var(--font-display); font-weight: 700; letter-spacing: .05em; font-size: 1rem; line-height: 1.1; }
.sb-brand-text b { color: #7dd3fc; font-weight: 700; }
.sb-brand-text small { display: block; font-family: var(--mono); font-size: .64rem; color: #93a8d6; letter-spacing: 0; font-weight: 500; margin-top: .15rem; }
.sb-nav { position: relative; flex: 1; overflow-y: auto; padding: .3rem .65rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sb-group { font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #6f86b8; padding: 1rem .7rem .4rem; }
.sb-item {
    position: relative; display: flex; align-items: center; gap: .8rem; width: 100%;
    padding: .62rem .75rem; margin: 2px 0; border-radius: 11px; border: 0; background: none; cursor: pointer;
    color: #c9d6f5; font: 500 .86rem var(--font); text-align: left; white-space: nowrap;
    transition: background .15s, color .15s, transform .15s;
}
.sb-item i { width: 22px; text-align: center; font-size: 1.02rem; color: #7ea2e8; transition: color .15s, transform .2s; }
.sb-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sb-item:hover i { color: #7dd3fc; transform: scale(1.12); }
.sb-item.active { background: linear-gradient(90deg, rgba(59,130,246,.38), rgba(6,182,212,.12)); color: #fff; box-shadow: inset 0 0 0 1px rgba(125,211,252,.25); }
.sb-item.active::before { content: ""; position: absolute; left: -.65rem; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0; background: #38bdf8; box-shadow: 0 0 12px #38bdf8; }
.sb-item.active i { color: #7dd3fc; }
.sb-foot { position: relative; padding: .6rem .65rem .9rem; border-top: 1px solid rgba(255,255,255,.07); }
.sb-engine { font-size: .72rem; color: #9fb3dd; padding: .4rem .75rem .7rem; line-height: 1.4; }
.sb-engine small { color: #6f86b8; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; margin-right: .3rem; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.sb-toggle i { transition: transform .25s; }
.app-main { margin-left: var(--sb-w); min-height: 100vh; transition: margin-left .22s ease; }

/* Minimizado: solo iconos con etiqueta flotante */
body.sb-min .sidebar { width: var(--sb-w-min); }
body.sb-min .app-main { margin-left: var(--sb-w-min); }
body.sb-min .sb-label { display: none; }
body.sb-min .sb-brand { justify-content: center; padding-left: 0; padding-right: 0; }
body.sb-min .sb-item { justify-content: center; padding: .7rem 0; }
body.sb-min .sb-toggle i { transform: rotate(180deg); }
body.sb-min .sb-item:hover::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    background: #0b1630; color: #fff; font-size: .78rem; font-weight: 600; padding: .4rem .65rem; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25); white-space: nowrap; z-index: 80; pointer-events: none;
}
body.sb-min .sb-nav { overflow: visible; }

/* ---------- Barra superior ---------- */
.topbar {
    position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
    display: flex; align-items: center; gap: .9rem; padding: 0 1.4rem;
    background: rgba(255,255,255,.86); backdrop-filter: saturate(170%) blur(14px); -webkit-backdrop-filter: saturate(170%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad-brand); opacity: .55; }
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.topbar-title .crumb { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title b { font-family: var(--font-display); font-size: 1.08rem; color: var(--navy-900); }
.topbar-right { display: flex; align-items: center; gap: .65rem; }
.topbar-user { font-size: .84rem; font-weight: 600; color: var(--navy-800); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-btn { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; color: var(--navy-800); cursor: pointer; transition: all .15s; }
.topbar-btn:hover { border-color: var(--blue-400); color: var(--blue-700); box-shadow: var(--ring); }
#sbMobile { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--grad-brand); box-shadow: var(--glow); }
.sb-backdrop { display: none; }
@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); width: var(--sb-w) !important; }
    body.sb-open .sidebar { transform: none; }
    body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(5,13,36,.45); z-index: 55; }
    .app-main, body.sb-min .app-main { margin-left: 0; }
    body.sb-min .sb-label { display: initial; }
    #sbMobile { display: grid; }
    .topbar-user, .topbar-right .role-tag { display: none; }
}

/* ---------- Componentes renovados ---------- */
.main-container { max-width: 1440px; padding: 1.7rem 1.8rem 3rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: var(--shadow-2); }
.page-title { font-size: 1.75rem; }
.eyebrow { color: var(--blue-600); }
.btn { border-radius: 11px; transition: transform .12s, box-shadow .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad-brand); border: 0; box-shadow: 0 6px 18px -8px rgba(37,99,235,.7); }
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 24px -10px rgba(37,99,235,.85); }
.form-control { border-radius: 11px; transition: border-color .15s, box-shadow .15s; }
.form-control:focus { border-color: var(--blue-500); box-shadow: var(--ring); outline: none; }
.data-table thead th { background: var(--surface-2); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: #f4f8ff; }
.kpi-card { border-radius: 16px; background: linear-gradient(180deg, #fff, var(--surface-2)); }
.kpi-card .kpi-icon { background: var(--blue-50); border-radius: 12px; }

/* Interruptores (configuración de curso) */
.switch { display: flex; align-items: center; gap: .65rem; font-size: .86rem; padding: .32rem 0; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch span { position: relative; flex: 0 0 38px; height: 22px; border-radius: 999px; background: #cbd5e1; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--blue-600); }
.switch input:checked + span::after { transform: translateX(16px); }
.cfg-block { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1rem; margin-top: .7rem; }
.cfg-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: .8rem 1rem; }
.cfg-head { font-weight: 700; font-size: .82rem; color: var(--navy-900); margin-bottom: .35rem; }
.cfg-head i { color: var(--blue-600); margin-right: .3rem; }

/* Tipos de coincidencia */
.kind-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin: .2rem 0 1rem; }
.kind-cell { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: .45rem; align-items: center;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .7rem; }
.kind-cell i { grid-row: span 2; font-size: 1.05rem; }
.kind-cell b { font-family: var(--font-display); font-size: 1.12rem; color: var(--navy-900); }
.kind-cell span { font-size: .72rem; color: var(--muted); }
.kind-tag { display: inline-flex; align-items: center; gap: .25rem; border-radius: 999px; padding: .05rem .5rem; font-size: .7rem; font-weight: 700; }
.kind-tag.tr { background: #cffafe; color: #0e7490; }
.kind-tag.pa { background: #ede9fe; color: #6d28d9; }
.kind-tag.rf { background: #ccfbf1; color: #0f766e; }
.hl.hl-para { border-bottom: 2px dashed; border-radius: 2px 2px 0 0; }
.hl-para { border-bottom: 2px dashed transparent; }

/* Estado vacío y entradas animadas */
.empty-state i { background: var(--blue-50); width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto .7rem; }
@media (prefers-reduced-motion: no-preference) {
    .main-container:not(.wide) > * { animation: rise .35s ease both; }
    .main-container:not(.wide) > *:nth-child(2) { animation-delay: .04s; }
    .main-container:not(.wide) > *:nth-child(3) { animation-delay: .08s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media print { .sidebar, .topbar { display: none !important; } .app-main { margin-left: 0 !important; } }
