/* Pho Cafe inspired theme for all pages */
.pho-theme-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #f6a14f 0%, #e2a14f 100%);
}

body.pho-theme-bg {
  background: linear-gradient(135deg, #f6a14f 0%, #e2a14f 100%);
}

/* Customer order pages (Dine-in and Takeaway) get image background */
body.customer-order-bg {
  background-color: #fbe7c6 !important;
  background-image: url('/data/menu-photos/app-bg.jpg') !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

.pho-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(124, 74, 46, 0.08);
  padding: 40px 32px 32px;
  border: 1px solid #f3e2c2;
  max-width: 480px;
  margin: 0 auto;
}

/* Mobile responsive adjustments for pho-card */
@media (max-width: 640px) {
  .pho-card {
    padding: 24px 16px 20px;
    border-radius: 16px;
    margin: 0 8px;
  }
}

.pho-button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
  width: 100%;
}

.pho-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  background: linear-gradient(90deg, #e2a14f 0%, #f6c177 100%);
  color: #7c4a2e;
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
  border: none;
  box-shadow: 0 2px 8px rgba(124, 74, 46, 0.06);
  transition: background 0.2s, color 0.2s;
}
.pho-btn:hover {
  background: linear-gradient(90deg, #f6c177 0%, #e2a14f 100%);
  color: #a67c52;
}
.pho-btn.secondary {
  background: #fff7ed;
  color: #e2a14f;
  border: 1px solid #e2a14f;
}
.pho-btn.danger {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fda4af;
}
.pho-btn.danger:hover {
  background: #ffe4e6;
}

/* Mobile touch-friendly buttons */
@media (max-width: 640px) {
  .pho-btn {
    padding: 12px 20px;
    font-size: 0.95rem;
    min-height: 44px; /* iOS touch target recommendation */
  }
}
/* Cookie theme background for index.html */
.cookie-bg {
  min-height: 100vh;
  background-color: #fbe7c6;
  background-image: url('data:image/svg+xml;utf8,<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="30" cy="30" r="28" fill="%23f6c177" stroke="%23e2a14f" stroke-width="4"/><circle cx="20" cy="24" r="3" fill="%23e2a14f"/><circle cx="40" cy="36" r="2.5" fill="%23e2a14f"/><circle cx="34" cy="18" r="2" fill="%23e2a14f"/><circle cx="26" cy="40" r="2" fill="%23e2a14f"/></svg>');
  background-repeat: repeat;
  background-size: 120px 120px;
}
:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172b4d;
  --muted: #6b778c;
  --primary: #2d6cdf;
  --primary-dark: #1f4fad;
  --success: #22a06b;
  --warning: #ffab00;
  --info: #0065ff;
  --danger: #de350b;
  --border: #e1e4ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* Full width container for mobile */
@media (max-width: 640px) {
  .container {
    padding: 16px 8px 32px;
    max-width: 100%;
  }
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  padding: 24px;
  border: 1px solid var(--border);
}

/* Flatten cards for mobile */
@media (max-width: 640px) {
  .card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    padding: 16px;
    background: rgba(255, 255, 255, 0.95);
  }
}

h1 {
  margin-top: 0;
}

h2 {
  margin-top: 0;
  font-size: 1.4rem;
}

p {
  color: var(--muted);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
}

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

.btn.secondary {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
}

/* Mobile touch-friendly buttons */
@media (max-width: 640px) {
  .btn {
    padding: 10px 14px;
    font-size: 0.9rem;
    min-height: 44px;
  }

  .btn.secondary {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
}

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

@media (max-width: 767px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
  box-sizing: border-box;
  min-width: 0;
}

/* Mobile touch-friendly inputs */
@media (max-width: 640px) {
  .input {
    padding: 12px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 44px;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge.pending {
  background: rgba(45, 108, 223, 0.12);
  color: var(--primary);
}

.badge.preparing {
  background: rgba(255, 171, 0, 0.18);
  color: #8a4f00;
}

.badge.ready {
  background: rgba(34, 160, 107, 0.15);
  color: var(--success);
}

.badge.delivered {
  background: rgba(45, 212, 191, 0.18);
  color: #0f766e;
}

.badge.completed {
  background: rgba(34, 160, 107, 0.2);
  color: #0f5f3e;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

/* Mobile adjustments for tables */
@media (max-width: 640px) {
  .table th,
  .table td {
    padding: 8px 6px;
    font-size: 0.85rem;
  }

  .table th {
    font-size: 0.8rem;
  }
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Mobile adjustments for toolbar */
@media (max-width: 640px) {
  .toolbar {
    gap: 8px;
  }

  .toolbar .pho-btn,
  .toolbar .btn {
    flex: 1;
    min-width: 120px;
  }

  .card .toolbar,
  .pho-card .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .card .toolbar .pho-btn,
  .pho-card .toolbar .pho-btn {
    width: 100%;
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Mobile adjustments for stack spacing */
@media (max-width: 640px) {
  .stack {
    gap: 10px;
  }

  main.stack {
    gap: 16px;
  }
}

.notice {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f0f4ff;
  color: #1f3f8b;
}

/* Mobile adjustments for notices */
@media (max-width: 640px) {
  .notice {
    padding: 10px;
    font-size: 0.9rem;
    border-radius: 8px;
  }
}

.order-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fafbff;
}

/* All items ready for delivery — highlight card green */
.order-card--all-ready {
  background: #f0fdf4;
  border-color: #86efac;
  box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.35);
}

/* QR code lightbox overlay */
.qr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: qr-fade-in 0.15s ease;
}
.qr-lightbox img {
  width: min(80vw, 80vh);
  height: min(80vw, 80vh);
  border-radius: 12px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
  pointer-events: none;
}
@keyframes qr-fade-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* Mobile adjustments for order cards */
@media (max-width: 640px) {
  .order-card {
    padding: 12px;
    border-radius: 10px;
    background: rgba(250, 251, 255, 0.95);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }

  .order-card h3 {
    font-size: 1rem;
  }

  .order-card .badge {
    font-size: 0.75rem;
    padding: 3px 8px;
  }
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: #ffffff;
}

/* Mobile adjustments for item rows */
@media (max-width: 640px) {
  .item-row {
    flex-direction: column;
 

/* Mobile adjustments for item actions */
@media (max-width: 640px) {
  .item-actions {
    width: 100%;
    gap: 6px;
  }

  .item-actions .btn {
    flex: 1;
    min-width: 100px;
    font-size: 0.85rem;
    padding: 10px 12px;
    min-height: 44px;
  }
}   align-items: flex-start;
    gap: 8px;
    padding: 10px;
  }

  .item-row > div:first-child {
    width: 100%;
  }
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-card {
  display: grid;
  gap: 8px;
}

.menu-card h3 {
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Flatten menu cards for mobile */
@media (max-width: 640px) {
  .menu-card {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(226, 161, 79, 0.2) !important;
    box-shadow: 0 2px 8px rgba(124, 74, 46, 0.04) !important;
    padding: 12px !important;
    border-radius: 12px !important;
  }

  .menu-card .menu-image {
    height: 120px;
    border-radius: 8px;
  }

  .menu-card h3 {
    font-size: 1rem;
    gap: 8px;
  }

  .menu-card .small {
    font-size: 0.75rem;
  }
}

.qty-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.qty-btn {
  min-width: 36px;
  padding: 6px 12px;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: bold;
}

.qty-input {
  flex: 1;
  text-align: center;
}

.menu-category {
  display: grid;
  gap: 12px;
}

.menu-category-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

/* Mobile adjustments for menu category */
@media (max-width: 640px) {
  .menu-category {
    gap: 8px;
    margin-bottom: 16px;
  }

  .menu-category-title {
    font-size: 1rem;
    padding: 0 8px;
    color: #7c4a2e;
    font-weight: 700;
  }
}

.order-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 11px 0;
  margin: 0;
  border-bottom: 2px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  width: 100%;
  left: 0;
  right: 0;
}

.order-header .toolbar,
.order-header nav,
.order-header .tab-bar {
  max-width: 100%;
  margin: 0;
  padding: 0 16px;
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 0 0;
  margin-top: 12px;
  transition: all 0.3s ease;
}

.category-nav button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.menu-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}

[hidden] { display: none !important; }

.tab-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tab-bar .btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.receipts-stack {
  display: grid;
  gap: 16px;
  justify-items: start;
}

.receipt-card {
  width: 240px;
  max-width: 100%;
  background: #ffffff;
  border: 1px dashed var(--border);
  border-radius: 6px;
  box-shadow: none;
  font-family: "Courier New", "Courier", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  letter-spacing: 0;
  padding: 16px;
}

.receipt-card * {
  font-family: inherit;
}

.receipt-header {
  text-align: center;
}

.receipt-business-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.receipt-divider {
  border-top: 1px dashed var(--border);
  margin: 10px 0;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.receipt-table td,
.receipt-table th {
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

.receipt-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.receipt-totals {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
}

.admin-grid {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 16px;
  align-items: start;
  width: 100%;
}

#menuEditor .admin-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

#menuEditor .admin-grid .menu-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 10px;
  order: -1;
}

.admin-row .menu-image {
  height: 140px;
  border-radius: 10px;
}

.admin-row .form-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
}

#menuEditor .admin-row .form-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.field-group label {
  margin-bottom: 0;
}

.field-group.full-width {
  grid-column: 1 / -1;
}

.admin-row .form-fields > button {
  grid-column: 1 / -1;
  margin-top: 8px;
  align-self: start;
}

.admin-row .form-fields > .btn {
  grid-column: 1 / -1;
}

.admin-row .input {
  width: 100%;
  min-width: 0;
}

.sub-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.sub-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sub-item-row .input {
  flex: 1;
}

.sub-item-row .btn.small {
  padding: 6px 12px;
  min-width: auto;
  font-size: 1.2rem;
  line-height: 1;
}

@media (max-width: 1200px) {
  .admin-grid {
    grid-template-columns: 140px 1fr auto;
  }
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
  
  .admin-row .form-fields {
    grid-template-columns: 1fr;
  }
  
  .field-group.full-width {
    grid-column: 1;
  }
}

.order-card h3 {
  margin: 4px 0 8px;
}

.small {
  font-size: 0.8rem;
  color: var(--muted);
}

.medium {
  font-size: 1.2rem;
  color: var(--muted);
}

.large {
  font-size: 1.6rem;
  color: var(--muted);
}

/* Ensure long audit text and danger zone content wrap inside their card */
#dangerZone,
#dangerZone .small,
#dangerZone .order-card,
#dangerZone .audit-details,
#dangerZone #adminAuditList {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#dangerZone .audit-details {
  white-space: pre-wrap;
  background: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  max-width: 100%;
}

/* Mobile responsive styles */
@media (max-width: 640px) {
  .order-header {
    padding: 8px 0;
    margin: 0;
  }

  .order-header .toolbar,
  .order-header nav,
  .order-header .tab-bar {
    padding: 0 12px;
  }

  .order-header .toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .order-header .toolbar > div {
    flex-direction: row;
    align-items: center;
    width: 100%;
  }

  .order-header img {
    width: 34px !important;
    height: 34px !important;
  }

  .order-header h2 {
    font-size: 1.1rem !important;
  }

  .category-nav {
    gap: 6px;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    overflow-x: visible;
  }

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

  .category-nav button {
    font-size: 0.72em !important;
    padding: 5px 10px !important;
    flex-shrink: 0;
  }

  .qty-control {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .qty-btn {
    min-width: 40px;
    padding: 10px 12px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .qty-input {
    flex: 1;
    min-width: 50px;
    font-size: 1rem;
    padding: 8px;
  }

  /* Cashier navigation tabs */
  header nav {
    gap: 6px !important;
    padding: 8px 0 !important;
  }

  header nav button {
    flex: 1;
    min-width: 0;
    padding: 8px 10px !important;
    font-size: 0.8em !important;
    white-space: nowrap;
  }

  header nav span {
    display: none !important;
  }

  /* Beeper modal adjustments */
  .beeper-modal-content {
    width: 95% !important;
    padding: 20px !important;
  }

  .beeper-buttons {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)) !important;
    gap: 8px !important;
  }

  .beeper-btn {
    padding: 14px 8px !important;
    font-size: 1rem !important;
  }

  /* Badge sizing */
  .badge {
    font-size: 0.75rem;
    padding: 3px 8px;
  }

  /* Better text sizing */
  .small {
    font-size: 0.75rem;
  }

  .medium {
    font-size: 1rem;
  }

  .large {
    font-size: 1.3rem;
  }

  /* Reports page responsive */
  .reports-controls {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .reports-controls input,
  .reports-controls button,
  .reports-controls label {
    width: 100%;
  }

  .reports-columns {
    grid-template-columns: 1fr !important;
  }

  /* Order board responsive */
  .order-number {
    font-size: 1rem !important;
    padding: 8px 10px !important;
  }

  .board-column h3 {
    font-size: 1rem !important;
  }
}

/* Additional mobile utilities */
@media (max-width: 480px) {
  .order-header h2 {
    font-size: 1.1rem !important;
  }

  .order-header .small {
    font-size: 0.7rem !important;
  }

  .pho-card {
    padding: 16px 12px !important;
  }
}

@media (max-width: 400px) {
  .order-header .toolbar > div {
    gap: 8px !important;
  }

  .order-header img {
    width: 28px !important;
    height: 28px !important;
  }

  .order-header h2 {
    font-size: 0.9rem !important;
  }

  .order-header .toolbar,
  .order-header nav {
    padding: 0 8px;
  }

  .category-nav button {
    font-size: 0.68em !important;
    padding: 4px 8px !important;
  }
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 200px;
}

/* Pulse animation for New Order button when all items delivered */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  }
}

/* ── Server connection badge ── */
.server-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}
.server-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.server-badge.connecting  { background: #f8fafc; color: #64748b; border-color: #cbd5e1; }
.server-badge.connected   { background: #f0fdf4; color: #16a34a; border-color: #86efac; }
.server-badge.disconnected { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.server-badge.reconnecting { background: #fffbeb; color: #d97706; border-color: #fcd34d; }
