/* ===== DOREMI Staff Portal CSS ===== */
:root {
  --red: #E63946;
  --red-dark: #C1121F;
  --yellow: #FFD603;
  --green: #4CAF50;
  --green-bg: #E8F5E9;
  --red-bg: #FFEBEE;
  --white: #FFFFFF;
  --bg: #F5F5F5;
  --text: #1A1A1A;
  --text-muted: #999;
  --text-light: #666;
  --border: #E0E0E0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-lg: 16px;
  --max-width: 480px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* ===== Screens ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ===== Login Screen ===== */
#loginScreen {
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  padding: 40px 20px;
}

#loginScreen.active {
  display: flex;
}

.login-box {
  text-align: center;
  width: 100%;
}

.login-logo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 16px;
  border: 3px solid var(--white);
  background: var(--white);
}

.login-box h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 1px;
}

.login-box h1 span {
  color: var(--yellow);
}

.login-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
  margin-bottom: 32px;
}

#loginForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#staffUsername, #staffPassword {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 1px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.15);
  color: var(--white);
  outline: none;
  transition: border-color 0.2s;
}

#staffUsername, #staffPassword {
  text-align: left;
}

#staffUsername::placeholder, #staffPassword::placeholder {
  color: rgba(255,255,255,0.4);
}

#staffUsername:focus, #staffPassword:focus {
  border-color: var(--yellow);
  background: rgba(255,255,255,0.2);
}

.btn-login {
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--red);
  background: var(--yellow);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s;
}

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

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.login-hint strong { color: var(--yellow); }

/* ===== Top Bar ===== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--red);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.top-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-lang-toggle {
  background: rgba(255,255,255,0.2);
  color: var(--white);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.2s;
}

.btn-lang-toggle:active {
  background: rgba(255,255,255,0.35);
}

.btn-logout {
  background: rgba(255,255,255,0.2);
  color: var(--white);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

/* ===== Tab Bar ===== */
.tab-bar {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 40;
}

.tab-btn {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 700;
}

.tab-icon { font-size: 20px; }

/* ===== Tab Panels ===== */
.tab-panel {
  display: none;
  padding: 20px 16px;
  min-height: calc(100vh - 56px - 48px);
}

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

/* ===== Scan Area ===== */
.scan-area {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
}

#qrReader {
  width: 100%;
  height: 100%;
}

#qrReader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* Style the library's built-in scan frame */
#qrReader img[alt="Info icon"] { display: none; }
#qrReader div { border: none !important; }

/* Single alignment frame — 65% matches qrbox function */
.scan-frame-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 65%;
  height: 65%;
  transform: translate(-50%, -50%);
  border: 3px solid var(--yellow);
  border-radius: 12px;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
}

.scan-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 12px 0 16px;
}

.btn-toggle-scan {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 16px;
  transition: transform 0.15s;
}

.btn-toggle-scan:active { transform: scale(0.97); }
.btn-toggle-scan.hidden { display: none; }
.btn-toggle-scan#btnStopScan { background: var(--text); }

.scan-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.manual-input {
  display: flex;
  gap: 8px;
}

#manualCode {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.2s;
}

#manualCode:focus { border-color: var(--red); }

.btn-verify {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  background: var(--yellow);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
}

/* ===== History List ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--green-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.history-info {
  display: flex;
  flex-direction: column;
}

.history-prize {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.history-code {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.history-time {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 40px 20px;
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card.stat-savings {
  grid-column: 1 / -1;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--red);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stats-breakdown {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stats-breakdown h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.breakdown-name { color: var(--text-light); }
.breakdown-count { font-weight: 700; color: var(--text); }

/* ===== Records: sub-tabs & filters ===== */
.rec-sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.rec-sub-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.rec-sub-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.rec-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.rec-date-filter {
  flex: 1;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px;
  color: var(--text);
}
.rec-date-picker {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px;
  color: var(--text);
  width: 0;
  min-width: 130px;
}
.rec-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rec-date-range.hidden { display: none; }
.date-range-sep {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.history-meta {
  display: flex;
  gap: 12px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}
.history-staff {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.history-value {
  font-weight: 700;
  color: var(--green);
}

/* ===== Records: daily summary ===== */
.stats-daily {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.stats-daily h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}
.daily-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.daily-row:last-child { border-bottom: none; }
.daily-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.daily-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-light);
}
.daily-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}
.daily-stat small {
  font-size: 10px;
  color: var(--text-muted);
}

/* ===== Admin tab: sub-tabs ===== */
.admin-manager {
  padding-top: 4px;
}
.admin-sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.admin-sub-btn {
  flex: 1;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.admin-sub-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ===== Prize Manager ===== */
.prize-manager-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.prize-manager-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.prize-manager-controls {
  margin-bottom: 14px;
}
.btn-prize-add {
  width: 100%;
  padding: 12px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.prize-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prize-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.prize-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.prize-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.prize-thumb-emoji {
  font-size: 24px;
}
.prize-item-info {
  flex: 1;
  min-width: 0;
}
.prize-item-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.prize-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.prize-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.prize-item-actions button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-prize-edit { color: var(--text); }
.btn-prize-del { color: var(--red); }
.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Prize editor: preview, toggle, badges, simulate ===== */
.prize-main-preview {
  text-align: center;
  margin-bottom: 14px;
}
.prize-main-preview canvas {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  max-width: 100%;
}
/* Modal preview removed — preview is on main Prizes page only */

/* Color presets */
.color-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.color-preset-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border 0.15s, transform 0.15s;
  outline: none;
}
.color-preset-btn:hover {
  transform: scale(1.15);
}
.color-preset-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--text);
}

/* Input with % suffix */
.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-suffix input {
  flex: 1;
  padding-right: 32px;
}
.input-suffix {
  position: absolute;
  right: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}
.prize-enable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}
/* iOS-style toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 30px;
  transition: 0.3s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}
.switch input:checked + .slider {
  background: var(--green, #4CAF50);
}
.switch input:checked + .slider:before {
  transform: translateX(22px);
}
.prize-item-off {
  opacity: 0.55;
}
.prize-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 4px;
}
.badge-active { background: #E8F5E9; color: #2E7D32; }
.badge-off { background: #ECEFF1; color: #546E7A; }
.badge-upcoming { background: #FFF3E0; color: #E65100; }
.badge-expired { background: #FFEBEE; color: #C62828; }
.prize-simulate-box {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.btn-prize-simulate {
  width: 100%;
  padding: 11px;
  background: #FF9800;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.simulate-result {
  margin-top: 10px;
}
.simulate-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.simulate-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.simulate-row:last-child { border-bottom: none; }
.simulate-label { color: var(--text-light); }
.simulate-count { font-weight: 700; color: var(--text); }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 360px;
  width: 100%;
  overflow: hidden;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 24px;
  text-align: center;
}

.modal-header.valid { background: var(--green); }
.modal-header.invalid { background: var(--red); }
.modal-header.redeemed { background: var(--text-muted); }

.modal-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
}

.modal-body {
  padding: 20px;
}

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

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

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

.detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

.detail-value.mono {
  font-family: monospace;
  letter-spacing: 1px;
}

.detail-value.status-valid { color: var(--green); }
.detail-value.status-redeemed { color: var(--red); }
.detail-value.status-expired { color: var(--text-muted); }

.modal-actions {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
}

.btn-redeem {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  background: var(--green);
  color: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-redeem:active { transform: scale(0.97); }
.btn-redeem:disabled { background: #CCC; cursor: not-allowed; }

.btn-cancel {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  background: #F0F0F0;
  color: var(--text-light);
  border-radius: var(--radius);
  cursor: pointer;
}

/* ===== Responsive ===== */
@media (min-width: 481px) {
  body {
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
  }
}

/* ===== Customer Search ===== */
.customer-search-bar {
  margin-bottom: 16px;
}

.search-type-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.search-type-btn {
  flex: 1;
  padding: 8px 4px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.search-type-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.search-input-row {
  display: flex;
  gap: 8px;
}

#customerSearchInput {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

#customerSearchInput:focus { border-color: var(--red); }

.btn-search {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  background: var(--yellow);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s;
}

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

.search-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== Customer Results ===== */
.customer-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.customer-result-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.customer-result-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow);
}

.cust-result-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red-bg);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.cust-result-info {
  flex: 1;
  min-width: 0;
}

.cust-result-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cust-result-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.cust-result-doid {
  font-family: monospace;
  letter-spacing: 0.5px;
  color: var(--red);
  font-weight: 600;
}

.cust-result-birthday-badge {
  background: #FFF3D6;
  color: #E65100;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* ===== Customer Detail Modal ===== */
.customer-modal-card {
  max-width: 380px;
}

.customer-header {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  padding: 28px 24px 20px;
}

.customer-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--white);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  margin: 0 auto 10px;
  border: 3px solid var(--yellow);
}

.customer-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}

.cust-doid {
  font-family: monospace;
  font-size: 13px;
  color: var(--yellow);
  letter-spacing: 1px;
  font-weight: 600;
}

.birthday-row {
  padding: 4px 0;
}

.btn-birthday-greet {
  background: linear-gradient(135deg, #FF6B6B 0%, #E63946 100%);
  color: var(--white);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  box-shadow: 0 2px 8px rgba(230,57,70,0.3);
}

.btn-birthday-greet:active { transform: scale(0.95); }
.btn-birthday-greet.hidden { display: none; }

.customer-modal-actions {
  justify-content: center;
}

.btn-close-customer {
  flex: 1;
}

/* ===== Greeting Modal ===== */
.greeting-modal-card {
  max-width: 360px;
}

.greeting-header {
  background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
}

.greeting-body {
  padding: 20px;
}

.greeting-message-preview {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.btn-greet-option {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 10px;
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-greet-option:active { transform: scale(0.97); }

#btnSendEmail {
  background: #E3F2FD;
  color: #1565C0;
}

#btnSendSMS {
  background: #E8F5E9;
  color: #2E7D32;
}

/* ===== Birthday Reminder Tab ===== */
.reminder-header {
  margin-bottom: 16px;
}

.reminder-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.reminder-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.reminder-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow 0.2s;
}

.reminder-card:hover {
  box-shadow: var(--shadow);
}

.reminder-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B6B 0%, #E63946 100%);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
}

.reminder-info {
  flex: 1;
  min-width: 0;
}

.reminder-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.reminder-name .bday-cake {
  font-size: 14px;
}

.reminder-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.reminder-meta .reminder-doid {
  font-family: monospace;
  color: var(--red);
  font-weight: 600;
}

.reminder-meta .reminder-phone {
  color: var(--text-light);
}

.btn-send-sms {
  background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
  color: var(--white);
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s;
  box-shadow: 0 2px 8px rgba(46,125,50,0.25);
}

.btn-send-sms:active { transform: scale(0.93); }

.btn-send-sms .sms-icon {
  font-size: 18px;
}

.reminder-empty {
  text-align: center;
  padding: 60px 20px;
}

.reminder-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.reminder-empty p {
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}

.reminder-empty-sub {
  font-size: 13px !important;
  color: var(--text-muted) !important;
  font-weight: 400 !important;
  margin-top: 4px;
}

/* ===== Accounts Gate ===== */
.accounts-gate {
  text-align: center;
  padding: 40px 20px;
}

.gate-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.gate-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.gate-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

#adminPasswordInput,
#menuPasswordInput {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 12px;
}

#adminPasswordInput:focus,
#menuPasswordInput:focus { border-color: var(--red); }
#adminPasswordInput.border-error,
#menuPasswordInput.border-error { border-color: #FF4444; }

.btn-gate-enter {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-gate-enter:active { transform: scale(0.97); }

.gate-error {
  margin-top: 12px;
  font-size: 13px;
  color: #FF4444;
  font-weight: 600;
}

.gate-error.hidden { display: none; }

/* ===== Accounts Manager ===== */
.accounts-manager.hidden { display: none; }

.acct-sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.acct-sub-btn {
  flex: 1;
  padding: 10px 4px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.acct-sub-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.acct-sub-panel.hidden { display: none; }

/* ===== Staff Account Cards ===== */
#staffListContainer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.staff-acct-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: box-shadow 0.2s;
}

.staff-acct-card:hover {
  box-shadow: var(--shadow);
}

.staff-acct-view {
  display: flex;
  align-items: center;
  gap: 12px;
}

.staff-acct-view.hidden { display: none; }

.staff-acct-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.staff-acct-details {
  flex: 1;
  min-width: 0;
}

.staff-acct-username {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.self-badge {
  background: var(--green-bg);
  color: var(--green);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.staff-acct-password {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pwd-mask {
  letter-spacing: 2px;
}

.staff-acct-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.btn-staff-edit, .btn-staff-delete {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s;
}

.btn-staff-edit {
  background: #E3F2FD;
  color: #1565C0;
}

.btn-staff-delete {
  background: var(--red-bg);
  color: var(--red);
}

.btn-staff-delete:disabled {
  background: #F0F0F0;
  color: #CCC;
  cursor: not-allowed;
}

.btn-staff-edit:active, .btn-staff-delete:active {
  transform: scale(0.93);
}

/* ===== Staff Edit Mode ===== */
.staff-acct-edit.hidden { display: none; }

.edit-field {
  margin-bottom: 12px;
}

.edit-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.edit-field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.edit-field input:focus { border-color: var(--red); }

.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-staff-save, .btn-staff-cancel {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s;
}

.btn-staff-save {
  background: var(--green);
  color: var(--white);
}

.btn-staff-save:active { transform: scale(0.97); }

.btn-staff-cancel {
  background: #F0F0F0;
  color: var(--text-light);
}

/* ===== Add Staff Form ===== */
.add-staff-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

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

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

.form-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus { border-color: var(--red); }

.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  resize: vertical;
}

.form-group textarea:focus { border-color: var(--red); }

.btn-add-staff {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  transition: transform 0.15s;
}

.btn-add-staff:active { transform: scale(0.97); }

/* ===== Utilities ===== */
.hidden { display: none !important; }

/* ===== Menu Manager ===== */
.menu-manager.hidden { display: none; }
.menu-manager { padding: 0 4px; }

.menu-manager-header {
  margin-bottom: 16px;
}

.menu-manager-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.menu-manager-header p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Cloud Sync Status Bar */
.cloud-sync-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 12px;
}

.sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  flex-shrink: 0;
}

.sync-status-dot.online { background: var(--green); }
.sync-status-dot.offline { background: #ccc; }

.sync-status-text {
  flex: 1;
  color: var(--text-muted);
}

.btn-sync-now {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid var(--green);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-sync-now:active { transform: scale(0.95); }

.menu-manager-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.cat-controls-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.menu-cat-select {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 13px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  outline: none;
}

.btn-cat-mgmt {
  flex-shrink: 0;
  width: 38px;
  padding: 0;
  font-size: 15px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.2s;
  line-height: 1;
}

.btn-cat-mgmt:active { transform: scale(0.93); }

.btn-cat-reorder { font-size: 12px; color: var(--text-muted); }
.btn-cat-reorder:hover { border-color: var(--text-muted); color: var(--text); }
.btn-cat-reorder:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-cat-edit:hover { border-color: var(--red); }
.btn-cat-add { border-color: var(--green); color: var(--green); }
.btn-cat-add:hover { background: rgba(34,197,94,0.08); }

.btn-menu-add {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s;
}

.btn-menu-add:active { transform: scale(0.97); }

.menu-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-edit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}

.menu-edit-card:active { transform: scale(0.98); }

.menu-edit-card:hover { box-shadow: var(--shadow); }

.menu-edit-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--yellow-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
}

.menu-edit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu-edit-info {
  flex: 1;
  min-width: 0;
}

.menu-edit-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-edit-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-edit-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--red);
  flex-shrink: 0;
}

.menu-modal-card {
  max-width: 380px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.menu-modal-card .modal-header {
  padding: 16px 20px;
  flex-shrink: 0;
}

.menu-modal-card .modal-header h2 {
  font-size: 18px;
}

.menu-modal-card .modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.menu-modal-card .modal-actions {
  flex-shrink: 0;
  padding: 12px 16px;
}

.menu-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-delete-menu {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: var(--radius);
  cursor: pointer;
  margin-right: auto;
  transition: background 0.15s;
}

.btn-delete-menu:active { background: rgba(230,57,70,0.1); }

.btn-save-menu {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-save-menu:active { transform: scale(0.97); }

/* ===== Tab bar: 6 tabs compact ===== */
@media (max-width: 380px) {
  .tab-btn { font-size: 10px; }
  .tab-icon { font-size: 18px; }
  .tab-btn { padding: 8px 0; }
}

/* ===== Menu Edit Modal: compact on mobile ===== */
@media (max-width: 480px) {
  .menu-modal-card {
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 12px;
  }

  .menu-modal-card .modal-header {
    padding: 12px 14px;
  }

  .menu-modal-card .modal-header h2 {
    font-size: 16px;
  }

  .menu-modal-card .modal-body {
    padding: 12px 14px;
  }

  .menu-modal-card .form-group {
    margin-bottom: 10px;
  }

  .menu-modal-card .form-group label {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .menu-modal-card .form-group input,
  .menu-modal-card .img-upload-area input[type="text"] {
    padding: 8px 10px;
    font-size: 14px;
  }

  .menu-modal-card .img-upload-area {
    padding: 8px;
  }

  .menu-modal-card .img-preview-wrap {
    max-width: 120px;
    margin-bottom: 8px;
  }

  .menu-modal-card .img-placeholder-icon {
    font-size: 26px;
  }

  .menu-modal-card .img-placeholder-text {
    font-size: 11px;
  }

  .menu-modal-card .img-placeholder-size {
    font-size: 10px;
  }

  .menu-modal-card .btn-img-upload,
  .menu-modal-card .btn-img-remove {
    padding: 6px 14px;
    font-size: 12px;
  }

  .menu-modal-card .modal-actions {
    padding: 10px 14px;
    gap: 6px;
  }

  .menu-modal-card .btn-delete-menu,
  .menu-modal-card .btn-cancel,
  .menu-modal-card .btn-save-menu {
    padding: 10px 12px;
    font-size: 13px;
    flex: 1;
    min-width: 0;
  }

  .menu-modal-card .btn-delete-menu {
    margin-right: 0;
  }
}

/* ===== Image Upload Area ===== */
.img-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.img-upload-area.drag-over {
  border-color: var(--red);
  background: var(--red-bg);
}

.img-preview-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 200px;
  margin: 0 auto 10px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #FAFAFA;
  cursor: pointer;
  position: relative;
}

.img-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
}

.img-placeholder-icon {
  font-size: 36px;
  line-height: 1;
}

.img-placeholder-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
}

.img-placeholder-size {
  font-size: 11px;
  color: var(--text-muted);
}

.img-upload-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn-img-upload,
.btn-img-remove {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s;
}

.btn-img-upload {
  border-color: var(--red);
  color: var(--red);
}

.btn-img-upload:active { transform: scale(0.96); }
.btn-img-remove:active { transform: scale(0.96); }

.btn-img-remove.hidden { display: none; }

/* Make the URL input inside upload area match form style */
.img-upload-area input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  border: 2px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.img-upload-area input[type="text"]:focus { border-color: var(--red); }
