/*
 * Design system canonico de tienda y espacio de trabajo.
 * Las hojas historicas conservan contratos de layout/funcion; esta hoja es la
 * unica fuente final para tokens, superficies, controles y estados visuales.
 */
:root {
  --ds-space-1: .25rem;
  --ds-space-2: .5rem;
  --ds-space-3: .75rem;
  --ds-space-4: 1rem;
  --ds-space-6: 1.5rem;
  --ds-space-8: 2rem;
  --ds-radius-sm: 10px;
  --ds-radius-md: 16px;
  --ds-radius-lg: 20px;
  --ds-shadow-1: 0 1px 3px rgba(15, 23, 42, .045), 0 12px 30px rgba(15, 23, 42, .065);
  --ds-shadow-2: 0 18px 52px rgba(15, 23, 42, .18);
  --ds-border-soft: color-mix(in srgb, var(--line) 78%, #fff);
  --ds-surface-raised: #fff;
  --ds-focus-ring: 0 0 0 3px color-mix(in srgb, var(--color-focus) 24%, transparent);
}

html { scroll-behavior: smooth; }
body { color: var(--color-ink); background: var(--color-canvas); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
button, input, select, textarea { font-family: inherit; }
button { min-height: 44px; border-radius: var(--ds-radius-sm); font-weight: 650; }
:is(button, a, input, select, textarea, summary):focus-visible { outline: 0; box-shadow: var(--ds-focus-ring); }
:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { min-height: 44px; border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-sm); background: var(--ds-surface-raised); color: var(--color-ink); }
:is(input, select, textarea)::placeholder { color: color-mix(in srgb, var(--color-muted) 78%, #fff); }

/* Quiet canvas and predictable white surfaces across every module. */
.panel, .view .panel, .view-controls, .web-chat-panel, .operations-board,
.config-dialog, .admin-form-dialog, .dialog-card,
.cart-panel, .chat-panel, .payment-settings-layout > .panel,
.product-card, .product-card-grid > .product-card,
#promotions > div, #delivery-zones > div, #workstations-list > div,
#staff-list > div, #panel-list > div, #dining-tables-list > article,
#payment-methods > div, #table-overview-list > .table-overview-card,
.operation-order, .stock-card, .inventory-card {
  border-color: var(--ds-border-soft);
  border-radius: var(--ds-radius-md);
  background-color: var(--ds-surface-raised);
  box-shadow: var(--ds-shadow-1);
}
.panel, .view .panel { padding: clamp(1.15rem, 1.8vw, 1.65rem); }
.view .panel.compact { padding: 1rem; }
.view .list > div, .list > div {
  min-width: 0;
  padding: .85rem 1rem;
  overflow-wrap: anywhere;
  border: 1px solid var(--ds-border-soft);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-raised);
}
.view :is(h2, h3, h4), .section-heading h2 { color: var(--color-ink); letter-spacing: -.035em; }
.view > .section-heading { gap: 1.35rem; margin-bottom: 1.65rem; padding-bottom: 1.15rem; }
.view > .section-heading h2 { font-size: clamp(1.8rem, 2.35vw, 2.35rem); font-weight: 760; line-height: 1.08; }
.view > .section-heading p:not(.eyebrow) { max-width: 64ch; color: var(--color-muted); line-height: 1.55; }
.eyebrow { color: var(--color-brand); letter-spacing: .12em; }
.muted, .form-help, .session-user { color: var(--color-muted); }
.view .panel > h3 { margin-bottom: .15rem; font-size: 1.12rem; font-weight: 720; line-height: 1.25; letter-spacing: -.025em; }
.view .panel > p:not(.eyebrow) { line-height: 1.55; }
.view .panel :is(label, legend) { font-weight: 560; }

/* One action grammar; destructive actions remain visibly distinct. */
.primary-button, .add-button, .product-action.add-button, .chat-toggle,
.cart-chip, .quick-add, #mobile-cart-bar {
  background: var(--color-brand);
  color: #fff;
}
.primary-button:hover, .add-button:hover, .product-action.add-button:hover,
.chat-toggle:hover, .cart-chip:hover, .quick-add:hover, #mobile-cart-bar:hover {
  background: var(--color-brand-hover);
}
.secondary-button, .icon-button, .small-button, .text-button,
.product-actions .product-editor summary, .admin-form-trigger {
  border-color: var(--ds-border-soft);
  border-radius: var(--ds-radius-sm);
  background: #fff;
  color: var(--color-ink);
}
.secondary-button:hover, .icon-button:hover, .small-button:hover,
.product-actions .product-editor summary:hover, .admin-form-trigger:hover {
  border-color: color-mix(in srgb, var(--color-brand) 42%, var(--line));
  background: var(--color-brand-soft);
  color: var(--color-brand-hover);
}
.text-button { border: 0; background: transparent; color: var(--color-brand); }
.text-button:hover { background: transparent; color: var(--color-brand-hover); }
.danger-button, .view .danger-button, .view button.danger-button { border-color: var(--color-danger); color: var(--color-danger); }
.danger-button:hover, .view .danger-button:hover { background: var(--color-danger-soft); }
.status-pill, .employee-status, .product-status { border-radius: 999px; }
.product-status.is-active, .status-success, .employee-status[data-state="active"] { color: var(--color-success); background: var(--color-success-soft); }
.product-status.is-inactive { color: var(--color-danger); background: var(--color-danger-soft); }

/* Storefront: image-led cards, compact filters and an always-reachable order. */
.store-header {
  min-height: 76px;
  border-bottom: 1px solid var(--ds-border-soft);
  background: color-mix(in srgb, var(--color-canvas) 92%, #fff);
  box-shadow: 0 4px 18px rgba(15, 23, 42, .06);
  backdrop-filter: blur(16px);
}
.brand-mark strong { font-family: inherit; font-size: 1.35rem; font-weight: 760; letter-spacing: -.04em; }
.brand-mark span { color: var(--color-muted); font-size: .64rem; letter-spacing: .13em; }
.store-navigation { gap: .55rem; }
.store-navigation .text-button { padding-inline: .7rem; white-space: nowrap; }
.cart-chip { border: 0; border-radius: 999px; box-shadow: 0 6px 18px color-mix(in srgb, var(--color-brand) 20%, transparent); }
.cart-chip b { background: var(--color-warm); color: #fff; }
main { max-width: 1440px; }
.hero { max-width: 780px; }
.hero h1 { max-width: 12ch; font-size: clamp(2.5rem, 5.6vw, 5.2rem); line-height: .98; letter-spacing: -.065em; }
.hero h1 em { color: var(--color-warm); }
.hero-copy { max-width: 54ch; color: var(--color-muted); line-height: 1.65; }
.catalog-filters { background: color-mix(in srgb, var(--color-canvas) 94%, #fff); border-color: var(--ds-border-soft); }
.category-tabs button { border-color: var(--ds-border-soft); border-radius: 999px; background: #fff; color: var(--color-ink); }
.category-tabs button.active { border-color: var(--color-brand); background: var(--color-brand); color: #fff; }
.product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.15rem; }
.product-card { overflow: hidden; transition: transform var(--motion-standard) ease, box-shadow var(--motion-standard) ease, border-color var(--motion-standard) ease; }
.product-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--color-brand) 30%, var(--line)); box-shadow: 0 14px 34px rgba(15, 23, 42, .12); }
.product-picture { min-height: 0; aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--color-brand-soft), #f3eee8); }
.product-picture img { width: 100%; height: 100%; object-fit: cover; }
.product-info { gap: .4rem; padding: 1rem 1rem .55rem; }
.product-info h3 { font-size: 1.08rem; line-height: 1.3; letter-spacing: -.025em; }
.product-info p:not(.eyebrow) { min-height: 2.8em; color: var(--color-muted); line-height: 1.45; }
.product-purchase { align-items: center; padding: .55rem 1rem 1rem; }
.product-purchase .price { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.product-action.add-button { min-height: 44px; border-radius: var(--ds-radius-sm); }
.cart-panel { border-radius: var(--ds-radius-lg) 0 0 var(--ds-radius-lg); }
.cart-head, .chat-head { border-color: var(--ds-border-soft); }
.cart-line { padding-block: .85rem; }
.cart-footer { padding-top: 1rem; }
.total-row strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.dialog-card, .admin-form-dialog { border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-2); }
.category-icon { font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-weight: 750; }
.dialog-image { border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0; }
.option-label, .choice-card, .payment-choice { border-color: var(--ds-border-soft); border-radius: var(--ds-radius-sm); background: #fff; }
.option-label:has(input:checked), .choice-card.selected, .mode-picker button.selected { border-color: var(--color-brand); background: var(--color-brand-soft); }
.fulfillment-summary, #customer-summary, .cart-table-actions { border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-sm); background: #f8fafc; }
.checkout-summary { padding: 1rem; border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-md); background: #fff; box-shadow: var(--ds-shadow-1); }
.payment-preview { border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-sm); background: #fff; }
.waiter-table-card { border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-md); background: #fff; box-shadow: var(--ds-shadow-1); transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease; }
.waiter-table-card:hover, .waiter-table-card.selected { border-color: color-mix(in srgb, var(--color-brand) 40%, var(--line)); background: color-mix(in srgb, var(--color-canvas) 72%, #fff); box-shadow: var(--ds-shadow-1); }
.waiter-table-card.has-request { border-color: color-mix(in srgb, var(--color-warm) 55%, var(--line)); background: var(--color-warm-soft); }
.waiter-table-alert { border-radius: 999px; background: var(--color-warm); color: #fff; }
#payment-alert, #checkout-availability:not(:empty) { border: 1px solid color-mix(in srgb, var(--color-warning) 25%, var(--line)); border-left: 3px solid var(--color-warning); border-radius: var(--ds-radius-sm); background: var(--color-warning-soft); color: var(--color-ink); }
.saved-order { margin-block: .5rem; padding: 1rem; border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-md); background: #fff; }
.role-picker, .view fieldset { border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-sm); }
.table-qr-summary { border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-sm); background: #f8fafc; }
.message-alert { border: 1px solid color-mix(in srgb, var(--color-warm) 45%, var(--line)); border-left: 4px solid var(--color-warm); border-radius: var(--ds-radius-sm); background: var(--color-warm-soft); color: var(--color-ink); }
.notice, .cart-feedback, #payment-toast { border-radius: var(--ds-radius-sm); box-shadow: var(--ds-shadow-1); }
.notice[data-kind="success"], .form-feedback[data-kind="success"] { border-color: color-mix(in srgb, var(--color-success) 28%, var(--line)); background: var(--color-success-soft); color: var(--color-success); }
.notice[data-kind="error"], .form-feedback[data-kind="error"], .field-error { color: var(--color-danger); }

/* Back office: consistent cards in catalog, orders, finance, people and roles. */
.topbar {
  background: #17263b;
  border-radius: 0 0 var(--ds-radius-md) var(--ds-radius-md);
  box-shadow: 0 8px 28px rgba(15, 23, 42, .13);
}
.topbar-logo { box-shadow: 0 3px 12px rgba(0, 0, 0, .16); }
.topbar .button-row :is(.secondary-button, .icon-button) {
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.08);
  color: #fff;
}
.topbar .button-row :is(.secondary-button, .icon-button):hover {
  border-color: rgba(255,255,255,.68);
  background: rgba(255,255,255,.16);
  color: #fff;
}
.topbar::after { background: var(--color-brand); }
.workspace-nav { border-color: var(--ds-border-soft); border-radius: var(--ds-radius-md); background: linear-gradient(155deg, #fff 68%, color-mix(in srgb, var(--color-brand-soft) 48%, #fff)); box-shadow: var(--ds-shadow-1); }
.workspace-nav .tab { min-height: 44px; border-radius: var(--ds-radius-sm); color: #344256; }
.workspace-nav .tab.active, .workspace-nav .tab[aria-current="page"] { background: var(--color-brand-soft); color: var(--color-brand-hover); box-shadow: inset 3px 0 0 var(--color-brand); }
.workspace-nav .tab:not(.active):hover { background: color-mix(in srgb, var(--color-brand-soft) 55%, #fff); }
#attention-center { align-items: center; justify-content: flex-start; padding: 0; border: 0; background: transparent; box-shadow: none; }
#attention-center .attention-action { min-height: 44px; border-color: var(--ds-border-soft); border-radius: var(--ds-radius-sm); background: #fff; box-shadow: var(--ds-shadow-1); color: var(--color-ink); }
#attention-center .attention-action:hover { background: var(--color-brand-soft); }
.view .list > div { border-left: 1px solid var(--ds-border-soft); }
.view .conversation-entry { display: grid; gap: .45rem; cursor: pointer; box-shadow: none; }
.view .conversation-entry:hover { border-color: color-mix(in srgb, var(--color-brand) 36%, var(--line)); background: #fff !important; box-shadow: var(--ds-shadow-1); }
.view .conversation-entry.selected { border-color: color-mix(in srgb, var(--color-brand) 46%, var(--line)); background: #fff; box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-brand) 12%, transparent); outline: 0; }
.view .conversation-entry .attention-count { display: inline-flex; width: max-content; max-width: 100%; padding: .22rem .55rem; border-radius: 999px; background: var(--color-danger); color: #fff; font-size: .74rem; line-height: 1.3; }
.product-card-grid > .product-card, #promotions > div, #delivery-zones > div,
#workstations-list > div, #staff-list > div, #panel-list > div,
#dining-tables-list > article, #payment-methods > div,
#table-overview-list > .table-overview-card, .operation-order, .stock-card {
  min-width: 0;
  border: 1px solid var(--ds-border-soft);
  border-radius: var(--ds-radius-md);
  background: #fff;
  box-shadow: var(--ds-shadow-1);
}
.view .config-group, .view details.config-group { border-left: 1px solid var(--ds-border-soft); }
.config-card-trigger, .view .config-group { border-color: var(--ds-border-soft); border-radius: var(--ds-radius-md); box-shadow: var(--ds-shadow-1); }
.config-card-trigger { min-height: 4.4rem; border: 1px solid var(--ds-border-soft); background: #fff; transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, transform var(--motion-fast) ease; }
.config-card-trigger:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--color-brand) 35%, var(--line)); background: #fff; box-shadow: 0 12px 26px rgba(15,23,42,.09); }
.config-group > summary { min-height: 3.75rem; }
.config-group[open] > summary { background: color-mix(in srgb, var(--color-canvas) 65%, #fff); }
.brand-structure, #overview #structure > .brand-structure { border: 1px solid var(--ds-border-soft); border-radius: var(--ds-radius-md); background: #fff; }
.brand-structure > div, #overview #structure > .brand-structure > * { border: 0; border-radius: var(--ds-radius-sm); background: color-mix(in srgb, var(--color-canvas) 58%, #fff); }
.conversation-toolbar { gap: .85rem; background: #fff; }
.test-messages { background: var(--color-canvas); }
.test-message { border: 1px solid var(--ds-border-soft); border-radius: 14px; background: #edf4f2; }
.test-message.customer { background: var(--color-success-soft); }
.testing-grid { gap: 1.15rem; }
.testing-grid > .panel { min-height: 7.5rem; }
.testing-grid > .panel > h3 { padding-bottom: .2rem; }
.status-pill { min-height: 1.65rem; padding-inline: .65rem; font-size: .76rem; font-weight: 700; }
.palette-settings-grid { border-color: var(--ds-border-soft); border-radius: var(--ds-radius-md); background: var(--color-canvas); }
.view .config-card-trigger strong { font-size: 1rem; letter-spacing: -.015em; }

@media (min-width: 1200px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1199px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view > .section-heading { align-items: flex-start; }
}
@media (max-width: 700px) {
  .store-header { min-height: 68px; }
  .store-navigation { gap: .25rem; }
  .store-navigation .text-button { padding-inline: .4rem; font-size: .82rem; }
  .hero h1 { font-size: clamp(2.35rem, 10vw, 3.5rem); }
  .product-grid { gap: .7rem; }
  .product-info { padding: .7rem .7rem .35rem; }
  .product-info h3 { font-size: .98rem; }
  .product-info p:not(.eyebrow) { min-height: 0; font-size: .78rem; }
  .product-purchase { align-items: stretch; flex-direction: column; gap: .45rem; padding: .4rem .7rem .7rem; }
  .product-purchase .price { font-size: .92rem; }
  .product-action.add-button { width: 100%; }
  .cart-panel { border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0; }
  .view > .section-heading { flex-direction: column; align-items: stretch; }
  .view > .section-heading > label { width: 100%; }
}

/* Every staff dialog opens centered in the viewport with one consistent
   surface and usable scrolling, regardless of which legacy form created it. */
dialog[open]:not(.waiter-order-dialog) {
  position: fixed;
  inset: 50% auto auto 50%;
  width: min(720px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: min(90dvh, 780px);
  margin: 0;
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid var(--ds-card-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--ds-shadow-2);
  animation: ds-dialog-enter 180ms cubic-bezier(.2,.75,.25,1) both;
}
@keyframes ds-dialog-enter { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(.99); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
dialog[open]:not(.waiter-order-dialog)::backdrop { background: rgba(15, 23, 42, .48); backdrop-filter: blur(5px); }
dialog.table-qr-dialog[open] { width: min(92vw, 28rem); }
dialog.waiter-attention-dialog[open] { width: min(560px, calc(100vw - 1.5rem)); }
dialog#waiter-payment-qr-dialog[open] { width: min(520px, calc(100vw - 2rem)); }
.admin-form-dialog { padding: clamp(1rem, 3vw, 1.5rem); }
.admin-form-dialog.config-dialog { padding: 0; overflow-x: clip; }
dialog.admin-form-dialog.config-dialog[open] { overflow-x: hidden; }
.admin-form-dialog.config-dialog > form { width: 100%; min-width: 0; padding: clamp(1rem, 3vw, 1.5rem); }
.admin-form-dialog.config-dialog :is(.profile-grid, .section-heading, label, input, select, textarea) { min-width: 0; }
.admin-form-dialog .dialog-close { position: sticky; top: 0; z-index: 2; float: right; margin: -.25rem -.25rem .25rem .5rem; }
@media (max-width: 420px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-picture { aspect-ratio: 16 / 10; }
  .store-navigation button { min-height: 42px; }
  .store-navigation .cart-chip { padding-inline: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .product-card:hover { transform: none; }
}

/* Canonical surfaces. These rules intentionally replace the legacy green
   left rails and tinted per-module cards while leaving layout/behavior in
   the original component sheets. */
:root {
  --ds-card-border: color-mix(in srgb, var(--color-border) 82%, #fff);
  --ds-card-shadow: 0 1px 3px rgba(15, 23, 42, .045), 0 12px 30px rgba(15, 23, 42, .065);
  --ds-card-hover: 0 14px 34px rgba(15, 23, 42, .11);
}

html { background: var(--color-canvas); }
body { background: var(--color-canvas); color: var(--color-ink); }
#workspace, #workspace > .view, #workspace > .view > *, #workspace .view .panel,
#workspace .view .profile-grid > *, #workspace .view .columns > * { min-width: 0; }
#workspace .view img { display: block; max-width: 100%; height: auto; }
#workspace .view #logo-preview:not([hidden]) { max-height: 240px; object-fit: contain; object-position: left center; }

/* Sidebar surface and item styling; responsive placement belongs to
   admin-layout.css so visual overrides cannot silently change navigation. */
.workspace-nav {
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-md);
  background: linear-gradient(155deg, #fff 68%, color-mix(in srgb, var(--color-brand-soft) 48%, #fff));
  box-shadow: var(--ds-card-shadow);
}
@media (max-width: 900px) {
  .topbar { min-height: 76px; }
  #workspace { grid-template-columns: minmax(176px, 218px) minmax(0, 1fr); column-gap: .85rem; }
  #workspace > .workspace-nav { top: 120px; max-height: calc(100dvh - 132px); }
  #workspace > #attention-center, #workspace > .view { grid-column: 2; }
  #workspace > #attention-center { grid-row: 1; }
  #workspace > .view { grid-row: 2; }
}
@media (max-width: 600px) {
  #workspace { grid-template-columns: minmax(142px, 38vw) minmax(0, 1fr); column-gap: .55rem; }
  #workspace > .workspace-nav { top: 104px; max-height: calc(100dvh - 116px); }
}
.workspace-nav .nav-group { gap: .2rem; }
.workspace-nav .nav-group + .nav-group { margin-top: .55rem; padding-top: .8rem; border-top: 1px solid var(--ds-card-border); }
.workspace-nav .nav-group-label { padding: .2rem .7rem .35rem; color: var(--color-muted); font-size: .66rem; letter-spacing: .11em; }
.workspace-nav .tab, .workspace-nav > .tab {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #344256;
  font-weight: 600;
}
.workspace-nav .tab.active, .workspace-nav .tab[aria-current="page"] {
  border-color: color-mix(in srgb, var(--color-brand) 18%, #fff);
  background: var(--color-brand-soft);
  color: var(--color-brand-hover);
  box-shadow: inset 3px 0 var(--color-brand);
}
.workspace-nav .tab:not(.active):hover { border-color: color-mix(in srgb, var(--color-brand) 24%, var(--ds-card-border)); background: color-mix(in srgb, var(--color-brand-soft) 50%, #fff); color: var(--color-brand-hover); transform: translateX(2px); }

/* One card grammar for every administration view, including cards emitted at
   runtime by catalog, inventory, payments, conversations and access control. */
#workspace .view :is(.panel, .config-group, .view-controls, .operations-board,
  .web-chat-panel, .conversation-toolbar, .table-overview-panel,
  .product-card-grid > .product-card, .operation-order, .stock-card,
  .inventory-card, .waiter-table-card, .table-overview-card,
  #promotions > div, #delivery-zones > div, #workstations-list > div,
  #staff-list > div, #panel-list > div, #dining-tables-list > article,
  #payment-methods > div) {
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-md);
  background: #fff;
  box-shadow: var(--ds-card-shadow);
}
#workspace .view .panel { padding: clamp(1.15rem, 1.8vw, 1.65rem); }
#workspace .view .panel.compact { padding: clamp(1rem, 1.45vw, 1.3rem); }
#workspace .view .list > div {
  border: 1px solid var(--ds-card-border);
  border-left: 1px solid var(--ds-card-border);
  border-radius: 11px;
  background: #fff;
  box-shadow: none;
}
#workspace .view :is(.brand-structure, #structure > .brand-structure) { border: 1px solid var(--ds-card-border); border-radius: var(--ds-radius-md); background: #fff; }
#workspace .view :is(.brand-structure > *, #structure > .brand-structure > *) { border: 0; border-radius: 11px; background: #f8fafc; }
#workspace .view .operation-order > .list > div:first-child,
#workspace .view :is(.stock-card, .inventory-card) { background: #fff; }
#workspace .view :is(.waiter-table-card.has-request, .message-alert) { border-color: color-mix(in srgb, var(--color-warning) 38%, #fff); background: var(--color-warning-soft); }
#workspace .view .conversation-entry { border-left: 1px solid var(--ds-card-border); }
#workspace .view .conversation-entry.selected { border-color: color-mix(in srgb, var(--color-brand) 48%, #fff); background: #fff; }
#workspace .view .config-group { overflow: clip; }
#workspace .view .config-group > summary { min-height: 3.75rem; background: #fff; }
#workspace .view .config-group[open] > summary { border-bottom: 1px solid var(--ds-card-border); background: #f8fafc; }
#workspace .view .config-group > form.panel, #workspace .view .config-group > .panel { border: 0; border-radius: 0; box-shadow: none; }
#workspace .view > .section-heading { gap: 1.35rem; margin-bottom: 1.65rem; padding-bottom: 1.15rem; border-bottom-color: var(--ds-card-border); scroll-margin-top: 7.5rem; }
#workspace .view > .section-heading h2 { font-size: clamp(1.8rem, 2.35vw, 2.35rem); font-weight: 760; line-height: 1.08; }
#workspace .view :is(.panel h2, .panel h3, .config-group > summary) { color: var(--color-ink); }
#workspace .view .panel > h3 { margin-bottom: .15rem; font-size: 1.12rem; font-weight: 720; line-height: 1.25; letter-spacing: -.025em; }
#workspace .view :is(.form-help, .muted, .panel p:not(.eyebrow)) { color: var(--color-muted); }
#workspace .view :is(.columns, .catalog-columns, .commerce-grid, .catalog-tools, .testing-grid, .product-card-grid) { gap: clamp(1rem, 1.4vw, 1.35rem); }
#workspace .view .config-card-trigger { min-height: 4.4rem; transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, transform var(--motion-fast) ease; }
#workspace .view .config-card-trigger:hover { transform: translateY(-2px); box-shadow: var(--ds-card-hover); }
#workspace .view .config-group[open] > :not(summary) { animation: ds-section-enter 180ms ease-out both; }
@keyframes ds-section-enter { from { opacity: .45; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* The storefront uses the same surfaces, typography, controls and status
   colors; photography and the configured brand palette provide personality. */
.store-header { border-bottom: 1px solid var(--ds-card-border); background: rgba(255,255,255,.94); box-shadow: 0 4px 20px rgba(15,23,42,.055); }
.brand-mark strong, .hero h1, .product-info h3, .cart-head h2 { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.hero h1 { font-weight: 760; }
.hero h1 em { font-style: normal; color: var(--color-brand); }
#product-grid .product-card, .product-grid .product-card {
  overflow: hidden;
  border: 1px solid var(--ds-card-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--ds-card-shadow);
}
#product-grid .product-card:hover, .product-grid .product-card:hover { border-color: color-mix(in srgb, var(--color-brand) 30%, #fff); box-shadow: var(--ds-card-hover); }
.product-open, .product-open:hover { background: #fff; color: var(--color-ink); }
.product-picture { background: #f1f5f9; }
.product-info h3 { color: var(--color-ink); font-weight: 700; }
.product-info p:not(.eyebrow) { color: var(--color-muted); }
.product-action.add-button, .quick-add, #mobile-cart-bar { border-radius: 10px; box-shadow: none; }
.cart-chip { border-radius: 11px; }
.cart-panel, .chat-panel, .dialog-card {
  border: 1px solid var(--ds-card-border);
  background: #fff;
  box-shadow: var(--ds-shadow-2);
}
.cart-panel { border-radius: 20px 0 0 20px; }
.dialog-card { border-radius: 18px; }
.saved-order { border-bottom-color: var(--ds-card-border); }
.fulfillment-summary, #customer-summary, .cart-table-actions, .table-qr-summary {
  border: 1px solid var(--ds-card-border);
  border-radius: 12px;
  background: #f8fafc;
}
.message-alert, #payment-alert, #checkout-availability:not(:empty) {
  border: 1px solid color-mix(in srgb, var(--color-warning) 38%, #fff);
  border-left: 3px solid var(--color-warning);
  border-radius: 12px;
  background: var(--color-warning-soft);
}

@media (max-width: 900px) {
  #workspace .workspace-nav .nav-group { display: grid; }
  #workspace .workspace-nav .nav-group-label { display: block; }
  #workspace .workspace-nav .tab { width: 100%; min-width: 0; white-space: normal; }
}
@media (max-width: 700px) {
  .cart-panel { border-radius: 20px 20px 0 0; }
  .store-header { background: rgba(255,255,255,.97); }
  #workspace .view .panel { padding: .9rem; }
}

/* Resumen: acciones, identidad de marca y configuración forman una portada
   de trabajo; la paleta activa aporta identidad sin competir con el contenido. */
#overview > .section-heading { margin-bottom: 1.35rem; }
#overview > .section-heading h2 { font-size: clamp(2rem, 3vw, 2.65rem); letter-spacing: -.055em; }
#overview > .section-heading p:not(.eyebrow) { margin-top: .55rem; color: var(--color-muted); font-size: 1rem; }
#overview > .columns { gap: .9rem; }
#overview > .columns > .admin-form-trigger {
  display: flex; align-items: center; justify-content: flex-start; gap: .8rem; min-height: 4.1rem;
  padding: .8rem 1rem; border: 1px solid color-mix(in srgb, var(--color-brand) 25%, #fff);
  border-radius: 14px; background: #fff; color: var(--color-brand-hover); box-shadow: var(--ds-card-shadow);
  font-size: .94rem; font-weight: 720; text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
}
#overview > .columns > .admin-form-trigger::before {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; flex: 0 0 1.8rem;
  border-radius: 9px; background: var(--color-brand-soft); color: var(--color-brand); content: '+'; font-size: 1.2rem; font-weight: 500;
}
#overview > .columns > .admin-form-trigger:nth-of-type(2) { border-color: var(--color-brand); background: var(--color-brand); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--color-brand) 24%, transparent); }
#overview > .columns > .admin-form-trigger:nth-of-type(2)::before { background: rgba(255,255,255,.16); color: #fff; }
#overview > .columns > .admin-form-trigger:hover { transform: translateY(-2px); border-color: var(--color-brand); box-shadow: var(--ds-card-hover); }
#overview > .columns > .admin-form-trigger:nth-of-type(2):hover { background: var(--color-brand-hover); }
#overview > .columns > .admin-form-trigger:active { transform: translateY(0) scale(.99); }
#overview > .columns > .panel { position: relative; overflow: hidden; padding: clamp(1.2rem, 2vw, 1.7rem); border-radius: 18px; background: linear-gradient(135deg, #fff 64%, color-mix(in srgb, var(--color-brand-soft) 70%, #fff)); }
#overview > .columns > .panel::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--color-brand); content: ''; }
#overview > .columns > .panel > h3 { margin-bottom: .8rem; font-size: 1.22rem; }
#overview #structure { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: .9rem; }
#overview #structure > .brand-structure {
  grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); align-items: stretch; gap: .75rem; padding: .55rem;
  border-color: color-mix(in srgb, var(--color-brand) 23%, var(--ds-card-border)); border-radius: 15px;
  background: rgba(255,255,255,.74); box-shadow: 0 4px 14px rgba(15,23,42,.035);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
#overview #structure > .brand-structure:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--color-brand) 42%, #fff); box-shadow: var(--ds-card-hover); }
#overview #structure .brand-identity { display: flex; align-items: center; gap: .8rem; min-width: 0; padding: .9rem; border-radius: 11px; background: color-mix(in srgb, var(--color-brand-soft) 75%, #fff); }
#overview #structure .brand-identity-logo, #overview #structure .brand-identity-monogram { display: grid; place-items: center; width: 3rem; height: 3rem; flex: 0 0 3rem; border-radius: 11px; }
#overview #structure .brand-identity-logo { border: 1px solid color-mix(in srgb, var(--color-brand) 14%, #fff); background: #fff; object-fit: contain; padding: .25rem; }
#overview #structure .brand-identity-monogram { background: var(--color-brand); color: #fff; font-size: .92rem; font-weight: 800; letter-spacing: -.04em; }
#overview #structure .brand-identity-copy { min-width: 0; padding: 0; background: transparent; }
#overview #structure .brand-identity-copy strong { font-size: 1rem; line-height: 1.25; }
#overview #structure .brand-identity-copy span { margin-top: .28rem; font-size: .76rem; }
#overview #structure .location-list { align-content: center; gap: .5rem; }
#overview #structure .location-entry { display: grid; align-content: center; min-height: 100%; padding: .9rem 1rem; border: 0; border-left: 2px solid color-mix(in srgb, var(--color-brand) 40%, #fff); border-radius: 0 10px 10px 0; background: #fff; }
#overview #structure .location-entry strong { font-size: .98rem; }
#overview #structure .location-entry span { margin-top: .35rem; line-height: 1.45; }
#overview .config-card-trigger { position: relative; min-height: 5.25rem; gap: .9rem; padding: .9rem 1rem; border-radius: 15px; text-align: left; transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
#overview .config-card-trigger:hover, #overview .config-card-trigger:focus-visible { transform: translateY(-3px); border-color: color-mix(in srgb, var(--color-brand) 43%, #fff); background: color-mix(in srgb, var(--color-brand-soft) 38%, #fff); box-shadow: var(--ds-card-hover); }
#overview .config-card-icon { width: 2rem; height: 2rem; flex-basis: 2rem; border-color: color-mix(in srgb, var(--color-brand) 18%, #fff); background: var(--color-brand-soft); color: var(--color-brand); font-size: 1.2rem; transition: transform 180ms ease, background-color 180ms ease; }
#overview .config-card-trigger:hover .config-card-icon { transform: rotate(90deg); background: var(--color-brand); color: #fff; }
#overview .config-card-copy { display: grid; gap: .2rem; min-width: 0; }
#overview .config-card-copy strong { font-size: 1rem; }
#overview .config-card-copy small { color: var(--color-muted); font-size: .76rem; font-weight: 450; line-height: 1.35; }
#overview .config-card-arrow { margin-left: auto; color: var(--color-brand); font-size: 1.1rem; transition: transform 180ms ease; }
#overview .config-card-trigger:hover .config-card-arrow { transform: translate(2px, -2px); }
@media (max-width: 700px) {
  #overview > .columns { grid-template-columns: 1fr; }
  #overview > .columns > .panel { grid-column: auto; }
  #overview #structure > .brand-structure { grid-template-columns: minmax(0, 1fr); }
  #overview #structure .location-entry { min-height: 0; }
  #overview > .section-heading h2 { font-size: clamp(1.8rem, 7vw, 2.2rem); }
}
@media (prefers-reduced-motion: reduce) {
  #overview > .columns > .admin-form-trigger, #overview #structure > .brand-structure, #overview .config-card-trigger, #overview .config-card-icon, #overview .config-card-arrow { transition: none; }
  #overview > .columns > .admin-form-trigger:hover, #overview #structure > .brand-structure:hover, #overview .config-card-trigger:hover { transform: none; }
}

/* Contrato compartido del back office: cada módulo hereda la misma identidad,
   jerarquía, relieve, foco y respuesta al interactuar. */
.topbar {
  background: linear-gradient(112deg, color-mix(in srgb, var(--color-brand) 42%, #14243a) 0%, color-mix(in srgb, var(--color-brand) 34%, #182a43) 72%, color-mix(in srgb, var(--color-brand) 52%, #182a43) 100%);
  box-shadow: 0 10px 32px rgba(15,23,42,.16);
}
.topbar-logo { border: 2px solid rgba(255,255,255,.82); border-radius: 14px; background: #fff; object-fit: contain; }
.topbar .eyebrow { color: color-mix(in srgb, var(--color-brand-soft) 72%, #fff); }
.topbar::after { height: 4px; box-shadow: 0 0 16px color-mix(in srgb, var(--color-brand) 45%, transparent); }
.workspace-nav { backdrop-filter: blur(14px); }
.workspace-nav .tab.active, .workspace-nav .tab[aria-current="page"] { border-color: color-mix(in srgb, var(--color-brand) 24%, #fff); background: color-mix(in srgb, var(--color-brand-soft) 78%, #fff); box-shadow: inset 3px 0 var(--color-brand), 0 4px 12px color-mix(in srgb, var(--color-brand) 9%, transparent); }
#workspace .view > .section-heading { align-items: flex-end; }
#workspace .view > .section-heading .eyebrow { margin-bottom: .45rem; font-size: .69rem; font-weight: 780; }
#workspace .view > .section-heading h2 { font-size: clamp(1.9rem, 2.7vw, 2.55rem); font-weight: 780; letter-spacing: -.055em; }
#workspace .view > .section-heading p:not(.eyebrow) { max-width: 66ch; margin-top: .5rem; font-size: .98rem; line-height: 1.55; }
#workspace .view :is(.panel, .view-controls, .operations-board, .web-chat-panel, .payment-settings-layout > .panel, .config-group) {
  border-color: color-mix(in srgb, var(--color-border) 80%, #fff);
  border-radius: 18px;
  box-shadow: 0 2px 5px rgba(15,23,42,.035), 0 14px 34px rgba(15,23,42,.065);
}
#workspace .view { container-name: backoffice-view; container-type: inline-size; }
#workspace .view .panel { padding: clamp(1.15rem, 1.8vw, 1.7rem); }
#workspace .view .panel.compact { padding: clamp(1rem, 1.5vw, 1.35rem); }
#workspace .view :is(.panel h2, .panel h3, .panel h4) { letter-spacing: -.035em; }
#workspace .view .panel > h3 { margin-bottom: .35rem; font-size: 1.16rem; font-weight: 750; }
#workspace .view :is(.view-controls, .operations-toolbar, .catalog-tools, .team-toolbar) { gap: .85rem; padding: 1rem; background: color-mix(in srgb, var(--color-canvas) 72%, #fff); }
#workspace .view .list > div {
  padding: .95rem 1rem;
  border: 1px solid var(--ds-card-border);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,.035);
  transition: border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease, background-color 170ms ease;
}
#workspace .view :is(.list > div, .product-card-grid > .product-card, #promotions > div, #delivery-zones > div, #workstations-list > div, #staff-list > div, #panel-list > div, #dining-tables-list > article, #payment-methods > div) strong { letter-spacing: -.02em; }
#workspace .view :is(.conversation-entry, .product-card[role="button"], .table-overview-card, .waiter-table-card, #staff-list > div, #panel-list > div) {
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background-color 180ms ease;
}
#workspace .view :is(.conversation-entry, .product-card[role="button"], .table-overview-card, .waiter-table-card, #staff-list > div, #panel-list > div):hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--color-brand) 38%, #fff);
  box-shadow: 0 12px 28px rgba(15,23,42,.095);
}
#workspace .view :is(.conversation-entry, .product-card[role="button"], .table-overview-card, .waiter-table-card, #staff-list > div, #panel-list > div):focus-visible,
#workspace .view :is(.panel, .operation-order, .payment-settings-layout > .panel):focus-within { outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 18%, transparent), var(--ds-card-shadow); }
#workspace .view :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-color: color-mix(in srgb, var(--color-border) 88%, #fff);
  border-radius: 11px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
#workspace .view :is(input, select, textarea):focus-visible { border-color: var(--color-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 17%, transparent); }
#workspace .view input[type="checkbox"], #workspace .view input[type="radio"] { accent-color: var(--color-brand); }
#workspace .view button, .admin-form-dialog button {
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
#workspace .view button:not(:disabled):not(.text-button):not(.danger-button):hover,
.admin-form-dialog button:not(:disabled):not(.text-button):not(.danger-button):hover { transform: translateY(-1px); }
#workspace .view button:not(:disabled):active, .admin-form-dialog button:not(:disabled):active { transform: translateY(0) scale(.985); }
#workspace .view button[type="submit"]:not(.secondary-button):not(.small-button):not(.danger-button),
#workspace .view form > button:not([type]):not(.secondary-button):not(.small-button):not(.danger-button) {
  border-color: var(--color-brand);
  border-radius: 11px;
  background: linear-gradient(145deg, var(--color-brand), var(--color-brand-hover));
  color: #fff;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--color-brand) 19%, transparent);
}
#workspace .view button[type="submit"]:not(:disabled):not(.secondary-button):not(.small-button):hover,
#workspace .view form > button:not([type]):not(:disabled):not(.secondary-button):not(.small-button):hover { box-shadow: 0 9px 20px color-mix(in srgb, var(--color-brand) 25%, transparent); }
#attention-center .attention-action { transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease; }
#attention-center .attention-action:hover { transform: translateY(-2px); box-shadow: var(--ds-card-hover); }
dialog[open]:not(.waiter-order-dialog) { border-radius: 20px; }
dialog[open]:not(.waiter-order-dialog)::backdrop { animation: ds-backdrop-enter 180ms ease-out both; }
@keyframes ds-backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@container backoffice-view (max-width: 680px) {
  #workspace .view .web-chat-panel .chat-layout { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(160px, 30%) minmax(300px,1fr); height: min(72vh,760px); min-height: 460px; }
  #workspace .view .payment-settings-layout:has(#payment-editor-panel:not([hidden])) { grid-template-columns: minmax(0,1fr); }
  #workspace .view .payment-settings-layout .panel:has(#payment-method-form) { position: static; }
  #workspace .view .payment-settings-layout #payment-method-form { max-height: none; }
  #workspace .view :is(.catalog-tools, .testing-grid, .commerce-grid) { grid-template-columns: minmax(0,1fr); }
  #workspace .view > .section-heading { align-items: stretch; flex-direction: column; }
  #workspace .view > .section-heading .inline-fields { justify-content: flex-start; }
  #workspace .view .view-controls > label { width: 100%; flex-basis: auto; }
}
@media (prefers-reduced-motion: reduce) {
  #workspace .view *, #workspace .view *::before, #workspace .view *::after, .topbar, .workspace-nav *, #attention-center *, dialog[open] { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
  #workspace .view :is(.conversation-entry, .product-card[role="button"], .table-overview-card, .waiter-table-card, #staff-list > div, #panel-list > div):hover,
  #workspace .view button:hover, .admin-form-dialog button:hover { transform: none; }
}

/* Dialogs must scroll even when nested in a configuration view. */
#workspace .view dialog.admin-form-dialog[open], dialog.staff-editor[open] {
  overflow-y: auto; overflow-x: hidden; max-height: calc(100dvh - 2rem); overscroll-behavior: contain;
}
body:has(dialog[open]) { overflow: hidden; }
.admin-form-dialog .role-picker[hidden], .admin-form-dialog label[hidden] { display: none; }
.admin-form-dialog .admin-profile-help { padding: .85rem; border-radius: .7rem; background: var(--soft, #eef6f4); }
.admin-form-dialog > form.panel { border: 0; box-shadow: none; padding: .5rem; }



#password-recovery-dialog > h3, #password-dialog > h3 { margin: .4rem 3rem .8rem 0; font-size: 1.35rem; }
#password-recovery-dialog > p, #owner-recovery-help { margin: .8rem 0 1rem; line-height: 1.55; }
#password-recovery-dialog form[hidden] { display: none; }
