/* ============================================================
   KasirKu — Versi Statis (hosting PHP/HTML biasa)
   Tema emerald, mobile-first, bottom-nav di HP + sidebar di desktop
   ============================================================ */
:root {
  --em-50: #ecfdf5; --em-100: #d1fae5; --em-200: #a7f3d0; --em-500: #10b981;
  --em-600: #059669; --em-700: #047857; --em-800: #065f46; --em-900: #064e3b;
  --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb; --bg: #f8fafc;
  --card: #ffffff; --danger: #dc2626; --amber: #d97706; --violet: #7c3aed;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; }

/* ---------- Boot splash ---------- */
.boot-splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.boot-logo { font-size: 44px; }
.boot-title { font-size: 24px; font-weight: 800; color: var(--em-700); }
.boot-sub { color: var(--muted); }

/* ---------- Layout app ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 40; background: linear-gradient(135deg, var(--em-700), var(--em-600));
  color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 10px rgba(4, 120, 87, .25);
}
.app-header .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.app-header .brand .logo-badge {
  width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.15);
  display: grid; place-items: center; font-size: 18px;
}
.app-header .spacer { flex: 1; }
.header-btn {
  background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 10px;
  padding: 8px 12px; font-weight: 700; font-size: 13px; display: inline-flex; gap: 6px; align-items: center;
}
.app-main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 14px 12px calc(78px + var(--safe-b)); }
@media (min-width: 900px) {
  .app-shell.with-side { display: block; }
  .app-main { padding-bottom: 60px; }
}

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding: 6px 4px calc(6px + var(--safe-b));
}
.bottom-nav button {
  flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; min-height: 48px;
}
.bottom-nav button .ic { font-size: 20px; line-height: 1; }
.bottom-nav button.active { color: var(--em-700); }
@media (min-width: 900px) {
  .bottom-nav {
    top: 56px; bottom: auto; left: 0; right: auto; width: 220px; flex-direction: column;
    border-top: 0; border-right: 1px solid var(--line); padding: 10px 8px; gap: 4px;
  }
  .bottom-nav button { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 10px;
    padding: 12px; border-radius: 10px; font-size: 14px; min-height: 44px; width: 100%; }
  .bottom-nav button.active { background: var(--em-700); color: #fff; }
  .app-shell.with-side .app-main { margin-left: 220px; max-width: 980px; }
}

/* ---------- Footer ---------- */
.app-footer { margin-top: auto; padding: 14px; text-align: center; color: var(--muted); font-size: 12px; }
@media (min-width: 900px) { .app-footer { margin-left: 220px; } }

/* ---------- Cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 12px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat .lbl { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.stat .val { font-size: 20px; font-weight: 800; margin-top: 4px; }
.stat .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; font-size: 14px;
  background: var(--em-600); color: #fff; min-height: 46px; width: 100%;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--em-700); border: 1.5px solid var(--em-200); }
.btn.ghost { background: transparent; color: var(--em-700); }
.btn.danger { background: var(--danger); }
.btn.amber { background: var(--amber); }
.btn.sm { padding: 8px 12px; min-height: 38px; font-size: 13px; width: auto; border-radius: 10px; }
.btn.google { background: #fff; color: #374151; border: 1.5px solid var(--line); }

/* ---------- Forms ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px;
  background: #fff; font-size: 15px; min-height: 46px; outline: none;
}
.input:focus { border-color: var(--em-500); box-shadow: 0 0 0 3px var(--em-100); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--em-100), transparent), var(--bg); }
.auth-logo { width: 72px; height: 72px; border-radius: 22px; background: linear-gradient(135deg, var(--em-600), var(--em-700));
  display: grid; place-items: center; font-size: 34px; box-shadow: 0 10px 24px rgba(4,120,87,.35); }
.auth-title { font-size: 26px; font-weight: 800; margin-top: 12px; }
.auth-sub { color: var(--muted); margin-top: 2px; text-align: center; }
.auth-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; max-width: 420px; width: 100%; }
.auth-feat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 12px; color: #374151;
  display: flex; gap: 8px; align-items: center; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; max-width: 420px; width: 100%;
  box-shadow: 0 8px 24px rgba(15,23,42,.06); }
.auth-card .btn + .btn, .auth-card .field + .btn { margin-top: 8px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 12px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Kasir ---------- */
.kasir-search { margin-bottom: 10px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line); background: #fff; color: #374151; border-radius: 999px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; white-space: nowrap; min-height: 36px; }
.chip.active { background: var(--em-700); color: #fff; border-color: var(--em-700); }
.prod-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .prod-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .prod-grid { grid-template-columns: repeat(4, 1fr); } }
.prod-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: left;
  display: flex; flex-direction: column; gap: 4px; border-width: 1.5px; transition: transform .06s ease; }
.prod-card:active { transform: scale(.97); }
.prod-card:disabled { opacity: .5; }
.prod-card .p-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.prod-card .p-price { color: var(--em-700); font-weight: 800; font-size: 15px; }
.prod-card .p-stock { font-size: 11px; color: var(--muted); }
.prod-card .p-stock.low { color: var(--amber); font-weight: 700; }
.prod-card .p-stock.out { color: var(--danger); font-weight: 700; }

.fab {
  position: fixed; right: 16px; bottom: calc(76px + var(--safe-b)); z-index: 45;
  background: var(--em-600); color: #fff; border: 0; border-radius: 999px; padding: 14px 20px;
  font-weight: 800; font-size: 15px; box-shadow: 0 8px 20px rgba(4,120,87,.4);
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px;
}
@media (min-width: 900px) { .fab { bottom: 24px; margin-right: 220px; } }

/* ---------- Sheet / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column;
  animation: up .18s ease; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { padding: 14px 16px 8px; display: flex; align-items: center; gap: 10px; }
.sheet-head h3 { font-size: 16px; flex: 1; }
.sheet-x { background: var(--bg); border: 0; border-radius: 999px; width: 34px; height: 34px; font-size: 16px; }
.sheet-body { padding: 4px 16px 16px; overflow-y: auto; }
@media (min-width: 640px) {
  .overlay { align-items: center; }
  .sheet { max-width: 460px; border-radius: 20px; max-height: 88vh; }
}
.cart-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cart-line .cl-info { flex: 1; min-width: 0; }
.cart-line .cl-name { font-weight: 700; font-size: 14px; }
.cart-line .cl-price { font-size: 12px; color: var(--muted); }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 800; font-size: 16px; }
.qty-ctrl .q { min-width: 26px; text-align: center; font-weight: 800; }
.total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.total-row.grand { font-size: 18px; font-weight: 800; color: var(--em-700); border-top: 2px solid var(--line); margin-top: 6px; padding-top: 10px; }
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.quick-row .chip { min-height: 40px; }

.success-modal { text-align: center; padding: 24px 16px; }
.success-ic { width: 74px; height: 74px; margin: 0 auto 12px; border-radius: 50%; background: var(--em-100);
  display: grid; place-items: center; font-size: 36px; }
.success-amount { font-size: 28px; font-weight: 800; color: var(--em-700); margin: 6px 0 2px; }
.success-change { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* ---------- Receipt preview ---------- */
.receipt-paper { background: #fff; border: 1px dashed var(--line); border-radius: 8px; padding: 14px 12px;
  font-family: ui-monospace, "Courier New", monospace; font-size: 12px; line-height: 1.5; margin: 0 auto; }
.receipt-paper.w58 { max-width: 270px; }
.receipt-paper.w80 { max-width: 360px; }
.receipt-paper .r-c { text-align: center; }
.receipt-paper .r-b { font-weight: 800; }
.receipt-paper .r-big { font-size: 15px; }
.receipt-paper .r-line { border-top: 1px dashed #9ca3af; margin: 6px 0; }
.receipt-paper .r-row { display: flex; justify-content: space-between; gap: 8px; }

/* ---------- Product row ---------- */
.row-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item .ri-main { flex: 1; min-width: 0; }
.row-item .ri-name { font-weight: 700; font-size: 14px; }
.row-item .ri-sub { font-size: 12px; color: var(--muted); }
.row-item .ri-right { text-align: right; }
.row-item .ri-price { font-weight: 800; color: var(--em-700); }
.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; }
.badge.ok { background: var(--em-100); color: var(--em-800); }
.badge.low { background: #fef3c7; color: #92400e; }
.badge.out { background: #fee2e2; color: #991b1b; }

/* ---------- List & misc ---------- */
.list-plain { list-style: none; margin: 0; padding: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.row-flex { display: flex; gap: 10px; align-items: center; }
.row-flex > * { flex: 1; }
.pill-link { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; font-size: 14px; font-weight: 600; color: #374151; width: 100%; text-align: left; margin-bottom: 8px; }
.logo-preview { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); background: var(--em-50); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(90px + var(--safe-b)); z-index: 100;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #111827; color: #fff; border-radius: 12px; padding: 11px 16px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 20px rgba(0,0,0,.25); max-width: 440px; animation: up .18s ease; }
.toast.ok { background: var(--em-700); }
.toast.err { background: var(--danger); }

/* ---------- Chart ---------- */
.chart-box { width: 100%; }
.chart-box canvas { width: 100%; height: 150px; display: block; }

/* ---------- Alert boxes ---------- */
.alert { border-radius: 12px; padding: 12px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.alert.warn { background: #fef3c7; color: #92400e; }
.alert.info { background: var(--em-50); color: var(--em-800); }
.alert.err { background: #fee2e2; color: #991b1b; }
.alert + .alert { margin-top: 8px; }

/* ---------- Scrollbar ---------- */
.scroll-y { max-height: 55vh; overflow-y: auto; }
.scroll-y::-webkit-scrollbar, .sheet-body::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb, .sheet-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; }
