#app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: flex;
    width: 72px;
    flex-direction: column;
    padding: 18px 10px;
    background: #004d31;
    color: #ffffff;
    transition: width .2s ease;
}

#app-sidebar.expanded {
    width: 260px;
}

#app-sidebar .menu-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-bottom: 20px;
    color: #d4e622;
    font-size: .9rem;
    font-weight: 800;
    overflow: hidden;
    white-space: nowrap;
}

#app-sidebar .menu-brand-text,
#app-sidebar .menu-label {
    display: none;
}

#app-sidebar.expanded .menu-brand-text,
#app-sidebar.expanded .menu-label {
    display: inline;
}

#app-sidebar .menu-brand-icon {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    background: #d4e622;
    color: #004d31;
    font-size: 1rem;
}

#app-sidebar.expanded .menu-brand {
    justify-content: flex-start;
    gap: 10px;
    padding: 0 8px;
}

#app-sidebar .menu-caption {
    margin: 0 0 8px;
    color: rgba(255, 255, 255, .6);
    font-size: .7rem;
    text-align: center;
    text-transform: uppercase;
}

#app-sidebar.expanded .menu-caption {
    text-align: left;
    padding-left: 10px;
}

#app-sidebar .menu-nav {
    display: grid;
    gap: 6px;
}

#app-sidebar .menu-link,
#app-sidebar .menu-toggle {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

#app-sidebar.expanded .menu-link,
#app-sidebar.expanded .menu-toggle {
    justify-content: flex-start;
}

#app-sidebar .menu-link:hover,
#app-sidebar .menu-link:focus-visible,
#app-sidebar .menu-link.active,
#app-sidebar .menu-toggle:hover,
#app-sidebar .menu-toggle:focus-visible {
    background: #d4e622;
    color: #004d31;
}

#app-sidebar .menu-icon {
    display: inline-grid;
    width: 24px;
    min-width: 24px;
    height: 24px;
    place-items: center;
    font-size: 1.2rem;
    line-height: 1;
}

#app-sidebar .menu-footer {
    margin-top: auto;
}

.has-app-sidebar {
    padding-left: 72px !important;
}

body.has-home-navigation {
    padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
}

@media (max-width: 600px) {
    #app-sidebar {
        width: 62px;
        padding: 12px 7px;
    }

    #app-sidebar.expanded {
        width: min(260px, 82vw);
    }

    .has-app-sidebar {
        padding-left: 62px !important;
    }
}

/* Navegación fija para las vistas del panel administrativo. */
.admin-bottom-nav {
    position: fixed;
    z-index: 1000;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid !important;
    width: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    min-height: calc(72px + env(safe-area-inset-bottom, 0px));
    padding: 6px max(10px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
    border-top: 1px solid rgba(40, 55, 35, .1);
    background: rgba(250, 251, 248, .97);
    box-shadow: 0 -4px 14px rgba(40, 55, 35, .08);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.admin-bottom-nav .admin-bottom-nav-link {
    display: flex;
    min-width: 0;
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 3px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #626b58;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.admin-bottom-nav .admin-bottom-nav-link:hover,
.admin-bottom-nav .admin-bottom-nav-link:focus-visible {
    background: #edf3e5;
    outline: none;
}

.admin-bottom-nav .admin-bottom-nav-link.active {
    background: #e4edcf;
    color: #557622;
}

.admin-bottom-nav .admin-bottom-nav-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.admin-bottom-nav .admin-bottom-nav-link small {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(.58rem, 2.1vw, .72rem);
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-bottom-nav .admin-bottom-nav-link.active small {
    font-weight: 800;
}

body.rt-page,
body.maquinas-page,
body.skill-page {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

.home-header-actions { position: relative; z-index: 3; display: flex; align-items: center; gap: 6px; }
.app-status-pill { display: inline-flex; min-height: 30px; align-items: center; justify-content: center; gap: 4px; padding: 5px 9px; border: 1px solid #dce6d0; border-radius: 999px; background: #fff; color: #557622; font: inherit; font-size: .65rem; font-weight: 750; cursor: pointer; }
.app-status-pill:hover, .app-status-pill:focus-visible { background: #edf3e5; outline: none; }
.app-status-pill[data-state="update"] { border-color: #668b27; background: #e4edcf; color: #426317; }
.app-help-dialog { width: min(440px, calc(100% - 28px)); padding: 0; overflow: hidden; border: 1px solid #dfe4d8; border-radius: 16px; background: #fff; box-shadow: 0 20px 60px rgba(35,45,29,.25); }
.app-help-dialog::backdrop { background: rgba(35,45,29,.5); }
.app-help-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; background: #edf3e5; }
.app-help-header h2 { margin: 0; color: #557622; font-size: .92rem; }
.app-help-close { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid #d6dfc9; border-radius: 50%; background: #fff; color: #557622; font: inherit; font-size: 1.05rem; cursor: pointer; }
.app-help-content { padding: 14px; color: #46513e; font-size: .76rem; line-height: 1.5; }
.app-help-content p { margin: 0 0 9px; }
.app-help-content p:last-child { margin-bottom: 0; color: #78806f; font-size: .69rem; }
.app-help-footer { display: flex; justify-content: flex-end; gap: 7px; padding: 10px 14px 14px; border-top: 1px solid #edf0e9; }
.app-help-footer button { min-height: 35px; padding: 6px 10px; border: 1px solid #d6dfc9; border-radius: 8px; background: #fff; color: #59644f; font: inherit; font-size: .7rem; font-weight: 700; cursor: pointer; }
.app-help-footer .app-install-action { border-color: #5e811d; background: #5e811d; color: #fff; }
.app-help-footer .app-install-action[hidden] { display: none; }

@media (max-width: 420px) {
    .home-header { gap: 6px; }
    .home-header-actions { gap: 4px; }
    .app-status-pill { width: 30px; min-width: 30px; padding: 4px; font-size: 0; }
    .app-status-pill > span:first-child { font-size: .86rem; }
}
.app-subscription-notice { width: min(calc(100% - 24px), 1180px); margin: 12px auto 0; padding: 9px 12px; border: 1px solid #ecd9a8; border-radius: 9px; background: #fff8e6; color: #85621a; font-size: .75rem; }
