:root {
  color-scheme: dark;
  --bg: #0c0b09;
  --surface: #151310;
  --surface-2: #1f1b16;
  --surface-3: #2a251f;
  --ink: #fff7e6;
  --muted: #b8aa94;
  --soft: #8f826f;
  --line: #3b3329;
  --panel: #171511;
  --brand: #f47a1f;
  --brand-dark: #c95510;
  --accent: #ffd329;
  --accent-dark: #d7a900;
  --danger: #d95745;
  --ok: #79b76a;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
  --soft-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  --font-ui: "Segoe UI", "Inter", Arial, sans-serif;
  --font-display: "Bahnschrift", "Segoe UI Semibold", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  position: relative;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(244, 122, 31, 0.18), transparent 320px),
    linear-gradient(180deg, #17120d 0, var(--bg) 360px);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.35;
}

.brand-backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(12, 11, 9, 0.2), rgba(12, 11, 9, 0.98) 380px),
    radial-gradient(circle at 85% 0, rgba(255, 211, 41, 0.12), transparent 280px);
}

body.has-brand-background .brand-backdrop {
  background:
    linear-gradient(180deg, rgba(12, 11, 9, 0.62), rgba(12, 11, 9, 0.96) 360px, rgba(12, 11, 9, 1)),
    var(--brand-bg-image) center top / cover no-repeat;
  filter: saturate(0.95);
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at top right, rgba(244, 122, 31, 0.18), transparent 320px),
    rgba(12, 11, 9, 0.96);
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.login-card label:has(#loginBakerySlug) {
  display: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px clamp(14px, 4vw, 28px) 12px;
  background: rgba(12, 11, 9, 0.86);
  border-bottom: 1px solid rgba(255, 211, 41, 0.16);
  backdrop-filter: blur(18px) saturate(1.1);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1 1 280px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  background: #fff;
  border: 1px solid rgba(255, 211, 41, 0.35);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: #fff4d2;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  color: #fff4d2;
  font-family: var(--font-ui);
  font-size: 1.02rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h3 {
  color: #fff4d2;
  font-family: var(--font-ui);
  font-weight: 900;
}

.header-actions,
.button-row,
.section-heading,
.tabs,
.status-row,
.route-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
  max-width: 100%;
}

.header-actions .field {
  min-width: min(220px, 100%);
}

.app-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 14px clamp(10px, 4vw, 26px) 36px;
}

.top-panel {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(31, 27, 22, 0.96), rgba(21, 19, 16, 0.98));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.route-panel {
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field.grow {
  flex: 1;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  font-weight: 800;
  letter-spacing: 0;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #807464;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 211, 41, 0.14);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stats-grid article {
  position: relative;
  overflow: hidden;
  padding: 13px 14px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.stats-grid article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--brand));
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stats-grid strong {
  display: block;
  margin-top: 7px;
  color: #fff4d2;
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 1;
}

.tabs {
  margin: 12px 0;
  padding: 3px;
  background: #100f0d;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.tab {
  flex: 1;
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tab.active {
  color: #15100a;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  box-shadow: 0 6px 16px rgba(255, 211, 41, 0.22);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 10px;
}

.primary,
.secondary,
.danger,
.ghost,
.icon-button,
.file-picker {
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 6px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary {
  color: #fff8e4;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  box-shadow: 0 10px 22px rgba(244, 122, 31, 0.28);
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary,
.icon-button,
.file-picker {
  color: var(--ink);
  background: linear-gradient(180deg, #302a23, #231f1a);
  border: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.danger {
  color: #fff;
  background: var(--danger);
}

.ghost {
  color: var(--muted);
  background: transparent;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.route-list,
.customer-list,
.line-items {
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: rgba(31, 27, 22, 0.78);
  border: 1px dashed #4c4135;
  border-radius: 8px;
}

.stop-card,
.customer-card,
.backup-panel {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.stop-card {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  padding: 12px;
}

.route-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #15100a;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-radius: 6px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(255, 211, 41, 0.18);
}

.stop-main h3,
.customer-card h3 {
  margin: 0 0 3px;
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.fixed-label {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 8px;
  color: #15100a;
  background: var(--accent);
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.order-text {
  margin: 8px 0;
  color: #f4ead0;
  white-space: pre-wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-pending {
  color: #18120a;
  background: var(--accent);
}

.status-prepared {
  color: #18120a;
  background: #f4c06a;
}

.status-delivered {
  color: #0e2113;
  background: #8ee078;
}

.status-paid {
  color: #10212a;
  background: #8ed9ee;
}

.status-issue,
.status-returned {
  color: #2d0f0a;
  background: #ff907f;
}

.money-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}

.money-row strong {
  color: #fff4d2;
}

.route-actions {
  flex-direction: column;
  align-items: stretch;
}

.small-button {
  min-width: 40px;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--ink);
  background: #2b261f;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 900;
}

.pay-button {
  color: #fff8e4;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  border-color: rgba(244, 122, 31, 0.7);
}

.customer-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
}

.backup-layout,
.settings-grid,
.dashboard-grid,
.cashbox-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.system-list,
.production-list,
.payment-list,
.message-list,
.ticket-list,
.inventory-list {
  display: grid;
  gap: 10px;
}

.quick-sale-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.product-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.pastry-quick-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.pastry-quick-panel button {
  min-height: 76px;
  color: #15100a;
  background: linear-gradient(180deg, #fff1a8, #ffd629);
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.bread-quick-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(240px, 1.2fr);
  gap: 12px;
  margin: 12px 0 18px;
}

.bread-primary {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 20px;
  color: #15100a;
  text-align: left;
  background: linear-gradient(180deg, #ffd629, #f47a1f);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(244, 122, 31, 0.28);
  cursor: pointer;
}

#quickProductSelect {
  min-height: 62px;
  font-size: 1.25rem;
}

.bread-primary span {
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.bread-primary strong {
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 0.9;
}

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

.bread-steps button,
.bread-manual button {
  min-height: 72px;
  color: #fff4d2;
  background: rgba(13, 12, 10, 0.94);
  border: 1px solid rgba(255, 211, 41, 0.24);
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
}

.bread-manual {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

#quickManualGrams {
  min-height: 62px;
  font-size: 1.22rem;
}

.full-width-action {
  width: 100%;
  min-height: 64px;
  margin-top: 12px;
  font-size: 1.08rem;
}

.product-tile {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 14px;
  color: #fff4d2;
  text-align: left;
  background: rgba(13, 12, 10, 0.94);
  border: 1px solid rgba(255, 211, 41, 0.22);
  border-radius: 8px;
  cursor: pointer;
}

.product-tile strong {
  font-size: 1.08rem;
  line-height: 1.05;
}

.product-tile span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.amount-sale-box {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.amount-sale-box .field {
  margin: 0;
}

#addQuickAmountBtn {
  min-height: 58px;
}

#saleAmount {
  min-height: 58px;
  font-size: 1.28rem;
}

body.sale-by-amount #saleQty,
body.sale-by-amount #saleUnit {
  opacity: 0.45;
}

.operator-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.operator-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 18px;
  color: #fff4d2;
  text-align: left;
  background: linear-gradient(180deg, rgba(36, 29, 22, 0.98), rgba(22, 18, 14, 0.98));
  border: 1px solid rgba(255, 211, 41, 0.18);
  border-radius: 10px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
  cursor: pointer;
}

.operator-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.operator-card strong {
  color: #fff8df;
  font-size: clamp(1.12rem, 1.8vw, 1.55rem);
  line-height: 1.05;
}

.operator-card.primary-action {
  color: #161008;
  background: linear-gradient(180deg, #ffd629, #f47a1f);
  border-color: transparent;
}

.operator-card.primary-action span,
.operator-card.primary-action strong {
  color: #161008;
}

.product-hint {
  min-height: 36px;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 900;
}

.ticket-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  color: #15100a;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.ticket-total strong {
  font-size: 1.4rem;
}

#cashboxView .backup-panel {
  min-height: 220px;
}

#saleSearch {
  min-height: 66px;
  font-size: 1.28rem;
}

#addSaleItemBtn,
#saveSaleBtn,
#closeCashboxBtn {
  min-height: 54px;
}

body[data-role="mostrador"] .top-panel,
body[data-role="mostrador"] .stats-grid,
body[data-role="caja"] .top-panel,
body[data-role="caja"] .stats-grid {
  display: none;
}

body[data-role="mostrador"] .app-shell,
body[data-role="caja"] .app-shell {
  padding-top: 18px;
}

body[data-role="mostrador"] #cashboxView,
body[data-role="caja"] #cashboxView {
  max-width: 680px;
  margin: 0 auto;
}

body[data-role="mostrador"] #cashboxView .section-heading,
body[data-role="caja"] #cashboxView .section-heading {
  align-items: center;
  flex-direction: row;
  margin-bottom: 8px;
}

body[data-role="mostrador"] #cashboxView .section-heading h2,
body[data-role="caja"] #cashboxView .section-heading h2 {
  font-size: 1.05rem;
}

body[data-role="mostrador"] #cashboxView .section-heading .button-row,
body[data-role="caja"] #cashboxView .section-heading .button-row {
  flex: 0 0 auto;
}

body[data-role="mostrador"] #cashboxView .section-heading button,
body[data-role="caja"] #cashboxView .section-heading button {
  min-height: 42px;
  padding: 10px 14px;
}

body[data-role="mostrador"] .cashbox-layout,
body[data-role="caja"] .cashbox-layout {
  grid-template-columns: 1fr;
  gap: 10px;
}

body[data-role="mostrador"] #cashboxView .backup-panel,
body[data-role="caja"] #cashboxView .backup-panel {
  min-height: 0;
  padding: 14px;
}

body[data-role="mostrador"] #cashboxView .backup-panel h2,
body[data-role="caja"] #cashboxView .backup-panel h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

body[data-role="mostrador"] .cashflow-panel,
body[data-role="caja"] .cashflow-panel {
  display: none;
}

body[data-role="mostrador"].show-cashflow .cashflow-panel,
body[data-role="caja"].show-cashflow .cashflow-panel {
  display: block;
}

body[data-role="mostrador"].show-cashflow .cashbox-layout > .backup-panel:not(.cashflow-panel),
body[data-role="caja"].show-cashflow .cashbox-layout > .backup-panel:not(.cashflow-panel) {
  display: none;
}

#cashflowView .cashflow-panel {
  display: block;
}

.inventory-card .fixed-label {
  margin-top: 0;
}

.system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.system-row:last-child {
  border-bottom: 0;
}

.system-row span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.system-row strong {
  color: #fff4d2;
  text-align: right;
}

.client-link {
  max-width: min(520px, 100%);
  margin: 8px 0 0;
  padding: 8px;
  overflow: hidden;
  color: var(--accent);
  background: #0d0c0a;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-card p {
  margin-bottom: 8px;
}

.user-admin-panel {
  grid-column: 1 / -1;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.user-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.user-access-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 0.8fr) minmax(160px, 0.9fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: rgba(24, 20, 16, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-access-row > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.user-access-row > div strong,
.user-access-row > div span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-access-row > div span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.user-active-switch {
  min-height: 54px;
  padding: 0 10px;
  align-items: center;
}

.advanced-panel {
  grid-column: 1 / -1;
}

.advanced-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.advanced-summary p {
  margin: 6px 0 0;
}

.advanced-content {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.backup-panel {
  padding: 18px;
}

.backup-panel p {
  color: var(--muted);
}

.backup-panel .field + .field,
.backup-panel .field + p {
  margin-top: 12px;
}

.stretch {
  align-items: stretch;
  flex-direction: column;
}

.file-picker {
  display: inline-grid;
  place-items: center;
  width: 100%;
  text-align: center;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.order-builder {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

.switch-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}

.order-builder-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-builder-heading h3 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.line-item-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.3fr) 82px 70px 92px 92px 38px;
  gap: 8px;
  align-items: center;
}

.line-item-row input {
  min-height: 38px;
}

.item-total {
  display: grid;
  align-items: center;
  min-height: 38px;
  padding: 0 8px;
  color: var(--accent);
  background: #0d0c0a;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 900;
  text-align: right;
}

dialog {
  width: min(560px, calc(100% - 20px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  margin: 4px 0 0;
  padding: 0;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  color: #15100a;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .app-header,
  .section-heading,
  .top-panel,
  .customer-card {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    position: relative;
    padding-bottom: 12px;
  }

  .app-shell {
    padding: 10px 10px 92px;
  }

  .header-actions,
  .button-row {
    flex-wrap: wrap;
  }

  .header-actions > *,
  .button-row > * {
    flex: 1;
  }

  .header-actions {
    width: 100%;
  }

  .stats-grid,
  .operator-actions,
  .backup-layout,
  .settings-grid,
  .dashboard-grid,
  .cashbox-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabs {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    margin: 0;
    background: rgba(15, 13, 11, 0.9);
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(16px);
  }

  .stop-card {
    grid-template-columns: 34px 1fr;
  }

  .route-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .route-actions > * {
    flex: 1;
  }

  .line-item-row {
    grid-template-columns: 1fr 78px;
  }

  .user-form {
    grid-template-columns: 1fr;
  }

  .user-access-row {
    grid-template-columns: 1fr;
  }

  .quick-sale-grid {
    grid-template-columns: 1fr;
  }

  .product-tile-grid,
  .pastry-quick-panel,
  .bread-quick-panel,
  .amount-sale-box {
    grid-template-columns: 1fr;
  }

  .bread-manual {
    grid-template-columns: 1fr;
  }

  .line-item-row .item-name,
  .line-item-row .item-total {
    grid-column: 1 / -1;
  }

  body[data-role="mostrador"] .app-shell,
  body[data-role="caja"] .app-shell {
    padding: 8px 8px 84px;
  }

  body[data-role="mostrador"] #cashboxView .section-heading,
  body[data-role="caja"] #cashboxView .section-heading {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  body[data-role="mostrador"] #cashboxView .section-heading .button-row,
  body[data-role="caja"] #cashboxView .section-heading .button-row {
    width: auto;
  }

  body[data-role="mostrador"] .bread-primary,
  body[data-role="caja"] .bread-primary {
    min-height: 150px;
  }

  body[data-role="mostrador"] .bread-steps,
  body[data-role="caja"] .bread-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-role="mostrador"] .bread-steps button,
  body[data-role="caja"] .bread-steps button {
    min-height: 76px;
  }

  body[data-role="mostrador"] .ticket-total,
  body[data-role="caja"] .ticket-total {
    min-height: 66px;
    margin-bottom: 10px;
  }

  body[data-role="mostrador"] #saveSaleBtn,
  body[data-role="caja"] #saveSaleBtn {
    min-height: 66px;
    font-size: 1.15rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  .stats-grid,
  .operator-actions,
  .two-cols,
  .backup-layout,
  .settings-grid,
  .dashboard-grid,
  .cashbox-layout {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .dialog-actions span {
    display: none;
  }

  .stats-grid article {
    padding: 12px;
  }

  .stats-grid strong {
    font-size: 1.32rem;
  }

  body[data-role="mostrador"] .app-header,
  body[data-role="caja"] .app-header {
    padding: 10px 12px;
  }

  body[data-role="mostrador"] .brand-title h1,
  body[data-role="caja"] .brand-title h1 {
    font-size: 1.35rem;
  }

  body[data-role="mostrador"] #cashboxView .backup-panel,
  body[data-role="caja"] #cashboxView .backup-panel {
    padding: 12px;
  }

  body[data-role="mostrador"] .bread-primary,
  body[data-role="caja"] .bread-primary {
    min-height: 138px;
    padding: 18px;
  }

  body[data-role="mostrador"] .bread-primary strong,
  body[data-role="caja"] .bread-primary strong {
    font-size: 3.8rem;
  }

  body[data-role="mostrador"] .pastry-quick-panel,
  body[data-role="caja"] .pastry-quick-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-role="mostrador"] .pastry-quick-panel button,
  body[data-role="caja"] .pastry-quick-panel button {
    min-height: 68px;
    padding: 8px;
    font-size: 0.9rem;
  }
}

@media print {
  .app-header,
  .top-panel,
  .tabs,
  .button-row,
  .route-actions,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .view {
    display: none !important;
  }

  #routeView {
    display: block !important;
  }

  .stop-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
