:root {
  --ink: #17202a;
  --muted: #687381;
  --line: #dde5ed;
  --soft: #f5f8fb;
  --panel: rgba(255, 255, 255, 0.88);
  --brand: #0891b2;
  --brand-dark: #0e7490;
  --accent: #f97316;
  --danger: #e11d48;
  --ok: #16a34a;
  --blue: #2563eb;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 20%, rgba(13, 148, 136, 0.16), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(245, 158, 11, 0.16), transparent 26%),
    linear-gradient(135deg, #eef7f5 0%, #f8fafc 48%, #fff7ed 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 480px);
}

.auth-visual {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(rgba(12, 28, 34, 0.38), rgba(12, 28, 34, 0.62)),
    url("https://images.unsplash.com/photo-1555396273-367ea4eb4db5?auto=format&fit=crop&w=1500&q=80") center/cover;
  color: #fff;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 22px;
  position: relative;
}

  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  line-height: 1.4;
}

/* Badge en botones del nav */
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
  line-height: 1.4;
  min-width: 18px;
  text-align: center;
}

.brand-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.auth-title {
  max-width: 720px;
}

.auth-title h1 {
  margin: 0 0 18px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.95;
  letter-spacing: 0;
}

.auth-title p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
  line-height: 1.7;
}

.auth-card {
  align-self: center;
  margin: 32px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
  box-shadow: 0 12px 24px rgba(13, 148, 136, 0.22);
}

.btn.secondary {
  color: var(--ink);
  background: #e8eef4;
}

.btn.secondary:hover {
  background: #dfe7ee;
  box-shadow: none;
}

.btn.warning {
  background: var(--accent);
}

.btn.danger {
  background: var(--danger);
}

.btn.full {
  width: 100%;
}

.hint {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 13px;
  line-height: 1.5;
}

.error {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: #05070f;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar .brand-logo {
  box-shadow: none;
}

.nav {
  display: grid;
  gap: 8px;
  flex: 1;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.nav svg,
.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer strong {
  display: block;
}

.sidebar-footer span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 24px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.panel {
  border: 1px solid rgba(221, 229, 237, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.stat small {
  color: var(--ok);
  font-weight: 800;
}

.content-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 0.7fr);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 18px;
}

/* Panel derecho de pedidos: scroll interno */
.panel.order-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.panel.order-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.menu-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

/* Input de búsqueda reutilizable */
.search-input {
  padding: 8px 12px;
  border: 1.5px solid #c8d5e0;
  border-radius: 8px;
  font-size: 13px;
  min-width: 200px;
  background: #f0f4f8;
  color: var(--ink);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
  transition: border-color 0.15s, background 0.15s;
}
.search-input::placeholder {
  color: #94a3b8;
}
.search-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

/* Scroll universal en table-wrap */
.table-wrap {
  overflow-x: auto;
  max-height: 72vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.category-tabs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}

.category-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.category-tabs button.active,
.category-tabs button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #f0fdfa;
}

.product-search {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.product-search input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.product-search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.product-empty {
  grid-column: 1 / -1;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.product-image-container {
  width: 100%;
  height: 120px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--soft);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card strong {
  display: block;
  font-size: 13px;
  min-height: unset;
  line-height: 1.3;
}

.product-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.image-preview-container {
  margin: 16px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.image-preview-container label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}

.image-preview {
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.image-preview img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.receipt-thumb {
  max-width: 80px;
  max-height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.circle-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
}

.circle-btn:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.cart-list,
.activity-list {
  display: grid;
  gap: 10px;
}

/* Lista de items del carrito con scroll */
.cart-list {
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

/* Lista de domicilios/pedidos con scroll */
.order-list {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.cart-item,
.activity-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.cart-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.item-note {
  display: block;
  width: min(360px, 100%);
  min-height: 34px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.item-note:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.total-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #05070f;
  color: #fff;
}

.total-box div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.total-box strong {
  font-size: 24px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #e0f2fe;
  color: #0369a1;
}

.badge.low {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.inventory-search-container {
  /* removed - inventory search UI deleted */
}

.actions-cell {
  display: flex;
  gap: 8px;
}

.table-wrap table tr[data-select-client] {
  cursor: pointer;
}

.table-wrap table tr.selected-row {
  background: rgba(41, 98, 255, 0.08);
}

.mini-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  transition: transform 160ms cubic-bezier(.2,.9,.2,1), box-shadow 160ms ease, opacity 120ms;
  box-shadow: 0 1px 0 rgba(15,23,42,0.04);
  cursor: pointer;
}

.mini-btn:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 10px 30px rgba(41,98,255,0.08);
}

.mini-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 12px rgba(41,98,255,0.06);
}

.mini-btn svg {
  width: 18px;
  height: 18px;
}

.mini-btn.danger {
  color: var(--danger);
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  opacity: 0.7;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse-sync 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-sync {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.sync-indicator small {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.mini-btn.ok {
  color: var(--ok);
}

.mini-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.date-input {
  min-height: 42px;
  border: 1.5px solid #c8d5e0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #f0f4f8;
  font-weight: 800;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.date-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
}

.void-row {
  opacity: 0.62;
  background: #f8fafc;
}

.chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(30px, 1fr));
  align-items: end;
  gap: 8px;
  height: 180px;
  margin-top: 4px;
}

.bar {
  display: grid;
  align-content: end;
  gap: 4px;
  height: 100%;
  position: relative;
}

.bar-value {
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  word-break: break-all;
}

.bar-fill {
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  opacity: 0.55;
  transition: opacity 0.2s;
}

.bar-fill.bar-today {
  opacity: 1;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
}

.bar:hover .bar-fill {
  opacity: 0.85;
}

.bar label {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.bar-label-today {
  color: var(--brand) !important;
  font-weight: 800 !important;
}

.empty {
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.muted-text {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.delivery-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  transition: transform 0.2s, border 0.2s, box-shadow 0.2s;
}

.table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  transition: transform 0.2s, border 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.table-card:hover,
.delivery-card:hover,
.table-card.selected,
.delivery-card.selected {
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.table-card {
  min-height: 150px;
  display: grid;
  gap: 8px;
  align-content: space-between;
}

.table-main {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 118px;
  border: 0;
  padding: 14px 14px 6px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 10px 10px;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.table-card:hover .table-actions,
.table-card:focus-within .table-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.table-card span,
.table-card small,
.delivery-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-card strong {
  font-size: 24px;
}

.table-card b {
  color: var(--ok);
}

.table-card.busy {
  background: linear-gradient(135deg, #fefce8, #ffffff);
  border-color: #fde68a;
}

.table-card.busy b {
  color: #b45309;
}

.table-card.preparing {
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  border-color: #fdba74;
}

.table-card.preparing b {
  color: #c2410c;
}

.table-card.ready {
  background: linear-gradient(135deg, #f0fdf4, #ffffff);
  border-color: #86efac;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.table-card.ready b {
  color: var(--ok);
}

.table-status-label {
  font-size: 10px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

/* Banner alerta mesas listas */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.alert-ready {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
}

/* Badge verde en nav */
.nav-badge-green {
  background: var(--ok) !important;
}

/* Vista de planes */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.plan-card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.plan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.plan-current {
  box-shadow: 0 0 0 2px var(--brand);
}

.table-card.selected,
.delivery-card.selected {
  background: #f0fdfa;
}

.delivery-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.delivery-card strong {
  display: block;
  margin-bottom: 4px;
}

.order-meta {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.order-meta strong {
  color: var(--ink);
}

.order-meta label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.order-meta input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.payment-field {
  margin-top: 14px;
  margin-bottom: 0;
}

.cash-shift-panel {
  margin-bottom: 18px;
}

.cash-form {
  margin-top: 16px;
}

.adjustment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.adjustment-grid .field {
  margin-bottom: 0;
}

.client-box {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.client-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.client-box-head h3 {
  margin: 0;
  font-size: 16px;
}

.client-box-head select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.client-box .field {
  margin-bottom: 10px;
}

.receipt {
  color: #111827;
}

.receipt-head {
  display: grid;
  gap: 4px;
  justify-items: center;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px dashed #cbd5e1;
  text-align: center;
}

.receipt-head strong {
  font-size: 28px;
}

.receipt-head span,
.receipt-head small {
  color: var(--muted);
  font-weight: 700;
}

.receipt-head em {
  padding: 6px 10px;
  border-radius: 8px;
  color: #991b1b;
  background: #fee2e2;
  font-style: normal;
  font-weight: 900;
}

.receipt-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.receipt-info div {
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.receipt-info span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.receipt-info strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.receipt-table th,
.receipt-table td {
  white-space: normal;
}

.receipt-table small {
  color: var(--muted);
}

.receipt-totals {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #cbd5e1;
}

.receipt-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt-totals .grand {
  font-size: 22px;
}

.receipt-note {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.command-ticket {
  color: #111827;
}

.command-meta {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  line-height: 1.6;
}

.command-section {
  margin-top: 16px;
}

.command-section h3 {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #05070f;
  color: #fff;
  font-size: 16px;
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .main,
  .modal-header,
  .modal-backdrop::before,
  .print-hide {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .modal-backdrop {
    position: static;
    display: block;
    padding: 0;
    background: #fff;
  }

  .modal {
    width: 100%;
    max-height: none;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
  }

  .modal-body {
    padding: 0;
  }

  .receipt,
  .command-ticket {
    width: 80mm;
    margin: 0 auto;
    padding: 8mm;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}

.modal {
  width: min(620px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
}

.modal-body {
  padding: 18px;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────── */

/* Pantallas grandes (1280px+): todo normal */
@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

/* Tablets grandes / laptops pequeños (1024px) */
@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .main {
    padding: 18px 20px;
  }
  .topbar h1 {
    font-size: 24px;
  }
  .content-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  }
  .table-wrap {
    max-height: 65vh;
  }
}

/* Tablets (980px) */
@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-visual {
    min-height: 280px;
    padding: 28px;
  }
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    padding: 14px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
  }
  .sidebar .brand-mark {
    width: 100%;
  }
  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: unset;
    width: 100%;
  }
  .sidebar-footer {
    width: 100%;
    margin-top: 0;
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-wrap {
    max-height: 55vh;
  }
  .panel.order-panel {
    max-height: none;
  }
}

/* Móvil grande (768px) */
@media (max-width: 768px) {
  .main {
    padding: 14px 16px;
  }
  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .topbar h1 {
    font-size: 22px;
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal {
    width: 95vw;
    max-width: 95vw;
    margin: 10px;
  }
  .table-wrap {
    max-height: 50vh;
  }
  .btn {
    font-size: 13px;
    padding: 8px 12px;
    min-height: 38px;
  }
  .adjustment-grid {
    grid-template-columns: 1fr;
  }
}

/* Móvil (640px) */
@media (max-width: 640px) {
  .auth-card {
    margin: 12px;
    padding: 20px;
  }
  .main {
    padding: 12px;
  }
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nav button {
    font-size: 12px;
    padding: 10px 10px;
    gap: 6px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stat strong {
    font-size: 22px;
  }
  .topbar h1 {
    font-size: 20px;
  }
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .toolbar .btn,
  .toolbar .search-input {
    width: 100%;
  }
  .table-wrap {
    max-height: 45vh;
  }
  table th, table td {
    padding: 8px 6px;
    font-size: 12px;
  }
  .menu-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .delivery-card {
    flex-direction: column;
    gap: 6px;
  }
  .modal-backdrop {
    padding: 8px;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    overflow-y: auto;
  }
  .actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .mini-btn {
    min-width: 30px;
    min-height: 30px;
  }
}

/* Móvil pequeño (480px) */
@media (max-width: 480px) {
  .nav {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav button {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 6px;
    font-size: 11px;
    gap: 4px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .panel-header {
    padding: 12px;
  }
  .panel-body {
    padding: 12px;
  }
  .topbar {
    margin-bottom: 14px;
  }
  .product-image-container {
    height: 90px;
  }
  .modal-body {
    padding: 14px;
  }
}

/* Print */
@media print {
  .sidebar,
  .main,
  .modal-header,
  .modal-backdrop::before,
  .print-hide {
    display: none !important;
  }
  .app-shell {
    display: block;
  }
  .modal-backdrop {
    position: static;
    display: block;
    padding: 0;
    background: #fff;
  }
  .receipt, .command-ticket {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}
