:root{
  --rojo:#E41D23; --rojo-dark:#B5151A; --negro:#111111; --gris-oscuro:#555555;
  --gris-claro:#E5E5E5; --gris-fondo:#F4F4F4; --blanco:#FFFFFF;
  --verde:#1F9254; --azul:#2563EB; --morado:#7C3AED; --cian:#0891B2; --amarillo:#D9A400;
  --radius:14px; --shadow:0 2px 10px rgba(0,0,0,.08); --shadow-lg:0 12px 32px rgba(0,0,0,.22);
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
body{margin:0; font-family:'Inter',system-ui,sans-serif; color:var(--negro); background:var(--gris-fondo);}
h1,h2,h3,.display{font-family:'Poppins',sans-serif;}
.brand-font{font-family:'Baloo 2',sans-serif; font-weight:800;}
button{font-family:inherit; cursor:pointer; border:none;}
input,select,textarea{font-family:inherit;}
a{color:inherit; text-decoration:none;}
svg{display:block;}

/* ===================== AUTH (login/registro) ===================== */
.auth-body{display:flex; align-items:center; justify-content:center; min-height:100vh; padding:20px;
  background:radial-gradient(circle at 30% 20%, #1a1a1a, #000 70%);}
.auth-wrap{width:100%; max-width:420px;}
.auth-brand{display:flex; flex-direction:column; align-items:center; gap:8px; margin-bottom:22px;}
.auth-wordmark{font-family:'Baloo 2',sans-serif; font-weight:800; font-size:27px; color:#fff;}
.auth-wordmark .red{color:var(--rojo);}
.auth-card{background:#fff; border-radius:20px; box-shadow:var(--shadow-lg); padding:26px 24px;}
.auth-tabs{display:flex; background:var(--gris-fondo); border-radius:12px; padding:4px; margin-bottom:18px;}
.auth-tab{flex:1; padding:12px; border-radius:9px; font-weight:700; font-size:14px; background:transparent; color:var(--gris-oscuro);}
.auth-tab.active{background:var(--rojo); color:#fff;}
.auth-panel{display:none;}
.auth-panel.active{display:block;}
.auth-msg{padding:12px 14px; border-radius:10px; font-size:13.5px; font-weight:600; margin-bottom:16px;}
.auth-msg.error{background:#FEE2E2; color:#991B1B;}
.auth-msg.ok{background:#DCFCE7; color:#166534;}
.auth-note{font-size:12px; color:var(--gris-oscuro); margin-top:12px; text-align:center; line-height:1.5;}

/* ===================== FORM ELEMENTS ===================== */
.form-row{margin-bottom:14px;}
.form-row label{display:block; font-weight:700; font-size:13px; margin-bottom:6px; color:var(--gris-oscuro);}
.form-row input, .form-row select, .form-row textarea{
  width:100%; padding:13px 14px; border-radius:10px; border:2px solid var(--gris-claro); font-size:15px; font-weight:600;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus{border-color:var(--rojo); outline:none;}
.btn-primary{
  width:100%; background:var(--rojo); color:#fff; font-weight:800; font-size:16px;
  padding:15px; border-radius:14px; box-shadow:0 6px 16px rgba(228,29,35,.3);
}
.btn-primary:active{background:var(--rojo-dark);}
.btn-primary:disabled{background:#ccc; box-shadow:none;}
.btn-secondary{width:100%; background:var(--negro); color:#fff; font-weight:800; font-size:14px; padding:13px; border-radius:12px;}
.btn-outline{background:#fff; border:2px solid var(--negro); color:var(--negro); font-weight:700; padding:11px; border-radius:12px; font-size:13.5px;}
.btn-sm{padding:8px 14px; border-radius:9px; font-weight:700; font-size:12.5px;}
.btn-danger{background:#FEE2E2; color:#991B1B;}
.btn-ok{background:#DCFCE7; color:#166534;}

/* ===================== ADMIN LAYOUT ===================== */
.admin-shell{display:flex; min-height:100vh;}
.admin-sidebar{
  width:230px; background:var(--negro); color:#fff; flex-shrink:0; display:flex; flex-direction:column;
  position:fixed; top:0; left:0; bottom:0; z-index:100; transition:.2s;
}
.admin-sidebar .side-brand{display:flex; align-items:center; gap:10px; padding:18px 16px; border-bottom:1px solid #262626;}
.admin-sidebar .side-brand svg{width:30px; height:30px;}
.admin-sidebar .side-brand .wm{font-family:'Baloo 2',sans-serif; font-weight:800; font-size:17px;}
.admin-sidebar .side-brand .wm .red{color:var(--rojo);}
.side-nav{flex:1; overflow-y:auto; padding:12px 10px;}
.side-nav a{display:flex; align-items:center; gap:10px; padding:12px 12px; border-radius:10px; font-weight:600; font-size:14px; color:#bbb; margin-bottom:2px;}
.side-nav a .ic{font-size:16px; width:20px; text-align:center;}
.side-nav a.active, .side-nav a:hover{background:var(--rojo); color:#fff;}
.side-user{padding:14px 16px; border-top:1px solid #262626; font-size:12.5px;}
.side-user .su-name{font-weight:700; color:#fff;}
.side-user .su-rol{color:#999; text-transform:capitalize;}
.side-user a{display:block; margin-top:8px; color:var(--rojo); font-weight:700; font-size:12.5px;}

.admin-main{margin-left:230px; flex:1; min-width:0; padding:22px 26px;}
.admin-topbar-mobile{display:none;}
.admin-wrap{max-width:1180px; margin:0 auto;}
.page-head{display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:20px; flex-wrap:wrap; gap:12px;}
.page-head h1{font-size:22px; margin:0;}
.page-head .sub{color:var(--gris-oscuro); font-size:13.5px; margin-top:2px;}

.card{background:#fff; border-radius:16px; box-shadow:var(--shadow); padding:20px; margin-bottom:16px;}
.card h2{margin:0 0 4px; font-size:17px;}
.card .sub{color:var(--gris-oscuro); font-size:13px; margin-bottom:14px;}

.kpi-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:12px; margin-bottom:16px;}
.kpi{background:var(--negro); color:#fff; border-radius:14px; padding:16px 18px;}
.kpi.rojo{background:var(--rojo);}
.kpi .k-label{font-size:11.5px; opacity:.75; font-weight:700; text-transform:uppercase; letter-spacing:.4px;}
.kpi .k-value{font-size:23px; font-weight:800; margin-top:4px;}

table{width:100%; border-collapse:collapse; font-size:13.5px;}
table th{text-align:left; color:var(--gris-oscuro); font-size:11.5px; text-transform:uppercase; padding:9px 8px; border-bottom:2px solid var(--gris-claro); white-space:nowrap;}
table td{padding:11px 8px; border-bottom:1px solid #f0f0f0; font-weight:600; vertical-align:middle;}
.table-wrap{overflow-x:auto;}
.badge{display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:800; text-transform:uppercase;}
.badge.verde{background:#DCFCE7; color:#166534;}
.badge.rojo{background:#FEE2E2; color:#991B1B;}
.badge.gris{background:var(--gris-claro); color:var(--gris-oscuro);}
.badge.dorado{background:#FEF3C7; color:#92400E;}
.thumb{width:44px; height:44px; border-radius:9px; object-fit:cover; background:var(--gris-fondo);}
.empty-msg{color:#aaa; font-size:13.5px; text-align:center; padding:22px 0;}
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:16px;}
.filters{display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px;}
.filters select, .filters input{padding:10px 12px; border-radius:9px; border:2px solid var(--gris-claro); font-weight:600; font-size:13.5px;}
.fab-add{position:fixed; bottom:24px; right:24px; background:var(--rojo); color:#fff; width:56px; height:56px; border-radius:50%; font-size:26px; box-shadow:var(--shadow-lg); display:flex; align-items:center; justify-content:center; z-index:150;}

/* ===================== MODALS ===================== */
.modal-overlay{position:fixed; inset:0; background:rgba(17,17,17,.55); display:flex; align-items:center; justify-content:center; z-index:300; padding:16px;}
.modal-overlay.hidden{display:none;}
.modal-box{background:#fff; border-radius:20px; width:100%; max-width:480px; max-height:90vh; overflow-y:auto; box-shadow:var(--shadow-lg);}
.modal-box.wide{max-width:640px;}
.modal-head{padding:18px 20px 12px; display:flex; justify-content:space-between; align-items:flex-start; border-bottom:1px solid var(--gris-claro); position:sticky; top:0; background:#fff; z-index:2;}
.modal-head h3{margin:0; font-size:17px;}
.modal-close{background:var(--gris-fondo); width:30px; height:30px; border-radius:50%; font-weight:700; color:var(--gris-oscuro);}
.modal-body{padding:18px 20px;}
.modal-foot{padding:14px 20px 20px;}

.toast{position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); background:var(--negro); color:#fff; padding:14px 22px; border-radius:12px; font-weight:700; font-size:13.5px; box-shadow:var(--shadow-lg); z-index:500; opacity:0; pointer-events:none; transition:.25s;}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}

/* ===================== POS ===================== */
#app{height:100vh; display:flex; flex-direction:column;}
#topbar{background:var(--negro); color:#fff; display:flex; align-items:center; padding:0 16px; height:60px; flex-shrink:0; gap:14px; box-shadow:var(--shadow-lg); z-index:50;}
.brand{display:flex; align-items:center; gap:9px; flex-shrink:0;}
.brand svg{width:32px; height:32px;}
.brand .wordmark{font-family:'Baloo 2',sans-serif; font-weight:800; font-size:18px;}
.brand .wordmark .red{color:var(--rojo);}
.tabs{display:flex; gap:5px; background:#1c1c1c; padding:4px; border-radius:11px;}
.tab{background:transparent; color:#bbb; padding:9px 14px; border-radius:8px; font-weight:700; font-size:13px;}
.tab.active{background:var(--rojo); color:#fff;}
.session-info{margin-left:auto; display:flex; align-items:center; gap:12px; font-size:12.5px;}
#caja-status-pill{padding:6px 11px; border-radius:999px; font-weight:700; font-size:11.5px; background:#333; color:#ccc; display:flex; align-items:center; gap:6px;}
#caja-status-pill.abierta{background:rgba(31,146,84,.18); color:#4ADE80;}
#caja-status-pill .dot{width:7px; height:7px; border-radius:50%; background:#888;}
#caja-status-pill.abierta .dot{background:#4ADE80; box-shadow:0 0 6px #4ADE80;}
.pos-user{display:flex; align-items:center; gap:6px; color:#ccc;}
.pos-user a{color:var(--rojo); font-weight:700;}

.view{display:none; flex:1; min-height:0;}
.view.active{display:flex;}

.menu-panel{flex:1; display:flex; flex-direction:column; min-width:0; padding:14px 0 14px 14px;}
.category-tabs{display:flex; gap:8px; overflow-x:auto; padding-bottom:10px; flex-shrink:0;}
.category-tabs::-webkit-scrollbar{height:0;}
.cat-btn{background:#fff; color:var(--gris-oscuro); padding:11px 18px; border-radius:11px; font-weight:700; font-size:13.5px; white-space:nowrap; box-shadow:var(--shadow); flex-shrink:0;}
.cat-btn.active{background:var(--negro); color:#fff;}
.product-grid{flex:1; overflow-y:auto; display:grid; gap:11px; align-content:start; padding-right:14px; grid-template-columns:repeat(auto-fill,minmax(145px,1fr));}
.product-card{background:#fff; border-radius:14px; box-shadow:var(--shadow); padding:0; overflow:hidden; display:flex; flex-direction:column; min-height:150px; text-align:left;}
.product-card:active{transform:scale(.97);}
.product-card .pimg{width:100%; height:80px; object-fit:cover; background:var(--gris-fondo);}
.product-card .pimg-placeholder{width:100%; height:80px; background:linear-gradient(135deg,#f4f4f4,#eaeaea); display:flex; align-items:center; justify-content:center; font-size:26px;}
.product-card .pbody{padding:10px 12px; flex:1; display:flex; flex-direction:column; justify-content:space-between;}
.product-card .pname{font-weight:700; font-size:13.5px; line-height:1.25;}
.product-card .pmeta{display:flex; justify-content:space-between; align-items:center; margin-top:8px;}
.product-card .pprice{font-weight:800; color:var(--rojo); font-size:14.5px;}
.product-card .ptag{font-size:9.5px; font-weight:700; text-transform:uppercase; color:var(--gris-oscuro); background:var(--gris-claro); padding:2px 6px; border-radius:6px;}

.cart-panel{width:340px; flex-shrink:0; background:#fff; margin:14px; border-radius:18px; box-shadow:var(--shadow-lg); display:flex; flex-direction:column; overflow:hidden;}
.cart-header{padding:14px 16px; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--gris-claro); font-weight:800; font-size:15px;}
.cart-header button{background:none; color:var(--rojo); font-weight:700; font-size:12px; padding:5px 9px; border-radius:8px;}
.cart-items{flex:1; overflow-y:auto; padding:6px 12px;}
.cart-empty{height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; color:#aaa; gap:8px; font-size:13px; text-align:center; padding:20px;}
.cart-line{padding:9px 4px; border-bottom:1px solid #f0f0f0;}
.cart-line .cl-top{display:flex; justify-content:space-between; gap:8px;}
.cart-line .cl-name{font-weight:700; font-size:13.5px; flex:1;}
.cart-line .cl-price{font-weight:700; font-size:13.5px; white-space:nowrap;}
.cart-line .cl-extras{font-size:11.5px; color:var(--gris-oscuro); margin-top:2px; line-height:1.5;}
.cart-line .cl-bottom{display:flex; justify-content:space-between; align-items:center; margin-top:7px;}
.qty-stepper{display:flex; align-items:center; background:var(--gris-fondo); border-radius:9px;}
.qty-stepper button{width:29px; height:29px; background:transparent; font-weight:800; font-size:15px;}
.qty-stepper span{min-width:24px; text-align:center; font-weight:700; font-size:13px;}
.cl-remove{color:var(--rojo); font-size:11.5px; font-weight:700; background:none; padding:4px 7px;}
.cart-summary{padding:14px 16px; border-top:1px solid var(--gris-claro); background:#fafafa;}
.cart-summary .row{display:flex; justify-content:space-between; font-size:13.5px; color:var(--gris-oscuro); padding:3px 0;}
.cart-summary .row.total{font-size:20px; font-weight:900; padding-top:8px; margin-top:6px; border-top:1px dashed #ccc;}
.cart-summary .row.total span:last-child{color:var(--rojo);}
.cart-actions{display:flex; gap:8px; margin-top:10px;}
.cart-actions button{flex:1;}

/* adicionales / checkbox */
.adic-item{display:flex; justify-content:space-between; align-items:center; padding:12px 4px; border-bottom:1px solid #f0f0f0;}
.adic-item:last-child{border-bottom:none;}
.adic-left{display:flex; align-items:center; gap:11px;}
.checkbox{width:23px; height:23px; border-radius:7px; border:2px solid var(--gris-claro); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-weight:900; font-size:13px; color:#fff;}
.checkbox.checked{background:var(--rojo); border-color:var(--rojo);}
.adic-name{font-weight:600; font-size:14px;}
.adic-price{font-weight:700; color:var(--gris-oscuro); font-size:13px;}
.qty-mini{display:flex; align-items:center; gap:10px; background:var(--gris-fondo); border-radius:10px; padding:4px 6px;}
.qty-mini button{width:28px; height:28px; background:#fff; border-radius:7px; font-weight:800; box-shadow:var(--shadow);}
.qty-mini span{font-weight:800; min-width:18px; text-align:center;}

.pago-grid{display:grid; grid-template-columns:1fr 1fr; gap:9px;}
.pago-btn{border:2px solid var(--gris-claro); border-radius:13px; padding:14px 8px; display:flex; flex-direction:column; align-items:center; gap:7px; font-weight:700; font-size:12.5px; background:#fff;}
.pago-btn.active{border-color:var(--rojo); background:#fff5f5; color:var(--rojo);}
.keypad{display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:12px;}
.keypad button{background:var(--gris-fondo); border-radius:12px; padding:15px 0; font-weight:800; font-size:18px;}
.quick-amounts{display:flex; gap:7px; margin-top:8px; flex-wrap:wrap;}
.quick-amounts button{flex:1; background:var(--negro); color:#fff; padding:9px 0; border-radius:10px; font-weight:700; font-size:12px; min-width:62px;}
.recibido-display{background:var(--gris-fondo); border-radius:14px; padding:15px; text-align:center; margin-top:12px;}
.recibido-display .rd-label{font-size:11px; color:var(--gris-oscuro); font-weight:700; text-transform:uppercase;}
.recibido-display .rd-value{font-size:25px; font-weight:900; margin-top:2px;}
.vuelto-row{display:flex; justify-content:space-between; margin-top:11px; font-weight:800; font-size:15px; padding-top:11px; border-top:1px dashed #ccc;}
.vuelto-row.negativo span:last-child{color:var(--rojo);}
.vuelto-row.positivo span:last-child{color:var(--verde);}

.mesas-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:10px;}
.mesas-layout{display:flex; gap:16px; align-items:flex-start;}
.mesas-layout .mesas-zona{flex:2; margin-bottom:0;}
.mesas-layout .mesas-zona-barra{flex:1;}
.mesas-layout .mesas-zona-barra .mesas-grid{grid-template-columns:1fr;}
.mesas-layout .mesas-zona-barra .mesa-card{min-height:90px;}
@media (max-width:800px){ .mesas-layout{flex-direction:column;} }
.mesa-card{background:#fff; border-radius:13px; padding:16px 10px; text-align:center; box-shadow:var(--shadow); font-weight:700;}
.mesa-card.ocupada{background:var(--rojo); color:#fff;}
.mesa-card .mnum{font-size:16px;}
.mesa-card .mestado{font-size:11px; margin-top:4px; opacity:.85; text-transform:uppercase;}

/* ticket */
#ticketPrintArea{font-family:'Inter',monospace; width:290px; margin:0 auto; padding:16px 12px; background:#fff; color:#000; font-size:12px;}
#ticketPrintArea .t-center{text-align:center;}
#ticketPrintArea .t-logo{font-family:'Baloo 2',sans-serif; font-weight:800; font-size:19px;}
#ticketPrintArea .t-logo .red{color:var(--rojo);}
#ticketPrintArea hr{border:none; border-top:1px dashed #999; margin:9px 0;}
#ticketPrintArea .t-line{display:flex; justify-content:space-between; margin:3px 0;}
#ticketPrintArea .t-item{margin:6px 0;}
#ticketPrintArea .t-item .t-item-row{display:flex; justify-content:space-between; font-weight:700;}
#ticketPrintArea .t-item .t-extra{padding-left:10px; color:#555; font-size:11px;}
#ticketPrintArea .t-total{font-size:15px; font-weight:900; display:flex; justify-content:space-between;}
#ticketPrintArea .t-footer{text-align:center; margin-top:11px; font-size:10.5px; color:#555;}

@media print{
  @page { size: auto; margin: 10mm; }
  body *{visibility:hidden;}
  #ticketPrintArea, #ticketPrintArea *{visibility:visible;}
  #ticketPrintArea{position:absolute; top:0; left:0; width:290px; margin:0 auto;}
}
/* ===================== RESPONSIVE (celular / tablet) ===================== */
@media (max-width:1000px){
  .admin-sidebar{transform:translateX(-100%);}
  .admin-sidebar.open{transform:translateX(0);}
  .admin-main{margin-left:0; padding:16px;}
  .admin-topbar-mobile{
    display:flex; align-items:center; justify-content:space-between; background:var(--negro); color:#fff;
    padding:12px 16px; margin:-16px -16px 16px; position:sticky; top:0; z-index:90;
  }
  .admin-topbar-mobile .wm{font-family:'Baloo 2',sans-serif; font-weight:800; font-size:16px;}
  .admin-topbar-mobile .wm .red{color:var(--rojo);}
  .menu-btn{background:#262626; color:#fff; width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center;}
  .sidebar-overlay{position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:99; display:none;}
  .sidebar-overlay.show{display:block;}
  .kpi-grid{grid-template-columns:1fr 1fr;}
  .grid-2{grid-template-columns:1fr;}
}
@media (max-width:800px){
  #venta-view{flex-direction:column;}
  .menu-panel{padding:10px;}
  .cart-panel{width:auto; margin:0 10px 10px; max-height:46vh;}
  .product-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));}
  .tabs .tab{padding:8px 10px; font-size:12px;}
  .session-info{gap:8px;}
  #clock{display:none;}
  .kpi-grid{grid-template-columns:1fr;}
}
@media (max-width:480px){
  .auth-card{padding:20px 16px;}
  .brand .wordmark{font-size:14px;}
  .modal-box{max-width:100%;}
}
