@layer base {
    html {
        font-family: sans-serif;
        scroll-behavior: smooth;
    }

    body {
        margin: 0;
        min-height: 100vh;
        color: var(--negro-claro);
        background: var(--blanco);
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    button,
    input,
    select,
    textarea {
        font: inherit;
    }
}

@layer components {
    .tribu-guest {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        background: var(--color-tema-base);
        color: var(--blanco);
    }

    .tribu-auth-main {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 3rem 1rem;
    }

    .tribu-guest > .home-legal {
        margin-top: auto;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .tribu-app {
        min-height: 100vh;
        background-color: var(--blanco);
        color: var(--negro-claro);
    }

    .tribu-app::before {
        content: "";
        position: fixed;
        top: calc(50px + env(safe-area-inset-top, 0px)); /*añado el alto del menu, tribu-topbar*/
        left: 50%;
        z-index: 0;
        /* width: min(28rem, 88vw);
        height: min(28rem, 88vw); */
        width: 100%;
        height: 100vh;        
        transform: translate(-50%, 0%);
        background: url('/assets/img/logo_devices/logo.svg') center / contain no-repeat;
        opacity: 0.12;
        pointer-events: none;
    }

    .tribu-app > * {
        position: relative;
        z-index: 1;
    }

    .tribu-app .tribu-bottom-nav {
        z-index: 50;
    }

    .tribu-app .tribu-scroll-top {
        z-index: 60;
    }

    .tribu-shell {
        width: 100%;
        max-width: 72rem;
        margin-inline: auto;
        padding-inline: 1rem;
    }

    .tribu-brand {
        font-family: "Lobster", cursive;
        font-size: 1.85rem;
        line-height: 1;
        color: var(--logo);
        letter-spacing: 0.02em;
    }

    .tribu-brand-xl {
        font-family: "Lobster", cursive;
        font-size: clamp(3rem, 8vw, 4.5rem);
        line-height: 1;
        color: var(--logo);
    }

    .tribu-topbar {
        position: sticky;
        top: 0;
        z-index: 40;
        background: var(--color-tema);
        color: var(--blanco);
    }

    .tribu-topbar-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding-block: 0.85rem;
    }

    .tribu-topbar .home-logo {
        width: 52px;
        height: 52px;
    }

    .tribu-nav {
        display: flex;
        align-items: center;
        gap: 0.35rem 1rem;
        overflow-x: auto;
    }

    .tribu-nav-link {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding-block: 0.35rem;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--blanco);
        opacity: 0.78;
        white-space: nowrap;
        border-bottom: 2px solid transparent;
    }

    .tribu-nav-link:hover,
    .tribu-nav-link-active {
        opacity: 1;
        border-bottom-color: var(--color-tema);
    }

    .tribu-panel {
        width: 100%;
        max-width: 28rem;
        border-radius: 1rem;
        background: var(--blanco);
        color: var(--negro-claro);
        padding: 2rem;
        box-shadow: 0 12px 32px rgba(11, 60, 93, 0.18);
    }

    .tribu-panel-wide {
        max-width: 32rem;
    }

    .tribu-btn-on-dark {
        border-color: var(--blanco);
        color: var(--blanco);
        background: transparent;
    }

    .tribu-btn-on-dark:hover {
        background: var(--blanco-trans);
    }

    .tribu-card {
        border-radius: 1rem;
        background: rgba(255, 255, 255, 0.96);
        box-shadow:
            0 1px 2px rgba(11, 60, 93, 0.08),
            0 8px 20px rgba(11, 60, 93, 0.12),
            0 18px 40px rgba(11, 60, 93, 0.1);
    }

    .tribu-card-link {
        display: block;
        border-radius: 1rem;
        background: rgba(255, 255, 255, 0.96);
        padding: 1.25rem;
        box-shadow:
            0 1px 2px rgba(11, 60, 93, 0.08),
            0 8px 20px rgba(11, 60, 93, 0.12),
            0 18px 40px rgba(11, 60, 93, 0.1);
        transition: transform 150ms ease, box-shadow 150ms ease;
    }

    .tribu-card-link:hover {
        transform: translateY(-2px);
        box-shadow:
            0 2px 4px rgba(11, 60, 93, 0.1),
            0 12px 28px rgba(11, 60, 93, 0.16),
            0 24px 48px rgba(11, 60, 93, 0.12);
    }

    .tribu-label {
        display: block;
        margin-bottom: 0.35rem;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--negro-claro);
    }

    .tribu-input {
        display: block;
        width: 100%;
        border: 1px solid var(--gris-medio-mas);
        border-radius: 0.6rem;
        background: var(--blanco);
        padding: 0.65rem 1rem;
        color: var(--negro-claro);
    }

    .tribu-input:focus {
        outline: none;
        border-color: var(--color-tema);
        box-shadow: 0 0 0 3px var(--color-tema-trans);
    }

    .tribu-error {
        margin-top: 0.35rem;
        font-size: 0.875rem;
        color: var(--rojo);
    }

    .tribu-alert {
        border-radius: 0.75rem;
        padding: 0.9rem 1rem;
        font-size: 0.875rem;
        font-weight: 600;
    }

    .tribu-alert-ok {
        background: #e9fbe6;
        color: #21631c;
    }

    .tribu-alert-error {
        background: #fde8e2;
        color: var(--rojo);
    }

    .tribu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        border: 2px solid transparent;
        border-radius: 30px;
        padding: 0.6rem 0.9rem;
        font-weight: 600;
        line-height: 1;
        cursor: pointer;
        transition:
            background-color 150ms ease,
            transform 150ms ease,
            box-shadow 150ms ease;
        min-height: 52px;
    }

    .tribu-btn:hover {
        transform: translateY(-1px);
    }

    .tribu-btn-block {
        width: 100%;
    }

    .home-script {
        font-family: "Allura", cursive;
    }

    .home-quote {
        font-family: "Playfair Display", serif;
    }

    .tribu-btn-primary {
        background: var(--color-tema);
        color: var(--blanco);
    }

    .tribu-btn-primary:hover {
        background: var(--color-tema-medio);
    }

    .tribu-btn-outline {
        border-color: var(--color-tema);
        color: var(--color-tema);
        background: var(--blanco);
    }

    .tribu-btn-outline:hover {
        background: var(--gris-claro);
    }

    .tribu-btn-ghost {
        background: transparent;
        color: var(--blanco);
        border-color: transparent;
        padding-inline: 0.5rem;
    }

    .tribu-btn-muted {
        background: var(--gris-medio);
        color: var(--negro-claro);
    }

    .tribu-btn-muted:hover {
        background: var(--gris-medio-mas);
    }

    .tribu-btn-danger {
        background: var(--naranja);
        color: var(--blanco);
    }

    .tribu-btn-alert {
        background: var(--rojo);
        color: var(--blanco);
    }

    .tribu-filters {
        display: grid;
        gap: 1rem;
        grid-template-columns: 1fr;
    }

    .tribu-search-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: center;
    }

    .tribu-search-row .tribu-input {
        flex: 1 1 14rem;
    }

    .tribu-search-row .icon {
        width: 18px;
        height: 18px;
        background-color: var(--color-tema);
    }

    .tribu-filter-panel {
        margin-top: 1.25rem;
        padding-top: 1.25rem;
        border-top: 1px solid var(--gris-claro);
    }

    @media (min-width: 700px) {
        .tribu-filters {
            grid-template-columns: 1fr 1fr 1fr;
            align-items: end;
        }
    }

    .tribu-cal-nav-row {
        display: grid;
        grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .tribu-cal-nav {
        display: inline-flex;
        width: 2.75rem;
        height: 2.75rem;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: var(--gris-claro);
        color: var(--negro-claro);
        flex-shrink: 0;
    }

    .tribu-cal-nav:hover {
        background: var(--gris-medio);
    }

    .tribu-cal-nav .icon {
        width: 1.35rem;
        height: 1.35rem;
        background-color: var(--negro-claro);
    }

    .tribu-cal-day {
        min-height: 4rem;
        border-radius: 0.75rem;
        padding: 0.5rem;
        text-align: center;
        border: 1px solid transparent;
        background: var(--blanco);
        color: var(--negro-claro);
        transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
    }

    .tribu-cal-day:hover {
        background: var(--azul-claro);
    }

    .tribu-cal-day-event {
        background: var(--color-tema-trans);
        font-weight: 700;
    }

    .tribu-cal-day-active {
        background: var(--color-tema);
        color: var(--blanco);
        border-color: var(--color-tema);
    }

    .tribu-cal-day-today {
        border-color: var(--color-tema);
        box-shadow: 0 0 0 2px var(--color-tema-trans);
    }

    .tribu-cal-dot {
        width: 0.5rem;
        height: 0.5rem;
        margin: 0.5rem auto 0;
        border-radius: 9999px;
        background: var(--color-tema);
    }

    .tribu-cal-dot-on {
        background: var(--blanco);
    }

    .tribu-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 1.5rem;
        border-radius: 9999px;
        padding: 0.15rem 0.5rem;
        background: var(--color-tema);
        color: var(--blanco);
        font-size: 0.75rem;
        font-weight: 700;
    }


    @media (max-width: 899px) {
    .tribu-app::before {
        top: env(safe-area-inset-top, 0px);
        bottom: calc(50px + env(safe-area-inset-bottom, 0px)); /*quito el top dado, en el caso de que lo tenga*/
    }
}
}