/* TuMarketSV — Capa "Pro" (elevación visual sobre tmsv.css, sin tocar la base).
   Objetivo: premium, editorial, cálido y operable. Carga DESPUÉS de tmsv.css.
   Reversible: quitar el <link> revierte todo. */

:root{
  /* Sombras en capas (suaves, no duras) */
  --shadow-sm: 0 1px 2px rgba(22,18,45,.05), 0 1px 3px rgba(22,18,45,.03);
  --shadow-md: 0 2px 4px rgba(22,18,45,.04), 0 10px 24px -6px rgba(22,18,45,.10);
  --shadow-lg: 0 6px 12px rgba(22,18,45,.06), 0 28px 56px -14px rgba(22,18,45,.18);
  --shadow: var(--shadow-md);
  --ring: 0 0 0 3px rgba(124,58,237,.16);
  --radius: 14px;
  --grad-brand: linear-gradient(135deg,#7c3aed 0%,#8b3df0 42%,#e8843c 130%);
  --grad-accent: linear-gradient(135deg,#ef9a4f 0%,#e8843c 58%,#d9722b 100%);
}

/* Fondo con tinte sutil de marca (premium, no plano) */
body{
  background:
    radial-gradient(1200px 560px at 100% -8%, rgba(124,58,237,.055), transparent 60%),
    radial-gradient(1000px 520px at -8% 2%, rgba(232,132,60,.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* Tipografía display más confiada en números/títulos */
.kpi .k-value{ font-size: 25px; letter-spacing: -.02em; }
.stat .s-value{ font-size: 31px; letter-spacing: -.02em; }
.big-num{ font-size: 34px; letter-spacing: -.025em; }
.topbar h1{ font-size: 19px; letter-spacing: -.01em; }
.wordmark{ font-size: 20px; }

/* Superficies: bordes más finos, sombra en capas, transición */
.card, .tbl, .kpis, .stat, .agenda{
  border-color: rgba(22,18,45,.07);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.card{ box-shadow: var(--shadow-sm); }
.card:hover{ box-shadow: var(--shadow-md); }

/* Topbar: vidrio refinado */
.topbar{
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  border-bottom-color: rgba(22,18,45,.06);
}

/* Sidebar: activo con barra de acento + degradé sutil */
.sidebar{ background: linear-gradient(180deg,#fff, #fdfdff); }
.nav-item{ transition: background .16s ease, color .16s ease, box-shadow .16s ease; }
.nav-item:hover{ background:#f6f4fe; }
.nav-item.active{
  background: linear-gradient(90deg, rgba(124,58,237,.12), rgba(124,58,237,.045));
  color: var(--primary-700);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item.active svg{ stroke: var(--primary-700); }

/* Botón primario: degradé + sombra de color (se siente "tocable") */
.btn{ border-radius: 10px; transition: transform .12s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease; }
.btn-primary{
  background: var(--grad-accent);
  box-shadow: 0 1px 2px rgba(217,114,43,.30), 0 8px 18px -6px rgba(232,132,60,.50);
}
.btn-primary:hover{ transform: translateY(-1px); box-shadow: 0 2px 4px rgba(217,114,43,.30), 0 12px 24px -6px rgba(232,132,60,.55); }
.btn-primary:active{ transform: translateY(0); }
.btn-ghost:hover{ border-color:#d6d3e8; background:#fcfcff; }

/* Focus accesible y premium en todos los campos */
.field input:focus, .field select:focus, .search input:focus, input:focus, select:focus, textarea:focus{
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}

/* Chips / pills con un poco más de vida */
.chip{ box-shadow: inset 0 0 0 1px rgba(124,58,237,.08); }
.chip.fc{ box-shadow: inset 0 0 0 1px rgba(22,163,74,.12); }
.pill{ box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }

/* KPIs: número en degradé de marca para el primero (acento de jerarquía) */
.kpi:first-child .k-value, .stat:first-child .s-value{
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Tablas: cabecera y hover más definidos */
.tbl th{ background:#fbfaff; color:#8b8f9c; }
.tbl tr:hover td{ background:#faf8ff; }

/* Avatares y glyphs con degradé */
.mod-glyph{ background: var(--grad-brand) !important; box-shadow: 0 6px 16px -6px rgba(124,58,237,.5); }

/* Hero de módulos: degradé de marca + brillo */
.mod-hero{ background: var(--grad-brand); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.18); }

/* Barras de progreso (food cost, reportes): más vivas */
.bar-track{ background:#efeefb; }
.bar-fill{ background: var(--grad-accent); box-shadow: 0 1px 3px rgba(232,132,60,.4); }

/* POS: tarjeta de producto se siente táctil */
.pos-prod{ transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.pos-prod:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color:#d6d3e8; }

/* Estados vacíos: cálidos, no fríos */
.empty{ color:#8b8f9c; }

/* FIX 2026-07-07 (pantalla en blanco en escritorio): la animación de entrada de .content
   (opacity 0→1, gateada por prefers-reduced-motion) dejaba el contenido en opacity:0 en
   escritorio (movimiento activado) → área principal en blanco. En móviles con reduce-motion
   no corría, por eso ahí SÍ se veía. Se retira la animación para garantizar que el contenido
   SIEMPRE sea visible (correctitud > fade-in cosmético). Reimplementable luego con una clase
   añadida por JS tras el paint (garantizada), no con animación CSS de opacity sobre .content. */
.content{ opacity: 1; }

/* Scrollbars refinados */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-thumb{ background: rgba(22,18,45,.16); border-radius:999px; border:2px solid transparent; background-clip:padding-box; }
*::-webkit-scrollbar-thumb:hover{ background: rgba(22,18,45,.26); background-clip:padding-box; }
*::-webkit-scrollbar-track{ background: transparent; }

/* Búsqueda del topbar: más suave */
.search input{ border-radius:10px; transition: box-shadow .16s ease, border-color .16s ease, background .16s ease; }

/* ════════════════════════════════════════════════════════════════════
   Reglas nuevas (append-only). Scoped a login / KDS / POS.
   No alteran ninguna regla previa.
   ════════════════════════════════════════════════════════════════════ */

/* ── LOGIN: rail con foto de comida + overlay de marca ────────────── */
.login-rail--hero{
  position: relative;
  overflow: hidden;
  background:
    /* overlay degradé de marca para legibilidad del texto blanco */
    linear-gradient(155deg, rgba(124,58,237,.86) 0%, rgba(109,40,217,.78) 48%, rgba(232,132,60,.62) 130%),
    /* foto: pupusas en el comal */
    url('/assets/img/hero-login.jpg');
  background-size: cover, cover;
  background-position: center, center 35%;
  background-repeat: no-repeat, no-repeat;
}
/* viñeta inferior para asentar el texto */
.login-rail--hero::after{
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(20,12,40,.40) 100%);
  pointer-events: none;
}
.login-rail--hero .login-rail__content{
  position: relative; z-index: 1;
  text-shadow: 0 1px 14px rgba(20,12,40,.35);
}
.login-rail--hero .serif{ font-size: 38px; }
.login-rail--hero p{ opacity: .96; }

/* ── KDS: tablero de cocina legible a 2 metros ────────────────────── */
.kds-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  min-height: 240px;
}
.kds-card{
  background: var(--card);
  border: 1px solid rgba(22,18,45,.07);
  border-left: 10px solid var(--kds-edge, #9ca3af);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
}
.kds-card__head{
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.kds-order{
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px; font-weight: 700; letter-spacing: -.01em;
  color: var(--ink);
}
.kds-status{ font-size: 12px; padding: 5px 11px; }
.kds-card__meta{ margin-bottom: 12px; }
.kds-time{
  display: inline-block;
  font-weight: 700; font-size: 15px;
  padding: 4px 12px; border-radius: 999px;
  background: #f1f0f6; color: var(--muted);
}
.kds-time--urgent{
  background: #fdecec; color: #b91c1c;
  box-shadow: inset 0 0 0 1px rgba(185,28,28,.25);
  animation: kdsPulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce){ .kds-time--urgent{ animation: none; } }
@keyframes kdsPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.62; } }
.kds-items{ list-style: none; margin: 0 0 16px; padding: 0; }
.kds-item{
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 8px;
  font-size: 19px; line-height: 1.35;
  padding: 6px 0; border-bottom: 1px solid #f3f3f7;
}
.kds-item:last-child{ border-bottom: none; }
.kds-qty{
  font-family: 'Fraunces', Georgia, serif; font-weight: 700;
  font-size: 21px; color: var(--primary-700);
  min-width: 2.4em;
}
.kds-desc{ font-weight: 600; color: var(--ink); }
.kds-note{
  flex-basis: 100%;
  margin-left: 2.4em;
  font-size: 15px; font-style: italic; color: var(--accent-600); font-weight: 600;
}
.kds-actions{ display: flex; gap: 10px; margin-top: auto; }
.kds-btn{
  flex: 1; justify-content: center;
  padding: 14px 12px; font-size: 16px; border-radius: 11px;
}
.kds-btn[disabled]{ opacity: .45; cursor: default; }
.kds-empty{ padding: 56px 24px; }
.kds-empty__icon{ font-size: 44px; margin-bottom: 10px; }
.kds-empty__title{
  font-family: 'Fraunces', Georgia, serif; font-size: 20px; font-weight: 600;
  color: var(--ink); margin-bottom: 6px;
}
@media (max-width: 860px){
  .kds-grid{ grid-template-columns: 1fr; }
  .kds-order{ font-size: 23px; }
}

/* ── POS: se siente caja registradora física ──────────────────────── */
.pos-prod{
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 92px;
}
.pos-prod .pp-name{ font-size: 13.5px; }
.pos-prod .pp-foot{
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.pos-prod .pp-price{ margin-top: 0; font-size: 15px; }
.pos-prod .pp-add{
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px; line-height: 1;
  color: #fff; background: var(--grad-accent);
  box-shadow: 0 4px 10px -3px rgba(232,132,60,.55);
  opacity: 0; transform: scale(.8);
  transition: opacity .14s ease, transform .14s ease;
}
.pos-prod:hover .pp-add{ opacity: 1; transform: scale(1); }
.cart{ box-shadow: var(--shadow-md); }
.cart h3{ font-size: 18px; }
.cart .qbtn{
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1;
  display: grid; place-items: center;
  transition: border-color .12s ease, background .12s ease;
}
.cart .qbtn:hover{ border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.cart-row{ padding: 11px 0; font-size: 14px; }
.cart-row .cr-qty{ min-width: 20px; text-align: center; font-weight: 600; color: var(--ink); }
.cart-tot.grand{ font-size: 30px; letter-spacing: -.02em; }
.cart .btn-primary.btn-block{ padding: 15px; font-size: 16px; }
.cart-empty{ text-align: center; color: #8b8f9c; padding: 28px 12px; font-size: 14px; }
.cart-empty__icon{ font-size: 34px; margin-bottom: 8px; }
.pos-empty{ grid-column: 1 / -1; }
.pos-empty__icon{ font-size: 40px; display: block; margin-bottom: 8px; }

/* ════════════════════════════════════════════════════════════════════
   Detalle de controles v2 (append-only · 2026-07-23)
   Botones y pestañas con esmero: tap targets, estados completos y
   segmented control REAL sin tocar markup ni JS (usa el alternado
   btn-primary/btn-ghost existente). Quitar esta sección revierte todo.
   ════════════════════════════════════════════════════════════════════ */

/* Base: tap target cómodo, tipografía firme, sin flash azul en móvil */
.btn{
  min-height: 40px;
  font-weight: 600;
  letter-spacing: .01em;
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active{ transform: translateY(0) scale(.97); }
.btn:focus-visible{ outline: none; box-shadow: var(--ring); }
.btn svg{ width: 16px; height: 16px; flex: none; stroke: currentColor; }
.btn[disabled]{ opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none; }

/* Primario: naranja de marca con luz interna — se siente tocable */
.btn-primary{
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.32),
    inset 0 -1px 0 rgba(0,0,0,.06),
    0 1px 2px rgba(217,114,43,.35),
    0 8px 18px -6px rgba(232,132,60,.50);
}
.btn-primary:hover{
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.36),
    inset 0 -1px 0 rgba(0,0,0,.06),
    0 2px 5px rgba(217,114,43,.32),
    0 14px 26px -8px rgba(232,132,60,.58);
}
.btn-primary:active{
  transform: translateY(0) scale(.98);
  box-shadow: inset 0 2px 4px rgba(120,53,15,.22), 0 1px 2px rgba(217,114,43,.30);
}

/* Ghost: secundario con intención — hairline, tinte lavanda al pasar */
.btn-ghost{ border: 1px solid var(--line); background: #fff; }
.btn-ghost:hover{
  border-color: #cfc9ea;
  background: #faf9ff;
  color: var(--primary-700);
  box-shadow: 0 1px 2px rgba(22,18,45,.05), 0 6px 14px -8px rgba(124,58,237,.25);
}
.btn-ghost:active{ background: var(--primary-50); }

/* ── Pestañas: riel segmentado real (el wrapper que contiene .tab-btn) ── */
.toolbar:has(> .tab-btn){
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  background: #efedf6;
  border: 1px solid rgba(22,18,45,.05);
  padding: 4px;
  border-radius: 13px;
  box-shadow: inset 0 1px 2px rgba(22,18,45,.05);
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar:has(> .tab-btn)::-webkit-scrollbar{ display: none; }
.tab-btn{ border-radius: 10px; white-space: nowrap; flex: none; }

/* Pestaña inactiva: texto tranquilo — el riel ya la contiene */
.tab-btn.btn-ghost{
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}
.tab-btn.btn-ghost:hover{
  background: rgba(255,255,255,.75);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

/* Pestaña activa: píldora blanca elevada, tinta morada + subrayado de acento */
.tab-btn.btn-primary{
  background: #fff;
  color: var(--primary-700);
  transform: none;
  box-shadow:
    0 1px 2px rgba(22,18,45,.08),
    0 4px 10px -2px rgba(124,58,237,.18),
    inset 0 0 0 1px rgba(124,58,237,.14);
}
.tab-btn.btn-primary:hover{ transform: none; }
.tab-btn.btn-primary::after{
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 5px;
  height: 2.5px; border-radius: 999px;
  background: var(--grad-accent);
}

/* Fallback sin :has(): los tabs mejoran igual aunque no haya riel */
@supports not (selector(:has(*))){
  .tab-btn.btn-primary{
    box-shadow: 0 1px 2px rgba(22,18,45,.10), inset 0 0 0 1px rgba(124,58,237,.16);
  }
}

/* Quietud para quien la pide */
@media (prefers-reduced-motion: reduce){
  .btn{ transition: none; }
  .btn:active, .btn-primary:hover, .btn-primary:active{ transform: none; }
}

/* ════════════════════════════════════════════════════════════════════
   MÓVIL REDMI (append-only · 2026-07-25) — corrige lo medido en un
   Redmi físico (Android 15 · Chrome 137 · viewport CSS 360x660):
     · el aviso del cobro se pintaba 1.934px fuera de pantalla,
     · el teclado (255px) tapaba resultados y "Confirmar cobro",
     · objetivos tocables de 15-40px de alto (mínimo humano = 44px).
   Quitar esta sección revierte los tres cambios visuales.
   Las variables --tmsv-vvh / --tmsv-kb las publica TMSV.viewport
   (public/js/tmsv.js); todo lleva fallback para cuando el JS no corrió.
   ════════════════════════════════════════════════════════════════════ */

/* ── 1) AVISO flotante: aparece DONDE está el dedo ──────────────────── */
#tmsv-toasts{
  position: fixed; left: 0; right: 0;
  /* Se apoya SOBRE el teclado (--tmsv-kb), no debajo. */
  bottom: calc(var(--tmsv-kb, 0px) + 14px);
  z-index: 10050;                     /* por encima del modal de cobro (9999) */
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 12px; pointer-events: none;
}
.tmsv-toast{
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%; max-width: 520px;
  padding: 13px 12px 13px 15px; border-radius: 14px;
  font: 600 13.5px/1.45 Inter, system-ui, sans-serif;
  box-shadow: 0 10px 34px -10px rgba(20,16,40,.45), 0 2px 6px rgba(20,16,40,.12);
  opacity: 0; transform: translateY(14px);
  transition: opacity .18s ease, transform .18s ease;
}
.tmsv-toast.is-in{ opacity: 1; transform: translateY(0); }
.tmsv-toast--ok{ background: #ecf9ee; color: #14532d; border: 1px solid #bfe6c6; }
.tmsv-toast--err{ background: #fdf0f0; color: #8f1a1a; border: 1px solid #f0c9c9; }
.tmsv-toast--info{ background: #f6f2ff; color: #43227d; border: 1px solid #ded0fb; }
.tmsv-toast__body{ flex: 1; min-width: 0; overflow-wrap: break-word; }
/* Acciones del aviso (Imprimir ticket · Ver DTE): tocables de verdad. */
.tmsv-toast__body a{
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 10px; margin: 2px 2px 0 0; border-radius: 10px;
  background: rgba(255,255,255,.72); color: inherit;
  text-decoration: underline; font-weight: 700;
}
.tmsv-toast__x{
  flex: none; width: 44px; height: 44px; margin: -6px -4px -6px 0;
  border: 0; background: none; color: inherit; opacity: .6;
  font-size: 15px; line-height: 1; cursor: pointer; border-radius: 12px;
}
.tmsv-toast__x:hover{ opacity: 1; background: rgba(255,255,255,.6); }
@media (prefers-reduced-motion: reduce){
  .tmsv-toast{ transition: none; opacity: 1; transform: none; }
}

/* ── 2) Teclado abierto: que no tape lo que importa ─────────────────── */
/* Modales de cobro/genéricos: alto atado al viewport VISUAL y pie pegado
   abajo, para que "Confirmar cobro" nunca quede detrás del teclado. */
#tmk-caja-cobro-modal{ height: var(--tmsv-vvh, 100%); top: var(--tmsv-vvtop, 0px); bottom: auto; }
.modal-box{ max-height: calc(var(--tmsv-vvh, 100vh) - 24px); overflow-y: auto; }
@media (max-width: 860px){
  /* En el POS, con el teclado arriba el cromo es peso muerto: el cajero está
     escribiendo y necesita VER los resultados (medido: 0 de 5 visibles). */
  body.tmsv-pos.tmsv-kb-open .demo-banner,
  body.tmsv-pos.tmsv-kb-open .topbar,
  body.tmsv-pos.tmsv-kb-open .pos-cats{ display: none !important; }
  body.tmsv-pos.tmsv-kb-open .content{ padding-top: 10px; }
  body.tmsv-pos.tmsv-kb-open .pos-search{
    position: sticky; top: 0; z-index: 6; background: var(--bg, #fff);
    padding-top: 6px; margin-bottom: 0;
  }
  body.tmsv-pos.tmsv-kb-open .pos-prods{
    max-height: calc(var(--tmsv-vvh, 100vh) - 96px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
}

/* ── 3) Objetivos tocables ≥44px en pantallas de dedo ───────────────── */
@media (max-width: 860px), (pointer: coarse){
  .btn{ min-height: 44px; }
  .btn-sm{ min-height: 44px; padding: 10px 14px; }
  .tab, .tab-btn{ min-height: 44px; }
  .nav-toggle{ width: 44px; height: 44px; }
  .cart .qbtn, .qbtn{ width: 44px; height: 44px; }
  /* Enlaces de texto que SON acciones: "Cerrar sesión", "Boleta ↓",
     "Ver portal →" medían 15px de alto. La letra no crece; el área sí. */
  a.note, .note a, .link{
    display: inline-flex; align-items: center; min-height: 44px;
  }
  /* Campos y botones sueltos (Fondo de apertura, Abrir turno, modal de cobro). */
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select, textarea, button{ min-height: 44px; }
  /* Ícono "Emitir factura" del topbar (34x34 inline) y avatar. */
  .topbar a[href="/emitir"]{ width: 44px !important; height: 44px !important; }
  /* La barra DEMO queda FUERA: no es producto y ya se come 27% del viewport
     en 360px; engordarla sería empeorar lo que el informe señaló. */
  .demo-banner a, .demo-banner button, .demo-banner select{ min-height: 0; }
}
