/* ============================================================
   Kasir & Stok — Calabu Jaya Farm
   styles.css — mobile-first, tema terang/gelap, tanpa dependensi
   ============================================================ */

/* ---------- Font lokal (.woff2, jalan tanpa internet) ---------- */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./fonts/outfit.woff2") format("woff2");
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./fonts/plus-jakarta-sans.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./fonts/jetbrains-mono.woff2") format("woff2");
}

/* ---------- Token warna ---------- */
:root {
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Outfit", "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Courier New", Courier, monospace;

  --bg: #F8FAFC;
  --panel: #FFFFFF;
  --panel-2: #F1F5F9;
  --text: #0F172A;
  --muted: #475569;
  --faint: #94A3B8;
  --line: #E2E8F0;

  --accent: #059669;
  --accent-strong: #047857;
  --accent-deep: #064E3B;
  --on-accent: #FFFFFF;
  --accent-ink: #047857;
  --accent-soft: #D1FAE5;
  --ring: rgba(5, 150, 105, 0.32);

  --amber: #B45309;
  --amber-bg: #FEF3C7;
  --red: #B91C1C;
  --red-bg: #FEE2E2;
  --gray-bg: #E2E8F0;
  --gray-ink: #475569;

  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px -14px rgba(15, 23, 42, 0.22);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, 0.35);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #090D14;
  --panel: #131A26;
  --panel-2: #0E1420;
  --text: #F8FAFC;
  --muted: #94A3B8;
  --faint: #64748B;
  --line: #26324A;

  --accent-ink: #34D399;
  --accent-soft: rgba(52, 211, 153, 0.14);
  --amber: #FBBF24;
  --amber-bg: rgba(251, 191, 36, 0.14);
  --red: #F87171;
  --red-bg: rgba(248, 113, 113, 0.15);
  --gray-bg: rgba(148, 163, 184, 0.16);
  --gray-ink: #CBD5E1;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ---------- Dasar ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.hint { font-size: 12.5px; color: var(--faint); margin: 6px 0 0; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 8px; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 10px 16px; font-size: 14.5px; font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { flex: 0 0 auto; width: 18px; height: 18px; }
.cart-head h3 svg, .fab-cta svg { width: 18px; height: 18px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); box-shadow: 0 8px 20px -8px rgba(5, 150, 105, 0.6); }
.btn-secondary { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--faint); }
.btn-outline { background: transparent; color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-outline:hover:not(:disabled) { background: var(--accent-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.btn-lg { padding: 14px 20px; font-size: 16px; border-radius: 14px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-icon-only { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  border: none; background: transparent; color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Input ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; min-height: 44px;
  padding: 10px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
textarea.input { min-height: 70px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.form-error {
  background: var(--red-bg); color: var(--red);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-weight: 600;
}

/* ---------- Badge & chip ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.badge-green { background: var(--accent-soft); color: var(--accent-ink); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: var(--gray-bg); color: var(--gray-ink); }
.badge-solid { background: var(--accent-deep); color: #fff; }

/* ---------- Halaman login ---------- */
.login-screen {
  min-height: 100dvh; display: grid; grid-template-columns: 1fr; align-items: stretch;
  background:
    radial-gradient(900px 480px at -10% -10%, rgba(5, 150, 105, 0.14), transparent 60%),
    radial-gradient(700px 420px at 110% 110%, rgba(217, 119, 6, 0.10), transparent 55%),
    var(--bg);
}
.login-brand {
  padding: 28px 22px 8px; color: var(--text);
  display: flex; flex-direction: column; gap: 12px;
}
.brand-badge {
  width: 52px; height: 52px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -10px rgba(6, 78, 59, 0.7);
}
.brand-badge img, .brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.login-brand h1 { font-size: 26px; }
.login-tag { margin: 0; color: var(--muted); max-width: 46ch; }
.brand-points { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.brand-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.pt-ic {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.login-panel { display: flex; align-items: center; justify-content: center; padding: 26px 18px calc(28px + env(safe-area-inset-bottom)); }
.login-card {
  width: 100%; max-width: 420px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-lg); padding: 26px 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h2 { font-size: 22px; }
.login-sub { margin: -8px 0 2px; font-size: 13.5px; }
.captcha-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.captcha-left { display: flex; align-items: center; gap: 6px; }
.captcha-q {
  font-family: var(--font-mono); font-size: 17px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--panel-2); border: 1px dashed var(--faint); color: var(--text);
  border-radius: 12px; padding: 9px 14px; user-select: none;
}
.captcha-row .icon-btn { flex: 0 0 auto; }
.captcha-row .input { margin: 0; }
.login-demo { font-size: 12.5px; color: var(--muted); text-align: center; }
.login-demo b { color: var(--text); }
.login-dl {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: none;
  padding: 9px; border-radius: 10px; background: var(--accent-soft);
  transition: filter 0.15s ease;
}
.login-dl:hover { filter: brightness(1.05); }
.login-reset { background: none; border: none; color: var(--faint); font-size: 12px; text-decoration: underline; padding: 2px; }
.login-reset:hover { color: var(--red); }

@media (min-width: 900px) {
  .login-screen { grid-template-columns: 1.1fr 1fr; align-items: center; padding: 48px; gap: 24px; }
  .login-brand { padding: 0 48px; gap: 16px; }
  .login-brand h1 { font-size: 38px; }
  .brand-badge { width: 64px; height: 64px; border-radius: 20px; }
  .login-panel { padding: 0; }
}

/* ---------- Kerangka aplikasi ---------- */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--accent-deep); color: #fff;
}
.topbar .brand-mark { background: rgba(255, 255, 255, 0.16); color: #fff; }
.topbar .brand-text small { color: rgba(255, 255, 255, 0.78); }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-family: var(--font-head); font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent-deep); color: #fff; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta b { font-size: 13px; }
.user-meta small { font-size: 10.5px; color: var(--muted); }
@media (max-width: 560px) { .user-meta { display: none; } }

/* Navigasi: tab di desktop, bar bawah di mobile */
.mainnav { display: flex; justify-content: center; gap: 6px; padding: 10px 16px 0; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 12px; border: none; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-tab svg { width: 18px; height: 18px; }
.nav-tab:hover { background: var(--panel-2); color: var(--text); }
.nav-tab.active { background: var(--accent-deep); color: #fff; }
@media (max-width: 899px) {
  .mainnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
    display: grid; grid-template-columns: repeat(var(--n, 1), 1fr);
    gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .nav-tab { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 2px; border-radius: 10px; min-width: 0; }
  .nav-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.1; }
  .nav-tab svg { width: 20px; height: 20px; flex-shrink: 0; }
}
.mainnav[hidden] { display: none !important; }

.view-root { flex: 1; padding: 14px 14px calc(150px + env(safe-area-inset-bottom)); width: 100%; max-width: 1280px; margin: 0 auto; }
@media (min-width: 900px) { .view-root { padding: 22px 24px 40px; } }
@media (max-width: 899px) { body.no-nav .view-root { padding-bottom: calc(90px + env(safe-area-inset-bottom)); } }

/* ---------- Halaman admin ---------- */
.page { display: flex; flex-direction: column; gap: 16px; }
.page-head h2 { font-size: 21px; }
.page-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.page-head.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 16px;
}
.filter-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.filter-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 640px) { .filter-grid { grid-template-columns: 1fr 1fr; align-items: end; } .filter-dates { grid-column: span 2; } }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.stat small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: clamp(15px, 4.4vw, 21px); letter-spacing: -0.02em; color: var(--accent-ink); }
.stat small.ink { color: var(--amber); }

.pay-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pay-chips .badge {
  font-size: 12px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; white-space: normal; color: var(--text);
}
.pay-chips .badge small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.pay-chips .badge b { display: block; font-family: var(--font-mono); font-size: clamp(13px, 3.5vw, 17px); letter-spacing: -0.02em; color: var(--accent-ink); }
.pay-chips .badge span { display: block; font-size: 11px; color: var(--faint); }

/* Baris daftar (produk / pengguna / transaksi) */
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); text-align: left; color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.list-row + .list-row { margin-top: 14px; }
button.list-row:hover, .list-row.clickable:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.list-row.clickable { cursor: pointer; }
.row-thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--panel-2); flex: 0 0 auto; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-main b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .muted { font-size: 12.5px; }
.row-facts { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.row-facts b { font-family: var(--font-mono); font-size: 14px; letter-spacing: -0.01em; }
.row-actions { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }
.row-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; object-fit: cover;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}

/* ---------- Kasir / POS ---------- */
.pos-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 1000px) {
  .pos-wrap { grid-template-columns: minmax(0, 1fr) 390px; }
}
.searchbar { position: relative; margin-bottom: 12px; }
.searchbar svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.searchbar .input { padding-left: 40px; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .product-grid { gap: 12px; } }

.product-card {
  position: relative; padding: 0; text-align: left; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.product-card:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.product-card:active:not(:disabled) { transform: scale(0.965); }
.product-card:disabled { cursor: not-allowed; opacity: 0.62; }
.pc-img { position: relative; aspect-ratio: 1 / 1; background: var(--panel-2); }
.pc-img img { width: 100%; height: 100%; object-fit: cover; }
.pc-badge { position: absolute; top: 8px; right: 8px; z-index: 2; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }
.pc-empty {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.45); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: 0.06em;
}
.pc-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; }
@media (min-width: 640px) { .pc-body { padding: 10px 12px 12px; } }
.pc-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pc-price { font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; color: var(--accent-ink); letter-spacing: -0.01em; }
.pc-price small { font-weight: 100; color: var(--faint); font-size: 10px; font-family: var(--font-sans); }
.pc-stock { position: absolute; top: 6px; right: 6px; z-index: 2; line-height: 1; }
.pc-stock .badge { font-size: 10.5px; padding: 3px 7px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }

/* Keranjang — panel samping di desktop, sheet di mobile */
.cart-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
@media (min-width: 1000px) {
  .cart-panel { position: sticky; top: 70px; max-height: calc(100dvh - 86px); overflow-y: auto; }
}
@media (max-width: 999px) {
  .cart-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 80;
    max-height: 88dvh; overflow-y: auto; border-radius: 22px 22px 0 0; margin: 0;
    transform: translateY(105%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.28, 1);
    box-shadow: 0 -12px 44px rgba(0, 0, 0, 0.3); padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  body.cart-open .cart-panel { transform: translateY(0); }
}
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cart-head h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.cart-count { background: var(--accent); color: #fff; border-radius: 999px; font-size: 12px; font-family: var(--font-mono); padding: 1px 8px; }
.cart-close { display: none; }
@media (max-width: 999px) { .cart-close { display: inline-flex; } }

.cart-lines { display: flex; flex-direction: column; gap: 10px; }
.cart-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--faint); font-size: 13.5px; padding: 26px 10px; text-align: center;
}
.cart-empty svg { width: 34px; height: 34px; }

.cart-line {
  display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
}
.cart-line img, .cl-ph { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; background: var(--panel-2); }
.cl-ph { display: flex; align-items: center; justify-content: center; color: var(--faint); }
.cl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.cl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cl-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-unit { font-size: 11px; color: var(--faint); }
.cl-price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-price {
  width: 108px; min-height: 36px; padding: 6px 10px;
  border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--panel-2); color: var(--text);
  font-family: var(--font-mono); font-weight: 700; font-size: 13.5px; text-align: right;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cl-price:focus { outline: none; border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--panel); }
.cl-orig { font-size: 12px; color: var(--faint); text-decoration: line-through; }
.cl-badge { font-size: 10px; padding: 2px 7px; }
.cl-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 32px; height: 32px; border: none; background: var(--panel-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; transition: background-color 0.15s ease; }
.stepper button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-ink); }
.stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper button svg { width: 15px; height: 15px; }
.stepper b { min-width: 30px; text-align: center; font-family: var(--font-mono); font-size: 14px; }
.cl-total { font-family: var(--font-mono); font-weight: 700; font-size: 13.5px; }
.cl-remove { width: 30px; height: 30px; }

.cart-divider { border: none; border-top: 1px dashed var(--line); margin: 2px 0; }

.cart-foot { display: flex; flex-direction: column; gap: 12px; }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cart-total span { font-weight: 700; font-size: 15px; }
.cart-total b { font-family: var(--font-mono); font-size: 22px; letter-spacing: -0.02em; color: var(--accent-ink); }

/* Pembayaran */
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; background: var(--panel-2); padding: 5px; border-radius: 14px; }
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: transparent; color: var(--muted);
  border-radius: 10px; padding: 9px 6px; font-size: 13px; font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg-btn svg { width: 16px; height: 16px; }
.seg-btn.active { background: var(--panel); color: var(--accent-ink); box-shadow: 0 2px 10px -4px rgba(15, 23, 42, 0.35); }
[data-theme="dark"] .seg-btn.active { background: var(--accent-deep); color: #fff; }

.cash-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.cash-chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; font-family: var(--font-mono);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.cash-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

.paid-hint { font-size: 13px; font-weight: 700; min-height: 1.4em; }
.paid-hint.ok { color: var(--accent-ink); }
.paid-hint.less { color: var(--amber); }

.pay-info-box {
  border: 1px dashed var(--line); border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.pay-info-box .muted { font-size: 12.5px; }
.qr-canvas { width: 150px; height: 150px; border-radius: 10px; background: #fff; }
.qr-img { max-width: 190px; max-height: 240px; width: auto; height: auto; border-radius: 10px; background: #fff; object-fit: contain; }
.bank-lines { font-family: var(--font-mono); font-size: 13px; line-height: 1.8; color: var(--text); }

.proof { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proof-thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.proof-label { font-size: 12px; color: var(--muted); }

/* ---------- Autocomplete Pelanggan ---------- */
.autocomplete-wrap { position: relative; width: 100%; }
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); max-height: 200px; overflow-y: auto; z-index: 100; padding: 4px;
}
.autocomplete-item {
  padding: 8px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; transition: background-color 0.1s ease;
}
.autocomplete-item:hover, .autocomplete-item.active { background: var(--panel-2); color: var(--accent-ink); }
.autocomplete-hint { padding: 7px 12px; font-size: 12px; color: var(--faint); font-style: italic; }

/* Tombol keranjang melayang (mobile) */
.cart-fab {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  bottom: calc(74px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-deep); color: #fff; border: none;
  border-radius: 16px; padding: 13px 16px;
  box-shadow: 0 16px 34px -12px rgba(6, 78, 59, 0.75);
  transition: transform 0.15s ease;
}
.cart-fab:active { transform: scale(0.98); }
.cart-fab[hidden] { display: none; }
body.no-nav .cart-fab { bottom: calc(12px + env(safe-area-inset-bottom)); }
.fab-badge {
  position: relative; flex: 0 0 auto;
  background: var(--amber); color: #fff; font-weight: 800; font-size: 12.5px;
  border-radius: 999px; padding: 3px 9px; font-family: var(--font-mono);
}
.fab-main { flex: 1; text-align: left; display: flex; flex-direction: column; line-height: 1.2; }
.fab-main b { font-size: 14px; }
.fab-main small { font-size: 11.5px; color: #A7F3D0; font-family: var(--font-mono); }
.fab-cta { font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; }
@media (min-width: 1000px) { .cart-fab { display: none; } }

/* ---------- Modal (TIDAK tertutup saat klik di luar) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(9, 13, 20, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; opacity: 0; transition: opacity 0.18s ease;
}
.modal-backdrop.show { opacity: 1; }
.modal-panel {
  background: var(--panel); color: var(--text);
  width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  transform: translateY(40px); transition: transform 0.22s cubic-bezier(0.32, 0.72, 0.28, 1);
  display: flex; flex-direction: column; gap: 14px;
  margin-top: auto;
}
.modal-backdrop.show .modal-panel { transform: translateY(0); }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal-panel { border-radius: 22px; margin: auto 0; transform: translateY(14px) scale(0.98); }
  .modal-backdrop.show .modal-panel { transform: translateY(0) scale(1); }
}
.modal-panel.modal-sm { max-width: 400px; }
.modal-panel.modal-receipt { max-width: 430px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h3 { font-size: 18px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-msg { margin: 0; color: var(--muted); font-size: 14px; }

.photo-widget { display: flex; align-items: center; gap: 14px; }
.photo-preview {
  width: 92px; height: 92px; border-radius: 14px; overflow: hidden; flex: 0 0 auto;
  border: 1.5px dashed var(--line); background: var(--panel-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--faint); font-size: 11px; text-align: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview-round { border-radius: 50%; }
.photo-preview-qris { width: 120px; height: 120px; }
.photo-preview-qris img { object-fit: contain; background: #fff; }

/* ---------- Pengaturan ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 820px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.settings-card { display: flex; flex-direction: column; gap: 14px; }
.settings-card h3 { font-size: 16.5px; }
.color-picker-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-input { width: 44px; height: 44px; padding: 2px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; flex: 0 0 auto; }
.color-swatches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 999px; border: 2px solid transparent; padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel); }
.bp-row { display: grid; grid-template-columns: 54px 1fr; gap: 8px; align-items: center; }
.bp-ic-input { text-align: center; padding: 10px 6px; font-size: 17px; }
.photo-preview svg { width: 22px; height: 22px; }
.photo-btns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- Struk thermal ---------- */
.receipt-wrap { display: flex; justify-content: center; }
.receipt {
  background: #FFFFFF; color: #18181B;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55;
  width: 100%; max-width: 330px; padding: 20px 18px;
  border-radius: 12px; box-shadow: 0 8px 30px -12px rgba(15, 23, 42, 0.45);
  display: flex; flex-direction: column; gap: 2px;
}
.rc-head { text-align: center; font-weight: 800; font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; }
.rc-sub { text-align: center; font-size: 11.5px; color: #52525B; }
.rc-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-top: 10px; }
.rc-buyer { font-size: 19px; font-weight: 800; margin: 4px 0 2px; letter-spacing: -0.01em; }
.rc-sep { border: none; border-top: 1.6px dashed #A1A1AA; margin: 9px 0; }
.rc-item { margin-bottom: 5px; }
.rc-item-name { font-size: 12.5px; }
.rc-item-calc { display: flex; justify-content: space-between; gap: 10px; padding-left: 10px; font-size: 12.5px; }
.rc-item-calc s { color: #71717A; }
.rc-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 19px; font-weight: 800; }
.rc-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.rc-note { font-size: 11.5px; color: #52525B; text-align: center; }
.rc-kasir { font-size: 12px; margin-top: 2px; }
.rc-bank { text-align: center; font-size: 11.5px; line-height: 1.75; }
.rc-thanks { text-align: center; font-weight: 700; letter-spacing: 0.12em; margin-top: 8px; }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed; bottom: calc(146px + env(safe-area-inset-bottom)); left: 0; right: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  padding: 0 16px;
}
@media (min-width: 900px) { #toast-root { bottom: 20px; align-items: flex-end; padding-right: 24px; } }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--text); color: var(--bg);
  border-radius: 12px; padding: 11px 16px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); max-width: 420px;
  animation: toast-in 0.25s cubic-bezier(0.32, 0.72, 0.28, 1);
}
.toast svg { width: 17px; height: 17px; flex: 0 0 auto; }
.toast.ok { background: var(--accent-strong); color: #fff; }
.toast.err { background: var(--red); color: #fff; }
.toast.warn { background: var(--amber); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity 0.25s ease, transform 0.25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ---------- Util & animasi kecil ---------- */
.state-empty { text-align: center; color: var(--faint); padding: 30px 12px; font-size: 14px; }
@keyframes pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.pulse { animation: pop 0.3s ease; }

/* ---------- Cetak struk: hanya struk yang tampil ---------- */
@media print {
  body.receipt-open #app,
  body.receipt-open #login-screen,
  body.receipt-open #toast-root,
  body.receipt-open .modal-head,
  body.receipt-open .modal-actions { display: none !important; }
  body.receipt-open .modal-backdrop { position: static; background: none; backdrop-filter: none; display: block; padding: 0; opacity: 1; }
  body.receipt-open .modal-panel { box-shadow: none; border: none; max-width: 80mm; margin: 0 auto; padding: 0; transform: none; overflow: visible; }
  .receipt { max-width: 80mm; box-shadow: none; border-radius: 0; }
}

/* ============================================================
   v3 Styles: Ngampas Telur, Rekap Uang, Modal, Untung & Pengeluaran
   ============================================================ */
.rekap-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rekap-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.rekap-top h3 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rekap-highlight {
  background: linear-gradient(135deg, var(--accent-deep) 0%, var(--accent-strong) 100%);
  color: #FFFFFF;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px -6px rgba(5, 150, 105, 0.4);
}
.rekap-highlight small {
  display: block;
  font-size: 12px;
  opacity: 0.88;
  font-weight: 500;
  margin-bottom: 2px;
}
.rekap-highlight b {
  font-family: var(--font-head);
  font-size: 24px;
  letter-spacing: -0.02em;
}
.rekap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 680px) {
  .rekap-grid { grid-template-columns: repeat(4, 1fr); }
}
.rekap-stat {
  background: var(--panel-2);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid var(--line);
}
.rekap-stat small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}
.rekap-stat b {
  font-family: var(--font-head);
  font-size: 16.5px;
  color: var(--text);
}
.rekap-stat.profit {
  background: var(--accent-soft);
  border-color: rgba(5, 150, 105, 0.25);
}
.rekap-stat.profit b {
  color: var(--accent-ink);
}
.rekap-stat.unpaid {
  background: var(--amber-bg);
  border-color: rgba(245, 158, 11, 0.25);
}
.rekap-stat.unpaid b {
  color: var(--amber);
}
.rekap-stat.expense {
  background: var(--red-bg);
  border-color: rgba(239, 68, 68, 0.25);
}
.rekap-stat.expense b {
  color: var(--red);
}

/* Badge Laba & Modal */
.profit-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-ink);
  letter-spacing: 0.01em;
}
.cost-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* Chips Pengeluaran */
.expense-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}
.expense-chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.expense-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

/* Modal Isi Stok Cepat */
.quick-adder-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.quick-adder-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.quick-adder-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---------- Footer Admin ---------- */
.admin-footer {
  width: 100%;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  margin-top: auto;
}
.admin-footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.admin-footer a {
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
}
.admin-footer a:hover {
  text-decoration: underline;
}

/* Top 5 Produk Paling Laku */
.top-products-card {
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.top-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.top-prod-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}
.top-prod-rank {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  font-family: var(--font-mono);
  background: var(--line);
  color: var(--muted);
}
.top-prod-rank.rank-1 {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
}
.top-prod-rank.rank-2 {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #CBD5E1;
}
.top-prod-rank.rank-3 {
  background: #FFEDD5;
  color: #C2410C;
  border: 1px solid #FDBA74;
}
[data-theme="dark"] .top-prod-rank.rank-1 {
  background: rgba(245, 158, 11, 0.2);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, 0.4);
}
[data-theme="dark"] .top-prod-rank.rank-2 {
  background: rgba(148, 163, 184, 0.2);
  color: #E2E8F0;
  border-color: rgba(148, 163, 184, 0.4);
}
[data-theme="dark"] .top-prod-rank.rank-3 {
  background: rgba(234, 88, 12, 0.2);
  color: #FDBA74;
  border-color: rgba(234, 88, 12, 0.4);
}
.top-prod-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--panel);
}
.top-prod-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.top-prod-name {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-prod-sold {
  font-size: 12px;
  color: var(--accent-ink);
  font-weight: 700;
  margin-top: 2px;
}
.top-prod-sales {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

