/* =========================================================
   GESTION BULLCOC — INTERFAZ CLARA Y MOVIL
   Capa visual final. Los iconos originales se conservan.
========================================================= */

:root {
    --ui-blue: #09a7ec;
    --ui-blue-dark: #008fd2;
    --ui-blue-soft: #eaf8ff;
    --ui-ink: #090b0f;
    --ui-text: #20242a;
    --ui-muted: #8b9199;
    --ui-line: #eceef1;
    --ui-soft: #f4f5f7;
    --ui-surface: #ffffff;
    --ui-danger: #ff3658;
    --ui-success: #24bd6b;
    --ui-radius: 22px;
    --ui-shadow: 0 14px 42px rgba(24, 31, 40, .07);
}

html {
    background: var(--ui-surface);
}

body.admin-app,
body.portal-page {
    margin: 0;
    background: var(--ui-surface);
    color: var(--ui-text);
    font-family: Arial, "Segoe UI", Helvetica, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(9, 167, 236, .25);
    outline-offset: 2px;
}

/* =========================================================
   CONTROL DE STOCK / PEDIDOS
========================================================= */

.admin-app .stock-order-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
    gap: 18px;
    margin-bottom: 18px;
}

.admin-app .stock-order-layout .card,
.admin-app .stock-order-list-card {
    margin: 0;
}

.admin-app .stock-order-layout h2,
.admin-app .stock-order-list-card h2 {
    margin: 0 0 6px;
    color: var(--ui-ink);
    font-size: 21px;
}

.admin-app .stock-order-help {
    margin: 0 0 16px;
    color: var(--ui-muted);
    font-size: 14px;
}

.admin-app .stock-order-search-row {
    margin-bottom: 0;
}

.admin-app .stock-order-search-row input {
    flex: 1;
    min-width: 0;
}

.admin-app .stock-order-search-results {
    max-height: 280px;
    margin-top: 8px;
    overflow-y: auto;
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    background: var(--ui-surface);
}

.admin-app .stock-order-search-results[hidden],
.admin-app .stock-order-selected[hidden] {
    display: none;
}

.admin-app .stock-order-product-option {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--ui-line);
    background: transparent;
    color: var(--ui-text);
    text-align: left;
}

.admin-app .stock-order-product-option:last-child {
    border-bottom: 0;
}

.admin-app .stock-order-product-option:hover {
    background: var(--ui-blue-soft);
}

.admin-app .stock-order-product-option span,
.admin-app .stock-order-selected span,
.admin-app .stock-order-purchase-item span {
    color: var(--ui-muted);
    font-size: 13px;
}

.admin-app .stock-order-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid rgba(36, 189, 107, .28);
    border-radius: 14px;
    background: rgba(36, 189, 107, .08);
}

.admin-app .stock-order-selected strong {
    width: 100%;
}

.admin-app .stock-order-quantity-label {
    display: block;
    margin: 18px 0 7px;
    font-weight: 800;
}

.admin-app .stock-order-quantity {
    width: 150px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--ui-line);
    border-radius: 11px;
    background: var(--ui-surface);
    color: var(--ui-text);
}

.admin-app .stock-order-add {
    margin-left: 10px;
}

.admin-app .stock-order-purchase-items {
    display: grid;
    gap: 8px;
}

.admin-app .stock-order-purchase-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--ui-soft);
}

.admin-app .stock-order-purchase-item div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.admin-app .stock-order-purchase-item b {
    min-width: 42px;
    color: var(--ui-blue-dark);
    font-size: 19px;
    text-align: right;
}

.admin-app .stock-order-list-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.admin-app .stock-orders-table td small {
    display: block;
    margin-top: 3px;
    color: var(--ui-muted);
}

.admin-app .stock-order-status {
    min-width: 112px;
    min-height: 38px;
    padding: 0 9px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    background: var(--ui-surface);
    color: var(--ui-text);
    font-weight: 700;
}

@media (max-width: 760px) {
    .admin-app .stock-order-layout {
        grid-template-columns: 1fr;
    }

    .admin-app .stock-order-create-card,
    .admin-app .stock-order-purchase-card,
    .admin-app .stock-order-list-card {
        padding: 18px;
    }

    .admin-app .stock-order-quantity {
        width: 100%;
        box-sizing: border-box;
    }

    .admin-app .stock-order-add {
        width: 100%;
        margin: 10px 0 0;
    }
}

/* =========================================================
   LOGIN
========================================================= */

.admin-app .login-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    overflow-y: auto;
    background: #fff;
}

.admin-app .login-background-image,
.admin-app .login-screen::after {
    display: none !important;
}

.admin-app .login-box {
    position: relative;
    width: min(100%, 520px);
    padding: 0 16px 32px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.admin-app .login-heading {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 56px;
}

.admin-app .login-heading h1 {
    margin: 0;
    color: var(--ui-ink);
    font-size: clamp(30px, 5vw, 38px);
    font-weight: 800;
    letter-spacing: -.035em;
}

.admin-app .login-back {
    color: var(--ui-ink);
    font-size: 43px;
    font-weight: 400;
    line-height: 1;
}

.admin-app .login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin-bottom: 58px;
}

.admin-app .login-logo {
    display: block;
    width: min(88%, 380px);
    height: auto;
    margin: 0;
    padding: 0;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    background: #fff;
}

.admin-app .login-box .login-brand h2 {
    margin: 0;
    color: var(--ui-ink);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.admin-app .login-fields {
    margin-bottom: 34px;
}

.admin-app .login-fields label {
    display: block;
    margin: 0 0 8px;
    color: var(--ui-ink);
    font-size: 16px;
    font-weight: 800;
}

.admin-app .login-fields input {
    width: 100%;
    height: 55px;
    margin: 0 0 24px;
    padding: 0 4px;
    border: 0;
    border-bottom: 2px solid var(--ui-line);
    border-radius: 0;
    background: #fff;
    color: var(--ui-ink);
    box-shadow: none;
    font-size: 18px;
    font-weight: 600;
    transition: border-color .2s ease;
}

.admin-app .login-fields input::placeholder {
    color: #c7cacf;
}

.admin-app .login-fields input:focus {
    border-color: var(--ui-blue);
    outline: none;
    box-shadow: none;
}

.admin-app .login-button {
    width: 100%;
    height: 60px;
    border: 0;
    border-radius: 9px;
    background: var(--ui-blue);
    color: #fff;
    box-shadow: 0 12px 26px rgba(9, 167, 236, .24);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
    transition: transform .18s ease, background .18s ease;
}

.admin-app .server-config-button {
    display: none;
}

.native-app .admin-app .server-config-button {
    display: block;
    margin: 22px auto 0;
    padding: 10px 18px;
    border: 0;
    background: transparent;
    color: var(--ui-blue-dark);
    font-size: 14px;
    font-weight: 700;
}

.native-sync-status {
    position: fixed;
    right: 14px;
    bottom: 88px;
    z-index: 99990;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: calc(100vw - 28px);
    padding: 9px 12px;
    border: 1px solid #dcefe4;
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 24px rgba(24, 31, 40, .12);
    color: #177744;
    font-size: 12px;
}

.native-sync-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--ui-success);
}

.native-sync-time {
    color: var(--ui-muted);
    white-space: nowrap;
}

.native-sync-status--offline {
    border-color: #ffd7de;
    color: #b71935;
}

.native-sync-status--offline .native-sync-dot {
    background: var(--ui-danger);
}

.native-app .main-tab[data-ribbon="administracion"] {
    display: none !important;
}

@media (max-width: 520px) {
    .native-sync-status {
        left: 12px;
        right: 12px;
        justify-content: center;
    }

    .native-sync-time {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.admin-app .login-button:hover {
    background: var(--ui-blue-dark);
    transform: translateY(-1px);
}

.admin-app #loginError {
    min-height: 22px;
    margin-top: 14px;
    color: var(--ui-danger);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

/* =========================================================
   ESTRUCTURA PRINCIPAL
========================================================= */

.admin-app .system-shell {
    min-height: 100vh;
    background: var(--ui-surface);
}

.admin-app .topbar {
    min-height: 76px;
    height: auto;
    display: grid;
    grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
    align-items: center;
    gap: 22px;
    padding: 12px clamp(18px, 3vw, 42px);
    border-bottom: 1px solid var(--ui-line);
    background: #fff;
    color: var(--ui-text);
    box-shadow: none;
}

.admin-app .topbar-brand,
.admin-app .topbar-actions,
.admin-app .branch-box {
    display: flex;
    align-items: center;
}

.admin-app .topbar-brand {
    min-width: 0;
    gap: 14px;
}

.admin-app .topbar-logo {
    width: 188px;
    height: 58px;
    object-fit: contain;
    object-position: left center;
}

.admin-app .brand-divider {
    width: 1px;
    height: 28px;
    background: var(--ui-line);
}

.admin-app .system-name {
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-app .topbar-center {
    display: flex;
    justify-content: center;
}

.admin-app .branch-box {
    gap: 10px;
    padding: 6px 8px 6px 16px;
    border-radius: 999px;
    background: var(--ui-soft);
}

.admin-app .branch-label {
    color: var(--ui-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.admin-app #locationSelector {
    width: 220px;
    height: 38px;
    padding: 0 34px 0 13px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--ui-ink);
    box-shadow: none;
    font-size: 14px;
    font-weight: 700;
}

.admin-app .topbar-actions {
    justify-content: flex-end;
    gap: 9px;
}

.admin-app .current-user {
    margin-right: 4px;
    color: var(--ui-muted);
    font-size: 13px;
    font-weight: 700;
}

.admin-app .header-icon-button,
.admin-app .logout-button {
    min-width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border: 0;
    border-radius: 14px;
    background: var(--ui-soft);
    color: var(--ui-text);
    box-shadow: none;
    font-size: 13px;
    font-weight: 800;
}

.admin-app .header-icon-button:hover,
.admin-app .logout-button:hover {
    background: var(--ui-blue-soft);
    color: var(--ui-blue-dark);
}

.admin-app .header-png-icon,
.admin-app .logout-png-icon {
    width: 25px;
    height: 25px;
    object-fit: contain;
    filter: none;
}

.admin-app .settings-theme-icon {
    width: 35px;
    flex: 0 0 35px;
    text-align: center;
    font-size: 27px;
    font-weight: 700;
    line-height: 1;
}

.admin-app .settings-area {
    position: relative;
    align-items: center;
}

.admin-app .settings-menu[hidden] {
    display: none;
}

.admin-app .settings-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 5000;
    width: 250px;
    padding: 10px;
    border: 1px solid var(--ui-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 55px rgba(24, 31, 40, .16);
}

.admin-app .settings-menu-title {
    padding: 8px 11px 11px;
    color: var(--ui-ink);
    font-size: 16px;
    font-weight: 800;
}

.admin-app .settings-menu button {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
    border: 0;
    border-radius: 13px;
    background: #fff;
    color: var(--ui-text);
    font-size: 14px;
    font-weight: 800;
    text-align: left;
}

.admin-app .settings-menu button:hover {
    background: var(--ui-blue-soft);
    color: var(--ui-blue-dark);
}

.admin-app .settings-menu button img {
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    object-fit: contain;
    filter: none;
}

/* =========================================================
   NAVEGACION SUPERIOR Y ACCESOS
========================================================= */

.admin-app .main-tabs {
    height: 55px;
    display: flex;
    align-items: stretch;
    gap: 26px;
    padding: 0 clamp(20px, 4vw, 54px);
    overflow-x: auto;
    border-bottom: 1px solid var(--ui-line);
    background: #fff;
}

.admin-app .main-tab {
    position: relative;
    min-width: max-content;
    height: 55px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ui-muted);
    box-shadow: none;
    font-size: 15px;
    font-weight: 800;
}

.admin-app .main-tab-icon {
    width: 25px;
    height: 25px;
    object-fit: contain;
    filter: none;
}

.admin-app .main-tab:hover,
.admin-app .main-tab.active {
    border: 0;
    background: transparent;
    color: var(--ui-ink);
    box-shadow: none;
}

.admin-app .main-tab.active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: var(--ui-blue);
}

.admin-app .command-bar {
    min-height: 100px;
    overflow-x: auto;
    border-bottom: 1px solid var(--ui-line);
    background: #fff;
    box-shadow: none;
}

.admin-app .command-panel {
    min-height: 100px;
    padding: 14px clamp(18px, 4vw, 54px);
}

.admin-app .command-panel.active {
    display: block;
}

.admin-app .command-group {
    display: flex;
    gap: 9px;
}

.admin-app .command-button {
    width: 94px;
    min-width: 94px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 7px;
    border: 0;
    border-radius: 17px;
    background: transparent;
    color: var(--ui-muted);
    box-shadow: none;
    font-size: 12px;
    font-weight: 700;
}

.admin-app .command-button:hover,
.admin-app .command-button.active {
    border: 0;
    background: var(--ui-blue-soft);
    color: var(--ui-blue-dark);
    box-shadow: none;
}

.admin-app .command-icon {
    width: 40px;
    height: 40px;
}

.admin-app .command-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: none;
}

.admin-app .command-text {
    max-width: 88px;
    color: inherit;
    line-height: 1.1;
}

/* =========================================================
   CONTENIDO Y TARJETAS
========================================================= */

.admin-app main {
    width: min(100%, 1440px);
    flex: 1;
    margin: 0 auto;
    padding: 42px clamp(18px, 4vw, 56px) 110px;
    background: #fff;
}

.admin-app h1 {
    margin: 0;
    color: var(--ui-ink);
    font-size: clamp(32px, 4vw, 46px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.045em;
    text-shadow: none;
}

.admin-app .dashboard-greeting {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 28px;
    color: var(--ui-ink);
    font-size: clamp(40px, 5vw, 60px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.05em;
}

.admin-app .dashboard-greeting-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25em;
    height: 1.25em;
    font-size: .76em;
    line-height: 1;
    letter-spacing: 0;
}

.admin-app h1.dashboard-title {
    font-size: clamp(21px, 2.2vw, 27px);
    line-height: 1.15;
    letter-spacing: -.025em;
}

.admin-app h3 {
    margin: 0 0 22px;
    color: var(--ui-ink);
    font-size: 20px;
    font-weight: 800;
}

.admin-app .sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 30px;
    color: var(--ui-muted);
    font-size: 15px;
    line-height: 1.45;
}

.admin-app .location-chip {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--ui-blue-soft);
    color: var(--ui-blue-dark);
    box-shadow: none;
    font-size: 12px;
    font-weight: 800;
}

.admin-app .grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.admin-app .card {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius);
    background: #fff;
    box-shadow: var(--ui-shadow);
}

.admin-app .grid .card {
    min-height: 148px;
    justify-content: center;
    border: 0;
    border-top: 0;
    background: var(--ui-soft);
    box-shadow: none;
}

.admin-app .grid .card:first-child {
    background: var(--ui-blue);
}

.admin-app .grid .card:first-child .label,
.admin-app .grid .card:first-child .value {
    color: #fff;
}

.admin-app .label {
    margin-bottom: 12px;
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .07em;
}

.admin-app .value {
    color: var(--ui-ink);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 800;
    letter-spacing: -.045em;
}

.admin-app .two {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
    gap: 16px;
    margin-top: 16px;
}

.admin-app .card > b {
    display: block;
    margin-bottom: 18px;
    color: var(--ui-ink);
    font-size: 19px;
    font-weight: 800;
}

.admin-app .card > p {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 15px 0;
    border-bottom: 1px solid var(--ui-line);
    font-size: 14px;
    font-weight: 700;
}

.admin-app .card > p:last-child {
    border-bottom: 0;
}

.admin-app .card > p strong {
    color: var(--ui-blue-dark);
    white-space: nowrap;
}

/* =========================================================
   BUSQUEDA, TABLAS Y FORMULARIOS
========================================================= */

.admin-app #productSearch {
    width: 100%;
    height: 58px;
    margin: 0 0 22px;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    background: var(--ui-soft);
    color: var(--ui-ink);
    box-shadow: none;
    font-size: 17px;
    font-weight: 700;
}

.admin-app #productSearch::placeholder {
    color: #c3c6ca;
}

.admin-app #productSearch:focus {
    outline: 3px solid rgba(9, 167, 236, .17);
}

.admin-app .product-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    align-items: center;
    gap: 10px;
    margin: 0 0 22px;
}

.admin-app .product-search-row #productSearch {
    margin: 0;
}

.admin-app .barcode-search-button {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 17px;
    background: var(--ui-blue);
    color: #fff;
}

.admin-app .barcode-search-button svg {
    width: 31px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
}

.admin-app .product-match td {
    background: var(--ui-blue-soft) !important;
    color: var(--ui-ink);
}

.admin-app .barcode-dialog,
.admin-app .permissions-dialog {
    width: min(calc(100% - 28px), 540px);
    padding: 25px;
    border: 1px solid var(--ui-line);
    border-radius: 22px;
    background: var(--ui-surface);
    color: var(--ui-text);
    box-shadow: 0 25px 80px rgba(0, 0, 0, .28);
}

.admin-app .barcode-dialog::backdrop,
.admin-app .permissions-dialog::backdrop {
    background: rgba(8, 11, 16, .62);
    backdrop-filter: blur(3px);
}

.admin-app .barcode-dialog p,
.admin-app .permissions-dialog p,
.admin-app .permissions-fieldset p {
    color: var(--ui-muted);
    font-size: 13px;
}

.admin-app .barcode-dialog button,
.admin-app .barcode-dialog input {
    width: 100%;
    margin-bottom: 11px;
}

.admin-app .permissions-fieldset {
    margin: 6px 0 18px;
    padding: 16px;
    border: 1px solid var(--ui-line);
    border-radius: 16px;
}

.admin-app .permissions-fieldset legend {
    padding: 0 6px;
    color: var(--ui-ink);
    font-weight: 800;
}

.admin-app .permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.admin-app .permission-option {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--ui-soft);
    color: var(--ui-text);
    font-size: 13px;
    font-weight: 700;
}

.admin-app .permission-option input {
    width: 19px !important;
    min-height: 19px !important;
    margin: 0 !important;
    accent-color: var(--ui-blue);
}

.admin-app .dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 20px;
}

.admin-app .dialog-close-button {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: var(--ui-soft);
    color: var(--ui-text);
    font-weight: 800;
}

.permission-hidden {
    display: none !important;
}

.admin-app .scroll {
    width: 100%;
    overflow-x: auto;
    border: 0;
    border-radius: 16px;
    background: #fff;
}

.admin-app table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.admin-app th {
    padding: 14px 13px;
    border-bottom: 2px solid var(--ui-line);
    background: #fff;
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: left;
    text-shadow: none;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-app td {
    padding: 18px 13px;
    border-bottom: 1px solid var(--ui-line);
    color: var(--ui-text);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.admin-app tbody tr:nth-child(even),
.admin-app tbody tr:hover {
    background: #fff;
}

.admin-app tbody tr:hover td {
    background: #fbfdff;
}

.admin-app tbody tr:last-child td {
    border-bottom: 0;
}

.admin-app input:not(#productSearch):not(#loginUser):not(#loginPass),
.admin-app .form-select,
.admin-app .branding-form-column input[type="text"],
.admin-app .branding-form-column input[type="file"] {
    width: 100%;
    min-height: 50px;
    margin-bottom: 13px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--ui-soft);
    color: var(--ui-ink);
    box-shadow: none;
    font-size: 15px;
}

.admin-app input:focus,
.admin-app .form-select:focus {
    border-color: var(--ui-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(9, 167, 236, .12);
}

.admin-app .primary-button,
.admin-app .secondary-button,
.admin-app .management-actions button {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: var(--ui-soft);
    color: var(--ui-text);
    box-shadow: none;
    font-size: 13px;
    font-weight: 800;
}

.admin-app .primary-button,
.admin-app .branding-actions .primary-button {
    background: var(--ui-blue);
    color: #fff;
}

.admin-app .primary-button:hover,
.admin-app .branding-actions .primary-button:hover {
    background: var(--ui-blue-dark);
}

.admin-app .secondary-button:hover,
.admin-app .management-actions button:hover {
    background: var(--ui-blue-soft);
    color: var(--ui-blue-dark);
}

.admin-app .danger-button {
    background: #fff0f3 !important;
    color: var(--ui-danger) !important;
}

.admin-app .management-row {
    padding: 18px 0;
    border-bottom: 1px solid var(--ui-line);
}

.admin-app .management-info strong {
    color: var(--ui-ink);
    font-size: 15px;
}

.admin-app .management-info span,
.admin-app .management-info small,
.admin-app .branding-help {
    color: var(--ui-muted);
    font-size: 13px;
}

.admin-app .branding-card {
    grid-template-columns: minmax(0, 620px);
    border-top: 0;
}

.admin-app .branding-preview-box,
.admin-app .login-background-preview {
    border: 0;
    border-radius: 18px;
    background-color: var(--ui-soft);
}

/* =========================================================
   NAVEGACION INFERIOR MOVIL
========================================================= */

.admin-app .mobile-nav {
    display: none;
}

.admin-app .mobile-more-backdrop,
.admin-app .mobile-more-sheet {
    display: none;
}

/* =========================================================
   AVISOS PWA
========================================================= */

.admin-app .connection-notice {
    bottom: 92px;
    padding: 12px 18px;
    border-radius: 999px;
    font-size: 14px;
    box-shadow: var(--ui-shadow);
}

.admin-app .connection-notice--offline {
    background: var(--ui-danger);
}

.admin-app .connection-notice--online {
    background: var(--ui-success);
}

.admin-app .install-app-button {
    right: 18px;
    bottom: 18px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 14px;
    background: var(--ui-blue);
    box-shadow: 0 12px 26px rgba(9, 167, 236, .22);
    font-size: 14px;
}

/* =========================================================
   PORTAL DE CLIENTES
========================================================= */

.portal-page .topbar {
    height: 78px;
    border-bottom: 1px solid var(--ui-line);
    background: #fff;
}

.portal-page .topbar-inner {
    width: min(1220px, calc(100% - 40px));
}

.portal-page .logo {
    height: 48px;
}

.portal-page .portal-name {
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.portal-page .page {
    width: min(1220px, calc(100% - 40px));
    margin: 44px auto 70px;
}

.portal-page .hello {
    color: var(--ui-muted);
    font-size: 15px;
    font-weight: 700;
}

.portal-page .welcome h1 {
    color: var(--ui-ink);
    font-size: clamp(32px, 4vw, 44px);
    font-weight: 800;
    letter-spacing: -.04em;
}

.portal-page .welcome p {
    color: var(--ui-muted);
    font-size: 14px;
}

.portal-page .balance-box {
    padding: 28px;
    border: 0;
    border-radius: var(--ui-radius);
    background: var(--ui-blue);
    box-shadow: none;
}

.portal-page .balance-left small,
.portal-page .balance-value,
.portal-page .meta-item span,
.portal-page .meta-item strong {
    color: #fff;
}

.portal-page .balance-value {
    font-size: clamp(34px, 5vw, 48px);
    font-weight: 800;
}

.portal-page .panel {
    overflow: hidden;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius);
    background: #fff;
    box-shadow: var(--ui-shadow);
}

.portal-page .panel-title {
    padding: 24px 26px 20px;
    border-bottom: 1px solid var(--ui-line);
}

.portal-page .panel-title h2 {
    color: var(--ui-ink);
    font-size: 21px;
    font-weight: 800;
}

.portal-page .panel-title p {
    color: var(--ui-muted);
    font-size: 13px;
}

.portal-page .filters {
    gap: 13px;
    padding: 20px 26px;
    border-bottom: 1px solid var(--ui-line);
    background: #fff;
}

.portal-page .field label {
    color: var(--ui-text);
    font-size: 12px;
    font-weight: 800;
}

.portal-page .field input,
.portal-page .field select {
    height: 48px;
    padding: 0 14px;
    border: 0;
    border-radius: 13px;
    background: var(--ui-soft);
    color: var(--ui-ink);
    font-size: 14px;
}

.portal-page .field input:focus,
.portal-page .field select:focus {
    border: 0;
    box-shadow: 0 0 0 3px rgba(9, 167, 236, .15);
}

.portal-page .pdf-link {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 0 12px;
    border-radius: 9px;
    background: var(--ui-blue-soft);
    color: var(--ui-blue-dark);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.portal-page .clear-button {
    height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 13px;
    background: var(--ui-blue-soft);
    color: var(--ui-blue-dark);
    font-size: 12px;
    font-weight: 800;
}

.portal-page th {
    padding: 14px;
    border-bottom: 2px solid var(--ui-line);
    color: var(--ui-muted);
    font-size: 11px;
}

.portal-page td {
    padding: 18px 14px;
    border-bottom: 1px solid var(--ui-line);
    color: var(--ui-text);
    font-size: 13px;
    font-weight: 600;
}

.portal-page tbody tr:hover {
    background: #fbfdff;
}

.portal-page .status {
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
}

.portal-page .table-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--ui-line);
    background: #fff;
    color: var(--ui-muted);
    font-size: 12px;
}

.portal-page .loading,
.portal-page .error {
    border: 0;
    border-radius: var(--ui-radius);
    background: var(--ui-soft);
    color: var(--ui-muted);
    box-shadow: none;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1050px) {
    .admin-app .topbar {
        grid-template-columns: 1fr auto;
    }

    .admin-app .topbar-center {
        display: none;
    }

    .admin-app .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-app .two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .admin-app .login-screen {
        align-items: flex-start;
        padding: 28px 18px 44px;
    }

    .admin-app .login-box {
        width: 100%;
        max-width: 520px;
        padding: 0;
    }

    .admin-app .login-heading {
        margin-bottom: clamp(54px, 10vh, 92px);
    }

    .admin-app .login-heading h1 {
        font-size: 32px;
    }

    .admin-app .login-back {
        font-size: 38px;
    }

    .admin-app .login-brand {
        margin-top: clamp(34px, 7vh, 66px);
        margin-bottom: clamp(54px, 9vh, 82px);
    }

    .admin-app .login-logo {
        width: min(82%, 300px);
        height: auto;
        border-radius: 0;
    }

    .admin-app .login-fields label {
        font-size: 16px;
    }

    .admin-app .login-fields input {
        height: 52px;
        font-size: 17px;
    }

    .admin-app .topbar {
        min-height: 64px;
        grid-template-columns: 1fr auto;
        padding: 9px 12px;
    }

    .admin-app .topbar-logo {
        width: 148px;
        height: 48px;
    }

    .admin-app .brand-divider,
    .admin-app .system-name,
    .admin-app .current-user,
    .admin-app .logout-button span,
    .admin-app .header-action-label {
        display: none;
    }

    .admin-app .header-icon-button,
    .admin-app .logout-button {
        min-width: 42px;
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 13px;
    }

    .admin-app .settings-menu {
        position: fixed;
        top: 72px;
        right: 12px;
        left: 12px;
        width: auto;
        padding: 12px;
        border-radius: 20px;
    }

    .admin-app .main-tabs,
    .admin-app .command-bar {
        display: none;
    }

    .admin-app main {
        padding: 32px 16px 112px;
    }

    .admin-app h1 {
        font-size: 36px;
    }

    .admin-app .dashboard-greeting {
        gap: 10px;
        margin-bottom: 22px;
        font-size: 38px;
    }

    .admin-app h1.dashboard-title {
        font-size: 23px;
    }

    .admin-app .sub {
        margin-bottom: 24px;
        font-size: 14px;
    }

    .admin-app .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .admin-app .grid .card {
        min-height: 126px;
        padding: 18px;
        border-radius: 19px;
    }

    .admin-app .label {
        font-size: 10px;
    }

    .admin-app .value {
        font-size: 25px;
    }

    .admin-app .card {
        padding: 18px;
        border-radius: 20px;
    }

    .admin-app .scroll {
        margin: 0 -4px;
    }

    .admin-app th,
    .admin-app td {
        padding-right: 12px;
        padding-left: 12px;
    }

    .admin-app .management-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .admin-app .mobile-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        height: 78px;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        padding: 7px 5px max(7px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--ui-line);
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -10px 30px rgba(23, 30, 38, .06);
        backdrop-filter: blur(16px);
    }

    .admin-app .mobile-nav button {
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        padding: 3px;
        border: 0;
        border-radius: 16px;
        background: transparent;
        color: var(--ui-muted);
        font-size: 10px;
        font-weight: 700;
    }

    .admin-app .mobile-nav button.active {
        background: var(--ui-blue);
        color: #fff;
        font-weight: 800;
    }

    .admin-app .mobile-nav-icon {
        width: 25px;
        height: 25px;
        object-fit: contain;
        filter: none;
    }

    .admin-app .mobile-more-backdrop:not([hidden]) {
        position: fixed;
        inset: 0;
        z-index: 1090;
        display: block;
        background: rgba(9, 11, 15, .34);
        backdrop-filter: blur(2px);
    }

    .admin-app .mobile-more-sheet:not([hidden]) {
        position: fixed;
        right: 10px;
        bottom: calc(84px + env(safe-area-inset-bottom));
        left: 10px;
        z-index: 1100;
        display: block;
        padding: 9px 16px 20px;
        border: 1px solid var(--ui-line);
        border-radius: 26px;
        background: #fff;
        box-shadow: 0 22px 60px rgba(9, 11, 15, .2);
    }

    .admin-app .mobile-more-handle {
        width: 46px;
        height: 5px;
        margin: 0 auto 15px;
        border-radius: 999px;
        background: #d7dade;
    }

    .admin-app .mobile-more-title {
        margin-bottom: 14px;
        color: var(--ui-ink);
        font-size: 19px;
        font-weight: 800;
    }

    .admin-app .mobile-more-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .admin-app .mobile-more-grid button {
        min-height: 92px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 8px;
        padding: 12px 8px;
        border: 0;
        border-radius: 18px;
        background: var(--ui-soft);
        color: var(--ui-ink);
        font-size: 13px;
        font-weight: 800;
        text-align: center;
    }

    .admin-app .mobile-more-grid button.active {
        background: var(--ui-blue-soft);
        color: var(--ui-blue-dark);
    }

    .admin-app .mobile-more-grid img {
        width: 34px;
        height: 34px;
        object-fit: contain;
    }

    .admin-app .install-app-button {
        right: 12px;
        bottom: 88px;
    }

    .portal-page .topbar {
        height: 66px;
    }

    .portal-page .topbar-inner,
    .portal-page .page {
        width: calc(100% - 28px);
    }

    .portal-page .logo {
        height: 41px;
    }

    .portal-page .page {
        margin-top: 30px;
    }

    .portal-page .welcome h1 {
        font-size: 34px;
    }

    .portal-page .balance-box {
        padding: 23px;
        border-radius: 20px;
    }

    .portal-page .balance-meta {
        gap: 22px;
    }

    .portal-page .panel {
        border-radius: 20px;
    }

    .portal-page .filters {
        grid-template-columns: 1fr;
        padding: 18px;
    }
}

@media (max-width: 430px) {
    .admin-app .grid {
        grid-template-columns: 1fr;
    }

    .admin-app .grid .card {
        min-height: 112px;
    }

    .admin-app .mobile-nav button span {
        max-width: 62px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .portal-page .balance-meta {
        width: 100%;
        justify-content: space-between;
    }

    .admin-app .permissions-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

/* =========================================================
   MODO OSCURO
========================================================= */

html[data-theme="dark"] {
    color-scheme: dark;
    --ui-blue: #20b4f4;
    --ui-blue-dark: #6dcefa;
    --ui-blue-soft: #123649;
    --ui-ink: #f6f8fb;
    --ui-text: #e2e6ec;
    --ui-muted: #a5adb8;
    --ui-line: #303640;
    --ui-soft: #252a32;
    --ui-surface: #111318;
    --ui-shadow: 0 14px 42px rgba(0, 0, 0, .28);
}

html[data-theme="dark"],
html[data-theme="dark"] body.admin-app,
html[data-theme="dark"] .admin-app .system-shell,
html[data-theme="dark"] .admin-app main {
    background: var(--ui-surface);
    color: var(--ui-text);
}

html[data-theme="dark"] .admin-app .login-screen,
html[data-theme="dark"] .admin-app .login-fields input,
html[data-theme="dark"] .admin-app .topbar,
html[data-theme="dark"] .admin-app .main-tabs,
html[data-theme="dark"] .admin-app .command-bar,
html[data-theme="dark"] .admin-app .settings-menu,
html[data-theme="dark"] .admin-app .settings-menu button,
html[data-theme="dark"] .admin-app .card,
html[data-theme="dark"] .admin-app .scroll,
html[data-theme="dark"] .admin-app table,
html[data-theme="dark"] .admin-app th,
html[data-theme="dark"] .admin-app tbody tr:nth-child(even),
html[data-theme="dark"] .admin-app tbody tr:hover,
html[data-theme="dark"] .admin-app .mobile-nav,
html[data-theme="dark"] .admin-app .mobile-more-sheet:not([hidden]) {
    background: #171a20;
}

html[data-theme="dark"] .admin-app .login-logo {
    padding: 8px;
    border-radius: 14px;
    background: #fff;
}

html[data-theme="dark"] .admin-app .branch-box select,
html[data-theme="dark"] .admin-app input:not(#loginUser):not(#loginPass),
html[data-theme="dark"] .admin-app .form-select,
html[data-theme="dark"] .admin-app .branding-form-column input,
html[data-theme="dark"] .admin-app #productSearch {
    background: var(--ui-soft);
    color: var(--ui-ink);
}

html[data-theme="dark"] .admin-app tbody tr:hover td {
    background: #20252c;
}

html[data-theme="dark"] .admin-app .danger-button {
    background: #421d27 !important;
}

html[data-theme="dark"] .admin-app .native-sync-status {
    border-color: var(--ui-line);
    background: rgba(23, 26, 32, .97);
}

html[data-theme="dark"] .admin-app .mobile-more-backdrop:not([hidden]) {
    background: rgba(0, 0, 0, .62);
}
