/**
 * CIVI — Suite de herramientas (laboratorio / bento / workbench)
 * Carga después de landing-extras.css
 */

:root {
    --ts-surface: rgba(255, 255, 255, 0.72);
    --ts-surface-strong: rgba(255, 255, 255, 0.92);
    --ts-border: rgba(255, 255, 255, 0.55);
    --ts-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
    --ts-glow-violet: rgba(139, 92, 246, 0.45);
    --ts-glow-emerald: rgba(16, 185, 129, 0.4);
    --ts-glow-blue: rgba(59, 130, 246, 0.4);
    --ts-glow-teal: rgba(20, 184, 166, 0.4);
    --ts-radius: 1.35rem;
    --ts-font: 'Outfit', system-ui, sans-serif;
}

/* ========== Página índice herramientas ========== */
body.tools-lab-page .tools-lab-shell,
body.tools-lab-page .hero.hero--tools-lab .hero-content,
body.tools-lab-page .landing-links-section {
    font-family: var(--ts-font);
}

body.tools-lab-page .nav,
body.tools-tool-page .nav {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.hero.hero--tools-lab {
    position: relative;
    overflow: hidden;
    /* Refuerzo: nunca altura mínima de pantalla completa en herramientas */
    min-height: auto !important;
}

.hero.hero--tools-lab::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 60% at 50% -20%, rgba(255, 255, 255, 0.35) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 50%, rgba(167, 139, 250, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse 60% 45% at 0% 80%, rgba(52, 211, 153, 0.14) 0%, transparent 45%);
    pointer-events: none;
    z-index: 0;
}

.hero.hero--tools-lab .hero-content,
.hero.hero--tools-lab .floating-element,
.hero.hero--tools-lab .nav {
    position: relative;
    z-index: 1;
}

.tools-lab-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    margin-bottom: 1rem;
    backdrop-filter: blur(8px);
}

.tools-lab-hero-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 12px #34d399;
    animation: ts-pulse 2.2s ease-in-out infinite;
}

@keyframes ts-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.65;
        transform: scale(0.85);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tools-lab-hero-badge-dot {
        animation: none;
    }
}

/* Shell principal (reemplaza fondo plano) */
.tools-lab-shell {
    position: relative;
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 5rem;
    overflow: hidden;
    background:
        linear-gradient(180deg, #f8fafc 0%, #eef2ff 35%, #f0fdf4 70%, #fafafa 100%);
}

.tools-lab-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.09) 0%, transparent 42%),
        radial-gradient(circle at 92% 15%, rgba(16, 185, 129, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 95%, rgba(59, 130, 246, 0.07) 0%, transparent 45%);
    pointer-events: none;
}

.tools-lab-shell::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
}

.tools-lab-shell .container {
    position: relative;
    z-index: 1;
}

.tools-lab-head {
    text-align: center;
    max-width: 40rem;
    margin: 0 auto 2.5rem;
}

.tools-lab-eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6366f1;
    margin: 0 0 0.5rem;
}

.tools-lab-intro {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.65;
    color: #475569;
}

/* ========== Bento grid ========== */
.tools-bento {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1.15rem;
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .tools-bento--index {
        grid-template-columns: repeat(12, 1fr);
        grid-auto-rows: minmax(140px, auto);
        gap: 1.25rem;
    }

    .tools-bento--index .tools-bento__cell--rtm {
        grid-column: 1 / span 8;
        grid-row: 1 / span 2;
    }

    .tools-bento--index .tools-bento__cell--multa {
        grid-column: 9 / span 4;
        grid-row: 1 / span 1;
    }

    .tools-bento--index .tools-bento__cell--crc {
        grid-column: 9 / span 4;
        grid-row: 2 / span 1;
    }

    .tools-bento--index .tools-bento__cell--cuotas {
        grid-column: 1 / span 12;
        grid-row: 3 / span 1;
    }
}

.tools-bento--home {
    gap: 1rem;
}

@media (min-width: 960px) {
    .tools-bento--home.tools-bento--index .tools-bento__cell--rtm .tools-bento__card {
        min-height: 240px;
    }
}

.tools-bento__cell {
    opacity: 0;
    animation: ts-bento-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tools-bento__cell:nth-child(1) {
    animation-delay: 0.05s;
}
.tools-bento__cell:nth-child(2) {
    animation-delay: 0.12s;
}
.tools-bento__cell:nth-child(3) {
    animation-delay: 0.19s;
}
.tools-bento__cell:nth-child(4) {
    animation-delay: 0.26s;
}

@keyframes ts-bento-in {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tools-bento__cell {
        animation: none;
        opacity: 1;
    }
}

.tools-bento__card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 148px;
    padding: 1.35rem 1.35rem 1.15rem;
    border-radius: var(--ts-radius);
    text-decoration: none;
    color: #fff;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s ease,
        border-color 0.25s ease;
}

.tools-bento__card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.tools-bento__card:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.tools-bento__glint {
    position: absolute;
    inset: -40% -20% auto 40%;
    height: 80%;
    background: linear-gradient(125deg, rgba(255, 255, 255, 0.35) 0%, transparent 55%);
    opacity: 0.5;
    transform: rotate(-12deg);
    pointer-events: none;
    z-index: 0;
}

.tools-bento__noise {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23a)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.tools-bento__top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.tools-bento__icon-wrap {
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.tools-bento__icon-wrap svg {
    width: 1.35rem;
    height: 1.35rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tools-bento__arrow {
    font-size: 1.35rem;
    font-weight: 300;
    opacity: 0.85;
    transition: transform 0.3s ease;
}

.tools-bento__card:hover .tools-bento__arrow {
    transform: translate(3px, -3px);
}

.tools-bento__meta {
    position: relative;
    z-index: 1;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    opacity: 0.92;
    margin-bottom: 0.35rem;
}

.tools-bento__title {
    position: relative;
    z-index: 1;
    font-size: clamp(1.05rem, 2.2vw, 1.35rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 0.45rem;
    letter-spacing: -0.02em;
}

.tools-bento__desc {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    opacity: 0.92;
    font-weight: 500;
}

.tools-bento__foot {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.88;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tools-bento__cell--rtm .tools-bento__card {
    background: linear-gradient(145deg, #6d28d9 0%, #4c1d95 48%, #5b21b6 100%);
}

.tools-bento__cell--multa .tools-bento__card {
    background: linear-gradient(145deg, #059669 0%, #047857 50%, #065f46 100%);
}

.tools-bento__cell--crc .tools-bento__card {
    background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 48%, #1e40af 100%);
}

.tools-bento__cell--cuotas .tools-bento__card {
    background: linear-gradient(100deg, #0f766e 0%, #0d9488 40%, #115e59 100%);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    min-height: auto;
    padding: 1.25rem 1.5rem;
}

@media (min-width: 640px) {
    .tools-bento__cell--cuotas .tools-bento__card {
        flex-wrap: nowrap;
        gap: 1.5rem;
    }

    .tools-bento__cell--cuotas .tools-bento__body {
        flex: 1;
    }
}

.tools-bento__cell--cuotas .tools-bento__top {
    margin-bottom: 0.5rem;
}

.tools-bento__cell--cuotas .tools-bento__foot {
    padding-top: 0;
    margin-left: auto;
    white-space: nowrap;
}

@media (max-width: 639px) {
    .tools-bento__cell--cuotas .tools-bento__card {
        flex-direction: column;
        align-items: stretch;
    }

    .tools-bento__cell--cuotas .tools-bento__foot {
        margin-left: 0;
        padding-top: 0.75rem;
        white-space: normal;
    }
}

.tools-bento__cell--rtm .tools-bento__card {
    min-height: 280px;
}

@media (min-width: 960px) {
    .tools-bento__cell--rtm .tools-bento__card {
        padding: 1.65rem 1.65rem 1.35rem;
    }

    .tools-bento__cell--rtm .tools-bento__title {
        font-size: 1.5rem;
    }
}

/* Barra de métricas */
.tools-lab-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1.5rem;
    margin: 2.25rem 0 0;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
}

.tools-lab-strip-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}

.tools-lab-strip-item strong {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.tools-lab-strip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

/* CTA final */
.tools-lab-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.75rem;
}

.btn-tools-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border: none;
    box-shadow:
        0 8px 28px rgba(5, 150, 105, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-tools-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(5, 150, 105, 0.45);
}

.btn-tools-ghost {
    display: inline-flex;
    align-items: center;
    padding: 0.9rem 1.35rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    color: #334155;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.5);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-tools-ghost:hover {
    background: #fff;
    border-color: #94a3b8;
}

/* ========== Home: sección herramientas con mismo lenguaje ========== */
.civi-home-tools.tools-lab-home {
    padding: clamp(3.5rem, 8vw, 5rem) 0;
    background:
        linear-gradient(180deg, #f8fafc 0%, #eef2ff 45%, #f0fdf4 100%);
    position: relative;
    overflow: hidden;
}

.civi-home-tools.tools-lab-home::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.09) 0%, transparent 42%);
    pointer-events: none;
}

.civi-home-tools.tools-lab-home .container {
    position: relative;
    z-index: 1;
}

.civi-home-tools.tools-lab-home {
    font-family: var(--ts-font);
}

.civi-home-tools-title.tools-lab-home-title {
    font-family: var(--ts-font);
    font-size: clamp(1.65rem, 3.5vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, #1e1b4b 0%, #4c1d95 40%, #047857 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.35rem;
}

.civi-home-tools-sub.tools-lab-home-sub {
    font-family: var(--ts-font);
    max-width: 36rem;
}

.civi-home-tools-cta {
    margin-top: 2.25rem;
}

/* ========== Páginas de herramienta individual (workbench) ========== */
body.tools-tool-page .hero.hero--tools-lab .hero-content,
body.tools-tool-page .civi-tool-section,
body.tools-tool-page .calc-section,
body.tools-tool-page .landing-links-section {
    font-family: var(--ts-font);
}

body.tools-tool-page .civi-tool-section,
body.tools-tool-page .calc-section {
    padding: clamp(2.5rem, 5vw, 4rem) 0 5rem;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 40%, #0f172a 100%);
    box-shadow: none;
}

body.tools-tool-page .civi-tool-section::before,
body.tools-tool-page .calc-section::before {
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99, 102, 241, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 100% 60%, rgba(16, 185, 129, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 0% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 40%);
}

body.tools-tool-page .civi-tool-card,
body.tools-tool-page .calc-card {
    max-width: 560px;
    background: var(--ts-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 1.5rem;
    box-shadow:
        var(--ts-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    position: relative;
    overflow: hidden;
}

body.tools-tool-page .civi-tool-card::before,
body.tools-tool-page .calc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #10b981, #06b6d4);
    opacity: 0.95;
}

body.tools-tool-page .civi-tool-card--wide {
    max-width: 680px;
}

body.tools-tool-page .civi-tool-card h2,
body.tools-tool-page .calc-card h2,
body.tools-tool-page .crc-checklist-heading {
    font-family: var(--ts-font);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
}

body.tools-tool-page .civi-tool-card label,
body.tools-tool-page .calc-card label {
    font-size: 0.88rem;
    color: #334155;
}

body.tools-tool-page .civi-tool-card select,
body.tools-tool-page .civi-tool-card input,
body.tools-tool-page .calc-card select,
body.tools-tool-page .calc-card input {
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.tools-tool-page .civi-tool-card select:focus,
body.tools-tool-page .civi-tool-card input:focus,
body.tools-tool-page .calc-card select:focus,
body.tools-tool-page .calc-card input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

body.tools-tool-page .civi-tool-card .btn-primary,
body.tools-tool-page .calc-card .btn-primary {
    border-radius: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #059669 100%);
    border: none;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.35);
}

body.tools-tool-page .civi-tool-card .btn-primary:hover,
body.tools-tool-page .calc-card .btn-primary:hover {
    filter: brightness(1.05);
}

body.tools-tool-page .calc-result {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.95rem;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.98) 100%);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.85rem;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        0 12px 40px rgba(0, 0, 0, 0.25);
    min-height: 3.5rem;
}

body.tools-tool-page .crc-checklist-items li {
    border-bottom-color: rgba(148, 163, 184, 0.25);
    border-radius: 0.5rem;
    padding: 0.65rem 0.5rem;
    margin-bottom: 0.25rem;
    transition: background 0.2s ease;
}

body.tools-tool-page .crc-checklist-items li:hover {
    background: rgba(99, 102, 241, 0.06);
}

body.tools-tool-page .calc-disclaimer,
body.tools-tool-page .civi-tool-hint {
    color: #64748b;
}

body.tools-tool-page .calc-disclaimer a {
    color: #4f46e5;
}

/* Internal links section after tool - keep readable */
body.tools-tool-page .landing-links-section {
    background: #f1f5f9;
}
