/* Estilos base: móvil primero, responsivo para tablet y escritorio. Sin estilos inline (CSP). */
:root {
  --brand: #b33a1e;
  --brand-dark: #8a2a14;
  --ink: #1d1d1f;
  --muted: #6b6b73;
  --bg: #faf7f4;
  --card: #ffffff;
  --line: #e7e1da;
  --ok: #2f7d4f;
  --warn: #b7791f;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; font-size: 16px; line-height: 1.4; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer; border: 0; border-radius: 10px; padding: 12px 16px; min-height: 44px;
  background: var(--brand); color: #fff; font-weight: 600;
}
button:hover { background: var(--brand-dark); }
button.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
button.danger { background: var(--danger); }
button.small { min-height: 34px; padding: 6px 10px; font-size: 14px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: 44px;
}
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.muted { color: var(--muted); font-size: 14px; }
.price { font-weight: 700; color: var(--brand-dark); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #f1e9e2; font-size: 12px; color: var(--muted); }
.tag.alert { background: #fde8e6; color: var(--danger); }
.tag.ok { background: #e4f3ea; color: var(--ok); }
.tag.warn { background: #fdf3dc; color: var(--warn); }
.hidden { display: none !important; }
.pad { padding: 20px; }
.clickable { cursor: pointer; }
.clickable:hover { background: #fbf4ef; }
.center { text-align: center; }
.spacer { flex: 1; }

header.top {
  position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
}
header.top img { height: 40px; width: auto; }
header.top .title { font-weight: 700; font-size: 18px; }
main { padding: 14px; max-width: 1100px; margin: 0 auto; padding-bottom: 96px; }

nav.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); }
nav.tabs button { background: transparent; color: var(--muted); white-space: nowrap; border-radius: 999px; }
nav.tabs button.active { background: var(--brand); color: #fff; }

.banner { border-radius: var(--radius); overflow: hidden; background: linear-gradient(135deg, #f6d7c7, #fbeee6); margin-bottom: 16px; }
.banner .body { padding: 14px; }
.banner h2 { margin: 4px 0; font-size: 20px; }

.product { display: grid; grid-template-columns: 1fr; gap: 10px; }
.product img.thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #eee; }
.product .info { display: flex; flex-direction: column; gap: 6px; }
.product .info .row { justify-content: space-between; }

.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 14px; display: flex; gap: 8px; align-items: center; z-index: 20;
}

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, 96vw); max-height: 92vh; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .dlg-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
dialog .dlg-body { padding: 14px 16px; overflow-y: auto; max-height: calc(92vh - 140px); }
dialog .dlg-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.option-group { margin: 12px 0; }
.option-group h4 { margin: 0 0 6px; font-size: 15px; }
.option-group .choice { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.option-group .choice input { width: 20px; min-height: 20px; height: 20px; margin: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 92vw; box-shadow: var(--shadow);
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

.kanban { display: grid; gap: 12px; grid-template-columns: 1fr; }
.ticket { border-left: 5px solid var(--warn); }
.ticket.preparing { border-left-color: #2b6cb0; }
.ticket.ready { border-left-color: var(--ok); }
.ticket ul { margin: 6px 0; padding-left: 18px; }
.ticket li small { color: var(--muted); display: block; }

.login { max-width: 380px; margin: 10vh auto; }
.kpi { text-align: center; }
.kpi .value { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.kpi .label { font-size: 13px; color: var(--muted); }

/* Tablet */
@media (min-width: 640px) {
  .product { grid-template-columns: 160px 1fr; }
  .product img.thumb { height: 120px; aspect-ratio: auto; }
  .grid.kpis { grid-template-columns: repeat(3, 1fr); }
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
/* Escritorio */
@media (min-width: 1024px) {
  .grid.kpis { grid-template-columns: repeat(4, 1fr); }
  .kanban { grid-template-columns: repeat(3, 1fr); }
  main { padding: 24px; }
}

@media print {
  nav.tabs, header.top button, .cart-bar { display: none !important; }
}
