/* =========================
   VARIABLES (UNIFICADAS)
========================= */
:root{
  /* Base marca */
  --brand-main:#571F0E;   /* cacao */
  --brand-dark:#4A2608;
  --brand-soft:#996C49;
  --cream:#F2EFE5;
  --border:#E2D6C6;

  --ok:#25D366;
  --danger:#B00020;

  /* POS (tema colorido tipo dashboard) */
  --pos-accent: #ffb703;   /* amarillo cálido */
  --pos-accent-2: #fb8500; /* naranja */
  --pos-ink: #1b1b1b;
  --pos-soft: #fff7ed;     /* crema */
  --pos-border: rgba(0,0,0,.08);
}

/* =========================
   BASE
========================= */
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background: var(--brand-main);
  color: var(--cream);
}

.app{ min-height:100vh; }

/* =========================
   PIN LOGIN - TOUCH (UNIFICADO)
========================= */
.pin-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(242,239,229,.16), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.22), rgba(0,0,0,.06)),
    var(--brand-main);
}

.pin-card{
  width:min(470px, 96vw);
  background: rgba(255,255,255,.97);
  border:1px solid rgba(226,214,198,.95);
  border-radius:28px;
  padding:22px;
  box-shadow:0 18px 45px rgba(0,0,0,.38);
  text-align:center;
}

.brand{ margin-bottom: 10px; }
.brand-logo{
  width: 260px;
  max-width: 86%;
  height:auto;
  display:block;
  margin: 0 auto;
}
.brand-sub{
  margin-top:8px;
  font-weight:900;
  color: rgba(87,31,14,.62);
}

.pin-title{
  font-size:34px;
  font-weight:950;
  color:var(--brand-main);
}
.pin-sub{
  margin-top:6px;
  font-weight:900;
  color:rgba(43,26,14,.65);
}

.pin-error{
  margin:14px 0 10px;
  background:rgba(176,0,32,.10);
  border:1px solid rgba(176,0,32,.20);
  color:#7A0016;
  padding:10px 12px;
  border-radius:14px;
  font-weight:900;
}

.pin-boxes{
  display:flex;
  gap:14px;
  justify-content:center;
  margin:18px 0 18px;
}
.pin-box{
  width:70px;
  height:70px;
  border-radius:18px;
  border:2px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:34px;
  font-weight:900;
  color:var(--brand-main);
  background:#fff;
}
.pin-box.filled{
  border-color: rgba(87,31,14,.42);
  box-shadow: 0 0 0 4px rgba(87,31,14,.10);
}

.pin-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:14px;
}

.pin-btn{
  height:80px;
  font-size:28px;
  font-weight:950;
  border-radius:22px;
  border:none;
  background: var(--brand-soft);
  color:#fff;
  cursor:pointer;
  box-shadow:0 10px 18px rgba(0,0,0,.12);
}
.pin-btn:active{ background: var(--brand-main); }
.pin-clear{ background:#8a8a8a; }
.pin-ok{ background: var(--ok); }
.pin-ok:disabled{ opacity:.45; cursor:not-allowed; }

.pin-hint{
  margin-top:12px;
  font-size:13px;
  font-weight:900;
  color: rgba(87,31,14,.50);
}

/* =========================
   DASHBOARD TOUCH
========================= */
.dash-wrap{
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

.dash-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
  padding:14px 16px;
  border-radius:18px;
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(226,214,198,.95);
}

.dash-app{
  font-weight: 950;
  font-size: 18px;
  color: var(--brand-main);
}
.dash-user{
  margin-top:4px;
  font-weight: 800;
  color: rgba(87,31,14,.60);
  font-size: 13px;
}

.dash-logout{
  text-decoration:none;
  font-weight: 900;
  padding: 12px 14px;
  border-radius: 14px;
  background: #8a8a8a;
  color:#fff;
}

.dash-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (min-width: 900px){
  .dash-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.dash-card{
  text-decoration:none;
  display:block;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(226,214,198,.95);
  box-shadow: 0 12px 26px rgba(0,0,0,.10);
  min-height: 120px;
}
.dash-card:active{ transform: scale(.99); }

.dash-icon{ font-size: 34px; margin-bottom: 10px; }
.dash-title{
  font-weight: 950;
  font-size: 18px;
  color: var(--brand-main);
  margin-bottom: 6px;
}
.dash-desc{
  font-weight: 800;
  color: rgba(87,31,14,.55);
  font-size: 13px;
}

/* =========================
   PÁGINAS (MÓDULOS)
========================= */
.page{
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}
.page-top{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}
.btn-back{
  text-decoration:none;
  font-weight:900;
  padding: 12px 14px;
  border-radius: 14px;
  background:#8a8a8a;
  color:#fff;
}
.page-title{
  font-weight:950;
  font-size:22px;
  color:#fff;
}
.page-card{
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(226,214,198,.95);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 12px 26px rgba(0,0,0,.10);
}
.page-card h3{ margin: 0 0 8px; color:var(--brand-main); }
.page-card p{ margin: 0; font-weight: 800; color: rgba(87,31,14,.55); }

/* =========================
   POS - TIPO DE PEDIDO (UNIFICADO)
========================= */
.pos-type{
  max-width: 900px;
  margin: 0 auto;
  padding: 22px;
  display:flex;
  justify-content:center;
  align-items:center;
  min-height: 70vh;
}

.pos-type-card{
  width:100%;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(226,214,198,.95);
  border-radius: 26px;
  padding: 22px;
  box-shadow: 0 12px 26px rgba(0,0,0,.10);
  text-align:center;
}

.pos-type-title{
  font-weight: 950;
  font-size: 22px;
  color:var(--brand-main);
  margin-bottom: 16px;
}

.pos-type-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media(max-width: 720px){
  .pos-type-grid{ grid-template-columns: 1fr; }
}

.type-btn{
  width:100%;
  border:0;
  border-radius: 22px;
  padding: 18px 16px;
  font-weight: 950;
  font-size: 20px;
  background: var(--brand-main);
  color:#fff;
  cursor:pointer;
}
.type-btn:active{ transform:scale(.99); }

.pos-type-note{
  margin-top: 14px;
  font-weight: 900;
  color: rgba(87,31,14,.55);
}

/* =========================
   POS (TEMA COLORIDO TIPO DASHBOARD)
========================= */
.pos-wrap{ padding: 16px; }

/* Header como banda bonita */
.pos-header{
  display:flex; align-items:center; gap:12px;
  margin-bottom:14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,183,3,.18), rgba(251,133,0,.12));
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
}

.pos-header-title{ flex:1; }
.pos-title{ font-size:20px; font-weight:900; color:#fff; }
.pos-subtitle{ margin-top:2px; font-weight:800; color: rgba(255,255,255,.9); }

.pos-header-actions{ display:flex; gap:10px; }

/* Links del header */
.pos-header a{
  color:#fff;
  text-decoration:none;
  font-weight:900;
  padding:10px 12px;
  border-radius:14px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
}
.pos-header a:hover{ background: rgba(255,255,255,.16); }

.pos-grid{
  display:grid;
  grid-template-columns: 2fr 1fr;
  gap:16px;
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.94));
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 14px 40px rgba(0,0,0,.12);
  color: var(--pos-ink);
}

.card-title{
  font-weight: 900;
  color: var(--pos-ink);
  margin-bottom: 10px;
  display:flex;
  align-items:center;
  gap:8px;
}

.pos-cats{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.pos-cat{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: 16px;
  text-decoration:none;
  font-weight: 900;
  color: var(--pos-ink);
  background: var(--pos-soft);
  border: 1px solid rgba(251,133,0,.25);
  box-shadow: 0 6px 18px rgba(251,133,0,.10);
  user-select:none;
}
.pos-cat:hover{ transform: translateY(-1px); }

.pos-cat.active{
  color:#fff;
  background: linear-gradient(135deg, var(--pos-accent), var(--pos-accent-2));
  border-color: rgba(0,0,0,.12);
  box-shadow: 0 10px 24px rgba(251,133,0,.25);
}

.pos-products{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}

.pos-product{
  background: linear-gradient(180deg, #ffffff, #fffaf2);
  border-radius: 18px;
  padding: 14px;
  border: 1px solid var(--pos-border);
  display:flex;
  flex-direction:column;
  gap:10px;
  box-shadow: 0 8px 22px rgba(0,0,0,.06);
}

.pos-product-name{
  font-weight: 900;
  color: var(--pos-ink);
  line-height:1.2;
}

.pos-product-price{
  display:inline-flex;
  align-self:flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  background: rgba(255,183,3,.22);
  border: 1px solid rgba(255,183,3,.35);
  color: #7a3b00;
}

.pos-empty{ opacity:.8; padding:10px 0; }

/* Botones touch */
.btn-touch{
  min-height: 48px;
  border-radius: 16px;
  font-weight: 900;
  border: none;
  cursor: pointer;
}
.btn-touch:active{ transform: scale(.98); }

.btn-touch-mini{
  min-height: 42px;
  width: 48px;
  border-radius: 16px;
  font-weight: 900;
  background: #fff;
  border: 2px solid rgba(0,0,0,.12);
  cursor:pointer;
}
.btn-touch-mini:active{ transform: scale(.98); }

/* Agregar */
.pos-product .btn-touch{
  color:#fff;
  background: linear-gradient(135deg, var(--pos-accent), var(--pos-accent-2));
  box-shadow: 0 10px 20px rgba(251,133,0,.20);
}

/* Cuenta */
.pos-cart{ display:flex; flex-direction:column; gap:12px; }

.pos-cart-item{
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border-radius: 18px;
  padding: 12px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 8px 18px rgba(0,0,0,.05);
}

.pos-cart-name{ font-weight:900; color: var(--pos-ink); }
.pos-cart-sub{ font-weight:900; color:#444; margin-top:4px; }

.pos-cart-actions{
  display:flex; align-items:center; gap:10px;
  margin-top:10px;
}
.pos-cart-qty{ min-width:34px; text-align:center; font-weight:900; }

.btn-danger.btn-touch-mini{
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color:#fff;
  border:none;
}

/* Total y botón cobro */
.pos-total{
  display:flex; justify-content:space-between; align-items:center;
  margin-top:14px;
  padding-top:12px;
  border-top:1px dashed rgba(0,0,0,.18);
  font-weight: 900;
}
.pos-total-value{ font-size: 18px; color:#111; }

.btn-pay{
  width:100%;
  margin-top: 14px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color:#fff;
  box-shadow: 0 12px 24px rgba(34,197,94,.18);
}
.btn-pay:disabled{
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  box-shadow:none;
  cursor:not-allowed;
  opacity: .95;
}

/* Responsive POS */
@media (max-width: 980px){
  .pos-grid{ grid-template-columns: 1fr; }
  .pos-products{ grid-template-columns: 1fr; }
}

/* =========================
   MODAL POS (UNIFICADO + MÓVIL OK)
========================= */
.pos-modal.hidden{ display:none; }

.pos-modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
  padding:12px; /* margen en móvil */
}

.pos-modal-card{
  width:min(720px, 96vw);
  max-height: 92vh;            /* clave para no salirse */
  background:#fff;
  border-radius:18px;
  padding:14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display:flex;
  flex-direction:column;
  overflow:hidden;             /* header fijo, body con scroll */
  color:#111;                  /* evita “marca de agua” */
}

.pos-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.pos-modal-title{
  font-weight:900;
  font-size:18px;
  color:#111;
}

.pos-modal-close{
  border:none;
  background:#111;
  color:#fff;
  width:44px;
  height:44px;
  border-radius:14px;
  font-weight:900;
  cursor:pointer;
}

.pos-modal-body{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:12px;

  overflow:auto;               /* scroll dentro del modal */
  -webkit-overflow-scrolling: touch;
  max-height: 52vh;            /* ajustable */
  padding-right:6px;
}

.pos-mod-title{
  font-weight:900;
  margin-bottom:6px;
  color:#111;
}

.pos-mod-options{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.pos-mod-opt{
  display:flex;
  gap:8px;
  align-items:center;
  padding:10px 12px;
  border-radius:14px;
  background: var(--pos-soft);
  border:1px solid rgba(251,133,0,.35);
  font-weight:800;
  color:#111;
}
.pos-mod-opt span{ color:#111; font-weight:800; }

.pos-modal-notes{ margin-top:10px; }
.pos-modal-notes label{ font-weight:900; display:block; margin-bottom:6px; color:#111; }
.pos-modal-notes textarea{
  width:100%;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.12);
  padding:10px 12px;
  color:#111;
  background:#fff;
}

/* Bloquear scroll del fondo cuando modal abierto */
body.modal-open{
  overflow:hidden;
  touch-action:none;
}
