/* ============================================================
   ZI_MASSAGE — tema admin
   Identitas: hijau daun & putih. Sidebar kiri hijau daun.
   ============================================================ */
:root {
  --green-950: #0d3b21;
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #1b7a3e;
  --green-600: #22883f;
  --green-500: #2f9e52;
  --green-200: #bfe8cb;
  --green-100: #e2f4e7;
  --green-50: #f2faf4;
  --ink: #1c2a21;
  --muted: #5f7266;
  --line: #dce9df;
  --surface: #ffffff;
  --bg: #f4f8f5;
  --amber: #b45309;
  --amber-bg: #fef3e2;
  --red: #dc2626;
  --red-bg: #fdeaea;
  --blue: #1d4ed8;
  --blue-bg: #e8eefc;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 52, 32, .08), 0 8px 24px rgba(16, 52, 32, .06);
  --sidebar-w: 248px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { vertical-align: middle; }
a { color: var(--green-700); }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(47, 158, 82, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(22, 101, 52, .16), transparent 55%),
    var(--green-50);
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 30px 28px;
}
.login-logo {
  width: 58px; height: 58px; border-radius: 16px;
  background: linear-gradient(150deg, var(--green-800), var(--green-500));
  display: grid; place-items: center; color: #fff; margin-bottom: 14px;
}
.login-card h1 { font-size: 24px; }
.login-card .tagline { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login-cta {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line);
  font-size: 13px; color: var(--muted); text-align: center;
}

/* ---------- layout aplikasi ---------- */
.shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  background: linear-gradient(180deg, var(--green-900) 0%, var(--green-800) 55%, var(--green-700) 100%);
  color: #eaf7ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 16px;
}
.brand-badge {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  display: grid; place-items: center; flex: 0 0 auto;
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: rgba(234, 247, 238, .75); }

.nav { padding: 6px 12px 14px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: rgba(234,247,238,.6); margin: 14px 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 10px 12px;
  margin: 2px 0;
  border: 0; border-radius: 11px;
  background: transparent; color: inherit;
  cursor: pointer; text-align: left;
  font-size: 14px; font-weight: 500;
}
.nav-item svg { opacity: .9; flex: 0 0 auto; }
.nav-item:hover { background: rgba(255, 255, 255, .1); }
.nav-item.active { background: #ffffff; color: var(--green-800); font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,.16); }
.nav-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.14); font-size: 12px; color: rgba(234,247,238,.75); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar .spacer { flex: 1; }
.hamburger { display: none; }
.top-user { text-align: right; line-height: 1.2; }
.top-user b { font-size: 14px; }
.top-user span { display: block; font-size: 11px; color: var(--muted); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--green-100); color: var(--green-800);
  display: grid; place-items: center; font-weight: 700;
}

/* lonceng notifikasi */
.bell-wrap { position: relative; }
.bell-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
}
.bell-btn:hover { background: var(--green-50); }
.bell-btn.has-unread { animation: bell-pulse 2.4s ease-in-out infinite; border-color: var(--green-500); }
@keyframes bell-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(47,158,82,.35); } 50% { box-shadow: 0 0 0 7px rgba(47,158,82,0); } }
.bell-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--red); color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.bell-panel {
  position: absolute; right: 0; top: 48px;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 60;
}
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.bell-head button { border: 0; background: none; color: var(--green-700); font-size: 12px; cursor: pointer; font-weight: 600; }
.bell-list { max-height: 380px; overflow-y: auto; }
.bell-item { padding: 11px 14px; border-bottom: 1px solid var(--green-50); cursor: pointer; }
.bell-item:hover { background: var(--green-50); }
.bell-item.unread { background: var(--green-100); }
.bell-item b { display: block; font-size: 13px; }
.bell-item p { margin: 3px 0 0; font-size: 12px; color: var(--muted); white-space: pre-line; }
.bell-item time { font-size: 11px; color: var(--muted); }
.bell-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

.content { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.page-head .grow { flex: 1; }

/* ---------- komponen umum ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 21px; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; }
.stat.stat-green { background: linear-gradient(140deg, var(--green-800), var(--green-600)); color: #fff; border: 0; }
.stat.stat-green .label { color: rgba(255,255,255,.8); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  cursor: pointer; font-weight: 600; font-size: 14px;
  text-decoration: none;
}
.btn:hover { background: var(--green-50); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--green-700); }
.btn-ghost:hover { background: var(--green-100); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 18px; font-size: 15px; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.input:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(47,158,82,.15); }
textarea.input { min-height: 74px; resize: vertical; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--green-700); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 9px 10px; border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--green-50); vertical-align: top; }
.tbl tr:hover td { background: var(--green-50); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { white-space: nowrap; text-align: right; }

.chip {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.chip-green { background: var(--green-100); color: var(--green-800); }
.chip-amber { background: var(--amber-bg); color: var(--amber); }
.chip-red { background: var(--red-bg); color: var(--red); }
.chip-blue { background: var(--blue-bg); color: var(--blue); }
.chip-gray { background: #eef1ef; color: var(--muted); }

.empty { padding: 30px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(13, 40, 24, .45);
  display: grid; place-items: center;
  padding: 18px;
}
.modal {
  width: min(640px, 100%);
  max-height: calc(100dvh - 40px);
  background: var(--surface);
  border-radius: 18px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(10, 35, 20, .3);
}
.modal.modal-lg { width: min(860px, 100%); }
.modal.modal-sm { width: min(430px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 17px; }
.modal-close { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; padding: 4px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}

/* ---------- toast & pop-up orderan ---------- */
#toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 240px; max-width: 360px;
  background: var(--ink); color: #fff;
  border-radius: 12px; padding: 12px 15px;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  font-size: 13.5px;
  animation: toast-in .25s ease;
}
.toast.toast-success { background: var(--green-800); }
.toast.toast-error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.order-pop {
  position: fixed; z-index: 130;
  right: 16px; top: 70px;
  width: min(360px, calc(100vw - 32px));
  background: #fff;
  border: 2px solid var(--green-500);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(13, 60, 33, .3);
  padding: 15px 16px;
  animation: pop-in .3s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop-in { from { transform: translateY(-14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.order-pop b { display: flex; align-items: center; gap: 8px; color: var(--green-800); font-size: 15px; }
.order-pop p { margin: 6px 0 10px; font-size: 13px; color: var(--muted); white-space: pre-line; }
.order-pop .row { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- dashboard ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 6px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.chart-bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--green-500), var(--green-700)); border-radius: 7px 7px 3px 3px; min-height: 3px; }
.chart-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.chart-value { font-size: 10px; color: var(--green-800); font-weight: 700; }
.therapist-line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--green-50); }
.therapist-line:last-child { border-bottom: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dot-green { background: var(--green-500); }
.dot-amber { background: #f59e0b; }
.dot-red { background: var(--red); }

/* ---------- kalender booking ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 800; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); font-weight: 700; padding: 4px 0; text-transform: uppercase; }
.cal-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 62px;
  padding: 6px;
  cursor: pointer;
  background: #fff;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
}
.cal-cell:hover { border-color: var(--green-500); }
.cal-cell.muted { opacity: .38; }
.cal-cell.today { border-color: var(--green-700); box-shadow: inset 0 0 0 1px var(--green-700); }
.cal-cell.selected { background: var(--green-100); border-color: var(--green-700); }
.cal-daynum { font-weight: 700; }
.cal-count {
  align-self: flex-start;
  background: var(--green-700); color: #fff;
  border-radius: 999px; padding: 1px 7px; font-size: 10.5px; font-weight: 700;
}

/* ---------- kasir ---------- */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pos-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pos-tab {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 15px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.pos-tab.active { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.pos-item {
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 11px 12px; cursor: pointer; text-align: left;
}
.pos-item:hover { border-color: var(--green-500); background: var(--green-50); }
.pos-item b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.pos-item .meta { font-size: 11.5px; color: var(--muted); }
.pos-item .price { display: block; margin-top: 5px; color: var(--green-800); font-weight: 800; font-size: 14px; }
.pos-item.oos { opacity: .5; cursor: not-allowed; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--green-50); }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .info b { font-size: 13px; display: block; }
.cart-line .info span { font-size: 11.5px; color: var(--muted); }
.qty-btn {
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 700; line-height: 1;
}
.qty-num { min-width: 22px; text-align: center; font-weight: 700; font-size: 13px; }
.cart-total { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.cart-total.big { font-size: 17px; font-weight: 800; color: var(--green-800); }
.change-view { background: var(--green-100); border-radius: 10px; padding: 10px 12px; font-weight: 800; color: var(--green-800); display: flex; justify-content: space-between; }

/* ---------- nota (pratinjau di layar) ---------- */
.receipt {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12.5px;
  background: #fff;
  color: #111;
  max-width: 300px;
  margin: 0 auto;
  padding: 6px 2px;
}
.receipt .c { text-align: center; }
.receipt .b { font-weight: 700; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 6px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 1px 0; vertical-align: top; }
.receipt .r { text-align: right; white-space: nowrap; }

/* ---------- laporan ---------- */
.report-presets { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .pos-layout { grid-template-columns: 1fr; }
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; height: 100dvh;
    transform: translateX(-100%);
    transition: transform .22s ease;
    width: min(290px, 84vw);
    box-shadow: 0 0 60px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(10, 30, 18, .4); z-index: 35; }
  .hamburger {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer;
  }
  .content { padding: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .top-user span { display: none; }
  .page-title { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Cadangan cetak: bila iframe cetak diblokir browser dan jatuh ke window.print(),
   hanya area nota yang tampil. Metode utama tetap iframe khusus (lihat app.js). */
@media print {
  body.printing-fallback * { visibility: hidden !important; }
  body.printing-fallback .receipt, body.printing-fallback .receipt * { visibility: visible !important; }
  body.printing-fallback .receipt { position: absolute; left: 0; top: 0; width: 100%; }
}
