/* Родной базар — UX design system + adaptive */

:root {
  --bg: #f4f1eb;
  --surface: #ffffff;
  --text: #141714;
  --muted: #6a716a;
  --accent: #701010;
  --accent-hover: #5c0d0d;
  --soft: #f7efe8;
  --border: #e8dfd4;
  --danger: #b42318;
  --warn: #b54708;
  --info: #175cd3;
  --ok: #701010;
  --shadow: 0 2px 12px rgba(20, 23, 20, 0.06);
  --shadow-lg: 0 16px 48px rgba(20, 23, 20, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Manrope', system-ui, sans-serif;
  --max-w: 430px;
  --tap: 44px;
  --page-pad: 20px;
  --content-max: 720px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(112, 16, 16, 0.1), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(112, 16, 16, 0.06), transparent),
    #e8e2d8;
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

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

.app-shell {
  width: 100%;
  max-width: var(--max-w);
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  box-shadow: var(--shadow-lg);
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  animation: fadeIn 0.22s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.scroll-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px var(--page-pad) calc(108px + var(--safe-bottom));
}
.scroll-body.no-tab { padding-bottom: calc(28px + var(--safe-bottom)); }
.scroll-body.tight-top { padding-top: 8px; }
.scroll-body.admin-body { padding-bottom: calc(32px + var(--safe-bottom)); }

h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 700; }
.text-muted { color: var(--muted); font-size: 0.875rem; line-height: 1.45; }
.text-accent { color: var(--accent); font-weight: 600; }
.label-sm {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.admin-field { margin: 0; }
.admin-field .label-sm { margin-bottom: 4px; }
.field-hint {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}
.admin-form > .field,
.admin-form > select.field,
.admin-form > textarea.field,
.admin-form > label.photo-upload,
.admin-form > .photo-preview,
.admin-form > .product-pick-list {
  margin-bottom: 14px;
}
.admin-form > .slot-card { margin-bottom: 12px; }

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--page-pad);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.back-btn {
  width: var(--tap); height: var(--tap);
  border: none; background: var(--surface);
  border-radius: 14px;
  font-size: 1.15rem;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  color: var(--text);
  flex-shrink: 0;
}
.address-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  max-width: 100%;
}
.address-chip .ui-icon { color: var(--accent); flex-shrink: 0; }
.address-chip .chev { color: var(--muted); font-weight: 500; display: inline-flex; }

.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 16px;
  margin-bottom: 16px;
}
.search-box input {
  border: none; background: none; flex: 1;
  outline: none; font-size: 0.95rem;
}
.search-box .ico,
.search-box .ui-icon {
  color: var(--muted);
  opacity: 0.55;
  flex-shrink: 0;
}

.chips {
  display: flex; gap: 8px;
  overflow-x: auto; padding-bottom: 2px; margin-bottom: 16px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  transition: 0.15s ease;
}
.chip.active, .chip:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 4px 0 12px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.section-title .link {
  font-size: 0.8125rem; font-weight: 600; color: var(--accent);
  background: none; border: none; cursor: pointer;
}

.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
  position: relative;
}
.product-card:active { transform: scale(0.98); }
.product-card .img {
  height: 118px;
  display: grid; place-items: center;
  font-size: 2.6rem;
  position: relative;
  overflow: hidden;
}
.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.fav-btn.on { color: #d64545; }
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.promo-row-input {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.promo-row-input .field {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  margin: 0;
}
.promo-row-input .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 7.5rem;
  margin-top: 0;
  padding: 12px 16px;
  font-size: 0.9rem;
  white-space: nowrap;
}
.checkout-promo .label-sm { display: block; margin-bottom: 8px; }
.rating-stars {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
}
.star-btn {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  color: #d0d5d2;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.star-btn.on { color: #f5b301; }
.data-row.warn { background: #fff6e8; }
.product-photo.card,
.product-photo.thumb,
.product-photo.hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-photo.thumb {
  border-radius: 14px;
}
.list-card .thumb {
  overflow: hidden;
}
.product-hero {
  height: 260px;
  display: grid; place-items: center;
  font-size: 5rem; position: relative;
  overflow: hidden;
}
.product-hero.has-photo {
  font-size: 0;
}
.product-hero .back-btn { position: absolute; top: 14px; left: 14px; z-index: 2; }

.photo-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
}
.photo-upload:active { background: var(--soft); }
.photo-preview {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.photo-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.product-admin-row {
  gap: 10px;
}
.product-admin-media {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 1.2rem;
}
.product-admin-media .product-photo.thumb {
  border-radius: 10px;
}
.product-card .info { padding: 12px; }
.product-card .name {
  font-size: 0.84rem; font-weight: 650; margin-bottom: 6px;
  line-height: 1.3; min-height: 2.2em;
}
.product-card .price-row {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.price { font-weight: 800; color: var(--accent); font-size: 0.95rem; }
.old-price {
  text-decoration: line-through; color: var(--muted);
  font-size: 0.75rem; font-weight: 500; margin-left: 2px;
}
.add-btn {
  width: 34px; height: 34px;
  border: none; border-radius: 11px;
  background: var(--accent); color: #fff;
  font-size: 1.2rem; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.cart-qty-pill {
  position: absolute; top: 8px; right: 8px;
  background: var(--text); color: #fff;
  font-size: 0.7rem; font-weight: 700;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  display: grid; place-items: center;
}

.discount-badge {
  position: absolute; top: 8px; left: 8px;
  background: #b42318; color: #fff;
  font-size: 0.68rem; font-weight: 800;
  padding: 4px 7px; border-radius: 8px;
}
.discount-badge.hero { top: 16px; right: 16px; left: auto; font-size: 0.8rem; }
.oos-badge {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.55);
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
}

.cart-bar {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  width: calc(100% - 40px);
  max-width: 520px;
  margin: 0 auto 10px;
  background: var(--accent); color: #fff;
  padding: 15px 18px; border-radius: 16px;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 0.9rem;
  border: none; cursor: pointer;
  box-shadow: 0 10px 28px rgba(42, 97, 72, 0.35);
  z-index: 25;
  flex-shrink: 0;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, var(--max-w));
  max-width: none;
  display: flex;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(10px + var(--safe-bottom));
  z-index: 30;
  flex-shrink: 0;
  margin-top: 0;
}
.screen.active.layout-buyer-tabs {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.screen.layout-buyer-tabs > .cart-bar {
  margin-bottom: calc(56px + var(--safe-bottom));
}
.tab-bar-brand { display: none; }
.tab-bar-items {
  display: flex;
  width: 100%;
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border: none; background: none;
  font-size: 0.65rem; font-weight: 600;
  color: var(--muted); cursor: pointer; position: relative;
}
.tab-item-label { line-height: 1.2; text-align: center; }
.tab-item .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.tab-item .ui-icon { stroke-width: 1.85; }
.tab-item.active .ui-icon { color: var(--accent); }
.tab-item.active { color: var(--accent); }
.tab-badge {
  position: absolute; top: 2px; right: calc(50% - 18px);
  background: var(--danger); color: #fff;
  font-size: 0.6rem; font-weight: 800;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; display: grid; place-items: center;
}

.btn {
  display: block; width: 100%;
  min-height: var(--tap);
  padding: 14px 20px;
  border: 1px solid transparent; border-radius: 14px;
  background: var(--accent); color: #fff;
  font-size: 1rem; font-weight: 700;
  cursor: pointer; text-align: center;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.outline {
  background: var(--surface); color: var(--text);
  border-color: var(--border);
}
.btn.outline:hover { background: var(--soft); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.ghost { background: var(--soft); color: var(--accent); }
.btn + .btn { margin-top: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; margin-top: 0; }

.field {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.95rem;
  margin-bottom: 12px;
  outline: none;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
select.field { appearance: none; }

.list-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: none; width: 100%;
  text-align: left; color: inherit; cursor: pointer;
}
.list-card .thumb {
  width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.7rem; flex-shrink: 0;
}
.list-card .meta { flex: 1; min-width: 0; }
.list-card .meta strong { display: block; font-size: 0.92rem; margin-bottom: 2px; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 34px; height: 34px; border: none; border-radius: 10px;
  background: var(--soft); color: var(--accent);
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.stepper span { font-weight: 700; min-width: 18px; text-align: center; }

.slot-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer; width: 100%;
  text-align: left; color: inherit;
  transition: 0.15s;
}
.slot-card.selected {
  background: var(--soft);
  border-color: var(--accent);
}
.slot-card.disabled { opacity: 0.4; pointer-events: none; }

.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  background: var(--soft); color: var(--accent);
  font-size: 0.72rem; font-weight: 700;
}
.badge.muted { background: #eeebe6; color: var(--muted); }
.badge.warn { background: #fef0c7; color: var(--warn); }
.badge.danger { background: #fee4e2; color: var(--danger); }
.badge.info { background: #d1e0ff; color: var(--info); }
.badge.ok { background: var(--soft); color: var(--ok); }

.status-hero {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.status-hero .big {
  font-size: 1.35rem; font-weight: 800; margin: 6px 0;
}

.timeline { margin: 8px 0 20px; }
.timeline-item {
  display: flex; gap: 14px; position: relative;
  padding-bottom: 18px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute; left: 7px; top: 18px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-item.done::before { background: var(--accent); }
.timeline-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--border); flex-shrink: 0; margin-top: 2px; z-index: 1;
}
.timeline-item.done .timeline-dot { background: var(--accent); }
.timeline-item.current .timeline-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--soft);
}
.timeline-item.current strong { font-weight: 800; }

.hero-full {
  min-height: 52vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.16), transparent 40%),
    linear-gradient(155deg, #c47a7a 0%, #8f2a2a 45%, #701010 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  align-items: flex-start;
  padding: 28px 24px; color: #fff;
}
.brand-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-logo--tab {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(20, 23, 20, 0.08);
}
.brand-logo--admin {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fdfbf4;
  padding: 2px;
}
.brand-logo--wide,
.brand-logo--landing {
  width: min(240px, 78vw);
  max-width: 100%;
  height: auto;
  margin: 0 0 12px;
}
.brand-logo--hero {
  width: min(200px, 62vw);
  margin: 0 0 14px;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.18));
}
.layout-admin .admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.layout-admin .admin-sidebar-brand span {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.hero-full h1 { font-size: 2.4rem; color: #fff; margin-bottom: 8px; }
.hero-full p { opacity: 0.92; font-size: 1rem; line-height: 1.5; max-width: 18em; }

.sticky-footer {
  position: sticky; bottom: 0;
  margin-top: auto;
  padding: 14px var(--page-pad) calc(16px + var(--safe-bottom));
  background: linear-gradient(transparent, var(--bg) 28%);
  z-index: 15;
}

.otp-row { display: flex; gap: 10px; margin: 24px 0; }
.otp-box {
  flex: 1; aspect-ratio: 1; max-width: 64px;
  text-align: center; font-size: 1.45rem; font-weight: 800;
  border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface); outline: none;
}
.otp-box:focus { border-color: var(--accent); }

.map-box {
  height: 140px;
  background:
    linear-gradient(135deg, rgba(42,97,72,.08), transparent),
    repeating-linear-gradient(0deg, transparent, transparent 18px, rgba(42,97,72,.05) 19px),
    repeating-linear-gradient(90deg, transparent, transparent 18px, rgba(42,97,72,.05) 19px),
    #d9e6de;
  border-radius: var(--radius);
  margin: 12px 0;
  display: grid; place-items: center;
  color: var(--muted); font-size: 0.85rem; font-weight: 600;
}
.map-box.tall { height: 42vh; border-radius: 0; margin: 0 -20px 12px; }

.address-map-wrap { margin: 0 0 16px; }
.address-map {
  height: 220px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: #d9e6de;
  z-index: 0;
  overflow: hidden;
}
.address-map-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.address-map-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.address-map-hint { font-size: 0.8rem; }
.address-map-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
  background: var(--soft);
  border-radius: inherit;
}
.address-form .label-sm { margin-top: 12px; }
.address-form .label-sm:first-of-type { margin-top: 0; }
.address-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.address-preview {
  margin: 12px 0 16px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.success-screen {
  text-align: center; padding: 72px 24px 40px;
  flex: 1; display: flex; flex-direction: column; align-items: center;
}
.success-icon {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  margin-bottom: 22px;
  box-shadow: 0 12px 28px rgba(42,97,72,.3);
}
.success-icon .ui-icon { stroke-width: 2.25; }

.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; min-height: var(--tap);
  padding: 14px 16px;
  background: var(--surface); border: none; border-radius: 14px;
  margin-bottom: 8px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; text-align: left; color: var(--text);
  box-shadow: var(--shadow);
}
.settings-row__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.settings-row__left > span:last-child { min-width: 0; }
.settings-row .settings-row__left .ui-icon { color: var(--accent); }
.settings-row > .ui-icon,
.settings-row > .ui-check { color: var(--muted); opacity: 0.45; flex-shrink: 0; }

.courier-badge {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; flex-shrink: 0;
}
.courier-badge.done { background: var(--soft); color: var(--accent); }
.courier-badge.done .ui-icon { stroke-width: 2.25; }
.slot-pick.active-slot { box-shadow: 0 0 0 2px var(--accent); }
.courier-contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.courier-contact-btn {
  margin: 0;
  min-height: 44px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(20,23,20,.42);
  display: grid; place-items: center;
  padding: 24px; z-index: 40;
}
.modal {
  background: var(--surface); border-radius: 22px;
  padding: 26px 22px; width: 100%; max-width: 340px;
  box-shadow: var(--shadow-lg);
}

.admin-header {
  background: linear-gradient(145deg, #2a6148, #1e4634);
  color: #fff;
  padding: 18px var(--page-pad);
  padding-top: max(18px, env(safe-area-inset-top));
  flex-shrink: 0;
}
.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-header-title {
  margin: 0;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}
.admin-header-exit {
  flex-shrink: 0;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}
.admin-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100dvh;
  min-width: 0;
}
.admin-sidebar { display: none; }
.admin-nav-side { display: none !important; }
.admin-sidebar-exit { display: none; }
.admin-nav {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  flex-shrink: 0;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav button {
  flex-shrink: 0; min-height: 34px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 0.78rem; font-weight: 650; cursor: pointer; color: var(--text);
}
.admin-nav button.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.admin-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.kpi-card {
  background: var(--surface); border-radius: 16px;
  padding: 14px; box-shadow: var(--shadow);
}
.kpi-card span { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.kpi-card strong { display: block; font-size: 1.25rem; margin-top: 6px; letter-spacing: -0.02em; }

.data-table {
  width: 100%; background: var(--surface);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
}
.data-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 13px 14px; border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
  background: var(--surface);
  width: 100%;
  border-left: none; border-right: none; border-top: none;
  font-family: inherit; color: inherit; text-align: left;
}
.data-row:last-child { border-bottom: none; }
.data-row.clickable {
  cursor: pointer;
  transition: background 0.12s;
}
.data-row.clickable:active { background: var(--soft); }
.data-row .chev {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}

.courier-row {
  align-items: center;
  gap: 12px;
}
.courier-row__info {
  flex: 1 1 auto;
  min-width: 0;
}
.courier-row__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.courier-row__name {
  font-weight: 700;
  line-height: 1.3;
}
.courier-row__phone {
  margin-top: 4px;
  font-size: 0.875rem;
}
.courier-row__action {
  flex: 0 0 auto;
  width: auto;
  min-width: 7.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 16px;
  margin-top: 0;
}

.role-landing {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 24px;
}
.role-landing .logo {
  font-size: 2.4rem; font-weight: 800; color: var(--accent);
  letter-spacing: -0.03em; margin-bottom: 6px;
}
.role-card {
  display: block; width: 100%;
  padding: 18px 18px;
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  text-align: left; cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.12s;
}
.role-card:active { transform: scale(0.99); }
.role-card:hover { border-color: var(--accent); }
.role-card strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.role-card span { color: var(--muted); font-size: 0.84rem; }

.summary-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.notification-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}
.checkout-steps { display: flex; gap: 6px; margin-bottom: 10px; }
.checkout-steps span {
  flex: 1; height: 4px; border-radius: 2px; background: var(--border);
}
.checkout-steps span.done { background: var(--accent); }
.step-labels {
  display: flex; justify-content: space-between;
  margin-bottom: 18px; font-size: 0.7rem; font-weight: 650; color: var(--muted);
}
.step-labels .on { color: var(--accent); }

.promo-row {
  display: flex; gap: 10px; overflow-x: auto;
  margin-bottom: 16px; scrollbar-width: none;
}
.promo-row::-webkit-scrollbar { display: none; }
.promo-card {
  flex: 0 0 188px;
  background: linear-gradient(145deg, #2a6148, #3d8a62);
  color: #fff; border: none; border-radius: 16px;
  padding: 16px; text-align: left; cursor: pointer;
  box-shadow: var(--shadow);
}
.promo-card strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.promo-card span { font-size: 0.78rem; opacity: 0.9; }
.promo-banner {
  background: var(--soft); color: var(--accent);
  padding: 12px 14px; border-radius: 12px;
  margin-bottom: 12px; font-size: 0.85rem; font-weight: 650;
}

.banner-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.banner-carousel::-webkit-scrollbar { display: none; }

.ad-banner-card {
  flex: 0 0 min(88%, 320px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  scroll-snap-align: start;
  color: inherit;
  padding: 0;
}
.ad-banner-media {
  position: relative;
  height: 148px;
  background: linear-gradient(145deg, #e3efe8, #c8ddd2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ad-banner-media .banner-photo,
.ad-banner-media .banner-photo.card {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner-photo-placeholder,
.ad-banner-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--accent);
  opacity: 0.5;
}
.ad-banner-copy {
  padding: 14px 16px 16px;
}
.ad-banner-copy strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 6px;
  line-height: 1.25;
}
.ad-banner-copy p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}
.ad-banner-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

.banner-hero {
  position: relative;
  min-height: 220px;
  background: linear-gradient(145deg, #2a6148, #3d8a62);
  display: grid;
  place-items: end;
}
.banner-hero.has-photo { background: #1a1c1a; min-height: 260px; }
.banner-hero .back-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}
.banner-photo.hero {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner-hero.has-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.45));
}

.banner-admin-thumb {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent);
}
.banner-admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.banner-active {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--soft);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  cursor: pointer; width: 100%; text-align: left; color: inherit;
}
.banner-active .pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--soft);
  flex-shrink: 0;
}

.empty-state {
  text-align: center; padding: 48px 16px;
}
.empty-state .illus {
  width: 72px; height: 72px; border-radius: 24px;
  background: var(--soft); color: var(--accent);
  display: grid; place-items: center;
  font-size: 1.8rem; margin: 0 auto 16px;
}

.progress-bar {
  height: 8px; background: var(--border); border-radius: 999px;
  overflow: hidden; margin: 10px 0 16px;
}
.progress-bar > i {
  display: block; height: 100%; background: var(--accent);
  border-radius: 999px; transition: width 0.2s;
}

.next-card {
  background: var(--accent); color: #fff;
  border-radius: 20px; padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 10px 28px rgba(42,97,72,.28);
}
.next-card .label { opacity: 0.8; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.next-card h2 { color: #fff; margin: 6px 0; }
.next-card p { opacity: 0.9; font-size: 0.9rem; }

.assemble-row { cursor: pointer; }
.assemble-row input {
  width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0;
}
.assemble-row.done { opacity: 0.55; }
.assemble-row.done strong { text-decoration: line-through; }

.chat-body { display: flex; flex-direction: column; gap: 10px; min-height: 55vh; }
.admin-chat-body {
  min-height: 40vh;
  max-height: 48vh;
  overflow-y: auto;
  padding: 4px 2px 8px;
  margin-bottom: 8px;
}
.chat-bubble {
  max-width: 82%; padding: 12px 14px; border-radius: 16px;
  font-size: 0.9rem; line-height: 1.4;
  position: relative;
}
.chat-bubble.admin { align-self: flex-start; background: var(--surface); box-shadow: var(--shadow); }
.chat-bubble.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.chat-time {
  display: block;
  margin-top: 6px;
  font-size: 0.7rem;
  opacity: 0.7;
}
.chat-form { margin-top: auto; padding-top: 12px; }

.attention {
  background: #fff8f0; border: 1px solid #f9dbaf;
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 0.85rem;
}
.attention strong { color: var(--warn); }

.load-bar {
  height: 6px; background: var(--border); border-radius: 999px;
  overflow: hidden; margin-top: 8px;
}
.load-bar > i { display: block; height: 100%; background: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 110px;
  transform: translateX(-50%) translateY(16px);
  background: var(--text); color: #fff;
  padding: 12px 16px; border-radius: 12px;
  font-size: 0.85rem; font-weight: 650;
  opacity: 0; pointer-events: none;
  transition: 0.22s; z-index: 200;
  max-width: min(420px, calc(100vw - 40px));
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Shift calendar */
.cal-week-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.cal-week-nav strong {
  font-size: 0.95rem; letter-spacing: -0.02em; text-align: center;
}
.cal-nav-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 1.35rem; line-height: 1; cursor: pointer; color: var(--text);
  box-shadow: var(--shadow);
}
.cal-nav-btn:active { background: var(--soft); }
.cal-days {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; margin-bottom: 14px;
}
.cal-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: inherit; color: var(--text);
  min-height: 64px;
}
.cal-day-name { font-size: 0.65rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.cal-day-num { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; }
.cal-day-dots { font-size: 0.45rem; color: var(--accent); letter-spacing: 1px; min-height: 8px; }
.cal-day.today { border-color: var(--accent); }
.cal-day.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.cal-day.active .cal-day-name,
.cal-day.active .cal-day-dots { color: rgba(255,255,255,.75); }
.cal-grid-scroll {
  overflow-x: auto; margin: 0 -4px 8px;
  padding-bottom: 4px; -webkit-overflow-scrolling: touch;
}
.cal-grid {
  width: 100%; min-width: 420px;
  border-collapse: separate; border-spacing: 4px;
  font-size: 0.72rem;
}
.cal-grid th, .cal-grid td {
  text-align: center; padding: 0; vertical-align: middle;
}
.cal-grid thead th {
  font-weight: 700; color: var(--muted); font-size: 0.68rem;
  line-height: 1.25; padding: 4px 0;
}
.cal-grid thead th.active-col { color: var(--accent); }
.cal-grid thead th span { font-weight: 800; color: var(--text); font-size: 0.85rem; }
.cal-grid thead th.active-col span { color: var(--accent); }
.cal-grid tbody th {
  text-align: left; font-size: 0.72rem; font-weight: 700;
  white-space: nowrap; padding-right: 6px; color: var(--text);
}
.cal-grid tr.focus-row th { color: var(--accent); }
.cal-cell {
  width: 100%; min-width: 40px; height: 36px;
  border-radius: 10px; border: 1px dashed var(--border);
  background: var(--bg); color: var(--muted);
  font-size: 0.7rem; font-weight: 700; cursor: pointer;
  font-family: inherit;
}
.cal-cell.filled {
  border-style: solid; border-color: var(--accent);
  background: var(--soft); color: var(--accent);
}
.cal-cell.selected {
  box-shadow: 0 0 0 2px var(--accent);
}
.cal-cell:active { transform: scale(0.96); }

.profile-header { margin-bottom: 18px; }
.greeting { font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }

.line-total { font-size: 0.8rem; color: var(--muted); }

.trust-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 12px 0 4px;
}
.trust-pill {
  font-size: 0.72rem; font-weight: 650; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 999px;
}

/* Layout helpers */
.home-top {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.home-top .address-chip,
.home-top .search-box { width: 100%; }
.home-top .search-box { margin-bottom: 0; }

.cart-layout,
.cart-items,
.cart-aside { display: block; }
.cart-aside .btn { width: 100%; margin-top: 10px; }
.cart-aside .btn:first-of-type { margin-top: 0; }
.cart-summary { margin-bottom: 12px; }

.orders-grid { display: grid; gap: 12px; }
.order-card { margin-bottom: 0; }

.profile-panel { margin-bottom: 8px; }
.profile-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}
.profile-auth-actions .btn {
  width: 100%;
  margin-top: 0;
}
.profile-auth-actions .btn + .btn { margin-top: 0; }
.settings-grid { display: grid; gap: 8px; }
.profile-logout { width: 100%; margin-top: 24px; }
.staff-grid { display: grid; gap: 10px; }

.auth-hub { width: 100%; }
.auth-hub-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.auth-hub-grid {
  display: grid;
  gap: 12px;
}
.auth-hub-col {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.auth-hub-label {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-hub-buyer-actions {
  display: grid;
  gap: 10px;
}
.profile-panel--guest {
  flex-direction: column;
  align-items: stretch;
}
.profile-panel--guest .profile-header {
  margin-bottom: 0;
}
.profile-panel--guest .auth-hub {
  margin-top: 4px;
}

.page-narrow {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}

/* ——— Tablet (≥768px) ——— */
@media (min-width: 768px) {
  :root {
    --max-w: 960px;
    --page-pad: 28px;
    --content-max: 680px;
  }

  body {
    padding: 20px;
    align-items: center;
  }

  .app-shell {
    max-width: var(--max-w);
    width: 100%;
    height: calc(100dvh - 40px);
    max-height: calc(100dvh - 40px);
    min-height: calc(100dvh - 40px);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
  }

  .screen,
  .admin-shell {
    min-height: 0;
    flex: 1;
    max-height: 100%;
  }

  .screen.active {
    overflow: hidden;
  }

  .scroll-body {
    min-height: 0;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.35rem; }

  .home-top {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }
  .home-top .address-chip {
    min-height: 52px;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
  }
  .home-top .search-box { margin-bottom: 0; }

  .banner-carousel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    overflow: visible;
    scroll-snap-type: none;
    padding-bottom: 0;
  }
  .ad-banner-card {
    flex: none;
    width: 100%;
    min-width: 0;
  }
  .ad-banner-media { height: 160px; }

  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .product-card .img { height: 148px; }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .promo-row {
    gap: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    overflow: visible;
  }
  .promo-card { flex: none; width: 100%; padding: 18px; }

  .chips { gap: 10px; flex-wrap: wrap; }

  .layout-landing .role-landing {
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
  }
  .layout-landing .staff-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .auth-hub-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .hero-full {
    min-height: 42vh;
    padding: 40px 36px;
  }
  .hero-full h1 { font-size: 2.8rem; }
  .hero-full p { max-width: 22em; font-size: 1.05rem; }

  .product-hero { height: 320px; }

  .map-box { height: 200px; }
  .map-box.tall { height: 36vh; margin-left: calc(-1 * var(--page-pad)); margin-right: calc(-1 * var(--page-pad)); }

  .tab-item { font-size: 0.72rem; padding: 10px 6px; }
  .tab-item .ui-icon { width: 26px; height: 26px; }

  .layout-buyer .scroll-body.no-tab,
  .layout-buyer .top-bar + .scroll-body {
    max-width: calc(var(--content-max) + var(--page-pad) * 2);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  .layout-buyer .scroll-body.no-tab > .btn,
  .layout-buyer .scroll-body.no-tab form,
  .layout-buyer .scroll-body.no-tab .field {
    max-width: var(--content-max);
  }

  .field { max-width: 100%; }
  form .field,
  form .btn,
  #register-form .field,
  #register-form .btn,
  #add-courier-form .field,
  #add-courier-form .btn { max-width: 100%; }

  .otp-row { max-width: 320px; }

  .modal { max-width: 420px; }

  .summary-box,
  .list-card,
  .slot-card,
  .settings-row,
  .notification-card,
  .data-table { max-width: none; }

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

  .cal-grid { min-width: 0; }
  .cal-grid-scroll { overflow-x: visible; }
  .cal-cell { min-width: 56px; height: 44px; font-size: 0.78rem; }

  .courier-contact-row { max-width: 420px; }

  .chat-body { min-height: 50vh; max-width: 720px; }
  .admin-chat-body { max-height: 56vh; }

  .toast { bottom: 36px; }

  .success-screen { padding-top: 96px; }

  .cart-bar {
    width: auto;
    margin-left: var(--page-pad);
    margin-right: var(--page-pad);
  }
}

/* ——— Admin tablet+ (≥900px) ——— */
@media (min-width: 900px) {
  .screen.layout-admin > .admin-shell {
    flex-direction: row;
  }
  .layout-admin .admin-sidebar {
    display: flex;
    flex-direction: column;
    width: 232px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #701010 0%, #5c0d0d 100%);
    color: #fff;
    padding: 24px 16px 20px;
    gap: 8px;
  }
  .layout-admin .admin-sidebar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    padding: 0 10px;
  }
  .layout-admin .admin-sidebar-sub {
    font-size: 0.78rem;
    opacity: 0.7;
    padding: 0 10px 16px;
    margin: 0;
  }
  .layout-admin .admin-nav-top { display: none !important; }
  .layout-admin .admin-nav-side {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
    padding: 0;
    background: transparent;
    border: none;
    flex: 1;
  }
  .layout-admin .admin-nav-side button {
    width: 100%;
    text-align: left;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    padding: 12px 14px;
    font-size: 0.88rem;
    min-height: 44px;
  }
  .layout-admin .admin-nav-side button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  .layout-admin .admin-nav-side button.active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: none;
  }
  .layout-admin .admin-sidebar-exit {
    display: block;
    width: 100%;
    margin-top: 12px;
    background: transparent !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
  }
  .layout-admin .admin-header-exit { display: none !important; }
  .layout-admin .admin-header {
    background: var(--bg);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding: 20px var(--page-pad) 16px;
  }
  .layout-admin .admin-header-title { color: var(--text) !important; font-size: 1.45rem; }
  .layout-admin .admin-body { padding-top: 24px; }
  .layout-admin .admin-main { background: var(--bg); }

  .kpi-grid { grid-template-columns: repeat(4, 1fr); }

  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .settings-grid .settings-row { margin-bottom: 0; }
}

/* ——— Desktop (≥1100px) ——— */
@media (min-width: 1100px) {
  :root {
    --max-w: 1280px;
    --page-pad: 36px;
    --content-max: 760px;
  }

  body { padding: 28px; }

  .app-shell {
    min-height: calc(100dvh - 56px);
    height: calc(100dvh - 56px);
    max-height: calc(100dvh - 56px);
    border-radius: 32px;
  }

  .screen,
  .admin-shell {
    min-height: 0;
  }

  /* Buyer: sidebar navigation */
  .screen:not(.active) {
    display: none !important;
  }
  .screen.active.layout-buyer-tabs {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: hidden;
  }
  .screen.layout-buyer-tabs > .cart-bar {
    margin-bottom: 0;
  }
  .screen.layout-buyer-tabs > .scroll-body {
    grid-column: 2;
    grid-row: 1;
    padding: 28px var(--page-pad) 32px;
    max-width: none;
    padding-bottom: 32px;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .screen.layout-buyer-tabs > .cart-bar {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    max-width: none;
    margin: 0 var(--page-pad) 20px;
  }
  .screen.layout-buyer-tabs > .tab-bar {
    grid-column: 1;
    grid-row: 1 / -1;
    position: sticky;
    top: 0;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    align-self: stretch;
    height: auto;
    min-height: 100%;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    border-top: none;
    border-right: 1px solid var(--border);
    border-bottom: none;
    padding: 24px 14px calc(24px + var(--safe-bottom));
    margin-top: 0;
    background: var(--surface);
  }
  .screen.layout-buyer-tabs > .tab-bar .tab-bar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 22px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .tab-bar-mark {
    display: none;
  }
  .tab-bar-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
  }
  .screen.layout-buyer-tabs > .tab-bar .tab-bar-items {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }
  .screen.layout-buyer-tabs > .tab-bar .tab-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
    transition: background 0.15s, color 0.15s;
  }
  .screen.layout-buyer-tabs > .tab-bar .tab-item:hover {
    background: var(--soft);
  }
  .screen.layout-buyer-tabs > .tab-bar .tab-item.active {
    background: var(--soft);
    color: var(--accent);
  }
  .screen.layout-buyer-tabs > .tab-bar .tab-item-label {
    text-align: left;
  }

  /* Product detail: image + info side by side */
  .screen.active.layout-product {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
  }
  .screen.layout-product > .product-hero {
    grid-row: 1 / 3;
    height: auto;
    min-height: 100%;
    border-radius: 0;
  }
  .screen.layout-product > .scroll-body {
    padding-top: 32px;
    padding-bottom: 16px;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .screen.layout-product > .sticky-footer {
    grid-column: 2;
    background: var(--bg);
    border-top: 1px solid var(--border);
  }
  .screen.layout-product > .sticky-footer .btn {
    max-width: 360px;
  }

  /* Home */
  .layout-home .home-top {
    grid-template-columns: 1.1fr 0.9fr;
    margin-bottom: 24px;
  }
  .layout-home .banner-carousel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
  }
  .layout-home .ad-banner-media { height: 176px; }

  /* Cart */
  .layout-cart .cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
  }
  .layout-cart .cart-aside {
    position: sticky;
    top: 16px;
  }
  .layout-cart .cart-aside .btn { margin-top: 12px; }

  /* History */
  .layout-history .orders-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  /* Profile */
  .layout-profile .profile-panel {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
  }
  .layout-profile .profile-header { margin-bottom: 0; }
  .layout-profile .profile-auth-actions {
    flex-direction: row;
    min-width: 320px;
    margin-bottom: 0;
  }
  .layout-profile .profile-auth-actions .btn {
    flex: 1;
    min-width: 0;
  }
  .layout-profile .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .layout-profile .profile-logout {
    max-width: 280px;
  }

  .product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }

  .product-card:hover {
    box-shadow: 0 8px 28px rgba(20, 23, 20, 0.1);
    transform: translateY(-2px);
  }
  .product-card:active { transform: translateY(0); }

  /* Narrow forms centered */
  .layout-buyer .scroll-body.no-tab,
  .screen:has(#register-form) .scroll-body,
  .screen:has(#support-form) .scroll-body.chat-body,
  .layout-landing .role-landing {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .checkout-steps,
  .step-labels {
    max-width: 560px;
  }

  .scroll-body:has(.slot-card),
  .scroll-body:has(.checkout-steps) {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }

  .promo-card { flex: none; width: 100%; }

  .kpi-grid { gap: 16px; }
  .kpi-card { padding: 18px; }
  .kpi-card strong { font-size: 1.45rem; }

  .layout-admin .admin-sidebar { width: 248px; padding: 28px 18px 20px; }

  .data-row { padding: 16px 18px; font-size: 0.9rem; }

  .cal-days { gap: 10px; max-width: none; }
  .cal-day { min-height: 72px; padding: 12px 4px; }
}

/* ——— Wide desktop (≥1400px) ——— */
@media (min-width: 1400px) {
  :root { --max-w: 1440px; }

  .product-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .layout-admin .admin-sidebar { width: 268px; }

  .layout-history .orders-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .layout-home .banner-carousel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Hover affordance for pointer devices */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { filter: brightness(1.03); }
  .list-card:hover,
  .slot-card:hover,
  .settings-row:hover,
  .role-card:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  }
  .data-row.clickable:hover { background: var(--soft); }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .product-card,
  .role-card,
  .cal-cell { transition: none; }
}

/* ——— UI icons ——— */
.ui-icon {
  display: block;
  flex-shrink: 0;
}
.ui-icon--xs { width: 14px; height: 14px; }
.ui-icon--sm { width: 18px; height: 18px; }
.ui-icon--md { width: 22px; height: 22px; }
.ui-icon--tab { width: 24px; height: 24px; }
.ui-icon--lg { width: 32px; height: 32px; }
.ui-icon--xl { width: 36px; height: 36px; }

.ui-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.ui-icon-box--lg {
  width: 100%;
  height: 100%;
}
.ui-icon-box--lg .ui-icon {
  width: 42%;
  height: 42%;
  opacity: 0.55;
}

.ui-check {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
}

.list-card .chev {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.thumb.thumb-icon {
  display: grid;
  place-items: center;
  color: var(--accent);
}

.slot-card__pay {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.cal-nav-btn {
  display: inline-grid;
  place-items: center;
}
.cal-nav-btn .ui-icon { stroke-width: 2; }

.product-card .img .ui-icon-box--lg .ui-icon {
  opacity: 0.45;
}

.badge .ui-check { color: inherit; }

.settings-badge {
  margin-left: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-item {
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
  border-left: 3px solid transparent;
}
.notification-item.unread {
  border-left-color: var(--accent);
  background: rgba(42, 97, 72, 0.06);
}

.analytics-bars {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.analytics-bar-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 0.8125rem;
}
.analytics-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border, #e2ddd4);
  overflow: hidden;
}
.analytics-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

