/* Ricas Tortas — interfaz de pedidos. Colores alegres con buen contraste, botones grandes. */
@font-face { font-family: 'Nunito'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/nunito-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/nunito-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-style: normal; font-display: swap; src: url('/fonts/nunito-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 900; font-style: normal; font-display: swap; src: url('/fonts/nunito-latin-900-normal.woff2') format('woff2'); }

:root {
  --bg: #fff6ea;
  --bg-2: #fdebd3;
  --surface: #ffffff;
  --ink: #2a1a12;
  --ink-2: #5b4336;
  --muted: #7a6355;
  --line: #ecd9c3;
  --brand: #c2185b;
  --brand-dark: #9c1149;
  --brand-soft: #fde4ee;
  --green: #17803a;
  --green-dark: #0f6a2e;
  --green-soft: #dcf5e3;
  --blue: #1d5bd8;
  --blue-soft: #e1eaff;
  --yellow: #f6b400;
  --yellow-soft: #fff3c7;
  --orange: #d9560b;
  --orange-soft: #ffe7d4;
  --red: #c62828;
  --red-soft: #fde3e3;
  --gray-soft: #efe7df;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 0 rgba(42, 26, 18, .05), 0 6px 20px rgba(42, 26, 18, .08);
  --shadow-lg: 0 12px 40px rgba(42, 26, 18, .18);
  --tap: 56px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 900; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .5em; }
a { color: var(--brand-dark); font-weight: 800; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 4px solid #2563eb; outline-offset: 2px; border-radius: 8px; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { font-size: 1.15rem; }
.spacer { flex: 1; }
.icon { flex: none; display: block; }
.boot, .loading { padding: 48px 16px; text-align: center; color: var(--muted); font-size: 1.1rem; }

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 22px; border-radius: 16px; border: 3px solid transparent;
  font-weight: 800; font-size: 1.05rem; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background-color .15s ease, box-shadow .15s ease;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 0 var(--brand-dark); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn-success:hover:not(:disabled) { background: var(--green-dark); }
.btn-warning { background: var(--yellow); color: #2a1a12; box-shadow: 0 4px 0 #c99300; }
.btn-info { background: var(--blue); color: #fff; box-shadow: 0 4px 0 #1544a8; }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 4px 0 #8f1c1c; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-2); }
.btn-ghost-danger { background: transparent; color: var(--red); border-color: transparent; }
.btn-ghost-danger:hover:not(:disabled) { background: var(--red-soft); }
.btn-light { background: rgba(255, 255, 255, .95); color: var(--ink); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: .95rem; border-radius: 12px; }
.btn-lg { min-height: 64px; font-size: 1.15rem; width: 100%; }
.btn-xl { min-height: 72px; font-size: 1.3rem; width: 100%; border-radius: 20px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: 14px; border: 0; background: transparent; color: var(--ink-2);
}
.icon-btn:hover:not(:disabled) { background: var(--bg-2); }
.icon-btn.danger { color: var(--red); }
.icon-btn:disabled { opacity: .4; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 2px dashed var(--line); background: var(--surface); font-weight: 800; font-size: .95rem;
}
.chip-btn.has-note { border-style: solid; border-color: var(--orange); background: var(--orange-soft); }

/* ---------------- Chips ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: .82rem; font-weight: 900; white-space: nowrap; line-height: 1.3;
}
.chip-yellow { background: var(--yellow-soft); color: #6b4d00; }
.chip-blue { background: var(--blue-soft); color: #143f99; }
.chip-green { background: var(--green-soft); color: #0b5a25; }
.chip-red { background: var(--red-soft); color: #8f1c1c; }
.chip-orange { background: var(--orange-soft); color: #8a3505; }
.chip-gray { background: var(--gray-soft); color: var(--ink-2); }
.chip-brand { background: var(--brand-soft); color: var(--brand-dark); }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------------- Estructura ---------------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  background: rgba(255, 246, 234, .96); border-bottom: 2px solid var(--line); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px; }
.brand-mark, .login-mark {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: var(--brand); color: #fff; font-weight: 900; font-size: 1.1rem; box-shadow: 0 3px 0 var(--brand-dark);
}
.brand-name { font-weight: 900; font-size: 1.3rem; color: var(--brand-dark); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-btn {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); font-weight: 800;
}
.usermenu { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 250px; padding: 8px;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 2px solid var(--line);
}
.dropdown-head { display: flex; flex-direction: column; padding: 8px 12px 12px; border-bottom: 2px solid var(--line); margin-bottom: 6px; }
.dropdown-head span { color: var(--muted); font-size: .9rem; }
.dropdown button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 12px;
  border: 0; background: none; border-radius: 12px; text-align: left; font-weight: 800;
}
.dropdown button:hover { background: var(--bg); }
.dropdown button.danger { color: var(--red); }
.conn {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  font-size: .85rem; font-weight: 900; white-space: nowrap;
}
.conn-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.conn-ok { background: var(--green-soft); color: var(--green-dark); }
.conn-warn { background: var(--yellow-soft); color: #6b4d00; }
.conn-warn .conn-dot { animation: blink 1s infinite; }
.conn-bad { background: var(--red-soft); color: #8f1c1c; }
@keyframes blink { 50% { opacity: .2; } }
.sound-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); font-weight: 800; position: relative;
}
.sound-btn.on { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.sound-btn.compact .sound-label { display: none; }
.sound-hint { font-size: .75rem; color: var(--orange); }
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: var(--surface);
  border-bottom: 2px solid var(--line); scrollbar-width: none; position: sticky; top: 66px; z-index: 20;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; background: transparent;
  font-weight: 900; color: var(--ink-2);
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--ink); color: #fff; }
.main { flex: 1; }
.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left)) 120px; }
.page.narrow { max-width: 640px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 18px 0 12px; }
.section-title { font-size: 1.4rem; margin: 0 0 12px; }
.section-head .section-title { margin: 0; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; display: grid; gap: 12px; }
.card.center { justify-items: center; text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; }

/* ---------------- Alertas y avisos ---------------- */
.alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 16px; margin: 0 0 12px; font-weight: 800; }
.alert-bad { background: var(--red-soft); color: #7d1717; border: 2px solid #f3b9b9; }
.alert-warn { background: var(--yellow-soft); color: #5c4200; border: 2px solid #f3dc8a; }
.alert-info { background: var(--blue-soft); color: #143f99; border: 2px solid #bccdfa; }
.banners { position: sticky; top: 66px; z-index: 25; display: grid; gap: 6px; padding: 6px 12px 0; }
.is-admin .banners { top: 130px; }
.banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 18px;
  color: #fff; font-weight: 900; font-size: 1.15rem; box-shadow: var(--shadow-lg); animation: drop .35s ease;
}
.banner-text { flex: 1; }
.banner .icon-btn { color: #fff; }
.banner-new { background: var(--brand); animation: drop .35s ease, flash 1s ease 3; }
.banner-ready { background: var(--green); animation: drop .35s ease, flash 1s ease 3; }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
@keyframes flash { 50% { filter: brightness(1.25); transform: scale(1.01); } }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(560px, calc(100% - 32px)); }
.toast { padding: 14px 18px; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 800; box-shadow: var(--shadow-lg); animation: drop .25s ease; }
.toast-ok { background: var(--green-dark); }
.toast-bad { background: var(--red); }

/* ---------------- Formularios ---------------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field.inline { margin: 0; }
.field-label { font-weight: 900; }
.field-hint { font-size: .85rem; color: var(--muted); }
.field-error { font-size: .9rem; color: var(--red); font-weight: 800; }
.input {
  width: 100%; min-height: 54px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; font-weight: 700;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 4px var(--brand-soft); }
.input-lg { min-height: 62px; font-size: 1.2rem; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.input-addon { flex: none; min-width: 90px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); font-weight: 800; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; font-weight: 700; }
.check input { width: 26px; height: 26px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.switch {
  position: relative; width: 64px; height: 38px; flex: none; border-radius: 999px; border: 0;
  background: #cdbfb2; transition: background .15s;
}
.switch.on { background: var(--green); }
.switch-knob { position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .15s; }
.switch.on .switch-knob { transform: translateX(26px); }
.switch-label { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; }
.segmented { display: inline-flex; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 4px; gap: 4px; }
.segmented button { min-height: 46px; padding: 0 16px; border: 0; border-radius: 12px; background: transparent; font-weight: 900; color: var(--ink-2); }
.segmented button.active { background: var(--ink); color: #fff; }
.filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------------- Login ---------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.login-hero {
  display: grid; place-content: center; justify-items: center; gap: 10px; padding: 40px 20px 24px; text-align: center;
  background: radial-gradient(circle at 20% 20%, #ff8fb8 0, transparent 40%), radial-gradient(circle at 80% 70%, #ffb36b 0, transparent 45%), var(--brand);
  color: #fff;
}
.login-hero h1 { font-size: clamp(2.2rem, 8vw, 3.6rem); }
.login-hero p { font-size: 1.2rem; opacity: .95; }
.login-mark { width: 84px; height: 84px; font-size: 2rem; border-radius: 26px; background: #fff; color: var(--brand); box-shadow: 0 6px 0 rgba(0,0,0,.15); }
.login-card { width: min(460px, calc(100% - 32px)); margin: -12px auto 40px; background: var(--surface); padding: 24px; border-radius: 28px; box-shadow: var(--shadow-lg); display: grid; gap: 6px; }
.login-card h2 { margin-bottom: 8px; }
@media (min-width: 900px) {
  .login { grid-template-columns: 1fr 1fr; align-items: center; }
  .login-hero { min-height: 100vh; }
  .login-card { margin: 0 auto; }
}

/* ---------------- Mesero: mesas ---------------- */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
@media (min-width: 700px) { .table-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; } }
.table-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  aspect-ratio: 1; min-height: 104px; padding: 10px 6px; border-radius: var(--radius); border: 3px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); transition: transform .08s;
}
.table-tile:active { transform: scale(.96); }
.table-label { font-size: .9rem; color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.table-number { font-size: clamp(2.2rem, 9vw, 3.2rem); font-weight: 900; line-height: 1; }
.table-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 22px; }
.table-chips .chip { font-size: .72rem; padding: 2px 7px; }
.table-tile.is-draft { border-color: var(--orange); background: #fffaf5; }
.table-tile.is-busy { border-color: var(--blue); }
.table-tile.is-ready { border-color: var(--green); background: var(--green-soft); }
.table-tile.is-failed { border-color: var(--red); background: var(--red-soft); }
.ready-strip { background: var(--green); color: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.ready-strip h2 { margin-bottom: 10px; }
.ready-list { display: flex; gap: 10px; overflow-x: auto; }
.ready-card { flex: none; display: grid; text-align: left; gap: 2px; padding: 12px 16px; border-radius: 16px; border: 0; background: #fff; color: var(--green-dark); }
.ready-table { font-size: 1.4rem; font-weight: 900; }

/* ---------------- Mesero: pedido ---------------- */
.order-layout { width: 100%; }
.order-layout.is-wide { display: grid; grid-template-columns: minmax(0, 1fr) 420px; max-width: 1400px; margin: 0 auto; align-items: start; }
.order-layout.is-wide .order-main { max-width: none; }
.order-side { position: sticky; top: 70px; max-height: calc(100vh - 70px); overflow-y: auto; padding: 16px 16px 24px 0; }
.is-admin .order-side { top: 136px; max-height: calc(100vh - 136px); }
.order-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.table-title { font-size: clamp(1.9rem, 6vw, 2.6rem); color: var(--brand-dark); }
.category-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .category-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .category-grid { grid-template-columns: repeat(3, 1fr); } }
.category-tile {
  position: relative; display: block; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow); text-align: left; transition: transform .08s;
}
.category-tile:active { transform: scale(.98); }
.category-photo { aspect-ratio: 16 / 9; }
@media (min-width: 560px) { .category-photo { aspect-ratio: 4 / 3; } }
.category-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 18px; color: #fff;
  font-size: clamp(1.6rem, 5vw, 2rem); font-weight: 900; text-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.tone-teal .category-name { background: linear-gradient(transparent, rgba(8, 92, 99, .95) 35%); }
.tone-coffee .category-name { background: linear-gradient(transparent, rgba(92, 50, 24, .95) 35%); }
.tone-amber .category-name { background: linear-gradient(transparent, rgba(160, 80, 0, .95) 35%); }
.tone-green .category-name { background: linear-gradient(transparent, rgba(22, 101, 52, .95) 35%); }
.tone-berry .category-name { background: linear-gradient(transparent, rgba(156, 17, 73, .95) 35%); }
.tone-blue .category-name { background: linear-gradient(transparent, rgba(21, 68, 168, .95) 35%); }
.tone-orange .category-name { background: linear-gradient(transparent, rgba(170, 66, 7, .95) 35%); }
.count-badge, .qty-badge {
  position: absolute; top: 10px; right: 10px; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 999px;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 900; font-size: 1.3rem;
  border: 3px solid #fff; box-shadow: var(--shadow);
}
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; min-height: 48px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-weight: 900; }
.pill.active { color: #fff; border-color: transparent; background: var(--ink); }
.pill.tone-teal.active { background: #0b6f78; }
.pill.tone-coffee.active { background: #6d3b1f; }
.pill.tone-amber.active { background: #a65400; }
.pill.tone-green.active { background: #1a7a3c; }
.pill.tone-berry.active { background: var(--brand); }
.pill.is-off { opacity: .6; border-style: dashed; }

.product-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 1300px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
.product {
  display: grid; grid-template-columns: 128px 1fr; gap: 12px; padding: 10px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); border: 3px solid transparent;
}
.product.in-order { border-color: var(--brand); background: #fffafc; }
.product.sold-out { opacity: .65; }
@media (min-width: 640px) { .product { grid-template-columns: 1fr; padding: 0; overflow: hidden; } }
.product-photo { position: relative; display: block; padding: 0; border: 0; background: none; border-radius: 16px; overflow: hidden; }
.product-photo .photo { aspect-ratio: 4 / 3; height: 100%; }
@media (min-width: 640px) { .product-photo { border-radius: 0; } .product-body { padding: 4px 14px 14px; } }
.product-body { display: grid; gap: 6px; align-content: start; }
.product-name { font-size: 1.15rem; font-weight: 900; }
.product-desc { color: var(--muted); font-size: .9rem; margin: 0; }
.product-price { font-size: 1.25rem; font-weight: 900; color: var(--brand-dark); }
.soldout { position: absolute; inset: auto 0 0 0; padding: 6px; background: rgba(42,26,18,.85); color: #fff; text-align: center; font-weight: 900; }

/* Contador grande */
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.step {
  width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center;
  box-shadow: 0 3px 0 rgba(0,0,0,.15); transition: transform .08s;
}
.step:active:not(:disabled) { transform: scale(.9); }
.step-minus { background: var(--bg-2); color: var(--ink); }
.step-plus { background: var(--brand); color: #fff; }
.step:disabled { opacity: .35; box-shadow: none; }
.step-value { min-width: 44px; text-align: center; font-size: 1.6rem; font-weight: 900; }
.stepper-lg .step { width: 72px; height: 72px; }
.stepper-lg .step-value { min-width: 96px; font-size: 3rem; }
.stepper-sm { gap: 4px; }
.stepper-sm .step { width: 46px; height: 46px; }
.stepper-sm .step-value { min-width: 36px; font-size: 1.35rem; }

/* Fotos */
.photo { position: relative; background: var(--bg-2); overflow: hidden; width: 100%; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-empty { display: grid; place-items: center; aspect-ratio: 4 / 3; background: repeating-linear-gradient(45deg, #f6e3cc, #f6e3cc 12px, #f9ead8 12px, #f9ead8 24px); color: var(--muted); font-size: .85rem; font-weight: 900; }
.photo-badge { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(42, 26, 18, .62); color: #fff; font-size: .68rem; font-weight: 800; }

/* Resumen */
.summary { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; }
.summary-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.summary-empty { padding: 18px; text-align: center; color: var(--ink-2); background: var(--bg); border-radius: 16px; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.line { padding: 10px; border-radius: 18px; background: var(--bg); display: grid; gap: 8px; }
.line.is-missing { background: var(--red-soft); }
.line-top { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; }
.line-photo { width: 56px; height: 56px; border-radius: 12px; }
.line-photo.photo-empty { aspect-ratio: 1; font-size: 0; }
.line-info { display: grid; }
.line-total { font-size: 1.1rem; }
.line-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.line-controls .chip-btn { margin-left: auto; padding: 0 12px; }
.line-note, .order-note { margin: 0; padding: 6px 10px; border-radius: 10px; background: var(--orange-soft); color: #7a3004; font-weight: 800; }
.item-note { display: block; font-style: normal; color: #a1410a; font-size: .9rem; font-weight: 800; }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 4px; border-top: 3px dashed var(--line); font-size: 1.2rem; }
.summary-total strong { font-size: 1.8rem; font-weight: 900; }
.send-btn { font-size: 1.35rem; }
.send-failed { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--red-soft); border: 2px solid #f0a9a9; color: #6e1414; }
.summary-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 12px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.summary-bar-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 640px; margin: 0 auto; min-height: 72px; padding: 0 18px;
  border: 0; border-radius: 22px; background: var(--green); color: #fff; font-weight: 900; font-size: 1.2rem; box-shadow: 0 6px 0 var(--green-dark), var(--shadow-lg);
}
.summary-bar-btn.is-failed { background: var(--red); box-shadow: 0 6px 0 #8f1c1c, var(--shadow-lg); }
.summary-bar-count { display: grid; place-items: center; min-width: 44px; height: 44px; border-radius: 999px; background: #fff; color: var(--green-dark); }
.summary-bar-btn.is-failed .summary-bar-count { color: var(--red); }
.summary-bar-label { flex: 1; text-align: left; }
.sheet-page { max-width: 680px; }

/* Confirmación de envío */
.sent { display: grid; place-items: center; min-height: 70vh; }
.sent-card { width: min(560px, 100%); background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-lg); padding: 28px 22px; text-align: center; display: grid; gap: 12px; }
.sent-check { width: 112px; height: 112px; margin: 0 auto; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.1); } }
.sent-meta { font-size: 1.3rem; font-weight: 900; color: var(--brand-dark); }
.sent-items { list-style: none; margin: 0; padding: 0; text-align: left; display: grid; gap: 4px; }
.sent-items li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line); }

/* ---------------- Tarjetas de pedido (mesero) ---------------- */
.group { margin-bottom: 18px; }
.order-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.order-card { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border-left: 8px solid var(--line); display: grid; gap: 6px; }
.order-card.status-listo { border-left-color: var(--green); background: #f6fff8; }
.order-card.status-preparacion { border-left-color: var(--blue); }
.order-card.status-nuevo { border-left-color: var(--yellow); }
.order-card.status-anulado { opacity: .7; }
.order-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-table { font-size: 1.5rem; font-weight: 900; }
.order-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.order-card-foot { display: flex; justify-content: space-between; border-top: 2px dashed var(--line); padding-top: 8px; font-size: 1.1rem; }

/* ---------------- Caja: tablero ---------------- */
.board-page { max-width: 1500px; }
.board { display: grid; gap: 16px; }
.board-tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.board-tab { flex: 1 0 auto; min-height: 56px; padding: 0 14px; border-radius: 16px; border: 3px solid var(--line); background: var(--surface); font-weight: 900; }
.board-tab.active.tab-nuevo { border-color: var(--yellow); background: var(--yellow-soft); }
.board-tab.active.tab-preparacion { border-color: var(--blue); background: var(--blue-soft); }
.board-tab.active.tab-listo { border-color: var(--green); background: var(--green-soft); }
.badge { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .9rem; margin-left: 6px; }
.column { display: none; flex-direction: column; gap: 12px; }
.column.is-current { display: flex; }
.column-title { display: none; padding: 12px 16px; border-radius: 16px; font-size: 1.2rem; }
.column-nuevo .column-title { background: var(--yellow); color: #2a1a12; }
.column-preparacion .column-title { background: var(--blue); color: #fff; }
.column-listo .column-title { background: var(--green); color: #fff; }
.column-empty { text-align: center; color: var(--muted); padding: 24px; border: 3px dashed var(--line); border-radius: 18px; }
@media (min-width: 1000px) {
  .board-tabs { display: none; }
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .column { display: flex; }
  .column-title { display: block; }
}
.ticket { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: grid; gap: 8px; border: 3px solid transparent; }
.ticket.status-nuevo { border-color: var(--yellow); }
.ticket.is-fresh { animation: fresh 1.1s ease-in-out infinite; border-color: var(--brand); }
@keyframes fresh { 50% { box-shadow: 0 0 0 8px rgba(194, 24, 91, .25), var(--shadow); } }
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ticket-table { font-size: 1.8rem; font-weight: 900; }
.ticket-time { display: grid; text-align: right; }
.ticket-time small { color: var(--muted); font-weight: 800; }
.ticket-meta { margin: 0; color: var(--ink-2); font-weight: 800; }
.ticket-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticket-items li { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ticket-qty { display: grid; place-items: center; height: 34px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 900; font-size: 1.1rem; }
.ticket-name { font-weight: 800; font-size: 1.05rem; }
.ticket-line { color: var(--muted); }
.ticket-total { display: flex; justify-content: space-between; font-size: 1.15rem; }
.ticket-total strong { font-size: 1.4rem; }
.ticket-secondary { display: flex; justify-content: space-between; gap: 8px; }
.recent { margin-top: 20px; background: var(--surface); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.recent summary { cursor: pointer; font-weight: 900; min-height: 44px; display: flex; align-items: center; }
.recent-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.recent-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.recent-list li > span:first-child { flex: 1; }

/* ---------------- Historial ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: grid; border-top: 6px solid var(--line); }
.stat span { color: var(--muted); font-weight: 800; }
.stat strong { font-size: 1.6rem; }
.stat-green { border-top-color: var(--green); }
.stat-brand { border-top-color: var(--brand); }
.stat-red { border-top-color: var(--red); }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history-item { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.history-row { display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 14px; border: 0; background: none; text-align: left; }
.history-table { font-weight: 900; font-size: 1.1rem; }
.history-who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-detail { padding: 4px 16px 14px; border-top: 2px dashed var(--line); display: grid; gap: 8px; }
@media (max-width: 640px) {
  .history-row { grid-template-columns: auto 1fr auto; }
  .history-who, .history-row .chip { display: none; }
}
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }

/* ---------------- Administración del menú ---------------- */
.cat-card { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.cat-card-photo { border-radius: 14px; aspect-ratio: 4 / 3; }
.cat-card-body { display: grid; gap: 10px; justify-items: start; }
.admin-products { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.admin-product { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; background: var(--surface); border-radius: 18px; padding: 10px; box-shadow: var(--shadow); }
.admin-product.is-off { opacity: .7; }
.admin-product-photo { border-radius: 12px; aspect-ratio: 4 / 3; }
.admin-product-info { display: grid; gap: 2px; justify-items: start; }
.admin-product-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .cat-card { grid-template-columns: 110px 1fr; }
  .admin-product { grid-template-columns: 80px 1fr; }
  .admin-product-actions { grid-column: 1 / -1; justify-content: space-between; }
}
.archived { margin-top: 16px; display: grid; gap: 10px; justify-items: start; }
.form-grid { display: grid; gap: 18px; }
@media (min-width: 760px) { .form-grid { grid-template-columns: 1fr 320px; } }
.photo-picker { display: grid; gap: 10px; align-content: start; }
.photo-picker-preview .photo { border-radius: 16px; aspect-ratio: 4 / 3; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-meta { display: grid; gap: 4px; padding: 12px; border-radius: 14px; background: var(--bg); }
.mini-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; width: 100%; margin-top: 8px; }
.mini-tables span { display: grid; place-items: center; height: 42px; border-radius: 10px; background: var(--bg); font-weight: 900; color: var(--ink-2); }

/* ---------------- Usuarios ---------------- */
.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.user-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.user-card.is-off { opacity: .65; }
.user-card-info { display: grid; gap: 4px; }
.user-card-info .chip { margin-right: 6px; }
.user-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.role-card { display: grid; gap: 4px; padding: 14px; border-radius: 16px; border: 3px solid var(--line); background: var(--surface); text-align: left; }
.role-card span { color: var(--muted); font-size: .9rem; }
.role-card.active { border-color: var(--brand); background: var(--brand-soft); }

/* ---------------- Créditos ---------------- */
.credits { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.credit { display: grid; grid-template-columns: 110px 1fr; gap: 12px; background: var(--surface); border-radius: 18px; padding: 10px; box-shadow: var(--shadow); }
.credit-photo { border-radius: 12px; aspect-ratio: 4 / 3; }
.credit-info { display: grid; gap: 3px; font-size: .9rem; justify-items: start; overflow-wrap: anywhere; }

/* ---------------- Diálogos ---------------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(42, 26, 18, .55); display: grid; place-items: end center; padding: 0; }
@media (min-width: 700px) { .modal-backdrop { place-items: center; padding: 24px; } }
.modal { width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg); animation: drop .2s ease; }
@media (min-width: 700px) { .modal { border-radius: 26px; } }
.modal-wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 16px 8px 22px; }
.modal-body { padding: 8px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px max(18px, env(safe-area-inset-bottom)); border-top: 2px solid var(--line); flex-wrap: wrap; }

@media (max-width: 520px) {
  body { font-size: 17px; }
  .user-name, .brand-name { display: none; }
  .conn { padding: 6px 10px; }
  .product { grid-template-columns: 112px 1fr; }
  .step { width: 50px; height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
