:root {
    /* --- PALETA PREMIUM: SALUD, ENERGÍA Y VIDA (10/10) --- */
    --color-bg-base: #f8fafc;
    /* Gris plata ultra claro y limpio */
    --color-bg-canvas: #ffffff;
    /* Blanco puro para tarjetas */
    --color-bg-subtle: #f1f5f9;
    /* Gris plata para fondos secundarios */

    /* Verde Salud (Menta/Esmeralda Profundo y Elegante, no chillón) */
    --brand: #059669;
    --brand-dark: #064e3b;
    --brand-light: #ecfdf5;

    /* Naranja Coral Energía (Vibrante y Premium) */
    --accent: #f97316;
    --accent-dark: #ea580c;
    --accent-light: #fff7ed;

    /* Neutros Premium */
    --ink: #0f172a;
    /* Azul pizarra casi negro */
    --muted: #475569;
    /* Gris pizarra elegante */
    --light-muted: #94a3b8;
    /* Gris plata para deshabilitados */
    --line: #e2e8f0;
    /* Bordes limpios y discretos */
    --line-hover: #cbd5e1;

    /* Sombras de Alta Calidad (Estilo Tailwind/Stripe) */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.02), 0 0 0 1px rgba(0, 0, 0, 0.02);
    --shadow-premium: 0 10px 15px -3px rgba(15, 23, 42, 0.04), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

    --radius: 12px;
    --bg-soft: var(--color-bg-canvas);
}

* {
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--ink);
    background-color: var(--color-bg-base);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

main {
    width: 100%;
}

h1,
h2,
h3 {
    font-family: "Outfit", sans-serif;
    margin: 0;
    color: var(--ink);
    letter-spacing: -0.03em;
    font-weight: 700;
}

p {
    line-height: 1.6;
    color: var(--muted);
}

/* --- TABLAS MODERNAS --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    text-align: left;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 700;
    background: var(--color-bg-subtle);
    border-bottom: 2px solid var(--line);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(248, 250, 252, 0.8);
}

/* --- FORMULARIOS E INPUTS --- */
input,
select,
textarea,
button {
    font: inherit;
    outline: none;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.8rem 1.1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.08);
}

textarea {
    resize: vertical;
    min-height: 7rem;
}

label span {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ink);
}

/* --- BOTONES PREMIUM (SOLID COLOR) --- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), #047857);
    color: white;
    padding: 0.8rem 1.75rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.2);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.3);
    background: linear-gradient(135deg, #047857, var(--brand-dark));
}

.button:active {
    transform: translateY(0);
}

.button-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
    background: none;
}

.button-secondary:hover {
    background: var(--color-bg-subtle);
    border-color: var(--line-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    background: var(--color-bg-subtle);
}

.button-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    box-shadow: none;
}

.button-ghost:hover {
    background: var(--color-bg-subtle);
    color: var(--ink);
}

.button-full {
    width: 100%;
}

/* --- BADGES Y ELEMENTOS ESTILO --- */
.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--brand);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.875rem;
}

.pill,
.user-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.75rem;
    border: 1px solid rgba(5, 150, 105, 0.12);
}

.user-badge {
    background: var(--color-bg-canvas);
    color: var(--ink);
    border-color: var(--line);
    box-shadow: var(--shadow);
}

.flash {
    margin-bottom: 2rem;
    padding: 1.1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.925rem;
    animation: flashIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-success {
    background: var(--brand-light);
    color: var(--brand-dark);
    border: 1px solid rgba(5, 150, 105, 0.15);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.08);
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.15);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.08);
}

.hero-shell,
.admin-shell,
.auth-shell {
    min-height: 100vh;
}

.topbar,
.hero,
.section,
.auth-card {
    width: min(1200px, calc(100% - 3rem));
    margin: 0 auto;
}

/* --- CABECERA --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2.5rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-family: "Outfit", sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--ink);
    margin-top: 2rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-version {
    font-size: 12pt;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.3px;
    margin-top: 1px;
}

.brand-business {
    font-size: 10pt;
    font-weight: 400;
    color: var(--light-muted);
    letter-spacing: 0.2px;
    margin-top: 1px;
}

.brand:hover .brand-mark {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.3);
}

.brand-logo {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 5.95rem;
    object-fit: contain;
}

.brand-logo-public {
    max-height: 10.56rem;
}

.topbar .brand {
    flex: 0 0 clamp(17.5rem, 28.5vw, 26.5rem);
    justify-content: flex-start;
}

.topbar .brand.brand-has-logo {
    align-items: center;
}

.topbar .brand .brand-logo-public {
    width: 100%;
    max-width: 23.75rem;
    max-height: 10.56rem;
    object-position: left center;
}

.brand-version-logo {
    display: none;
}

.brand-mark {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #047857);
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.2);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-nav,
.hero-actions,
.sidebar-nav,
.checkbox-row {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.topbar-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-nav>a,
.topbar-dropdown>a {
    padding: 0.4rem 0;
    color: var(--muted);
    font-weight: 600;
}

.topbar-nav>a:hover,
.topbar-nav>a.is-active,
.topbar-dropdown:hover>a,
.topbar-dropdown.is-active>a {
    color: var(--ink);
}

.topbar-dropdown {
    position: relative;
}

.topbar-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.8rem);
    left: 0;
    min-width: 14rem;
    display: grid;
    gap: 0.2rem;
    padding: 0.8rem;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

.topbar-dropdown:hover .topbar-dropdown-menu,
.topbar-dropdown:focus-within .topbar-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.topbar-dropdown-menu a {
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
}

.topbar-dropdown-menu a:hover,
.topbar-dropdown-menu a:focus-visible {
    background: var(--color-bg-subtle);
    color: var(--ink);
}

.topbar-dropdown-parent {
    color: var(--ink) !important;
    background: rgba(5, 150, 105, 0.08);
}

.topbar-cta {
    margin-left: 0.25rem;
}

/* --- HERO --- */
.hero {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 5rem;
    padding: 5rem 0 7rem;
    align-items: center;
}

.hero-copy h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.05;
    margin-bottom: 1.5rem;
}

.hero-text {
    max-width: 56ch;
    font-size: 1.15rem;
    color: var(--muted);
    line-height: 1.6;
}

/* --- GRIDS --- */
.metrics-grid,
.feature-grid,
.roles-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
}

/* --- TARJETAS PREMIUM --- */
.metric-card,
.feature-card,
.role-card,
.stat-card,
.glass-card,
.hero-note,
.panel-card,
.auth-card {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.75rem;
    position: relative;
}

.panel-card:hover {
    box-shadow: var(--shadow-premium);
    border-color: var(--line-hover);
}

.metric-card,
.stat-card {
    padding: 1.5rem 1.75rem;
    animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stat-card:nth-child(1) {
    animation-delay: 0.05s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card strong,
.stat-card strong {
    display: block;
    font-size: 2.5rem;
    font-family: "Outfit", sans-serif;
    color: var(--brand);
    margin-top: 0.25rem;
    font-weight: 700;
}

.metric-card span,
.stat-card span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
}

.stat-icon-wrapper {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: var(--brand-light);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
}


.hero-panel {
    display: grid;
    gap: 1.5rem;
}

.glass-card {
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.8);
}

.glass-header,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.panel-head h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.glass-header h2,
.panel-head h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.bar-group {
    margin-bottom: 1.25rem;
}

.bar {
    height: 0.5rem;
    border-radius: 999px;
    background: var(--color-bg-subtle);
    overflow: hidden;
}

.bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.macro-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.macro-grid div {
    padding: 0.95rem;
    border-radius: 10px;
    background: var(--color-bg-subtle);
    text-align: center;
    border: 1px solid var(--line);
}

.macro-grid div span {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 700;
}

.macro-grid div strong {
    display: block;
    font-size: 1.2rem;
    font-family: "Outfit", sans-serif;
    color: var(--ink);
    margin-top: 0.25rem;
}

.section {
    padding: 6rem 0;
}

.section-heading {
    margin-bottom: 3.5rem;
    max-width: 48rem;
}

.section-heading h2 {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    line-height: 1.15;
}

.feature-card,
.role-card {
    padding: 2.25rem;
}

.section-contrast {
    background: var(--brand-dark);
    color: white;
}

.section-contrast h1,
.section-contrast h2,
.section-contrast h3,
.section-contrast .eyebrow {
    color: white;
}

.timeline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.timeline article {
    padding: 2.25rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.timeline span {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 1.25rem;
    font-weight: 700;
}

.role-card-active {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

/* --- AUTENTICACIÓN PREMIUM (10/10) --- */
.auth-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #022c22 0%, #064e3b 35%, #047857 65%, #059669 100%);
    position: relative;
    overflow: hidden;
}

.auth-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255, 255, 255, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(5, 150, 105, 0.4) 0%, transparent 50%);
    pointer-events: none;
}

.auth-shell::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='48' height='48' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M24 20v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-24V0h-2v4h-4v2h4v4h2V6h4V4h-4zM4 20v-4H2v4H-2v2h4v4h2v-4h4v-2H4zM4 0V-4H2v4H-2v2h4v4h2V2h4V0H4z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.6;
    pointer-events: none;
}

.auth-card {
    width: min(26rem, calc(100% - 2rem));
    padding: 3rem;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 24px 80px rgba(0, 0, 0, 0.2),
        0 10px 24px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: authFadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card>div:first-child {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-card .eyebrow {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--brand);
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.auth-card h1 {
    font-size: 1.65rem;
    margin-bottom: 0.5rem;
}

.auth-card .muted {
    font-size: 0.925rem;
    color: var(--light-muted);
    line-height: 1.5;
    max-width: 32ch;
    margin: 0 auto;
}

.stack-form {
    display: grid;
    gap: 1.25rem;
}

.stack-form label {
    display: grid;
    gap: 0.4rem;
}

.stack-form label span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0;
}

.stack-form input {
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    border: 1.5px solid var(--line);
    background: var(--color-bg-base);
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.stack-form input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
    background: white;
}

.stack-form .button {
    margin-top: 0.5rem;
    padding: 0.9rem 1.75rem;
    font-size: 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand) 0%, #047857 100%);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
    transition: all 0.3s ease;
}

.stack-form .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.35);
    background: linear-gradient(135deg, #047857 0%, var(--brand-dark) 100%);
}

.text-link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    color: var(--light-muted);
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.text-link:hover {
    color: var(--brand);
    text-decoration: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

/* --- SECCIÓN ADMINISTRATIVA (SHELL) --- */
.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    background-color: var(--color-bg-base);
    transition: grid-template-columns 0.3s ease;
}

.admin-shell.sidebar-collapsed {
    grid-template-columns: 0 1fr;
}

.admin-shell.sidebar-collapsed .sidebar {
    overflow: hidden;
    padding: 2rem 0;
    border-right-color: transparent;
    opacity: 0;
    pointer-events: none;
}

.admin-shell.sidebar-collapsed .sidebar>.brand,
.admin-shell.sidebar-collapsed .sidebar-nav,
.admin-shell.sidebar-collapsed .sidebar form {
    opacity: 0;
    transition: opacity 0.15s;
}

.sidebar {
    transition: padding 0.3s ease, opacity 0.3s ease, border-color 0.3s ease;
}

.sidebar>.brand,
.sidebar-nav,
.sidebar form {
    transition: opacity 0.3s ease;
}

.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--color-bg-canvas);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--color-bg-subtle);
    color: var(--ink);
    border-color: var(--brand);
}

.sidebar-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
}

.admin-shell.sidebar-collapsed .sidebar-toggle {
    left: 1rem;
}

.sidebar {
    min-height: 100vh;
    padding: 2rem 1.75rem;
    border-right: 1px solid var(--line);
    background: var(--bg-soft);
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.sidebar>div:first-child {
    min-height: 0;
}

.sidebar>.nav-group {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--line);
}

.sidebar>.brand {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0 0 2.5rem;
}

.sidebar .brand {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.sidebar .brand.brand-has-logo {
    padding: 0.5rem 0 0;
    margin-bottom: 1rem;
}

.sidebar .brand.brand-has-logo .brand-logo {
    max-height: 7.6rem;
    margin: 0 auto;
}

.sidebar-nav {
    flex-direction: column;
    align-items: stretch;
    margin: 1.5rem 0;
    flex: 1;
}

.sidebar-nav a {
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.15rem;
    font-size: 0.875rem;
    position: relative;
    transition: all 0.2s ease;
}

.sidebar-nav a.is-active {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 700;
}

.sidebar-nav a.is-active::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 1.5rem;
    border-radius: 0 3px 3px 0;
    background: var(--brand);
}

.sidebar-nav a:hover:not(.is-active) {
    background: var(--color-bg-subtle);
    color: var(--ink);
}

.nav-icon {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    flex-shrink: 0;
    transition: stroke 0.2s ease;
}

.sidebar-nav a.is-active .nav-icon {
    stroke-width: 2.5;
}

.user-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), #047857);
    color: white;
    display: inline-grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem 0.35rem 0.35rem;
    border-radius: 999px;
    background: var(--color-bg-canvas);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ink);
}


.admin-main {
    padding: 2.5rem 3rem;
    width: 100%;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    position: relative;
}

.admin-topbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, var(--line), transparent);
}

.admin-topbar h1 {
    font-size: 1.75rem;
}

.admin-topbar .eyebrow {
    margin-bottom: 0.25rem;
}

.content-grid,
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 2rem;
}

.panel-card {
    padding: 2.25rem;
    background: var(--bg-soft);
}

.panel-card-wide {
    grid-column: 1 / -1;
}

.table-list {
    display: grid;
    gap: 0.75rem;
}

.table-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.5rem;
    border-radius: 10px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    align-items: center;
}

.table-row:hover {
    border-color: var(--line-hover);
    box-shadow: var(--shadow);
}

.table-wrap {
    overflow: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    margin-bottom: 1.5rem;
}

.inline-user-form {
    display: grid;
    grid-template-columns: 1.2fr 1.3fr 1fr 1fr auto;
    gap: 0.5rem;
    min-width: 820px;
    align-items: center;
}

.inline-user-form input,
.inline-user-form select {
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
}

.detail-list {
    display: grid;
    gap: 1rem;
}

.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.detail-list dt {
    color: var(--muted);
    font-weight: 500;
}

.detail-list dd {
    margin: 0;
    font-weight: 600;
    color: var(--ink);
}

.detail-block {
    margin-top: 1.5rem;
    padding: 1.1rem 1.5rem;
    border-radius: 10px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--line);
    font-size: 0.95rem;
}

.macro-total {
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid rgba(5, 150, 105, 0.12);
}

.text-link {
    color: var(--brand);
    font-weight: 700;
}

.text-link:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

.pagination {
    margin-top: 2rem;
    display: flex;
    gap: 0.35rem;
    justify-content: center;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--color-bg-canvas);
    border: 1px solid var(--line);
    transition: all 0.2s ease;
}

.pagination a:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-light);
}

.pagination span[aria-current="page"] {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.15);
}

.pagination .disabled span {
    opacity: 0.4;
    cursor: default;
}

/* --- DISEÑO COMERCIAL Y LANDING --- */
.hero-commercial {
    grid-template-columns: 1.15fr 0.85fr;
    padding-top: 2rem;
}

.promise-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.promise-strip span {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--line);
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.metrics-grid-commercial {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hero-note-commercial {
    padding: 1.5rem;
}

.section-split,
.section-benefits,
.section-faq,
.section-contact {
    position: relative;
}

.section-proof {
    width: min(1200px, calc(100% - 3rem));
    margin: 0 auto;
    padding: 6rem 0;
}

.proof-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.proof-grid article {
    padding: 1.75rem;
    border-radius: var(--radius);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
}

.proof-grid article h3 {
    margin-top: 1rem;
    font-size: 1.15rem;
}

.feature-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.roles-grid-commercial {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.faq-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.contact-card {
    width: min(1200px, calc(100% - 3rem));
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 3rem;
    align-items: center;
    padding: 4rem 5rem;
    border-radius: 20px;
    color: white;
    background: var(--brand);
    box-shadow: 0 10px 30px rgba(5, 150, 105, 0.15);
}

.contact-card h2 {
    color: white;
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
}

.contact-card .hero-text {
    color: rgba(255, 255, 255, 0.9);
}

.contact-card .eyebrow {
    color: rgba(255, 255, 255, 0.85);
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    flex-shrink: 0;
}

.contact-card .button {
    background: white;
    color: var(--brand-dark);
    box-shadow: var(--shadow);
}

.contact-card .button:hover {
    background: var(--color-bg-subtle);
    box-shadow: var(--shadow-premium);
}

.contact-card .button-secondary {
    color: var(--brand-dark);
    border-color: rgba(255, 255, 255, 0.35);
}

.contact-card .button-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--brand-dark);
}

.public-page-shell {
    background:
        radial-gradient(circle at top left, rgba(5, 150, 105, 0.08), transparent 28%),
        linear-gradient(180deg, #f7faf8 0%, #ffffff 40%, #f8fafc 100%);
}

.public-page-main {
    width: min(1200px, calc(100% - 3rem));
    margin: 0 auto;
    padding: 0 0 5rem;
}

.public-page-hero {
    padding: 2rem 0 1.5rem;
}

.public-page-hero-copy {
    max-width: 52rem;
}

.public-page-hero-copy h1 {
    font-size: clamp(2.4rem, 4vw, 4rem);
    line-height: 1.04;
    margin-top: 0.4rem;
}

.public-page-excerpt {
    font-size: 1.08rem;
    line-height: 1.8;
    max-width: 60ch;
    margin-top: 1rem;
}

.public-page-content-card {
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.98));
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
    padding: clamp(1.4rem, 3vw, 3rem);
}

.prose-html {
    color: var(--muted);
}

.prose-html>*:first-child {
    margin-top: 0;
}

.prose-html>*:last-child {
    margin-bottom: 0;
}

.prose-html h1,
.prose-html h2,
.prose-html h3 {
    margin: 0 0 1rem;
}

.prose-html h2,
.prose-html h3,
.prose-html p,
.prose-html ul,
.prose-html ol,
.prose-html blockquote {
    margin-bottom: 1rem;
}

.prose-html ul,
.prose-html ol {
    padding-left: 1.25rem;
}

.prose-html a {
    color: var(--brand);
    text-decoration: underline;
    text-decoration-color: rgba(5, 150, 105, 0.3);
}

.prose-html img {
    float: left;
    width: min(20rem, 46%);
    max-width: 100%;
    height: auto;
    margin: 0.35rem 1.15rem 0.9rem 0;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.prose-html blockquote {
    margin-left: 0;
    padding: 1rem 1.2rem;
    border-left: 4px solid var(--brand);
    background: rgba(5, 150, 105, 0.06);
    border-radius: 0 14px 14px 0;
}

.prose-html table {
    margin: 1.5rem 0;
}

.landing-photo-frame {
    overflow: hidden;
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    background: var(--color-bg-subtle);
    border: 1px solid var(--line);
}

.landing-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.landing-photo-frame-hero {
    min-height: 31rem;
}

.landing-photo-frame-vertical {
    height: 18rem;
    margin-bottom: 1.25rem;
}

.landing-photo-frame-horizontal {
    height: 18rem;
    margin-bottom: 1.25rem;
}

.image-placeholder {
    display: grid;
    gap: 0.75rem;
    padding: 2.25rem;
    border-radius: 16px;
    border: 2px dashed var(--line);
    background: rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-card);
    align-content: center;
}

.image-placeholder-top {
    display: grid;
    gap: 0.35rem;
}

.image-placeholder-top span,
.image-placeholder-small span {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.image-placeholder strong,
.image-placeholder-small strong {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.85rem;
    word-break: break-word;
    color: var(--ink);
}

.image-placeholder-hero {
    min-height: 31rem;
    align-content: space-between;
}

.image-placeholder-small {
    min-height: 13rem;
    display: grid;
    align-content: end;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px dashed var(--line);
    background: var(--bg-soft);
}

.landing-editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.landing-editor-card {
    display: grid;
    gap: 1.25rem;
}

.landing-editor-preview {
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
}

.landing-preview-image {
    width: 100%;
    max-height: 20rem;
    object-fit: cover;
}

.cropper-meta {
    padding: 1rem;
    border-radius: 10px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
}

.cropper-stage {
    min-height: 22rem;
    overflow: hidden;
    border-radius: 12px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--line);
}

.cropper-stage img {
    display: block;
    max-width: 100%;
}

.cropper-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* --- MEDIAS --- */
@media (max-width: 980px) {

    .hero,
    .content-grid,
    .detail-grid,
    .timeline,
    .metrics-grid,
    .feature-grid,
    .roles-grid,
    .stats-grid,
    .proof-grid,
    .faq-list,
    .feature-grid-three,
    .roles-grid-commercial,
    .metrics-grid-commercial,
    .landing-editor-grid {
        grid-template-columns: 1fr;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .admin-shell.sidebar-collapsed .sidebar {
        opacity: 1;
        pointer-events: auto;
        padding: 1.25rem;
        border-bottom: 1px solid var(--line);
    }

    .admin-shell.sidebar-collapsed .sidebar>.brand,
    .admin-shell.sidebar-collapsed .sidebar-nav,
    .admin-shell.sidebar-collapsed .sidebar form {
        opacity: 1;
    }

    .sidebar {
        position: static;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 2.1rem 1.25rem 1.25rem;
    }

    .sidebar>.brand {
        margin-bottom: 0;
        padding-top: 1rem;
        padding-left: 1.9rem;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
        margin: 1rem 0 0;
        flex: none;
    }

    .sidebar-nav a {
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
        gap: 0.5rem;
    }

    .sidebar-nav a.is-active::before {
        display: none;
    }

    .sidebar-nav a.is-active {
        background: var(--brand-light);
        color: var(--brand-dark);
    }

    .topbar,
    .topbar-nav,
    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .topbar-nav {
        justify-content: flex-start;
    }

    .contact-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 2rem;
    }

    .admin-main {
        padding: 1.5rem;
    }

    .admin-topbar {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
}

@media (max-width: 720px) {
    .hero-copy h1 {
        font-size: 2.25rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .inline-user-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .hero-commercial {
        padding-top: 1rem;
    }

    .public-page-main {
        width: min(1200px, calc(100% - 2rem));
    }

    .image-placeholder-hero {
        min-height: 22rem;
    }

    .landing-photo-frame-hero,
    .cropper-stage {
        min-height: 18rem;
    }

    .topbar-dropdown-menu {
        position: static;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        margin-top: 0.5rem;
        min-width: 100%;
    }

    .prose-html img {
        float: none;
        display: block;
        width: 100%;
        margin: 0 0 1rem;
    }
}

/* --- CHATBOT FLOTANTE IA --- */
.chatbot-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    font-family: "Manrope", sans-serif;
}

.chatbot-toggle {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 999px;
    background: var(--brand);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(5, 150, 105, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-toggle:hover {
    transform: scale(1.05) translateY(-2px);
    background: var(--brand-dark);
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.4);
}

.chatbot-toggle:active {
    transform: scale(1) translateY(0);
}

.chatbot-box {
    position: absolute;
    bottom: 4.25rem;
    right: 0;
    width: 380px;
    height: 520px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbox-fade-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-box[hidden] {
    display: none !important;
}

@keyframes chatbox-fade-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-header {
    padding: 1rem 1.25rem;
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-header-info h3 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--ink);
    font-weight: 700;
}

.chatbot-header-info p {
    font-size: 0.75rem;
    margin: 0;
    color: var(--brand);
    font-weight: 600;
}

.chatbot-avatar-active {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--brand);
    display: inline-block;
    position: relative;
}

.chatbot-avatar-active::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
    animation: pulse-avatar 2s infinite;
}

@keyframes pulse-avatar {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.chatbot-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
}

.chatbot-close-btn:hover {
    color: var(--ink);
}

.chatbot-messages {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #fafafb;
}

.chat-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg-bot {
    background: #e8f5e9;
    color: #1b5e20;
    align-self: flex-start;
    border-radius: 12px 12px 12px 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.chat-msg-user {
    background: #fff;
    color: #111;
    align-self: flex-end;
    border-radius: 12px 12px 2px 12px;
    border: 1px solid var(--line);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.chat-msg-loading {
    background: #e8f5e9 !important;
    padding: 0.6rem 1rem !important;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 2rem;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #81c784;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {

    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: scale(0.85);
    }

    30% {
        opacity: 1;
        transform: scale(1);
    }
}

.chatbot-input-area {
    padding: 0.85rem 1rem;
    background: var(--bg-soft);
    border-top: 1px solid var(--line);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chatbot-input-area input {
    flex: 1;
    border: 1px solid var(--line);
    padding: 0.6rem 0.85rem;
    border-radius: 20px;
    font-size: 0.875rem;
    background: var(--color-bg-subtle);
}

.chatbot-input-area input:focus {
    background: var(--bg-soft);
}

.chatbot-input-area button {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: var(--brand);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.chatbot-input-area button:hover {
    background: var(--brand-dark);
}

@media (max-width: 480px) {
    .chatbot-box {
        width: calc(100vw - 2rem);
        height: calc(100vh - 8rem);
        right: -1rem;
    }

    .chatbot-container {
        bottom: 1rem;
        right: 1rem;
    }
}