/* Capa de diseño del panel del celular: menos cajas, mas aire, una sola jerarquia (estilo iOS).
   Va al final de las hojas de estilo y solo cambia presentacion: ninguna funcion ni id cambia. */

:root {
    --bg: #f2f2f7;
    --line: rgba(60, 60, 67, .13);
    --muted: #7c7c82;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04);
    --relleno: rgba(118, 118, 128, .12);
}

:root.oscuro {
    --bg: #000;
    --line: rgba(255, 255, 255, .1);
    --relleno: rgba(118, 118, 128, .28);
}

body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }

/* ---- Encabezados: titulo grande y limpio ---- */
.dueno-app { padding-top: calc(10px + env(safe-area-inset-top)); }
.dueno-header { gap: 10px; margin-bottom: 14px; }
.dueno-header h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.dueno-saludo { font-size: 13px; font-weight: 600; letter-spacing: 0; }
.dueno-estado { font-size: 12px; opacity: .85; }
.dueno-menu-boton { align-self: flex-start; border: 0; background: var(--relleno); border-radius: 50%; width: 36px; height: 36px; }
#duenoApp .dueno-header-nexo { display: none; }

/* ---- Barra "Dile a Nexo": una linea, sin marco grueso; los ejemplos aparecen al escribir ---- */
.dnx-barra { margin: 4px 0 16px; gap: 10px; }
.dnx-barra-campo { border: 0 !important; background: var(--relleno) !important; box-shadow: none !important; border-radius: 14px !important; padding: 4px 4px 4px 14px !important; }
.dnx-barra-campo input { font-size: 17px !important; padding: 8px 0 !important; }
.dnx-barra-campo input::placeholder { color: var(--muted); }
.dnx-mic, .dnx-enviar { width: 36px !important; height: 36px !important; border-radius: 50% !important; }
.dnx-mic { background: transparent !important; }
.dnx-ejemplos { display: none !important; }
.dnx-barra:focus-within .dnx-ejemplos { display: flex !important; }

/* ---- Inicio: ventas y numeros en UNA tarjeta ---- */
#duenoApp .dueno-kpis { gap: 0; margin-bottom: 18px; padding: 18px 0 16px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
#duenoApp .dueno-kpis .kpi { padding: 0 16px; border-radius: 0; background: none; box-shadow: none; animation: none; }
#duenoApp .dueno-kpis .kpi + .kpi + .kpi { border-left: 1px solid var(--line); }
#duenoApp .dueno-kpis .kpi-ventas { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); background: none; }
#duenoApp .kpi span { font-size: 12px; font-weight: 600; color: var(--muted); }
#duenoApp .kpi strong { margin: 4px 0 2px; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
#duenoApp .kpi-ventas strong { font-size: clamp(34px, 9vw, 42px); font-weight: 800; letter-spacing: -.035em; }
#duenoApp .kpi small { font-size: 12px; font-weight: 500; color: var(--muted); }
#duenoApp .dueno-sparkline { height: 34px; margin-top: 12px; opacity: .9; }

/* ---- Pendientes: una lista agrupada, no tres tarjetas ---- */
.dueno-grid { gap: 16px; }
.dueno-alertas { gap: 0; overflow: hidden; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.dalerta { padding: 14px 16px; border-radius: 0; background: transparent; box-shadow: none; gap: 14px; }
.dalerta + .dalerta { border-top: 1px solid var(--line); }
.dalerta:active { background: var(--relleno); transform: none; }
.dalerta-icono { width: 38px; height: 38px; border-radius: 11px; }
.dalerta-icono svg { width: 20px; height: 20px; }
.dalerta-texto small { font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.dalerta-texto strong { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.dalerta-texto em { font-size: 13px; }
.dalerta-flecha { font-size: 22px; opacity: .55; }

.dueno-card { border: 0; border-radius: 22px; box-shadow: var(--shadow); }
.fila-dueno { border: 0; }
:root.oscuro .dueno-card, :root.oscuro .fila-dueno { border: 0; }
.card-head span { font-weight: 600; }
.card-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }

/* ---- Inventario: sin tarjeta alrededor del buscador y las herramientas ---- */
#duenoInventario .dueno-card:not(.dueno-card-wide) { padding: 0; background: transparent; box-shadow: none; }
#duenoInventario input[type="search"] { width: 100%; height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--relleno); color: var(--text); font-size: 17px; }
#duenoInventario input[type="search"]::placeholder { color: var(--muted); }
#duenoInventario .dueno-chips-categorias { display: flex; gap: 8px; margin: 12px 0 0; overflow-x: auto; scrollbar-width: none; }
#duenoInventario .dueno-chips-categorias::-webkit-scrollbar { display: none; }
#duenoInventario .dueno-chip-categoria { padding: 8px 14px; border: 0; background: var(--relleno); color: var(--text); font-size: 13.5px; font-weight: 600; }
#duenoInventario .dueno-chip-categoria.activo { background: var(--text); color: var(--surface); }
#duenoInventario .dueno-chip-categoria.dueno-chip-alerta { color: var(--red); }
#duenoInventario .dueno-chip-categoria.dueno-chip-alerta.activo { background: var(--red); color: #fff; }

/* acciones de producto: una fila de pildoras que se desliza */
#duenoInventarioAcciones { display: flex !important; flex-wrap: nowrap; gap: 8px; margin: 14px 0 0; overflow-x: auto; scrollbar-width: none; }
#duenoInventarioAcciones::-webkit-scrollbar { display: none; }
#duenoInventarioAcciones[style*="display:none"], #duenoInventarioAcciones[style*="display: none"] { display: none !important; }
#duenoInventarioAcciones button { flex: none; width: auto; margin: 0; padding: 10px 16px; border: 0; border-radius: 999px; background: var(--brand-soft) !important; color: var(--brand) !important; font-size: 14px; font-weight: 700; white-space: nowrap; }
#duenoInventarioAcciones button:first-child { background: var(--brand) !important; color: #fff !important; }

/* herramientas de la tienda: iconos en cuadricula de 3, sin cajas */
#dmAccesosInv { padding: 4px 0 0 !important; background: transparent !important; box-shadow: none !important; gap: 12px; }
#dmAccesosInv .dm-accesos-cab span { display: none; }
#dmAccesosInv .dm-accesos-cab h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
#dmAccesosInv .dm-accesos-cab button { padding: 6px 10px; border-radius: 999px; font-size: 13px; }
#dmAccesosInv .dm-cuadricula { grid-template-columns: repeat(3, 1fr); gap: 16px 8px; padding: 18px 8px 16px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
#dmAccesosInv .dm-cuadricula button { flex-direction: column; justify-content: flex-start; gap: 8px; padding: 0; border-radius: 0; background: none !important; box-shadow: none; color: var(--text) !important; font-size: 12.5px; font-weight: 600; line-height: 1.2; text-align: center; grid-column: auto !important; }
#dmAccesosInv .dm-icono-caja { width: 54px; height: 54px; border-radius: 16px; }

/* lista de productos: una sola tarjeta con lineas finas */
#duenoInventario .dueno-card-wide { padding: 4px 16px; background: var(--surface); }
#duenoInventario .lista-compacta { gap: 0; }
#duenoInventario .fila-dueno { padding: 12px 0; border-radius: 0; background: transparent; gap: 12px; }
#duenoInventario .fila-dueno + .fila-dueno { border-top: 1px solid var(--line); }
#duenoInventario .fila-dueno strong { font-size: 15px; font-weight: 600; }
#duenoInventario .fila-dueno span { font-size: 12.5px; }
#duenoInventario .dueno-miniatura { width: 46px; height: 46px; border-radius: 10px; }

/* ---- Barra inferior: capsula flotante de vidrio (Liquid Glass), con el contenido pasando por detras ---- */
.dueno-tabs {
    left: 50%; right: auto; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    width: min(540px, calc(100% - 24px)); padding: 6px; gap: 2px; border-radius: 32px;
    background: rgba(255, 255, 255, .55);
    -webkit-backdrop-filter: blur(24px) saturate(190%); backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, .6);
    box-shadow: 0 10px 32px rgba(15, 23, 42, .16), inset 0 1px 0 rgba(255, 255, 255, .75);
}
:root.oscuro .dueno-tabs { background: rgba(44, 44, 48, .5); border-color: rgba(255, 255, 255, .13); box-shadow: 0 10px 32px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .12); }
.dueno-tabs button { padding: 7px 2px 6px; border-radius: 26px; transition: background-color .2s ease, color .2s ease; }
.dueno-tabs button.activo { background: rgba(120, 120, 128, .2); color: var(--brand); }
.dueno-tabs button.activo::before { display: none; }
.dueno-tabs button:not(.activo) { opacity: .8; }
.dueno-tab-badge { right: 24%; top: 0; }
/* lo flotante sube para no quedar tapado por la capsula */
.dueno-nexo-burbuja { bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
.dueno-toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .dueno-tabs { background: var(--surface); }
}

/* ---- Menu Mas: accesos destacados sin bordes de color, mismo ritmo que la lista ---- */
#duenoMas .dueno-status-card { margin-bottom: 14px; background: var(--surface); }
#duenoMas .dx-entrada, #duenoMas .da-entrada, #duenoMas #dtEntrada, #duenoMas [id$="Entrada"] {
    display: grid; grid-template-columns: 38px minmax(0, 1fr); column-gap: 14px; align-items: center; width: 100%; margin: 0 0 10px; padding: 12px 14px;
    border: 0 !important; border-radius: 18px; background: var(--surface) !important; box-shadow: var(--shadow); color: var(--text) !important; text-align: left;
}
#duenoMas .dx-entrada > span, #duenoMas .da-entrada > span, #duenoMas [id$="Entrada"] > span { grid-row: 1 / 3; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); font-size: 19px; }
#duenoMas .dx-entrada b, #duenoMas .da-entrada b, #duenoMas [id$="Entrada"] b { font-size: 15px; font-weight: 600; }
#duenoMas .dx-entrada small, #duenoMas .da-entrada small, #duenoMas [id$="Entrada"] small { color: var(--muted); font-size: 12.5px; font-weight: 400; }

/* Buscador de Creditos/Fiado igual que el de Inventario */
#duenoCreditos input[type="search"] { display: block; width: 100%; height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--relleno); color: var(--text); font-size: 17px; font-family: inherit; }
#duenoCreditos input[type="search"]::placeholder { color: var(--muted); }
#duenoCreditos .dueno-card { background: var(--surface); }

/* ---- Instalar Nexo como app (despues de escanear el QR) ---- */
.dui-capa { position: fixed; inset: 0; z-index: 99990; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 23, 42, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: duiFondo .25s ease; }
.dui-capa.saliendo { opacity: 0; transition: opacity .2s; }
.dui-hoja { width: min(480px, 100%); max-height: 92vh; overflow-y: auto; display: grid; gap: 12px; justify-items: center; padding: 26px 22px calc(24px + env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0; background: var(--surface, #fff); color: var(--text, #0f172a); text-align: center; box-shadow: 0 -20px 60px rgba(0, 0, 0, .3); animation: duiSube .35s cubic-bezier(.2, .8, .2, 1); }
.dui-nexo { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; object-position: center 15%; box-shadow: 0 10px 24px rgba(37, 99, 255, .3); }
.dui-hoja h2 { margin: 2px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.dui-sub { margin: 0; max-width: 340px; color: var(--muted, #66738a); font-size: 14.5px; font-weight: 500; line-height: 1.45; }
.dui-bonos { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 2px 0; padding: 0; list-style: none; }
.dui-bonos li { padding: 8px 14px; border-radius: 999px; background: var(--brand-soft, #eaf0ff); font-size: 13px; font-weight: 700; }
.dui-pasos { display: grid; gap: 8px; width: 100%; margin: 4px 0; padding: 0; list-style: none; text-align: left; }
.dui-pasos li { display: grid; grid-template-columns: 26px 40px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--surface-soft, #f1f4f9); }
.dui-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand, #2563ff); color: #fff; font-size: 13px; font-weight: 800; }
.dui-icono { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface, #fff); color: var(--brand, #2563ff); font-size: 20px; }
.dui-pasos b { display: block; font-size: 14px; }
.dui-pasos small { display: block; margin-top: 1px; color: var(--muted, #66738a); font-size: 12px; font-weight: 500; }
.dui-principal, .dui-suave { width: 100%; min-height: 52px; border: 0; border-radius: 16px; font: inherit; font-size: 16px; font-weight: 800; }
.dui-principal { background: var(--brand, #2563ff); color: #fff; box-shadow: 0 10px 22px rgba(37, 99, 255, .3); }
.dui-principal:disabled { opacity: .6; }
.dui-suave { background: transparent; color: var(--muted, #66738a); font-size: 14.5px; min-height: 44px; }
.dui-nota { margin: 0; color: var(--muted, #66738a); font-size: 12px; font-weight: 500; line-height: 1.4; }
.dui-error { margin: 0; color: var(--red, #dc2626); font-size: 13px; font-weight: 700; }
.dui-codigo { display: flex; align-items: center; gap: 5px; margin: 6px 0; }
.dui-codigo span { display: grid; place-items: center; width: 34px; height: 46px; border-radius: 11px; background: #0b1b3a; color: #fff; font: 800 22px/1 ui-monospace, Menlo, Consolas, monospace; box-shadow: 0 6px 14px rgba(11, 27, 58, .28); }
.dui-codigo i { width: 12px; height: 4px; border-radius: 2px; background: #94a3b8; }
:root.oscuro .dui-codigo span { background: #f1f5f9; color: #0b1b3a; }
@keyframes duiFondo { from { opacity: 0; } }
@keyframes duiSube { from { transform: translateY(60px); opacity: 0; } }
@media (min-width: 560px) { .dui-capa { align-items: center; } .dui-hoja { border-radius: 30px; } }
@media (prefers-reduced-motion: reduce) { .dui-capa, .dui-hoja { animation: none; } }

.dui-copiar { min-height: 46px; padding: 0 22px; border: 1.5px solid var(--brand, #2563ff); border-radius: 14px; background: transparent !important; color: var(--brand, #2563ff) !important; font: inherit; font-size: 15px; font-weight: 800; transition: background .2s, color .2s; }
.dui-copiar.ok { background: #16a34a !important; border-color: #16a34a; color: #fff !important; }

/* Entrada con QR: boton para escanear el QR de la computadora */
.dueno-login-o { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; color: var(--muted, #66738a); font-size: 12.5px; font-weight: 700; }
.dueno-login-o::before, .dueno-login-o::after { content: ""; flex: 1; height: 1px; background: var(--line, rgba(60, 60, 67, .13)); }
.dueno-boton-qr { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; font-weight: 800; }
