:root {
  /* Logo FoodPi: naranja + carb?n, combinado con teal del sistema */
  --bg: #fff8f3;
  --bg-elev: #ffffff;
  --ink: #2c2c2c;
  --ink-soft: #6b6560;
  --line: #f0e4d8;
  --brand: #ff6b00;
  --brand-deep: #e85d04;
  --accent: #0d9488;
  --accent-soft: #ccfbf1;
  --ok: #0d9488;
  --danger: #dc2626;
  --shadow: 0 8px 28px rgba(255, 107, 0, 0.10);
  --radius: 16px;
  --nav-h: 0px;
  --top-h: 56px;
  --side-w: 220px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 8% -8%, #ffe4cc 0%, transparent 55%),
    radial-gradient(900px 480px at 100% 0%, #d5f5f0 0%, transparent 50%),
    var(--bg);
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.view { min-height: 100%; }
.boot-view {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  min-height: 100dvh;
  background: var(--bg);
}
.boot-card {
  text-align: center;
}
.boot-card .login-logo {
  margin: 0 auto 0.75rem;
}
.boot-msg {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.login-view {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  min-height: 100dvh;
}
.login-card {
  width: min(100%, 400px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
}
.brand-mark {
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand-mark .pi { color: var(--brand); }
.login-logo {
  display: block;
  width: min(100%, 380px);
  height: auto;
  margin: 0 auto 0.85rem;
  object-fit: contain;
}
.login-sub {
  color: var(--ink-soft);
  margin: 0.25rem 0 1.5rem;
  text-align: center;
}
.login-card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.9rem;
}
.login-card input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fffd;
}
.login-links { margin: 0.75rem 0 0; text-align: center; }
.btn-link {
  background: none; border: 0; color: var(--brand-deep); font: inherit;
  font-size: 0.88rem; cursor: pointer; text-decoration: underline; padding: 0;
}
.pass-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.pass-wrap input {
  width: 100%;
  padding-right: 2.75rem !important;
}
.pass-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
}
.pass-toggle:hover,
.pass-toggle.is-on { color: var(--ink); background: rgba(0,0,0,0.04); }
.pass-toggle svg { display: block; }
.error-msg { color: var(--danger); font-size: 0.9rem; margin-top: 0.75rem; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
  line-height: 1.2;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover:not(:disabled) { filter: brightness(0.95); }
.btn-ghost {
  background: #fff;
  color: var(--ink);
  border-color: #e5d5c6;
  box-shadow: 0 1px 2px rgba(44, 44, 44, 0.04);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: #fff7ed;
}
.btn-danger {
  background: #fee2e2;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover:not(:disabled) {
  background: #fecaca;
  border-color: #f87171;
}
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; border-radius: 10px; min-height: 2rem; }

.app-shell {
  display: grid;
  grid-template-rows: var(--top-h) 1fr;
  height: 100dvh;
  width: 100%;
  max-width: none;
  margin: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-h);
  padding: 0 clamp(0.75rem, 2vw, 1.35rem);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  height: 100%;
}
.nav-toggle {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.nav-toggle:hover { border-color: var(--brand); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  position: relative;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  height: 100%;
  padding: 2px 0;
}
.biz-logo {
  width: auto;
  height: calc(var(--top-h) - 14px);
  max-height: calc(var(--top-h) - 14px);
  max-width: min(180px, 42vw);
  border-radius: 0;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  display: block;
}
.biz-name {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
}
.user-menu {
  position: relative;
  flex-shrink: 0;
}
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 46vw;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
}
.user-menu-btn:hover,
.user-menu.open .user-menu-btn { border-color: var(--brand); }
.user-menu-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-caret {
  color: var(--ink-soft);
  font-size: 0.75rem;
  flex-shrink: 0;
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  width: max-content;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(44, 44, 44, 0.12);
  padding: 0.2rem;
  z-index: 40;
}
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.42rem 0.7rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.84rem;
  line-height: 1.2;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.user-menu-item:hover { background: #fff4eb; }
.user-menu-item[data-action="logout"] { color: var(--danger); }
.user-menu-item[data-action="logout"]:hover { background: #fee2e2; }
.chip {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.module-root {
  grid-area: main;
  overflow: auto;
  padding: 0.85rem clamp(0.85rem, 2vw, 1.5rem);
  padding-bottom: calc(0.85rem + var(--safe-b));
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  min-height: 0;
  width: 100%;
}

.shell-body {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-areas: "nav main";
  min-height: 0;
  overflow: hidden;
  position: relative;
  transition: grid-template-columns 0.22s ease;
}
.app-shell.nav-collapsed .shell-body {
  grid-template-columns: 0 minmax(0, 1fr);
}

.side-nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.55rem;
  background: rgba(255,255,255,0.96);
  border-right: 1px solid var(--line);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  min-width: 0;
  transition: opacity 0.18s ease, transform 0.22s ease;
}
.app-shell.nav-collapsed .side-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}
.nav-backdrop {
  display: none;
  grid-area: main;
  z-index: 20;
}
.nav-item {
  flex: 0 0 auto;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  white-space: nowrap;
}
.nav-item.active {
  background: #ffe8d6;
  color: var(--brand-deep);
}
.nav-item:hover { background: #fff4eb; color: var(--ink); }
.nav-item.active:hover { background: #ffe8d6; color: var(--brand-deep); }
.nav-item .nav-ico { font-size: 1.1rem; line-height: 1; width: 1.35rem; text-align: center; flex-shrink: 0; }

@media (max-width: 900px) {
  :root { --top-h: 52px; }
  .shell-body,
  .app-shell.nav-collapsed .shell-body,
  .app-shell:not(.nav-collapsed) .shell-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
  }
  .side-nav {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    height: 100%;
    z-index: 25;
    box-shadow: 8px 0 28px rgba(44, 44, 44, 0.14);
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    border-right: 1px solid var(--line);
  }
  .app-shell.nav-collapsed .side-nav {
    transform: translateX(-105%);
    opacity: 1;
    pointer-events: none;
    box-shadow: none;
  }
  .nav-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 21, 18, 0.4);
    z-index: 20;
    border: none;
    padding: 0;
    width: 100%;
    height: 100%;
  }
  .app-shell.nav-collapsed .nav-backdrop { display: none; }
  .app-shell:not(.nav-collapsed) .nav-backdrop { display: block; }
  .biz-logo { max-width: min(150px, 48vw); height: calc(var(--top-h) - 14px); max-height: calc(var(--top-h) - 14px); }
  .biz-name { font-size: 1.1rem; }
  .user-menu-btn { max-width: 38vw; padding: 0.4rem 0.65rem; font-size: 0.8rem; }
  .module-root { padding: 0.75rem; }
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}
.panel h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
  font-weight: 700;
}
.panel h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }

.grid-cats {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-bottom: 0.65rem;
  scrollbar-width: none;
}
.grid-cats::-webkit-scrollbar { display: none; }
.cat-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
}
.cat-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.prod-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

/* Celular + tablet: dock abajo + sheet de pedido */
@media (max-width: 1023px) {
  .module-root.atencion-touch {
    overflow: visible;
    padding-bottom: calc(5.25rem + var(--safe-b, 0px));
  }
  .atencion-layout {
    display: block;
    position: relative;
    min-height: 0;
  }
  .atencion-catalog {
    min-width: 0;
  }
  .grid-cats {
    position: sticky;
    top: 0;
    z-index: 8;
    margin: 0 0 0.65rem;
    padding: 0.35rem 0 0.45rem;
    background: linear-gradient(180deg, var(--bg, #f6f3ef) 70%, transparent);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    display: flex;
    gap: 0.4rem;
  }
  .grid-cats::-webkit-scrollbar { display: none; }
  .grid-cats .cat-pill {
    flex: 0 0 auto;
  }
  .mesa-grid {
    gap: 0.35rem;
    margin-bottom: 0.55rem !important;
  }
  .mesa-card {
    flex-basis: 3.65rem;
    width: 3.65rem;
    height: 3.65rem;
    max-width: 3.65rem;
    max-height: 3.65rem;
    padding: 0.22rem 0.15rem;
    border-radius: 9px;
    gap: 0.04rem;
  }
  .mesa-card-name {
    font-size: 0.74rem;
  }
  .mesa-card-sub {
    font-size: 0.52rem;
  }
  .atencion-cart-scrim {
    position: fixed;
    inset: 0;
    z-index: 9998;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(28, 22, 18, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .atencion-layout.cart-open .atencion-cart-scrim {
    opacity: 1;
    pointer-events: auto;
  }
  body.atencion-touch #cart-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 10000 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    max-height: min(88dvh, 760px);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 36px rgba(28, 22, 18, 0.18);
    transform: translateY(110%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(0.75rem + var(--safe-b, 0px));
    pointer-events: none;
  }
  body.atencion-touch.atencion-sheet-open #cart-panel,
  body.atencion-touch .atencion-layout.cart-open #cart-panel {
    transform: translateY(0);
    pointer-events: auto;
  }
  body.atencion-touch #cart-panel .cart-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.15rem 0 0.55rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.35rem;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--panel, #fff);
  }
  body.atencion-touch #cart-panel .cart-sheet-head h2 {
    margin: 0;
    font-size: 1.05rem;
  }
  body.atencion-touch #cart-panel .cart-sheet-grab {
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 99px;
    background: #d6cfc6;
    margin: 0.15rem auto 0.55rem;
  }
  body.atencion-touch #atencion-cart-dock {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    padding: 0.55rem 0.65rem 0.55rem 0.85rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #1f1a17;
    color: #fff7f0;
    box-shadow: 0 12px 28px rgba(28, 22, 18, 0.35);
  }
  body.atencion-touch.atencion-sheet-open #atencion-cart-dock,
  body.atencion-touch .atencion-layout.cart-open #atencion-cart-dock {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
  }
  .atencion-cart-dock .dock-meta {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
  }
  .atencion-cart-dock .dock-meta strong {
    display: block;
    font-size: 1rem;
    line-height: 1.15;
  }
  .atencion-cart-dock .dock-meta span {
    display: block;
    margin-top: 0.12rem;
    font-size: 0.75rem;
    opacity: 0.78;
  }
  .atencion-cart-dock .dock-open {
    flex: 0 0 auto;
    border: 0;
    border-radius: 12px;
    padding: 0.55rem 0.8rem;
    font: inherit;
    font-weight: 700;
    background: var(--brand, #e0672c);
    color: #fff;
    cursor: pointer;
  }
  .atencion-cart-dock.dock-pulse {
    animation: atencionDockPulse 0.45s ease;
  }
  @keyframes atencionDockPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.03); }
    100% { transform: scale(1); }
  }
  body.atencion-sheet-open {
    overflow: hidden;
  }
}

/* Grilla de productos (tablet/PC); el pedido en columna solo en escritorio */
@media (min-width: 640px) {
  .prod-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .prod-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Escritorio (sin modo touch): mesas grandes */
body:not(.atencion-touch) .mesa-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 6rem)) !important;
  gap: 0.7rem !important;
  justify-content: start;
}
body:not(.atencion-touch) .mesa-card {
  flex: none !important;
  width: 100% !important;
  height: auto !important;
  min-height: 6rem !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0.4rem 0.3rem !important;
  border-radius: 14px !important;
  gap: 0.1rem !important;
}
body:not(.atencion-touch) .mesa-card-name {
  font-size: 0.95rem !important;
  line-height: 1.15 !important;
}
body:not(.atencion-touch) .mesa-card-sub {
  font-size: 0.65rem !important;
  line-height: 1.2 !important;
}

/* Escritorio: pedido siempre visible a la derecha */
@media (min-width: 1024px) {
  .atencion-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 0.85rem;
    align-items: start;
    min-height: calc(100dvh - var(--top-h) - var(--nav-h) - 2rem);
  }
  .atencion-layout > #atencion-cart-scrim,
  .atencion-layout > .atencion-cart-dock,
  body > #atencion-cart-scrim,
  body > #atencion-cart-dock {
    display: none !important;
  }
  .atencion-layout > #cart-panel,
  body > #cart-panel {
    position: sticky !important;
    top: 0.25rem !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1 !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - var(--top-h) - var(--nav-h) - 1.5rem);
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
    border-radius: var(--radius, 16px);
    overflow: auto;
    grid-column: 2;
    grid-row: 1;
  }
  .atencion-catalog {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  #cart-panel .cart-sheet-head {
    display: block;
    border: 0;
    padding: 0;
    margin: 0;
  }
  #cart-panel .cart-sheet-head h2 {
    margin: 0 0 0.65rem;
  }
  #cart-panel .cart-sheet-grab,
  #cart-panel .cart-sheet-close {
    display: none !important;
  }
  .grid-cats {
    position: sticky;
    top: 0;
    z-index: 8;
    margin: 0 0 0.65rem;
    padding: 0.35rem 0 0.45rem;
    background: linear-gradient(180deg, var(--bg, #f6f3ef) 70%, transparent);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    display: flex;
    gap: 0.4rem;
  }
  .grid-cats::-webkit-scrollbar { display: none; }
  .grid-cats .cat-pill { flex: 0 0 auto; }
}
@media (min-width: 1100px) {
  .prod-grid { grid-template-columns: repeat(4, 1fr); }
  .atencion-layout {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: 1.25rem;
  }
}
@media (min-width: 1400px) {
  .prod-grid { grid-template-columns: repeat(5, 1fr); }
  .atencion-layout {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  }
}
@media (min-width: 1700px) {
  .prod-grid { grid-template-columns: repeat(6, 1fr); }
}
.prod-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f7fffc);
  padding: 0.75rem;
  text-align: left;
  min-height: 84px;
}
.prod-card strong { display: block; font-size: 0.92rem; margin-bottom: 0.25rem; }
.prod-card .prod-incl {
  display: block; font-size: 0.72rem; line-height: 1.25;
  margin: 0 0 0.35rem; color: var(--ink-soft);
}
.prod-card .price { color: var(--brand-deep); font-weight: 700; }
.prod-grid-readonly .prod-card {
  opacity: 0.72;
  cursor: not-allowed;
}
.cart-meta.combo-sel { color: var(--ink-soft); font-size: 0.78rem; }

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line);
}
.cart-line-main { flex: 1 1 auto; min-width: 0; }
.cart-meta { font-size: 0.8rem; color: var(--ink-soft); }
.cart-meta em { font-style: normal; color: var(--brand-deep); }
.cart-line-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  justify-self: end;
}
.cart-note-wrap { grid-column: 1 / -1; }
.btn-note {
  width: 32px; height: 32px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
  font-weight: 700; font-size: 0.75rem; color: var(--ink-soft);
}
.btn-note.has-note {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: #fff4eb;
}
.btn-note.has-desc {
  border-color: var(--danger);
  color: var(--danger);
  background: #fef2f2;
}
.desc-tag { color: var(--danger) !important; font-style: normal; font-weight: 600; }
.note-inline {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--brand);
  border-radius: 10px;
  font-size: 0.85rem;
}
.note-units {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.35rem;
  width: 100%;
  padding: 0.65rem;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
}
.note-units-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.note-head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.note-units-head strong {
  font-size: 0.8rem;
}
.note-apply,
.note-close {
  width: 30px;
  height: 30px;
  border: 1px solid #fdba74;
  border-radius: 10px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
}
.note-apply {
  color: var(--ok);
  border-color: #86efac;
  background: #f0fdf4;
  font-weight: 700;
}
.note-apply:hover {
  color: #166534;
  border-color: #4ade80;
  background: #dcfce7;
}
.note-close:hover {
  color: var(--danger);
  border-color: #fca5a5;
  background: #fff1f2;
}
.note-units-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.3;
}
.note-unit-row {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
}
.note-unit-row span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.note-unit-row .note-inline { margin-top: 0; }
.cart-breakdown { margin-top: 0.35rem; }
.mesa-action-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  margin-top: 0.55rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-items: stretch;
}
.mesa-action-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 42px;
}
#btn-precuenta {
  flex: 1.15 1 0;
  padding: 0.35rem 0.25rem;
  font-size: 0.68rem;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
  hyphens: auto;
}
.mesa-action-icon {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  font-size: 1.25rem;
  padding: 0.3rem 0.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mesa-action-icon#btn-cobrar {
  flex: 1.15 1 0;
  min-width: 0;
  font-size: 1.35rem;
}
.mesa-action-danger {
  color: var(--danger);
  font-size: 1.35rem;
}
.icon-trasladar {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
}
#btn-trasladar-mesa {
  color: #2c2622;
  background: #f3eee8;
  border: 1px solid #e2d8ce;
  box-shadow: none;
}
#btn-trasladar-mesa:hover,
#btn-trasladar-mesa:focus-visible {
  background: #ebe3da;
  border-color: #d5c8bc;
  color: #1f1a17;
}
#btn-trasladar-mesa:active {
  transform: scale(0.97);
}
.icon-swap-arrows {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 0.82;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.06em;
}
.cart-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.92rem; margin: 0.35rem 0; color: var(--ink-soft);
}
.cart-desc label { font-weight: 600; font-size: 0.85rem; }
.cart-desc input {
  width: 7.5rem; padding: 0.4rem 0.55rem;
  border: 1px solid var(--line); border-radius: 10px; text-align: right;
}
.bodega-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.75rem;
}
.bodega-search {
  flex: 1 1 180px;
  min-width: 140px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}
.bodega-toolbar select {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
}
.tip-pcts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.45rem;
}
.tip-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.tip-btn.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.cliente-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.cliente-toggle {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
  text-align: left;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cliente-save-btn {
  flex: 0 0 auto;
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cliente-save-btn svg { display: block; }
.cliente-box {
  display: grid; gap: 0.4rem; margin: 0.45rem 0 0.65rem;
}
.cliente-box .cli-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0.15rem 0 -0.15rem;
}
.cliente-box input,
.cliente-box select {
  width: 100%; padding: 0.55rem 0.65rem;
  border: 1px solid var(--line); border-radius: 10px; font-size: 0.9rem;
  background: #fff;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.qty-ctrl { display: flex; align-items: center; gap: 0.35rem; }
.qty-ctrl button {
  width: 32px; height: 32px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 700;
}
.qty-locked {
  display: inline-flex; align-items: center; min-width: 2rem;
  justify-content: center; font-weight: 700; color: var(--ink-soft);
}
.cart-line-saved { opacity: 0.92; }
.cart-total {
  display: flex; justify-content: space-between;
  font-size: 1.2rem; font-weight: 700; margin: 0.75rem 0;
  color: var(--ink);
}
.report-filters {
  display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: end;
}
.report-filters label { margin: 0; flex: 1 1 120px; min-width: 0; max-width: 100%; }
.report-filters input[type="date"],
.report-filters input[type="month"],
.report-filters select {
  display: block; width: 100%; max-width: 100%; min-width: 0; margin-top: 0.25rem;
  padding: 0.5rem 0.55rem; border: 1px solid var(--line); border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
}
.report-filters .btn {
  flex: 0 1 auto;
  min-width: 0;
}
.report-period { margin-bottom: 0.85rem; }
.report-period-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}
.report-period-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}
.report-period-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.report-period-hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
}
.arq-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.arq-filters label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  display: grid;
  gap: 0.25rem;
}
.arq-filters input,
.arq-filters select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  box-sizing: border-box;
}
.arq-filters .arq-q { grid-column: 1 / -1; }
.arq-table-wrap {
  max-height: min(55vh, 420px);
  overflow: auto;
}
@media (min-width: 560px) {
  .arq-filters {
    grid-template-columns: 1fr 1fr 1fr 1.4fr;
  }
  .arq-filters .arq-q { grid-column: auto; }
}
.report-kpis {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem;
  margin-bottom: 1rem;
}
@media (min-width: 720px) {
  .report-kpis { grid-template-columns: repeat(4, 1fr); }
}
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 0.65rem 0.75rem;
}
.kpi-label { display: block; font-size: 0.75rem; color: var(--ink-soft); }
.kpi strong { font-size: 1.05rem; }
.kpi-delta { display: block; font-size: 0.78rem; font-weight: 600; margin-top: 0.15rem; }
.kpi-delta.up, .delta-up { color: var(--ok); }
.kpi-delta.down, .delta-down { color: var(--danger); }
.muted { color: var(--ink-soft); font-size: 0.78rem; }
.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.pay-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.7rem;
  font-weight: 600;
}
.pay-btn.selected {
  border-color: var(--brand);
  background: #ffe8d6;
}
.kg-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.5rem;
}
.prod-card .price small {
  font-weight: 600;
  opacity: 0.75;
  font-size: 0.78em;
}
.pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}
.pay-head strong { font-size: 0.9rem; }
.pay-lines { display: grid; gap: 0.4rem; }
.pay-line-wrap { display: grid; gap: 0.25rem; }
.pay-line {
  display: grid;
  grid-template-columns: 1fr minmax(5.5rem, 7rem) auto;
  gap: 0.35rem;
  align-items: center;
}
.pay-line select,
.pay-line input {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.pay-line input { text-align: right; }
.pay-tip-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 0.1rem 0.1rem;
}
.pay-tip-row label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.pay-tip-row input {
  width: 6.5rem;
  text-align: right;
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.btn-pay-del {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 1.1rem;
  line-height: 1;
}
.pay-rest {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.pay-rest.ok { color: var(--ok); font-weight: 600; }
.pay-rest.over { color: var(--danger); font-weight: 600; }
.pay-cash-hint {
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: -0.15rem 0 0.25rem;
}
.pay-vuelto {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  color: #0f766e;
  font-size: 1rem;
}
.pay-vuelto strong {
  font-size: 1.25rem;
  font-weight: 700;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-wrap > .table {
  width: max-content;
  min-width: 100%;
}
.table th, .table td {
  text-align: left;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid var(--line);
}
.table th { color: var(--ink-soft); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }

.form-row { margin-bottom: 0.7rem; }
.form-row label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; }
.form-row input:not([type="checkbox"]):not([type="radio"]),
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

/* Color pickers: swatch grande (Chrome suele dejarlos como una línea) */
.form-row input[type="color"] {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 6px;
  border: 1px solid #e5d5c6;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.form-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.form-row input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}
.form-row input[type="color"]::-moz-color-swatch {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}

.promo-dias {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.promo-tipo {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.promo-dia {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid #e5d5c6;
  border-radius: 10px;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.promo-dia input {
  width: auto !important;
  margin: 0;
  accent-color: var(--brand);
}
.promo-dia:has(input:checked) {
  border-color: var(--brand);
  background: #fff7ed;
  color: var(--brand-deep);
}
.promo-prods {
  display: grid;
  gap: 0.35rem;
  max-height: 220px;
  overflow: auto;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf5;
}
.promo-prod {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}
.promo-prod:hover { background: #fff4eb; }
.promo-prod input {
  width: auto !important;
  margin: 0.15rem 0 0;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.promo-prod span { display: flex; flex-wrap: wrap; gap: 0.35rem 0.65rem; align-items: baseline; }

/* Grillas de formularios ? aprovechan ancho en PC */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 0.85rem;
}
.form-grid .form-row { margin-bottom: 0.7rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-2 { grid-template-columns: 1fr; }

.cfg-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: start;
}
.cfg-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.35rem;
  background: var(--panel, #fff);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.cfg-nav-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
}
.cfg-nav-btn:hover { background: rgba(0,0,0,0.04); color: var(--ink); }
.cfg-nav-btn.active {
  background: color-mix(in srgb, var(--brand, #ff6b00) 14%, transparent);
  color: var(--brand, #ff6b00);
}
.cfg-panel { min-width: 0; }
.cfg-carta-stack {
  display: grid;
  gap: 0.85rem;
}
.cfg-fondo-preview {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}
.cfg-fondo-preview img {
  max-height: 72px;
  max-width: 160px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
}
@media (min-width: 900px) {
  .cfg-shell {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 1rem;
  }
  .cfg-nav {
    flex-direction: column;
    position: sticky;
    top: 0.75rem;
    padding: 0.5rem;
  }
  .cfg-nav-btn { text-align: left; width: 100%; }
}

.cfg-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: start;
}
.cfg-layout > .panel {
  margin-bottom: 0;
  height: 100%;
}

@media (min-width: 900px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr 1fr; }
  .cfg-layout {
    grid-template-columns: 1.35fr 1fr;
  }
  .cfg-wide { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .form-grid { grid-template-columns: 1fr 1fr 1fr; }
  .form-grid .span-2 { grid-column: span 2; }
}
.cfg-panel .cfg-layout {
  grid-template-columns: 1fr;
}
@media (min-width: 960px) {
  .cfg-panel .cfg-layout {
    grid-template-columns: 1.3fr 1fr;
  }
  .cfg-panel .cfg-main,
  .cfg-panel .cfg-side {
    grid-column: auto;
  }
}
.row-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.75rem; }
.switch,
.form-row.switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.7rem;
  width: 100%;
  cursor: pointer;
}
.form-row.switch {
  display: block;
  margin-bottom: 0.7rem;
}
.form-row.switch > .switch {
  margin-bottom: 0;
}
.switch input[type="checkbox"],
.form-row.switch input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--brand);
  cursor: pointer;
}
.switch span {
  flex: 0 1 auto;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
}
.switch-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1.1rem;
  margin-bottom: 0.7rem;
}
.switch-row .switch,
.switch-row .form-row.switch {
  width: auto;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.mesa-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-start;
  align-items: flex-start;
}
.mesa-card {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.28rem 0.2rem;
  text-align: center;
  background: #fff;
  font-weight: 700;
  position: relative;
  font: inherit;
  color: inherit;
  box-sizing: border-box;
  flex: 0 0 3.85rem;
  width: 3.85rem;
  height: 3.85rem;
  max-width: 3.85rem;
  max-height: 3.85rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.06rem;
  overflow: hidden;
  line-height: 1.1;
  appearance: none;
  -webkit-appearance: none;
}
.mesa-card-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
}
.mesa-card-sub {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.1;
}
.mesa-card-atiende {
  font-weight: 400;
}
.mesa-card-sub-empty {
  display: none;
}
.mesa-orden {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.mesa-card.libre { border-color: #5eead4; background: #ccfbf1; }
.mesa-card.ocupada { border-color: #fb923c; background: #ffedd5; }
.mesa-card.mesa-off { opacity: 0.55; }
.traslado-mesa-grid {
  max-height: min(48dvh, 360px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 0.35rem;
  padding: 0.15rem 0.1rem 0.35rem;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--top-h, 56px) + 0.75rem);
  bottom: auto;
  transform: translateX(-50%) translateY(-10px);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: min(420px, calc(100vw - 1.5rem));
  padding: 0.85rem 1.15rem 0.85rem 1rem;
  border-radius: 16px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  z-index: 20100;
  box-shadow: 0 14px 36px rgba(31, 26, 23, 0.18);
  border: 1px solid transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.toast-show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-anim {
  animation: toastPop 0.35s ease;
}
.toast::before {
  content: "";
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
}
.toast-ok {
  background: #0f766e;
  color: #ecfdf8;
  border-color: rgba(255, 255, 255, 0.12);
}
.toast-err {
  background: #b91c1c;
  color: #fff5f5;
  border-color: rgba(255, 255, 255, 0.12);
}
.toast-warn {
  background: #c2410c;
  color: #fff7ed;
  border-color: rgba(255, 255, 255, 0.12);
}
.toast-info {
  background: #1f1a17;
  color: #fffaf6;
  border-color: rgba(255, 255, 255, 0.08);
}
@keyframes toastPop {
  0% { transform: translateX(-50%) translateY(-10px) scale(0.96); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

#pwa-install-root[hidden] { display: none !important; }
#pwa-install-root {
  position: fixed;
  inset: auto 0 calc(12px + var(--safe-b)) 0;
  z-index: 1050;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 0.85rem;
}
.pwa-sheet {
  width: min(100%, 460px);
  pointer-events: auto;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  padding: 1rem 1rem 0.95rem;
  color: #fffaf6;
  background:
    radial-gradient(520px 220px at 0% 0%, rgba(255, 255, 255, 0.12), transparent 55%),
    linear-gradient(135deg, #1f1a17 0%, #2c221d 48%, #ff6b00 160%);
  box-shadow: 0 18px 46px rgba(15, 24, 36, 0.28);
}
.pwa-sheet-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1rem;
}
.pwa-sheet-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-right: 2.2rem;
}
.pwa-sheet-brand img {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  padding: 0.35rem;
}
.pwa-sheet-brand strong {
  display: block;
  font-size: 1rem;
}
.pwa-sheet-brand p,
.pwa-sheet-copy {
  margin: 0.22rem 0 0;
  color: rgba(255, 250, 246, 0.88);
  font-size: 0.9rem;
  line-height: 1.45;
}
.pwa-sheet-body {
  margin-top: 0.8rem;
}
.pwa-sheet-steps {
  margin: 0;
  padding-left: 1.1rem;
  color: rgba(255, 250, 246, 0.92);
  font-size: 0.9rem;
  line-height: 1.5;
}
.pwa-sheet-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
}
.pwa-sheet-actions .btn {
  flex: 1 1 0;
  min-height: 44px;
}
.pwa-sheet-actions .btn-ghost {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
}
.pwa-sheet-actions .btn-ghost:hover {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

#modal-root .modal-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 40, 36, 0.52);
  display: grid;
  place-items: end center;
  z-index: 20050;
  padding: 0;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
@media (min-width: 720px) {
  #modal-root .modal-backdrop,
  .modal-backdrop { place-items: center; padding: 1rem; }
}
#modal-root .modal,
.modal {
  width: min(100%, 560px);
  max-width: 100%;
  max-height: 90dvh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid rgba(15, 40, 36, 0.08);
  border-radius: 20px 20px 0 0;
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: 0 22px 56px rgba(15, 40, 36, 0.32);
  animation: slideUp 0.22s ease;
  position: relative;
  z-index: 20051;
  box-sizing: border-box;
}
@media (min-width: 720px) {
  #modal-root .modal,
  .modal { border-radius: 20px; width: min(100%, 640px); }
}
#modal-root .modal.modal-confirm,
.modal.modal-confirm {
  width: min(100%, 420px);
}
.confirm-msg {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
  white-space: normal;
}
.confirm-actions {
  justify-content: flex-end;
  margin-top: 0.35rem;
}
.confirm-actions .btn-danger {
  background: var(--danger);
  color: #fff;
}
.confirm-actions .btn-danger:hover {
  filter: brightness(0.92);
}
.confirm-actions .btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
@media (min-width: 720px) {
  #modal-root .modal.modal-confirm,
  .modal.modal-confirm { width: min(100%, 440px); }
}

@media (max-width: 420px) {
  .pwa-sheet-actions {
    flex-direction: column;
  }
}

.arq-detail-head {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #fff8f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.88rem;
}
@media (min-width: 560px) {
  .arq-detail-head { grid-template-columns: repeat(3, 1fr); }
}
.arq-detail-head .muted { display: block; font-size: 0.72rem; margin-bottom: 0.1rem; }
.arq-pedidos { display: grid; gap: 0.75rem; }
.arq-pedido {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}
.arq-pedido-anul {
  border-color: #fecaca;
  background: #fff7f7;
}
.arq-pedido-h {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.45rem;
}
.arq-pedido-h .muted { flex: 1 1 auto; font-size: 0.75rem; }
.arq-pedido-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.arq-row:hover { background: #fff4eb; }
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem;
}
.modal-head h3 { margin: 0; font-family: var(--display); }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 1.5rem 0.5rem;
}
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #ffe8d6;
  color: var(--brand-deep);
}
.badge.warn { background: #ffedd5; color: #c2410c; }

.print-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.print-flag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #f5f5f4;
  color: var(--ink-soft);
}
.print-flag.on {
  background: #ccfbf1;
  border-color: #99f6e4;
  color: #0f766e;
}
.print-flag.off {
  opacity: 0.45;
  text-decoration: line-through;
}

.hist-detail { display: grid; gap: 0.85rem; }
.hist-list-desktop { display: block; }
.hist-list-mobile { display: none; }
.hist-order-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.hist-order-card:active { transform: scale(0.99); }
.hist-order-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}
.hist-order-card-top strong {
  font-size: 1rem;
  line-height: 1.2;
}
.hist-order-card-meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.35;
}
.hist-order-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  flex-wrap: wrap;
}
.hist-order-card-row .total {
  font-weight: 700;
  font-size: 1.05rem;
}
.hist-order-card-actions {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-top: 0.15rem;
}
@media (max-width: 720px) {
  .hist-list-desktop { display: none; }
  .hist-list-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }
  .report-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    align-items: end;
  }
  .report-filters label {
    flex: none;
    width: 100%;
  }
  .report-filters .btn {
    width: 100%;
  }
}
.hist-meta { margin-bottom: 0.15rem; }
.hist-split {
  display: grid;
  gap: 0.75rem;
  min-height: 0;
}
@media (min-width: 720px) {
  .hist-split {
    grid-template-columns: 9.5rem 1fr;
    gap: 1rem;
    align-items: start;
  }
  .modal.modal-wide { width: min(100%, 760px); }
}
.hist-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
@media (min-width: 720px) {
  .hist-side {
    flex-direction: column;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
  }
}
.hist-side-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.hist-side-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.hist-tab-count {
  display: inline-block;
  margin-left: 0.2rem;
  font-size: 0.72rem;
  opacity: 0.9;
}
.hist-panels { min-width: 0; }
.hist-panel { display: none; }
.hist-panel.active { display: grid; gap: 0.75rem; }
.hist-block h4 {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}
.hist-note {
  font-size: 0.8rem;
  color: var(--brand-deep);
  font-weight: 500;
  margin-top: 0.15rem;
}
.hist-list, .hist-timeline {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.hist-timeline li { line-height: 1.35; }
.hist-detail-table { margin: 0; }
.hist-totals {
  background: #fff8f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}
.badge.muted { background: #e2e8f0; color: #475569; }

.tabs { display: flex; gap: 0.35rem; margin-bottom: 0.75rem; }
.tab {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.55rem;
  font-weight: 600;
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.report-tabs {
  flex-wrap: wrap;
}
.report-tabs .tab {
  flex: 1 1 auto;
  min-width: 7.5rem;
  font-size: 0.82rem;
  padding: 0.45rem 0.55rem;
}
.table tr.row-warn td {
  background: #fff7ed;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  max-height: 240px;
  overflow: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.check-grid label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.check-grid input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--brand);
}
.priv-mod {
  font-weight: 700;
  margin-top: 0.45rem;
  color: var(--brand-deep, #c2410c);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.priv-mod:first-child { margin-top: 0; }
.mod-hint {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.4;
  max-width: 52ch;
}
.mod-title {
  font-family: var(--display);
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
}
.atencion-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.65rem;
  flex-wrap: wrap;
}
.atencion-head .mod-title { margin: 0; }
.atencion-turno {
  margin: 0;
  font-size: 0.8rem;
  text-align: right;
  margin-left: auto;
}
.atencion-search {
  margin: 0 0 0.65rem;
}
.atencion-search input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: var(--panel, #fff);
}
.atencion-prints {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.prints-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.15rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.prints-toggle .prints-chevron {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.85rem;
}
.prints-body {
  margin-top: 0.25rem;
  padding-bottom: 0.15rem;
}
.prints-body-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.print-job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.8rem;
}
.print-job-meta {
  min-width: 0;
  line-height: 1.3;
}
.btn-print-icon {
  flex: 0 0 auto;
  min-width: 2.1rem;
  padding: 0.35rem 0.45rem;
  font-size: 1rem;
  line-height: 1;
}
.mesa-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #fdba74;
  border-radius: 12px;
  background: #fff7ed;
}
.mesa-active-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.mesa-active-meta strong {
  font-size: 0.98rem;
  line-height: 1.2;
}
.mesa-active-meta span {
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.mesa-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.45rem;
}
.mesa-picker-head strong {
  font-size: 0.92rem;
}

/* ?? Superadmin / Plataforma ?? */
.impersonate-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 1rem;
  background: linear-gradient(90deg, #fff7ed, #ffedd5);
  border-bottom: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.88rem;
  font-weight: 600;
}
.sa-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.sa-clock {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-top: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.25;
  max-width: 100%;
}
.sa-clock-k {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 600;
}
.sa-clock strong {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: #f8fafc;
  letter-spacing: 0.02em;
}
.sa-clock-meta {
  color: #94a3b8;
  font-size: 0.72rem;
}
.sa-clock-delta {
  margin-left: auto;
  font-weight: 600;
  font-size: 0.72rem;
}
.sa-clock-ok { color: #86efac; }
.sa-clock-warn { color: #fbbf24; }
.sa-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.sa-list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.sa-list-tools input[type="search"] {
  flex: 1 1 12rem;
  min-width: 10rem;
}
.sa-config-h {
  margin: 1.1rem 0 0.4rem;
  font-size: 1rem;
}
.sa-config-h:first-child { margin-top: 0; }
.sa-config .form-grid {
  grid-template-columns: 1fr;
  gap: 0 0.75rem;
}
.sa-config .form-row { margin-bottom: 0.55rem; }
.sa-config .form-grid .span-2 { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .sa-config .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 1200px) {
  .sa-config .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .sa-config .form-grid .span-2 {
    grid-column: 1 / -1;
  }
}
.sa-banco-grid {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}
.sa-banco-grid .form-row { margin-bottom: 0.5rem; }
.sa-tab-panel { margin-top: 0.35rem; }
.sa-tab-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}
.sa-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
@media (min-width: 720px) {
  .sa-meta-grid { grid-template-columns: 1fr 1fr; }
}
.sa-meta-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}
.sa-meta-card.span-2 { grid-column: 1 / -1; }
.sa-meta-k {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.sa-meta-card strong {
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.25;
}
.sa-smtp-test {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}
.sa-smtp-test .btn { flex-shrink: 0; }
.sa-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}
@media (min-width: 640px) {
  .sa-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 980px) {
  .sa-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.sa-kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
.sa-kpi strong { display: block; font-size: 1.05rem; line-height: 1.2; }
.sa-kpi span { display: block; margin-top: 0.2rem; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.sa-kpi-ok { border-left-color: #16a34a; }
.sa-kpi-info { border-left-color: #0284c7; }
.sa-kpi-paid { border-left-color: #7c3aed; }
.sa-kpi-warn { border-left-color: #d97706; }
.sa-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  margin-bottom: 0.85rem;
}
.sa-alert-warn { background: #fff7ed; border: 1px solid #fdba74; }
.sa-alert-trial { background: linear-gradient(135deg, #fff7ed, #fef3c7); border: 1px solid #fbbf24; display: block; }
.sa-trial-list { display: grid; gap: 0.45rem; margin-top: 0.55rem; }
@media (min-width: 720px) {
  .sa-trial-list { grid-template-columns: repeat(3, 1fr); }
}
.sa-trial-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}
.sa-chart-panel { margin-bottom: 0.75rem; }
.sa-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.sa-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 110px;
  padding-top: 0.5rem;
}
.sa-bar-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem;
}
.sa-bar {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, #fb923c, #ea580c);
  border-radius: 4px 4px 2px 2px;
}
.sa-bar-col span { font-size: 0.62rem; color: var(--ink-soft); }
.sa-list-tools { margin-bottom: 0.65rem; }
.sa-list-tools input { width: 100%; max-width: 420px; }
.sa-link {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.sa-link:hover strong { color: var(--brand); }
.sa-actions { white-space: nowrap; }
.sa-actions .btn { margin: 0.1rem; }
.sa-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.2rem;
}
.sa-pill-trial { background: #e0f2fe; color: #0369a1; }
.sa-pill-paid { background: #dcfce7; color: #166534; }
.sa-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.85rem;
}
.sa-detail-grid {
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 900px) {
  .sa-detail-grid { grid-template-columns: 1.6fr 0.9fr; align-items: start; }
}
.sa-detail-side .panel { margin-bottom: 0.65rem; }
.btn-block { width: 100%; }

.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.report-toolbar .report-period { flex: 1 1 240px; margin-bottom: 0; }
.report-toolbar #rep-excel { margin-top: 0.15rem; flex-shrink: 0; }

/* ?? Plan / renovaci?n ?? */
.renew-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 1rem;
  background: linear-gradient(90deg, #fff7ed, #ffedd5);
  border-bottom: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.88rem;
  font-weight: 600;
}
.renew-banner.renew-banner-urgent {
  background: linear-gradient(90deg, #fef2f2, #fee2e2);
  border-bottom-color: #fca5a5;
  color: #991b1b;
}
.renew-banner-actions { display: flex; align-items: center; gap: 0.35rem; }
.side-nav {
  display: flex;
  flex-direction: column;
}
.nav-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 0;
  overflow-y: auto;
}
.nav-empty {
  margin: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.nav-plan {
  flex: 0 0 auto;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.nav-item-plan { font-weight: 700; }
.nav-plan-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fffaf5;
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.nav-plan-card:hover,
.nav-plan-card.active {
  border-color: #fdba74;
  background: #fff4eb;
}
.nav-plan-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.nav-plan-card-top strong {
  font-size: 0.82rem;
}
.nav-plan-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
}
.nav-plan-badge.trial { background: #e0f2fe; color: #0369a1; }
.nav-plan-badge.paid { background: #dcfce7; color: #166534; }
.nav-plan-badge.expired { background: #fee2e2; color: #991b1b; }
.nav-plan-card-meta {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.nav-plan-card-warn {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #c2410c;
}

/* Listados paginados (AJAX) */
.list-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.list-pager-info {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.list-pager-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.list-pager-size {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0;
}
.list-pager-size select {
  min-width: 4.2rem;
  padding: 0.25rem 0.4rem;
}
.list-pager-page {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  min-width: 5.5rem;
  text-align: center;
}
.list-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.plan-banco {
  margin: 0.65rem 0 0.5rem;
}
.plan-banco-box {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--ink);
}
.plan-pay-title {
  margin: 1.15rem 0 0.65rem;
  font-size: 0.95rem;
}
.plan-pay-methods {
  display: grid;
  gap: 0.85rem;
}
.plan-pay-card {
  padding: 1rem 1.05rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.plan-pay-card--mp {
  border-color: #b6e4f7;
  background: linear-gradient(160deg, #f3fbff 0%, #fff 55%);
}
.plan-pay-card--tr {
  border-color: #e2e8f0;
  background: linear-gradient(160deg, #f8fafc 0%, #fff 55%);
}
.plan-pay-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.plan-pay-card-head strong {
  display: block;
  font-size: 1rem;
  color: var(--ink);
}
.plan-pay-card-head p {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.35;
}
.plan-pay-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
}
.plan-pay-ico--tr {
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}
.plan-pay-ico--mp {
  background: transparent;
  padding: 0;
}
.plan-pay-ico--mp svg {
  display: block;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 158, 227, 0.35);
}
.plan-pay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.plan-pay-btn-ico {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.plan-pay-btn--mp {
  background: #009EE3;
  border-color: #009EE3;
  color: #fff;
  font-weight: 700;
}
.plan-pay-btn--mp:hover,
.plan-pay-btn--mp:focus {
  background: #0088c7;
  border-color: #0088c7;
  color: #fff;
}
.plan-pay-btn--mp .plan-pay-btn-ico svg {
  border-radius: 5px;
}
.plan-pay-actions {
  margin-top: 0.85rem;
  max-width: 22rem;
}
.plan-doc-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.plan-doc-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}
.plan-doc-opt:has(input:checked) {
  border-color: var(--brand);
  background: #fff7ed;
}

/* —— Caja: layout compacto —— */
.caja-page .mod-title { margin-bottom: 0.55rem; }
.caja-layout {
  display: grid;
  gap: 0.65rem;
  align-items: start;
}
.caja-panel {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0;
}
.caja-lead {
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.4;
  max-width: 42ch;
}
.caja-open-form {
  max-width: 22rem;
}
.caja-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.caja-name { margin-left: 0.3rem; }
.caja-meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}
.caja-esperado {
  text-align: right;
}
.caja-esperado strong {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.caja-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.caja-kpis .kpi {
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: #fffaf6;
}
.caja-kpis .kpi strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
}
.caja-kpis .muted {
  display: block;
  margin-top: 0.1rem;
}
.caja-sub {
  margin: 0.7rem 0 0.35rem;
  font-size: 0.88rem;
}
.caja-medios {
  display: grid;
  gap: 0.15rem;
  max-width: 18rem;
}
.caja-medio {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.28rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.9rem;
}
.caja-medio:last-child { border-bottom: 0; }
.caja-medio-amts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  text-align: right;
}
.caja-medio-amts .muted { font-size: 0.72rem; }
.caja-kpis-tips {
  margin-top: 0.4rem;
}
@media (min-width: 640px) {
  .caja-kpis-tips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.caja-actions { margin-top: 0.65rem; }
.caja-empty {
  margin: 0;
  padding: 0.35rem 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-align: left;
}
.caja-hint {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
}
.caja-table th,
.caja-table td {
  padding: 0.4rem 0.3rem;
  font-size: 0.86rem;
  vertical-align: middle;
}
.caja-table th { font-size: 0.72rem; }
.caja-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.caja-table-turnos td:nth-child(2) {
  width: 4.5rem;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.caja-td-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.caja-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
@media (min-width: 640px) {
  .caja-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .caja-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 0.75rem;
  }
  .caja-side { position: sticky; top: 0.5rem; }
}

/* —— Delivery local (Atención) —— */
.delivery-picker { margin-bottom: 0.65rem; }
.delivery-picker-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.delivery-picker-head > strong {
  flex: 0 0 auto;
  white-space: nowrap;
}
.delivery-picker-head > #btn-delivery-nuevo,
.delivery-picker-head > .btn {
  flex: 0 0 auto;
}
.delivery-search {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.delivery-search input {
  width: 100%;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 0.85rem;
  background: var(--panel, #fff);
  box-sizing: border-box;
}
@media (max-width: 639px) {
  .delivery-picker-head {
    flex-wrap: wrap;
  }
  .delivery-search {
    flex: 1 1 100%;
    order: 3;
  }
}
.delivery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.45rem;
  margin-top: 0.45rem;
}
.delivery-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-width: 0;
}
.delivery-card.selected { outline: 2px solid var(--brand); }
.delivery-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  width: 100%;
  flex-wrap: nowrap;
  min-width: 0;
}
.delivery-card-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-deep);
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.delivery-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
}
.delivery-card-sub {
  font-size: 0.75rem;
  color: var(--ink-soft);
}
.delivery-card-addr {
  display: block;
  width: 100%;
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Solo PC: nombre del delivery asignado en la tarjeta */
.delivery-card-rep {
  display: none;
}
body:not(.atencion-touch) .delivery-card-rep {
  display: block;
  width: 100%;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand-deep);
  line-height: 1.3;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.delivery-estado-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  font: inherit;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.14rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.delivery-card .delivery-estado-pill {
  max-width: 5.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.delivery-estado-pill:hover {
  filter: brightness(1.06);
}
button.delivery-estado-pill:active {
  transform: scale(0.97);
}
.mesa-active-meta .delivery-estado-pill {
  color: #fff;
}
.delivery-estado-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0 0.15rem;
}
.delivery-estado-chip {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
}
.delivery-estado-chip.active {
  color: #fff;
  border-color: transparent;
}
.delivery-estado-pill.st-recibido,
.delivery-estado-chip.st-recibido.active,
.delivery-card.st-recibido { border-color: #60a5fa; }
.delivery-estado-pill.st-recibido,
.delivery-estado-chip.st-recibido.active { background: #2563eb; color: #fff; }
.delivery-card.st-recibido { background: #dbeafe; }
.delivery-estado-pill.st-preparando,
.delivery-estado-chip.st-preparando.active { background: #d97706; color: #fff; }
.delivery-card.st-preparando { background: #fef3c7; border-color: #fbbf24; }
.delivery-estado-pill.st-listo,
.delivery-estado-chip.st-listo.active { background: #059669; color: #fff; }
.delivery-card.st-listo { background: #d1fae5; border-color: #34d399; }
.delivery-estado-pill.st-en_camino,
.delivery-estado-chip.st-en_camino.active { background: #7c3aed; color: #fff; }
.delivery-card.st-en_camino { background: #ede9fe; border-color: #a78bfa; }
.delivery-estado-pill.st-entregado,
.delivery-estado-chip.st-entregado.active { background: #475569; color: #fff; }
.delivery-card.st-entregado { background: #e2e8f0; border-color: #94a3b8; }
.delivery-estado-chip.st-recibido:not(.active) { border-color: #60a5fa; color: #1d4ed8; }
.delivery-estado-chip.st-preparando:not(.active) { border-color: #fbbf24; color: #b45309; }
.delivery-estado-chip.st-listo:not(.active) { border-color: #34d399; color: #047857; }
.delivery-estado-chip.st-en_camino:not(.active) { border-color: #a78bfa; color: #6d28d9; }
.delivery-estado-chip.st-entregado:not(.active) { border-color: #94a3b8; color: #475569; }
