:root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #f7f7f8;
    --surface-hover: #eeeeef;
    --black: #111111;
    --black-soft: #1a1a1a;
    --blue: #101b2d;
    --blue-soft: #17243a;
    --orange: #f28c28;
    --orange-hover: #ff9f3d;
    --orange-soft: rgba(242, 140, 40, 0.10);
    --text: #151515;
    --muted: #707070;
    --border: #dedede;
    --border-dark: #242424;
    --radius-sm: 7px;
    --radius-md: 9px;
    --radius-lg: 12px;
}


/* =========================
   Base
   ========================= */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button, a, input {
    font: inherit;
}

a {
    color: inherit;
}


/* =========================
   Aplicación
    ========================= */

.app {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
}


/* =========================
   Header
   ========================= */

.topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: min(1200px, calc(100% - 40px));
    min-height: 70px;
    margin: 0 auto;
    padding: 12px 0;
}


/* =========================
   Logo
   ========================= */

.logo {
    display: block;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}


/* =========================
   Navegación
   ========================= */

.topbar > ul {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}


/* =========================
   Elementos de navegación
   ========================= */

.topbar > ul > li {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}


/* =========================
   Links de navegación
   ========================= */

.topbar > ul > li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 17px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}

.topbar > ul > li > a:hover {
    color: var(--text);
    background: var(--surface-hover);
}


/* =========================
   Link activo
   ========================= */

.topbar > ul > li > a.active {
    color: var(--black);
    background: #ffffff;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}


/* =========================
   Zona derecha del header
   ========================= */

.topbar-right {
    display: flex;
    align-items: center;
    justify-self: flex-end;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}


/* =========================
   Usuario / Login
   ========================= */

.user-menu {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 3px 11px 3px 4px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}


/* Usuario logueado */

.user-menu:not(.login-user):hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: #cfcfcf;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.07);
}


/* Efecto al hacer click */

.user-menu:active {
    transform: translateY(1px);
}


/* =========================
   Nombre de usuario
   ========================= */

.username {
    display: block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}


/* =========================
   Login
   ========================= */

.login-user {
    padding-right: 13px;
    color: #ffffff;
    background: var(--orange);
    border-color: var(--orange);
    font-weight: 600;
}

.login-user:hover {
    color: #ffffff;
    background: var(--orange-hover);
    border-color: var(--orange-hover);
    box-shadow:
        0 4px 14px rgba(242, 140, 40, 0.18);
}


/* =========================
   Avatar
   ========================= */

.avatar {
    display: block;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
}


/* Avatar dentro del botón de login */

.login-user .avatar {
    border-color: rgba(255, 255, 255, 0.25);
}


/* =========================
   Moneda
   ========================= */

.currency {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 11px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
}


/* =========================
   Botón de ayuda
   ========================= */

.help-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.help-button:hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: #cfcfcf;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.06);
}


/* =========================
   Layout principal
   ========================= */

.layout {
    width: min(1200px, calc(100% - 40px));
    min-height: calc(100vh - 70px);
    margin: 0 auto;
}


/* =========================
   Login
   ========================= */

.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50vh;
}


.login-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    padding: 24px;
    gap: 10px;
    background: var(--bg);
    border-radius: var(--radius-md);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}


/* =========================
   Input de login
   ========================= */

.login-card input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


.login-card input:focus {
    border-color: var(--orange);
    box-shadow:
        0 0 0 3px var(--orange-soft);
}


/* =========================
   Botón de login
   ========================= */

.login-card button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 15px;
    color: #ffffff;
    background: var(--orange);
    border: 1px solid var(--orange);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}


.login-card button:hover {
    background: var(--orange-hover);
    border-color: var(--orange-hover);
    box-shadow:
        0 4px 14px rgba(242, 140, 40, 0.18);
}


.login-card button:active {
    transform: translateY(1px);
}


/* =========================
   Responsive
   ========================= */

@media (max-width: 700px) {

    .topbar {
        grid-template-columns: auto 1fr auto;
        width: calc(100% - 24px);
        gap: 12px;
    }
    .topbar > ul {
        justify-self: center;
    }
    .topbar > ul > li > a {
        padding: 0 12px;
    }
    .username {
        max-width: 90px;
    }
    .currency {
        display: none;
    }
    .layout {
        grid-template-columns: 1fr;
        width: calc(100% - 24px);
    }
}


/* =========================
   Pantallas muy pequeñas
   ========================= */

@media (max-width: 480px) {

    .topbar {
        gap: 8px;
    }
    .topbar > ul {
        gap: 2px;
        padding: 3px;
    }
    .topbar > ul > li > a {
        height: 34px;
        padding: 0 9px;
        font-size: 0.82rem;
    }
    .user-menu {
        min-height: 36px;
        padding: 2px 8px 2px 3px;
        gap: 6px;
    }
    .avatar {
        width: 30px;
        height: 30px;
    }
    .username {
        max-width: 75px;
        font-size: 0.82rem;
    }
    .help-button {
        width: 36px;
        height: 36px;
    }
}