:root {
    --color-primary: #233469;
    --color-primary-dark: #182546;
    --color-accent: #8b1f28;
    --color-accent-soft: rgba(139, 31, 40, 0.12);
    --color-surface: rgba(255, 255, 255, 0.94);
    --color-surface-alt: rgba(248, 249, 252, 0.92);
    --color-border: rgba(35, 52, 105, 0.12);
    --color-text: #1f2a44;
    --color-text-muted: #58637d;
    --shadow-lg: 0 20px 54px rgba(13, 24, 54, 0.18);
    --shadow-md: 0 16px 34px rgba(13, 24, 54, 0.12);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Open Sans", sans-serif;
    color: var(--color-text);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.12), transparent 34%),
        linear-gradient(180deg, #233469 0%, #2e3f7e 38%, #8b1f28 100%);
}

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

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
}

body.study-dashboard,
body.clients-dashboard {
    display: block;
    padding: 32px 20px;
}

.study-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.study-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 18px 24px;
    margin-bottom: 28px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
}

.study-brand {
    display: inline-flex;
    align-items: center;
}

.study-brand img {
    width: 172px;
    height: auto;
}

.study-backlink {
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.study-main {
    padding: 0;
    background: transparent;
}

.study-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(240px, 0.82fr);
    gap: 24px;
    margin-bottom: 24px;
}

.study-hero__content,
.study-summary,
.study-panel {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.study-hero__content {
    position: relative;
    overflow: hidden;
    padding: 40px;
}

.study-hero__content::after {
    content: "";
    position: absolute;
    inset: auto -64px -84px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(35, 52, 105, 0.16) 0%, rgba(35, 52, 105, 0) 70%);
    pointer-events: none;
}

.study-kicker {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--color-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.study-hero__content h1,
.study-panel__header h2,
.study-card h3 {
    margin: 0;
    color: var(--color-primary);
}

.study-hero__content h1 {
    margin-bottom: 12px;
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.05;
}

.study-hero__content p,
.study-panel__header p,
.study-card p {
    margin: 0;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.study-summary {
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(160deg, rgba(35, 52, 105, 0.96), rgba(139, 31, 40, 0.94));
    color: #ffffff;
}

.study-summary__label,
.study-summary__caption {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.study-summary__value {
    margin: 10px 0;
    font-size: clamp(48px, 7vw, 76px);
    line-height: 1;
}

.study-panel {
    padding: 32px;
}

.study-panel__header {
    margin-bottom: 24px;
}

.study-panel__header h2 {
    margin-bottom: 8px;
    font-size: 28px;
}

.study-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.study-card {
    padding: 26px;
    border-radius: 24px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.study-card--accent {
    background: linear-gradient(180deg, var(--color-accent-soft), rgba(255, 255, 255, 0.96));
}

.study-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.study-card__eyebrow {
    color: var(--color-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.study-card__count {
    color: var(--color-primary);
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
}

.study-card h3 {
    font-size: 24px;
}

.study-card__action,
.btn-generar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 124px;
    margin-top: auto;
    padding: 14px 18px;
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(35, 52, 105, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.study-card__action:hover,
.btn-generar:hover {
    background: var(--color-primary-dark);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(35, 52, 105, 0.28);
}

.study-card__action:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
    transform: none;
}

.study-footer {
    margin-top: 20px;
    padding: 10px 0 0;
    color: rgba(255, 255, 255, 0.88);
    text-align: center;
    font-size: 11px;
}

.clients-hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    margin-bottom: 18px;
}

.clients-hero .study-hero__content {
    min-height: auto;
    padding: 28px 32px;
}

.clients-hero .study-hero__content::after {
    width: 160px;
    height: 160px;
    inset: auto -28px -44px auto;
}

.clients-hero .study-kicker {
    margin-bottom: 10px;
}

.clients-hero .study-hero__content h1 {
    margin-bottom: 10px;
    font-size: clamp(28px, 4vw, 40px);
}

.clients-hero .study-hero__content p {
    max-width: 720px;
    font-size: 15px;
}

.clientes-panel {
    position: relative;
    overflow: hidden;
    padding: 28px;
}

.clientes-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(35, 52, 105, 0.03), transparent 45%),
        linear-gradient(315deg, rgba(139, 31, 40, 0.04), transparent 40%);
    pointer-events: none;
}

.clientes-toolbar,
.clientes-lista {
    position: relative;
    z-index: 1;
}

.clientes-toolbar {
    margin-bottom: 20px;
}

.clientes-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-md);
}

.clientes-search:focus-within {
    border-color: rgba(35, 52, 105, 0.28);
    box-shadow: 0 0 0 4px rgba(35, 52, 105, 0.08), var(--shadow-md);
}

.clientes-search__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    line-height: 0;
}

.clientes-search__icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.clientes-search__input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--color-primary);
    font-size: 15px;
    font-weight: 600;
}

.clientes-search__input::placeholder {
    color: #73809f;
    font-weight: 500;
}

.clientes-lista {
    display: grid;
    gap: 16px;
}

.cliente-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cliente-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(13, 24, 54, 0.12);
    border-color: rgba(35, 52, 105, 0.18);
}

.nombre-cliente {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.01em;
}

.clientes-lista:empty::after {
    content: "No hay clientes disponibles para esta busqueda.";
    display: block;
    padding: 28px;
    border-radius: 20px;
    border: 1px dashed rgba(35, 52, 105, 0.18);
    background: rgba(248, 249, 252, 0.72);
    color: var(--color-text-muted);
    text-align: center;
    font-weight: 600;
}

@media (max-width: 900px) {
    .study-hero,
    .study-metrics {
        grid-template-columns: 1fr;
    }

    .study-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    body.study-dashboard,
    body.clients-dashboard {
        padding: 18px 14px;
    }

    .study-topbar,
    .study-hero__content,
    .study-summary,
    .study-panel,
    .study-card,
    .clientes-panel {
        padding: 22px;
        border-radius: var(--radius-lg);
    }

    .study-hero__content h1 {
        font-size: 30px;
    }

    .study-panel__header h2,
    .study-card h3 {
        font-size: 22px;
    }

    .cliente-row {
        flex-direction: column;
        align-items: stretch;
    }

    .clientes-search {
        padding: 12px 16px;
    }

    .btn-generar {
        width: 100%;
        min-width: 0;
    }
}
