:root {
  --cream: #fff8f1;
  --cream-deep: #f9eee4;
  --white: #fffdfb;
  --strawberry: #eaa6b8;
  --strawberry-deep: #cf7890;
  --peach: #f5c5a6;
  --butter: #f4dc9f;
  --sage: #afc9b1;
  --sage-deep: #6f9875;
  --terracotta: #d9836c;
  --terracotta-deep: #bb6653;
  --cocoa: #453633;
  --muted: #7b6d69;
  --line: #ebddd4;
  --danger: #b95858;
  --shadow: 0 14px 40px rgba(95, 66, 55, .10);
  --shadow-soft: 0 8px 22px rgba(95, 66, 55, .08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--cocoa);
  background: var(--cream);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; }

.public-shell, .admin-shell { width: min(100% - 28px, 1180px); margin-inline: auto; }
.admin-shell { max-width: 860px; }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.75rem, 7vw, 2.55rem); line-height: 1.05; letter-spacing: -.035em; margin-bottom: 10px; }
h2 { font-size: 1.15rem; line-height: 1.2; margin-bottom: 8px; }
small { color: var(--muted); }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 800; color: var(--terracotta-deep); }

.primary-button, .secondary-button, .ghost-button {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 0 20px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--terracotta), var(--strawberry-deep));
  box-shadow: 0 10px 22px rgba(207, 120, 144, .28);
}
.secondary-button { background: #f9e7dc; color: var(--terracotta-deep); }
.ghost-button { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.primary-button:active, .secondary-button:active, .ghost-button:active, .add-button:active { transform: scale(.97); }
.compact { min-height: 42px; padding: 0 16px; font-size: .88rem; }
.full-width { width: 100%; }
.text-link { color: var(--terracotta-deep); font-weight: 800; font-size: .9rem; }
.centered-block { display: block; text-align: center; margin-top: 18px; }

.toast-stack { position: fixed; z-index: 3000; top: 12px; left: 14px; right: 14px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 520px; margin: auto; width: 100%; padding: 13px 16px; border-radius: 15px; color: var(--cocoa); background: white; box-shadow: var(--shadow); font-weight: 700; animation: toast-in .25s ease; }
.toast-success { border-left: 5px solid var(--sage-deep); }
.toast-error { border-left: 5px solid var(--danger); }
.toast-info { border-left: 5px solid var(--butter); }
@keyframes toast-in { from { transform: translateY(-12px); opacity: 0; } }

/* Public catalog */
.public-body { padding-bottom: 100px; }
.public-hero { min-height: 240px; position: relative; overflow: hidden; background: linear-gradient(145deg, #f8c7b0 0%, #efabc0 52%, #f3d89f 100%); border-radius: 0 0 34px 34px; }
.public-hero.has-cover { background-image: var(--hero-image); background-size: cover; background-position: center 62%; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(69,54,51,.08), rgba(69,54,51,.46)); }
.public-hero.has-cover .hero-overlay { background: linear-gradient(90deg, rgba(255,249,242,.92) 0%, rgba(255,249,242,.82) 34%, rgba(255,249,242,.28) 60%, rgba(69,54,51,.08) 100%); }
.public-hero:not(.has-cover) .hero-overlay { background: radial-gradient(circle at 10% 20%, rgba(255,255,255,.5), transparent 35%), radial-gradient(circle at 90% 10%, rgba(255,255,255,.38), transparent 30%); }
.hero-content { min-height: 240px; position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; padding-block: 28px; gap: 16px; }
.brand-lockup { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: white; text-shadow: 0 2px 16px rgba(69,54,51,.22); }
.public-hero:not(.has-cover) .brand-lockup, .public-hero.has-cover .brand-lockup { color: var(--cocoa); text-shadow: none; }
.brand-logo { width: clamp(170px, 48vw, 220px); height: auto; max-height: 154px; border-radius: 0; object-fit: contain; object-position: left center; padding: 0; background: transparent; border: 0; box-shadow: none; flex: 0 0 auto; }
.brand-logo-fallback { display: grid; place-items: center; font-size: 2rem; font-weight: 900; color: var(--terracotta-deep); }
.brand-lockup h1 { margin-bottom: 5px; }

.brand-lockup > div { max-width: min(520px, 86vw); }
.hero-tagline { margin: 0; max-width: 520px; font-weight: 600; opacity: .94; }
.soft-icon-button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.88); color: var(--cocoa); display: grid; place-items: center; box-shadow: var(--shadow-soft); font-size: 1.15rem; flex: 0 0 auto; }
.soft-icon-button.install-app-button { width: auto; min-width: 44px; padding: 0 14px; border-radius: 999px; display: inline-flex; gap: 7px; font-size: .86rem; font-weight: 800; }
.soft-icon-button.install-app-button small { color: inherit; font-size: .76rem; font-weight: 800; letter-spacing: .01em; }
.soft-icon-button.install-app-button span { font-size: 1rem; line-height: 1; }
.public-main { padding-top: 20px; }
.notice-card { display: flex; align-items: center; gap: 12px; padding: 15px; border-radius: var(--radius-lg); background: #fff0e5; border: 1px solid #f3ddcf; box-shadow: var(--shadow-soft); }
.notice-card p { margin: 0; font-size: .9rem; font-weight: 650; }
.notice-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: white; color: var(--strawberry-deep); font-size: 1.3rem; flex: 0 0 auto; }
.catalog-toolbar { margin-top: 18px; }
.search-box { display: flex; align-items: center; gap: 10px; border-radius: 999px; background: white; padding: 0 17px; min-height: 50px; box-shadow: var(--shadow-soft); border: 1px solid rgba(235,221,212,.75); }
.search-box span { color: var(--terracotta); font-size: 1.4rem; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--cocoa); }
.category-scroller { display: flex; overflow-x: auto; gap: 9px; padding: 15px 2px 7px; scrollbar-width: none; }
.category-scroller::-webkit-scrollbar { display: none; }
.category-chip, .filter-chips a { border: 1px solid var(--line); background: rgba(255,255,255,.84); color: var(--muted); border-radius: 999px; padding: 9px 15px; white-space: nowrap; font-size: .83rem; font-weight: 800; }
.category-chip.is-active, .filter-chips .is-active { color: white; border-color: transparent; background: linear-gradient(135deg, var(--terracotta), var(--strawberry-deep)); box-shadow: 0 7px 16px rgba(207,120,144,.22); }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; margin-top: 12px; }
.product-card { background: white; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); border: 1px solid rgba(235,221,212,.55); min-width: 0; }
.product-image-wrap { aspect-ratio: 1 / 1; position: relative; overflow: hidden; background: #f9eee4; }
.product-image { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.product-placeholder { display: grid; place-items: center; background: linear-gradient(145deg, #fae7dc, #f8d7df); font-size: 2.4rem; }
.featured-pill { position: absolute; top: 9px; left: 9px; padding: 5px 8px; background: rgba(255,255,255,.92); color: var(--terracotta-deep); border-radius: 999px; font-size: .62rem; font-weight: 900; box-shadow: var(--shadow-soft); }
.product-card-body { padding: 13px; }
.product-category { margin: 0 0 4px; color: var(--terracotta-deep); font-size: .67rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.product-card h2 { font-size: .98rem; min-height: 2.34em; }
.product-description { color: var(--muted); font-size: .76rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }
.product-card-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 12px; }
.product-price { display: block; font-size: 1.03rem; }
.product-unit { font-size: .7rem; color: var(--muted); }
.add-button { width: 42px; height: 42px; border-radius: 14px; border: 0; color: white; background: linear-gradient(135deg, var(--terracotta), var(--strawberry-deep)); font-size: 1.6rem; line-height: 1; box-shadow: 0 8px 18px rgba(207,120,144,.25); flex: 0 0 auto; }
.no-results { padding: 40px 20px; text-align: center; color: var(--muted); }
.no-results span { font-size: 2rem; }

.floating-cart { position: fixed; z-index: 100; left: 16px; right: 16px; bottom: var(--safe-bottom); border: 0; border-radius: 999px; min-height: 58px; background: linear-gradient(135deg, var(--terracotta-deep), #bb6b82); color: white; box-shadow: 0 16px 34px rgba(111,65,74,.34); display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 850; }
.floating-cart b { background: white; color: var(--terracotta-deep); min-width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; }
.drawer-backdrop { position: fixed; z-index: 500; inset: 0; background: rgba(45,32,30,.38); backdrop-filter: blur(3px); }
.cart-drawer { position: fixed; z-index: 510; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--cream); border-radius: 28px 28px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .28s ease; box-shadow: 0 -20px 50px rgba(69,54,51,.22); }
.cart-drawer.is-open { transform: translateY(0); }
.drawer-handle { width: 46px; height: 5px; border-radius: 99px; background: #d8c7bd; margin: 2px auto 15px; }
.cart-header { display: flex; align-items: start; justify-content: space-between; }
.close-button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: white; color: var(--muted); font-size: 1.5rem; }
.cart-items { display: grid; gap: 10px; margin: 12px 0 18px; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; background: white; border-radius: 18px; padding: 13px; box-shadow: var(--shadow-soft); }
.cart-item h3 { margin: 0 0 3px; font-size: .96rem; }
.cart-item small { display: block; }
.quantity-control { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.quantity-control button { width: 32px; height: 32px; border-radius: 10px; border: 0; background: #f8e8de; color: var(--terracotta-deep); font-weight: 900; }
.cart-item-total { text-align: right; }
.cart-item-total button { border: 0; background: transparent; color: var(--danger); margin-top: 10px; font-size: .75rem; }
.cart-customer-form { display: grid; gap: 12px; }
.cart-total-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 6px; font-size: 1.02rem; }
.cart-total-row strong { font-size: 1.4rem; }
.whatsapp-button { background: linear-gradient(135deg, #6f9d7a, #78ad85); box-shadow: 0 10px 22px rgba(111,157,122,.28); justify-content: space-between; }
.centered { text-align: center; }

/* Forms */
.stack-form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; font-size: .82rem; font-weight: 800; color: var(--cocoa); }
input, textarea, select { width: 100%; border: 1px solid var(--line); background: var(--white); color: var(--cocoa); border-radius: 14px; min-height: 48px; padding: 11px 13px; outline: none; transition: border-color .18s, box-shadow .18s; }
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { border-color: var(--strawberry); box-shadow: 0 0 0 4px rgba(234,166,184,.18); }
label > small, .form-hint { font-size: .7rem; font-weight: 600; color: var(--muted); margin-top: -2px; }
.check-row { display: flex; align-items: center; gap: 10px; background: #fffaf6; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.check-row input { width: 20px; min-height: auto; height: 20px; accent-color: var(--terracotta); }
.danger-check { color: var(--danger); }
.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Authentication / hub */
.auth-body, .hub-body { min-height: 100vh; background: radial-gradient(circle at 15% 10%, #f8d8df 0, transparent 32%), radial-gradient(circle at 85% 20%, #f5dfac 0, transparent 30%), linear-gradient(160deg, #fff9f3, #f8eee9); }
.auth-shell, .hub-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card, .hub-card { width: min(100%, 440px); background: rgba(255,253,251,.92); border: 1px solid rgba(255,255,255,.85); border-radius: 30px; padding: 25px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.auth-mark, .hub-logo-fallback { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(145deg, var(--peach), var(--strawberry)); color: white; font-weight: 900; font-size: 1.35rem; box-shadow: var(--shadow-soft); margin-bottom: 18px; }
.auth-intro { color: var(--muted); margin-bottom: 22px; }
.hub-card { text-align: center; }
.hub-logo { width: min(240px, 82vw); height: auto; max-height: 168px; object-fit: contain; object-position: center; padding: 0; background: transparent; border-radius: 0; margin: 0 auto 18px; box-shadow: none; }
.hub-logo-fallback { margin-inline: auto; }
.hub-actions { display: grid; gap: 12px; margin: 24px 0 15px; text-align: left; }
.hub-action { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 16px; border-radius: 20px; box-shadow: var(--shadow-soft); }
.hub-action-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: white; font-size: 1.35rem; }
.hub-action b, .hub-action small { display: block; }
.public-action { background: #f9e2d5; }
.admin-action { background: #e8f0e6; }
.error-card { text-align: center; }
.error-card .auth-mark { margin-inline: auto; }

/* Admin shell */
.admin-body { padding-bottom: 98px; }
.admin-topbar { position: sticky; z-index: 80; top: 0; background: rgba(255,248,241,.88); border-bottom: 1px solid rgba(235,221,212,.78); backdrop-filter: blur(15px); }
.topbar-content { height: 70px; display: flex; align-items: center; justify-content: space-between; }
.admin-brand { display: flex; align-items: center; gap: 10px; }
.admin-brand img { width: 92px; height: 42px; object-fit: contain; object-position: left center; padding: 0; background: transparent; border-radius: 0; }
.admin-brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--peach), var(--strawberry)); border-radius: 14px; font-weight: 900; }
.admin-brand span span, .admin-brand small, .admin-brand b { display: block; line-height: 1.12; }
.admin-brand small { font-size: .67rem; }
.admin-brand b { font-size: .96rem; }
.topbar-actions { display: flex; gap: 8px; }
.admin-main { padding-top: 20px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .86rem; }
.page-heading h1 { font-size: 1.8rem; }
.section-card { background: white; border-radius: var(--radius-xl); padding: 18px; box-shadow: var(--shadow-soft); border: 1px solid rgba(235,221,212,.56); margin-bottom: 16px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 1.18rem; }
.admin-bottom-nav { position: fixed; z-index: 100; bottom: 0; left: 0; right: 0; height: calc(72px + env(safe-area-inset-bottom)); padding: 8px 8px env(safe-area-inset-bottom); background: rgba(255,253,251,.96); border-top: 1px solid var(--line); box-shadow: 0 -8px 30px rgba(69,54,51,.08); display: grid; grid-template-columns: repeat(5, 1fr); backdrop-filter: blur(15px); }
.admin-bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #998984; font-size: 1.2rem; }
.admin-bottom-nav small { font-size: .61rem; font-weight: 800; color: inherit; }
.admin-bottom-nav a.is-active { color: var(--terracotta-deep); }
.admin-bottom-nav .nav-create { position: relative; top: -22px; color: white; }
.admin-bottom-nav .nav-create span { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--terracotta), var(--strawberry-deep)); box-shadow: 0 10px 24px rgba(207,120,144,.34); font-size: 1.8rem; }
.admin-bottom-nav .nav-create small { color: var(--terracotta-deep); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 16px; }
.stat-card { min-height: 158px; border-radius: 24px; padding: 15px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid rgba(255,255,255,.62); box-shadow: var(--shadow-soft); }
.stat-card small, .stat-card strong, .stat-card em { display: block; }
.stat-card small { color: var(--cocoa); opacity: .78; font-weight: 800; margin-top: 8px; }
.stat-card strong { font-size: clamp(1.35rem, 6vw, 1.85rem); line-height: 1.05; margin-top: 5px; }
.stat-card em { font-style: normal; font-size: .67rem; color: var(--muted); margin-top: auto; }
.stat-icon { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.74); }
.stat-pending { background: #f7e4c0; }
.stat-sales { background: #f7d9df; }
.stat-profit { background: #dfeddf; }
.stat-month { background: #f7ddcf; }
.quick-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-action-grid a { min-height: 130px; padding: 14px; border-radius: 20px; background: #fff8f3; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; }
.quick-action-grid a:nth-child(2) { background: #f9eef1; }
.quick-action-grid a:nth-child(3) { background: #edf4ea; }
.quick-action-grid a:nth-child(4) { background: #fbf2db; }
.quick-action-grid span { font-size: 1.35rem; }
.quick-action-grid b { margin-top: auto; font-size: .88rem; }
.quick-action-grid small { font-size: .65rem; }
.mini-order-list { display: grid; gap: 4px; }
.mini-order { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid #f2e8e2; }
.mini-order:last-child { border-bottom: 0; }
.order-avatar, .client-avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: #f5dde4; color: var(--strawberry-deep); font-weight: 900; }
.mini-order-main b, .mini-order-main small, .mini-order-right strong, .mini-order-right span { display: block; }
.mini-order-main small { font-size: .65rem; }
.mini-order-right { text-align: right; }
.mini-order-right strong { font-size: .83rem; }
.status-dot { font-size: .58rem; font-weight: 800; margin-top: 4px; }
.status-dot.status-preparing { color: var(--terracotta-deep); }
.status-dot.status-prepared { color: #9d6c1e; }
.status-dot.status-delivered { color: var(--sage-deep); }

.inline-links { display: flex; gap: 8px; overflow-x: auto; margin: -5px 0 15px; }
.inline-links a { white-space: nowrap; border-radius: 999px; background: white; border: 1px solid var(--line); padding: 9px 13px; color: var(--terracotta-deep); font-size: .75rem; font-weight: 800; }
.mobile-card-list, .order-card-list, .client-list { display: grid; gap: 12px; }
.admin-product-card { background: white; border-radius: 24px; padding: 12px; box-shadow: var(--shadow-soft); border: 1px solid rgba(235,221,212,.56); display: grid; grid-template-columns: 100px 1fr; gap: 13px; }
.admin-product-card.is-muted { opacity: .67; }
.admin-product-card > img, .admin-product-placeholder { width: 100px; height: 100px; border-radius: 17px; object-fit: cover; object-position: center top; }
.admin-product-placeholder { display: grid; place-items: center; background: #fae9df; font-size: 2rem; }
.admin-product-info { min-width: 0; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title-row small { display: block; font-size: .64rem; }
.card-title-row h2 { font-size: 1rem; margin: 3px 0 8px; }
.price-pair { display: flex; gap: 14px; overflow-x: auto; }
.price-pair span { white-space: nowrap; }
.price-pair small, .price-pair b { display: block; }
.price-pair small { font-size: .58rem; }
.price-pair b { font-size: .76rem; }
.card-actions { display: flex; gap: 7px; align-items: center; margin-top: 11px; }
.card-actions form { margin: 0; }
.pill { display: inline-flex; border-radius: 999px; padding: 6px 9px; font-size: .64rem; font-weight: 850; white-space: nowrap; }
.pill.neutral { background: #eee7e3; color: var(--muted); }
.status-preparing { background: #fae1d3; color: var(--terracotta-deep); }
.status-prepared { background: #f8e8bf; color: #8d651d; }
.status-delivered { background: #e0eddf; color: #5b855f; }
.payment-pending { background: #f7dddd; color: #a35454; }
.payment-partial { background: #fff0c9; color: #946814; }
.payment-paid { background: #ddecdf; color: #57825e; }
.image-upload-field { min-height: 240px; border-radius: 24px; border: 2px dashed #dfc9bd; background: #fff9f5; overflow: hidden; display: grid; place-items: center; text-align: center; cursor: pointer; }
.image-upload-field input { display: none; }
.image-upload-field img { width: 100%; max-height: 310px; object-fit: cover; }
#imagePreviewPlaceholder { display: grid; gap: 5px; place-items: center; color: var(--muted); padding: 30px; }
#imagePreviewPlaceholder span { font-size: 2rem; }
.sticky-form-actions, .sticky-save-bar { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.danger-zone { text-align: center; margin: 14px 0; }
.danger-link { border: 0; background: transparent; color: var(--danger); font-weight: 800; padding: 10px; }
.inline-form { display: flex; align-items: end; gap: 10px; }
.inline-form label { flex: 1; }
.simple-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f1e7e1; }
.simple-list-row:last-child { border-bottom: 0; }
.simple-list-row b, .simple-list-row small { display: block; }

.order-item-list { display: grid; gap: 12px; margin-bottom: 12px; }
.order-items-empty {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px dashed rgba(111, 82, 72, 0.28);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}
.order-items-empty b { color: var(--cocoa); }
.order-items-empty span { font-size: 0.9rem; line-height: 1.35; }
.order-items-empty[hidden] { display: none; }
.order-item-row { position: relative; background: #fff9f5; border: 1px solid var(--line); border-radius: 20px; padding: 15px; display: grid; gap: 11px; }
.remove-item-button { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: white; color: var(--danger); font-size: 1.1rem; }
.product-select-label { padding-right: 34px; }
.item-numbers { display: grid; grid-template-columns: .8fr 1.2fr; gap: 9px; }
.item-summary { display: flex; justify-content: space-between; align-items: center; }
.item-summary span { color: var(--muted); font-size: .7rem; }
.item-summary b { color: var(--terracotta-deep); }
.order-total-card { padding: 18px; border-radius: 20px; background: linear-gradient(145deg, #f9e2d5, #f4d9df); }
.order-total-card span, .order-total-card strong, .order-total-card small { display: block; }
.order-total-card strong { font-size: 1.8rem; margin: 5px 0; }
.order-total-card small { color: var(--muted); }
.sticky-save-bar { position: sticky; z-index: 30; bottom: 78px; background: rgba(255,248,241,.92); padding: 10px; border-radius: 20px; box-shadow: var(--shadow); backdrop-filter: blur(12px); margin: 15px 0; }

.filter-chips {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  margin-bottom: 15px;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: #d8b8ae transparent;
  overscroll-behavior-inline: contain;
}
.filter-chips::-webkit-scrollbar { height: 6px; }
.filter-chips::-webkit-scrollbar-track { background: transparent; }
.filter-chips::-webkit-scrollbar-thumb { background: #d8b8ae; border-radius: 999px; }

/* En Pedidos, los filtros se acomodan en varias filas en PC para que nunca se corte "Cobrados". */
@media (min-width: 700px) {
  .orders-filter-chips {
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
  }
}
.order-card { background: white; border-radius: 23px; overflow: hidden; box-shadow: var(--shadow-soft); border: 1px solid rgba(235,221,212,.6); border-left-width: 5px; }
.status-border-preparing { border-left-color: var(--peach); }
.status-border-prepared { border-left-color: var(--butter); }
.status-border-delivered { border-left-color: var(--sage); }
.order-card-main { display: block; padding: 15px; }
.order-card-main .card-title-row h2 { font-size: 1.08rem; margin-bottom: 0; }
.order-card-main .card-title-row > strong { font-size: 1.05rem; }
.items-summary { color: var(--muted); font-size: .78rem; margin: 10px 0 5px; }
.delivery-line { font-size: .72rem; color: var(--muted); margin: 0 0 10px; }
.order-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.order-quick-actions { display: grid; grid-template-columns: 1fr 1fr; background: #fff9f5; border-top: 1px solid var(--line); }
.order-quick-actions > * + * { border-left: 1px solid var(--line); }
.order-quick-actions button,
.order-quick-actions > a {
  width: 100%;
  min-height: 43px;
  border: 0;
  background: transparent;
  color: var(--terracotta-deep);
  font-weight: 800;
  font-size: .73rem;
}
.order-quick-actions > a { display: grid; place-items: center; text-align: center; }
.detail-status-row { display: flex; gap: 8px; margin-bottom: 18px; }
.detail-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-contact p { background: #fff9f5; border-radius: 15px; padding: 12px; margin: 0; }
.detail-contact small, .detail-contact b { display: block; }
.detail-contact b { font-size: .78rem; margin-top: 4px; }
.detail-items { margin: 18px 0; border-block: 1px solid var(--line); }
.detail-items > div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f3eae4; }
.detail-items > div:last-child { border-bottom: 0; }
.detail-items b, .detail-items small { display: block; }
.detail-items small { margin-top: 3px; }
.notes-box { padding: 14px; border-radius: 16px; background: #fbf2dc; }
.notes-box p { margin: 5px 0 0; }
.detail-totals { margin-top: 16px; display: grid; gap: 8px; }
.detail-totals > div { display: flex; justify-content: space-between; }
.detail-totals .profit-line { margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--sage-deep); font-size: 1.12rem; }
.detail-action-grid { display: grid; gap: 10px; }
.client-card { background: white; border-radius: 21px; box-shadow: var(--shadow-soft); border: 1px solid rgba(235,221,212,.6); padding: 13px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; }
.client-main h2 { margin: 0; font-size: .98rem; }
.client-main p { margin: 2px 0; color: var(--muted); font-size: .75rem; }
.client-main small { font-size: .63rem; }
.settings-form { display: grid; gap: 0; }
.file-card { min-height: 145px; border: 1px dashed #d9c2b6; border-radius: 20px; background: #fff9f5; padding: 12px; text-align: center; place-items: center; cursor: pointer; }
.file-card img { width: min(240px, 100%); height: 150px; object-fit: contain; object-position: center; padding: 4px; background: white; border-radius: 18px; margin: 8px auto; }
.file-card.wide img { width: 100%; height: 150px; object-fit: cover; object-position: center; padding: 0; border-radius: 18px; }
.file-card input { margin-top: 8px; font-size: .72rem; }
.logout-form { margin: 18px 0; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 36px 20px; background: white; border-radius: 24px; color: var(--muted); box-shadow: var(--shadow-soft); }
.empty-state span, .empty-emoji { font-size: 2rem; }
.empty-state h2, .empty-state h3 { color: var(--cocoa); margin: 8px 0; }
.empty-state p { margin: 0; }
.compact-empty { padding: 22px; box-shadow: none; }


.edit-order-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 15px;
  border: 1px solid #ead7af;
  border-radius: 19px;
  padding: 14px;
  background: #fff8e9;
}
.edit-order-notice span { font-size: 1.25rem; }
.edit-order-notice b { display: block; }
.edit-order-notice p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.compact-control-card { padding: 14px; }
.compact-control-card label { margin: 0; }
.compact-control-card small,
.payment-control-card > small { display: block; margin-top: 9px; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.payment-control-card { padding: 15px; scroll-margin-top: 20px; }
.payment-heading { align-items: center; margin-bottom: 12px; }
.payment-heading h2 { margin-bottom: 0; }
.payment-action-buttons { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 11px; }
.payment-action-buttons button { min-height: 44px; }
.detail-totals .balance-due { color: #a35454; font-weight: 850; }
.detail-totals .balance-credit { color: #946814; font-weight: 850; }
.detail-totals .balance-paid { color: var(--sage-deep); font-weight: 850; }

@media (min-width: 700px) {
  .public-hero { min-height: 340px; }
  .hero-content { min-height: 340px; }
  .brand-lockup { flex-direction: row; align-items: flex-end; gap: 20px; }
  .brand-logo { width: 230px; max-height: 162px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
  .product-card-body { padding: 16px; }
  .floating-cart { left: auto; width: 310px; }
  .cart-drawer { left: auto; width: 430px; top: 0; max-height: none; border-radius: 28px 0 0 28px; transform: translateX(105%); padding-top: 20px; }
  .cart-drawer.is-open { transform: translateX(0); }
  .drawer-handle { display: none; }
  .stats-grid { grid-template-columns: repeat(4,1fr); }
  .stat-card { min-height: 172px; }
  .quick-action-grid { grid-template-columns: repeat(4,1fr); }
  .admin-product-card { grid-template-columns: 130px 1fr; }
  .admin-product-card > img, .admin-product-placeholder { width: 130px; height: 130px; }
  .detail-contact { grid-template-columns: repeat(3,1fr); }
}

@media (min-width: 1050px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

@media (max-width: 390px) {
  .public-shell, .admin-shell { width: min(100% - 20px, 1180px); }
  .brand-logo { width: 155px; height: auto; max-height: 108px; padding: 0; }
  .product-grid { gap: 9px; }
  .product-card-body { padding: 10px; }
  .product-card h2 { font-size: .9rem; }
  .product-description { display: none; }
  .product-price { font-size: .92rem; }
  .admin-product-card { grid-template-columns: 84px 1fr; }
  .admin-product-card > img, .admin-product-placeholder { width: 84px; height: 84px; }
  .price-pair { gap: 9px; }
  .two-column-fields { grid-template-columns: 1fr; }
}

/* Manual product ordering */
.product-order-toolbar {
  position: sticky;
  z-index: 35;
  top: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 249, 245, .96);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.product-order-toolbar > div { min-width: 0; }
.product-order-toolbar b,
.product-order-toolbar small { display: block; }
.product-order-toolbar small { margin-top: 3px; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.product-order-toolbar .primary-button:disabled { opacity: .48; box-shadow: none; cursor: default; }
.product-order-toolbar.is-dirty { border-color: rgba(207, 120, 144, .48); }

.product-sort-list .admin-product-card {
  grid-template-columns: 42px 100px minmax(0, 1fr);
  align-items: center;
}
.product-move-controls {
  display: grid;
  justify-items: center;
  gap: 5px;
}
.product-move-button {
  width: 36px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--terracotta-deep);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.product-move-button:active { transform: scale(.94); }
.product-move-button:disabled { opacity: .28; box-shadow: none; cursor: default; }
.product-position {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f7e7df;
  color: var(--terracotta-deep);
  font-size: .68rem;
  font-weight: 900;
}

@media (min-width: 700px) {
  .product-sort-list .admin-product-card {
    grid-template-columns: 42px 130px minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .product-order-toolbar {
    top: 76px;
    align-items: flex-start;
    padding: 12px;
  }
  .product-order-toolbar small { max-width: 190px; }
  .product-order-toolbar .primary-button { flex: 0 0 auto; padding-inline: 12px; }
}

@media (max-width: 390px) {
  .product-sort-list .admin-product-card {
    grid-template-columns: 34px 84px minmax(0, 1fr);
    gap: 9px;
  }
  .product-move-button { width: 32px; height: 31px; }
  .product-position { min-width: 25px; height: 22px; }
}

/* Cantidades enteras, promociones y detalle público */
.product-card {
  display: flex;
  cursor: pointer;
  flex-direction: column;
  height: 100%;
}
.product-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
}
.product-card h2 { margin-bottom: 7px; }
.product-description {
  display: -webkit-box;
  min-height: 2.35em;
  margin-bottom: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.product-more-slot { min-height: 25px; }
.product-more-button {
  border: 0;
  padding: 3px 0;
  background: transparent;
  color: var(--terracotta-deep);
  font-size: .72rem;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.product-more-button[hidden],
.product-modal-overlay[hidden],
.promotion-applied[hidden],
.modal-promotion[hidden] { display: none !important; }
.promotion-pill {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(69,54,51,.9);
  color: white;
  font-size: .56rem;
  font-weight: 950;
  letter-spacing: .035em;
  box-shadow: var(--shadow-soft);
}
.promotion-copy {
  min-height: 4.2em;
  margin: 4px 0 8px;
  padding: 8px 10px;
  border: 1px solid rgba(193, 98, 78, 0.18);
  border-left: 4px solid var(--terracotta);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 247, 243, 0.98) 0%, rgba(255, 240, 233, 0.98) 100%);
  color: var(--terracotta-deep);
  font-size: .72rem;
  font-weight: 760;
  line-height: 1.42;
  box-shadow: 0 8px 18px rgba(193, 98, 78, 0.08);
}
.promotion-copy b {
  color: var(--terracotta-deep);
  font-size: .84rem;
  font-weight: 950;
}
.promotion-copy-placeholder { visibility: hidden; }
.promotion-applied {
  min-height: 18px;
  margin: -2px 0 6px;
  color: var(--sage-deep);
  font-size: .67rem;
  font-weight: 900;
}
.product-card-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.product-price-row { min-width: 0; }
.product-buy-controls { display: grid; gap: 7px; }
.quantity-selector {
  display: grid;
  grid-template-columns: 34px minmax(28px, 1fr) 34px;
  align-items: center;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffaf6;
}
.quantity-selector button {
  width: 100%;
  height: 38px;
  border: 0;
  background: #f8e8de;
  color: var(--terracotta-deep);
  font-size: 1.08rem;
  font-weight: 950;
}
.quantity-selector span {
  text-align: center;
  font-size: .88rem;
  font-weight: 900;
}
.quantity-selector.large {
  grid-template-columns: 44px minmax(42px, 1fr) 44px;
  min-height: 46px;
}
.quantity-selector.large button { height: 46px; }
.product-add-button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 13px;
  padding: 7px 9px;
  background: linear-gradient(135deg, var(--terracotta), var(--strawberry-deep));
  color: white;
  font-size: .76rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(207,120,144,.22);
}
.product-add-button.is-added {
  background: linear-gradient(135deg, var(--sage-deep), #89ab8d);
  box-shadow: 0 8px 18px rgba(111,152,117,.2);
}
.promo-price-active { color: var(--sage-deep); }
.cart-quantity-selector { width: 118px; margin-top: 9px; }
.cart-promotion {
  display: block;
  margin-top: 4px;
  color: var(--sage-deep);
  font-size: .68rem;
  font-weight: 900;
}

.product-modal-overlay {
  position: fixed;
  z-index: 900;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(45,32,30,.5);
  backdrop-filter: blur(4px);
}
.product-modal {
  position: relative;
  width: min(100%, 560px);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 24px 70px rgba(45,32,30,.3);
}
.product-modal-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  color: var(--cocoa);
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}
.product-modal-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 28px 28px 0 0;
  background: #f6e7dc;
}
.product-modal-media img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.product-modal-placeholder { display: grid; width: 100%; height: 100%; place-items: center; font-size: 3rem; }
.product-modal-content { padding: 19px; }
.product-modal-content h2 { padding-right: 38px; font-size: 1.35rem; }
.product-modal-description {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: .9rem;
  white-space: pre-wrap;
}
.modal-promotion {
  margin-bottom: 13px;
  border: 1px solid rgba(212, 179, 106, 0.45);
  border-left: 4px solid #d1a13a;
  border-radius: 17px;
  padding: 12px 13px;
  background: linear-gradient(180deg, rgba(255, 248, 229, 0.98) 0%, rgba(255, 239, 199, 0.98) 100%);
  box-shadow: 0 10px 22px rgba(157, 108, 30, 0.10);
}
.modal-promotion span { color: #9d6c1e; font-size: .67rem; font-weight: 950; letter-spacing: .07em; }
.modal-promotion p { margin: 5px 0 0; font-size: .9rem; font-weight: 850; color: #6d4510; line-height: 1.42; }
.modal-price-row { display: flex; align-items: baseline; gap: 5px; margin: 9px 0 13px; }
.modal-price-row strong { font-size: 1.55rem; }
.modal-price-row span { color: var(--muted); font-size: .8rem; }
.modal-buy-row { display: grid; grid-template-columns: minmax(132px, .85fr) 1.15fr; gap: 10px; }
.modal-add-button { min-height: 46px; }

/* Promoción y cantidad entera en administración */
.promotion-editor {
  display: grid;
  gap: 10px;
  border: 1px solid #ead7b0;
  border-radius: 20px;
  padding: 15px;
  background: #fff8e8;
}
.promotion-editor h2 { margin-bottom: 3px; }
.promotion-editor p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .76rem; }
.promotion-editor > small { color: var(--muted); }
.admin-promo-line {
  margin: 8px 0 0;
  color: #9d6c1e;
  font-size: .7rem;
  font-weight: 850;
}
.admin-quantity-control {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
.admin-quantity-control button {
  border: 0;
  background: #f8e8de;
  color: var(--terracotta-deep);
  font-size: 1.15rem;
  font-weight: 950;
}
.admin-quantity-control span { display: grid; place-items: center; font-weight: 900; }
@media (min-width: 700px) {
  .payment-action-buttons { grid-template-columns: repeat(3, 1fr); }
  .product-modal-overlay { place-items: center; }
  .product-buy-controls { grid-template-columns: 1fr 1.2fr; align-items: stretch; }
  .product-add-button { min-height: 38px; }
}

@media (max-width: 520px) {
  .product-modal-overlay { padding-inline: 0; padding-bottom: 0; }
  .product-modal { width: 100%; max-height: 94vh; border-radius: 28px 28px 0 0; }
  .product-modal-media { border-radius: 28px 28px 0 0; }
}

@media (max-width: 390px) {
  .product-description {
    display: -webkit-box;
    min-height: 2.35em;
    font-size: .7rem;
    -webkit-line-clamp: 2;
  }
  .product-more-slot { min-height: 23px; }
  .promotion-copy { min-height: 4.8em; padding: 8px 9px; font-size: .66rem; }
  .product-price { font-size: .88rem; }
  .product-unit { font-size: .62rem; }
  .quantity-selector { grid-template-columns: 31px minmax(24px,1fr) 31px; }
  .product-add-button { font-size: .7rem; }
  .modal-buy-row { grid-template-columns: 1fr; }
}
.floating-cart[hidden], .drawer-backdrop[hidden] { display: none !important; }

/* Encabezado administrativo más legible */
.topbar-content { min-height: 82px; height: auto; padding-block: 8px; }
.admin-brand { gap: 13px; }
.admin-brand img { width: 116px; height: 54px; }
.admin-brand-mark { width: 50px; height: 50px; border-radius: 16px; font-size: 1.2rem; }
.admin-brand span span, .admin-brand small, .admin-brand b { line-height: 1.08; }
.admin-brand small { font-size: .78rem; font-weight: 700; }
.admin-brand b { font-size: 1.42rem; font-weight: 900; letter-spacing: -.03em; }
.topbar-actions { gap: 10px; }

/* Navegación con acceso directo a estadísticas */
.admin-bottom-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.admin-bottom-nav a { min-width: 0; }
.admin-bottom-nav small { max-width: 100%; overflow: hidden; font-size: .56rem; text-overflow: ellipsis; white-space: nowrap; }

/* Resumen operativo */
.stat-ready { background: #f6eccb; }
.dashboard-debt-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #efd6d6;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff4f0, #fae6e9);
  box-shadow: var(--shadow-soft);
}
.dashboard-debt-banner > span:first-child { font-size: 1.45rem; }
.dashboard-debt-banner small, .dashboard-debt-banner b { display: block; }
.dashboard-debt-banner small { font-size: .68rem; }
.dashboard-debt-banner b { margin-top: 2px; font-size: 1.1rem; }
.dashboard-debt-banner > strong { color: var(--terracotta-deep); font-size: .72rem; }

/* Registro e historial de cobros */
.payment-entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.payment-note-field { grid-column: 1 / -1; }
.payment-movement-buttons { grid-template-columns: 1fr; }
.payment-history-card { scroll-margin-top: 100px; }
.payment-movement-list { display: grid; gap: 8px; }
.payment-movement-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid #f1e7e1;
}
.payment-movement-row:last-child { border-bottom: 0; }
.movement-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; font-weight: 950; }
.movement-icon.movement-payment { color: #4f7e58; background: #e4f0e4; }
.movement-icon.movement-refund { color: #a35454; background: #f8e1e1; }
.movement-main { min-width: 0; }
.movement-main b, .movement-main small, .movement-main em { display: block; }
.movement-main small { margin-top: 2px; font-size: .65rem; }
.movement-main em { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: .68rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.movement-amount { white-space: nowrap; font-size: .86rem; }
.movement-amount.movement-payment { color: var(--sage-deep); }
.movement-amount.movement-refund { color: var(--danger); }
.movement-delete-button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: #fff0ed; color: var(--danger); font-size: 1rem; font-weight: 900; }

/* Estadísticas */
.statistics-heading { align-items: center; }
.statistics-filter-card { padding-bottom: 15px; }
.period-date-label { color: var(--muted); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.statistics-range-chips, .statistics-section-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.statistics-range-chips::-webkit-scrollbar, .statistics-section-nav::-webkit-scrollbar { display: none; }
.statistics-range-chips a, .statistics-section-nav a {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: #fffaf6;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
  white-space: nowrap;
}
.statistics-range-chips a.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--terracotta), var(--strawberry-deep));
  color: white;
  box-shadow: 0 7px 16px rgba(207,120,144,.22);
}
.statistics-custom-range { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 9px; margin-top: 12px; }
.statistics-custom-range label { margin: 0; }
.statistics-custom-range input { min-height: 42px; }
.statistics-section-nav { position: sticky; z-index: 32; top: 92px; margin: 0 0 14px; padding: 8px; border: 1px solid rgba(235,221,212,.8); border-radius: 999px; background: rgba(255,248,241,.94); box-shadow: var(--shadow-soft); backdrop-filter: blur(12px); }
.statistics-section-nav a { border: 0; background: white; color: var(--terracotta-deep); }
.statistics-kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; scroll-margin-top: 150px; }
.statistics-kpi {
  min-height: 158px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 23px;
  box-shadow: var(--shadow-soft);
}
.statistics-kpi > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: rgba(255,255,255,.75); }
.statistics-kpi small { margin-top: 8px; color: var(--cocoa); font-weight: 850; }
.statistics-kpi strong { margin-top: 4px; font-size: clamp(1.2rem, 5vw, 1.7rem); line-height: 1.05; overflow-wrap: anywhere; }
.statistics-kpi em { margin-top: auto; color: var(--muted); font-size: .65rem; font-style: normal; }
.kpi-orders { background: #f7e8cf; }
.kpi-sales { background: #f7dce1; }
.kpi-collected { background: #deece0; }
.kpi-debt { background: #f7dddd; }
.kpi-profit { background: #e5efdc; }
.kpi-projected { background: #edf2d6; }
.kpi-ticket { background: #f6e2d5; }
.kpi-clients { background: #e5edf5; }
.statistics-chart-card { scroll-margin-top: 150px; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: .62rem; font-weight: 800; }
.chart-legend span::before { width: 9px; height: 9px; border-radius: 3px; content: ""; }
.legend-sales::before { background: var(--strawberry-deep); }
.legend-profit::before { background: var(--sage-deep); }
.legend-collected::before { background: #d5a640; }
.statistics-chart-scroll { overflow-x: auto; padding: 8px 0 2px; }
.statistics-chart { min-width: max(100%, calc(var(--chart-columns) * 36px)); height: 230px; display: grid; grid-template-columns: repeat(var(--chart-columns), minmax(28px, 1fr)); align-items: end; gap: 5px; padding: 12px 4px 0; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0 49px, rgba(235,221,212,.55) 50px); }
.statistics-chart-column { height: 100%; display: grid; grid-template-rows: 1fr 24px; gap: 6px; align-items: end; text-align: center; }
.statistics-chart-bars { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.statistics-chart-bars i { width: min(8px, 28%); min-height: 0; border-radius: 5px 5px 1px 1px; }
.bar-sales { background: var(--strawberry-deep); }
.bar-profit { background: var(--sage-deep); }
.bar-collected { background: #d5a640; }
.bar-collected.is-negative { background: var(--danger); }
.statistics-chart-column small { font-size: .56rem; transform: rotate(-35deg); transform-origin: center; white-space: nowrap; }
.statistics-status-grid, .statistics-cash-grid { display: grid; gap: 0; }
.statistics-status-list { display: grid; gap: 8px; }
.statistics-status-list a { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid #f0e5df; border-radius: 15px; background: #fffaf7; }
.statistics-status-list b { font-size: 1rem; }
.statistics-status-list small { min-width: 82px; text-align: right; font-size: .65rem; }
.statistics-table-card, #clientes, #productos, #cobros { scroll-margin-top: 150px; }
.statistics-table-scroll { overflow-x: auto; }
.statistics-table { width: 100%; min-width: 700px; border-collapse: collapse; }
.statistics-table th { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .64rem; text-align: right; white-space: nowrap; }
.statistics-table th:first-child { text-align: left; }
.statistics-table td { padding: 11px 10px; border-bottom: 1px solid #f3eae4; font-size: .75rem; text-align: right; white-space: nowrap; }
.statistics-table td:first-child { max-width: 230px; text-align: left; white-space: normal; }
.statistics-table td b, .statistics-table td small { display: block; }
.statistics-table td small { font-size: .62rem; }
.statistics-table tbody tr:last-child td { border-bottom: 0; }
.positive-cell { color: var(--sage-deep); font-weight: 850; }
.debt-cell { color: var(--danger); font-weight: 850; }
.cash-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 13px; }
.cash-summary-grid p { margin: 0; padding: 12px; border-radius: 16px; background: #fff8f3; }
.cash-summary-grid small, .cash-summary-grid strong { display: block; }
.cash-summary-grid small { font-size: .64rem; }
.cash-summary-grid strong { margin-top: 4px; font-size: 1.03rem; }
.cash-summary-grid .cash-net { grid-column: 1 / -1; background: #e6f0e4; }
.statistics-movement-list { max-height: 480px; overflow-y: auto; }
.statistics-movement-list .payment-movement-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.debt-total-label { color: var(--danger); font-size: 1.05rem; }
.debt-list { display: grid; gap: 7px; }
.debt-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px; border: 1px solid #f0e2dc; border-radius: 15px; background: #fff9f6; }
.debt-list span { min-width: 0; }
.debt-list b, .debt-list small { display: block; }
.debt-list small { margin-top: 2px; font-size: .62rem; }
.debt-list strong { color: var(--danger); white-space: nowrap; }

@media (min-width: 700px) {
  .statistics-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .statistics-status-grid, .statistics-cash-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .statistics-status-grid .section-card, .statistics-cash-grid .section-card { height: calc(100% - 16px); }
  .payment-entry-grid { grid-template-columns: 1fr 1fr 1fr; }
  .payment-note-field { grid-column: 1 / -1; }
  .payment-movement-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-action-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 520px) {
  .topbar-content { min-height: 86px; padding-block: 10px; }
  .admin-brand { gap: 12px; }
  .admin-brand img { width: 122px; height: 58px; }
  .admin-brand-mark { width: 54px; height: 54px; border-radius: 18px; font-size: 1.3rem; }
  .admin-brand small { font-size: .82rem; }
  .admin-brand b { font-size: 1.5rem; }
  .topbar-actions .soft-icon-button { width: 46px; height: 46px; }
  .topbar-actions .soft-icon-button.install-app-button { width: auto; min-width: 46px; padding: 0 12px; }
  .topbar-actions .soft-icon-button.install-app-button small { font-size: .72rem; }
  .statistics-heading { align-items: flex-start; }
  .statistics-heading .primary-button { display: none; }
  .statistics-custom-range { grid-template-columns: 1fr 1fr; }
  .statistics-custom-range button { grid-column: 1 / -1; }
  .statistics-section-nav { top: 94px; border-radius: 18px; }
  .statistics-chart-card .section-heading { align-items: flex-start; flex-direction: column; }
  .chart-legend { justify-content: flex-start; }
  .payment-movement-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .payment-movement-row > form { grid-column: 3; }
  .payment-movement-row > .movement-amount { grid-column: 3; grid-row: 1; }
  .payment-movement-row > form { grid-row: 2; justify-self: end; }
}

@media (max-width: 390px) {
  .topbar-content { min-height: 82px; }
  .admin-brand { gap: 10px; }
  .admin-brand img { width: 112px; height: 52px; }
  .admin-brand-mark { width: 48px; height: 48px; border-radius: 16px; }
  .admin-brand small { font-size: .78rem; }
  .admin-brand b { font-size: 1.34rem; }
  .admin-bottom-nav { padding-inline: 3px; }
  .admin-bottom-nav small { font-size: .5rem; }
  .statistics-kpi { min-height: 150px; padding: 12px; }
  .statistics-kpi strong { font-size: 1.15rem; }
  .period-date-label { display: none; }
  .dashboard-debt-banner { grid-template-columns: auto 1fr; }
  .dashboard-debt-banner > strong { grid-column: 2; }
  .payment-entry-grid { grid-template-columns: 1fr; }
  .payment-note-field { grid-column: auto; }
}

/* Compras y seguimiento de mercadería */
.admin-bottom-nav { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.status-dot.status-purchasing { color: var(--terracotta-deep); }
.status-dot.status-ordered { color: #a06d1e; }
.status-purchasing, .item-to-buy { background: #fae1d3; color: var(--terracotta-deep); }
.status-ordered, .item-waiting { background: #fff0c9; color: #946814; }
.item-arrived { background: #ddecdf; color: #57825e; }
.status-border-purchasing { border-left-color: var(--peach); }
.status-border-ordered { border-left-color: #e7bd68; }

.detail-items > .detail-item-row { display: block; padding: 14px 0; }
.detail-item-main { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-item-state-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; margin-top: 11px; }
.item-purchase-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.item-purchase-controls form { margin: 0; }
.item-state-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 850;
}
.item-state-button span { margin-right: 3px; }
.item-state-button.state-ordered.is-active { border-color: #e4bd6b; background: #fff0c9; color: #8b641a; }
.item-state-button.state-arrived.is-active { border-color: #a9c7ae; background: #ddecdf; color: #4e7856; }

.purchase-kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.purchase-kpi {
  min-height: 128px;
  padding: 14px;
  border: 1px solid rgba(235,221,212,.72);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.purchase-kpi-buy { background: #fbe5d8; }
.purchase-kpi-wait { background: #fff1cb; }
.purchase-kpi.is-active { outline: 2px solid rgba(187,102,83,.38); }
.purchase-kpi > span { font-size: 1.3rem; }
.purchase-kpi small, .purchase-kpi strong, .purchase-kpi em { display: block; }
.purchase-kpi small { margin-top: 7px; font-weight: 850; color: var(--cocoa); }
.purchase-kpi strong { margin-top: auto; font-size: 1.7rem; line-height: 1; }
.purchase-kpi em { margin-top: 4px; color: var(--muted); font-size: .65rem; font-style: normal; }
.purchase-controls-card { display: grid; gap: 13px; padding: 14px; }
.purchase-control-group > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .68rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.compact-chips { margin-bottom: 0; }
.purchase-table-card { padding: 15px; }
.purchase-table-scroll { overflow-x: auto; }
.purchase-table { width: 100%; border-collapse: collapse; }
.purchase-table th { padding: 8px 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .63rem; text-align: left; white-space: nowrap; }
.purchase-table td { padding: 12px 9px; border-bottom: 1px solid #f3eae4; vertical-align: middle; font-size: .75rem; }
.purchase-table tbody tr:last-child td { border-bottom: 0; }
.purchase-table td small { display: block; margin-top: 2px; font-size: .62rem; }
.purchase-table td:nth-child(2) { white-space: nowrap; }
.purchase-order-link { color: var(--terracotta-deep); font-weight: 850; white-space: nowrap; }
.purchase-summary-grid { display: grid; gap: 12px; }
.purchase-summary-card .section-heading > span { font-size: 1.4rem; }
.summary-to-buy { border-top: 4px solid var(--peach); }
.summary-waiting { border-top: 4px solid #e7bd68; }
.purchase-summary-list { display: grid; }
.purchase-summary-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f3eae4; }
.purchase-summary-list > div:last-child { border-bottom: 0; }
.purchase-summary-list b, .purchase-summary-list small { display: block; }
.purchase-summary-list small { margin-top: 2px; font-size: .62rem; }
.purchase-summary-list strong { color: var(--terracotta-deep); white-space: nowrap; }
.summary-empty { margin: 0; color: var(--muted); font-size: .78rem; }

@media (min-width: 700px) {
  .purchase-controls-card { grid-template-columns: 1fr 1fr; align-items: end; }
  .purchase-summary-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 699px) {
  .purchase-table-scroll { overflow: visible; }
  .purchase-table, .purchase-table tbody { display: block; }
  .purchase-table thead { display: none; }
  .purchase-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .purchase-table tr:last-child { border-bottom: 0; }
  .purchase-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .purchase-table td::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: .57rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
  .purchase-table td:nth-child(1), .purchase-table td:nth-child(3), .purchase-table td:nth-child(6) { grid-column: 1 / -1; }
  .purchase-table td:nth-child(5) { text-align: right; }
  .purchase-table td:nth-child(5)::before { text-align: right; }
  .purchase-table .item-purchase-controls { justify-content: flex-start; }
}

@media (max-width: 390px) {
  .admin-bottom-nav small { font-size: .46rem; }
  .admin-bottom-nav a { font-size: 1.05rem; }
  .admin-bottom-nav .nav-create span { width: 50px; height: 50px; }
  .detail-item-state-row { align-items: flex-start; }
}

/* Edición de clientes */
.client-edit-link { min-width: 0; color: inherit; }
.client-edit-link h2 { display: flex; align-items: center; gap: 6px; }
.client-edit-link h2 span { color: var(--terracotta-deep); font-size: .8rem; }
.client-edit-link p { overflow-wrap: anywhere; }
.client-delete-button { min-width: 36px; min-height: 36px; }
.client-editor .form-help { display: block; color: var(--muted); font-size: .7rem; line-height: 1.45; }


/* Ítems ocasionales y cantidades de medio kilo */
.order-item-add-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.order-item-add-actions .secondary-button { width: 100%; }
.occasional-button { background: #fff4dc; border-color: #e6ca8c; color: #8b641d; }
.order-item-row.is-custom-item { background: #fffaf0; border-color: #ead8ab; }
.custom-item-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(110px, .8fr); gap: 9px; padding-right: 34px; }
.item-numbers { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.occasional-pill { display: inline-flex; margin-left: 5px; padding: 2px 7px; border-radius: 999px; background: #fff0c8; color: #8b641d; font-size: .58rem; font-style: normal; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }
.pending-value { color: #a66d13; font-size: .82rem; }
.detail-totals strong small { color: #a66d13; font-size: .66rem; }

@media (max-width: 520px) {
  .order-item-add-actions, .custom-item-fields { grid-template-columns: 1fr; }
}


/* Visibilidad estricta de los campos del pedido */
[data-catalog-fields][hidden],
[data-custom-fields][hidden],
[data-cost-field][hidden] {
  display: none !important;
}
