/* KedaiTiara Design System Stylesheet */

:root {
  /* Color System */
  --bg-canvas: #FAF6F0;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F4EFEA;
  --bg-highlight: #FFFDF9;
  
  --border-color: #E6DDD2;
  --border-strong: #D5C9BC;
  --border-shadow: #D0C3B4;
  
  --text-main: #181512;
  --text-muted: #5C554E;
  --text-light: #8A8177;
  --text-inverted: #FFFFFF;
  --text-on-accent: #FFFFFF;

  --accent-primary: #D92D07;
  --accent-gradient: linear-gradient(180deg, #E63914 0%, #CD2600 100%);
  --accent-hover: #BF2604;
  --accent-depth: #8F1B00;
  --accent-subtle: #FDF2EF;
  --accent-border: rgba(217, 45, 7, 0.25);
  --accent-shadow: rgba(217, 45, 7, 0.22);
  --accent-ring: rgba(217, 45, 7, 0.14);

  --spice-gold: #B45309;
  --spice-bg: #FEF3C7;
  --spice-border: #FDE68A;

  --status-green: #15803D;
  --status-green-bg: #DCFCE7;
  --status-green-border: #86EFAC;

  --status-red: #DC2626;
  --status-red-bg: #FEE2E2;
  --status-red-border: #FCA5A5;

  --status-blue: #0369A1;
  --status-blue-bg: #E0F2FE;

  --status-orange: #C2410C;
  --status-orange-bg: #FFEDD5;
  --status-orange-border: #FDBA74;

  /* Typography & Sizing */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Tactile Physical Press Shadows */
  --btn-press-primary: 0 3px 0 var(--accent-depth), 0 6px 14px rgba(217, 45, 7, 0.22);
  --btn-press-sec: 0 2px 0 var(--border-shadow);
  --card-physical-shadow: 0 3px 0 var(--border-shadow), 0 6px 18px rgba(24, 21, 18, 0.04);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y pinch-zoom;
  position: relative;
}

body.modal-open {
  overflow: hidden !important;
}

@supports (overflow-x: clip) {
  html, body {
    overflow-x: clip;
  }
}

/* Tabular Numbers */
.price, .tabular-num, .receipt-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Layout Containers */
.app-container {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg-surface);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.06);
  padding-bottom: 96px;
  overflow-x: hidden;
  box-sizing: border-box;
}

@supports (overflow-x: clip) {
  .app-container {
    overflow-x: clip;
  }
}

.desktop-full {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header & Store Profile */
.store-header {
  background-color: var(--bg-surface);
  border-bottom: 2px solid var(--border-color);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.store-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.store-logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-logo-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: var(--accent-subtle);
  border: 1.5px solid var(--accent-border);
  box-shadow: 0 2px 0 var(--accent-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  overflow: hidden;
}

.store-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-info h1 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.store-info p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Store Status Pill */
.store-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid currentColor;
}

.store-status-pill.open {
  background-color: var(--status-green-bg);
  color: var(--status-green);
  border-color: var(--status-green-border);
}

.store-status-pill.closed {
  background-color: var(--status-red-bg);
  color: var(--status-red);
  border-color: var(--status-red-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
}

/* Order Type Context (Meja / Bungkus / Antar) */
.order-context-box {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin: 16px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1.5px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(24, 21, 18, 0.04);
}

.order-context-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-context-info .icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--accent-border);
}

.context-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.context-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 1px;
}

.order-type-btn {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 36px;
  box-shadow: 0 2px 0 var(--border-strong);
  transition: all 0.1s ease;
}

.order-type-btn:hover {
  background: var(--accent-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.order-type-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Store Closed Alert Banner */
.store-closed-alert {
  background-color: var(--status-red-bg);
  border: 1.5px solid var(--status-red-border);
  color: var(--status-red);
  padding: 14px 18px;
  margin: 16px 20px 0;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 2px 0 rgba(220, 38, 38, 0.15);
}

/* Search Bar */
.search-container {
  padding: 14px 20px 0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.15s ease;
}

.search-input:focus {
  outline: none;
  background-color: var(--bg-surface);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(217, 45, 7, 0.12);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.1s ease;
}

.search-clear-btn:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 16px;
}

/* Category Navigation (Sticky Tactile Tab Pills) */
.category-nav-wrapper {
  position: sticky;
  top: var(--kedai-header-h, 82px);
  background-color: var(--bg-surface);
  border-bottom: 2px solid var(--border-color);
  z-index: 30;
  padding: 12px 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.category-nav-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  max-width: 100%;
}

.category-nav-scroll::-webkit-scrollbar {
  display: none;
}

.category-pill {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 0 var(--border-color);
  transition: all 0.1s ease;
  min-height: 42px;
}

.category-pill:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.category-pill:active {
  transform: translateY(2px);
  box-shadow: none;
}

.category-pill.active {
  background-color: var(--text-main);
  color: var(--bg-surface);
  border-color: var(--text-main);
  box-shadow: 0 2px 0 var(--border-shadow);
}

/* Menu Section & Product Cards */
.menu-section {
  padding: 18px 20px 24px;
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  gap: 14px;
  box-shadow: var(--card-physical-shadow);
  transition: all 0.15s ease;
  position: relative;
}

.product-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--border-strong), 0 8px 20px rgba(24, 21, 18, 0.05);
}

.product-card.unavailable,
.product-card.is-sold-out {
  opacity: 0.85;
  border-color: var(--border-color);
}

.product-card.is-sold-out .product-img-box img,
.product-card.is-sold-out .product-placeholder-box {
  filter: grayscale(0.85);
  opacity: 0.75;
}

.sold-out-badge-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-6deg);
  background-color: #DC2626;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.4), 0 2px 0 #991B1B;
  border: 1.5px solid #FFFFFF;
  z-index: 4;
  white-space: nowrap;
  pointer-events: none;
}

.btn-sold-out-disabled {
  background: var(--bg-subtle) !important;
  border: 1.5px solid var(--border-color) !important;
  color: #DC2626 !important;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: not-allowed !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  box-shadow: none !important;
  opacity: 0.95;
  letter-spacing: 0.02em;
}

.btn-sold-out-disabled:hover {
  background: var(--bg-subtle) !important;
  color: #DC2626 !important;
}

.soldout-list-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 2px;
}

.soldout-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.soldout-item-row.is-empty {
  background: #FEF2F2;
  border-color: #FECACA;
}

.soldout-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.soldout-item-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.soldout-item-category {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-soldout-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid transparent;
  min-height: 38px;
  transition: all 0.15s ease;
}

.btn-soldout-toggle.available {
  background-color: var(--status-green-bg);
  color: var(--status-green);
  border-color: var(--status-green-border);
}

.btn-soldout-toggle.sold-out {
  background-color: var(--status-red-bg);
  color: var(--status-red);
  border-color: var(--status-red-border);
}

@keyframes spinIcon {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-active {
  animation: spinIcon 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.product-img-box {
  width: 104px;
  height: 104px;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
}

.product-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-placeholder-box {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(145deg, var(--bg-subtle) 0%, var(--bg-surface) 100%);
  padding: 8px;
  text-align: center;
}

.placeholder-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.1;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-recommended {
  position: absolute;
  top: 6px;
  left: 6px;
  background-color: var(--accent-primary);
  color: var(--text-on-accent, #FFFFFF);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.product-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.product-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.product-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spicy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  background-color: var(--spice-bg);
  color: var(--spice-gold);
  border: 1px solid var(--spice-border);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  margin-top: 6px;
  width: fit-content;
}

.product-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.product-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-primary);
}

/* Tactile 3D Button "+ Tambah" */
.btn-add-item {
  background: var(--bg-surface);
  border: 1.5px solid var(--accent-primary);
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  box-shadow: 0 2px 0 var(--accent-shadow);
  transition: all 0.1s ease;
}

.btn-add-item:hover {
  background: var(--accent-primary);
  color: var(--text-on-accent, #FFFFFF);
  box-shadow: 0 2px 0 var(--accent-depth);
}

.btn-add-item:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Tactile Stepper Quantity */
.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  box-shadow: 0 1px 0 var(--border-shadow);
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 var(--border-strong);
  transition: all 0.1s ease;
}

.qty-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.qty-val {
  font-size: 14px;
  font-weight: 800;
  min-width: 22px;
  text-align: center;
}

/* Floating Bottom Bar (Cart Summary) */
.floating-cart-bar {
  position: fixed;
  bottom: 18px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: calc(100% - 32px);
  max-width: 448px;
  box-sizing: border-box;
  background: #181512;
  color: var(--text-inverted);
  border-radius: var(--radius-lg);
  border: 2px solid #2B2520;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 3px 0 #000000;
  z-index: 50;
  cursor: pointer;
  animation: slideUpSpring 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUpSpring {
  0% { transform: translateY(40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.cart-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-bar-count {
  background-color: var(--accent-primary);
  color: var(--text-on-accent, #FFFFFF);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 0 var(--accent-depth);
}

.cart-bar-total {
  font-size: 17px;
  font-weight: 800;
}

.cart-bar-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  color: #FBBF24;
}

/* Universal modal dialog and bottom sheet */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(24, 21, 18, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  display: none;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y !important;
  box-sizing: border-box;
}

.modal-overlay.active {
  display: flex !important;
}

@media (min-width: 641px) {
  .modal-overlay {
    align-items: center;
    padding: 24px 16px;
  }
}

.bottom-sheet {
  background-color: var(--bg-surface);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.22);
  animation: sheetUp 0.25s ease-out;
  box-sizing: border-box;
  touch-action: pan-y !important;
  position: relative;
}

@media (min-width: 641px) {
  .bottom-sheet {
    border-radius: 18px !important;
    margin: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.28);
  }
}

.bottom-sheet.modal-lg {
  max-width: 640px !important;
}

.bottom-sheet.modal-md {
  max-width: 520px !important;
}

.bottom-sheet.modal-sm {
  max-width: 440px !important;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Ensure forms inside modals are fully participating in the vertical flex chain */
.bottom-sheet form,
.modal-form-flex {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100%;
  overflow: hidden !important;
}

.sheet-header {
  padding: 16px 20px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  max-width: 100%;
  flex-shrink: 0 !important;
}

.sheet-header h2 {
  font-size: 17px;
  font-weight: 800;
}

.sheet-close-btn {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  flex-shrink: 0;
}

.sheet-close-btn:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.sheet-body {
  padding: 20px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  overscroll-behavior-y: contain;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  box-sizing: border-box;
  max-width: 100%;
}

.sheet-footer {
  padding: 16px 20px;
  border-top: 2px solid var(--border-color);
  background-color: var(--bg-surface);
  box-sizing: border-box;
  max-width: 100%;
  flex-shrink: 0 !important;
}

/* Master Tactile Primary & Secondary Buttons */
.btn-primary {
  width: 100%;
  background: var(--accent-gradient);
  color: var(--text-on-accent, #FFFFFF);
  border: 1.5px solid var(--accent-depth);
  font-size: 15px;
  font-weight: 800;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  box-shadow: var(--btn-press-primary);
  transition: all 0.1s ease;
}

.btn-primary:hover {
  background: var(--accent-primary);
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--accent-depth);
}

.btn-secondary {
  width: 100%;
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1.5px solid var(--border-strong);
  font-size: 14px;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  box-shadow: var(--btn-press-sec);
  transition: all 0.1s ease;
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--text-main);
}

.btn-secondary:active {
  transform: translateY(2px);
  box-shadow: none;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.15s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  background-color: var(--bg-surface);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Choice Cards (Radio / Checkbox) */
.choice-card-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-card {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background-color: var(--bg-surface);
  box-shadow: 0 2px 0 var(--border-shadow);
  transition: all 0.1s ease;
}

.choice-card:hover {
  border-color: var(--border-strong);
}

.choice-card.selected {
  border-color: var(--accent-primary);
  background-color: var(--accent-subtle);
  box-shadow: 0 2px 0 var(--accent-shadow);
}

.choice-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
}

/* Spicy Level Chips (0 s/d 8) */
.spicy-chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.spicy-chip {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-subtle);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 0 var(--border-shadow);
  transition: all 0.1s ease;
}

.spicy-chip .num {
  font-size: 17px;
  font-weight: 800;
  display: block;
}

.spicy-chip:active {
  transform: translateY(2px);
  box-shadow: none;
}

.spicy-chip.selected {
  background-color: var(--accent-primary);
  color: var(--text-on-accent, #FFFFFF);
  border-color: var(--accent-depth);
  box-shadow: 0 2px 0 var(--accent-depth);
}

/* Cart Item Row */
.cart-item-row {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1.5px solid var(--border-color);
}

.cart-item-row:last-child {
  border-bottom: none;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 15px;
  font-weight: 800;
}

.cart-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.cart-item-notes {
  font-size: 11px;
  font-weight: 700;
  color: var(--spice-gold);
  background: var(--spice-bg);
  border: 1px solid var(--spice-border);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  margin-top: 4px;
  display: inline-block;
}

/* Admin POS and dashboard layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-canvas);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.admin-sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 2px solid var(--border-color);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  z-index: 90;
  box-sizing: border-box;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-left: 8px;
  flex-shrink: 0;
}

.admin-brand h2 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.admin-nav-link:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-main);
}

.admin-nav-link.active {
  background-color: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent-primary);
  box-shadow: 0 2px 0 var(--accent-shadow);
}

/* Admin Mobile Top Bar & Offcanvas Sidebar */
.admin-mobile-topbar {
  display: none;
}

.admin-hamburger-btn {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  box-shadow: 0 2px 0 var(--border-shadow);
  transition: all 0.1s ease;
}

.admin-hamburger-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.sidebar-mobile-close-btn {
  display: none;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.1s ease;
}

.admin-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(24, 21, 18, 0.65);
  backdrop-filter: blur(2px);
  z-index: 95;
}

.admin-sidebar-overlay.active {
  display: block;
}

/* Base Desktop Admin Main & Header Layout */
.admin-main {
  flex: 1;
  margin-left: 260px;
  padding: 28px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.admin-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 14px;
}

.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Switch Buka/Tutup Toko */
.store-switch-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  box-shadow: 0 2px 0 var(--border-shadow);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #CBD5E1;
  transition: .25s;
  border-radius: 24px;
  border: 1px solid rgba(0,0,0,0.1);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
  background-color: var(--status-green);
}

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

/* KPI Stat Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--card-physical-shadow);
}


.kpi-visibility-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s ease;
  flex-shrink: 0;
}

.kpi-visibility-btn:hover {
  background: var(--bg-canvas);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.kpi-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 6px;
}

/* Order Board Cards (Perforated POS Tickets) */
.order-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.order-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--card-physical-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 6px solid #CBD5E1;
  position: relative;
  height: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.order-card.new { border-top-color: var(--accent-primary); }
.order-card.cooking { border-top-color: var(--spice-gold); }
.order-card.ready { border-top-color: var(--status-blue); }
.order-card.completed { border-top-color: var(--status-green); }

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1.5px dashed var(--border-color);
}

.order-code {
  font-size: 15px;
  font-weight: 800;
}

.order-timestamp {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.order-customer-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-customer-name {
  font-size: 16px;
  font-weight: 800;
}

.btn-wa-confirm {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #25D366;
  color: #FFFFFF;
  border: 1.5px solid #1EBE5D;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  margin-top: 5px;
  box-shadow: 0 3px 0 #15803D, 0 3px 6px rgba(37, 211, 102, 0.25);
  transition: all 0.1s ease;
  min-height: 44px;
}

.btn-wa-confirm:hover {
  background: #22BF5B;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #15803D, 0 5px 8px rgba(37, 211, 102, 0.3);
}

.btn-wa-confirm:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #15803D;
}

.order-type-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
}

.order-items-list {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 96px;
  max-height: 220px;
  overflow-y: auto;
}

.order-item-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.order-card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

/* Master Data Table (Elevated Tactile) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  box-shadow: var(--card-physical-shadow);
}

.product-table,
.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border: none;
}

.product-table th, .product-table td,
.history-table th, .history-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1.5px solid var(--border-color);
  font-size: 13px;
}

.product-table th, .history-table th {
  background-color: var(--bg-subtle);
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
}

.product-table tr:last-child td,
.history-table tr:last-child td {
  border-bottom: none;
}

/* Responsive reflow across tablet and phone viewports */

/* Tablet & Intermediate Viewports (<= 1024px) */
@media (max-width: 1024px) {
  .admin-layout {
    display: block !important;
    position: relative;
    padding-top: 64px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .admin-mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--border-color);
    padding: 0 16px;
    z-index: 80;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }

  .sidebar-mobile-close-btn {
    display: flex;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 25px rgba(0,0,0,0.25);
  }

  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0 !important;
    padding: 20px 20px;
  }

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

  .order-queue-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }
}

/* Smartphone Viewports (<= 640px) */
@media (max-width: 640px) {
  .app-container {
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .admin-main {
    padding: 14px 12px;
  }

  .admin-header-bar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
    margin-bottom: 16px;
  }

  .admin-header-bar h1 {
    font-size: 20px !important;
  }

  .admin-header-bar p {
    font-size: 12px !important;
  }

  .admin-top-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .admin-top-actions button,
  .admin-top-actions a,
  .admin-top-actions .btn-primary,
  .admin-top-actions .btn-secondary {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center;
    font-size: 13px !important;
    padding: 10px 14px !important;
  }

  .admin-top-actions .store-switch-container {
    width: 100% !important;
    justify-content: space-between;
    padding: 10px 16px;
    min-height: 44px;
    box-sizing: border-box;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 14px 16px;
  }

  .kpi-label {
    font-size: 12px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .order-queue-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .order-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .order-card-header {
    padding-bottom: 10px;
  }

  .product-filter-controls {
    grid-template-columns: 1fr !important;
  }

  .order-code {
    font-size: 14px;
  }

  .order-customer-name {
    font-size: 15px;
  }

  .order-items-list {
    padding: 10px 12px;
    font-size: 12px;
    gap: 6px;
  }

  /* Bottom sheet on phone */
  .bottom-sheet {
    border-radius: 20px 20px 0 0 !important;
    max-height: 90dvh !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .sheet-header {
    padding: 14px 16px;
    flex-shrink: 0 !important;
  }

  .sheet-body {
    padding: 14px 16px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  .sheet-footer {
    padding: 14px 16px;
    flex-shrink: 0 !important;
  }

  /* Form & Filter Reflow */
  .report-filter-bar,
  form[action="history.php"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .report-filter-bar > div,
  .report-filter-bar button,
  form[action="history.php"] > div,
  form[action="history.php"] button,
  form[action="history.php"] a {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
  }
}

/* Thermal receipt printing for 58mm and 80mm paper */
.receipt-container {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  .receipt-container, .receipt-container * {
    visibility: visible;
  }
  .receipt-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #000000;
    background: #FFFFFF;
  }

  .receipt-58mm {
    width: 58mm;
    max-width: 58mm;
    padding: 2mm;
    margin: 0 auto;
  }

  .receipt-80mm {
    width: 80mm;
    max-width: 80mm;
    padding: 4mm;
    margin: 0 auto;
  }

  .receipt-header {
    text-align: center;
    margin-bottom: 8px;
  }

  .receipt-title {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
  }

  .receipt-divider {
    border-top: 1px dashed #000;
    margin: 6px 0;
  }

  .receipt-row {
    display: flex;
    justify-content: space-between;
    margin: 3px 0;
  }

  .receipt-footer {
    text-align: center;
    margin-top: 12px;
    font-size: 11px;
  }
}

.btn-active {
  background: var(--accent-subtle) !important;
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-active {
  animation: spin 0.7s linear infinite;
}
