:root {
  /* Tema base: Monocromo claro. Las paletas solo cambian colores fuente. */
  --bg: #f5f5f5;
  --panel: #ffffff;
  --panel-alt: #f0f0f0;
  --text: #111111;
  --muted: #6b6b6b;
  --line: #dedede;

  --primary: #111111;
  --primary-dark: #000000;
  --accent: #3f3f46;
  --nav: #090909;
  --success: #166534;
  --warning: #92400e;
  --danger: #b91c1c;

  /* Tonos derivados: se adaptan automáticamente al panel claro u oscuro. */
  --primary-soft: color-mix(in srgb, var(--primary) 12%, var(--panel));
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--panel));
  --success-soft: color-mix(in srgb, var(--success) 12%, var(--panel));
  --warning-soft: color-mix(in srgb, var(--warning) 13%, var(--panel));
  --danger-soft: color-mix(in srgb, var(--danger) 12%, var(--panel));

  --shadow-sm: 0 6px 20px rgba(0, 0, 0, .055);
  --shadow: 0 18px 48px rgba(0, 0, 0, .10);
  --radius: 18px;
  --touch: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
body { margin: 0; min-width: 320px; min-height: 100vh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .52; }
button, a, input, select, textarea { outline-offset: 3px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(7, 7, 7, 0.28); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 118px minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 118px;
  height: 100vh;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  z-index: 50;
  padding: 18px 14px 18px;
  background: linear-gradient(180deg, #0f0f0f 0%, #000000 100%);
  box-shadow: 12px 0 34px rgba(8, 8, 8, 0.08);
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 0 4px 22px; position: relative; }
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -.06em;
  color: white;
  background: linear-gradient(145deg, #161616, #020202);
  box-shadow: 0 12px 30px rgba(7, 7, 7, 0.32);
}
.brand-copy { text-align: center; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 12px; line-height: 1.15; }
.brand span { color: #91a0b8; font-size: 10px; margin-top: 4px; }
.sidebar-close { display: none; }
.nav-list { display: grid; gap: 9px; }
.nav-item {
  position: relative;
  border: 0;
  width: 100%;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 5px;
  border-radius: 18px;
  color: #aebbd0;
  background: transparent;
  text-align: center;
  transition: background .16s ease, color .16s ease, transform .12s ease;
}
.nav-item:active { transform: scale(.97); }
.nav-item:hover { background: #161616; color: white; }
.nav-item.active { color: white; background: var(--primary); box-shadow: 0 10px 24px rgba(36, 36, 36, 0.28); }
.nav-icon { width: 32px; height: 28px; display: grid; place-items: center; font-size: 25px; line-height: 1; }
.nav-label { font-size: 11px; font-weight: 750; }
.nav-item b {
  position: absolute;
  top: 7px;
  right: 8px;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 10px;
  background: #ef4444;
  color: white;
  border: 2px solid var(--nav);
}
.sidebar-footer { margin-top: auto; color: #91a0b8; text-align: center; }
.connection-state { display: grid; justify-items: center; gap: 7px; margin-bottom: 6px; font-size: 10px; line-height: 1.25; }
.connection-state i { width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 5px rgba(245,158,11,.1); }
.connection-state i.online { background: #22c55e; box-shadow: 0 0 0 5px rgba(34,197,94,.1); }
.connection-state i.offline { background: #ef4444; box-shadow: 0 0 0 5px rgba(239,68,68,.1); }
.sidebar-footer small { font-size: 9px; }

.main-content { grid-column: 2; min-width: 0; padding: 0 clamp(18px, 2.4vw, 36px) 44px; }
.topbar {
  min-height: 100px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(238, 242, 247, .9);
  backdrop-filter: blur(16px);
}
.topbar h1 { font-size: clamp(23px, 2.5vw, 30px); margin: 0; letter-spacing: -.045em; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.topbar time { color: var(--muted); font-size: 13px; min-width: 160px; text-align: right; }
.menu-button { display: none; width: var(--touch); height: var(--touch); border: 1px solid var(--line); border-radius: 16px; background: white; font-size: 22px; }

.view { display: none; animation: fadeIn .2s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.primary-button, .secondary-button, .text-button, .filter-pill, .icon-button, .table-action {
  border: 0;
  border-radius: 15px;
  transition: transform .12s ease, background .16s ease, box-shadow .16s ease;
}
.primary-button, .secondary-button { min-height: var(--touch); padding: 12px 20px; font-weight: 780; }
.primary-button { background: var(--primary); color: white; box-shadow: 0 9px 22px rgba(10, 10, 10, 0.2); }
.primary-button:hover { background: var(--primary-dark); }
.primary-button:active, .secondary-button:active, .filter-pill:active, .table-action:active { transform: scale(.97); }
.primary-button.compact { min-height: 48px; padding: 10px 18px; font-size: 14px; }
.secondary-button { background: white; color: var(--text); border: 1px solid var(--line); }
.secondary-button:hover { background: #f8fafc; }
.text-button { min-height: 44px; padding: 10px 8px; color: var(--primary); background: transparent; font-weight: 780; }
.danger-text { color: var(--danger); }
.icon-button { width: 52px; height: 52px; background: #edf1f6; color: #475569; font-size: 27px; }

.quick-actions { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.quick-action {
  min-height: 102px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, border-color .16s ease, box-shadow .16s ease;
}
.quick-action:hover { transform: translateY(-2px); border-color: #b8ccf6; box-shadow: var(--shadow); }
.quick-action:active { transform: scale(.985); }
.quick-action.primary-action { color: white; background: linear-gradient(145deg, #313131, #000000); border-color: transparent; }
.quick-action-icon { width: 58px; height: 58px; flex: 0 0 58px; display: grid; place-items: center; border-radius: 18px; font-size: 31px; background: var(--primary-soft); color: var(--primary); }
.primary-action .quick-action-icon { color: white; background: rgba(255,255,255,.17); }
.quick-action strong, .quick-action small { display: block; }
.quick-action strong { font-size: 16px; }
.quick-action small { color: var(--muted); margin-top: 5px; font-size: 12px; }
.primary-action small { color: rgba(255,255,255,.78); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; box-shadow: var(--shadow-sm); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { font-size: 13px; font-weight: 720; }
.metric-card strong { display: block; margin: 12px 0 8px; font-size: clamp(27px, 3vw, 36px); letter-spacing: -.05em; }
.metric-card small { font-size: 11px; line-height: 1.35; }

.content-grid { display: grid; gap: 20px; }
.dashboard-grid { grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; box-shadow: var(--shadow-sm); min-width: 0; }
.flush-panel { padding: 0; overflow: hidden; }
.panel-heading, .section-toolbar, .modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading { margin-bottom: 17px; }
.panel-heading h2, .section-toolbar h2, .modal-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.panel-heading p, .section-toolbar p, .modal-heading p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.section-toolbar { margin-bottom: 18px; }

.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; min-width: 690px; }
th, td { padding: 17px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f7faff; }
[data-order-row] { cursor: pointer; }
.table-action { min-height: 44px; padding: 10px 15px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 780; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-badge.captured { color: #6d42c7; background: #f0eaff; }
.status-badge.scheduled { color: var(--warning); background: var(--warning-soft); }
.status-badge.ready { color: var(--success); background: var(--success-soft); }
.status-badge.completed { color: #2456ad; background: #e8f0ff; }
.status-badge.cancelled { color: var(--danger); background: var(--danger-soft); }
.status-badge.active { color: var(--success); background: var(--success-soft); }
.status-badge.inactive { color: var(--muted); background: #edf1f5; }

.stack-list { display: grid; gap: 11px; }
.stack-item { display: flex; align-items: center; gap: 13px; min-height: 66px; padding: 13px 14px; background: var(--panel-alt); border-radius: 16px; }
.stack-item .stack-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; display: grid; place-items: center; background: white; border: 1px solid var(--line); color: var(--warning); font-weight: 900; }
.stack-item strong, .stack-item small { display: block; }
.stack-item strong { font-size: 14px; }
.stack-item small { color: var(--muted); margin-top: 3px; }
.stack-item b { margin-left: auto; font-size: 12px; color: var(--danger); }
.empty-state { padding: 42px 22px; text-align: center; color: var(--muted); grid-column: 1 / -1; line-height: 1.5; }
.empty-state strong { display: block; color: var(--text); margin-bottom: 5px; font-size: 16px; }

.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(370px, 420px); gap: 20px; align-items: start; }
.catalog-panel { min-width: 0; }
.catalog-toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
.search-field { min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: white; border: 1px solid var(--line); border-radius: 17px; flex: 1; box-shadow: var(--shadow-sm); }
.search-field span { color: #8290a5; font-size: 25px; }
.search-field input { width: 100%; height: 52px; border: 0; outline: 0; background: transparent; font-size: 16px; box-shadow: none; padding: 0; }
.search-field.wide { max-width: 540px; }
.category-chips { display: flex; gap: 10px; overflow-x: auto; padding: 2px 1px 13px; scrollbar-width: thin; }
.category-chip, .filter-pill { flex: 0 0 auto; min-height: 48px; padding: 11px 17px; background: white; border: 1px solid var(--line); color: #475569; font-size: 13px; font-weight: 780; border-radius: 15px; }
.category-chip.active, .filter-pill.active { color: var(--primary); border-color: #c9c9c9; background: var(--primary-soft); box-shadow: inset 0 0 0 1px rgba(37,99,235,.06); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 15px; padding-bottom: 10px; }
.product-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  background: white;
  border-radius: 21px;
  padding: 18px;
  min-height: 184px;
  display: flex;
  flex-direction: column;
  transition: transform .14s ease, border-color .16s ease, box-shadow .16s ease;
  box-shadow: var(--shadow-sm);
}
.product-card::after { content: "+"; position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 22px; font-weight: 800; }
.product-card:hover:not(:disabled) { transform: translateY(-3px); border-color: #a9c3f5; box-shadow: var(--shadow); }
.product-card:active:not(:disabled) { transform: scale(.98); }
.product-card.in-cart { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.1), var(--shadow-sm); }
.product-card.in-cart::after { content: attr(data-cart-quantity); background: var(--primary); color: white; font-size: 14px; }
.product-card .product-code { max-width: calc(100% - 42px); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; line-height: 1.35; }
.product-card strong { margin: 15px 0 7px; font-size: 16px; line-height: 1.28; }
.product-card small { color: var(--muted); line-height: 1.4; font-size: 12px; }
.product-card footer { margin-top: auto; padding-top: 17px; display: flex; align-items: end; justify-content: space-between; gap: 8px; }
.product-card footer b { font-size: 21px; letter-spacing: -.03em; }
.product-card footer span { font-size: 11px; color: var(--muted); text-align: right; }
.product-card.out-of-stock { opacity: .55; }
.product-card.out-of-stock::after { content: "×"; background: #eef1f5; color: #8390a3; }

.cart-panel { position: sticky; top: 114px; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); max-height: calc(100vh - 138px); overflow: auto; overscroll-behavior: contain; }
.cart-heading { margin-bottom: 13px; }
.cart-close { display: none; }
.cart-items { display: grid; gap: 11px; max-height: 310px; overflow-y: auto; padding-right: 3px; overscroll-behavior: contain; }
.cart-item { min-height: 92px; padding: 14px; border: 1px solid var(--line); border-radius: 17px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 13px; }
.cart-item strong { display: block; font-size: 14px; }
.cart-item small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.cart-line-total { font-size: 15px; font-weight: 850; }
.quantity-control { display: inline-flex; align-items: center; gap: 12px; }
.quantity-control button { width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line); background: #f7f9fc; color: var(--text); font-size: 22px; }
.quantity-control b { min-width: 20px; text-align: center; font-size: 16px; }
.remove-item { min-height: 40px; border: 0; background: transparent; color: var(--danger); font-size: 12px; font-weight: 750; padding: 4px 0 4px 8px; }
.checkout-form { margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; background: #edf1f6; border-radius: 16px; padding: 5px; }
.segmented-control button { border: 0; min-height: 48px; padding: 10px 8px; border-radius: 12px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 780; }
.segmented-control button.active { color: var(--primary); background: white; box-shadow: 0 4px 12px rgba(15,23,42,.09); }
.checkout-form label, .modal-form label, .history-filters label { color: #475569; font-size: 12px; font-weight: 760; display: grid; gap: 7px; }
.checkout-form label span, .modal-form label span { color: #8a97aa; font-weight: 520; }
input, select, textarea { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; color: var(--text); background: white; outline: none; font-size: 15px; }
input:focus, select:focus, textarea:focus { border-color: #79a3f5; box-shadow: 0 0 0 4px rgba(37,99,235,.09); }
textarea { resize: vertical; min-height: 76px; }
.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.three-column-fields { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 11px; }
.totals-box { padding: 13px 0 0; display: grid; gap: 10px; }
.totals-box div { display: flex; justify-content: space-between; }
.totals-box span { color: var(--muted); font-size: 13px; }
.totals-box strong { font-size: 15px; }
.totals-box .grand-total { padding-top: 12px; border-top: 1px dashed var(--line); align-items: center; }
.totals-box .grand-total strong { font-size: 27px; }
.checkout-button { width: 100%; min-height: 60px; padding: 14px; font-size: 16px; }
.hidden { display: none !important; }

.filter-bar { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; flex-wrap: wrap; }
.align-right { margin-left: auto; }
.scheduled-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.scheduled-card { background: white; border: 1px solid var(--line); border-radius: 21px; padding: 19px; box-shadow: var(--shadow-sm); }
.scheduled-card.captured-card { border-color: #c6b2ef; box-shadow: 0 8px 26px rgba(109,66,199,.09); }
.scheduled-card.ready-card { border-color: #8fd5bb; box-shadow: 0 8px 26px rgba(18,128,92,.1); }
.scheduled-card header { display: flex; justify-content: space-between; gap: 12px; }
.scheduled-card h3 { margin: 0; font-size: 17px; }
.scheduled-card .customer-line { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.schedule-time { margin: 18px 0; padding: 15px; border-radius: 16px; background: var(--panel-alt); }
.schedule-time small, .schedule-time strong, .schedule-time span { display: block; }
.schedule-time small { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.schedule-time strong { font-size: 15px; }
.schedule-time span { color: var(--muted); font-size: 12px; margin-top: 5px; }
.order-trace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: -5px 0 16px; }
.order-trace-grid > div { min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.order-trace-grid > div > span:first-child { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.trace-user { display: inline-grid; gap: 2px; min-width: 0; }
.trace-user strong { overflow: hidden; color: var(--text); font-size: 12px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.trace-user small { color: var(--muted); font-size: 10px; }
.trace-empty { color: var(--muted); font-size: 12px; font-style: italic; }
#view-history table { min-width: 1120px; }
.scheduled-summary { display: flex; justify-content: space-between; align-items: end; color: var(--muted); font-size: 13px; }
.scheduled-summary b { color: var(--text); font-size: 21px; }
.card-actions { margin-top: 16px; display: flex; gap: 10px; }
.card-actions button { flex: 1; }

.history-filters { background: white; border: 1px solid var(--line); border-radius: 19px; padding: 15px; box-shadow: var(--shadow-sm); }
.history-filters label { min-width: 165px; }
.history-filters .primary-button { align-self: end; }
.checkbox-field { display: flex !important; grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px !important; min-height: 52px; padding: 0 8px; }
.checkbox-field input { width: 22px; height: 22px; min-height: 0; }
.stock-low { color: var(--danger); font-weight: 850; }
.stock-ok { color: var(--success); font-weight: 800; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; padding: 24px; display: grid; place-items: center; background: rgba(15,23,42,.58); backdrop-filter: blur(7px); }
.modal-card { width: min(720px, 100%); max-height: calc(100vh - 48px); overflow: auto; border-radius: 25px; background: white; padding: 24px; box-shadow: 0 28px 90px rgba(15,23,42,.34); }
.order-detail-card { width: min(850px, 100%); }
.modal-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.modal-form { display: grid; gap: 16px; padding-top: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 11px; margin-top: 20px; }
.order-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin: 20px 0; }
.order-meta { min-height: 82px; padding: 14px; background: var(--panel-alt); border-radius: 16px; }
.order-meta span, .order-meta strong { display: block; }
.order-meta span { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.order-meta strong { font-size: 14px; margin-top: 7px; line-height: 1.35; }
.order-notes { margin: 15px 0; padding: 14px; background: #fffbea; border: 1px solid #f3df91; border-radius: 15px; font-size: 13px; }
.order-total-line { display: flex; justify-content: flex-end; gap: 27px; padding: 16px 0 0; font-size: 18px; }

.toast-container { position: fixed; right: max(22px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100vw - 44px)); }
.toast { color: white; background: #1f2937; border-radius: 16px; padding: 16px 18px; box-shadow: 0 15px 42px rgba(15,23,42,.24); animation: toastIn .2s ease; font-size: 14px; }
.toast.success { background: #12684f; }
.toast.error { background: #a93636; }
@keyframes toastIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.floating-cart, .drawer-overlay { display: none; }

@media (min-width: 1400px) {
  .app-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .sidebar { width: 230px; padding-inline: 17px; }
  .brand { flex-direction: row; align-items: center; justify-content: flex-start; padding-inline: 8px; }
  .brand-mark { width: 50px; height: 50px; flex: 0 0 50px; }
  .brand-copy { text-align: left; }
  .brand strong { font-size: 15px; }
  .brand span { font-size: 11px; }
  .nav-item { min-height: 58px; flex-direction: row; justify-content: flex-start; gap: 13px; padding: 10px 14px; text-align: left; }
  .nav-icon { width: 30px; font-size: 23px; }
  .nav-label { font-size: 13px; }
  .nav-item b { position: static; margin-left: auto; border: 0; }
  .connection-state { display: flex; justify-content: flex-start; text-align: left; }
  .sidebar-footer { text-align: left; padding: 0 10px; }
}

@media (max-width: 1180px) {
  .quick-actions { grid-template-columns: 1fr 1fr 1fr; }
  .quick-action { padding: 15px; min-height: 94px; }
  .quick-action-icon { width: 50px; height: 50px; flex-basis: 50px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: minmax(0, 1fr) 365px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
}

/* Tableta vertical y pantallas compactas: navegación inferior y carrito tipo drawer. */
@media (max-width: 900px) {
  :root { --touch: 54px; }
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar {
    inset: auto 0 0 0;
    width: 100%;
    height: calc(78px + env(safe-area-inset-bottom));
    padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    display: block;
    box-shadow: 0 -12px 34px rgba(15,23,42,.17);
  }
  .brand, .sidebar-footer { display: none; }
  .nav-list { height: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
  .nav-item { min-height: 60px; height: 100%; gap: 3px; padding: 5px 3px; border-radius: 16px; }
  .nav-icon { height: 27px; font-size: 23px; }
  .nav-label { font-size: 10px; }
  .nav-item b { top: 2px; right: calc(50% - 29px); min-width: 21px; height: 21px; }
  .main-content { padding: 0 18px calc(105px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 88px; padding-top: env(safe-area-inset-top); }
  .topbar time { display: none; }
  .menu-button { display: none; }
  .topbar-actions .primary-button { display: none; }
  .quick-actions { grid-template-columns: 1.2fr 1fr; }
  .quick-actions .quick-action:last-child { grid-column: 1 / -1; min-height: 82px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .pos-layout { display: block; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cart-panel {
    position: fixed;
    z-index: 92;
    top: 0;
    right: 0;
    width: min(500px, 92vw);
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 28px 0 0 28px;
    padding: max(24px, env(safe-area-inset-top)) 22px max(25px, env(safe-area-inset-bottom));
    transform: translateX(105%);
    transition: transform .22s ease;
    box-shadow: -20px 0 60px rgba(15,23,42,.28);
  }
  body.cart-drawer-open { overflow: hidden; }
  body.cart-drawer-open .cart-panel { transform: translateX(0); }
  .cart-close { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; border: 0; border-radius: 15px; background: #edf1f6; color: #475569; font-size: 26px; }
  .cart-heading { justify-content: flex-start; }
  .cart-heading .danger-text { margin-left: auto; }
  .cart-items { max-height: 34vh; }
  .floating-cart {
    position: fixed;
    z-index: 70;
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(89px + env(safe-area-inset-bottom));
    min-height: 66px;
    padding: 10px 14px;
    border: 0;
    border-radius: 20px;
    display: none;
    align-items: center;
    gap: 12px;
    text-align: left;
    color: white;
    background: #172033;
    box-shadow: 0 16px 40px rgba(15,23,42,.28);
  }
  body.view-pos .floating-cart { display: flex; }
  .floating-cart:active { transform: scale(.985); }
  .floating-cart-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,.12); font-size: 22px; }
  .floating-cart span:nth-child(2) { min-width: 0; }
  .floating-cart strong, .floating-cart small { display: block; }
  .floating-cart strong { font-size: 14px; }
  .floating-cart small { margin-top: 3px; color: #b9c4d5; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .floating-cart b { margin-left: auto; min-width: 35px; height: 35px; padding: 0 8px; display: grid; place-items: center; border-radius: 12px; color: #172033; background: white; }
  .drawer-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15,23,42,.52); backdrop-filter: blur(4px); }
  body.cart-drawer-open .drawer-overlay { display: block; }
  body.view-pos .toast-container { bottom: calc(170px + env(safe-area-inset-bottom)); }
  .modal-card { max-height: calc(100dvh - 48px); }
}

@media (max-width: 700px) {
  .main-content { padding-inline: 12px; }
  .topbar { min-height: 78px; }
  .topbar h1 { font-size: 23px; }
  .topbar p { font-size: 12px; }
  .quick-actions { grid-template-columns: 1fr; gap: 12px; }
  .quick-actions .quick-action:last-child { grid-column: auto; }
  .quick-action { min-height: 80px; }
  .metric-grid { gap: 11px; }
  .metric-card { padding: 16px; border-radius: 18px; }
  .metric-card strong { font-size: 26px; }
  .panel { padding: 17px; border-radius: 20px; }
  .panel-heading, .section-toolbar { align-items: flex-start; }
  .section-toolbar { flex-wrap: wrap; }
  .section-toolbar > button { flex: 1 1 100%; }
  .catalog-toolbar { align-items: stretch; }
  .catalog-toolbar .secondary-button { padding-inline: 13px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .product-card { min-height: 172px; padding: 14px; border-radius: 18px; }
  .product-card strong { font-size: 15px; }
  .product-card footer b { font-size: 18px; }
  .scheduled-grid { grid-template-columns: 1fr; }
  .history-filters label { width: 100%; min-width: 0; }
  .history-filters .primary-button { width: 100%; }
  .two-column-fields, .three-column-fields, .order-meta-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal-card { width: 100%; max-height: calc(100dvh - 20px); border-radius: 25px 25px 0 0; padding: 19px; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
  .modal-actions button { width: 100%; }
  .cart-panel { width: 100%; border-radius: 0; padding-inline: 17px; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { min-height: 160px; }
  .product-card small { display: none; }
  .nav-label { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Acceso, selector de módulos y roles */
.auth-screen, .module-screen {
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}
.auth-screen {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(0, 0, 0, 0.18), transparent 32%),
    radial-gradient(circle at 82% 76%, rgba(27, 27, 27, 0.12), transparent 30%),
    #eef2f7;
}
.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: clamp(28px, 5vw, 44px);
  border: 1px solid rgba(220,227,236,.9);
  border-radius: 30px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 30px 80px rgba(15,23,42,.16);
}
.login-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(145deg, #131313, #000000);
  box-shadow: 0 18px 38px rgba(14, 14, 14, 0.28);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -.06em;
}
.login-copy { text-align: center; margin-bottom: 4px; }
.login-copy h1 { margin: 0; font-size: 29px; letter-spacing: -.045em; }
.login-copy p { margin: 8px 0 0; color: var(--muted); }
.login-card label { display: grid; gap: 8px; color: #475569; font-size: 13px; font-weight: 800; }
.login-card input { min-height: 58px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 17px; background: #f8fafc; }
.login-card input:focus { background: #fff; border-color: var(--primary); }
.login-button { min-height: 60px; margin-top: 4px; font-size: 16px; }
.form-message { min-height: 20px; margin: -4px 0 0; color: var(--danger); text-align: center; font-size: 13px; }

.module-screen { background: var(--bg); }
.module-header {
  width: min(1180px, 100%);
  margin: 0 auto clamp(28px, 5vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.module-header h1 { margin: 5px 0 7px; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.055em; }
.module-header p { margin: 0; color: var(--muted); font-size: 16px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.module-grid {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.module-card {
  min-height: 330px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.module-card:hover:not(:disabled) { transform: translateY(-6px); border-color: #b6caf3; box-shadow: var(--shadow); }
.module-card:active:not(:disabled) { transform: scale(.985); }
.module-icon { width: 82px; height: 82px; display: grid; place-items: center; border-radius: 25px; font-size: 40px; background: var(--primary-soft); color: var(--primary); }
.module-card.orders .module-icon { color: var(--success); background: var(--success-soft); }
.module-card.admin .module-icon { color: #7c3aed; background: #f0eafe; }
.module-card span:nth-child(2) { margin-top: auto; padding-top: 34px; }
.module-card strong, .module-card small { display: block; }
.module-card strong { font-size: 24px; letter-spacing: -.035em; }
.module-card small { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.module-card b { margin-top: 24px; min-height: 48px; padding: 13px 18px; border-radius: 15px; background: var(--primary); color: #fff; font-size: 13px; }
.module-card.locked { filter: grayscale(.55); background: #f3f5f8; }
.module-card.locked b { color: var(--muted); background: #e1e6ed; }

.application-screen { min-height: 100dvh; }
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.back-button { min-height: 50px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 15px; background: #fff; color: var(--text); font-weight: 800; }
.user-pill { min-width: 150px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.78); }
.user-pill span, .user-pill small { display: block; }
.user-pill span { font-size: 12px; font-weight: 850; }
.user-pill small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.role-badge { display: inline-flex; padding: 8px 11px; border-radius: 999px; font-size: 11px; font-weight: 850; white-space: nowrap; }
.role-badge.capture { color: #2456ad; background: #e8f0ff; }
.role-badge.orders { color: var(--success); background: var(--success-soft); }
.role-badge.admin { color: #6d28d9; background: #f0eafe; }

.date-filter-group { display: flex; align-items: end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.date-filter-group label { min-width: 155px; display: grid; gap: 7px; color: #475569; font-size: 11px; font-weight: 800; }
.date-filter-group input { min-height: 52px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.scheduled-toolbar { align-items: end; }

/* Los módulos independientes no muestran la navegación administrativa. */
.mode-standalone .app-shell { display: block; }
.mode-standalone .sidebar { display: none; }
.mode-standalone .main-content { grid-column: 1; max-width: 1600px; margin: 0 auto; padding-inline: clamp(18px, 3vw, 42px); }
.mode-standalone .topbar { border-bottom: 1px solid rgba(220,227,236,.82); }
.mode-standalone .topbar-actions { gap: 12px; }

@media (max-width: 1000px) {
  .module-grid { grid-template-columns: 1fr; max-width: 720px; }
  .module-card { min-height: 210px; display: grid; grid-template-columns: 88px 1fr auto; column-gap: 22px; align-items: center; }
  .module-card span:nth-child(2) { margin: 0; padding: 0; }
  .module-card b { margin: 0; }
  .scheduled-toolbar { align-items: flex-start; }
  .date-filter-group { width: 100%; justify-content: flex-start; }
}

@media (max-width: 900px) {
  .mode-admin .nav-list { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .mode-standalone .main-content { padding-bottom: 28px; }
  .mode-standalone.view-pos .main-content { padding-bottom: 105px; }
  .mode-standalone.view-pos .floating-cart { bottom: max(18px, env(safe-area-inset-bottom)); }
  .mode-standalone.view-pos .toast-container { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .topbar-actions { gap: 8px; }
  .user-pill { display: none; }
}

@media (max-width: 700px) {
  .auth-screen, .module-screen { padding: 16px; }
  .module-header { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .module-header .secondary-button { width: 100%; }
  .module-card { min-height: 260px; display: flex; }
  .module-card span:nth-child(2) { margin-top: auto; padding-top: 26px; }
  .module-card b { margin-top: 20px; width: 100%; text-align: center; }
  .topbar-left { gap: 9px; }
  .back-button { padding-inline: 11px; font-size: 12px; }
  .topbar-actions .secondary-button { min-height: 46px; padding-inline: 13px; }
  .date-filter-group { display: grid; grid-template-columns: 1fr 1fr; }
  .date-filter-group label { min-width: 0; }
  .date-filter-group button { width: 100%; }
}

/* ===== Ventas v4: imágenes, ajustes, branding y modo nocturno ===== */
.brand-logo { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.configurable-mark { overflow: hidden; }
.product-thumb { width: 100%; aspect-ratio: 16 / 10; margin-bottom: 10px; border-radius: 14px; overflow: hidden; background: var(--panel-alt); display: grid; place-items: center; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-thumb-empty { color: var(--muted); font-size: 28px; border: 1px dashed var(--line); }
.table-product-image { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; background: var(--panel-alt); }
.table-product-image.empty { color: var(--muted); border: 1px dashed var(--line); font-size: 19px; }
.image-upload-field { display: grid; gap: 10px; padding: 15px; border: 1px dashed var(--line); border-radius: 18px; background: var(--panel-alt); }
.image-upload-field > div:first-child b, .image-upload-field > div:first-child small { display: block; }
.image-upload-field > div:first-child small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.image-preview-box { width: min(260px, 100%); min-height: 135px; padding: 8px; display: grid; place-items: center; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); overflow: hidden; }
.image-preview-box img { width: 100%; max-height: 190px; object-fit: contain; border-radius: 11px; }
.branding-preview { width: 180px; min-height: 120px; }
.branding-preview span { width: 74px; height: 74px; display: grid; place-items: center; border-radius: 22px; color: white; background: linear-gradient(145deg, var(--primary), var(--primary-dark)); font-size: 24px; font-weight: 900; }
.sales-quick-actions { grid-template-columns: 1.15fr 1fr; }
.settings-layout { display: grid; grid-template-columns: minmax(230px, 290px) minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-tabs { display: grid; gap: 10px; position: sticky; top: 115px; }
.settings-tab { min-height: 92px; padding: 15px; display: grid; grid-template-columns: 40px 1fr; grid-template-areas: "icon title" "icon copy"; gap: 3px 10px; align-items: center; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); text-align: left; box-shadow: var(--shadow-sm); }
.settings-tab > span { grid-area: icon; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 21px; }
.settings-tab b { grid-area: title; font-size: 14px; }
.settings-tab small { grid-area: copy; color: var(--muted); line-height: 1.3; }
.settings-tab.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-sm); }
.settings-tab.active > span { background: var(--primary); color: #fff; }
.settings-pane { display: none; }
.settings-pane.active { display: block; animation: fadeIn .2s ease; }
.settings-form { display: grid; gap: 17px; }
.settings-form > label { color: #475569; font-size: 12px; font-weight: 760; display: grid; gap: 7px; }
.settings-form input:not([type="checkbox"]):not([type="color"]), .settings-form select, .settings-form textarea { width: 100%; min-height: 52px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); }
.settings-form textarea { min-height: 80px; resize: vertical; }
.color-input-wrap { display: grid; grid-template-columns: 56px 1fr; gap: 8px; }
.color-input-wrap input[type="color"] { width: 56px; height: 52px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.settings-checkbox { align-content: center; min-height: 52px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-alt); }
.settings-callout { padding: 16px; border-radius: 16px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); }
.settings-callout strong { display: block; color: var(--primary-dark); }
.settings-callout p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ticket-options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ticket-options-grid .checkbox-field { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-alt); }
.sale-success-card { max-width: 460px; text-align: center; }
.sale-success-icon { width: 76px; height: 76px; margin: 4px auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 38px; font-weight: 900; }
.sale-success-copy h2 { margin: 0; font-size: 26px; }
.sale-success-copy p { color: var(--muted); margin: 8px 0 20px; }
.print-frame { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; left: -9999px; top: -9999px; }

/* Seis accesos en navegación móvil. */
@media (max-width: 900px) {
  .nav-list { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .nav-item { padding-inline: 2px; }
  .nav-label { font-size: 9px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { position: static; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .settings-tab { min-height: 82px; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 5px; padding: 9px; }
  .settings-tab > span { width: 34px; height: 34px; }
  .settings-tab small { display: none; }
}
@media (max-width: 600px) {
  .ticket-options-grid { grid-template-columns: 1fr; }
  .settings-tabs { grid-template-columns: 1fr; }
  .settings-tab { min-height: 64px; flex-direction: row; justify-content: flex-start; text-align: left; padding: 10px 12px; }
  .settings-tab small { display: block; margin-left: auto; max-width: 50%; text-align: right; }
}

/* Compatibilidad de componentes que necesitan un ajuste explícito en oscuro. */
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] .login-card label,
html[data-theme="dark"] .checkout-form label,
html[data-theme="dark"] .modal-form label,
html[data-theme="dark"] .settings-form > label { color: #c7d0d6; }

/* v4.1 · Tipos de negocio, restaurante, cocina y mesas */
.restaurant-sale-options { display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-alt); }
.restaurant-sale-hint { padding: 10px 12px; border-radius: 12px; background: var(--primary-soft); color: var(--muted); font-size: 12px; line-height: 1.45; }
.kitchen-product-badge { position: absolute; top: 13px; right: 13px; z-index: 2; padding: 6px 9px; border-radius: 999px; color: #7a4300; background: #fff1cc; border: 1px solid #f2d98d; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.product-card { position: relative; }

.segmented-filter { width: fit-content; max-width: 100%; margin: 0 0 18px; padding: 5px; display: flex; gap: 5px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-sm); }
.segmented-filter button { min-height: 44px; padding: 9px 16px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-weight: 850; }
.segmented-filter button.active { color: #fff; background: var(--primary); }

.kitchen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.kitchen-empty { grid-column: 1 / -1; }
.kitchen-card { display: flex; flex-direction: column; min-height: 280px; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow-sm); }
.kitchen-card.pending { border-top: 4px solid #d38a16; }
.kitchen-card.ready { border-top: 4px solid var(--success); }
.kitchen-card header, .kitchen-card footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kitchen-card h3 { margin: 7px 0 0; font-size: 16px; }
.order-folio { color: var(--muted); font-size: 11px; font-weight: 850; }
.kitchen-location { display: inline-flex; align-items: center; gap: 6px; }
.kitchen-location.table { color: var(--primary-dark); }
.kitchen-location.counter { color: var(--text); }
.kitchen-status { display: inline-flex; align-items: center; justify-content: center; padding: 7px 10px; border-radius: 999px; white-space: nowrap; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.kitchen-status.pending { color: #875000; background: #fff0cb; }
.kitchen-status.ready { color: #087052; background: var(--success-soft); }
.kitchen-items { margin: 18px 0; padding: 0; display: grid; gap: 10px; list-style: none; }
.kitchen-items li { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--panel-alt); }
.kitchen-items li b { font-size: 16px; color: var(--primary-dark); }
.kitchen-items li span { font-weight: 800; }
.kitchen-items li small { color: var(--muted); }
.kitchen-notes { margin: 0 0 15px; padding: 11px 12px; border-radius: 13px; color: #735000; background: #fff8df; border: 1px solid #f1dfaa; font-size: 12px; line-height: 1.45; }
.kitchen-card footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); align-items: center; }
.kitchen-card footer div:first-child small, .kitchen-card footer div:first-child span { display: block; }
.kitchen-card footer div:first-child small { color: var(--muted); }
.kitchen-card footer div:first-child span { margin-top: 4px; font-size: 12px; font-weight: 800; }
.ready-meta { text-align: right; }
.ready-meta b, .ready-meta small { display: block; }
.ready-meta b { color: var(--success); }
.ready-meta small { margin-top: 4px; color: var(--muted); }

.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 15px; }
.table-card { min-height: 185px; padding: 18px; display: grid; grid-template-columns: 54px 1fr; grid-template-rows: auto 1fr auto; gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 22px; color: var(--text); background: var(--panel); text-align: left; box-shadow: var(--shadow-sm); }
.table-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.table-card.open { border-color: color-mix(in srgb, var(--primary) 38%, var(--line)); }
.table-card-icon { grid-row: 1 / 3; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: var(--primary-soft); color: var(--primary-dark); font-size: 25px; }
.table-card div strong, .table-card div small { display: block; }
.table-card div strong { font-size: 18px; }
.table-card div small { margin-top: 6px; color: var(--muted); line-height: 1.35; }
.table-card > b { grid-column: 2; align-self: end; font-size: 22px; }
.table-card.free > b { color: var(--success); font-size: 15px; }
.table-card-action { grid-column: 1 / -1; padding-top: 11px; border-top: 1px solid var(--line); color: var(--primary-dark); font-size: 12px; font-weight: 850; }

.table-order-block { margin-top: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel-alt); }
.table-order-block header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.table-order-block header b, .table-order-block header small { display: block; }
.table-order-block header small { margin-top: 4px; color: var(--muted); }
.table-order-items { margin-top: 12px; display: grid; gap: 6px; }
.table-order-items span { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.table-order-items em { font-style: normal; font-weight: 800; }
.table-session-total { margin: 18px 0; padding: 16px; display: flex; justify-content: space-between; align-items: center; border-radius: 16px; background: var(--primary-soft); }
.table-session-total strong { font-size: 24px; }
.table-checkout-bar { margin-top: 18px; padding-top: 17px; display: flex; align-items: end; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--line); }
.table-checkout-bar label { min-width: 200px; display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.table-checkout-bar select { min-height: 50px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); }
.settings-callout.warning { background: var(--warning-soft); border-color: #eed9aa; }
.settings-callout.warning strong { color: var(--warning); }
.status-badge.warning { color: var(--warning); background: var(--warning-soft); }

.business-type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.business-type-card { position: relative; min-height: 190px; padding: 17px; display: flex !important; flex-direction: column; align-items: flex-start; gap: 8px !important; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.business-type-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.business-type-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.business-type-card input { position: absolute; top: 15px; right: 15px; width: 20px; height: 20px; min-height: 0; }
.business-type-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--primary-soft); color: var(--primary-dark); font-size: 23px; }
.business-type-card b { margin-top: auto; font-size: 16px; }
.business-type-card small { color: var(--muted); line-height: 1.45; }
.restaurant-settings-block { display: grid; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 19px; background: var(--panel-alt); }
.compact-heading { margin-bottom: 2px; }
.compact-heading h3 { margin: 0; font-size: 16px; }
.compact-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.table-settings-block { display: grid; gap: 12px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.table-settings-create { display: flex; gap: 10px; align-items: end; }
.table-settings-create label { flex: 1; }
.settings-table-list { display: grid; gap: 8px; }
.settings-table-row { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.settings-table-row input { min-height: 44px !important; }

html[data-theme="dark"] .restaurant-sale-options,
html[data-theme="dark"] .kitchen-card,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .business-type-card,
html[data-theme="dark"] .settings-table-row { background: var(--panel); }
html[data-theme="dark"] .kitchen-notes { color: #e8d7a1; background: #332c1b; border-color: #554721; }

@media (max-width: 1100px) {
  .business-type-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .nav-list { display: flex; grid-template-columns: none; overflow-x: auto; scrollbar-width: none; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-item { flex: 1 0 72px; min-width: 72px; }
  .settings-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow-x: auto; }
}

@media (max-width: 700px) {
  .kitchen-grid, .tables-grid { grid-template-columns: 1fr; }
  .table-checkout-bar, .table-settings-create { display: grid; grid-template-columns: 1fr; }
  .table-checkout-bar label { min-width: 0; }
  .settings-table-row { grid-template-columns: 1fr 1fr; }
  .settings-table-row input { grid-column: 1 / -1; }
}

/* v4.2 · Salas y mesas persistentes en MySQL + editor de cuadrícula */
.floor-runtime-shell,
.floor-settings-panel { display: grid; gap: 14px; }
.floor-room-tabs { display: flex; gap: 9px; align-items: center; overflow-x: auto; padding: 2px 2px 5px; scrollbar-width: thin; }
.floor-room-tab { min-height: 46px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--muted); font-weight: 850; white-space: nowrap; box-shadow: var(--shadow-sm); }
.floor-room-tab:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); color: var(--text); }
.floor-room-tab.active { color: #fff; background: var(--primary-dark); border-color: var(--primary-dark); }
.floor-room-tab.inactive-room { opacity: .62; }
.floor-map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.compact-floor-toolbar { min-height: 56px; }
.floor-map-toolbar > small { color: var(--muted); font-weight: 750; }
.floor-current-room strong, .floor-current-room small { display: block; }
.floor-current-room strong { font-size: 15px; }
.floor-current-room small { margin-top: 3px; color: var(--muted); }
.floor-toolbar-buttons, .floor-editor-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.floor-editor-heading { align-items: center; }
.floor-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; font-weight: 800; }
.floor-legend span { display: inline-flex; align-items: center; gap: 6px; }
.floor-legend small { margin-left: auto; color: var(--muted); }
.floor-dot { width: 10px; height: 10px; display: inline-block; border-radius: 999px; background: var(--line); }
.floor-dot.free { background: var(--success); }
.floor-dot.open { background: var(--primary-dark); }
.floor-dot.pending { background: var(--warning); }
.floor-dot.inactive { background: var(--muted); }
.floor-map-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--panel-alt); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 38%, transparent); }
.floor-map-scroll.editor-scroll { max-height: min(68vh, 780px); }
.floor-plan {
  --floor-cols: 12;
  --floor-rows: 8;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--floor-cols), minmax(72px, 1fr));
  grid-template-rows: repeat(var(--floor-rows), 78px);
  min-width: calc(var(--floor-cols) * 72px);
  min-height: calc(var(--floor-rows) * 78px);
  padding: 10px;
  gap: 0;
  background-color: var(--panel-alt);
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--line) 72%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--line) 72%, transparent) 1px, transparent 1px);
  background-size: calc((100% - 20px) / var(--floor-cols)) calc((100% - 20px) / var(--floor-rows));
  background-position: 10px 10px;
}
.floor-plan::before { content: ''; grid-column: 1 / -1; grid-row: 1 / -1; pointer-events: none; border: 1px solid color-mix(in srgb, var(--line) 85%, transparent); border-radius: 8px; }
.floor-plan-empty { grid-column: 1 / -1; grid-row: 1 / -1; place-self: center; max-width: 390px; text-align: center; color: var(--muted); }
.floor-plan-empty strong { display: block; margin-bottom: 7px; color: var(--text); font-size: 16px; }
.floor-table-token {
  position: relative;
  z-index: 2;
  margin: 7px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--success) 52%, var(--line));
  border-radius: 17px;
  background: color-mix(in srgb, var(--success-soft) 82%, var(--panel));
  color: var(--text);
  box-shadow: 0 6px 14px rgba(20, 35, 27, .09);
  text-align: center;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, opacity .12s ease;
  user-select: none;
}
.floor-table-token:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.floor-table-token.shape-round { border-radius: 999px; }
.floor-table-token.shape-rectangle { border-radius: 14px; }
.floor-table-token.open { border-color: color-mix(in srgb, var(--primary-dark) 70%, var(--line)); background: color-mix(in srgb, var(--primary-soft) 72%, var(--panel)); }
.floor-table-token.pending { border-color: color-mix(in srgb, var(--warning) 70%, var(--line)); background: var(--warning-soft); }
.floor-table-token.inactive { opacity: .48; filter: grayscale(.2); border-style: dashed; }
.floor-table-token.dragging { opacity: .72; transform: scale(.98); box-shadow: 0 10px 25px rgba(0,0,0,.18); z-index: 10; }
.floor-table-token strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.floor-table-token small { max-width: 100%; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.floor-table-token b { margin-top: 2px; font-size: 12px; color: var(--primary-dark); }
.editor-floor .floor-table-token { cursor: grab; touch-action: none; }
.editor-floor .floor-table-token:active { cursor: grabbing; }
.editor-floor .floor-table-token::after { content: '⋮⋮'; position: absolute; top: 5px; right: 7px; color: var(--muted); font-size: 10px; letter-spacing: -2px; }
.floor-editor-actions .primary-button, .floor-editor-actions .secondary-button { min-height: 46px; }
.editor-legend { padding: 2px 4px; }
.floor-settings-link { margin-top: 3px; }
.floor-table-room-badge { display: inline-flex; max-width: 100%; align-items: center; gap: 5px; font-size: 10px; font-weight: 850; color: var(--muted); }

html[data-theme="dark"] .floor-map-scroll,
html[data-theme="dark"] .floor-plan { background-color: var(--panel-alt); }
html[data-theme="dark"] .floor-room-tab { background: var(--panel); }
html[data-theme="dark"] .floor-table-token { box-shadow: 0 7px 18px rgba(0,0,0,.2); }

@media (max-width: 1100px) {
  .settings-tabs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .floor-plan { grid-template-columns: repeat(var(--floor-cols), 76px); }
}
@media (max-width: 760px) {
  .floor-map-toolbar, .floor-editor-heading { align-items: stretch; flex-direction: column; }
  .floor-toolbar-buttons, .floor-editor-actions { width: 100%; }
  .floor-toolbar-buttons > *, .floor-editor-actions > * { flex: 1; }
  .floor-plan { grid-template-columns: repeat(var(--floor-cols), 70px); grid-template-rows: repeat(var(--floor-rows), 72px); min-width: calc(var(--floor-cols) * 70px); min-height: calc(var(--floor-rows) * 72px); }
  .floor-legend small { width: 100%; margin-left: 0; }
}

/* ===== Cajas y arqueos v4.3 ===== */
.cash-status-strip {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line));
  border-radius: 16px;
  background: var(--warning-soft);
}
.cash-status-strip.active { border-color: color-mix(in srgb, var(--success) 42%, var(--line)); background: var(--success-soft); }
.cash-status-strip .cash-status-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 5px color-mix(in srgb, var(--warning) 12%, transparent); }
.cash-status-strip.active .cash-status-dot { background: var(--success); box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 12%, transparent); }
.cash-status-strip strong, .cash-status-strip small { display: block; }
.cash-status-strip small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.cash-register-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.cash-register-card { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 108px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow-sm); }
.cash-register-card.open { border-color: color-mix(in srgb, var(--success) 42%, var(--line)); }
.cash-register-card.selected { box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-sm); border-color: var(--primary); }
.cash-register-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: var(--panel-alt); color: var(--primary-dark); font-weight: 950; font-size: 24px; }
.cash-register-card.open .cash-register-icon { background: var(--success-soft); color: var(--success); }
.cash-register-copy span, .cash-register-copy strong, .cash-register-copy small { display: block; }
.cash-register-copy span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.cash-register-copy strong { margin: 2px 0 4px; font-size: 17px; }
.cash-register-copy small { color: var(--muted); line-height: 1.35; }
.cash-register-actions { display: grid; justify-items: end; gap: 8px; }
.cash-active-area { display: grid; gap: 18px; }
.cash-metric-grid { grid-template-columns: repeat(6, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 2px; }
.cash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cash-movement-form { display: grid; gap: 13px; }
.cash-movement-form label { display: grid; gap: 7px; font-weight: 750; font-size: 12px; }
.cash-balance-list { display: grid; gap: 9px; }
.cash-balance-row { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-alt); }
.cash-balance-row span { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center; }
.cash-balance-row i { grid-row: 1 / 3; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; font-style: normal; font-weight: 950; }
.cash-balance-row small { color: var(--muted); font-size: 10px; }
.cash-balance-row.in i { color: var(--success); background: var(--success-soft); }
.cash-balance-row.out i { color: var(--danger); background: var(--danger-soft); }
.cash-balance-row.in > strong, .cash-amount.in { color: var(--success); }
.cash-balance-row.out > strong, .cash-amount.out { color: var(--danger); }
.cash-direction { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.cash-direction.in { color: var(--success); background: var(--success-soft); }
.cash-direction.out { color: var(--danger); background: var(--danger-soft); }
.cash-amount { font-weight: 900; }
.cash-movements-panel { margin-bottom: 18px; }
.cash-history-filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cell-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.variance { white-space: nowrap; }
.variance.ok { color: var(--success); }
.variance.positive { color: #9b5700; }
.variance.negative { color: var(--danger); }
.cash-close-preview { display: grid; gap: 8px; padding: 16px 20px 0; }
.cash-close-preview > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cash-close-preview span { color: var(--muted); font-size: 12px; }
.cash-close-preview .cash-close-expected { margin-top: 3px; padding-top: 12px; font-size: 17px; border-bottom: 0; }
.cash-close-preview .cash-close-expected span { color: var(--text); font-weight: 850; font-size: 14px; }
.cash-audit-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.cash-audit-detail-grid > div { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-alt); }
.cash-audit-detail-grid span, .cash-audit-detail-grid strong { display: block; }
.cash-audit-detail-grid span { margin-bottom: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.cash-audit-detail-grid strong { font-size: 16px; }
.cash-audit-detail-grid .audit-variance { border-color: color-mix(in srgb, var(--primary) 38%, var(--line)); background: var(--primary-soft); }
.cash-settings-stack { display: grid; gap: 18px; }
.danger-button { min-height: var(--touch); border: 0; border-radius: 14px; padding: 0 18px; background: var(--danger); color: white; font-weight: 850; box-shadow: 0 8px 20px color-mix(in srgb, var(--danger) 22%, transparent); }
.danger-button.compact { min-height: 42px; padding-inline: 13px; font-size: 11px; }
.danger-button:active { transform: translateY(1px); }

@media (max-width: 1180px) {
  .cash-metric-grid { grid-template-columns: repeat(3, minmax(190px, 1fr)); }
  .cash-history-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .cash-grid { grid-template-columns: 1fr; }
  .cash-register-card { grid-template-columns: 48px minmax(0, 1fr); }
  .cash-register-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; justify-items: stretch; }
  .cash-register-actions > * { justify-content: center; text-align: center; }
  .cash-metric-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .cash-history-filters { grid-template-columns: 1fr 1fr; }
  .cash-audit-detail-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .cash-status-strip { grid-template-columns: auto minmax(0, 1fr); }
  .cash-status-strip .text-button { grid-column: 2; justify-self: start; }
  .cash-metric-grid { grid-template-columns: minmax(175px, 1fr); }
  .cash-history-filters, .cash-audit-detail-grid { grid-template-columns: 1fr; }
}
.nav-list { min-height: 0; overflow-y: auto; scrollbar-width: thin; }


.cash-section-panel .panel-heading,
.cash-section-panel .filter-bar,
.cash-section-panel .report-summary-grid {
  padding-left: 20px;
  padding-right: 20px;
}

.cash-section-panel .panel-heading {
  padding-top: 18px;
}

.cash-section-panel .table-wrap {
  padding: 0 12px 12px;
}

.field-label {
  display: inline-flex;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.check-chip-grid,
.register-operator-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-chip {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.check-chip span {
  display: grid;
  gap: 2px;
}

.check-chip small {
  color: var(--muted);
}

.register-operator-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .10);
  color: var(--primary);
  font-size: .82rem;
  font-weight: 600;
}

.cash-amount.in {
  color: #047857;
}

.cash-amount.out {
  color: #b91c1c;
}

/* ===== Catálogo administrativo v4.5 ===== */
.catalog-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.catalog-tab {
  min-height: 82px;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-areas: "icon title" "icon copy";
  column-gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.catalog-tab > span {
  grid-area: icon;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 19px;
  font-weight: 900;
}

.catalog-tab b { grid-area: title; font-size: 13px; }
.catalog-tab small { grid-area: copy; color: var(--muted); font-size: 10px; line-height: 1.3; }
.catalog-tab.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-sm); }
.catalog-tab.active > span { background: var(--primary); color: #fff; }
.catalog-pane { display: none; }
.catalog-pane.active { display: block; }
.catalog-pane-toolbar { margin-top: 2px; }

@media (max-width: 1180px) {
  .catalog-tabs { grid-template-columns: repeat(5, minmax(132px, 1fr)); }
}

@media (max-width: 760px) {
  .catalog-tabs { grid-template-columns: repeat(5, minmax(118px, 1fr)); }
  .catalog-tab { min-height: 72px; padding: 10px; grid-template-columns: 34px minmax(0, 1fr); }
  .catalog-tab > span { width: 34px; height: 34px; }
  .catalog-tab small { display: none; }
}

/* ========================================================================== */
/* UI Refresh v4.6 — inspirado en las referencias compartidas por el usuario. */
/* Mantiene la lógica existente y utiliza Font Awesome Free Classic Regular.   */
/* ========================================================================== */

body {
  background:
    radial-gradient(circle at 82% 0%, rgba(37, 99, 235, .035), transparent 32rem),
    var(--bg);
}

/* ----- Shell / sidebar ----- */
.app-shell { grid-template-columns: 238px minmax(0, 1fr); }

.brand {
  min-height: 72px;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 4px 22px;
}
.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 15px;
  font-size: 15px;
  background: linear-gradient(145deg, #0f0f0f 0%, #000000 100%);
  box-shadow: 0 12px 30px rgba(8, 8, 8, 0.08);
}
.brand-copy { text-align: left; min-width: 0; }
.brand strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { font-size: 11px; margin-top: 3px; color: #93a4bf; }
.nav-list { gap: 5px; padding: 8px 0; }
.nav-item {
  min-height: 50px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 13px;
  padding: 0 14px;
  border-radius: 12px;
  color: #b8c5d9;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 82%, #0649dd));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 25%, transparent);
}
.nav-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  font-size: 17px;
  color: currentColor;
}
.nav-label { font-size: 13px; font-weight: 700; }
.sidebar-footer {
  padding: 14px 12px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  text-align: left;
}
.connection-state { grid-template-columns: 10px 1fr; justify-items: start; align-items: center; gap: 8px; font-size: 10px; }
.connection-state i { width: 8px; height: 8px; }
.sidebar-footer small { display: block; margin-top: 6px; font-size: 10px; color: #91a0b8; }

/* ----- Main / topbar ----- */
.main-content { grid-column: 2; padding: 0 28px 44px; }
.topbar {
  min-height: 88px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.topbar-left h1 { font-size: 28px; letter-spacing: -.035em; }
.topbar-left p { font-size: 13px; }
.topbar-actions { gap: 12px; }
.topbar time { font-size: 12px; min-width: 180px; }
.user-pill {
  min-width: 165px;
  padding: 8px 13px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.user-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
}
.user-pill { position: relative; }
.user-pill span, .user-pill small { display: block; padding-right: 14px; }
.user-pill span { font-weight: 800; font-size: 12px; }
.user-pill small { color: var(--muted); margin-top: 2px; font-size: 10px; }

/* ----- Core visual language ----- */
.section-toolbar { margin-bottom: 18px; }
.section-toolbar h2 { font-size: 24px; letter-spacing: -.03em; margin: 0; }
.section-toolbar p { color: var(--muted); margin: 4px 0 0; font-size: 12px; }
.panel,
.metric-card,
.product-card,
.cart-panel,
.catalog-tab,
.settings-tab,
.cash-register-card {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.panel { border-radius: 16px; }
.panel-heading { padding: 17px 20px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.panel-heading h2, .panel-heading h3 { letter-spacing: -.015em; }
.panel-heading p { font-size: 11px; }
.panel-icon,
.summary-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  background: var(--primary-soft);
}
.panel-icon { width: 42px; height: 42px; border-radius: 13px; }
.summary-icon { width: 48px; height: 48px; border-radius: 14px; font-size: 18px; }
.tone-blue { color: #2563eb !important; background: #edf4ff !important; }
.tone-green { color: #159455 !important; background: #e9f9ef !important; }
.tone-orange { color: #df8019 !important; background: #fff3e4 !important; }
.tone-purple { color: #7c3aed !important; background: #f3edff !important; }
.tone-cyan { color: #0b9db1 !important; background: #e8f9fb !important; }

.primary-button,
.secondary-button,
.danger-button {
  border-radius: 10px;
  min-height: 44px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary-button { box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 18%, transparent); }
.secondary-button { background: var(--panel); }
.text-button { display: inline-flex; align-items: center; gap: 7px; }
input, select, textarea { border-radius: 10px !important; }
.filter-bar { border-radius: 14px; }

/* ----- Metrics ----- */
.metric-grid { gap: 12px; }
.metric-card {
  border-radius: 15px;
  padding: 16px 17px;
  min-height: 90px;
}
.metric-card > span { font-size: 11px; font-weight: 700; color: #627087; }
.metric-card > strong { margin: 5px 0 2px; font-size: 21px; letter-spacing: -.025em; }
.metric-card > small { font-size: 10px; color: var(--muted); }

/* ----- Tables ----- */
.table-wrap { border-radius: 12px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
thead th {
  padding: 11px 14px;
  background: #f7f9fc;
  color: #69768a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f6;
  font-size: 11px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfe; }
.table-action { min-height: 34px; padding: 6px 10px; border-radius: 8px; }
.status-badge { border-radius: 999px; padding-inline: 10px; }

/* ----- Cash page tabs / summary ----- */
.cash-page-heading { margin-bottom: 10px; }
.cash-tabs {
  display: inline-flex;
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 11px 11px 0 0;
  background: #f7f9fc;
  overflow: hidden;
}
.cash-tab {
  min-width: 98px;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #66758a;
  font-size: 11px;
  font-weight: 800;
  position: relative;
}
.cash-tab:last-child { border-right: 0; }
.cash-tab.active { color: var(--primary); background: var(--panel); }
.cash-tab.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
}
.cash-tab-pane { display: none; }
.cash-tab-pane.active { display: block; }
.cash-register-selector { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 12px; }
.cash-register-card {
  min-height: 132px;
  padding: 19px 20px;
  border-radius: 16px;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  background: var(--panel);
}
.cash-register-icon {
  width: 58px; height: 58px;
  border-radius: 17px;
  color: var(--primary);
  background: #eff5ff;
  font-size: 0;
}
.cash-register-icon::before {
  content: "\f09d";
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  font-size: 23px;
}
.cash-register-copy > span {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 9px;
  font-weight: 900;
}
.cash-register-copy > strong { font-size: 18px; margin: 7px 0 4px; }
.cash-register-copy > small { font-size: 10px; }
.cash-register-actions { gap: 9px; }
.cash-active-area { gap: 14px; }
.cash-metric-grid { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
.cash-grid { gap: 14px; }
.cash-movement-form { padding: 0 20px 20px; }
.cash-section-panel { border-radius: 16px; overflow: hidden; }
.cash-section-panel .filter-bar { border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: #fbfcfe; }
.report-summary-grid { padding-top: 15px; }

/* ----- Sales ----- */
.pos-layout { grid-template-columns: minmax(0, 1fr) minmax(390px, 435px); gap: 18px; }
.catalog-panel { min-width: 0; }
.sales-toolbar { grid-template-columns: minmax(260px, 1fr) auto auto; display: grid; gap: 10px; }
.sales-toolbar .search-field { min-width: 0; }
.search-field i { color: #78869a; font-size: 13px; }
.category-chips { padding-top: 3px; margin-bottom: 3px; }
.category-chip,
.filter-pill { min-height: 38px; border-radius: 10px; padding-inline: 15px; background: var(--panel); border: 1px solid var(--line); }
.category-chip.active,
.filter-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sales-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 14px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.sales-summary-grid article {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 14px;
  border-right: 1px solid var(--line);
}
.sales-summary-grid article:last-child { border-right: 0; }
.sales-summary-grid i { color: var(--primary); font-size: 18px; }
.sales-summary-grid strong, .sales-summary-grid span { display: block; }
.sales-summary-grid strong { font-size: 16px; }
.sales-summary-grid span { font-size: 10px; color: var(--muted); margin-top: 2px; }
.product-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.product-card {
  min-height: 235px;
  padding: 10px 12px 14px;
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
}
.product-card::after {
  width: 30px; height: 30px;
  right: 10px; top: 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 7px 15px color-mix(in srgb, var(--primary) 22%, transparent);
}
.product-thumb {
  height: 120px !important;
  margin: -2px -4px 8px !important;
  border-radius: 10px !important;
  background: #f4f6f8 !important;
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .product-code { font-size: 9px; }
.product-card strong { margin: 5px 0 6px; font-size: 14px; }
.product-card small {
  display: inline-flex;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 9px;
}
.product-card footer { padding-top: 10px; }
.product-card footer b { font-size: 17px; }
.product-card footer span { color: var(--success); font-size: 9px; }
.cart-panel {
  top: 102px;
  padding: 15px 17px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 120px);
}
.cart-heading { padding: 2px 0 14px; }
.cart-heading h2 { font-size: 16px; }
.cart-item { border-radius: 10px; }
.cash-status-strip { border-radius: 11px; }
.checkout-form { gap: 12px; }
.totals-box { border-radius: 12px; }
.checkout-button { font-size: 13px; }

/* ----- Settings ----- */
.settings-layout { grid-template-columns: 285px minmax(0, 1fr); gap: 14px; }
.settings-tabs {
  top: 99px;
  gap: 0;
  padding: 10px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.settings-tab {
  min-height: 84px;
  margin: 0 10px;
  padding: 12px 12px;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  border-radius: 10px;
  box-shadow: none;
  background: transparent;
}
.settings-tab:last-child { border-bottom: 0; }
.settings-tab > span { width: 42px; height: 42px; border-radius: 12px; font-size: 17px; }
.settings-tab b { font-size: 12px; }
.settings-tab small { font-size: 9px; }
.settings-tab.active {
  border: 1px solid color-mix(in srgb, var(--primary) 65%, #b9d1ff);
  background: #f6f9ff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.settings-tab.active > span { background: var(--primary); }
.settings-content > .settings-pane > .panel,
.settings-content > .settings-pane > form.panel { border-radius: 16px; }
.settings-pane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 3px 2px 0;
}
.settings-pane-heading h2 { margin: 0; font-size: 20px; }
.settings-pane-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.settings-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.settings-summary-grid.floor-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.settings-summary-grid article {
  min-height: 90px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.settings-summary-grid strong { display: inline-block; font-size: 22px; margin-right: 6px; }
.settings-summary-grid b { font-size: 11px; }
.settings-summary-grid small { display: block; color: var(--muted); margin-top: 3px; font-size: 9px; }
.cash-settings-stack { gap: 12px; }
.sync-callout {
  display: flex !important;
  align-items: center;
  gap: 12px;
  border-color: #cfe0ff !important;
  background: #f3f7ff !important;
  color: #255cad;
}
.sync-callout .callout-icon {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; background: var(--primary); color: white;
}
.floor-settings-panel { padding-bottom: 14px; }
.floor-room-tabs { gap: 8px; }
.floor-room-tab {
  min-height: 58px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.floor-room-tab.active { border-color: var(--primary); background: #f6f9ff; box-shadow: 0 0 0 1px var(--primary-soft); }
.floor-map-toolbar { border-radius: 12px; background: #fafbfd; }
.floor-map-scroll { border-radius: 12px; border-color: var(--line); }
.floor-plan {
  background-color: #fbfcfe;
  background-image:
    linear-gradient(to right, #e8edf4 1px, transparent 1px),
    linear-gradient(to bottom, #e8edf4 1px, transparent 1px);
}
.floor-table-token { border-radius: 13px; }
.floor-table-token.round { border-radius: 999px; }

/* ----- Catalog ----- */
.catalog-tabs { gap: 9px; }
.catalog-tab {
  min-height: 76px;
  border-radius: 13px;
  box-shadow: none;
}
.catalog-tab > span { border-radius: 11px; font-size: 16px; }
.catalog-tab.active { background: #f7faff; box-shadow: inset 0 -3px 0 var(--primary); }
.catalog-pane .panel { overflow: hidden; }

/* ----- Auth ----- */
.login-card { border-radius: 22px; box-shadow: 0 30px 70px rgba(8, 26, 54, .16); }

/* ----- Dark mode component hierarchy ----- */
html[data-theme="dark"] .sales-summary-grid,
html[data-theme="dark"] .settings-tabs { background: var(--panel); }

/* ----- Responsive ----- */
@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { width: 205px; }
  .main-content { padding-inline: 20px; }
  .settings-layout { grid-template-columns: 245px minmax(0, 1fr); }
  .cash-metric-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .sales-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-summary-grid article:nth-child(2) { border-right: 0; }
  .sales-summary-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 98px minmax(0, 1fr); }
  .sidebar { width: 98px; padding-inline: 10px; }
  .brand { flex-direction: column; gap: 7px; }
  .brand-copy { text-align: center; }
  .brand strong { font-size: 10px; }
  .brand span { display: none; }
  .nav-item { flex-direction: column; justify-content: center; gap: 4px; min-height: 62px; padding: 7px 4px; text-align: center; }
  .nav-label { font-size: 9px; }
  .sidebar-footer { padding: 8px; text-align: center; }
  .connection-state { grid-template-columns: 1fr; justify-items: center; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { position: static; grid-template-columns: repeat(6, minmax(125px, 1fr)); display: grid; overflow-x: auto; padding: 8px; }
  .settings-tab { margin: 0; min-height: 72px; border: 1px solid var(--line); }
  .settings-tab small { display: none; }
  .settings-summary-grid.floor-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { width: min(280px, 88vw); transform: translateX(-110%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .brand { flex-direction: row; }
  .brand-copy { text-align: left; }
  .brand strong { font-size: 14px; }
  .brand span { display: block; }
  .nav-item { flex-direction: row; justify-content: flex-start; min-height: 50px; padding-inline: 14px; text-align: left; }
  .nav-label { font-size: 12px; }
  .main-content { padding-inline: 14px; }
  .menu-button { display: grid; place-items: center; }
  .topbar { min-height: 76px; }
  .topbar time { display: none; }
  .user-pill { display: none; }
  .pos-layout { display: block; }
  .cart-panel { top: 0; }
  .settings-summary-grid,
  .settings-summary-grid.floor-summary-grid { grid-template-columns: 1fr 1fr; }
  .cash-register-selector { grid-template-columns: 1fr; }
  .cash-history-filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .main-content { padding-inline: 10px; }
  .topbar-left h1 { font-size: 22px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .secondary-button { padding-inline: 10px; }
  .sales-toolbar { grid-template-columns: 1fr auto; }
  .sales-toolbar .search-field { grid-column: 1 / -1; }
  .sales-summary-grid { grid-template-columns: 1fr 1fr; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { min-height: 205px; }
  .product-thumb { height: 96px !important; }
  .settings-summary-grid,
  .settings-summary-grid.floor-summary-grid { grid-template-columns: 1fr; }
  .cash-tabs { width: 100%; }
  .cash-tab { min-width: 0; flex: 1; }
  .cash-register-card { grid-template-columns: 48px 1fr; }
  .cash-register-actions { grid-column: 1 / -1; }
}

/* v4.6 small icon/filter fixes */
.cash-register-icon::before { display: none !important; }
.cash-register-icon i { font-size: 22px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; }
.category-chips.filters-hidden { display: none; }
.cash-metric-card { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; }
.cash-metric-card > i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 14px; }
.cash-metric-card > div > span, .cash-metric-card > div > strong, .cash-metric-card > div > small { display: block; }

.clock-display { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; }
.clock-display i { color:#76859a; }
.clock-display time { min-width:0; text-align:left; }
.user-pill { display:grid; grid-template-columns:30px minmax(0,1fr); align-items:center; gap:8px; }
.user-pill-icon { width:30px; height:30px; display:grid; place-items:center; color:var(--primary); background:var(--primary-soft); border-radius:999px; font-size:17px; }
@media (max-width:820px) { .clock-display { display:none; } }

/* ========================================================================== 
   Cajas v4.6.1 — rediseño inspirado en la referencia suministrada
   ========================================================================== */
#view-cash {
  --cash-blue: var(--primary);
  --cash-blue-soft: var(--primary-soft);
  --cash-green: var(--success);
  --cash-green-soft: var(--success-soft);
  --cash-cyan: var(--accent);
  --cash-cyan-soft: var(--accent-soft);
  --cash-orange: var(--warning);
  --cash-orange-soft: var(--warning-soft);
  --cash-purple: var(--accent);
  --cash-purple-soft: var(--accent-soft);
  --cash-red: var(--danger);
  --cash-red-soft: var(--danger-soft);
  --cash-ink: var(--text);
  --cash-muted: var(--muted);
}

#view-cash .cash-page-heading {
  margin-bottom: 12px;
}
#view-cash .cash-page-heading h2 {
  color: var(--cash-ink);
  font-size: clamp(28px, 3vw, 36px);
  letter-spacing: -.045em;
}
#view-cash .cash-page-heading p { color: var(--cash-muted); }

#view-cash .cash-tabs {
  margin-bottom: 0;
  border: 0;
  border-radius: 14px 14px 0 0;
  background: #F5F7FA;
  box-shadow: inset 0 0 0 1px #E3E8F0;
}
#view-cash .cash-tab {
  min-width: 118px;
  min-height: 46px;
  padding-inline: 22px;
  border-color: #E3E8F0;
  color: #647188;
  font-size: 12px;
}
#view-cash .cash-tab.active {
  color: var(--cash-blue);
  background: #fff;
}
#view-cash .cash-tab.active::after {
  left: 15px;
  right: 15px;
  height: 3px;
  background: var(--cash-blue);
}
#view-cash .cash-tab-pane.active {
  padding-top: 0;
}

/* Selector compacto cuando existen varias cajas */
#view-cash .cash-register-selector {
  display: flex;
  gap: 9px;
  margin: 12px 0;
  overflow-x: auto;
  padding: 2px 2px 3px;
  scrollbar-width: thin;
}
#view-cash .cash-register-choice {
  flex: 0 0 auto;
  min-width: 218px;
  min-height: 58px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #E0E6EF;
  border-radius: 13px;
  background: #fff;
  color: var(--cash-ink);
  text-align: left;
  box-shadow: 0 3px 12px rgba(13, 30, 56, .035);
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
#view-cash .cash-register-choice:hover { border-color: #B9CBEC; }
#view-cash .cash-register-choice:active { transform: scale(.985); }
#view-cash .cash-register-choice.selected {
  border-color: var(--cash-blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 246, .10);
}
#view-cash .cash-register-choice-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--cash-blue);
  background: var(--cash-blue-soft);
  font-size: 15px;
}
#view-cash .cash-register-choice > span:nth-child(2) { min-width: 0; }
#view-cash .cash-register-choice b,
#view-cash .cash-register-choice small { display: block; }
#view-cash .cash-register-choice b { font-size: 12px; }
#view-cash .cash-register-choice small {
  margin-top: 2px;
  color: var(--cash-muted);
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#view-cash .cash-register-choice em {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}
#view-cash .cash-register-choice.open em { color: #13834B; background: var(--cash-green-soft); }
#view-cash .cash-register-choice.closed em { color: #A5383E; background: var(--cash-red-soft); }

/* Tarjeta principal de la caja seleccionada */
#view-cash .cash-overview-card {
  border: 1px solid #E0E6EF;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(13, 30, 56, .07);
  overflow: hidden;
}
#view-cash .cash-overview-loading {
  min-height: 145px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--cash-muted);
}
#view-cash .cash-overview-loading i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--cash-blue);
  background: var(--cash-blue-soft);
}
#view-cash .cash-overview-main {
  min-height: 126px;
  display: grid;
  grid-template-columns: minmax(300px, 1.15fr) minmax(260px, .9fr) auto;
  align-items: center;
  gap: 24px;
  padding: 22px 26px 18px;
}
#view-cash .cash-overview-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
#view-cash .cash-overview-icon {
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--cash-blue);
  background: linear-gradient(145deg, #F2F7FF, #E6EFFF);
  font-size: 25px;
}
#view-cash .cash-overview-code {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--cash-blue);
  background: var(--cash-blue-soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .03em;
}
#view-cash .cash-overview-identity h3 {
  margin: 6px 0 4px;
  color: var(--cash-ink);
  font-size: 23px;
  letter-spacing: -.035em;
}
#view-cash .cash-overview-identity p {
  margin: 0;
  color: var(--cash-muted);
  font-size: 11px;
}
#view-cash .cash-overview-identity p i { margin-right: 4px; }
#view-cash .cash-overview-state {
  min-height: 78px;
  padding-left: 24px;
  border-left: 1px solid #E7EBF2;
}
#view-cash .cash-state-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 900;
}
#view-cash .cash-state-pill.open { color: #087F48; background: var(--cash-green-soft); }
#view-cash .cash-state-pill.closed { color: #B42731; background: var(--cash-red-soft); }
#view-cash .cash-overview-state p {
  max-width: 310px;
  margin: 9px 0 0;
  color: var(--cash-muted);
  font-size: 10px;
  line-height: 1.45;
}
#view-cash .cash-overview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
#view-cash .cash-overview-actions .primary-button {
  min-width: 150px;
  background: var(--cash-blue);
}
#view-cash .cash-overview-actions .secondary-button { min-width: 150px; }
#view-cash .cash-overview-divider { height: 1px; margin-inline: 24px; background: #E8ECF2; }
#view-cash .cash-overview-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 14px 26px 17px;
}
#view-cash .cash-fact {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 54px;
  padding: 3px 22px;
  border-right: 1px solid #E8ECF2;
}
#view-cash .cash-fact:first-child { padding-left: 0; }
#view-cash .cash-fact:last-child { border-right: 0; }
#view-cash .cash-fact-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 16px;
}
#view-cash .cash-fact-icon.green { color: var(--cash-green); background: var(--cash-green-soft); }
#view-cash .cash-fact-icon.purple { color: var(--cash-purple); background: var(--cash-purple-soft); }
#view-cash .cash-fact-icon.orange { color: var(--cash-orange); background: var(--cash-orange-soft); }
#view-cash .cash-fact small,
#view-cash .cash-fact b,
#view-cash .cash-fact span { display: block; }
#view-cash .cash-fact small { color: var(--cash-muted); font-size: 9px; }
#view-cash .cash-fact b { margin: 2px 0; color: var(--cash-ink); font-size: 11px; }
#view-cash .cash-fact > div > span { color: var(--cash-muted); font-size: 9px; }
#view-cash .cash-variance.ok,
#view-cash .cash-variance.positive { color: var(--cash-green); }
#view-cash .cash-variance.negative { color: var(--cash-red); }
#view-cash .cash-variance.neutral { color: var(--cash-muted); }

/* Métricas multicolor de caja */
#view-cash .cash-overview-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
#view-cash .cash-overview-metric {
  min-height: 90px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid #E2E7EF;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 4px 15px rgba(13, 30, 56, .045);
}
#view-cash .cash-overview-metric-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 16px;
}
#view-cash .cash-overview-metric small,
#view-cash .cash-overview-metric strong,
#view-cash .cash-overview-metric div > span { display: block; }
#view-cash .cash-overview-metric small { color: #657287; font-size: 9px; font-weight: 750; }
#view-cash .cash-overview-metric strong { margin: 3px 0 2px; color: var(--cash-ink); font-size: 18px; letter-spacing: -.025em; }
#view-cash .cash-overview-metric div > span { font-size: 9px; font-weight: 750; }
#view-cash .cash-overview-metric.blue .cash-overview-metric-icon { color: var(--cash-blue); background: var(--cash-blue-soft); }
#view-cash .cash-overview-metric.blue div > span { color: var(--cash-blue); }
#view-cash .cash-overview-metric.green .cash-overview-metric-icon { color: var(--cash-green); background: var(--cash-green-soft); }
#view-cash .cash-overview-metric.green div > span { color: var(--cash-green); }
#view-cash .cash-overview-metric.cyan .cash-overview-metric-icon { color: var(--cash-cyan); background: var(--cash-cyan-soft); }
#view-cash .cash-overview-metric.cyan div > span { color: var(--cash-cyan); }
#view-cash .cash-overview-metric.orange .cash-overview-metric-icon { color: var(--cash-orange); background: var(--cash-orange-soft); }
#view-cash .cash-overview-metric.orange div > span { color: var(--cash-orange); }
#view-cash .cash-overview-metric.purple .cash-overview-metric-icon { color: var(--cash-purple); background: var(--cash-purple-soft); }
#view-cash .cash-overview-metric.purple div > span { color: var(--cash-purple); }

#view-cash .cash-operations-grid { margin-bottom: 14px; }
#view-cash .cash-operation-card { border-radius: 16px; }
#view-cash .cash-tone-green { color: var(--cash-green) !important; background: var(--cash-green-soft) !important; }
#view-cash .cash-tone-purple { color: var(--cash-purple) !important; background: var(--cash-purple-soft) !important; }

/* Arqueos recientes + acciones rápidas */
#view-cash .cash-summary-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(285px, 350px);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
#view-cash .cash-summary-bottom > .cash-quick-actions-panel:only-child { grid-column: 1 / -1; }
#view-cash .cash-recent-audits,
#view-cash .cash-quick-actions-panel {
  border-radius: 16px;
  overflow: hidden;
}
#view-cash .cash-recent-audits .panel-heading,
#view-cash .cash-quick-actions-panel .panel-heading { padding: 17px 18px 12px; }
#view-cash .cash-recent-audits .table-wrap { padding: 0 10px 10px; }
#view-cash .cash-quick-title-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--cash-blue);
  background: var(--cash-blue-soft);
}
#view-cash .cash-quick-actions {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}
#view-cash .cash-quick-action {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px 11px;
  border: 1px solid #E2E7EF;
  border-radius: 12px;
  background: #fff;
  color: var(--cash-ink);
  text-align: left;
  transition: border-color .15s ease, transform .12s ease, background .15s ease;
}
#view-cash .cash-quick-action:not(:disabled):hover { border-color: #BACBEA; background: #FBFCFF; }
#view-cash .cash-quick-action:not(:disabled):active { transform: scale(.99); }
#view-cash .cash-quick-action:disabled { opacity: .46; }
#view-cash .cash-quick-action > span:nth-child(2) { min-width: 0; }
#view-cash .cash-quick-action b,
#view-cash .cash-quick-action small { display: block; }
#view-cash .cash-quick-action b { font-size: 10px; line-height: 1.3; }
#view-cash .cash-quick-action small { margin-top: 3px; color: var(--cash-muted); font-size: 9px; line-height: 1.35; }
#view-cash .cash-quick-action > i { color: #8592A6; }
#view-cash .cash-quick-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 16px;
}
#view-cash .cash-quick-icon.blue { color: var(--cash-blue); background: var(--cash-blue-soft); }
#view-cash .cash-quick-icon.green { color: var(--cash-green); background: var(--cash-green-soft); }
#view-cash .cash-quick-icon.purple { color: var(--cash-purple); background: var(--cash-purple-soft); }

#view-cash .cash-section-panel {
  border: 1px solid #E0E6EF;
  box-shadow: 0 5px 18px rgba(13, 30, 56, .045);
}
#view-cash .cash-section-panel .filter-bar { background: #FBFCFE; }
#view-cash .variance.ok,
#view-cash .variance.positive { color: var(--cash-green); }
#view-cash .variance.negative { color: var(--cash-red); }

@media (max-width: 1280px) {
  #view-cash .cash-overview-main { grid-template-columns: minmax(270px, 1fr) minmax(230px, .9fr); }
  #view-cash .cash-overview-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 4px; }
  #view-cash .cash-overview-metrics { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
}

@media (max-width: 900px) {
  #view-cash .cash-overview-main { grid-template-columns: 1fr; gap: 14px; }
  #view-cash .cash-overview-state { border-left: 0; border-top: 1px solid #E8ECF2; padding: 14px 0 0; }
  #view-cash .cash-overview-actions { grid-column: auto; justify-content: flex-start; }
  #view-cash .cash-overview-facts { grid-template-columns: 1fr; gap: 8px; }
  #view-cash .cash-fact { border-right: 0; border-bottom: 1px solid #EEF1F5; padding: 8px 0; }
  #view-cash .cash-fact:last-child { border-bottom: 0; }
  #view-cash .cash-summary-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  #view-cash .cash-tab { min-width: 0; flex: 1; padding-inline: 10px; }
  #view-cash .cash-register-choice { min-width: 205px; }
  #view-cash .cash-overview-main { padding: 18px; }
  #view-cash .cash-overview-divider { margin-inline: 18px; }
  #view-cash .cash-overview-facts { padding: 12px 18px; }
  #view-cash .cash-overview-actions { display: grid; grid-template-columns: 1fr; }
  #view-cash .cash-overview-actions .primary-button,
  #view-cash .cash-overview-actions .secondary-button { width: 100%; min-width: 0; }
  #view-cash .cash-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  #view-cash .cash-overview-metrics { grid-template-columns: 1fr; }
  #view-cash .cash-overview-metric { min-height: 76px; }
}

/* ========================================================================== 
   v4.6.2 — pulido de encabezados y Cajas
   ========================================================================== */
.view-actions-only {
  justify-content: flex-end;
  min-height: 42px;
  margin-bottom: 12px;
}

#view-cash .cash-page-heading {
  justify-content: flex-end;
  min-height: 42px;
  margin-bottom: 10px;
}

#view-cash .cash-tab-action-heading {
  justify-content: flex-end;
  margin-bottom: 0;
  padding: 12px 16px 4px;
}

#view-cash .cash-tab-action-heading .text-button {
  margin-left: auto;
}

/* Centrado óptico de los tres indicadores del resumen. */
#view-cash .cash-fact {
  justify-content: center;
  padding-left: 18px;
  padding-right: 18px;
}

#view-cash .cash-fact:first-child {
  padding-left: 18px;
}

#view-cash .cash-fact-icon {
  align-self: center;
  justify-self: center;
}

#view-cash .cash-fact-icon i {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

#view-cash .cash-fact > div {
  min-width: 0;
}

/* Al retirar la tabla de movimientos, las dos tarjetas operativas cierran el bloque. */
#view-cash .cash-active-area {
  margin-bottom: 0;
}

/* ========================================================================== */
/* v4.6.3 · Ajustes / Salas y mesas                                           */
/* ========================================================================== */

.settings-menu-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 12px 8px;
  padding: 11px 10px 14px;
  border-bottom: 1px solid var(--line);
}
.settings-menu-title > i {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
  font-size: 17px;
}
.settings-menu-title span { min-width: 0; }
.settings-menu-title b { display: block; font-size: 13px; color: var(--text); }
.settings-menu-title small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }

.settings-tab {
  --settings-accent: var(--primary);
  --settings-soft: var(--primary-soft);
  position: relative;
  grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center;
  column-gap: 11px;
}
.settings-tab.settings-tone-green { --settings-accent: var(--success); --settings-soft: var(--success-soft); }
.settings-tab.settings-tone-purple { --settings-accent: var(--accent); --settings-soft: var(--accent-soft); }
.settings-tab.settings-tone-blue { --settings-accent: var(--primary); --settings-soft: var(--primary-soft); }
.settings-tab.settings-tone-orange { --settings-accent: var(--warning); --settings-soft: var(--warning-soft); }
.settings-tab.settings-tone-cyan { --settings-accent: var(--accent); --settings-soft: var(--accent-soft); }
.settings-tab.settings-tone-yellow { --settings-accent: var(--warning); --settings-soft: var(--warning-soft); }
.settings-tab > span {
  background: var(--settings-soft) !important;
  color: var(--settings-accent) !important;
}
.settings-tab .settings-chevron {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: #8e9aad;
  font-size: 13px;
  justify-self: center;
}
.settings-tab b,
.settings-tab small { grid-column: 2; }
.settings-tab.active {
  border-color: color-mix(in srgb, var(--settings-accent) 58%, #d9e2ef) !important;
  background: color-mix(in srgb, var(--settings-soft) 66%, var(--panel)) !important;
  box-shadow: inset 3px 0 0 var(--settings-accent), 0 8px 20px color-mix(in srgb, var(--settings-accent) 8%, transparent) !important;
}
.settings-tab.active > span {
  background: var(--settings-accent) !important;
  color: #fff !important;
}
.settings-tab.active .settings-chevron { color: var(--settings-accent); }

.floor-settings-redesign { padding: 18px; overflow: visible; }
.floor-settings-redesign .floor-editor-heading { padding: 0 0 14px; }
.floor-settings-redesign .floor-editor-heading h2 { font-size: 22px; }
.floor-settings-redesign .floor-editor-heading p { font-size: 11px; }
.floor-settings-redesign .settings-summary-grid { margin-bottom: 14px; }
.floor-settings-redesign .settings-summary-grid article {
  min-height: 82px;
  box-shadow: 0 8px 22px rgba(24, 42, 70, .035);
}
.floor-settings-redesign .sync-callout {
  position: relative;
  margin-bottom: 14px;
  padding-right: 58px !important;
}
.sync-check {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 1px solid #b9d2ff;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(255,255,255,.72);
}

.floor-room-selector-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 3px;
}
.floor-room-selector-row .editor-room-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}
.settings-room-card {
  --room-accent: var(--primary);
  --room-soft: var(--primary-soft);
  width: 220px;
  min-height: 64px !important;
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px !important;
  text-align: left;
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
}
.settings-room-card.active {
  border-color: var(--room-accent) !important;
  background: color-mix(in srgb, var(--room-soft) 68%, var(--panel)) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--room-accent) 24%, transparent) !important;
}
.settings-room-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--room-accent);
  background: var(--room-soft);
  font-size: 16px;
}
.settings-room-card.active .settings-room-icon {
  background: var(--room-accent);
  color: white;
}
.settings-room-copy { min-width: 0; }
.settings-room-copy b,
.settings-room-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-room-copy b { font-size: 11px; }
.settings-room-copy small { margin-top: 4px; color: var(--muted); font-size: 8.5px; }
.settings-room-status {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #25ad69;
  box-shadow: 0 0 0 3px rgba(37,173,105,.09);
}
.floor-new-room-card {
  min-width: 145px;
  border: 1px dashed #ced7e4;
  border-radius: 12px;
  background: #fbfcfe;
  color: #56657a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 10px;
  cursor: pointer;
}
.floor-new-room-card:hover { border-color: var(--primary); color: var(--primary); background: #f5f8ff; }

.floor-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 12px;
  align-items: stretch;
}
.floor-editor-main {
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}
.floor-editor-main .floor-map-toolbar {
  margin: 0;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fbfcfe;
}
.floor-current-room strong { font-size: 13px; }
.floor-current-room small { font-size: 9px; }
.floor-toolbar-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.floor-edit-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
}
.floor-edit-switch input { position: absolute; opacity: 0; pointer-events: none; }
.floor-edit-switch span {
  position: relative;
  width: 31px;
  height: 17px;
  border-radius: 999px;
  background: #ccd5e1;
  transition: .18s ease;
}
.floor-edit-switch span::after {
  content: '';
  position: absolute;
  width: 13px;
  height: 13px;
  left: 2px;
  top: 2px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 1px 4px rgba(16,34,60,.2);
  transition: .18s ease;
}
.floor-edit-switch input:checked + span { background: var(--primary); }
.floor-edit-switch input:checked + span::after { transform: translateX(14px); }

.floor-map-with-axis {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: 24px minmax(410px, auto);
  padding: 0 10px 10px;
  background: #fff;
}
.floor-axis-corner { grid-column: 1; grid-row: 1; }
.floor-axis-top {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(var(--floor-cols), minmax(28px, 1fr));
  align-items: end;
  min-width: calc(var(--floor-cols) * 58px);
  padding: 0 10px 4px;
  color: #8794a7;
  font-size: 8px;
  text-align: center;
}
.floor-axis-left {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(var(--floor-rows), minmax(48px, 1fr));
  align-items: stretch;
  min-height: calc(var(--floor-rows) * 58px);
  padding: 10px 4px 10px 0;
  color: #8794a7;
  font-size: 8px;
  text-align: center;
}
.floor-axis-left span { display: grid; place-items: center; }
.floor-map-with-axis .floor-map-scroll {
  grid-column: 2;
  grid-row: 2;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow: auto;
}
.floor-map-with-axis .floor-plan {
  min-width: calc(var(--floor-cols) * 58px);
  min-height: calc(var(--floor-rows) * 58px);
  grid-template-columns: repeat(var(--floor-cols), minmax(58px, 1fr));
  grid-template-rows: repeat(var(--floor-rows), minmax(58px, 1fr));
  padding: 10px;
  background-color: #fcfdfd;
  background-image:
    linear-gradient(to right, #e8edf4 1px, transparent 1px),
    linear-gradient(to bottom, #e8edf4 1px, transparent 1px);
  background-size: calc(100% / var(--floor-cols)) calc(100% / var(--floor-rows));
}

.floor-table-token.editor-token {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 20px 8px 8px;
  border-width: 1.5px;
  border-color: var(--room-accent, #25a66a);
  background: color-mix(in srgb, var(--room-soft, var(--success-soft)) 80%, var(--panel));
  color: #10243e;
  box-shadow: 0 7px 14px rgba(23, 46, 76, .055);
  overflow: visible;
  touch-action: none;
}
.floor-table-token.editor-token.free { border-color: var(--room-accent, #25a66a); }
.floor-table-token.editor-token.open { border-color: #ef8a35; background: #fff5ec; }
.floor-table-token.editor-token.pending { border-color: #d59b1d; background: #fff8e5; }
.floor-table-token.editor-token.inactive { border-color: #9ca8b8; background: #f2f4f7; color: #667386; }
.floor-table-token.editor-token.shape-square { border-radius: 12px; }
.floor-table-token.editor-token.shape-round { border-radius: 999px; }
.floor-table-token.editor-token.shape-rectangle { border-radius: 12px; }
.floor-table-token.editor-token strong { font-size: 10px; }
.floor-table-token.editor-token small { font-size: 8px; margin-top: 3px; }
.floor-table-shape-icon { display: block; margin-bottom: 3px; color: var(--room-accent, #25a66a); font-size: 14px; }
.floor-table-token.open .floor-table-shape-icon { color: #e97820; }
.floor-table-token.inactive .floor-table-shape-icon { color: #7b8797; }
.floor-table-drag-handle {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 34px;
  height: 13px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  cursor: grab;
  border-radius: 8px;
  touch-action: none;
  z-index: 3;
}
.floor-table-drag-handle:active { cursor: grabbing; }
.drag-dots {
  width: 19px;
  height: 8px;
  opacity: .5;
  background-image: radial-gradient(circle, currentColor 1.25px, transparent 1.35px);
  background-size: 6px 4px;
  background-position: center;
}
.floor-table-edit-hint {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: #68758a;
  font-size: 8px;
  opacity: 0;
  transition: opacity .15s ease;
}
.floor-table-token.editor-token:hover .floor-table-edit-hint { opacity: 1; }
.floor-table-token.dragging { z-index: 20; transform: scale(1.03); box-shadow: 0 12px 30px rgba(22, 44, 76, .16); }
.floor-plan.edit-disabled .floor-table-drag-handle { opacity: .28; cursor: not-allowed; }
.floor-table-total { margin-top: 3px; font-size: 8px; }

.room-config-panel {
  --room-accent: #25a66a;
  --room-soft: #eaf8f1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}
.room-config-heading {
  min-height: 63px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.room-config-heading h3 { margin: 0; font-size: 12px; }
.room-config-heading p { margin: 3px 0 0; color: var(--muted); font-size: 8px; }
.room-config-heading > i { color: var(--room-accent); }
.room-config-empty { padding: 22px 14px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.room-config-fields { display: grid; gap: 14px; padding: 14px; }
.room-config-fields label { font-size: 9px; font-weight: 650; }
.room-config-fields input,
.room-config-fields select { margin-top: 6px; min-height: 38px; font-size: 10px; }
.room-dimension-fields { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 7px; align-items: center; }
.room-dimension-fields select { margin: 0; }
.room-dimension-fields small { color: var(--muted); font-size: 8px; }
.room-capacity-block {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--room-soft);
  color: var(--text);
}
.room-capacity-block span { color: var(--muted); font-size: 8px; }
.room-capacity-block strong { font-size: 11px; }
.room-save-button { width: 100%; }
.room-quick-actions { display: grid; gap: 7px; padding-top: 5px; border-top: 1px solid var(--line); }
.room-quick-actions > b { margin: 5px 0 1px; font-size: 9px; }
.room-quick-actions button {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: #445269;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
}
.room-quick-actions button:hover { border-color: var(--primary); color: var(--primary); background: #f7faff; }
.room-quick-actions button.danger { border-color: #f3b7ba; color: #c33b45; background: #fffafa; }
.room-quick-actions button.danger:hover { border-color: #df5961; background: #fff2f3; }

.editor-legend {
  margin: 0;
  padding: 10px 13px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.legend-pill {
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 8px;
  font-weight: 600;
}
.legend-pill.free { background: #ecf8f1; color: #188a52; }
.legend-pill.open { background: #fff1e7; color: #d76519; }
.legend-pill.inactive { background: #f0f2f5; color: #687486; }

.table-shape-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 6px; }
.table-shape-option {
  min-height: 75px;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--muted);
  cursor: pointer;
}
.table-shape-option b { font-size: 8px; }
.table-shape-option.active { border-color: var(--primary); color: var(--primary); background: #f5f8ff; box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent); }
.shape-preview { display: block; width: 29px; height: 29px; border: 2px solid currentColor; background: color-mix(in srgb, currentColor 7%, transparent); }
.shape-preview.square { border-radius: 7px; }
.shape-preview.round { border-radius: 999px; }
.shape-preview.rectangle { width: 42px; height: 24px; border-radius: 7px; }

html[data-theme="dark"] .settings-menu-title > i,
html[data-theme="dark"] .settings-tab > span,
html[data-theme="dark"] .settings-room-icon,
html[data-theme="dark"] .room-capacity-block { background: color-mix(in srgb, var(--panel-alt) 82%, var(--settings-soft, #172233)); }
html[data-theme="dark"] .floor-new-room-card,
html[data-theme="dark"] .floor-editor-main .floor-map-toolbar,
html[data-theme="dark"] .room-config-heading,
html[data-theme="dark"] .room-quick-actions button,
html[data-theme="dark"] .table-shape-option,
html[data-theme="dark"] .editor-legend { background: var(--panel); }
html[data-theme="dark"] .floor-map-with-axis,
html[data-theme="dark"] .floor-map-with-axis .floor-plan { background-color: var(--panel-alt); }
html[data-theme="dark"] .floor-table-edit-hint { background: var(--panel); }

@media (max-width: 1250px) {
  .floor-editor-layout { grid-template-columns: 1fr; }
  .room-config-panel { order: -1; }
  .room-config-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-quick-actions { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .room-quick-actions > b { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .settings-menu-title { display: none; }
  .settings-tab { grid-template-columns: 40px minmax(120px, 1fr) 18px; }
  .floor-settings-redesign { padding: 12px; }
  .floor-editor-heading { align-items: flex-start; }
  .floor-editor-actions { width: 100%; }
  .floor-editor-actions button { flex: 1; }
  .floor-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .settings-room-card { width: 190px; }
  .room-config-fields { grid-template-columns: 1fr; }
  .room-quick-actions { grid-column: auto; grid-template-columns: 1fr; }
  .room-quick-actions > b { grid-column: auto; }
  .floor-map-with-axis { grid-template-columns: 22px minmax(0, 1fr); }
}
.settings-tab {
  grid-template-areas: none !important;
}
.settings-tab > span { grid-area: auto !important; grid-column: 1; grid-row: 1 / span 2; }
.settings-tab b { grid-area: auto !important; grid-column: 2; grid-row: 1; align-self: end; }
.settings-tab small { grid-area: auto !important; grid-column: 2; grid-row: 2; align-self: start; }
.settings-tab .settings-chevron { grid-area: auto !important; grid-column: 3; grid-row: 1 / span 2; }
.settings-menu-title { grid-column: 1 / -1; }

/* ========================================================================== */
/* v4.6.4 · Ajustes alineados + estados de mesas sin color por salón          */
/* ========================================================================== */
.settings-tabs .settings-tab {
  display: grid !important;
  grid-template-columns: 44px minmax(0, 1fr) 18px !important;
  grid-template-rows: minmax(18px, auto) minmax(24px, auto) !important;
  grid-template-areas: none !important;
  align-items: center !important;
  column-gap: 12px !important;
  row-gap: 2px !important;
  min-height: 86px;
  padding: 12px 14px !important;
  text-align: left !important;
}
.settings-tabs .settings-tab > .settings-tab-icon {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  width: 42px;
  height: 42px;
  margin: 0 !important;
  align-self: center;
  justify-self: center;
}
.settings-tabs .settings-tab > .settings-tab-copy {
  grid-column: 2 !important;
  grid-row: 1 / span 2 !important;
  display: grid !important;
  align-content: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
  margin: 0 !important;
  text-align: left !important;
}
.settings-tabs .settings-tab > .settings-tab-copy b,
.settings-tabs .settings-tab > .settings-tab-copy small {
  display: block !important;
  grid-column: auto !important;
  grid-row: auto !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  align-self: auto !important;
  white-space: normal;
  overflow-wrap: anywhere;
}
.settings-tabs .settings-tab > .settings-tab-copy b {
  font-size: 12px;
  line-height: 1.25;
}
.settings-tabs .settings-tab > .settings-tab-copy small {
  font-size: 9px;
  line-height: 1.35;
  color: var(--muted);
}
.settings-tabs .settings-tab > .settings-chevron {
  grid-column: 3 !important;
  grid-row: 1 / span 2 !important;
  margin: 0 !important;
  align-self: center;
  justify-self: center;
}

/* Los salones ya no tienen un color configurable: el azul solo identifica selección. */
.settings-room-card {
  --room-accent: var(--primary);
  --room-soft: var(--primary-soft);
}
.room-config-panel {
  --room-accent: var(--primary);
  --room-soft: var(--primary-soft);
}

/* El color de cada mesa vuelve a depender exclusivamente de su estado operativo. */
.floor-table-token.free,
.floor-table-token.editor-token.free {
  border-color: #20a565 !important;
  background: #eef9f3 !important;
  color: #153d2a !important;
}
.floor-table-token.open,
.floor-table-token.editor-token.open {
  border-color: #ef8a35 !important;
  background: #fff4ea !important;
  color: #6f3811 !important;
}
.floor-table-token.pending,
.floor-table-token.editor-token.pending {
  border-color: #d69d20 !important;
  background: #fff8e2 !important;
  color: #73540f !important;
}
.floor-table-token.inactive,
.floor-table-token.editor-token.inactive {
  border-color: #9ca8b8 !important;
  background: #f2f4f7 !important;
  color: #667386 !important;
}
.floor-table-token.free .floor-table-shape-icon { color: #20a565 !important; }
.floor-table-token.open .floor-table-shape-icon { color: #ef8a35 !important; }
.floor-table-token.pending .floor-table-shape-icon { color: #d69d20 !important; }
.floor-table-token.inactive .floor-table-shape-icon { color: #7b8797 !important; }
.legend-pill.pending { color: #8a6715; background: #fff8e2; border-color: #f2d88a; }
.floor-dot.pending { background: #d69d20; }

@media (max-width: 1020px) {
  .settings-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(250px, 1fr)) !important;
    overflow: visible !important;
    gap: 10px !important;
    padding: 10px !important;
  }
  .settings-menu-title {
    display: flex !important;
    grid-column: 1 / -1 !important;
    margin: 0 2px 2px !important;
  }
  .settings-tabs .settings-tab {
    margin: 0 !important;
    border: 1px solid var(--line) !important;
  }
}

@media (max-width: 680px) {
  .settings-tabs {
    grid-template-columns: 1fr !important;
  }
  .settings-menu-title {
    display: flex !important;
  }
  .settings-tabs .settings-tab {
    min-height: 82px;
    grid-template-columns: 44px minmax(0, 1fr) 18px !important;
  }
  .settings-tabs .settings-tab > .settings-tab-copy small {
    display: block !important;
  }
}
.settings-tabs .settings-tab > .settings-tab-copy {
  height: auto !important;
  min-height: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-size: inherit !important;
  place-items: initial !important;
  justify-items: stretch !important;
}
.settings-tabs .settings-tab.active > .settings-tab-copy {
  background: transparent !important;
  color: inherit !important;
}

/* ========================================================================== */
/* v4.6.5 · Mesas operativas + flujo de apertura                              */
/* ========================================================================== */

.settings-pane.feature-disabled { display: none !important; }

.room-config-heading {
  align-items: center;
}
.room-config-heading > .room-new-table-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 11px;
  white-space: nowrap;
}

/* La pestaña activa de salón debe conservar contraste sobre el fondo claro. */
.floor-room-tab.active,
#view-tables .floor-room-tab.active {
  color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary-soft) 76%, var(--panel)) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 16%, transparent), var(--shadow-sm) !important;
}

#view-tables .floor-runtime-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  gap: 12px;
}
#view-tables .floor-room-tabs {
  min-height: 58px;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 2px 2px;
}
#view-tables .floor-room-tab {
  min-width: 132px;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 12px;
}
#view-tables .compact-floor-toolbar {
  min-height: 58px;
  padding: 13px 16px;
}
#view-tables .floor-legend {
  justify-content: flex-start;
  gap: 18px;
}
#view-tables .floor-map-scroll {
  width: 100%;
  min-height: 420px;
  max-height: calc(100vh - 330px);
  margin: 0 auto;
  border-radius: 16px;
  background: #fbfcfe;
}
#view-tables .runtime-floor {
  grid-template-columns: repeat(var(--floor-cols), minmax(92px, 1fr));
  grid-template-rows: repeat(var(--floor-rows), 96px);
  min-width: calc(var(--floor-cols) * 92px);
  min-height: calc(var(--floor-rows) * 96px);
  padding: 12px;
  background-size: calc((100% - 24px) / var(--floor-cols)) calc((100% - 24px) / var(--floor-rows));
  background-position: 12px 12px;
}
#view-tables .runtime-floor .floor-table-token {
  margin: 8px;
  min-height: 72px;
  padding: 10px 9px;
  gap: 2px;
  overflow: hidden;
  justify-content: center;
}
#view-tables .runtime-floor .floor-table-token.shape-round {
  aspect-ratio: 1;
  justify-self: center;
  align-self: center;
  width: calc(100% - 16px);
  max-width: 84px;
  min-height: 0;
}
#view-tables .runtime-floor .floor-table-token strong {
  width: 100%;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
}
#view-tables .runtime-floor .floor-table-token small {
  width: 100%;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
}
#view-tables .runtime-floor .floor-table-shape-icon {
  margin: 0 0 2px;
  font-size: 13px;
}
.floor-table-visit-meta {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.15;
}
#view-tables .floor-table-total {
  margin-top: 2px;
  font-size: 9px;
}

.table-open-card { max-width: 620px; }
.table-open-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #dce6f4;
  border-radius: 14px;
  background: #f7faff;
}
.table-open-summary .table-open-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e7f0ff;
  color: var(--primary);
  font-size: 18px;
}
.table-open-summary strong,
.table-open-summary small { display: block; }
.table-open-summary strong { font-size: 14px; }
.table-open-summary small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.table-service-context {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid #cfe0ff;
  border-radius: 13px;
  background: #f4f8ff;
}
.table-service-context > div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  border-right: 1px solid #dce7f6;
}
.table-service-context > div:last-child { border-right: 0; }
.table-service-context span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #62738b;
  font-size: 8px;
  font-weight: 650;
}
.table-service-context strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #18365e;
  font-size: 10px;
}
.checkout-form input[readonly] {
  background: #f5f7fa;
  color: #5f6c7c;
  cursor: default;
}

.table-visit-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #dce6f4;
  border-radius: 14px;
  background: #f8faff;
}
.table-visit-summary > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.table-visit-summary span { color: var(--muted); font-size: 9px; }
.table-visit-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.compact-empty { min-height: 90px; padding: 18px; }
.table-checkout-bar {
  grid-template-columns: minmax(170px, .8fr) auto auto;
  align-items: end;
}

html[data-theme="dark"] .table-open-summary,
html[data-theme="dark"] .table-service-context,
html[data-theme="dark"] .table-visit-summary {
  background: var(--panel-alt);
  border-color: var(--line);
}
html[data-theme="dark"] .table-service-context strong { color: var(--text); }
html[data-theme="dark"] .checkout-form input[readonly] { background: var(--panel-alt); color: var(--muted); }

@media (max-width: 980px) {
  .table-service-context,
  .table-visit-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-service-context > div { border-right: 0; }
  #view-tables .runtime-floor {
    grid-template-columns: repeat(var(--floor-cols), 84px);
    grid-template-rows: repeat(var(--floor-rows), 90px);
    min-width: calc(var(--floor-cols) * 84px);
    min-height: calc(var(--floor-rows) * 90px);
  }
}

@media (max-width: 680px) {
  .room-config-heading { align-items: stretch; flex-direction: column; }
  .room-config-heading > .room-new-table-button { width: 100%; }
  .table-service-context,
  .table-visit-summary { grid-template-columns: 1fr; }
  .table-checkout-bar { grid-template-columns: 1fr; }
}

/* v4.6.6 - Mesas abiertas: contenido adaptable sin superposición */
#view-tables .runtime-floor {
  grid-template-columns: repeat(var(--floor-cols), minmax(104px, 1fr));
  grid-template-rows: repeat(var(--floor-rows), 122px);
  min-width: calc(var(--floor-cols) * 104px);
  min-height: calc(var(--floor-rows) * 122px);
}

#view-tables .runtime-floor .floor-table-token {
  align-self: center;
  min-height: 86px;
  max-height: calc(100% - 12px);
  margin: 6px;
  padding: 9px 8px;
  gap: 3px;
  overflow: hidden;
}

#view-tables .runtime-floor .floor-table-token.open,
#view-tables .runtime-floor .floor-table-token.pending {
  min-height: 108px;
  justify-content: center;
}

#view-tables .runtime-floor .floor-table-token.shape-round {
  width: min(calc(100% - 12px), 96px);
  height: min(calc(100% - 12px), 96px);
  max-width: none;
  min-height: 0;
  aspect-ratio: 1;
}

#view-tables .runtime-floor .floor-table-token.shape-round.open,
#view-tables .runtime-floor .floor-table-token.shape-round.pending {
  width: min(calc(100% - 8px), 110px);
  height: min(calc(100% - 8px), 110px);
}

#view-tables .runtime-floor .floor-table-token strong,
#view-tables .runtime-floor .floor-table-token small,
#view-tables .runtime-floor .floor-table-customer,
#view-tables .runtime-floor .floor-table-visit-meta,
#view-tables .runtime-floor .floor-table-total {
  position: static;
  width: 100%;
  max-width: 100%;
  margin: 0;
  text-align: center;
  overflow: hidden;
}

#view-tables .runtime-floor .floor-table-token strong {
  font-size: 11px;
  line-height: 1.12;
  white-space: normal;
  overflow-wrap: anywhere;
}

#view-tables .runtime-floor .floor-table-status {
  font-size: 8px;
  line-height: 1.1;
  white-space: normal;
  color: var(--muted);
}

#view-tables .runtime-floor .floor-table-customer {
  display: block;
  font-size: 9px;
  line-height: 1.1;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
}

#view-tables .runtime-floor .floor-table-visit-meta {
  display: block;
  font-size: 7.5px;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--muted);
}

#view-tables .runtime-floor .floor-table-visit-meta i {
  font-size: 7px;
}

#view-tables .runtime-floor .floor-table-total {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  line-height: 1.1;
  color: var(--primary-dark);
}

#view-tables .runtime-floor .floor-table-token.content-dense {
  gap: 2px;
  padding-inline: 6px;
}

#view-tables .runtime-floor .floor-table-token.content-dense strong { font-size: 10px; }
#view-tables .runtime-floor .floor-table-token.content-dense .floor-table-customer { font-size: 8px; }
#view-tables .runtime-floor .floor-table-token.content-dense .floor-table-visit-meta { font-size: 7px; }
#view-tables .runtime-floor .floor-table-token.content-dense .floor-table-total { font-size: 8px; }

@media (max-width: 900px) {
  #view-tables .runtime-floor {
    grid-template-columns: repeat(var(--floor-cols), 104px);
    grid-template-rows: repeat(var(--floor-rows), 122px);
  }
}

/* ========================================================================== */
/* v4.6.7 · Cocina sin stock + experiencia móvil                              */
/* ========================================================================== */

.product-card.kitchen-unlimited footer {
  align-items: center;
}
.product-kitchen-availability {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #9a5b13;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}
.product-kitchen-availability i { font-size: 9px; }
.product-stock-count { color: #27965d; }

.sidebar-overlay {
  display: none;
}

@media (max-width: 820px) {
  html, body { min-width: 0; width: 100%; overflow-x: hidden; }
  body { overscroll-behavior-y: auto; }

  .app-shell { display: block !important; min-height: 100dvh; }

  /* Menú lateral móvil real; corrige las reglas antiguas de navegación inferior. */
  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: min(300px, 86vw) !important;
    height: 100dvh !important;
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom)) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(-106%) !important;
    transition: transform .2s ease !important;
    z-index: 150 !important;
    box-shadow: 20px 0 52px rgba(6, 18, 38, .28);
  }
  .sidebar.open { transform: translateX(0) !important; }
  .sidebar .brand {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0 4px 18px !important;
  }
  .sidebar .brand-copy { display: block !important; text-align: left !important; }
  .sidebar .brand strong { font-size: 14px !important; }
  .sidebar .brand span { display: block !important; font-size: 10px !important; }
  .sidebar-close {
    display: grid !important;
    place-items: center;
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(255,255,255,.08);
    color: #d8e2f0;
    font-size: 18px;
  }
  .sidebar .nav-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    height: auto !important;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
  }
  .sidebar .nav-item {
    min-height: 50px !important;
    height: auto !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    padding: 10px 13px !important;
    border-radius: 13px !important;
    text-align: left !important;
  }
  .sidebar .nav-icon { width: 28px !important; height: 28px !important; font-size: 18px !important; }
  .sidebar .nav-label { font-size: 12px !important; }
  .sidebar .sidebar-footer {
    display: block !important;
    margin-top: auto !important;
    padding: 12px 8px 0 !important;
    text-align: left !important;
  }
  .sidebar .connection-state { display: flex !important; justify-content: flex-start !important; justify-items: initial !important; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 140;
    display: block;
    pointer-events: none;
    opacity: 0;
    background: rgba(6, 18, 38, .48);
    backdrop-filter: blur(2px);
    transition: opacity .2s ease;
  }
  .sidebar.open + .sidebar-overlay { opacity: 1; pointer-events: auto; }

  .main-content {
    grid-column: auto !important;
    width: 100%;
    min-width: 0;
    padding: 0 12px max(24px, env(safe-area-inset-bottom)) !important;
  }
  body.view-pos .main-content { padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    min-height: 68px !important;
    margin-inline: -12px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px !important;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  }
  .topbar-left { gap: 9px !important; min-width: 0; }
  .menu-button {
    display: grid !important;
    place-items: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border-radius: 12px;
  }
  .topbar-left > div { min-width: 0; }
  .topbar-left h1 {
    font-size: 20px !important;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-left p { display: none; }
  .topbar-actions { margin-left: auto !important; gap: 6px !important; }
  .topbar-actions .clock-display,
  .topbar-actions .user-pill { display: none !important; }
  .topbar-actions .secondary-button.compact {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0 !important;
    display: grid;
    place-items: center;
    font-size: 0;
    border-radius: 12px;
  }
  .topbar-actions .secondary-button.compact i { font-size: 15px; margin: 0; }

  .view { padding-top: 12px; }
  .view-actions-only,
  .section-toolbar,
  #view-cash .cash-page-heading {
    min-height: 0;
    margin-bottom: 10px;
  }
  .view-actions-only > button,
  .section-toolbar > button { min-height: 44px; }

  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 9px !important; }
  .metric-card { min-height: 92px; padding: 13px !important; border-radius: 15px !important; }
  .metric-card strong { font-size: clamp(20px, 7vw, 25px) !important; }
  .metric-card span, .metric-card small { font-size: 10px !important; }

  .panel { padding: 14px !important; border-radius: 16px !important; }
  .panel-heading { gap: 8px; }
  .panel-heading h2 { font-size: 16px; }
  .panel-heading p { font-size: 10px; line-height: 1.35; }

  /* Ventas: prioridad a catálogo + carrito como drawer. */
  .pos-layout { display: block !important; }
  .sales-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 46px 46px !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
  .sales-toolbar .search-field { grid-column: auto !important; min-width: 0; }
  .sales-toolbar .secondary-button,
  .sales-toolbar .primary-button {
    width: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0 !important;
    display: grid;
    place-items: center;
    font-size: 0;
  }
  .sales-toolbar button i { font-size: 15px; }
  .category-chips {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .category-chips::-webkit-scrollbar { display: none; }
  .category-chip { flex: 0 0 auto; min-height: 40px; padding: 9px 13px; }
  .sales-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1px;
    margin-bottom: 10px;
  }
  .sales-summary-grid article { min-height: 66px; padding: 10px !important; }
  .sales-summary-grid article i { width: 30px; height: 30px; font-size: 12px; }
  .sales-summary-grid article strong { font-size: 16px; }
  .sales-summary-grid article span { font-size: 9px; }

  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 9px !important; }
  .product-card {
    min-height: 174px !important;
    padding: 9px !important;
    border-radius: 14px !important;
  }
  .product-thumb { height: 82px !important; border-radius: 11px !important; }
  .product-card .product-code { font-size: 8px !important; margin-top: 6px; }
  .product-card > strong { font-size: 12px !important; line-height: 1.2; min-height: 29px; }
  .product-card > small { font-size: 8px !important; }
  .product-card footer { gap: 4px; margin-top: 5px; }
  .product-card footer b { font-size: 14px !important; }
  .product-card footer span { font-size: 8px !important; }
  .kitchen-product-badge { top: 7px; left: 7px; font-size: 8px; padding: 4px 6px; }

  .cart-panel {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    z-index: 180 !important;
    width: min(430px, 100vw) !important;
    height: 100dvh !important;
    max-height: none !important;
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    border-radius: 20px 0 0 20px !important;
    transform: translateX(104%);
    transition: transform .2s ease;
  }
  body.cart-drawer-open .cart-panel { transform: translateX(0); }
  .cart-items { max-height: 31dvh !important; }
  .cart-item { padding: 10px 0; }
  .checkout-form { gap: 10px; }
  .checkout-form input,
  .checkout-form select,
  .checkout-form textarea { min-height: 46px; }
  .floating-cart {
    left: 12px !important;
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    min-height: 58px !important;
    border-radius: 16px !important;
  }

  /* Cajas */
  #view-cash .cash-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  #view-cash .cash-tabs::-webkit-scrollbar { display: none; }
  #view-cash .cash-tab { flex: 1 0 100px !important; min-height: 42px; }
  #view-cash .cash-register-selector { display: flex !important; overflow-x: auto; gap: 8px; padding-bottom: 5px; }
  #view-cash .cash-register-choice { flex: 0 0 82vw; min-width: 240px !important; }
  #view-cash .cash-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #view-cash .cash-summary-bottom,
  #view-cash .cash-grid { grid-template-columns: 1fr !important; }
  #view-cash .cash-history-filters,
  #view-cash .filter-bar { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  #view-cash .filter-bar > button { width: 100%; }

  /* Mesas / mapa: compacto pero desplazable, sin comprimir las tarjetas. */
  #view-tables .floor-runtime-shell { gap: 8px; }
  #view-tables .floor-room-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; }
  #view-tables .floor-room-tab { flex: 0 0 auto; min-width: 122px !important; min-height: 44px !important; }
  #view-tables .compact-floor-toolbar {
    min-height: 0 !important;
    display: grid;
    gap: 8px;
    padding: 10px 12px !important;
  }
  #view-tables .floor-legend { gap: 10px !important; flex-wrap: wrap; }
  #view-tables .floor-legend span { font-size: 9px; }
  #view-tables .floor-map-scroll {
    min-height: 430px !important;
    max-height: calc(100dvh - 235px) !important;
    border-radius: 12px !important;
  }
  #view-tables .runtime-floor {
    grid-template-columns: repeat(var(--floor-cols), 96px) !important;
    grid-template-rows: repeat(var(--floor-rows), 116px) !important;
    min-width: calc(var(--floor-cols) * 96px) !important;
    min-height: calc(var(--floor-rows) * 116px) !important;
    padding: 8px !important;
  }

  /* Monitor */
  .kitchen-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
  .kitchen-card { border-radius: 15px; }
  .segmented-filter { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .segmented-filter button { flex: 1 0 auto; min-height: 42px; }

  /* Catálogo y Ajustes */
  .catalog-tabs {
    display: flex !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .catalog-tabs::-webkit-scrollbar { display: none; }
  .catalog-tab { flex: 0 0 155px; min-height: 66px !important; }
  .catalog-pane-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
  .catalog-pane-toolbar > button { flex: 1 1 auto; }

  .settings-layout { grid-template-columns: 1fr !important; gap: 10px !important; }
  .settings-tabs {
    position: static !important;
    display: flex !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding: 7px !important;
    border-radius: 15px !important;
    scrollbar-width: none;
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-menu-title { display: none !important; }
  .settings-tabs .settings-tab {
    flex: 0 0 190px;
    min-height: 68px !important;
    grid-template-columns: 38px minmax(0, 1fr) 14px !important;
    padding: 9px 10px !important;
  }
  .settings-tabs .settings-tab > .settings-tab-icon { width: 36px; height: 36px; }
  .settings-tabs .settings-tab > .settings-tab-copy b { font-size: 11px; }
  .settings-tabs .settings-tab > .settings-tab-copy small { font-size: 8px; line-height: 1.25; }
  .settings-summary-grid,
  .settings-summary-grid.floor-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .floor-settings-panel { padding: 12px !important; }
  .floor-editor-heading { display: grid !important; gap: 9px; }
  .floor-editor-actions { display: grid !important; grid-template-columns: 1fr !important; width: 100%; }
  .floor-map-with-config { grid-template-columns: 1fr !important; }
  .room-config-panel { position: static !important; width: 100% !important; }

  /* Formularios/modales */
  .two-column-fields,
  .three-column-fields,
  .order-meta-grid,
  .table-service-context,
  .table-visit-summary { grid-template-columns: 1fr !important; }
  .modal-backdrop { padding: 8px !important; align-items: flex-end !important; }
  .modal-card {
    width: 100% !important;
    max-height: calc(100dvh - 12px) !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 16px !important;
  }
  .modal-heading { position: sticky; top: -16px; z-index: 2; padding-top: 12px; background: var(--panel); }
  .modal-actions { grid-template-columns: 1fr !important; }
  .modal-actions button { width: 100%; min-height: 46px; }

  /* Tablas: desplazamiento horizontal claro y usable con pulgar. */
  .table-wrap {
    width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .table-wrap table { min-width: 680px; }
  .table-wrap th,
  .table-wrap td { padding: 10px 9px !important; font-size: 10px !important; white-space: nowrap; }
  .table-action { min-height: 38px; }

  .toast-container {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  body.view-pos .toast-container { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .main-content { padding-inline: 9px !important; }
  .topbar { margin-inline: -9px; padding-inline: 9px !important; }
  .metric-grid { grid-template-columns: 1fr 1fr !important; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 7px !important; }
  .product-card { min-height: 164px !important; padding: 8px !important; }
  .product-thumb { height: 74px !important; }
  .product-card > strong { font-size: 11px !important; min-height: 27px; }
  .product-card footer b { font-size: 13px !important; }
  .sales-summary-grid article { min-height: 61px; }
  #view-cash .cash-overview-metrics { grid-template-columns: 1fr !important; }
  #view-cash .cash-history-filters,
  #view-cash .filter-bar { grid-template-columns: 1fr !important; }
  .settings-summary-grid,
  .settings-summary-grid.floor-summary-grid { grid-template-columns: 1fr !important; }
  .settings-tabs .settings-tab { flex-basis: 176px; }
}

/* v4.6.8 · Tipo de negocio por tarjetas + Ticket + Delivery */
.business-type-card {
  appearance: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  font: inherit;
  overflow: hidden;
}
.business-type-card .business-card-check {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  opacity: .45;
  transition: .15s ease;
}
.business-type-card.active,
.business-type-card[aria-checked="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-sm);
  background: linear-gradient(145deg, var(--panel), var(--primary-soft));
}
.business-type-card.active .business-card-check,
.business-type-card[aria-checked="true"] .business-card-check {
  color: #fff;
  background: var(--primary);
  opacity: 1;
}
.business-type-card .business-type-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 22px;
}

.settings-tab.settings-tone-red { --settings-accent: var(--danger); --settings-soft: var(--danger-soft); }

.ticket-logo-option {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.ticket-logo-option > small { grid-column: 2; color: var(--muted); }
.ticket-logo-preview {
  grid-row: span 2;
  width: 96px;
  min-height: 76px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.ticket-logo-preview img { display: block; max-width: 100%; max-height: 70px; object-fit: contain; }

.delivery-settings-stack { display: grid; gap: 16px; }
.delivery-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.delivery-callout { border-color: #f3c5c9; background: #fff7f7; }
.delivery-callout .callout-icon { color: #dc4a55; background: #ffe8ea; }
.delivery-payload-panel pre {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  border-radius: 14px;
  background: #101827;
  color: #e8eef8;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.delivery-app-cell { display: grid; gap: 3px; }
.delivery-app-cell small, .delivery-webhook-cell small { color: var(--muted); }
.delivery-webhook-cell { display: grid; gap: 5px; min-width: 240px; }
.delivery-webhook-cell code { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.delivery-actions { display: flex; gap: 6px; justify-content: flex-end; }
.delivery-secret-result {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #b9dfcb;
  border-radius: 15px;
  background: #f0fbf5;
}
.delivery-secret-result p { margin: 0; color: var(--muted); }
.copy-field { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }

@media (max-width: 760px) {
  .business-type-grid { grid-template-columns: 1fr; }
  .business-type-card { min-height: 126px; padding: 16px 58px 16px 16px; }
  .business-type-card b { margin-top: 8px; }
  .delivery-summary-grid { grid-template-columns: 1fr; }
  .ticket-logo-option { grid-template-columns: 72px minmax(0,1fr); }
  .ticket-logo-preview { width: 72px; min-height: 64px; }
  .delivery-webhook-cell { min-width: 190px; }
  .copy-field { grid-template-columns: 1fr; }
  .copy-field button { width: 100%; }
}

/* v4.6.9 · Recetas, subrecetas e inventario de cocina */
.kitchen-inventory-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kitchen-inventory-summary article {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.kitchen-inventory-summary article > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #e9f2ff;
  color: #1769f6;
  font-size: 18px;
}
.kitchen-inventory-summary article.warning > span { background: #fff2df; color: #d97706; }
.kitchen-inventory-summary article div { display: grid; gap: 2px; }
.kitchen-inventory-summary strong { font-size: 20px; }
.kitchen-inventory-summary small { color: var(--muted); }
.stock-low-text { color: #c2410c; }
.status-badge.warning { background: #fff1dc; color: #b45309; }
.table-action-group { display: flex; gap: 6px; justify-content: flex-end; }
.recipe-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.recipe-type-badge.product { color: #1769f6; background: #e9f2ff; }
.recipe-type-badge.subrecipe { color: #7c3aed; background: #f2eaff; }
.recipe-editor-card { width: min(980px, calc(100vw - 30px)); }
.recipe-components-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.recipe-components-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.recipe-components-heading > div { display: grid; gap: 3px; }
.recipe-components-heading small { color: var(--muted); }
.recipe-component-row {
  display: grid;
  grid-template-columns: 130px minmax(180px, 1.4fr) 150px minmax(160px, 1fr) 42px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
}
.recipe-component-row select,
.recipe-component-row input { min-width: 0; }
.recipe-quantity-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.recipe-quantity-field span {
  min-width: 32px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.compact-empty { min-height: 60px; }
.kitchen-item-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.kitchen-item-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
  align-items: center;
}
.kitchen-item-main small { grid-column: 2; color: var(--muted); }
.kitchen-item-recipe-actions {
  display: grid;
  justify-items: end;
  gap: 5px;
}
.kitchen-recipe-button,
.inline-recipe-link {
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.inline-recipe-link { margin-left: 7px; }
.kitchen-stock-warning,
.kitchen-stock-ok,
.kitchen-no-recipe {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.kitchen-stock-warning { color: #c2410c; }
.kitchen-stock-ok { color: #15803d; }
.kitchen-no-recipe { color: var(--muted); }
.recipe-view-card { width: min(900px, calc(100vw - 28px)); }
.recipe-view-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.recipe-view-summary article {
  display: grid;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}
.recipe-view-summary article.warning { background: #fff7ed; border-color: #fed7aa; }
.recipe-view-summary span,
.recipe-view-summary small { color: var(--muted); }
.recipe-view-summary strong { font-size: 17px; }
.recipe-instructions,
.recipe-tree,
.recipe-requirements {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}
.recipe-instructions h3,
.recipe-tree h3,
.recipe-requirements h3 { margin: 0 0 10px; }
.recipe-instructions p { margin: 0; line-height: 1.65; }
.recipe-tree ul { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.recipe-tree li { color: var(--text-primary); }
.recipe-tree li > span { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: baseline; }
.recipe-tree li small { display: block; margin-top: 2px; color: var(--muted); }
.recipe-tree em { padding: 2px 6px; border-radius: 999px; background: #f2eaff; color: #7c3aed; font-size: 9px; font-style: normal; font-weight: 700; }
.subrecipe-node > ul { margin-top: 7px; }

@media (max-width: 900px) {
  .recipe-component-row { grid-template-columns: 1fr 1.4fr; }
  .recipe-component-row .recipe-quantity-field { grid-column: 1; }
  .recipe-component-row input[data-component-field="notes"] { grid-column: 2; }
  .recipe-component-row .icon-button { justify-self: end; }
}

@media (max-width: 760px) {
  .kitchen-inventory-summary { grid-template-columns: 1fr; }
  .recipe-component-row { grid-template-columns: 1fr; }
  .recipe-component-row .recipe-quantity-field,
  .recipe-component-row input[data-component-field="notes"] { grid-column: auto; }
  .recipe-component-row .icon-button { width: 100%; justify-self: stretch; }
  .recipe-view-summary { grid-template-columns: 1fr; }
  .kitchen-item-row { grid-template-columns: 1fr !important; }
  .kitchen-item-recipe-actions { justify-items: start; }
  .kitchen-recipe-button { min-height: 36px; padding: 7px 0; }
}

/* ===== v4.7.0 · CFDI 4.0 ===== */
.fiscal-business-block {
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface-soft, #f8fafc);
  display: grid;
  gap: 14px;
}

.cfdi-settings-stack {
  display: grid;
  gap: 18px;
}

.product-fiscal-details {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--surface-soft, #f8fafc);
  overflow: hidden;
}

.product-fiscal-details summary {
  cursor: pointer;
  padding: 13px 15px;
  font-weight: 700;
  color: var(--text-primary);
  user-select: none;
}

.product-fiscal-details[open] summary { border-bottom: 1px solid var(--border-color); }
.product-fiscal-details > small { display: block; padding: 0 15px 15px; color: var(--text-muted); }
.fiscal-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 15px;
}

.cfdi-status-button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 7px 9px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}
.cfdi-status-button i { font-size: 1.05rem; }
.cfdi-status-button span { display: grid; line-height: 1.1; gap: 2px; }
.cfdi-status-button small { font-size: .67rem; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfdi-status-button.stamped { background: #ecfdf3; border-color: #bbf7d0; color: #15803d; }
.cfdi-status-button.error { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.cfdi-action { display: inline-flex; align-items: center; gap: 6px; }

.cfdi-modal-card { width: min(900px, calc(100vw - 28px)); }
.cfdi-source-summary { margin-bottom: 16px; }
.cfdi-source-header {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 15px;
  background: var(--surface-soft, #f8fafc);
}
.cfdi-source-header > div { display: grid; gap: 4px; }
.cfdi-source-header span { color: var(--text-muted); font-size: .78rem; }
.cfdi-source-header strong { color: var(--text-primary); font-size: .96rem; }
.cfdi-stamped-view { display: grid; gap: 16px; }
.cfdi-success-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}
.cfdi-success-card h3, .cfdi-success-card p { margin: 0; }
.cfdi-success-card p { margin-top: 3px; color: #3f6f50; }
.cfdi-success-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dcfce7;
  font-size: 1.3rem;
}
.cfdi-uuid { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.sale-success-actions { flex-wrap: wrap; }

@media (max-width: 760px) {
  .fiscal-product-grid,
  .cfdi-source-header { grid-template-columns: 1fr; }
  .cfdi-modal-card { width: 100%; max-height: 92dvh; }
  .cfdi-modal-card .modal-form { gap: 12px; }
  .cfdi-modal-card .two-column-fields,
  .cfdi-modal-card .three-column-fields,
  .fiscal-business-block .two-column-fields,
  .fiscal-business-block .three-column-fields { grid-template-columns: 1fr; }
  .sale-success-actions > button { flex: 1 1 100%; min-height: 46px; }
  .cfdi-status-button small { max-width: 90px; }
}


/* Aura v5.0.0 ------------------------------------------------------------ */
.aura-brand-mark {
  overflow: hidden;
  background: #fff !important;
  padding: 3px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18) !important;
}
.aura-brand-mark .brand-logo { object-fit: contain; border-radius: 12px; }
.login-mark.aura-brand-mark { width: 78px; height: 78px; border-radius: 22px; margin-inline: auto; }
.status-badge.neutral { background: #eef2f7; color: #475569; border-color: #dbe3ee; }
@media (max-width: 620px) {
  .aura-brand-mark .brand-logo { border-radius: 10px; }
}

/* Aura v5.1.1 · Appearance system simplificado -------------------------- */
/* Surfaces must always follow the active theme instead of fixed whites. */
.panel,
.metric-card,
.product-card,
.cart-panel,
.modal-card,
.login-card,
.quick-action:not(.primary-action),
.secondary-button,
.menu-button,
.back-button,
.module-card,
.settings-tab,
.business-type-card,
.kitchen-card,
.table-card,
.cash-overview-metric,
.cash-register-choice,
.cash-register-card,
.table-open-summary,
.table-service-context,
.table-visit-summary,
.floor-room-tab,
.floor-new-room-card,
.room-quick-actions button,
.table-shape-option,
.editor-legend,
.floor-table-edit-hint,
.settings-table-row,
.catalog-card,
.inventory-overview-card,
.overview-card {
  background-color: var(--panel);
  color: var(--text);
  border-color: var(--line);
}

.topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); }
.secondary-button:hover,
.back-button:hover { background: var(--panel-alt); }
.icon-button,
.cart-close { background: var(--panel-alt); color: var(--muted); }
.primary-button { box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 22%, transparent); }
.nav-item.active { box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 28%, transparent); }
.nav-item:hover { background: color-mix(in srgb, var(--primary) 24%, var(--nav)); }
.brand-mark { background: linear-gradient(145deg, var(--primary), var(--primary-dark)); box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 30%, transparent); }
.quick-action.primary-action { background: linear-gradient(145deg, var(--primary), var(--primary-dark)); }

.appearance-theme-row { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr); gap: 14px; align-items: end; }
.appearance-mode-hint { min-height: 58px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-alt); color: var(--muted); font-size: 12px; line-height: 1.45; }
.appearance-mode-hint i { color: var(--primary); font-size: 18px; }
.palette-section { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 19px; background: var(--panel-alt); }
.palette-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.palette-heading b, .palette-heading small { display: block; }
.palette-heading small { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.palette-badge { padding: 6px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.palette-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.palette-option { min-height: 84px; padding: 12px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); text-align: left; }
.palette-option:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.palette-option.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.palette-option > span:nth-child(2) strong, .palette-option > span:nth-child(2) small { display: block; }
.palette-option > span:nth-child(2) small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.palette-option > b { color: var(--primary); opacity: 0; }
.palette-option.active > b { opacity: 1; }
.palette-swatches { width: 46px; display: grid; grid-template-columns: repeat(2, 20px); gap: 3px; }
.palette-swatches i { width: 20px; height: 20px; border-radius: 7px; background: var(--swatch); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.custom-palette-details { border-top: 1px solid var(--line); padding-top: 12px; }
.custom-palette-details summary { cursor: pointer; color: var(--primary); font-size: 12px; font-weight: 850; }
.palette-custom-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Dark mode: one canonical neutral hierarchy. This intentionally appears last. */
html[data-theme="dark"] {
  --bg: #0c0d0f;
  --panel: #151619;
  --panel-alt: #1d1f23;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2e3035;
  --shadow-sm: 0 4px 18px rgba(0,0,0,.18);
  --shadow: 0 18px 45px rgba(0,0,0,.34);
  color-scheme: dark;
}
html[data-theme="dark"] .topbar { background: color-mix(in srgb, var(--bg) 91%, transparent); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background-color: var(--panel-alt); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] thead th { background: var(--panel-alt); color: var(--muted); }
html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] tbody tr:hover td { background: color-mix(in srgb, var(--primary) 8%, var(--panel)); }
html[data-theme="dark"] .catalog-tab.active,
html[data-theme="dark"] .settings-tab.active { background: color-mix(in srgb, var(--primary) 14%, var(--panel)); }
html[data-theme="dark"] .auth-screen { background: radial-gradient(circle at 18% 18%, var(--primary-soft), transparent 32%), var(--bg); }
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .cash-overview-metric,
html[data-theme="dark"] .inventory-overview-card,
html[data-theme="dark"] .overview-card { background: var(--panel); color: var(--text); }

@media (max-width: 760px) {
  .appearance-theme-row, .palette-custom-grid { grid-template-columns: 1fr; }
  .palette-grid { grid-template-columns: 1fr; }
}
