:root {
    --pink: #ed0876;
    --pink-dark: #bd075f;
    --green: #078b45;
    --green-dark: #075f34;
    --lime: #c8ed00;
    --yellow: #ffca16;
    --orange: #ff9b26;
    --ink: #14332a;
    --muted: #60736c;
    --surface: #ffffff;
    --soft: #f6f8f5;
    --border: #dfe9e3;
    --shadow: 0 24px 80px rgba(5, 77, 40, .14);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--soft);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, input, select { font: inherit; }

.auth-page {
    display: grid;
    place-items: center;
    padding: clamp(18px, 5vw, 56px);
    background:
        radial-gradient(circle at 8% 10%, rgba(200, 237, 0, .28), transparent 25rem),
        radial-gradient(circle at 92% 88%, rgba(237, 8, 118, .16), transparent 28rem),
        linear-gradient(140deg, #f9fff4 0%, #fff9e8 48%, #fff2f8 100%);
}

.auth-shell {
    width: min(100%, 1040px);
    min-height: 610px;
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(7, 139, 69, .14);
    border-radius: 32px;
    box-shadow: var(--shadow);
}
.install-shell { width: min(100%, 1160px); }
.brand-panel, .form-panel { padding: clamp(32px, 6vw, 76px); }
.brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    color: #fff;
    background:
        linear-gradient(150deg, rgba(7, 95, 52, .94), rgba(7, 139, 69, .94)),
        linear-gradient(45deg, var(--lime), var(--green));
}
.brand-panel::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    right: -80px;
    bottom: -90px;
    border-radius: 50%;
    background: var(--pink);
    opacity: .22;
}
.brand-logo {
    width: clamp(150px, 24vw, 235px);
    aspect-ratio: 1;
    object-fit: contain;
    margin-bottom: 28px;
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .18));
}
.brand-panel h1, .welcome-card h1, .module-hero h1 { margin: 0 0 16px; font-size: clamp(2.4rem, 6vw, 4.8rem); line-height: .98; letter-spacing: -.045em; }
.brand-panel p { max-width: 32rem; margin: 0; font-size: 1.08rem; line-height: 1.65; color: rgba(255,255,255,.86); }
.eyebrow { margin: 0 0 12px !important; color: var(--pink); font-size: .78rem !important; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.brand-panel .eyebrow { color: var(--lime); }
.form-panel { display: flex; flex-direction: column; justify-content: center; }
.form-panel h2 { margin: 0 0 8px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.03em; }
.muted { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }
form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; font-weight: 720; font-size: .92rem; }
input, select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cfded5;
    border-radius: 12px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(7,139,69,.13); }
fieldset { margin: 6px 0; padding: 20px; border: 1px solid var(--border); border-radius: 16px; }
legend { padding: 0 8px; color: var(--green-dark); font-weight: 850; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.field-span { grid-column: 1 / -1; }
.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 22px;
    color: #fff;
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    border: 0;
    border-radius: 13px;
    box-shadow: 0 10px 24px rgba(237, 8, 118, .2);
    font-weight: 820;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { filter: brightness(.96); transform: translateY(-1px); }
.button-full { width: 100%; margin-top: 6px; }
.button-small { min-height: 40px; padding: 9px 16px; font-size: .9rem; }
.button-outline { color: var(--green-dark); background: transparent; border: 1px solid rgba(7,139,69,.28); box-shadow: none; }
.alert { margin: 0 0 20px; padding: 14px 16px; border-radius: 12px; line-height: 1.45; }
.alert p { margin: 3px 0; }
.alert-error { color: #8c174c; background: #fff0f6; border: 1px solid #ffc4df; }
.alert-success { color: var(--green-dark); background: #eaf8ef; border: 1px solid #b9e4c9; }
.success-card { text-align: center; }
.success-card h2 { margin-bottom: 14px; }
.success-card p { margin: 0 0 28px; color: var(--muted); }

.dashboard-page { background: #f7faf7; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 76px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 12px clamp(18px, 5vw, 70px);
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; color: var(--green-dark); font-weight: 900; text-decoration: none; }
.topbar-brand img { width: 50px; height: 50px; object-fit: contain; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.text-link { color: var(--green); font-weight: 780; text-decoration: none; }
.dashboard-shell, .admin-shell, .module-shell { width: min(100% - 32px, 1180px); margin: 0 auto; padding: clamp(34px, 6vw, 76px) 0; }
.welcome-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 30px;
    margin-bottom: 56px;
    padding: clamp(30px, 6vw, 62px);
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(7,95,52,.18);
}
.welcome-card h1 { font-size: clamp(2.5rem, 7vw, 5.1rem); }
.welcome-card p:not(.eyebrow) { margin: 0; color: rgba(255,255,255,.8); font-size: 1.08rem; }
.account-badge, .status-pill { padding: 9px 14px; color: var(--green-dark); background: var(--lime); border-radius: 999px; font-weight: 850; white-space: nowrap; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.section-heading h1, .section-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.035em; }
.section-heading > span { color: var(--muted); font-weight: 750; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
.module-card { position: relative; min-height: 285px; display: flex; flex-direction: column; padding: 28px; overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 10px 30px rgba(16,64,43,.06); }
.module-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--pink); }
.module-card.accent-2::before { background: var(--green); }
.module-card.accent-3::before { background: var(--yellow); }
.module-card.accent-4::before { background: var(--orange); }
.module-card.accent-5::before { background: var(--lime); }
.module-number { color: #a2b0aa; font-weight: 900; }
.module-card h3 { margin: auto 0 10px; font-size: 1.45rem; }
.module-card p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
.module-link { color: var(--pink); font-weight: 850; text-decoration: none; }
.empty-card, .admin-card, .module-hero { padding: clamp(24px, 5vw, 48px); background: #fff; border: 1px solid var(--border); border-radius: 22px; }
.empty-card h2, .empty-card h3 { margin-top: 0; }
.empty-card p { margin-bottom: 0; color: var(--muted); }
.module-shell { display: grid; gap: 24px; }
.module-hero { color: #fff; background: linear-gradient(135deg, var(--green-dark), var(--green)); }
.module-hero p:not(.eyebrow) { max-width: 640px; color: rgba(255,255,255,.82); font-size: 1.1rem; line-height: 1.6; }
.module-hero .status-pill { display: inline-flex; margin-top: 20px; }

.admin-shell { display: grid; gap: 24px; }
.admin-card summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; cursor: pointer; font-weight: 850; }
.admin-card summary small { display: block; margin-top: 5px; color: var(--muted); font-weight: 550; }
.admin-card[open] summary { margin-bottom: 26px; }
.user-list { display: grid; gap: 14px; }
.user-list h2 { margin-bottom: 6px; }
.check-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.check-card { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; }
.check-card input { width: 18px; min-height: 18px; }
.status-dot { padding: 6px 10px; border-radius: 999px; font-size: .75rem; text-transform: uppercase; }
.status-dot.active { color: var(--green-dark); background: #e6f8ed; }
.status-dot.disabled { color: #8c174c; background: #fff0f6; }

@media (max-width: 880px) {
    .auth-shell { grid-template-columns: 1fr; }
    .brand-panel { align-items: center; text-align: center; }
    .brand-logo { width: 170px; }
    .module-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .check-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 620px) {
    .auth-page { padding: 0; place-items: stretch; }
    .auth-shell { min-height: 100vh; border: 0; border-radius: 0; }
    .field-grid, .module-grid, .check-grid { grid-template-columns: 1fr; }
    .field-span { grid-column: auto; }
    .welcome-card, .section-heading, .topbar, .topbar-actions { align-items: flex-start; flex-direction: column; }
    .topbar { position: static; }
    .topbar-actions { width: 100%; gap: 12px; }
}

/* Relieve visual común para todo el sistema. */
:root { --lift-green: #d9e8de; --lift-pink: #b7075c; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    border-color: #c9ddd0;
    box-shadow: 0 4px 0 var(--lift-green), 0 8px 16px rgba(17, 61, 42, .08);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

textarea {
    width: 100%;
    min-height: 112px;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cfded5;
    border-radius: 12px;
    outline: none;
    font: inherit;
    resize: vertical;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    transform: translateY(-1px);
    border-color: var(--green);
    box-shadow: 0 5px 0 #c5e4d0, 0 0 0 4px rgba(7,139,69,.13), 0 10px 18px rgba(17,61,42,.10);
}

.button {
    box-shadow: 0 5px 0 var(--lift-pink), 0 10px 20px rgba(237, 8, 118, .20);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 var(--lift-pink), 0 13px 24px rgba(237, 8, 118, .24);
}

.button:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 var(--lift-pink), 0 5px 10px rgba(237, 8, 118, .16);
}

.button-outline {
    box-shadow: 0 4px 0 #d9e8de, 0 8px 16px rgba(17, 61, 42, .08);
}

.button-outline:hover {
    box-shadow: 0 6px 0 #d1e4d8, 0 10px 18px rgba(17, 61, 42, .10);
}

.button:disabled,
.button:disabled:hover {
    transform: none;
    box-shadow: none;
}

.module-card,
.empty-card,
.admin-card,
.check-card,
fieldset {
    box-shadow: 0 7px 0 #e1ebe4, 0 14px 26px rgba(17, 61, 42, .07);
}

.module-card {
    transition: transform .18s ease, box-shadow .18s ease;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 0 #dce9e0, 0 19px 32px rgba(17, 61, 42, .11);
}

/* Botones especiales de las pantallas de perfil y carga de fotografías. */
.cg-upload-open,
.cg-upload-cancel,
.cg-upload-use {
    box-shadow: 0 4px 0 #d9e8de, 0 8px 16px rgba(17, 61, 42, .08);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.cg-upload-use {
    box-shadow: 0 4px 0 #056533, 0 8px 16px rgba(7, 139, 69, .18);
}

.cg-upload-open:hover,
.cg-upload-cancel:hover,
.cg-upload-use:hover {
    transform: translateY(-2px);
}
