/* =========================================================
   BCA SKARISA - Stylesheet
   Palet: hijau sekolah, putih, abu lembut
   ========================================================= */
:root {
  --g-950: #07342a;
  --g-900: #0b4a37;
  --g-700: #136b4e;
  --g-600: #17805c;
  --g-500: #1f8a5b;
  --g-200: #bfe0cd;
  --g-100: #e3f1e9;
  --g-50:  #f1f7f3;
  --surface: #ffffff;
  --canvas: #f3f5f4;
  --line: #dfe5e2;
  --ink: #18241f;
  --muted: #5e6e67;
  --amber: #b7791f;
  --amber-bg: #fdf3e1;
  --red: #c0392b;
  --red-bg: #fbe9e7;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 248px;
  --sidebar-mini: 74px;
  --topbar-h: 64px;

  --bs-body-font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-primary: var(--g-600);
  --bs-primary-rgb: 23, 128, 92;
  --bs-link-color: var(--g-700);
  --bs-link-color-rgb: 19, 107, 78;
  --bs-link-hover-color: var(--g-900);
  --bs-secondary-color: var(--muted);
}

[data-bs-theme="dark"] {
  --surface: #17201c;
  --canvas: #0f1613;
  --line: #2a3832;
  --ink: #e6efe9;
  --muted: #9aaba3;
  --g-100: #173a2c;
  --g-50: #13261e;
  --g-200: #245c45;
  --amber-bg: #3a2c12;
  --red-bg: #3c1b17;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-link-color: #6fd1a2;
  --bs-link-color-rgb: 111, 209, 162;
  --bs-tertiary-bg: #1c2722;
}

* { -webkit-tap-highlight-color: transparent; }
body { font-size: .925rem; background: var(--canvas); color: var(--ink); }
.num, .money, td.text-end, .stat-value { font-variant-numeric: tabular-nums; }

/* ---------- Tombol & form ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--g-600); --bs-btn-border-color: var(--g-600); --bs-btn-hover-bg: var(--g-700);
  --bs-btn-hover-border-color: var(--g-700); --bs-btn-active-bg: var(--g-900); --bs-btn-active-border-color: var(--g-900);
  --bs-btn-disabled-bg: var(--g-600); --bs-btn-disabled-border-color: var(--g-600); }
.btn-outline-primary { --bs-btn-color: var(--g-700); --bs-btn-border-color: var(--g-200); --bs-btn-hover-bg: var(--g-600);
  --bs-btn-hover-border-color: var(--g-600); --bs-btn-active-bg: var(--g-700); }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #8fe0b9; }
.btn-light { --bs-btn-bg: var(--canvas); --bs-btn-border-color: var(--line); --bs-btn-color: var(--ink); }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--line); background-color: var(--surface); }
.form-control:focus, .form-select:focus { border-color: var(--g-500); box-shadow: 0 0 0 .2rem rgba(31,138,91,.18); }
.form-check-input:checked { background-color: var(--g-600); border-color: var(--g-600); }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
:focus-visible { outline: 2px solid var(--g-500); outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: var(--g-900); color: #d6ebe0; display: flex; flex-direction: column;
  transition: width .2s ease, transform .2s ease;
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.1rem; height: var(--topbar-h);
  color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; white-space: nowrap; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .01em; }
.brand-text small { font-size: .68rem; color: #9fcbb4; text-overflow: ellipsis; overflow: hidden; }
.side-nav { flex: 1; overflow-y: auto; padding: .6rem .7rem 1rem; }
.nav-group { font-size: .72rem; color: #86b7a0; padding: 1rem .6rem .35rem; font-weight: 600; white-space: nowrap; }
.nav-link-item { display: flex; align-items: center; gap: .75rem; padding: .58rem .7rem; border-radius: var(--radius-sm);
  color: #d6ebe0; text-decoration: none; font-weight: 500; white-space: nowrap; position: relative; }
.nav-link-item i { font-size: 1.1rem; width: 1.3rem; text-align: center; flex-shrink: 0; }
.nav-link-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link-item.active { background: #fff; color: var(--g-900); font-weight: 700; }
.nav-badge { margin-left: auto; background: #f5b942; color: #3d2a00; font-style: normal; font-size: .7rem; font-weight: 700;
  border-radius: 20px; padding: .05rem .45rem; }
.sidebar-foot { font-size: .7rem; color: #7fae98; padding: .8rem 1.1rem; border-top: 1px solid rgba(255,255,255,.08); white-space: nowrap; overflow: hidden; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .2s ease; }
.main-plain { margin-left: 0; }

/* Sidebar mini (desktop) */
html.sidebar-mini .sidebar { width: var(--sidebar-mini); }
html.sidebar-mini .main { margin-left: var(--sidebar-mini); }
html.sidebar-mini .brand-text, html.sidebar-mini .nav-link-item span, html.sidebar-mini .nav-group,
html.sidebar-mini .sidebar-foot { display: none; }
html.sidebar-mini .nav-link-item { justify-content: center; }
html.sidebar-mini .nav-badge { position: absolute; top: 2px; right: 4px; }
html.sidebar-mini .brand { justify-content: center; padding: 1rem .5rem; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 1020; height: var(--topbar-h); display: flex; align-items: center; gap: .8rem;
  padding: 0 1.4rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.page-title { font-size: 1.12rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.clock { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.icon-btn:hover { background: var(--g-50); }
.user-chip { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); background: var(--surface);
  border-radius: 40px; padding: .25rem .7rem .25rem .25rem; color: var(--ink); }
.user-chip strong { font-size: .82rem; line-height: 1.1; }
.user-chip small { font-size: .7rem; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--g-600); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }

.content { padding: 1.4rem; max-width: 1500px; }

/* ---------- Panel / kartu ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; gap: .6rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { font-size: .98rem; font-weight: 700; margin: 0; }
.panel-body { padding: 1.15rem; }
.panel-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* Statistik dashboard: satu angka utama besar, sisanya tenang */
.stat-hero { background: var(--g-900); color: #fff; border-radius: var(--radius-lg); padding: 1.35rem 1.4rem; position: relative; overflow: hidden; height: 100%; }
.stat-hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%;
  border: 28px solid rgba(255,255,255,.06); }
.stat-hero .label { color: #a9d6bf; font-size: .85rem; font-weight: 500; }
.stat-hero .stat-value { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; margin: .2rem 0 .3rem; }
.stat-hero .sub { color: #cfe8db; font-size: .82rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.15rem; height: 100%; }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.stat .stat-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; margin-top: .25rem; }
.stat .sub { font-size: .75rem; color: var(--muted); }
.stat.warn { border-color: #efd29c; background: var(--amber-bg); }

/* ---------- Tabel ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .76rem; color: var(--muted); font-weight: 600; background: var(--g-50); border-bottom-color: var(--line); white-space: nowrap; }
.table > tbody td { vertical-align: middle; border-color: var(--line); }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: var(--g-50); }
.table-responsive { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--g-50); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: var(--g-600); }

.badge { font-weight: 600; border-radius: 6px; }
.badge-soft-success { background: var(--g-100); color: var(--g-700); }
.badge-soft-warning { background: var(--amber-bg); color: var(--amber); }
.badge-soft-danger { background: var(--red-bg); color: var(--red); }
.badge-soft-secondary { background: var(--canvas); color: var(--muted); border: 1px solid var(--line); }
[data-bs-theme="dark"] .badge-soft-success { color: #8fe0b9; }
[data-bs-theme="dark"] .badge-soft-warning { color: #f3c46b; }
[data-bs-theme="dark"] .badge-soft-danger { color: #f19b90; }

.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filter-bar > * { flex: 0 1 auto; }
.filter-bar .grow { flex: 1 1 200px; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; color: var(--g-500); }
.empty-state h2 { font-size: 1.15rem; color: var(--ink); margin: .8rem 0 .3rem; font-weight: 700; }

.list-row { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.15rem; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .meta { font-size: .75rem; color: var(--muted); }
.rank { width: 26px; height: 26px; border-radius: 7px; background: var(--g-100); color: var(--g-700); font-weight: 800;
  font-size: .78rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- Toast & modal ---------- */
.toast-container { z-index: 2000; }
.app-toast { border: 0; border-left: 4px solid var(--g-600); background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.app-toast.toast-danger { border-left-color: var(--red); }
.app-toast.toast-warning { border-left-color: var(--amber); }
.app-toast .bi { font-size: 1.1rem; color: var(--g-600); }
.app-toast.toast-danger .bi { color: var(--red); }
.app-toast.toast-warning .bi { color: var(--amber); }
.modal-content { border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--red-bg); color: var(--red);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; }

/* =========================================================
   HALAMAN KASIR
   ========================================================= */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1rem; align-items: start; }
.pos-search { position: relative; }
.pos-search .bi-upc-scan { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: var(--g-600); }
.pos-search input { padding: .85rem 1rem .85rem 2.9rem; font-size: 1.02rem; border-radius: var(--radius); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding: .75rem 0 .2rem; scrollbar-width: thin; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 30px; padding: .35rem .85rem;
  font-size: .82rem; font-weight: 600; white-space: nowrap; }
.chip.active { background: var(--g-600); border-color: var(--g-600); color: #fff; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; margin-top: .8rem; }
.p-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem;
  display: flex; flex-direction: column; gap: .35rem; transition: border-color .12s, transform .12s; color: var(--ink); }
.p-card:hover { border-color: var(--g-500); }
.p-card:active { transform: scale(.98); }
.p-card[disabled] { opacity: .5; }
.p-card .ph { aspect-ratio: 4/3; border-radius: 7px; background: var(--g-50); display: flex; align-items: center; justify-content: center;
  overflow: hidden; color: var(--g-500); font-size: 1.6rem; }
.p-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.p-card .nm { font-weight: 600; font-size: .84rem; line-height: 1.25; min-height: 2.1em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-card .pr { font-weight: 800; color: var(--g-700); font-size: .92rem; }
[data-bs-theme="dark"] .p-card .pr { color: #8fe0b9; }
.p-card .st { font-size: .72rem; color: var(--muted); }
.p-card .st.low { color: var(--amber); font-weight: 600; }

/* Keranjang bergaya gulungan struk */
.cart { position: sticky; top: calc(var(--topbar-h) + 1rem); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar-h) - 2rem); }
.cart-head { padding: .9rem 1.1rem; border-bottom: 1px dashed var(--line); display: flex; align-items: center; gap: .5rem; }
.cart-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.cart-items { flex: 1; overflow-y: auto; min-height: 120px; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); }
.cart-item .nm { font-weight: 600; font-size: .86rem; }
.cart-item .unit { font-size: .74rem; color: var(--muted); }
.cart-item .line { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.qty button { border: 0; background: var(--g-50); width: 32px; height: 32px; color: var(--g-700); font-weight: 700; }
.qty input { width: 48px; border: 0; text-align: center; font-weight: 700; background: transparent; color: var(--ink); height: 32px; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.rm { border: 0; background: none; color: var(--red); padding: 0 .3rem; }
.cart-summary { padding: .9rem 1.1rem; border-top: 1px dashed var(--line); background: var(--g-50); }
.sum-row { display: flex; justify-content: space-between; font-size: .86rem; padding: .12rem 0; font-variant-numeric: tabular-nums; }
.grand { background: var(--g-900); color: #fff; margin: .7rem -1.1rem -.9rem; padding: .9rem 1.1rem 1rem; position: relative; }
.grand::before { /* tepi sobekan struk */
  content: ""; position: absolute; top: -6px; left: 0; right: 0; height: 6px;
  background: radial-gradient(circle at 6px 0, transparent 5px, var(--g-900) 5.5px) repeat-x; background-size: 12px 6px; }
.grand .label { font-size: .8rem; color: #a9d6bf; }
.grand .amount { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pay-area { padding: .9rem 1.1rem 1.1rem; display: grid; gap: .6rem; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .4rem; }
.pay-methods .btn-check + .btn { font-size: .8rem; padding: .45rem .3rem; border-color: var(--line); color: var(--ink); background: var(--surface); }
.pay-methods .btn-check:checked + .btn { background: var(--g-600); border-color: var(--g-600); color: #fff; }
.quick-cash { display: flex; gap: .35rem; flex-wrap: wrap; }
.quick-cash button { flex: 1 1 auto; font-size: .78rem; }
.change-box { display: flex; justify-content: space-between; align-items: baseline; padding: .55rem .75rem; border-radius: var(--radius-sm);
  background: var(--g-100); font-weight: 700; }
.change-box.minus { background: var(--red-bg); color: var(--red); }
.change-box .v { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.btn-pay { padding: .85rem; font-size: 1.05rem; }
.qris-box { text-align: center; border: 1px dashed var(--g-200); border-radius: var(--radius); padding: .8rem; }
.qris-box img { max-width: 210px; width: 100%; border-radius: 8px; background: #fff; padding: 6px; }
.kbd-hint { font-size: .72rem; color: var(--muted); }
.kbd-hint kbd { background: var(--canvas); color: var(--ink); border: 1px solid var(--line); font-size: .7rem; }
.cart-fab { display: none; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side { background: var(--g-900); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-side::after { content: ""; position: absolute; right: -120px; top: 18%; width: 420px; height: 420px; border-radius: 50%;
  border: 60px solid rgba(255,255,255,.05); }
.login-side .school { display: flex; align-items: center; gap: 1rem; position: relative; z-index: 1; }
.login-side .school img { width: 64px; height: 64px; background: #fff; border-radius: 16px; padding: 6px; object-fit: contain; }
.login-side h1 { font-size: clamp(2.2rem, 4.5vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: 0; position: relative; z-index: 1; }
.login-side .tag { color: #a9d6bf; max-width: 30ch; margin-top: 1rem; position: relative; z-index: 1; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-weight: 800; font-size: 1.5rem; }
.login-card .form-control { padding: .7rem .9rem; }

/* ---------- Responsif ---------- */
@media (max-width: 1199.98px) {
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  html.sidebar-open .sidebar { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; display: none; }
  html.sidebar-open .sidebar-backdrop { display: block; }
  .main, html.sidebar-mini .main { margin-left: 0; }
  html.sidebar-mini .brand-text, html.sidebar-mini .nav-link-item span, html.sidebar-mini .nav-group, html.sidebar-mini .sidebar-foot { display: revert; }
  html.sidebar-mini .nav-link-item { justify-content: flex-start; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .pos { grid-template-columns: 1fr; }
  .cart { position: fixed; inset: auto 0 0 0; max-height: 92vh; border-radius: 18px 18px 0 0; z-index: 1045;
    transform: translateY(100%); transition: transform .22s ease; box-shadow: 0 -10px 30px rgba(0,0,0,.18); }
  html.cart-open .cart { transform: none; }
  .cart-fab { display: flex; position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 1030; align-items: center;
    justify-content: space-between; padding: .85rem 1.1rem; border-radius: var(--radius); background: var(--g-900); color: #fff; border: 0;
    font-weight: 700; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
  .pos-left { padding-bottom: 5rem; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { padding: 1.6rem; min-height: 0; gap: 1.5rem; }
  .login-side::after { display: none; }
}
@media (max-width: 575.98px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-title { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .no-print, .toast-container { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; }
  .panel { border: 0; }
}
