/* ==========================================================================
   ระบบจัดสำรับและเลือกเมนูอาหาร (Thai Food Menu Selector PWA)
   Responsive Design System: Mobile, Tablet & Desktop (PC) Compatible
   Emerald & Amber Gold Palette | Senior-Friendly Accessible UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Kanit:wght@400;500;600;700&display=swap');

:root {
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --danger-500: #ef4444;
  --danger-600: #dc2626;

  --surface-bg: #f4f6f8;
  --surface-card: #ffffff;
  --surface-muted: #f1f5f9;
  --surface-border: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 10px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.09), 0 4px 8px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 22px rgba(16, 185, 129, 0.35);

  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--surface-bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
  min-height: 100vh;
}

/* ----------------------------------------------------
   Responsive App Container (Full Width on PC & Mobile)
   ---------------------------------------------------- */
.app-container {
  width: 100%;
  max-width: 100%; /* Fully extended across all screens */
  margin: 0;
  min-height: 100vh;
  background-color: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1200px) {
  body {
    padding-top: 0;
    padding-bottom: 96px;
  }
}

/* ----------------------------------------------------
   Header & Navigation
   ---------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-800) 55%, var(--primary-700) 100%);
  color: #ffffff;
  padding: 14px 20px;
  box-shadow: var(--shadow-md);
  border-bottom: 2px solid var(--amber-500);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.header-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1.5px solid var(--amber-200);
  flex-shrink: 0;
}

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

.header-title-box {
  min-width: 0;
}

.header-title-box h1 {
  font-family: 'Kanit', sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: 0.78rem;
  color: var(--amber-200);
  font-weight: 400;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon-nav {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-family: 'Prompt', sans-serif;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-nav:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-icon-nav:active {
  transform: scale(0.96);
}

/* Mobile Header Wrap Fix: on small screens, gracefully keep in one single line */
@media (max-width: 520px) {
  .app-header {
    padding: 10px 14px;
  }
  .header-brand {
    gap: 8px;
  }
  .header-logo {
    width: 38px;
    height: 38px;
  }
  .header-title-box h1 {
    font-size: 0.96rem;
  }
  .header-subtitle {
    font-size: 0.7rem;
  }
  .btn-icon-nav {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 4px;
  }
}

@media (max-width: 380px) {
  .header-subtitle {
    display: none;
  }
  .btn-icon-nav .nav-text {
    display: none;
  }
  .btn-icon-nav {
    padding: 7px;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    justify-content: center;
  }
}

/* ----------------------------------------------------
   Stepper Indicator
   ---------------------------------------------------- */
.stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--surface-border);
  user-select: none;
}

.step-node {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-subtle);
  cursor: pointer;
  transition: color 0.2s ease;
}

.step-node:hover {
  color: var(--primary-700);
}

.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.25s ease;
}

.step-node.active {
  color: var(--primary-800);
  font-weight: 600;
}

.step-node.active .step-badge {
  background: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(5, 150, 105, 0.45);
}

.step-node.completed {
  color: var(--primary-800);
}

.step-node.completed .step-badge {
  background: var(--primary-100);
  color: var(--primary-800);
}

.step-divider {
  flex: 1;
  height: 3px;
  background: var(--surface-border);
  margin: 0 12px;
  border-radius: var(--radius-full);
}

.step-divider.filled {
  background: var(--primary-500);
}

/* ----------------------------------------------------
   Main Screen Panels
   ---------------------------------------------------- */
.screen-panel {
  display: none;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
  flex: 1;
}

.screen-panel.active {
  display: block;
}

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

@media (min-width: 768px) {
  .screen-panel {
    padding: 28px 36px;
  }
}

/* ----------------------------------------------------
   Step 1: ตั้งค่าวันที่รับอาหาร (Senior-Friendly UI)
   ---------------------------------------------------- */
.card-section {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--surface-border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .card-section {
    padding: 32px;
  }
}

.section-headline {
  margin-bottom: 20px;
}

.section-headline h2 {
  font-family: 'Kanit', sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--primary-900);
  line-height: 1.3;
}

.section-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Large Preset Touch Buttons (Senior-Friendly) */
.preset-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .preset-card-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
  }
}

.preset-card-btn {
  position: relative;
  background: #ffffff;
  border: 2px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  min-height: 84px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.preset-card-btn:hover {
  border-color: var(--primary-500);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.12);
}

.preset-card-btn:active {
  transform: scale(0.98);
}

.preset-card-btn.active {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-600) 100%);
  border-color: var(--primary-800);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
}

.preset-top-badge {
  position: absolute;
  top: -9px;
  right: 12px;
  background: var(--amber-500);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.preset-main-label {
  font-family: 'Kanit', sans-serif;
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--primary-900);
  line-height: 1.2;
  margin-bottom: 4px;
}

.preset-card-btn.active .preset-main-label {
  color: #ffffff;
}

.preset-sub-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.3;
}

.preset-card-btn.active .preset-sub-label {
  color: var(--primary-100);
}

.custom-pick-btn {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .custom-pick-btn {
    grid-column: auto;
  }
}

/* Date Display Input Boxes (Strictly dd/mm/yyyy) */
.date-fields-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .date-fields-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

.date-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-display-box {
  width: 100%;
  padding: 14px 18px;
  background: #ffffff;
  border: 2px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-900);
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.date-display-box:hover, .date-display-box:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.date-display-box span.val {
  letter-spacing: 0.8px;
  font-variant-numeric: tabular-nums;
}

.date-display-box span.icon {
  font-size: 1.25rem;
  opacity: 0.8;
}

/* Real-Time Calculation Card */
.calc-summary-card {
  background: linear-gradient(135deg, var(--primary-50) 0%, #ecfdf5 100%);
  border: 2px solid var(--primary-200);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 640px) {
  .calc-summary-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.calc-summary-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-900);
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-summary-sub {
  font-size: 0.95rem;
  color: var(--primary-800);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calc-pill-metric {
  display: inline-block;
  background: var(--primary-600);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 700;
}

/* Primary Action Buttons */
.btn-primary-action {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Kanit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary-action:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary-action:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.45);
}

.btn-primary-action:not(:disabled):active {
  transform: scale(0.98);
}

/* ----------------------------------------------------
   Step 2: เลือกเมนูอาหาร (Responsive Grid for PC & Mobile)
   ---------------------------------------------------- */
.sticky-filter-wrapper {
  position: sticky;
  top: 72px;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 14px 20px;
  border-bottom: 1px solid var(--surface-border);
  margin: -20px -20px 20px -20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

@media (min-width: 768px) {
  .sticky-filter-wrapper {
    margin: -28px -36px 24px -36px;
    padding: 16px 36px;
  }
}

.search-box-container {
  position: relative;
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  padding: 12px 18px 12px 42px;
  background: var(--surface-muted);
  border: 1.5px solid transparent;
  border-radius: var(--radius-full);
  font-family: 'Prompt', sans-serif;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.search-icon-pos {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
  font-size: 1.1rem;
}

/* Quick Selection Action Bar under categories */
.selection-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.btn-toolbar-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.btn-toolbar-random {
  background: #f0fdf4;
  border: 1.5px solid var(--primary-500);
  color: var(--primary-800);
}

.btn-toolbar-random:hover {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
}

.btn-toolbar-clear {
  background: #ffffff;
  border: 1.5px solid var(--surface-border);
  color: var(--text-muted);
}

.btn-toolbar-clear:not(:disabled):hover {
  background: #fef2f2;
  border-color: var(--danger-500);
  color: var(--danger-600);
}

.btn-toolbar-clear:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Category Filter Tabs */
.category-tab-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.category-tab-list::-webkit-scrollbar {
  display: none;
}

.category-tab-btn {
  flex: 0 0 auto;
  background: #ffffff;
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.category-tab-btn:hover {
  border-color: var(--amber-500);
  color: var(--amber-700);
}

.category-tab-btn.active {
  background: var(--amber-500);
  color: #ffffff;
  border-color: var(--amber-600);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

/* Responsive Dish Grid: 2 cols on mobile, fluid auto-fill on PC */
.dish-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 96px;
}

@media (min-width: 640px) {
  .dish-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
}

.dish-card {
  background: #ffffff;
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.dish-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.dish-card:active {
  transform: scale(0.97);
}

.dish-card.selected {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 2.5px var(--primary-500), 0 10px 24px rgba(16, 185, 129, 0.25);
  background: linear-gradient(180deg, #ffffff 0%, var(--primary-50) 100%);
}

.dish-thumbnail-box {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-muted);
  position: relative;
  overflow: hidden;
}

.dish-thumbnail-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.dish-card:hover .dish-thumbnail-box img {
  transform: scale(1.06);
}

.dish-check-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dish-card.selected .dish-check-badge {
  background: var(--primary-600);
  border-color: #ffffff;
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(5, 150, 105, 0.6);
}

.dish-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.dish-name {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dish-cat-badge {
  align-self: flex-start;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dish-card.selected .dish-check-badge.has-multi {
  width: auto;
  min-width: 38px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dish-stepper-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.dish-stepper-box {
  display: inline-flex;
  align-items: center;
  background: var(--surface-muted);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
  width: 100%;
  justify-content: space-between;
}

.dish-card.selected .dish-stepper-box {
  background: #ffffff;
  border-color: var(--primary-500);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-stepper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--primary-100);
  color: var(--primary-800);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1;
}

.btn-stepper:hover {
  background: var(--primary-600);
  color: #ffffff;
}

.btn-stepper:active {
  transform: scale(0.9);
}

.stepper-qty {
  flex: 1;
  text-align: center;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--primary-900);
  font-variant-numeric: tabular-nums;
}

.btn-add-pill {
  width: 100%;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  border: 1.5px dashed var(--surface-border);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.dish-card:hover .btn-add-pill {
  background: var(--primary-50);
  border-color: var(--primary-500);
  border-style: solid;
  color: var(--primary-800);
}

.btn-add-pill:active {
  transform: scale(0.96);
}

/* ----------------------------------------------------
   Sticky Bottom Summary Bar (Thumb Zone)
   ---------------------------------------------------- */
.thumb-summary-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--surface-border);
  box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.08);
  padding: 16px clamp(16px, 3.5vw, 48px) calc(14px + var(--safe-bottom)) clamp(16px, 3.5vw, 48px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Edge-to-Edge Full Width Progress Bar across the entire screen on PC & Mobile */
.summary-progress-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  .thumb-summary-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px clamp(24px, 4vw, 64px) calc(16px + var(--safe-bottom)) clamp(24px, 4vw, 64px);
  }
}

.summary-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-counter-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-900);
}

.status-indicator-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.status-indicator-light.yellow {
  background: var(--amber-500);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

.status-indicator-light.green {
  background: var(--primary-500);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.9);
  animation: pulseGreen 1.5s infinite;
}

.status-indicator-light.red {
  background: var(--danger-500);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.85);
}

@keyframes pulseGreen {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.2); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.summary-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--amber-500);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease;
}

.summary-progress-fill.complete {
  background: var(--primary-500);
}

.summary-progress-fill.over {
  background: var(--danger-500);
}

.thumb-action-row {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}

@media (min-width: 768px) {
  .thumb-action-row {
    display: flex;
    width: auto;
    min-width: 360px;
    gap: 12px;
  }
}

.btn-random-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  background: #f0fdf4;
  border: 1.5px solid var(--primary-500);
  border-radius: var(--radius-md);
  color: var(--primary-800);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.btn-random-action:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.btn-random-action:active {
  transform: scale(0.97);
}

.random-dice-icon {
  font-size: 1.15rem;
  display: inline-block;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.btn-random-action:hover .random-dice-icon {
  transform: rotate(20deg) scale(1.15);
}

.thumb-action-row .btn-primary-action {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  white-space: nowrap;
  min-width: 0;
  box-sizing: border-box;
}

.btn-clear-link {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-600);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  transition: all 0.15s ease;
}

.btn-clear-link:hover {
  background: var(--danger-600);
  color: #ffffff;
  border-color: var(--danger-600);
}

.btn-clear-link:active {
  transform: scale(0.95);
}

@media (max-width: 400px) {
  .thumb-action-row {
    grid-template-columns: 1fr 1.25fr;
    gap: 6px;
  }
  .btn-random-action {
    padding: 10px 8px;
    font-size: 0.82rem;
    gap: 4px;
  }
  .thumb-action-row .btn-primary-action {
    padding: 10px 10px;
    font-size: 0.88rem;
  }
}

/* ----------------------------------------------------
   Step 3: สรุปผล & ส่งออก (Receipt Card & LINE Export)
   ---------------------------------------------------- */
.receipt-card {
  max-width: 740px;
  margin: 0 auto 24px auto;
  background: #ffffff;
  border: 2px solid var(--amber-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  position: relative;
  background-image: radial-gradient(#f8fafc 18%, transparent 19%);
  background-size: 16px 16px;
}

@media (min-width: 768px) {
  .receipt-card {
    padding: 36px 32px;
  }
}

.receipt-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 2px dashed var(--surface-border);
  margin-bottom: 20px;
}

.receipt-header h3 {
  font-family: 'Kanit', sans-serif;
  font-size: 1.45rem;
  color: var(--primary-900);
  font-weight: 600;
}

.receipt-date-range {
  display: inline-block;
  background: var(--primary-50);
  color: var(--primary-800);
  border: 1px solid var(--primary-200);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 10px;
}

.receipt-item-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.receipt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid #f1f5f9;
}

.receipt-num {
  font-family: 'Kanit', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-700);
  background: var(--primary-100);
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.receipt-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.receipt-dish-name {
  font-weight: 600;
}

.receipt-qty-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--primary-600);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.3);
}

.receipt-category-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.export-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 640px) {
  .export-actions-grid {
    flex-direction: row;
    justify-content: center;
  }
  .export-actions-grid button {
    flex: 1;
    max-width: 300px;
  }
}

.btn-line-export {
  background: #06c755;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'Kanit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(6, 199, 85, 0.35);
  transition: all 0.2s ease;
}

.btn-line-export:hover {
  background: #05b34c;
  transform: translateY(-2px);
}

.btn-download-txt {
  background: #ffffff;
  color: var(--text-main);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: 'Prompt', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-download-txt:hover {
  background: var(--surface-muted);
}

.btn-secondary-edit {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

/* ----------------------------------------------------
   Admin Drawer (จัดการเมนู & Soft Delete)
   ---------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  z-index: 110;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.drawer-backdrop.open .drawer-panel {
  transform: translate(-50%, 0);
}

.drawer-handle-bar {
  width: 44px;
  height: 5px;
  background: #cbd5e1;
  border-radius: var(--radius-full);
  margin: 12px auto 6px auto;
}

.drawer-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--surface-border);
}

.drawer-header h3 {
  font-family: 'Kanit', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-900);
}

.drawer-close-btn {
  background: var(--surface-muted);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-content {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-tab-nav {
  display: flex;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.admin-nav-item {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-nav-item.active {
  background: #ffffff;
  color: var(--primary-800);
  box-shadow: var(--shadow-sm);
}

.admin-search-filter-box {
  background: var(--surface-muted);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  border: 1px solid var(--surface-border);
}

.admin-filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-filter-pills::-webkit-scrollbar {
  display: none;
}

.admin-filter-pill {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  text-align: center;
}

.admin-filter-pill:hover {
  border-color: var(--primary-600);
}

.admin-filter-pill.active {
  background: var(--primary-700);
  color: #ffffff;
  border-color: var(--primary-800);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.admin-dish-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-dish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  gap: 12px;
}

.admin-dish-row.hidden-dish {
  background: #f8fafc;
  opacity: 0.7;
}

.admin-dish-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--surface-border);
}

.admin-dish-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.admin-dish-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-dish-index {
  color: var(--primary-700);
  font-weight: 700;
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

.admin-dish-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-dish-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-edit-dish {
  background: var(--surface-muted);
  border: 1px solid var(--surface-border);
  color: var(--primary-800);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-edit-dish:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  transform: translateY(-1px);
}

/* Category Management in Admin */
.add-cat-inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.add-cat-inline-form .form-input {
  flex: 1 1 200px;
  min-width: 0;
}

.add-cat-inline-form .btn-primary-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .add-cat-inline-form {
    flex-direction: column;
  }
  .add-cat-inline-form .btn-primary-action {
    width: 100%;
  }
}

.admin-cat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  gap: 10px;
}

.admin-cat-row.inactive {
  background: #f8fafc;
  opacity: 0.65;
}

.admin-cat-name {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
}

.admin-cat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cat-action {
  background: var(--surface-muted);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cat-action:hover {
  background: #e2e8f0;
}

/* iOS-Style Toggle Switch */
.switch-label {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  cursor: pointer;
  flex-shrink: 0;
}

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

.slider-round {
  position: absolute;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 34px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider-round {
  background-color: var(--primary-600);
}

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

/* Add Dish Form with Image Compressor */
.add-dish-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-select {
  padding: 12px 14px;
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-family: 'Prompt', sans-serif;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary-600);
}

.image-drop-area {
  border: 2px dashed var(--primary-200);
  background: var(--primary-50);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.image-drop-area:hover {
  border-color: var(--primary-600);
}

.image-preview-box {
  width: 100%;
  max-height: 180px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin-top: 10px;
  display: none;
}

.compression-status-badge {
  font-size: 0.78rem;
  color: var(--primary-700);
  margin-top: 6px;
  display: none;
  font-weight: 500;
}

/* ----------------------------------------------------
   Date Picker Modal (Strictly dd/mm/yyyy)
   ---------------------------------------------------- */
.calendar-picker-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.calendar-picker-modal.open {
  display: flex;
}

.calendar-box {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 400px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-nav-btn {
  background: var(--surface-muted);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
  font-size: 1.1rem;
}

.cal-title {
  font-family: 'Kanit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-900);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
}

.cal-day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.cal-day-cell:hover {
  background: var(--primary-100);
}

.cal-day-cell.selected {
  background: var(--primary-600);
  color: #ffffff;
  font-weight: 700;
}

/* ----------------------------------------------------
   Share Modal with QR Code
   ---------------------------------------------------- */
.qr-modal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px;
}

.qr-code-wrapper {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--amber-200);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  margin-bottom: 16px;
}

/* Toast Notification (ภาษาไทย) - Positioned at top out of the way */
.toast-notice {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
