@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700;9..144,800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0b0908;
  --bg2: #171210;
  --card: #1e1814;
  --card2: #2a211c;
  --line: #3a2e27;
  --text: #f7efe6;
  --muted: #a89888;
  --accent: #ff6a13;
  --accent2: #ffa62b;
  --gold: #f2c46d;
  --ok: #2fd27a;
  --warn: #ffc928;
  --bill: #b779ff;
  --info: #4aa8ff;
  --danger: #ff4d5e;
  --radius: 18px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .7);
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0 0 .4em; letter-spacing: -.01em; }
a { color: var(--accent2); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; width: 100%; outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.gap { gap: 10px; }
.gap-s { gap: 6px; }
.grow { flex: 1; }
.grid { display: grid; gap: 14px; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--card2); padding: 11px 18px; border-radius: 14px; font-weight: 700; transition: transform .12s, background .2s, opacity .2s;
  white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: linear-gradient(135deg, #ff5a00, #ff9a1f); border-color: transparent; color: #1b0d05; box-shadow: 0 10px 30px -10px rgba(255, 106, 19, .7); }
.btn.ok { background: var(--ok); border-color: transparent; color: #04210f; }
.btn.warn { background: var(--warn); border-color: transparent; color: #2a2000; }
.btn.bill { background: var(--bill); border-color: transparent; color: #1a0733; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; border-radius: 10px; font-size: 13px; }
.btn.xs { padding: 4px 9px; border-radius: 8px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.icon { padding: 9px; width: 40px; height: 40px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--card2);
  border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #1b0d05; font-size: 11px; font-weight: 800; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

/* toasts */
#toasts { position: fixed; z-index: 9999; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #2b221c; border: 1px solid var(--line); border-left: 4px solid var(--info); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(-12px); transition: .3s; font-weight: 600; }
.toast.show { opacity: 1; transform: none; }
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }
.toast-bill { border-left-color: var(--bill); }

/* modal */
.modal-wrap { position: fixed; inset: 0; z-index: 1000; background: rgba(5, 3, 2, .72); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .25s; }
.modal-wrap.show { opacity: 1; }
.modal { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px; width: min(560px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow); transform: translateY(16px) scale(.98); transition: transform .25s; }
.modal-wrap.show .modal { transform: none; }
.modal.small { width: min(400px, 100%); }
.modal.wide { width: min(980px, 100%); }
.modal-x { position: absolute; top: 12px; right: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 50%; width: 34px; height: 34px; }

/* toggle */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ---------- Dish3D ---------- */
.d3 { position: relative; perspective: 1100px; perspective-origin: 50% 30%; user-select: none; touch-action: pan-y; cursor: grab; aspect-ratio: 1; }
.d3:active { cursor: grabbing; }
.d3-plate { position: absolute; inset: 7%; transform-style: preserve-3d; will-change: transform; }
.d3-plate img { -webkit-user-drag: none; pointer-events: none; }
.d3-base, .d3-thick { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .22s, transform .22s; }
.d3-base { transform: translateZ(0); filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.d3-base.d3-swap { opacity: 0; transform: translateZ(30px) scale(.96); }
.d3-shadow { position: absolute; inset: 2%; border-radius: 50%; transform: translateZ(-26px); background: radial-gradient(closest-side, rgba(0,0,0,.75), rgba(0,0,0,.35) 70%, transparent); filter: blur(18px); }
.d3-floor { position: absolute; left: 10%; right: 10%; bottom: 0; height: 26%; background: radial-gradient(closest-side, rgba(255,140,60,.13), transparent); filter: blur(10px); pointer-events: none; }
.d3-layers { position: absolute; inset: 0; transform-style: preserve-3d; }
.d3-layer { position: absolute; transform: translate(-50%, -50%) translateZ(var(--z)); transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2, .9, .25, 1.15), opacity .35s, filter .35s, left .5s, top .5s, width .5s, height .5s; }
.d3-layer img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 3px 3px rgba(0,0,0,.45)); transition: clip-path .5s; }
.d3-layer.d3-in { animation: d3drop .85s cubic-bezier(.2, .9, .25, 1.12) both; }
.d3-layer.d3-out { animation: d3lift .5s ease-in forwards; }
@keyframes d3drop {
  0% { transform: translate(-50%, -50%) translateZ(340px) scale(1.25) rotate(-25deg); opacity: 0; }
  45% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateZ(var(--z)) scale(1) rotate(0); opacity: 1; }
}
@keyframes d3lift { to { transform: translate(-50%, -50%) translateZ(260px) scale(1.2) rotate(18deg); opacity: 0; } }
.d3-bounce { animation: d3bounce .5s ease-out; }
@keyframes d3bounce { 30% { margin-top: 7px; } 60% { margin-top: -2px; } 100% { margin-top: 0; } }
.d3-cuts { position: absolute; inset: 0; width: 100%; height: 100%; transform: translateZ(14px); pointer-events: none; overflow: visible; }
.d3-cuts line { stroke: rgba(255, 245, 230, .85); stroke-width: .55; stroke-linecap: round; filter: drop-shadow(0 0 1px rgba(0,0,0,.8)); }
.d3-active-part { fill: rgba(255, 200, 120, .13); stroke: rgba(255, 200, 120, .9); stroke-width: .5; stroke-dasharray: 1.4 1; }
.d3-label {
  position: absolute; left: 100%; top: 0; white-space: nowrap; font: 700 12px var(--sans); color: #fff; background: rgba(20,14,10,.85);
  border: 1px solid rgba(255,255,255,.2); padding: 4px 9px; border-radius: 99px; opacity: 0; pointer-events: none;
  transform: rotateZ(calc(-1 * var(--spin))) rotateX(calc(-1 * var(--tilt))); transition: opacity .3s;
}
.d3-exploded .d3-layer { transform: translate(-50%, -50%) translateZ(var(--ez)); }
.d3-exploded .d3-layer .d3-label:not(:empty) { opacity: 1; }
.d3-layer.d3-l-left .d3-label { left: auto; right: 100%; }
.d3-exploded .d3-cuts { opacity: 0; }
.d3-layer.d3-dim { opacity: .18; filter: grayscale(.7); }
.d3-focus .d3-base { filter: brightness(.55); }
.d3-hint { position: absolute; bottom: 2%; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); background: rgba(0,0,0,.35); padding: 3px 10px; border-radius: 99px; pointer-events: none; opacity: .8; }
.d3-drink .d3-plate { inset: 4% 12%; }
.d3-drink .d3-base { filter: drop-shadow(0 30px 30px rgba(0,0,0,.6)); }
.d3-drink .d3-shadow { display: none; }

@media print { .no-print { display: none !important; } }

/* marca MESA360 (el negro del logo se funde con el fondo) */
.brand-logo { mix-blend-mode: screen; display: block; max-width: 100%; height: auto; }
.powered { display: flex; align-items: center; justify-content: center; gap: 8px; opacity: .75; }
.powered img { height: 22px; width: auto; }
/* pago dividido */
.pay-rows { display: flex; flex-direction: column; gap: 8px; }
.pay-row { display: grid; grid-template-columns: 86px 1fr 1.1fr; gap: 8px; align-items: center; }
.pay-row .pnum { font-weight: 700; font-size: 13px; }
.pay-row .pamt { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding-left: 10px; }
.pay-row .pamt span { color: var(--muted); font-weight: 700; }
.pay-row .pamt input { border: 0; background: transparent; padding: 10px 8px 10px 0; min-width: 0; font-family: var(--mono, monospace); font-weight: 700; }
.pay-row select { padding: 10px; }
.pay-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-status { font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 10px; }
.pay-status.even { color: var(--muted); }
.pay-status.over { color: #2fd27a; background: rgba(47,210,122,.12); }
.pay-status.short { color: #ff5a5a; background: rgba(255,90,90,.12); }
.pay-even { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.seg2 { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg2 button { border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 9px; font-weight: 700; cursor: pointer; }
.seg2 button.on { background: var(--text); color: var(--bg); }
