:root {
    --azul: #0a2f57;
    --azul2: #135ea8;
    --azul3: #1f78d1;
    --rojo: #d64545;
    --naranja: #f57c00;
    --amarillo: #f4b400;
    --verde: #1f9d55;
    --morado: #7c4dff;
    --borde: #dbe4ef;
    --texto: #1f2937;
    --shadow: 0 12px 30px rgba(10,47,87,.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(180deg, #f7fafe 0%, #eef3f8 100%);
    color: var(--texto);
}

.container {
    width: min(1500px, 96%);
    margin: 22px auto 40px;
}

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, var(--azul), var(--azul2));
    color: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    padding: 22px 28px;
    margin-bottom: 16px;
}

.hero::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
    right: -60px;
    top: -60px;
}

.hero-content {
    display: flex;
    gap: 24px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.hero-left {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.logo-box {
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    padding: 10px 14px;
    min-width: 240px;
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-box img {
    max-height: 72px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.logo-fallback {
    color: white;
    font-weight: 700;
    font-size: 16px;
    text-align: center;
    opacity: .95;
}

.hero-text h1 {
    margin: 0 0 7px;
    font-size: 34px;
    line-height: 1.05;
}

.hero-text p {
    margin: 0;
    opacity: .95;
    font-size: 15px;
}

.hero-right {
    text-align: right;
    min-width: 240px;
}

.hero-right .mini {
    font-size: 13px;
    opacity: .9;
    margin-bottom: 5px;
}

.hero-right .big {
    font-size: 24px;
    font-weight: 800;
}

/* ── Toolbar ── */
.toolbar {
    margin: 18px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 800;
    transition: .25s ease;
    color: white;
}

.btn:hover { transform: translateY(-1px); }

.btn-nav { background: #334155; }
.btn-nav.active { background: #0a2f57; }
.btn-express { background: var(--azul3); }
.btn-premium { background: var(--naranja); }
.btn-save { background: var(--verde); }
.btn-pdf { background: #c62828; }
.btn-gray { background: #64748b; }
.btn-dark { background: #111827; }
.btn-excel { background: #0f9d58; }

/* ── Top Form ── */
.top-form {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    background: white;
    border: 1px solid #e6edf5;
    border-radius: 20px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    color: #516070;
    font-weight: 700;
}

.field input {
    height: 42px;
    border: 1px solid #d7e2ee;
    border-radius: 12px;
    padding: 0 12px;
    background: #fbfdff;
    font-size: 14px;
}

/* ── Main Grid ── */
.main-grid {
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 18px;
}

.card {
    background: white;
    border: 1px solid #ebf1f7;
    border-radius: 20px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.section-title {
    margin: 0 0 14px;
    color: var(--azul);
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Question Blocks ── */
.question-block {
    border: 1px solid var(--borde);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 16px;
    background: #fff;
}

.question-block h3 {
    margin: 0;
    padding: 14px 18px;
    font-size: 18px;
    color: white;
}

.estrategia h3 { background: linear-gradient(90deg, #0d63c7, #3f90f5); }
.procesos h3 { background: linear-gradient(90deg, #ef7d00, #ff9d35); }
.tecnologia h3 { background: linear-gradient(90deg, #cf3d4a, #ea6672); }
.datos h3 { background: linear-gradient(90deg, #d6a100, #f7c94d); color: #243041; }
.cultura h3 { background: linear-gradient(90deg, #19864a, #35b66d); }
.abiertas h3 { background: linear-gradient(90deg, #6f42c1, #8b5cf6); }

.question-list { padding: 16px 18px; }

.question {
    border-bottom: 1px solid #eef3f8;
    margin-bottom: 14px;
    padding-bottom: 14px;
}

.question:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.question label.title {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.45;
}

.options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.option-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid #d9e4ef;
    border-radius: 999px;
    background: #f9fbfe;
    cursor: pointer;
    transition: .2s ease;
    font-size: 14px;
    user-select: none;
}

.option-pill:hover {
    border-color: #a9c9eb;
    background: #f1f7ff;
}

textarea {
    width: 100%;
    min-height: 86px;
    border: 1px solid #d8e2ec;
    border-radius: 12px;
    padding: 12px;
    resize: vertical;
    background: #fbfdff;
    font-size: 14px;
    line-height: 1.45;
}

/* ── Summary / Metrics ── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.metric-card {
    border: 1px solid #e4edf6;
    border-radius: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #f9fbff, #eef5fc);
}

.metric-card h4 {
    margin: 0 0 8px;
    color: #526173;
    font-size: 14px;
}

.metric-card .value {
    font-size: 24px;
    font-weight: 800;
    color: var(--azul);
}

/* ── Madurez ── */
.madurez-box {
    border: 1px solid #e3ecf5;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 14px;
}

.madurez-box h3 {
    margin: 0 0 10px;
    color: var(--azul);
    font-size: 19px;
}

.progress-wrap {
    width: 100%;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--rojo) 0%, var(--rojo) 40%, var(--amarillo) 40%, var(--amarillo) 70%, var(--verde) 70%, var(--verde) 100%);
    position: relative;
    overflow: hidden;
    margin: 10px 0 12px;
}

.progress-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 5px;
    background: #111827;
    left: 0%;
    transition: left .3s ease;
    box-shadow: 0 0 0 3px rgba(255,255,255,.35);
}

.madurez-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tag {
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 800;
    display: inline-block;
}

.tag.bajo { background: #fee2e2; color: #b91c1c; }
.tag.medio { background: #fef3c7; color: #92400e; }
.tag.alto { background: #dcfce7; color: #166534; }

/* ── Semaforos ── */
.semaforos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.semaforo {
    border: 1px solid #e8eef5;
    border-radius: 14px;
    padding: 14px;
    background: #fbfdff;
}

.semaforo h5 {
    margin: 0 0 8px;
    font-size: 13px;
    color: #526173;
    text-transform: uppercase;
}

.semaforo .score {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
}

.score-status {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
}

.status-rojo { background: #fee2e2; color: #b91c1c; }
.status-amarillo { background: #fef3c7; color: #92400e; }
.status-verde { background: #dcfce7; color: #166534; }

/* ── Charts ── */
.chart-card {
    border: 1px solid #e7eef6;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 14px;
    background: #fff;
}

.chart-card h3 {
    margin: 0 0 10px;
    color: var(--azul);
    font-size: 18px;
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 320px;
}

.chart-wrap.small {
    height: 280px;
}

/* ── Hallazgos ── */
.hallazgos {
    background: #f3ecd8;
    border: 1px solid #e4c56d;
    border-radius: 24px;
    padding: 18px 22px;
}

.hallazgos h3 {
    margin: 0 0 10px;
    color: #8a5a00;
    font-size: 18px;
}

.hallazgos ul {
    margin: 0;
    padding-left: 24px;
    line-height: 1.6;
}

.legend {
    margin-top: 8px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #526173;
}

.hidden { display: none !important; }

/* ── Bitacora ── */
.bitacora-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.bitacora-table th,
.bitacora-table td {
    border-bottom: 1px solid #e6edf5;
    padding: 12px 10px;
    font-size: 14px;
    text-align: left;
    vertical-align: top;
}

.bitacora-table th {
    background: #0a2f57;
    color: white;
}

.acciones {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mini-btn {
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    color: white;
}

.mini-view { background: #1f78d1; }
.mini-pdf { background: #c62828; }
.mini-del { background: #64748b; }

/* ── Responsive ── */
@media (max-width: 1200px) {
    .top-form { grid-template-columns: repeat(3, 1fr); }
    .main-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .top-form { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: 1fr; }
    .semaforos { grid-template-columns: 1fr; }
    .hero-text h1 { font-size: 28px; }
    .hero-right { text-align: left; }
    .chart-wrap, .chart-wrap.small { height: 260px; }
}
