@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --orange: #FF8A40;
  --orange-dark: #E8722A;
  --orange-light: #FFE4CC;
  --orange-pale: #FFF3E8;
  --ink: #2B2B2B;
  --ink-soft: #6B6560;
  --white: #FFFFFF;
  --green-ok: #2E4A2B;
  --red-err: #D9534F;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, #FFF9F3 0%, var(--orange-pale) 100%);
  color: var(--ink);
  width: 100vw;
  height: 100vh;
  position: relative;
}

h1, h2 { font-family: 'Baloo 2', 'Nunito', sans-serif; }

.screen {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  flex-direction: column;
  align-items: center;
}
.screen.active { display: flex; }

.fullscreen-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 500;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255,138,64,0.15);
  color: var(--orange-dark);
  font-size: 20px;
  cursor: pointer;
}
.fullscreen-btn:active { background: rgba(255,138,64,0.3); }

.conn-error {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  background: #FBE4E1;
  color: #C0392B;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}
.conn-error button {
  background: #C0392B; color: #fff; border: none; border-radius: 8px;
  padding: 4px 10px; margin-left: 6px; cursor: pointer; font-weight: 700;
}

/* LOADING */
.loading-box { text-align: center; margin: auto; }
.loading-logo { width: 140px; height: 140px; object-fit: contain; animation: bounce 1.4s ease-in-out infinite; }
.loading-box p { margin-top: 14px; color: var(--ink-soft); font-weight: 700; }
@keyframes bounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }

.spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 6px solid var(--orange-light); border-top-color: var(--orange);
  margin: 0 auto; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* CARD */
.card {
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 10px 34px rgba(255,138,64,0.18);
  padding: 32px;
  width: 100%;
  max-width: 460px;
  margin: auto;
  position: relative;
  text-align: center;
  border: 3px solid var(--orange-light);
}
.center-card { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.muted { color: var(--ink-soft); font-size: 14px; }
.center-text { text-align: center; }

.text-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--orange-light);
  border-radius: 14px;
  font-size: 18px;
  margin-top: 10px;
  background: #FFFBF6;
  color: var(--ink);
  text-align: center;
}
.text-input:focus { outline: none; border-color: var(--orange); }

.btn {
  border: none;
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 800;
  font-family: 'Baloo 2', sans-serif;
  cursor: pointer;
  margin-top: 14px;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 6px 0 var(--orange-dark); }
.btn-primary:active { background: var(--orange-dark); box-shadow: 0 2px 0 var(--orange-dark); transform: translateY(4px); }
.btn-secondary { background: var(--orange-pale); color: var(--orange-dark); }
.btn-secondary:active { background: var(--orange-light); }
.error-text { color: var(--red-err); font-size: 14px; min-height: 18px; font-weight: 700; }

.back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 15px;
  cursor: pointer;
  font-weight: 700;
}

/* HOME */
#screen-home { padding-top: 30px; }
.home-header { text-align: center; margin-bottom: 4px; }
.home-logo { width: 76px; height: 76px; object-fit: contain; margin-bottom: 6px; }
.home-header h1 { font-size: 28px; color: var(--orange-dark); }
.clock { font-size: 16px; color: var(--ink-soft); margin-top: 4px; font-weight: 700; }

.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px;
  width: 100%;
  max-width: 900px;
  margin-top: 20px;
}
.employee-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(255,138,64,0.14);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.1s;
  border: 2px solid var(--orange-light);
}
.employee-card:active { transform: scale(0.95); background: var(--orange-pale); }
.employee-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--orange-light);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--orange-dark);
  font-weight: 800;
  font-family: 'Baloo 2', sans-serif;
}
.employee-name { font-weight: 800; text-align: center; font-size: 15px; color: var(--ink); }
.employee-division { font-size: 11px; margin-top: 2px; font-weight: 700; color: var(--orange-dark); }
.empty-state { margin: auto; text-align: center; color: var(--ink-soft); }

/* PIN */
.pin-photo {
  width: 90px; height: 90px; border-radius: 50%; object-fit: cover; background: var(--orange-light);
  border: 3px solid var(--orange-light);
}
.pin-dots { display: flex; gap: 14px; margin: 10px 0; }
.pin-dots span {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--orange-light); display: inline-block;
}
.pin-dots span.filled { background: var(--orange); border-color: var(--orange); }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 300px;
  margin-top: 14px;
}
.keypad button {
  padding: 18px 0;
  font-size: 22px;
  font-weight: 800;
  border-radius: 16px;
  border: none;
  background: var(--orange-pale);
  color: var(--ink);
  cursor: pointer;
}
.keypad button:active { background: var(--orange-light); }
.keypad button.key-alt { background: #F5EEE7; font-size: 16px; color: var(--ink-soft); }

/* CAMERA */
.camera-wrap {
  width: 100%;
  max-width: 380px;
  aspect-ratio: 4/3;
  border-radius: 20px;
  overflow: hidden;
  background: #222;
  margin: 10px 0;
  position: relative;
  border: 3px solid var(--orange-light);
}
.camera-wrap video, .camera-wrap img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#previewControls { display: flex; gap: 10px; width: 100%; }
#previewControls .btn { flex: 1; }

/* NOTE */
.note-textarea { resize: vertical; font-family: inherit; text-align: left; min-height: 80px; }

/* SUCCESS */
.success-card { gap: 6px; }
.success-icon {
  width: 76px; height: 76px; border-radius: 50%; background: var(--green-ok); color: #fff;
  font-size: 40px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.success-name { font-size: 20px; font-weight: 800; color: var(--orange-dark); }
.success-time { font-size: 32px; font-weight: 800; letter-spacing: 1px; color: var(--ink); }
.success-subtitle { font-size: 14px; font-weight: 800; color: var(--orange-dark); margin-top: 2px; }

/* ===================== TUTUP KASIR ===================== */

.tutup-kasir-fab {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 15px;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
}
.tutup-kasir-fab:active { transform: translateX(-50%) scale(0.96); }
.tk-icon { width: 20px; height: 20px; flex-shrink: 0; }

.wide-card {
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 10px 34px rgba(255,138,64,0.18);
  padding: 28px;
  width: 100%;
  max-width: 640px;
  margin: 24px auto;
  position: relative;
  border: 3px solid var(--orange-light);
}
.wide-card h2 { font-size: 22px; color: var(--orange-dark); margin-top: 26px; }
.wide-card .muted { margin-top: 4px; margin-bottom: 16px; }
.wide-card .btn-block { margin-top: 18px; }

.shift-pick-grid { display: flex; gap: 14px; width: 100%; margin-top: 18px; }
.shift-pick-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--orange-pale);
  border: 2px solid var(--orange-light);
  border-radius: 18px;
  padding: 22px 10px;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--orange-dark);
  cursor: pointer;
}
.shift-pick-btn:active { background: var(--orange-light); transform: scale(0.97); }
.shift-pick-emoji { font-size: 34px; }

.sales-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 14px;
  width: 100%;
}
.sales-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: left;
}
.sales-grid .text-input { margin-top: 0; text-align: left; font-size: 16px; }

.dine-in-preview {
  margin-top: 14px;
  background: var(--orange-pale);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange-dark);
  text-align: left;
}

.dyn-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.dyn-item {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--orange-pale);
  border-radius: 14px;
  padding: 10px 12px;
}
.dyn-item input, .dyn-item select { flex: 1; padding: 8px 10px; font-size: 14px; margin-top: 0; }
.dyn-item input.dyn-amount { max-width: 130px; }
.dyn-item-refund { flex-direction: column; align-items: stretch; }
.dyn-refund-row1 { display: flex; gap: 8px; align-items: center; }
.dyn-refund-alasan { margin-top: 8px; width: 100%; }
.dyn-item-remove {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: #FBE4E1;
  color: #C0392B;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dyn-empty { color: var(--ink-soft); font-size: 13px; padding: 10px 4px; text-align: left; }

.review-body { width: 100%; text-align: left; }
.review-section { margin-bottom: 16px; }
.review-section-title { font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--orange-dark); font-size: 14px; margin-bottom: 8px; }
.review-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; border-bottom: 1px dashed var(--orange-light); }
.review-row.total { font-weight: 800; color: var(--ink); border-bottom: none; padding-top: 8px; }
.review-empty { font-size: 13px; color: var(--ink-soft); }

.closing-result-box { width: 100%; text-align: left; margin: 6px 0 14px; }
.closing-result-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--orange-pale); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px;
}
.closing-result-row .crr-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.closing-result-row .crr-value { font-size: 20px; font-weight: 800; color: var(--orange-dark); }
.closing-result-row.big { background: var(--green-ok); }
.closing-result-row.big .crr-label { color: rgba(255,255,255,0.85); }
.closing-result-row.big .crr-value { color: #fff; font-size: 26px; }
.closing-result-row.warn { background: #FBE4E1; }
.closing-result-row.warn .crr-label { color: #C0392B; }
.closing-result-row.warn .crr-value { color: #C0392B; }
