:root {
  --primary: #FF6B00;
  --bg-color: #F8F8F8;
  --text-main: #333333;
  --text-sub: #999999;
  --border: #EEEEEE;
  --white: #FFFFFF;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #ECECEC;
  color: var(--text-main);
  line-height: 1.5;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg-color);
  position: relative;
  padding-bottom: 60px; /* For bottom nav */
}

.app-container.with-bottom-bar {
  padding-bottom: 80px;
}

/* Header & Tabs */
.header {
  background: var(--white);
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.header .back {
  font-size: 14px;
  cursor: pointer;
  color: var(--text-main);
}
.header .title {
  flex: 1;
  text-align: center;
  font-weight: 500;
  margin-right: 40px; /* visually center title */
}

.tabs {
  display: flex;
  background: var(--white);
  padding: 12px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.tab {
  flex: 1;
  text-align: center;
  font-size: 15px;
  color: var(--text-sub);
  padding-bottom: 8px;
  position: relative;
  cursor: pointer;
}
.tab.active {
  color: var(--text-main);
  font-weight: 500;
}
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background-color: var(--primary);
  border-radius: 2px;
}

/* Order List */
.order-list {
  padding: 12px;
}
.order-group {
  margin-bottom: 16px;
}
.group-header {
  display: flex;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.time-details {
  flex: 1;
}
.dining-time {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.order-time {
  color: var(--text-sub);
  font-size: 12px;
}
.group-status {
  float: right;
  color: var(--primary);
}
.group-meta {
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.delivery-highlight {
  color: var(--primary);
  font-weight: bold;
}
.badge-invoiced {
  font-size: 11px;
  color: #999;
  background: #eee;
  padding: 2px 6px;
  border-radius: 4px;
}
.dish-more {
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 8px;
  background: #FAFAFA;
  padding: 6px 0;
  border-radius: 6px;
}
.checkbox-wrap {
  margin-right: 8px;
}
.checkbox {
  width: 18px;
  height: 18px;
  border: 1px solid var(--text-sub);
  border-radius: 50%;
  appearance: none;
  outline: none;
  cursor: pointer;
  position: relative;
}
.checkbox:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.checkbox:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.order-card {
  background: var(--white);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.shop-name {
  font-size: 14px;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.dish-info {
  display: flex;
}
.dish-img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  background-color: #E0E0E0;
  margin-right: 12px;
  object-fit: cover;
  background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0), linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
}
.dish-detail {
  flex: 1;
}
.dish-name {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}
.dish-meta {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
}

/* FAB */
.fab-invoice {
  position: fixed;
  right: calc(50% - 280px); /* relative to container max-width */
  bottom: 80px;
  background-color: var(--primary);
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s;
}
@media (max-width: 600px) {
  .fab-invoice {
    right: 20px;
  }
}
.fab-invoice:active {
  transform: scale(0.95);
}
.fab-invoice .icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: 60px;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.nav-item {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
}
.nav-item.active {
  color: var(--primary);
  font-weight: 500;
}

/* Bottom Action Bar */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: var(--white);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  z-index: 20;
}
.summary {
  font-size: 14px;
}
.summary .highlight {
  color: var(--primary);
  font-weight: 500;
  font-size: 16px;
}
.btn {
  border: none;
  outline: none;
  border-radius: 20px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn:active {
  opacity: 0.8;
}
.btn.primary {
  background-color: var(--primary);
  color: white;
}
.btn.primary.disabled {
  background-color: #CCCCCC;
  cursor: not-allowed;
}
.btn.full-width {
  width: 100%;
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
}

/* Success Page */
.success-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--white);
  height: 100vh;
}
.success-icon {
  width: 72px;
  height: 72px;
  background-color: #07C160;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 24px;
}
.success-title {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
}
.success-desc {
  font-size: 15px;
  color: var(--text-sub);
  text-align: center;
  margin-bottom: 8px;
}
.success-note {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 8px 16px;
  border-radius: 8px;
  margin-top: 16px;
  margin-bottom: 32px;
}

/* Invoice Page */
.invoice-summary {
  background: var(--primary);
  color: white;
  padding: 24px 16px;
}
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  margin-bottom: 8px;
}
.summary-item .price {
  font-size: 28px;
  font-weight: bold;
}
.summary-item.sub-item {
  font-size: 13px;
  opacity: 0.8;
}
.summary-tips {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 12px;
}

.selected-orders-container {
  padding: 16px;
  background: var(--white);
  margin-top: 12px;
}
.list-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 12px;
}

.form-container {
  background: var(--white);
  margin-top: 12px;
  border-radius: 12px 12px 0 0;
  padding: 20px 16px;
}
.form-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 8px;
}
.form-group label .required {
  color: #FF4D4F;
}
.form-group input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
}
.form-group input:focus {
  border-color: var(--primary);
}

/* Toast & Loading */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 999;
  display: none;
  text-align: center;
  white-space: nowrap;
}
.toast.show {
  display: block;
  animation: fadeIn 0.3s;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.8);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.loading-overlay.show {
  display: flex;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-text {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-sub);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.simplified-content {
  background: var(--white);
  padding: 12px;
  border-radius: 8px;
  margin-top: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.info-row {
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 6px;
}
.info-row:last-child {
  margin-bottom: 0;
}
.info-row .label {
  color: var(--text-sub);
}
.amount-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
}
.delivery-highlight {
  color: var(--primary);
  font-weight: bold;
}
