/* =====================================================================
   Shells: public site, customer app, panel (shop/admin), rider app.
   ===================================================================== */

/* ------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-dark {
  background: var(--brand-deep);
  border-bottom-color: transparent;
  color: #fff;
}
.topbar-dark a, .topbar-dark .brand-name { color: #fff; }
.topbar-dark .topbar-link { color: rgba(255, 255, 255, 0.82); }
.topbar-dark .topbar-link:hover, .topbar-dark .topbar-link.is-active { color: #fff; background: rgba(255, 255, 255, 0.14); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--sh-brand);
  flex: 0 0 auto;
}
.brand-name { font-size: var(--t-md); line-height: 1.1; }
.brand-sub {
  display: block;
  font-size: 10px;
  font-weight: 650;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  font-weight: 650;
  color: var(--ink-soft);
  transition: all var(--fast);
  position: relative;
}
.topbar-link:hover { background: var(--surface-3); color: var(--ink); }
.topbar-link.is-active { background: var(--brand-soft); color: var(--brand-deep); }
.topbar-link .count-bubble { position: absolute; top: 3px; right: 4px; }
button.topbar-link {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.topbar-loc {
  color: var(--brand-strong);
  background: var(--brand-soft);
  padding: 7px;
  border-radius: var(--r-xs);
}
.topbar-loc:hover { background: var(--brand-muted); color: var(--brand-deep); }

/* ------------------------------------------------------- customer shell */

.app-main { padding: 18px 0 30px; min-height: 60vh; }
.app-main.has-tabbar { padding-bottom: calc(var(--tabbar-h) + 26px); }

@media (min-width: 860px) {
  .app-main.has-tabbar { padding-bottom: 40px; }
}

/* Delivering-to bar */
.addr-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 420;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  transition: transform var(--med);
}
.addr-bar.is-hidden { transform: translateY(-105%); }
.addr-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-block: 6px;
}
.addr-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 1 auto;
  width: auto;
  max-width: min(100%, 420px);
  min-width: 0;
  text-align: left;
  color: var(--ink);
}
.addr-btn .grow {
  flex: 0 1 auto;
  min-width: 0;
}
.addr-btn:hover { color: var(--ink); }
.addr-ic {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.addr-ic .icon { width: 16px; height: 16px; }
.addr-label {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 1.2;
}
.addr-text {
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
  display: block;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addr-search {
  flex: 0 1 360px;
  max-width: 380px;
  min-width: 200px;
  margin-left: auto;
}
.addr-search .input-group > .input,
.addr-search .input-group > .btn {
  height: 32px;
  min-height: 32px;
  box-shadow: none;
}
.addr-search .input-group > .input {
  font-size: 14px;
}
.addr-search .input-group > .btn {
  padding-inline: 12px;
  background: transparent;
  color: var(--ink-muted);
  border-left-color: var(--line);
}
.addr-search .input-group > .btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.addr-search .input-group > .btn .icon { width: 15px; height: 15px; }
.addr-search,
.live-search-form {
  position: relative;
}
.input-group.has-clear > .input {
  padding-right: 34px;
}
.search-clear {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.addr-search .search-clear { right: 48px; }
.search-clear:hover { color: var(--ink); background: var(--line); }
.search-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 480;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  font-size: 12px;
}
.search-suggest-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-muted);
  padding: 6px 10px 2px;
}
.search-suggest-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.3;
}
.search-suggest-item:hover,
.search-suggest-item:focus {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}
.search-suggest-item strong {
  font-size: 12px;
  font-weight: 600;
  color: inherit;
}
.search-suggest-item .muted {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}
[data-live-results].is-live-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.ifsc-result {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  line-height: 1.35;
}
.ifsc-result.is-ok {
  background: var(--ok-50, #ecfdf3);
  border-color: var(--green-200, #a7f3d0);
  color: var(--ok-700, #067647);
}
.ifsc-result.is-bad {
  background: var(--bad-50, #fef3f2);
  border-color: var(--red-200, #fecaca);
  color: var(--bad-700, #b42318);
}
@media (max-width: 859px) {
  .addr-bar-inner { flex-wrap: nowrap; gap: 0; }
  .addr-search { flex: 1 1 auto; width: 100%; max-width: none; min-width: 0; margin-left: 0; }
}

.addr-menu {
  position: absolute;
  left: var(--gutter); right: var(--gutter);
  top: calc(100% + 6px);
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  overflow: hidden;
  display: none;
  z-index: 430;
}
.addr-menu.is-open { display: block; animation: pop-in var(--fast) both; }
.addr-menu-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.addr-menu-item:last-of-type { border-bottom: 0; }
.addr-menu-item:hover { background: var(--surface-2); color: var(--ink); }
.addr-menu-item.is-active { background: var(--brand-soft); }

/* Bottom tab bar */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tabbar-h);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  z-index: 600;
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 860px) { .tabbar { display: none; } }

.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-faint);
  position: relative;
  transition: color var(--fast);
}
.tab.is-active { color: var(--brand-strong); }
.tab.is-active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 3px;
  border-radius: 0 0 var(--r-pill) var(--r-pill);
  background: var(--brand);
}
.tab .count-bubble { position: absolute; top: 8px; right: calc(50% - 20px); }
.tab .tab-flag {
  position: absolute;
  top: 10px;
  right: calc(50% - 16px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn-500);
  border: 1.5px solid var(--surface);
}
.tab .tab-flag.is-bad { background: var(--bad-500); }

.tab-fab {
  flex: 0 0 auto;
  width: 62px;
  display: grid;
  place-items: center;
}
.tab-fab span {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--sh-brand);
  margin-top: -18px;
  border: 3px solid var(--surface);
}

/* Compact green chip — click opens the full cart drawer */
.cart-fab {
  position: fixed;
  left: auto;
  right: 14px;
  bottom: calc(var(--tabbar-h) + 12px);
  z-index: 560;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 250px;
  max-width: calc(100vw - 28px);
  padding: 9px 12px 9px 13px;
  border-radius: var(--r-pill);
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--sh-3);
}
.cart-fab:hover { color: #fff; }
.cart-fab-copy {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.cart-fab-total {
  flex: 0 0 4.6em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 860px) {
  .cart-fab { right: 24px; bottom: 24px; }
}

/* ---------------------------------------------------------- panel shell */

.panel {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}
@media (max-width: 1000px) {
  .panel { grid-template-columns: 1fr; align-content: start; }
  .panel-menu-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 20, 0.42);
    z-index: 610;
  }
  .panel-menu-mask[hidden] { display: none; }
}

.panel-side {
  background: var(--brand-deep);
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.panel-kebab {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  flex: 0 0 auto;
}
.panel-kebab .count-bubble {
  position: absolute;
  top: 4px;
  right: 4px;
}
.panel-drawer { display: contents; }

@media (max-width: 1000px) {
  .panel-side {
    position: sticky;
    top: 0;
    z-index: 620;
    height: auto;
    overflow: visible;
  }
  .panel-kebab { display: grid; }
  .panel.is-menu-open .panel-kebab { background: rgba(255, 255, 255, 0.22); }
  .panel-drawer {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: min(80vh, calc(100dvh - 64px));
    overflow-y: auto;
    background: var(--brand-deep);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    z-index: 621;
  }
  .panel.is-menu-open .panel-drawer { display: block; }
}

.panel-brand {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.panel-brand .brand-mark { background: rgba(255, 255, 255, 0.16); box-shadow: none; }
.panel-brand .panel-brand-name { color: #fff; font-weight: 800; font-size: var(--t-base); line-height: 1.2; }
.panel-brand .panel-brand-sub { display: block; font-size: var(--t-xs); color: rgba(255, 255, 255, 0.6); }

.panel-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}
@media (max-width: 1000px) {
  .panel-nav {
    flex: none;
    flex-direction: column;
    padding: 8px 10px 4px;
  }
}

.panel-nav-group {
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.4);
  padding: 12px 12px 5px;
}
@media (max-width: 1000px) {
  .panel-nav-group { padding: 10px 12px 4px; }
}

.panel-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--t-sm);
  font-weight: 650;
  white-space: nowrap;
  transition: all var(--fast);
}
.panel-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.panel-link.is-active { background: rgba(255, 255, 255, 0.17); color: #fff; }
.panel-link .count-bubble { margin-left: auto; }
.panel-link .panel-link-flag {
  margin-left: auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warn-500);
}

.panel-side-foot {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
@media (max-width: 1000px) {
  .panel-side-foot { border-top: 1px solid rgba(255, 255, 255, 0.12); }
}

.panel-main { min-width: 0; display: flex; flex-direction: column; }

.panel-top {
  position: sticky;
  top: 0;
  z-index: 400;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
body.has-shop-wait .panel-top,
body.has-shop-announce .panel-top {
  top: var(--shop-stack-h, 0px);
}
.panel-title { font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.02em; }
.panel-subtitle { font-size: var(--t-xs); color: var(--ink-muted); }
.panel-top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.orders-search {
  min-width: 220px;
  max-width: 320px;
}

/* Compact header search — same 34px height as .orders-search / .btn-sm */
.panel-top-actions > .input-group {
  min-width: 220px;
}
.panel-top-actions > .input-group > .input {
  min-height: 34px;
  height: 34px;
  padding: 4px 10px;
  font-size: 12px;
}
.panel-top-actions > .input-group > .btn {
  height: 34px;
  min-height: 34px;
  padding: 0 10px;
}
.panel-top-actions > .input-group > .btn .icon { width: 14px; height: 14px; }

@media (max-width: 640px) {
  .panel-top-actions > .input-group {
    flex: 1 1 140px;
    min-width: 0;
  }
}

@media (max-width: 1000px) {
  body.has-queue-tabs .panel-top {
    padding: 8px var(--gutter);
  }
  body.has-queue-tabs .panel-top > .grow { display: none; }
  body.has-queue-tabs .panel-top-actions {
    margin-left: 0;
    width: 100%;
  }
  body.has-queue-tabs .orders-search {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
}

.panel-content { padding: 20px var(--gutter) 40px; flex: 1 1 auto; }
@media (max-width: 640px) { .panel-content { padding-bottom: 30px; } }
@media (max-width: 860px) {
  body.has-shop-tabbar .panel-content {
    padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  }
}

/* Split layout: sticky form on the left, list on the right */
.split {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.split > .split-side { position: sticky; top: 84px; }
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .split > .split-side { position: static; }
}

/* ---------------------------------------------------------- rider shell */

.rider-shell {
  max-width: 640px;
  margin-inline: auto;
  padding: 16px var(--gutter) calc(var(--tabbar-h) + 26px);
}
@media (min-width: 860px) { .rider-shell { padding-bottom: 40px; } }

/* ----------------------------------------------------------- auth shell */

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 26px var(--gutter);
  background:
    radial-gradient(1000px 500px at 12% -8%, var(--brand-soft), transparent 60%),
    radial-gradient(800px 420px at 92% 108%, var(--brand-soft), transparent 60%),
    var(--page);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-3);
  padding: 30px 26px;
}
.auth-card.is-wide { max-width: 700px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-mark {
  width: 54px; height: 54px;
  border-radius: var(--r-md);
  background: var(--brand-gradient);
  color: #fff;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  box-shadow: var(--sh-brand);
}
.auth-head h1 { font-size: var(--t-xl); }
.auth-head p { font-size: var(--t-sm); color: var(--ink-muted); margin-top: 4px; }
.auth-foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: var(--t-sm);
  color: var(--ink-muted);
}

/* Role switcher on login screens */
.role-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.role-switch a {
  padding: 8px 4px;
  border-radius: var(--r-xs);
  text-align: center;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-muted);
}
.role-switch a.is-active { background: var(--surface); color: var(--brand-strong); box-shadow: var(--sh-1); }

/* Step dots for OTP / multi-step forms */
.steps { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 18px; }
.steps span {
  width: 26px; height: 4px;
  border-radius: var(--r-pill);
  background: var(--line-strong);
}
.steps span.is-done { background: var(--brand); }

/* ------------------------------------------------------------- footer */

.site-foot {
  background: var(--slate-900);
  color: rgba(255, 255, 255, 0.62);
  padding: 34px 0 26px;
  font-size: var(--t-sm);
  margin-top: 40px;
}
.site-foot a { color: rgba(255, 255, 255, 0.82); }
.site-foot a:hover { color: #fff; }
.site-foot h4 { color: #fff; font-size: var(--t-sm); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.site-foot-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 26px;
}
@media (max-width: 760px) {
  .site-foot-grid { grid-template-columns: repeat(2, 1fr); }
  .site-foot-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .site-foot-grid { grid-template-columns: 1fr; }
  .site-foot-grid > :first-child { grid-column: auto; }
}
.site-foot-bottom {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  font-size: var(--t-xs);
}
