:root {
    --bg: #f7f7f5;
    --panel-from: #0f2e1a;
    --panel-via: #146a37;
    --panel-to: #16a34a;
    --card-bg: #ffffff;
    --text: #17181a;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --accent: #16a34a;
    --accent-dark: #0f7a3d;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --success-bg: #f0fdf4;
    --success-text: #15803d;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── Auth shell (Login / Register / Recuperar) ──────────────────────────── */

.auth-shell {
    min-height: 100vh;
    display: flex;
}

.auth-shell__brand {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: #fff;
    background: linear-gradient(135deg, var(--panel-from) 0%, var(--panel-via) 55%, var(--panel-to) 100%);
    overflow: hidden;
}

.auth-shell__brand .shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.auth-shell__brand .shape--1 { width: 420px; height: 420px; top: -140px; right: -120px; }
.auth-shell__brand .shape--2 { width: 260px; height: 260px; bottom: -100px; left: -60px; background: rgba(255, 255, 255, .06); }

.brand-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -.02em;
    position: relative;
    z-index: 1;
}

.auth-shell__brand h1 {
    position: relative;
    z-index: 1;
    font-size: 2rem;
    line-height: 1.25;
    font-weight: 700;
    margin: 2rem 0 .75rem;
    max-width: 420px;
}

.auth-shell__brand p {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, .85);
    font-size: 1rem;
    max-width: 380px;
    line-height: 1.6;
}

.auth-shell__form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--card-bg);
}

@media (max-width: 860px) {
    .auth-shell__brand { display: none; }
}

.auth-card {
    width: 100%;
    max-width: 380px;
    animation: fadeInUp .5s ease both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 .25rem;
    letter-spacing: -.01em;
}

.auth-card .subtitle {
    color: var(--text-muted);
    font-size: .9375rem;
    margin: 0 0 2rem;
}

/* ── Campos ──────────────────────────────────────────────────────────────── */

.field {
    margin-bottom: 1.125rem;
}

.field label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    margin-bottom: .375rem;
    color: var(--text);
}

.input-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon svg {
    position: absolute;
    left: .8rem;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: .75rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: .9375rem;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input-icon input {
    padding-left: 2.5rem;
}

.field textarea {
    resize: vertical;
    min-height: 5rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .12);
}

.field input.invalid,
.field select.invalid,
.field textarea.invalid {
    border-color: var(--error);
}

.field-error {
    display: block;
    min-height: 1.1em;
    color: var(--error);
    font-size: .78125rem;
    margin-top: .3rem;
}

button.btn {
    position: relative;
    width: 100%;
    padding: .8125rem;
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: #fff;
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: .375rem;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

button.btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, .28);
}

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

button.btn:disabled {
    cursor: not-allowed;
}

.btn-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

button.btn.is-loading {
    color: transparent;
    filter: brightness(.95);
    transform: none;
    box-shadow: none;
}

button.btn.is-loading .btn-spinner {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    background: var(--error-bg);
    border: 1px solid #fecaca;
    color: var(--error);
    font-size: .8125rem;
    padding: .7rem .875rem;
    border-radius: 9px;
    margin-bottom: 1.25rem;
}

.mensaje {
    background: var(--success-bg);
    border: 1px solid #bbf7d0;
    color: var(--success-text);
    font-size: .8125rem;
    padding: .7rem .875rem;
    border-radius: 9px;
    margin-bottom: 1.25rem;
}

.footer-link {
    text-align: center;
    margin: 1rem 0 0;
}

.footer-link a {
    color: var(--text-muted);
    font-size: .8438rem;
    text-decoration: none;
    transition: color .15s ease;
}

.footer-link a:hover {
    color: var(--accent);
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: .8438rem;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    color: var(--accent);
}

.legal-consent {
    text-align: center;
    font-size: .78125rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: .25rem 0 1.125rem;
}

.legal-consent a {
    color: var(--text-muted);
    text-decoration: underline;
}

.legal-consent a:hover {
    color: var(--accent);
}

.brand-credit {
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
    opacity: .75;
    margin: 1.5rem 0 0;
}

.brand-credit a {
    color: var(--text-muted);
    text-decoration: underline;
}

.brand-credit a:hover {
    color: var(--accent);
}

/* ── Páginas legales (Términos / Privacidad) ─────────────────────────────── */

.legal-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 3rem 1.5rem 4rem;
}

.legal-content {
    max-width: 680px;
    width: 100%;
}

.legal-back {
    display: inline-block;
    color: var(--text-muted);
    font-size: .8438rem;
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.legal-back:hover {
    color: var(--accent);
}

.legal-content h1 {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0 0 .375rem;
}

.legal-updated {
    color: var(--text-muted);
    font-size: .8438rem;
    margin: 0 0 2rem;
}

.legal-content h2 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 2rem 0 .625rem;
}

.legal-content p,
.legal-content li {
    font-size: .9375rem;
    line-height: 1.65;
    color: var(--text);
}

.legal-content ul {
    padding-left: 1.25rem;
    margin: .5rem 0 1rem;
}

.legal-content li {
    margin-bottom: .375rem;
}

.legal-content a {
    color: var(--accent);
}

.legal-footer-note {
    margin-top: 2.5rem;
    padding: 1rem 1.125rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 9px;
    color: #92400e !important;
    font-size: .8125rem !important;
}

/* ── Dashboard (Index) ──────────────────────────────────────────────────── */

.dashboard-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.dashboard {
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
}

.dashboard p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.dashboard a {
    color: var(--accent);
    font-size: .875rem;
    text-decoration: none;
}

.dashboard a:hover {
    text-decoration: underline;
}
