/* JacksonMarkets — Premium iOS App Design */

:root {
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --bg-elevated: #3a3a3c;
  --bg-grouped: #000000;
  --text-primary: #ffffff;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.3);
  --accent: #007aff;
  --accent-tint: #0a84ff;
  --success: #34c759;
  --danger: #ff3b30;
  --separator: rgba(84, 84, 88, 0.65);
  --separator-opaque: #38383a;
  --overlay: rgba(0, 0, 0, 0.4);
  --card-bg: rgba(28, 28, 30, 0.95);
  --sheet-bg: rgba(28, 28, 30, 0.98);
  --blur-bg: rgba(18, 18, 18, 0.85);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
  --radius-sm: 30px;
  --radius-md: 30px;
  --radius-lg: 30px;
  --radius-xl: 30px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --header-height: 116px;
  --footer-height: 84px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f2f2f7;
    --bg-tertiary: #ffffff;
    --bg-elevated: #ffffff;
    --bg-grouped: #ffffff;
    --text-primary: #000000;
    --text-secondary: rgba(60, 60, 67, 0.6);
    --text-tertiary: rgba(60, 60, 67, 0.3);
    --accent: #007aff;
    --accent-tint: #0a84ff;
    --success: #34c759;
    --danger: #ff3b30;
    --separator: rgba(60, 60, 67, 0.29);
    --separator-opaque: #c6c6c8;
    --overlay: rgba(0, 0, 0, 0.3);
    --card-bg: rgba(255, 255, 255, 0.95);
    --sheet-bg: rgba(255, 255, 255, 0.98);
    --blur-bg: rgba(255, 255, 255, 0.85);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  max-width: 1300px;
  margin: 0 auto;
  position: relative;
}

body.install-mode .app-header,
body.install-mode .tab-bar {
  display: none !important;
}
body.install-mode .main-content {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ── Installation Intro ─────────────────────────────────────────── */
.install-intro-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: #06060f;
  overflow: hidden;
  z-index: 9999;
  transition: opacity 1.3s cubic-bezier(.4,0,.2,1), transform 1.3s cubic-bezier(.4,0,.2,1);
}
.install-intro-screen.intro-exit {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.intro-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.install-intro-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Logo ring */
.intro-logo-ring {
  width: clamp(56px, 14vw, 88px);
  height: clamp(56px, 14vw, 88px);
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(255,255,255,.12);
  display: grid;
  place-items: center;
  margin-bottom: clamp(18px, 4vw, 28px);
  animation: logoRingIn 600ms cubic-bezier(.34,1.56,.64,1) both;
  box-shadow: 0 0 0 0 rgba(100,130,255,.4);
}
.intro-logo-ring::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(100,130,255,.18);
  animation: ringPulse 1.8s ease-out infinite;
  animation-delay: .7s;
}
.intro-logo-img {
  width: 55%;
  height: 55%;
  object-fit: contain;
  filter: brightness(1.15);
}

/* Letters */
.install-intro-word {
  display: flex;
  gap: .01em;
  font-size: clamp(46px, 11vw, 96px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #fff;
}
.intro-letter {
  display: inline-block;
  animation: letterDrop 500ms cubic-bezier(.34,1.56,.64,1) both;
  text-shadow: 0 0 30px rgba(110,140,255,.6), 0 2px 18px rgba(0,0,0,.6);
}

.install-intro-sub {
  margin-top: clamp(10px, 2vw, 16px);
  font-size: clamp(11px, 2.5vw, 14px);
  color: rgba(255,255,255,.45);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: subFadeUp 700ms ease both;
  animation-delay: 700ms;
}

.install-intro-tagline {
  margin-top: 6px;
  font-size: clamp(11px, 2.5vw, 14px);
  font-weight: 400;
  color: rgba(255,255,255,.45);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.6;
  max-width: 380px;
}
.tagline-word {
  display: inline-block;
  opacity: 0;
  animation: wordFadeUp 500ms cubic-bezier(.22,1,.36,1) forwards;
}
@keyframes wordFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Exit: whole center group fade-scale */
.install-intro-screen.intro-exit .install-intro-center {
  animation: centerExit 420ms ease forwards;
}

@keyframes logoRingIn {
  from { opacity: 0; transform: scale(.4) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes ringPulse {
  0%   { transform: scale(1);   opacity: .5; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes letterDrop {
  from { opacity: 0; transform: translateY(-40px) scale(.7); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0)     scale(1);  filter: blur(0); }
}
@keyframes subFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes centerExit {
  to { opacity: 0; transform: scale(1.1) translateY(-10px); filter: blur(6px); }
}

.install-auth-section {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 20px;
  overflow-y: auto;
  background:
    radial-gradient(ellipse 80% 50% at 35% 30%, rgba(80,100,255,.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 75% 75%, rgba(94,92,230,.1), transparent 60%),
    #06060f;
  animation: sectionReveal 900ms cubic-bezier(.4,0,.2,1) both;
  z-index: 100;
}
@keyframes sectionReveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pw-wrap {
  position: relative;
}
.pw-wrap .form-input {
  padding-right: 48px;
}
.pw-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: rgba(255,255,255,.4);
  display: flex;
  align-items: center;
  line-height: 1;
}
.pw-toggle:hover { color: rgba(255,255,255,.75); }
.pw-toggle svg { width: 20px; height: 20px; }

.install-tagline-form {
  margin: 4px 0 0;
  font-size: clamp(11px, 2.5vw, 13px);
  color: rgba(255,255,255,.38);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.5;
}

.install-hero {
  text-align: center;
  margin-bottom: 6px;
  animation: installFadeUp 420ms ease both;
}
.install-logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
}
.install-logo {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 14px;
}
.install-title {
  margin: 0 0 6px;
  font-size: 44px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  letter-spacing: .01em;
}
.install-desc {
  margin: 0 auto;
  max-width: 540px;
  color: var(--text-secondary);
  font-size: 14px;
}
.install-steps {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.install-step {
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--separator);
  border-radius: 999px;
  padding: 6px 10px;
}
.install-step.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}
.install-progress {
  position: relative;
  margin: 14px auto 16px;
  width: min(520px, 92%);
  height: 26px;
}
.install-progress-line {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  background: var(--separator);
  overflow: hidden;
}
.install-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #007aff 0%, #0a84ff 100%);
  transition: width 360ms ease;
}
.install-progress-nodes {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.install-progress-labels {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}
.install-progress-labels .active {
  color: var(--accent);
  font-weight: 700;
}
.install-progress-labels .done {
  color: var(--text-primary);
}
.install-progress-ring {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid var(--separator-opaque);
  background: var(--bg-primary);
  box-shadow: 0 0 0 4px var(--bg-primary);
  transition: transform 220ms ease, border-color 220ms ease, background-color 220ms ease;
}
.install-progress-ring.active {
  border-color: #0a84ff;
  transform: scale(1.05);
}
.install-progress-ring.done {
  border-color: #0a84ff;
  background: #0a84ff;
}
.install-progress-ring.blink {
  animation: installBlink 900ms ease-in-out infinite;
}
@keyframes installBlink {
  0%, 100% { box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 0 rgba(10,132,255,.25); }
  50% { box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 7px rgba(10,132,255,.22); }
}
.install-card {
  background: rgba(255,255,255,.04) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  box-shadow: 0 8px 40px rgba(0,0,0,.5) !important;
  animation: installFadeUp 520ms ease both;
}

/* ── Install form dark-theme text overrides ─────────────────────── */
.install-auth-section .auth-title,
.install-auth-section .install-title {
  color: rgba(255,255,255,.92);
}
.install-auth-section .auth-desc {
  color: rgba(255,255,255,.45);
}
.install-auth-section .form-label {
  color: rgba(255,255,255,.55);
}
.install-auth-section .form-hint {
  color: rgba(255,255,255,.3);
}
.install-auth-section .form-input,
.install-auth-section .form-textarea {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
}
.install-auth-section .form-input::placeholder,
.install-auth-section .form-textarea::placeholder {
  color: rgba(255,255,255,.25);
}
.install-auth-section .form-input:focus,
.install-auth-section .form-textarea:focus {
  background: rgba(255,255,255,.1);
  border-color: rgba(110,130,255,.6);
}
.install-auth-section .btn-secondary {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
}
.install-auth-section .install-progress-ring {
  border-color: rgba(255,255,255,.2);
}
.install-auth-section .install-progress-line {
  background: rgba(255,255,255,.12);
}
.install-form-step {
  display: none;
}
.install-form-step.active {
  display: block;
}
@keyframes installFieldIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes installFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 50%;
  width: min(100%, 1300px);
  transform: translateX(-50%);
  background: rgba(18, 18, 18, 0.8);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: var(--safe-top) 20px 12px;
  z-index: 100;
  transition: padding 0.28s ease, background-color 0.28s ease;
  overscroll-behavior: none;
  touch-action: manipulation;
}
@media (prefers-color-scheme: light) {
  .app-header {
    background: rgba(255, 255, 255, 0.8);
  }
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.28s ease, padding 0.28s ease, margin 0.28s ease;
  max-height: 90px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  max-width: 68%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 40px;
  width: 40px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 20%;
}
#home-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.header-text {
  min-width: 0;
}

.header-title {
  margin: 0;
  font-size: clamp(15px, 4vw, 21px);
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  margin: 2px 0 0;
  font-size: clamp(8.5px, 2.25vw, 10px);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.13em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.icon-button:active {
  transform: scale(0.92);
  opacity: 0.7;
}
.icon-button svg {
  width: 22px;
  height: 22px;
}

.cart-button {
  position: relative;
}
.cart-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  padding: 0 6px;
  border: 2px solid var(--bg-primary);
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 40px;
    padding: 0 12px;
    height: 46px;
    margin-top: 10px;
    transition: margin-top 0.28s ease;
}

.app-header.compact {
  padding-bottom: 8px;
  padding-top: 8px;
  background: transparent !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.app-header.compact .header-content {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  pointer-events: none;
}
.app-header.compact .search-bar {
  margin-top: 0;
}
.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 17px;
  padding: 0 0 0 8px;
  outline: none;
}
.search-bar input::placeholder {
  color: var(--text-secondary);
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 0;
  padding: 12px 20px;
  background: var(--bg-primary);
  border-bottom: 0.5px solid var(--separator);
}

.category-tabs-wrapper {
  display: flex;
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 40px;
  padding: 2px;
  gap: 0;
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-tabs-wrapper::-webkit-scrollbar { display: none; }

.category-tab {
  flex-shrink: 0;
  padding: 9px 16px;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.category-tab:active {
  transform: scale(0.98);
}
.category-tab.active {
  color: var(--text-primary);
}
.category-tab.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 40px;
  z-index: -1;
  animation: segmentFadeIn 0.3s ease;
}

@keyframes segmentFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Main Content */
.main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary);
  padding-top: var(--header-height);
  padding-bottom: calc(var(--footer-height) + 24px);
  scroll-padding-top: var(--header-height);
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.main-content::-webkit-scrollbar {
  display: none;
}

@media (display-mode: standalone) {
  .main-content {
    padding-bottom: calc(var(--footer-height) + var(--safe-bottom) + 44px);
  }
}

.view { display: block; }
.view.hidden { display: none; }

/* Department Nav */
.dept-nav {
  display: flex;
  gap: 8px;
  padding: 24px 20px 12px;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dept-nav::-webkit-scrollbar { display: none; }

.dept-nav-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.dept-nav-btn:active {
  transform: scale(0.96);
}
.dept-nav-btn.active {
  background: var(--accent);
  color: #fff;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem 0.7rem;
}

/* Department Header */
.dept-header {
  padding: 1.5rem 1.25rem;
  margin: 0 0.7rem 0.7rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border-bottom: 1px solid var(--separator);
}

.dept-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.dept-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dept-delivery {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.dept-desc {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.product-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.product-card:active {
  transform: scale(0.97);
}

.product-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-elevated);
  overflow: hidden;
}
.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-name {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.product-unit {
  font-size: 16px;
  color: var(--text-secondary);
  margin-left: 2px;
  font-weight: 400;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  padding: 0 20px;
  height: 50px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active {
  transform: scale(0.96);
  opacity: 0.8;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn:disabled:active {
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid ButtonBorder;
}

.btn-danger {
  background: #ff3b30;
  color: #fff;
}
.btn-danger:active {
  background: #d32f2f;
}

.btn-large {
  height: 56px;
  font-size: 18px;
  font-weight: 700;
}

.btn-block {
  width: 100%;
}

/* Segmented Controls (Reusable) */
.segmented-control {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 40px;
  padding: 2px;
  gap: 0;
  position: relative;
  overflow: hidden;
}

.segment-selector {
  position: absolute;
  top: 3.5px;
  bottom: 3.5px;
  background: var(--bg-tertiary);
  border-radius: 40px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  z-index: 0;
  transform-origin: center;
}

.tab-bar .segment-selector {
  top: 3.5px;
  bottom: 3.5px;
}

.segment-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 20px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.3s ease;
  cursor: pointer;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  background: transparent;
  border: none;
}
.segment-item svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.8;
}
.segment-item.active {
  color: var(--text-primary);
}
.segment-item:active {
  opacity: 0.6;
}

/* Text-only segments */
.segment-item.text-only {
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 600;
}
.segment-item.text-only svg {
  display: none;
}

/* Tab Bar */
.tab-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 50%;
  width: min(100%, 1000px);
  transform: translateX(-50%);
  background: rgba(18, 18, 18, 0.8);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: 8px 20px calc(8px + var(--safe-bottom));
  z-index: 50;
  transition: transform 0.28s ease, opacity 0.22s ease;
  will-change: transform;
  overscroll-behavior: none;
  touch-action: manipulation;
}
.tab-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(-1 * var(--safe-bottom));
  height: var(--safe-bottom);
  background: rgba(18, 18, 18, 0.8);
  pointer-events: none;
}
@media (prefers-color-scheme: light) {
  .tab-bar {
    background: rgba(255, 255, 255, 0.8);
  }
  .tab-bar::after {
    background: rgba(255, 255, 255, 0.8);
  }
}

.tab-bar .segmented-control {
  padding: 3.5px;
  gap: 4px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-bar .segmented-control::-webkit-scrollbar {
  display: none;
}
.tab-bar .segment-item {
  flex: 0 0 auto;
  min-width: 78px;
}
.tab-bar.hidden-on-scroll {
  transform: translateX(-50%) translateY(calc(100% + var(--safe-bottom) + 8px));
  opacity: 0;
  pointer-events: none;
}

/* iOS/PWA: keep controls lower, paint safe area with same background */
@media (display-mode: standalone) {
  .tab-bar {
    padding-bottom: 8px;
  }
  .tab-bar::after {
    bottom: calc(-1 * (var(--safe-bottom) + 8px));
    height: calc(var(--safe-bottom) + 8px);
  }
  .tab-bar.hidden-on-scroll {
    transform: translateX(-50%) translateY(calc(100% + var(--safe-bottom) + 16px));
  }
}

/* Sheets */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.sheet[aria-hidden="false"] {
  pointer-events: auto;
  opacity: 1;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.sheet-content {
  position: relative;
  width: 100%;
  max-height: 90vh;
  background: var(--sheet-bg);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sheet[aria-hidden="false"] .sheet-content {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 5px;
  background: var(--separator-opaque);
  border-radius: 3px;
  margin: 12px auto 8px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 0.5px solid var(--separator);
  flex-shrink: 0;
}
.sheet-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}
.close-btn:active {
  transform: scale(0.9);
  opacity: 0.7;
}
.close-btn svg {
  width: 18px;
  height: 18px;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

.full-sheet .sheet-content {
  max-height: 95vh;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Product Detail */
.detail-image-carousel {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  cursor: grab;
  scrollbar-width: none;
  animation: detailCarouselAppear 320ms ease-out;
}
.detail-image-carousel::-webkit-scrollbar {
  display: none;
}
.detail-image-carousel.dragging {
  cursor: grabbing;
}
.detail-image-slide {
  width: 100%;
  flex: 0 0 100%;
  aspect-ratio: 1;
  object-fit: cover;
  scroll-snap-align: start;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

@keyframes detailCarouselAppear {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.detail-header {
  margin-bottom: 16px;
}
.detail-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.2;
}
.detail-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 20px;
}

.qty-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 8px;
  margin-bottom: 16px;
}
.qty-label {
  font-size: 17px;
  font-weight: 600;
}
.qty-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 8px;
  color: var(--accent);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}
.qty-btn:active {
  transform: scale(0.9);
}
.qty-value {
  min-width: 32px;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}

/* Notification */
.notification {
  position: fixed;
  top: calc(20px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 2000;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
  pointer-events: none;
}
.notification[aria-hidden="false"] {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.notification-content {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--success);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 16px;
  font-weight: 600;
}
.notification-icon {
  width: 20px;
  height: 20px;
}

/* Checkout */
.progress-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.progress-step {
  flex: 1;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
}
.progress-step.active {
  background: var(--accent);
}

.checkout-container {
  margin-bottom: 20px;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 0.5px solid var(--separator);
}
.cart-item:last-child {
  border-bottom: none;
}
.cart-item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}
.cart-item-details {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 8px;
}
.cart-item-price {
  font-size: 17px;
  font-weight: 700;
}
.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
}
.remove-btn {
  color: var(--danger);
  font-size: 16px;
  font-weight: 600;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}

.cart-summary {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 20px 0;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 16px;
}
.summary-row:last-child {
  margin-bottom: 0;
  padding-top: 12px;
  border-top: 0.5px solid var(--separator);
  font-size: 20px;
  font-weight: 700;
}

.form-section {
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.form-section:nth-child(odd) {
  background: var(--bg-primary);
}
.form-section:nth-child(even) {
  background: var(--bg-secondary);
}
.form-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem;
  padding-bottom: 0.5rem;
}
.form-section-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--text-secondary);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.form-section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-section .form-group {
  margin-bottom: 0;
  background: transparent;
}
.form-section .form-group:first-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.form-section .form-group:last-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.form-section .form-group:only-child {
  border-radius: var(--radius-md);
}

.form-group {
  margin-bottom: 16px;
  min-width: 0;
  background: transparent;
  padding: 1rem;
  border-radius: var(--radius-md);
}
.form-section .form-group:nth-child(odd) {
  background: transparent;
}
.form-section .form-group:nth-child(even) {
  background: transparent;
}
.form-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-hint {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-tertiary);
  margin: 2px 0 0;
  line-height: 1.3;
  font-weight: 300;
}

.form-input,
.form-textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
  height: 50px;
}
select.form-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="gray" d="M1.41 0L6 4.58 10.59 0 12 1.42l-6 6-6-6z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-input:focus,
.form-textarea:focus,
select.form-input:focus {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}
.form-textarea {
  min-height: 100px;
  height: auto;
  resize: vertical;
}

input[type="date"].form-input {
  padding-right: 10px;
}

.toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.toggle-group > div {
  flex: 1;
  min-width: 0;
}

.toggle-group .form-label {
  margin-bottom: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--separator);
  border-radius: 31px;
  transition: all 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 27px;
  width: 27px;
  left: 1px;
  bottom: 1px;
  background: var(--bg-elevated);
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #ffffff;
}

.action-bar {
  flex-shrink: 0;
  padding: 16px 20px calc(16px + var(--safe-bottom));
  background: var(--sheet-bg);
  border-top: 0.5px solid var(--separator);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.empty-state {
  text-align: center;
  padding: 60px 40px;
}
.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  color: var(--text-tertiary);
}
.empty-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
}
.empty-text {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

/* Party Hall */
.party-section {
  padding: 20px;
}
.party-hero {
  margin-bottom: 24px;
}
.party-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.party-title {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.2;
}
.party-desc {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.features-grid {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}
.remit-benefits {
  list-style: disc;
  padding-left: calc(24px + 1rem);
  margin: 24px 0;
}
.remit-benefits li {
  font-size: 16px;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.remit-benefits li:last-child {
  margin-bottom: 0;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-md);
}
.feature-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.feature-text {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

/* Auth */
.auth-section {
  padding: 20px;
}
.auth-card {
  /* background: var(--bg-secondary); */
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
  border: 1px solid var(--separator);
}
.auth-card + .auth-card {
  margin-top: 24px;
}
.auth-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 20px;
  text-align: center;
}
.auth-tabs {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: 40px;
  padding: 2px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 40px;
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}
.auth-tab.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 40px;
  z-index: -1;
}
.auth-note {
  font-size: 16px;
  color: var(--text-tertiary);
  text-align: center;
  margin: 16px 0 0;
  line-height: 1.4;
}
.auth-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 40px;
}

/* Profile */
.profile-section {
  padding: 20px;
}
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  margin-bottom: 20px;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 1;
}
.profile-name {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
  text-align: center;
  color: var(--text-primary);
}
.profile-phone {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.profile-phone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
  z-index: 1;
}
.profile-logout-btn {
  font-size: 16px;
  padding: 10px 24px;
  min-height: 40px;
  background: transparent;
  border: 1px solid var(--separator);
  color: var(--text-primary);
  margin-top: 8px;
}
.profile-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--separator);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: none;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}
.menu-item:active {
  background: var(--bg-tertiary);
}
.menu-item svg:first-child {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
}
.menu-item span {
  flex: 1;
}
.menu-item .chevron {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Profile */
.profile-section {
  padding: 20px;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-name {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
}
.profile-phone {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.2;
}
.profile-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--separator);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: none;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}
.menu-item:active {
  background: var(--bg-tertiary);
}
.menu-item svg:first-child {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
}
.menu-item span {
  flex: 1;
}
.menu-item .chevron {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.order-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.order-id {
  font-weight: 700;
  font-size: 16px;
}
.order-status {
  font-size: 16px;
  color: var(--success);
  font-weight: 600;
}
.order-date,
.order-tracking {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 4px 0;
}
.order-total {
  font-size: 18px;
  font-weight: 700;
  margin: 8px 0 0;
}

.address-flags {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.form-check {
  font-size: 14px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.address-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.address-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.address-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  padding: 12px;
}

.address-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.address-badges {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.address-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  color: #0b5e20;
  background: #d9f7e4;
  border: 1px solid #8fd7aa;
  font-weight: 700;
}

.address-card p {
  margin: 4px 0;
  font-size: 16px;
  color: var(--text-secondary);
}

.address-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* Admin */
.admin-section {
  padding: 20px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.admin-card {
  background: transparent;
  border-radius: var(--radius-lg);
  padding: 20px 0;
  margin-bottom: 16px;
}
.admin-card-header {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.admin-card-header .admin-help {
  margin-bottom: 8px;
}
.admin-card-header .admin-subtitle {
  margin-bottom: 0;
}
.admin-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}
.admin-subtitle {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
}
.admin-help {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.story-admin-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.gradient-option:hover {
  border-color: var(--accent) !important;
  opacity: 0.8;
}
.admin-tabs {
  margin-bottom: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
  justify-content: center;
  gap: clamp(8px, 1.2vw, 20px);
  padding-left: clamp(4px, 2vw, 20px);
  padding-right: clamp(4px, 2vw, 20px);
}
.admin-tabs::-webkit-scrollbar {
  display: none;
}
.admin-tabs .segment-selector {
  top: 2px;
  bottom: 2px;
}
.admin-tabs .segment-item.text-only {
  font-size: 16px;
  padding: 10px 14px;
  flex: 0 0 auto;
  min-width: max-content;
}
.newsletter-calendar {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 10px;
  background: var(--bg-secondary);
}
.newsletter-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.newsletter-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.newsletter-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
}
.newsletter-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.newsletter-day {
  min-height: 52px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.newsletter-day.empty {
  border-color: transparent;
  background: transparent;
  cursor: default;
}
.newsletter-day.active {
  border-color: var(--accent);
}
.newsletter-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.newsletter-day-num.muted {
  color: var(--text-tertiary);
}
.newsletter-dots {
  min-height: 10px;
  display: flex;
  align-items: center;
  gap: 2px;
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
}
.newsletter-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #2684ff;
}
.newsletter-more {
  font-size: 10px;
  color: #2684ff;
}
.newsletter-from-line {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--separator);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}
.orders-bar-chart {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: end;
}
.orders-bar-col {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.orders-bar-wrap {
  width: 100%;
  height: 90px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.orders-bar {
  width: 100%;
  border-radius: 10px 10px 0 0;
  min-height: 6px;
}
.orders-bar-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}
.orders-bar-num {
  font-size: 12px;
  font-weight: 700;
}
.fill-processing { background: #f59e0b; }
.fill-shipped { background: #3b82f6; }
.fill-delivered { background: #10b981; }

/* Install Banner */
.install-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--footer-height) + var(--safe-bottom) + 12px);
  max-width: 350px;
  width: min(350px, calc(100vw - 24px));
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
  border: 1px solid var(--separator);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}
.install-banner-text {
  flex: 1;
  min-width: 0;
}
.install-banner-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
}
.install-banner-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}
.install-banner .btn {
  height: 36px;
  padding: 0 12px;
  font-size: 16px;
  border-radius: 12px;
  white-space: nowrap;
  border: 1px solid transparent;
}
#install-dismiss-btn {
  border-color: ButtonBorder;
}
.install-banner.hide {
  display: none;
}
.bulk-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bulk-controls button {
  grid-column: span 2;
}
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
}
.admin-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 12px 8px;
  border-bottom: 0.5px solid var(--separator);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 12px 8px;
  border-bottom: 0.5px solid var(--separator);
}
td input,
td select,
td textarea {
  width: 100%;
  padding: 8px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
}

/* Loading */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--separator);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Story */
.story-section {
  padding: 20px;
}
.story-hero {
  margin-bottom: 24px;
}
.story-title {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.2;
}
.story-desc {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.story-grid {
  display: grid;
  gap: 16px;
}
.story-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.story-image {
  width: 100%;
  height: 160px;
}
.story-content {
  padding: 16px;
}
.story-card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}
.story-card-text {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 12px;
}
.story-author {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin: 0;
}

#remit .party-hero {
  margin-bottom: 18px;
}

#remit .feature-item {
  justify-content: flex-start;
}

/* Responsive */
@media (max-width: 768px) {
  .header-brand {
    max-width: 76%;
  }
  .brand-logo {
     height: 30px!important;
     width: 40px;
  }
  .header-title {
    font-size: clamp(14px, 3.7vw, 18px);
  }
  .header-text {
    min-width: 0;
    letter-spacing: 1.3px;
  }
  .header-subtitle {
    font-size: clamp(8px, 2.1vw, 9px);
    letter-spacing: 0.03em;
  }
}

@media (min-width: 769px) {
  .header-text {
    min-width: 0;
    letter-spacing: 1.8px;
  }
  .dept-nav {
    justify-content: flex-end;
  }

  .tab-bar {
    left: 50%;
    right: auto;
    width: auto;
    max-width: calc(100vw - 24px);
    padding: 0;
    border-radius: 999px;
    transform: translateX(-50%);
    margin-bottom: 10px;
  }

  .tab-bar::after {
    display: none;
  }

  .tab-bar .segmented-control {
    width: auto;
    max-width: none;
    overflow: visible;
    justify-content: center;
  }

  .tab-bar .segment-item {
    min-width: 84px;
  }

  .tab-bar.hidden-on-scroll {
    transform: translateX(-50%) translateY(calc(100% + var(--safe-bottom) + 16px));
  }
}

@media (min-width: 769px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 24px;
  }
  .sheet-content {
    max-width: 600px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
  }
  .full-sheet .sheet-content {
    max-width: 700px;
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}