/* Shared navigation pages. Phone-specific layout starts at the media query. */
#mobile-navigation, #mobile-cart { display: none; }
.account-card { max-width: 520px; margin: 0 auto 50px; padding: 28px; background: #fffef9; border: 1px solid var(--line); border-radius: 16px; }
.account-avatar { display: grid; place-items: center; background: #e9efe0; color: var(--green); border-radius: 50%; width: 64px; height: 64px; margin-bottom: 18px; }
.account-avatar svg { width: 30px; height: 30px; }
.account-detail { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 18px; font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.account-detail strong { overflow-wrap: anywhere; }
.account-actions { display: grid; gap: 12px; margin-top: 24px; }
.basket-page { max-width: 650px; margin: 0 auto 40px; background: #fffef9; padding: 24px; border: 1px solid var(--line); border-radius: 14px; }
.basket-page .empty-basket { padding: 40px 0; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--green); padding: 0; }
.order-filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 20px; padding-bottom: 4px; }
.order-filters button { flex-shrink: 0; min-height: 44px; padding: 10px 15px; border-radius: 24px; border: 1px solid var(--line); background: #fffef9; }
.order-filters button[aria-pressed="true"] { background: var(--green); color: white; border-color: var(--green); }
.inventory-search { max-width: 460px; margin-bottom: 20px; }
.inventory-search input { width: 100%; }
nav [aria-current="page"] { color: var(--green); font-weight: 800; }
.brand img.brand-mark { display: block; flex-shrink: 0; width: 52px; height: 52px; background: none; border-radius: 14px; box-shadow: 0 4px 12px #24583e2e; }
.brand-text { line-height: 1.1; }
.brand-powered { display: block; margin-top: 5px; font-family: 'DM Sans', sans-serif; font-size: 10px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.brand-powered b { color: var(--orange); font-weight: 800; }
/* Main fills at least one screen below the header, so the footer starts below the fold and appears only on scrolling. */
main { min-height: calc(100vh - 94px); min-height: calc(100svh - 94px); }
.footer-brand { gap: 8px; }
.footer-brand img { border-radius: 8px; }

@media (max-width: 700px) {
  :root { --mobile-nav-height: 70px; }
  html { scroll-padding-top: 78px; }
  body { font-size: 15px; padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 18px); -webkit-text-size-adjust: 100%; }
  body.has-mobile-cart { padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 100px); }
  button, a, input, select, textarea { touch-action: manipulation; }
  button { min-height: 44px; }
  .primary, .nav-outline { min-height: 48px; font-size: 14px; border-radius: 10px; }
  main { padding: 0 16px; width: 100%; min-height: calc(100vh - 66px); min-height: calc(100svh - 66px); }
  .site-header { height: 66px; position: sticky; top: 0; z-index: 10; padding: 0 16px; background: #fffef9f5; backdrop-filter: blur(12px); }
  .brand { font-size: 20px; gap: 9px; }
  .brand small { letter-spacing: 1px; font-size: 6px; }
  .brand img.brand-mark { width: 42px; height: 42px; border-radius: 11px; }
  .brand-powered { font-size: 9px; margin-top: 4px; }
  #navigation { gap: 0; }
  #navigation .desktop-nav, #navigation .user-name { display: none; }
  #navigation button { min-width: 44px; min-height: 44px; font-size: 12px; padding: 9px 12px; }
  #mobile-navigation { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; border-top: 1px solid #dfe5d9; background: #fffef9; box-shadow: 0 -5px 22px #20392d08; }
  #mobile-navigation button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: #798376; border-radius: 12px; min-width: 0; }
  #mobile-navigation button[aria-current="page"] { color: var(--green); font-weight: 700; background: #edf2e7; }
  .nav-icon { position: relative; height: 24px; }
  .nav-icon svg { width: 24px; height: 24px; }
  .nav-count { position: absolute; top: -5px; right: -11px; background: #d38244; color: white; border: 2px solid #fffef9; border-radius: 20px; min-width: 19px; height: 19px; line-height: 15px; font-size: 9px; }
  #mobile-cart:not(:empty) { display: block; position: fixed; left: 16px; right: 16px; bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px); z-index: 19; }
  #mobile-cart>button { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 64px; background: var(--green); color: white; border-radius: 14px; padding: 12px 16px; box-shadow: 0 6px 20px #16332225; text-align: left; }
  .cart-summary-icon svg { width: 25px; height: 25px; }
  #mobile-cart strong { font-size: 13px; }
  #mobile-cart small { display: block; font-size: 10px; color: #d6e4d2; margin-top: 4px; }
  .view-basket-label { margin-left: auto; white-space: nowrap; }

  /* Get shoppers to the products quickly, with the shop identity first. */
  #app[data-screen="shop"] { display: flex; flex-direction: column; }
  .shop-banner { order: 0; display: grid; grid-template-columns: 42px minmax(0,1fr); margin-top: 18px; gap: 8px 11px; padding: 14px; border-radius: 14px; }
  .shop-avatar { height: 42px; width: 42px; flex-shrink: 0; font-size: 27px; }
  .shop-banner>div:nth-child(2) { flex: 1; min-width: 0; }
  .shop-banner .eyebrow { font-size: 8px; letter-spacing: 1px; }
  .shop-banner h2 { margin: 3px 0; font-size: 19px; }
  .shop-banner p { font-size: 11px; line-height: 1.5; }
  .open-badge { grid-column: 2; justify-self: start; margin-left: 0; font-size: 10px; max-width: 100%; padding: 4px 8px; min-height: 24px; }
  .hero { order: 1; display: block; padding: 22px 2px 20px; }
  .hero-art, .hero-copy>.eyebrow, .hero-copy>p { display: none; }
  .hero h1 { font-size: 25px; letter-spacing: -.9px; line-height: 1.28; margin: 0; }
  .hero h1 br { display: none; }
  .hero h1 em { display: block; }
  .hero-benefits { margin-top: 12px; gap: 14px; font-size: 10px; flex-wrap: wrap; }
  .shopping-layout { order: 2; display: block; margin-top: 0; }
  .catalog .section-heading { display: block; margin-bottom: 13px; }
  .catalog .section-heading>div { display: none; }
  .search { width: 100%; min-height: 48px; padding: 0 12px; border-radius: 10px; font-size: 25px; }
  .search input { font-size: 16px; height: 46px; width: 100%; min-width: 0; margin: 0; padding: 0 6px; }
  .categories { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 0 0 6px; margin: 0 -2px 14px; scrollbar-width: none; }
  .categories::-webkit-scrollbar { display: none; }
  .categories button { flex-shrink: 0; min-height: 44px; padding: 10px 15px; border-radius: 24px; font-size: 12px; }
  .product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .product-card { display: flex; flex-direction: column; border-radius: 12px; }
  .product-image { height: 126px; flex-shrink: 0; }
  .product-tag { font-size: 9px; top: 8px; left: 8px; padding: 4px 6px; }
  .product-info { padding: 12px; display: flex; flex-direction: column; flex: 1; }
  .product-info h3 { font-size: 13px; line-height: 1.5; }
  .product-info h3 .tamil-name { font-size: 13px; }
  .product-info>p { font-size: 11px; margin: 7px 0 10px; }
  .product-bottom { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; margin-top: auto; }
  .product-bottom>strong { font-size: 17px; }
  .add-button { width: 100%; justify-content: space-between; font-size: 13px; border-radius: 8px; padding: 7px 12px; min-height: 46px; }
  .quantity { justify-content: space-between; border-radius: 8px; width: 100%; gap: 0; }
  .quantity button { width: 44px; padding: 0; min-width: 44px; font-size: 22px; }
  .quantity span { font-size: 14px; align-self: center; }
  .quantity { height: 46px; align-items: stretch; }
  .quantity button { min-height: 0; }
  .shopping-layout>.basket { display: none; }
  .how-it-works { order: 3; display: none; }
  footer { padding: 25px 16px 14px; margin-top: 28px; }
  footer>span:last-child { display: none; }

  /* Basket, account, and order pages all have a dedicated navigation destination. */
  .page-heading { padding: 23px 0 20px; }
  .page-heading h1 { font-size: 28px; line-height: 1.3; letter-spacing: -.8px; margin: 8px 0; }
  .page-heading p { font-size: 13px; }
  .basket-page { padding: 18px; margin-bottom: 20px; }
  .basket-title h2 { font-size: 19px; }
  .basket-title>span { font-size: 11px; }
  .basket-line { align-items: flex-start; font-size: 13px; }
  .basket-line small { font-size: 12px; line-height: 1.8; }
  .basket-line small button { width: 44px; height: 44px; font-size: 20px; border-radius: 8px; margin-top: 8px; }
  .basket-line small button:first-of-type { margin-left: 0; }
  .basket-total { font-size: 17px; }
  .pickup-note { font-size: 12px; line-height: 1.7; padding: 14px; }
  .pickup-note strong { font-size: 12px; }
  .pickup-note small { font-size: 11px; line-height: 1.6; }
  .basket-footnote { font-size: 10px; }
  .empty-basket h3 { font-size: 15px; }
  .empty-basket p { font-size: 12px; }
  .account-card { padding: 22px; }
  .orders-grid { gap: 16px; }
  .order-card { padding: 17px; border-radius: 13px; }
  .order-heading { align-items: flex-start; flex-wrap: wrap; }
  .order-heading .eyebrow { font-size: 10px; }
  .order-heading small { font-size: 11px; }
  .status { font-size: 11px; padding: 7px 11px; }
  .order-lines>div { font-size: 13px; gap: 12px; }
  .order-lines small { font-size: 11px; }
  .order-bottom>button { width: 100%; margin-top: 6px; }
  .order-bottom>.muted { font-size: 11px; }

  /* Vendor workflow: orders, stock, QR, and account are always one tap away. */
  .vendor-heading { gap: 8px; }
  .vendor-heading>button { display: none; }
  .vendor-heading p { font-size: 12px; }
  .stats { gap: 8px; }
  .stats>div { padding: 13px 10px; border-radius: 10px; }
  .stats span { font-size: 10px; min-height: 30px; line-height: 1.5; }
  .stats strong { font-size: 27px; margin-top: 3px; }
  .vendor-tabs { margin: 21px 0; flex-wrap: wrap; }
  .vendor-tabs button { min-height: 44px; font-size: 12px; border-radius: 9px; flex: 1; }
  .vendor-tabs>span { width: 100%; margin: 0; font-size: 10px; text-align: right; }
  .section-heading { gap: 12px; }
  .section-heading h2 { font-size: 20px; }
  .section-heading p { font-size: 12px; }
  #app[data-screen="stock"] .section-heading { display: grid; grid-template-columns: 1fr auto; }
  #app[data-screen="stock"] .section-heading .primary { white-space: nowrap; padding: 10px 14px; }
  .inventory-summary { font-size: 12px; line-height: 1.8; }
  .inventory-search { max-width: none; }
  .inventory { gap: 13px; }
  .inventory .inventory-card { display: grid; grid-template-columns: 68px minmax(0,1fr); gap: 13px; padding: 15px; border-radius: 13px; }
  .inventory img { width: 68px; height: 76px; }
  .inventory-details { min-width: 0; }
  .inventory h3 { font-size: 14px; }
  .inventory .stock-label { font-size: 12px; line-height: 1.65; }
  .inventory .inventory-details small { font-size: 11px; line-height: 1.7; display: block; }
  .inventory-actions { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; }
  .inventory-actions button { min-height: 46px; font-size: 12px; }

  /* Full-height sheets remain scrollable above the on-screen keyboard. */
  body:has(dialog[open]) { overflow: hidden; }
  dialog { inset: 0; margin: 0; width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; padding: max(20px,env(safe-area-inset-top)) 20px max(24px,env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
  dialog .close { position: sticky; top: 0; float: right; margin: -8px -8px 4px 8px; width: 44px; height: 44px; min-height: 44px; border-radius: 50%; background: #edf1e7; color: var(--green); z-index: 2; font-size: 28px; }
  dialog>.eyebrow { padding-top: 10px; font-size: 9px; }
  dialog h2 { font-size: 23px; line-height: 1.4; clear: none; }
  dialog>p { font-size: 13px; }
  form label, .qr-print label { font-size: 13px; margin: 18px 0; }
  input:not([type="checkbox"]), select, textarea { font-size: 16px; min-height: 48px; padding: 12px; border-radius: 9px; }
  input[type="hidden"] { display: none; }
  .search input { border: 0; padding: 0 6px; background: transparent; }
  .form-row { gap: 12px; }
  .form-row label { min-width: 0; }
  .form-row input, .form-row select { min-width: 0; }
  .small, .muted.small { font-size: 12px; }
  .form-error { font-size: 13px; }
  .role-tabs button { min-height: 46px; font-size: 14px; }
  .switch-auth { font-size: 13px; }
  .switch-auth button { min-height: 44px; }
  #photo-file { max-width: 100%; font-size: 13px; min-height: 48px; }
  .checkbox { display: flex; gap: 12px; min-height: 48px; }
  .checkbox input { width: 23px; height: 23px; flex-shrink: 0; }
  .qr-image { width: min(240px,100%); height: auto; aspect-ratio: 1; }
  .qr-print input { font-size: 13px; }
  #toast { bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 12px); font-size: 13px; padding: 13px 18px; z-index: 25; }
  body.has-mobile-cart #toast { bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 88px); }
  .empty { padding: 40px 8px; }
}
@media (max-width: 350px) {
  main { padding: 0 12px; }
  .product-grid { gap: 8px; }
  .product-info { padding: 10px; }
  .product-image { height: 110px; }
  .product-info h3, .product-info h3 .tamil-name { font-size: 12px; }
  .brand { font-size: 18px; }
  .hero h1 { font-size: 23px; }
  .hero-benefits { gap: 9px; font-size: 9px; }
  dialog { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@media print { #mobile-navigation, #mobile-cart { display: none !important; } }
