:root{
  --bg:#0b0f14;
  --panel:#111824;
  --panel-2:#0f1620;
  --text:#e6edf6;
  --muted:#9fb0c3;
  --brand:#2dd4bf;
  --danger:#ef4444;
  --warning:#f59e0b;
  --ok:#22c55e;
  --border:rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius:14px;
  --radius-sm:10px;
  --gap:14px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background: radial-gradient(1200px 700px at 20% -10%, rgba(45,212,191,.25), transparent 55%),
              radial-gradient(900px 500px at 110% 0%, rgba(59,130,246,.18), transparent 45%),
              var(--bg);
}

a{color:inherit; text-decoration:none}
small{color:var(--muted)}

.container{
  width: min(1100px, calc(100% - 32px));
  margin:0 auto;
}

.topbar{
  position:sticky;
  top:0;
  z-index:20;
  backdrop-filter: blur(8px);
  background: rgba(11,15,20,.75);
  border-bottom:1px solid var(--border);
}

.topbar-inner{
  display:flex;
  align-items:center;
  gap:18px;
  padding:14px 0;
}

.brand{
  display:flex; align-items:center; gap:10px;
  min-width: 180px;
}
.brand-mark{font-size:22px}
.brand-name{font-weight:700; letter-spacing:.2px}

.nav{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex:1;
}
.nav-link{
  padding:8px 10px;
  border-radius:999px;
  color:var(--muted);
  border:1px solid transparent;
}
.nav-link:hover{
  color:var(--text);
  border-color: var(--border);
  background: rgba(255,255,255,.03);
}

.user-badge{
  text-align:right;
  min-width: 170px;
}
.user-name{font-weight:600; line-height:1.2}
.user-role{color:var(--muted); font-size:12px}

.main{padding: 18px 0 30px}

.footer{
  border-top:1px solid var(--border);
  margin-top: 30px;
  background: rgba(11,15,20,.55);
}
.footer-inner{padding: 18px 0}

.alert{
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border:1px solid var(--border);
  margin-bottom: 12px;
  background: rgba(255,255,255,.03);
}
.alert-success{border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.09)}
.alert-danger{border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.09)}
.alert-warning{border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.09)}
.alert-info{border-color: rgba(59,130,246,.35); background: rgba(59,130,246,.09)}

.card{
  background: linear-gradient(180deg, rgba(17,24,36,.92), rgba(15,22,32,.92));
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header{
  padding: 14px 16px;
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.card-body{padding: 16px}
.card-title{font-weight:700}
.card-subtitle{color:var(--muted); font-size:13px}

.grid{
  display:grid;
  gap: var(--gap);
}
.grid.cols-2{grid-template-columns: repeat(2, minmax(0, 1fr))}
.grid.cols-3{grid-template-columns: repeat(3, minmax(0, 1fr))}
@media (max-width: 860px){
  .grid.cols-2, .grid.cols-3{grid-template-columns: 1fr}
  .brand{min-width: auto}
  .user-badge{display:none}
}

.kpi{
  padding: 14px 16px;
}
.kpi .value{font-size: 26px; font-weight:800}
.kpi .label{color: var(--muted)}

.table{
  width:100%;
  border-collapse: collapse;
}
.table th, .table td{
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th{
  text-align:left;
  color: var(--muted);
  font-weight:600;
  font-size: 13px;
}
.table tr:hover td{
  background: rgba(255,255,255,.02);
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border:1px solid var(--border);
  color: var(--muted);
}
.badge.ok{border-color: rgba(34,197,94,.35); color: rgba(34,197,94,.95)}
.badge.warn{border-color: rgba(245,158,11,.35); color: rgba(245,158,11,.95)}
.badge.danger{border-color: rgba(239,68,68,.35); color: rgba(239,68,68,.95)}
.badge.info{border-color: rgba(59,130,246,.35); color: rgba(59,130,246,.95)}

.form{
  display:grid;
  gap: 12px;
}
.field label{
  display:block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.input, select, textarea{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  outline:none;
}
.input:focus, select:focus, textarea:focus{
  border-color: rgba(45,212,191,.55);
  box-shadow: 0 0 0 3px rgba(45,212,191,.12);
}
textarea{min-height: 90px; resize: vertical}

.row{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
}
.row > *{flex:1}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  font-weight:600;
}
.btn:hover{background: rgba(255,255,255,.07)}
.btn-primary{
  border-color: rgba(45,212,191,.45);
  background: rgba(45,212,191,.12);
}
.btn-danger{
  border-color: rgba(239,68,68,.45);
  background: rgba(239,68,68,.12);
}
.btn-ghost{
  background: transparent;
}
.btn-small{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}
.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.hr{
  height:1px;
  background: var(--border);
  margin: 14px 0;
}

.table-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}
@media (max-width: 900px){.table-grid{grid-template-columns: repeat(2, minmax(0, 1fr));}}
@media (max-width: 560px){.table-grid{grid-template-columns: 1fr;}}

.table-tile{
  padding: 14px;
}

@media print{
  body{background:#fff !important; color:#000 !important;}
  .topbar, .nav, .user-badge, .btn, .alert{display:none !important;}
  .container{width:100% !important; margin:0 !important;}
  .card{box-shadow:none !important; background:#fff !important; border:1px solid #ddd !important;}
  .table th, .table td{border-bottom:1px solid #ddd !important;}
}
.table-tile .title{
  font-weight:800;
  font-size: 18px;
}
.table-tile .meta{
  color: var(--muted);
  font-size: 13px;
  margin-top:4px;
}
.table-tile .status{
  margin-top: 10px;
}
.table-tile .tile-actions{
  margin-top: 12px;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}

.table-tile-top{display:flex; align-items:center; justify-content:space-between; gap:12px}
.table-icon{
  width:72px;
  height:72px;
  border-radius: 18px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  box-shadow: 0 10px 22px rgba(0,0,0,.25);
}
.table-icon img{width:64px; height:64px; object-fit:contain; display:block}
.table-icon.status-FREE{border-color: rgba(34,197,94,.35)}
.table-icon.status-OCCUPIED{border-color: rgba(245,158,11,.35)}
.table-icon.status-RESERVED{border-color: rgba(239,68,68,.35)}


/* ===== Mesas gráficas (mapa) ===== */
.legend{display:flex; flex-wrap:wrap; gap:12px; padding:14px 0; border-bottom:1px solid var(--border); margin-bottom:14px}
.legend-item{display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px}
.dot{width:10px; height:10px; border-radius:999px; display:inline-block; background:rgba(255,255,255,.2)}
.dot.ok{background:var(--ok)}
.dot.warning{background:var(--warning)}
.dot.danger{background:var(--danger)}
.dot.muted{background:rgba(255,255,255,.25)}
.kbd{display:inline-flex; padding:2px 8px; border:1px solid var(--border); border-radius:999px; color:var(--text); background:rgba(255,255,255,.04); font-size:12px}

.table-map{
  position:relative;
  height: 70vh;
  min-height: 420px;
  border:1px dashed rgba(255,255,255,.14);
  border-radius: var(--radius);
  background: radial-gradient(circle at 30% 20%, rgba(45,212,191,.12), transparent 45%),
              radial-gradient(circle at 70% 60%, rgba(245,158,11,.10), transparent 50%),
              rgba(255,255,255,.02);
  overflow:hidden;
}

.table-map.is-editing{
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: rgba(255,255,255,.02);
}

.table-node{
  position:absolute;
  width: 140px;
  height: 92px;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 22px rgba(0,0,0,.30);
  background: rgba(17,24,36,.85);
  backdrop-filter: blur(6px);
  user-select:none;
  touch-action:none;
  cursor: pointer;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.table-node-row{display:flex; align-items:center; gap:10px; width:100%}
.table-node-icon{
  width:44px;
  height:44px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.table-node-icon img{width:38px; height:38px; object-fit:contain; display:block; opacity:.95}
.table-node-main{flex:1 1 auto; display:flex; flex-direction:column; justify-content:space-between}

.table-node.shape-ROUND{ border-radius: 999px; }
.table-node.shape-SQUARE{ border-radius: 18px; }

.table-node-name{font-weight:800; letter-spacing:.2px}
.table-node-badges{display:flex; gap:8px; flex-wrap:wrap}

.table-node.status-FREE{ outline:2px solid rgba(34,197,94,.35); }
.table-node.status-OCCUPIED{ outline:2px solid rgba(245,158,11,.35); }
.table-node.status-RESERVED{ outline:2px solid rgba(239,68,68,.35); }

.table-node.dragging{ transform: scale(1.02); box-shadow: 0 16px 32px rgba(0,0,0,.40); cursor: grabbing; }

/* Drawer */
.drawer.hidden{display:none}
.drawer{position:fixed; inset:0; z-index:60;}
.drawer-backdrop{position:absolute; inset:0; background:rgba(0,0,0,.55);}
.drawer-panel{
  position:absolute;
  right:0; top:0; bottom:0;
  width:min(420px, 92vw);
  background: var(--panel);
  border-left:1px solid var(--border);
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
}
.drawer-header{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:16px 16px 10px 16px; border-bottom:1px solid var(--border)}
.drawer-title{font-size:18px; font-weight:800}
.drawer-sub{color:var(--muted); font-size:13px; margin-top:2px}
.drawer-body{padding:16px; display:flex; flex-direction:column; gap:12px; overflow:auto}
.drawer-actions{display:flex; gap:10px; flex-wrap:wrap}
.drawer-footer{padding:14px 16px; border-top:1px solid var(--border); color:var(--muted)}

/* ===== Productos con imágenes ===== */
.product-toolbar{display:flex; gap:12px; align-items:center; justify-content:space-between; margin-bottom:14px; flex-wrap:wrap}
.product-grid{display:grid; gap:14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));}
.product-card{
  border:1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  background: rgba(255,255,255,.02);
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}
.product-img{position:relative; width:100%; aspect-ratio: 16/10; overflow:hidden; background: rgba(255,255,255,.03)}
.product-img img{width:100%; height:100%; object-fit:cover; display:block}
.product-img-placeholder{width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:34px; color:rgba(255,255,255,.6)}
.product-badges{position:absolute; left:10px; top:10px; display:flex; gap:8px}
.product-body{padding:12px}
.product-name{font-weight:800; font-size:15px; margin-bottom:4px}
.product-meta{color:var(--muted); font-size:12px; margin-bottom:12px}
.product-kpis{display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-bottom:10px}
.kpi{border:1px solid var(--border); border-radius: 12px; padding:10px; background: rgba(255,255,255,.02)}
.kpi-label{color:var(--muted); font-size:12px}
.kpi-value{font-weight:800; margin-top:3px}
.product-actions{display:flex; justify-content:flex-end; padding-top:8px}

/* Product form image preview */
.img-preview{margin-top:10px; border:1px solid var(--border); border-radius:14px; padding:12px; background: rgba(255,255,255,.02)}
.img-preview img{max-width:100%; height:auto; border-radius: 12px; display:block}

/* ===== Catálogo rápido en pedidos ===== */
.catalog{margin-top:14px}
.catalog-header{display:flex; gap:12px; align-items:flex-end; justify-content:space-between; flex-wrap:wrap}
.catalog-search{width:min(320px, 100%)}
.catalog-grid{display:grid; gap:12px; margin-top:12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));}
.catalog-item{
  display:flex; gap:12px; align-items:center;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
  border-radius: var(--radius);
  padding:10px;
  cursor:pointer;
  text-align:left;
}
.catalog-item:hover{transform: translateY(-1px)}
.catalog-img{width:54px; height:54px; border-radius: 14px; overflow:hidden; background: rgba(255,255,255,.03); flex:0 0 auto; display:flex; align-items:center; justify-content:center}
.catalog-img img{width:100%; height:100%; object-fit:cover; display:block}
.catalog-body{flex:1 1 auto}
.catalog-name{font-weight:800}
.catalog-meta{color:var(--muted); font-size:12px; margin-top:2px}
.catalog-add{font-size:22px; color:var(--brand); font-weight:900; padding:0 6px}
