* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f2f2f0;
  color: #1a1a1a;
  height: 100vh;
  overflow: hidden;
}
#app { height: 100vh; display: flex; flex-direction: column; }

/* MENU VIEW */
#menu-view { display: flex; flex-direction: column; height: 100%; }
#menu-header {
  padding: 16px 16px 12px;
  background: #fff;
  border-bottom: 1px solid #e0e0dd;
  flex-shrink: 0;
}
#menu-header h1 { font-size: 20px; font-weight: 600; margin: 0; }
#loading { padding: 40px; text-align: center; color: #888; }
#grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-content: start;
}
.table-btn {
  aspect-ratio: 1;
  border-radius: 12px;
  border: none;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: #4caf50;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.08s;
}
.table-btn:active { transform: scale(0.94); }
.table-btn.busy { background: #e53935; }

/* DETAIL VIEW */
#detail-view { display: none; flex-direction: column; height: 100%; }
#detail-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e0e0dd;
  flex-shrink: 0;
}
#back-btn {
  border: none;
  background: none;
  font-size: 28px;
  line-height: 1;
  padding: 4px 12px 4px 0;
  color: #1a1a1a;
  cursor: pointer;
}
#table-number {
  font-size: 32px;
  font-weight: 800;
  flex: 1;
  text-align: center;
  margin-right: 40px;
}
#order-text {
  flex: 1;
  border: none;
  resize: none;
  padding: 16px;
  font-size: 18px;
  line-height: 1.5;
  outline: none;
  background: #fff;
  font-family: inherit;
}
#detail-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e0e0dd;
  flex-shrink: 0;
}
#detail-footer button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
#confirm-btn { background: #4caf50; color: #fff; }
#clear-btn { background: #f0f0ee; color: #b3261e; }
#status-msg {
  text-align: center;
  font-size: 13px;
  color: #999;
  padding: 4px 0 0;
  height: 16px;
}
