:root {
    --bg-main: #0b1020;
    --bg-card: #141b2f;
    --bg-card-soft: #1b243a;
    --accent: #f2c94c;
    --accent-soft: rgba(242, 201, 76, 0.15);
    --text-main: #f7f7f7;
    --text-muted: #a8b0c5;
    --danger: #ff6b6b;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.35);
    --radius-xl: 24px;
}

/* Modo claro (default) */
body.light {
    --bg-main: #f4f5fb;
    --bg-card: #ffffff;
    --bg-card-soft: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --shadow-soft: 0 16px 35px rgba(15, 23, 42, 0.08);
}

/* Reset básico */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
}

/* Fondo general según tema */
body {
    display: flex;
    justify-content: center;
    align-items: stretch;
    background: radial-gradient(circle at top, #1f2937 0, #020617 45%, #000 100%);
}

body.light {
    background: radial-gradient(circle at top, #e5e7eb 0, #f9fafb 45%, #e5e7eb 100%);
}

/* Shell general */
.app-shell {
    width: 100%;
    max-width: 960px;
    min-height: 100vh;
    padding: 20px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
}

/* Masthead: menos zoom */
.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(120deg, rgba(15,23,42,0.9), rgba(30,64,175,0.9));
    border-radius: 18px;
    padding: 10px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    backdrop-filter: blur(16px);
}

body.light .masthead {
    background: linear-gradient(120deg, #ffffff, #e5e7eb);
    box-shadow: 0 10px 24px rgba(148, 163, 184, 0.4);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* LOGO más chico */
.logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 16px;
    background: rgba(0,0,0,0.3);
    padding: 6px;
}

body.light .logo {
    background: rgba(15,23,42,0.06);
}

.titles {
    display: flex;
    flex-direction: column;
}

.title {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
}

.subtitle {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.subtitle.empresa {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Botón tema (con icono + texto) */
.theme-toggle {
    border: none;
    background: rgba(15,23,42,0.8);
    color: var(--accent);
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s, color 0.15s;
}

.theme-icon {
    font-size: 1rem;
}

.theme-label {
    font-size: 0.78rem;
}

body.light .theme-toggle {
    background: rgba(15,23,42,0.06);
    color: #111827;
    box-shadow: 0 8px 18px rgba(148,163,184,0.6);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

body.light .theme-toggle:hover {
    box-shadow: 0 10px 24px rgba(148,163,184,0.8);
}

.theme-toggle:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

/* Main */
.main {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cards genéricas */
.card {
    background: radial-gradient(circle at top left, rgba(242,201,76,0.18), transparent 55%), var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 28px 26px 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.25);
    width: 100%;
}

body.light .card {
    background: radial-gradient(circle at top left, rgba(250,204,21,0.16), transparent 55%), var(--bg-card);
}

/* Vista login: más angosta */
.card-login {
    max-width: 420px;
    margin: 0 auto;
    text-align: left;
}

.card-login h2 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 1.45rem;
}

.hint {
    margin: 0 0 18px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Form login: input menos ancho visualmente */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-row label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-row input {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-main);
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s;
    max-width: 100%;
}

body.light .form-row input {
    background: #f9fafb;
}

.form-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(242, 201, 76, 0.6);
}

/* Botones */
.btn-primary,
.btn-secondary {
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s, color 0.12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #facc15, #f97316);
    color: #111827;
    font-weight: 600;
    box-shadow: 0 14px 30px rgba(245, 158, 11, 0.45);
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(245, 158, 11, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.5);
}

.btn-secondary {
    margin-top: 18px;
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed rgba(148, 163, 184, 0.7);
}

.btn-secondary:hover {
    background: var(--accent-soft);
    color: var(--text-main);
}

/* Error */
.error-msg {
    min-height: 18px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--danger);
}

/* Vista proyectos */
.card-projects {
    max-width: 900px;
    margin: 0 auto;
}

.card-projects h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.6rem;
}

.card-projects .hint {
    font-size: 0.95rem;
}

/* GRID proyectos */
.projects-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

/* Tarjeta de proyecto */
.project-card {
    text-decoration: none;
    padding: 18px 18px 16px;
    border-radius: 20px;
    background: var(--bg-card-soft);
    border: 1px solid transparent;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    color: var(--text-main);
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

body.light .project-card {
    background: #ffffff;
    box-shadow: 0 12px 26px rgba(148,163,184,0.55);
}

.project-card h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.project-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(0,0,0,0.55);
    border-color: rgba(242, 201, 76, 0.7);
    background: radial-gradient(circle at top, rgba(242,201,76,0.25), transparent 60%), var(--bg-card-soft);
}

body.light .project-card:hover {
    box-shadow: 0 18px 38px rgba(148,163,184,0.85);
    background: radial-gradient(circle at top, rgba(250,204,21,0.22), transparent 60%), #ffffff;
}

/* Footer */
.footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.85;
}

/* Responsivo */
@media (max-width: 768px) {
    .app-shell {
        padding: 12px;
        gap: 14px;
    }

    .masthead {
        border-radius: 16px;
        padding-inline: 12px;
    }

    .title {
        font-size: 1rem;
    }

    .logo {
        width: 52px;
        height: 52px;
        padding: 5px;
    }

    .card {
        padding: 22px 18px 18px;
        max-width: 100%;
    }

    .card-projects {
        padding-top: 20px;
    }

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

@media (max-width: 400px) {
    .subtitle.empresa {
        display: none;
    }
}
