
/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --bg2:      #161b27;
  --bg3:      #1e2535;
  --border:   #2a3349;
  --accent:   #4f8ef7;
  --accent2:  #7c5cfc;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --text:     #e8edf8;
  --text2:    #8b98b8;
  --radius:   12px;
  --shadow:   0 4px 24px rgba(0,0,0,.4);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon { font-size: 32px; }
.logo-title { font-size: 18px; font-weight: 800; color: var(--text); }
.logo-sub   { font-size: 11px; color: var(--text2); }

.nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding-top: 16px; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: var(--text2);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  width: 100%;
  text-align: left;
}

.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 700; }
.nav-icon { font-size: 18px; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 16px; }
.kasir-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg3);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text2);
}

/* ── Main ────────────────────────────────────────────────── */
#main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.page { display: none; padding: 24px; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 22px; font-weight: 800; }
.clock { font-family: 'JetBrains Mono', monospace; font-size: 15px; color: var(--text2); }

/* ── Kasir Layout ────────────────────────────────────────── */
.kasir-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  height: calc(100vh - 100px);
}

.kasir-left { display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.kasir-right {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
}

.search-icon { font-size: 16px; }
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 12px 0;
}

/* Kategori */
.kategori-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.kategori-tab {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.kategori-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Produk Grid */
.produk-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
  padding-right: 4px;
}

.produk-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}

.produk-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.produk-card.stok-habis { opacity: .4; pointer-events: none; }
.produk-card .stok-badge {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--yellow);
  color: #000;
  font-weight: 700;
}

.produk-card .produk-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.3;
}

.produk-card .produk-kategori {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 8px;
}

.produk-card .produk-harga {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.produk-card .produk-stok {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}

/* Cart */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.cart-header h3 { font-size: 15px; font-weight: 700; }
.btn-clear {
  font-size: 12px;
  color: var(--red);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.cart-items { flex: 1; overflow-y: auto; padding: 10px; }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text2);
}

.empty-icon { font-size: 40px; opacity: .4; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg3);
}

.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13px; font-weight: 600; }
.cart-item-price { font-size: 12px; color: var(--text2); font-family: 'JetBrains Mono', monospace; }

.cart-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.qty-btn:hover { background: var(--accent); border-color: var(--accent); }
.qty-val { font-size: 14px; font-weight: 700; min-width: 20px; text-align: center; font-family: 'JetBrains Mono', monospace; }

.cart-item-subtotal {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  min-width: 80px;
  text-align: right;
}

/* Summary */
.cart-summary {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text2); }
.total-row { font-size: 16px; font-weight: 800; color: var(--text); border-top: 1px solid var(--border); padding-top: 10px; }
#total-display { font-family: 'JetBrains Mono', monospace; color: var(--accent); }
#subtotal { font-family: 'JetBrains Mono', monospace; }

.payment-section { display: flex; flex-direction: column; gap: 8px; }
.payment-section label { font-size: 12px; color: var(--text2); font-weight: 600; }

.metode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.metode-btn {
  padding: 8px 6px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: all .15s;
}

.metode-btn.active { border-color: var(--accent); background: rgba(79,142,247,.15); color: var(--accent); }

#bayar-wrap { display: flex; flex-direction: column; gap: 6px; }
#bayar-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  outline: none;
  width: 100%;
}

#bayar-input:focus { border-color: var(--accent); }

.nominal-shortcuts { display: flex; gap: 6px; flex-wrap: wrap; }
.nominal-shortcuts button {
  flex: 1;
  padding: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.nominal-shortcuts button:hover { border-color: var(--accent); color: var(--accent); }

.kembalian-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.3);
  border-radius: 8px;
  font-size: 13px;
}

.kembalian-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 16px;
  color: var(--green);
}

.btn-bayar {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.btn-bayar:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-bayar:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: var(--bg3);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:hover td { background: var(--bg3); }
.loading-row { text-align: center; color: var(--text2); padding: 30px !important; }

/* ── Riwayat ─────────────────────────────────────────────── */
.riwayat-list { display: flex; flex-direction: column; gap: 10px; }

.riwayat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.riwayat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .15s;
}

.riwayat-header:hover { background: var(--bg3); }
.riwayat-no { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 14px; }
.riwayat-info { font-size: 12px; color: var(--text2); margin-top: 2px; }
.riwayat-total { font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 16px; color: var(--accent); }

.riwayat-detail {
  display: none;
  border-top: 1px solid var(--border);
  padding: 14px 18px;
}

.riwayat-detail.open { display: block; }
.detail-item { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; color: var(--text2); }

/* ── Stats ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-icon { font-size: 28px; }
.stat-val  { font-size: 22px; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text2); text-align: center; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 460px;
  max-width: 95vw;
  box-shadow: var(--shadow);
  animation: slideUp .2s ease;
}

.modal-struk { width: 380px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close {
  background: none; border: none;
  color: var(--text2); font-size: 18px;
  cursor: pointer; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}

.modal-close:hover { background: var(--bg3); color: var(--text); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Form */
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.form-row { display: flex; gap: 12px; }
.form-group label { font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; }
.form-group input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.form-group input:focus { border-color: var(--accent); }

/* Buttons */
.btn-primary {
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: 8px;
  color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s;
}

.btn-primary:hover { opacity: .9; }

.btn-secondary {
  padding: 10px 18px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2); font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: all .15s;
}

.btn-secondary:hover { border-color: var(--text2); color: var(--text); }

.btn-icon {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--bg3);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}

.btn-icon:hover { border-color: var(--accent); }
.btn-icon.del:hover { border-color: var(--red); }

/* Struk */
.struk-toko { text-align: center; margin-bottom: 14px; }
.struk-toko h4 { font-size: 16px; font-weight: 800; }
.struk-toko p { font-size: 12px; color: var(--text2); }
.struk-divider { border: none; border-top: 1px dashed var(--border); margin: 10px 0; }
.struk-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.struk-item { font-size: 12px; color: var(--text2); padding: 2px 0; }
.struk-total { font-weight: 800; font-size: 15px; color: var(--accent); font-family: 'JetBrains Mono', monospace; }
.struk-no { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text2); text-align: center; margin-top: 10px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: all .25s;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: none; }
.toast.success { background: var(--green); color: #fff; }
.toast.error   { background: var(--red); color: #fff; }
.toast.info    { background: var(--accent); color: #fff; }

.loading-state { text-align: center; padding: 40px; color: var(--text2); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Barcode Scanner ─────────────────────────────────────── */
.search-bar-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-bar-row .search-bar {
  flex: 1;
  min-width: 0;
}

.btn-scan {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f59e0b, #ef7c0b);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: opacity .15s;
}

.btn-scan:hover { opacity: .85; }
.scan-icon { font-size: 16px; }

.barcode-manual-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  min-width: 0;
  flex: 1.2;
  transition: border-color .15s;
}

.barcode-manual-wrap:focus-within { border-color: var(--yellow); }

.barcode-icon {
  font-size: 14px;
  color: var(--yellow);
  font-weight: 900;
  letter-spacing: -1px;
}

.barcode-manual-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 12px 0;
}

.barcode-manual-wrap input::placeholder { color: var(--text2); font-family: inherit; }

/* Barcode input in form */
.barcode-input-wrap {
  display: flex;
  gap: 8px;
}

.barcode-input-wrap input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
}

.barcode-input-wrap input:focus { border-color: var(--yellow); }

.btn-scan-inline {
  padding: 8px 14px;
  background: rgba(245,158,11,.15);
  border: 1px solid rgba(245,158,11,.4);
  border-radius: 8px;
  color: var(--yellow);
  font-size: 18px;
  cursor: pointer;
  transition: all .15s;
}

.btn-scan-inline:hover { background: rgba(245,158,11,.3); }

/* Scanner Modal */
.modal-scanner-wrap { width: 480px; }

.scanner-body { gap: 12px; }

.scanner-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px;
  color: var(--text2);
  font-size: 14px;
}

.scanner-spinner { font-size: 30px; animation: spin 1.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#scanner-container { border-radius: 10px; overflow: hidden; }

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-frame {
  position: relative;
  width: 240px;
  height: 160px;
}

.scan-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #f59e0b;
  border-style: solid;
}

.scan-corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.scan-corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.scan-corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.scan-corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.scan-line {
  position: absolute;
  left: 4px; right: 4px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #f59e0b, transparent);
  top: 0;
  animation: scanMove 2s ease-in-out infinite;
  border-radius: 2px;
}

@keyframes scanMove {
  0%   { top: 8px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: calc(100% - 8px); opacity: 0; }
}

.scanner-result {
  padding: 14px 16px;
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.4);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
  text-align: center;
  animation: popIn .25s ease;
}

@keyframes popIn {
  from { transform: scale(.9); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.scanner-result.error {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.4);
  color: var(--red);
}

.scanner-tips { font-size: 12px; color: var(--text2); line-height: 1.6; }
@media print {
  #sidebar, .modal-footer, .modal-close { display: none !important; }
  body { background: white; color: black; }
  .modal { position: static; box-shadow: none; border: none; }
  .modal-body { color: black; }
  .struk-total, .struk-row { color: black !important; }
}


/* ── Flash Feedback ──────────────────────────────────────── */
@keyframes flashSuccess {
  0%,100% { border-color: var(--border); }
  50% { border-color: var(--green); background: rgba(34,197,94,.12); }
}
@keyframes flashError {
  0%,100% { border-color: var(--border); }
  50% { border-color: var(--red); background: rgba(239,68,68,.12); }
}
.barcode-manual-wrap.flash-success { animation: flashSuccess .4s ease; }
.barcode-manual-wrap.flash-error   { animation: flashError .4s ease; }

/* ── Print ───────────────────────────────────────────────── */
@media print {
  #sidebar, .modal-footer, .modal-close { display: none !important; }
  body { background: white; color: black; }
  .modal { position: static; box-shadow: none; border: none; }
  .modal-body { color: black; }
  .struk-total, .struk-row { color: black !important; }
}

/* ── LOGIN SCREEN ────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1000;
}

.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .18;
}

.login-blob.b1 {
  width: 500px; height: 500px;
  background: var(--accent);
  top: -100px; left: -100px;
  animation: blobMove1 8s ease-in-out infinite;
}

.login-blob.b2 {
  width: 400px; height: 400px;
  background: var(--accent2);
  bottom: -80px; right: -80px;
  animation: blobMove2 10s ease-in-out infinite;
}

.login-blob.b3 {
  width: 300px; height: 300px;
  background: var(--green);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: blobMove3 12s ease-in-out infinite;
}

@keyframes blobMove1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,40px)} }
@keyframes blobMove2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-30px,-30px)} }
@keyframes blobMove3 { 0%,100%{transform:translate(-50%,-50%) scale(1)} 50%{transform:translate(-50%,-50%) scale(1.2)} }

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(22,27,39,.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 400px;
  max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  animation: loginSlide .4s ease;
}

@keyframes loginSlide {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  font-size: 48px;
  margin-bottom: 10px;
  display: block;
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-sub {
  color: var(--text2);
  font-size: 14px;
  margin-top: 4px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  transition: border-color .15s;
}

.login-input-wrap:focus-within { border-color: var(--accent); }
.login-input-icon { font-size: 16px; flex-shrink: 0; }

.login-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 13px 0;
}

.btn-toggle-pw {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: .6;
  transition: opacity .15s;
  flex-shrink: 0;
}

.btn-toggle-pw:hover { opacity: 1; }

.login-error {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.4);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
  animation: popIn .2s ease;
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
  transition: opacity .15s, transform .15s;
  position: relative;
}

.btn-login:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text2);
}

.login-footer code {
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--yellow);
  font-family: 'JetBrains Mono', monospace;
}

/* ── User sidebar ────────────────────────────────────────── */
.user-info-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kasir-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: var(--radius);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  color: #fff;
}

.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
  background: rgba(79,142,247,.2);
  color: var(--accent);
}

.user-role-badge.admin {
  background: rgba(124,92,252,.2);
  color: var(--accent2);
}

.user-actions {
  display: flex;
  gap: 6px;
  padding: 0 4px;
}

.user-action-btn {
  flex: 1;
  padding: 7px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
  text-align: center;
}

.user-action-btn:hover { border-color: var(--accent); background: rgba(79,142,247,.1); }
.user-action-btn.logout-btn:hover { border-color: var(--red); background: rgba(239,68,68,.1); }

/* ── Form Select ─────────────────────────────────────────── */
.form-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  width: 100%;
}

.form-select:focus { border-color: var(--accent); }

/* ── Toggle ──────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }

.toggle-wrap input[type="checkbox"] { display: none; }

.toggle-label {
  position: relative;
  padding-left: 50px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
  user-select: none;
}

.toggle-label::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 22px;
  background: var(--border);
  border-radius: 11px;
  transition: background .2s;
}

.toggle-label::after {
  content: '';
  position: absolute;
  left: 3px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
}

.toggle-wrap input:checked + .toggle-label::before { background: var(--green); }
.toggle-wrap input:checked + .toggle-label::after  { left: 21px; }

/* Status badges */
.badge-aktif    { color: var(--green); font-size: 12px; font-weight: 700; }
.badge-nonaktif { color: var(--red); font-size: 12px; font-weight: 700; }

/* ── User Management Badges ──────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.role-admin  { background: rgba(124,92,252,.2); color: #a78bfa; border: 1px solid rgba(124,92,252,.4); }
.role-kasir  { background: rgba(79,142,247,.15); color: var(--accent); border: 1px solid rgba(79,142,247,.3); }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.status-aktif    { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.status-nonaktif { background: rgba(239,68,68,.1);  color: var(--red);   border: 1px solid rgba(239,68,68,.2); }

/* ── Login Error Shake ───────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}
.shake { animation: shake .4s ease; }

/* ── Laporan Margin ──────────────────────────────────────── */
.laporan-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.laporan-tab {
  padding: 9px 18px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.laporan-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  color: #fff;
}

.margin-stats { grid-template-columns: repeat(5, 1fr); margin-bottom: 20px; }

.stat-omset  .stat-val { color: var(--accent); }
.stat-laba   .stat-val { color: var(--green); }
.stat-modal  .stat-val { color: var(--yellow); }
.stat-margin .stat-val { color: #a78bfa; }

.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 700;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.chart-wrap { position: relative; height: 220px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

.margin-bar-wrap { display: flex; align-items: center; gap: 8px; }
.margin-bar {
  flex: 1; height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.margin-bar-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }

.terlaris-list { font-size: 12px; color: var(--text2); line-height: 1.7; }

.laporan-header-right { display: flex; align-items: center; gap: 10px; }

/* Margin preview in product form */
.margin-preview {
  display: flex;
  gap: 20px;
  padding: 10px 14px;
  background: rgba(79,142,247,.08);
  border: 1px solid rgba(79,142,247,.2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text2);
}

.margin-preview strong { color: var(--accent); }

/* Overlay Latar Belakang Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 9999;
}
/* Kotak Modal Putih Bulat */
.modal-scanner-content {
  background: #ffffff; width: 90%; max-width: 420px; border-radius: 28px;
  overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.2); font-family: sans-serif;
}
.modal-scanner-header {
  display: flex; justify-content: space-between; align-items: center; padding: 20px 24px;
}
.scanner-title { display: flex; align-items: center; gap: 10px; }
.scanner-title h3 { margin: 0; font-size: 16px; color: #1e1b4b; font-weight: 700; }
.modal-scanner-close { background: none; border: none; font-size: 18px; color: #9ca3af; cursor: pointer; }

/* Container Kamera & Bingkai Pembaca */
.camera-container {
  position: relative; margin: 0 24px; background: #000; border-radius: 20px;
  height: 220px; overflow: hidden;
}
#reader { width: 100%; height: 100%; object-fit: cover; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover !important; }

/* Overlay Garis Ungu & Laser Merah */
.scanner-laser-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; justify-content: center; align-items: center; pointer-events: none;
}
.laser-box {
  position: relative; width: 85%; height: 75%; border: 1px solid rgba(255,255,255,0.15); border-radius: 12px;
}
/* Siku Kotak Ungu */
.corner { position: absolute; width: 20px; height: 20px; border-color: #8b5cf6; border-style: solid; border-width: 0; }
.top-left { top: 10px; left: 10px; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 4px; }
.top-right { top: 10px; right: 10px; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 4px; }
.bottom-left { bottom: 10px; left: 10px; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 4px; }
.bottom-right { bottom: 10px; right: 10px; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 4px; }
/* Garis Laser Merah Tengah */
.laser-line {
  position: absolute; top: 50%; left: 5%; width: 90%; height: 2px;
  background-color: #ef4444; box-shadow: 0 0 8px #ef4444;
}

/* Toggle Switch Multi Scan */
.toggle-container {
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 24px; padding: 14px 16px; background: #f8fafc; border-radius: 14px;
}
.toggle-text { font-size: 13px; color: #334155; font-weight: 600; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #e2e8f0; transition: .3s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; }
input:checked + .slider { background-color: #e2e8f0; } /* Di foto warnanya putih abu-abu saat aktif/nonaktif */
input:checked + .slider:before { transform: translateX(20px); background-color: #8b5cf6; }
.slider.round { border-radius: 24px; }
.slider.round:before { border-radius: 50%; }

/* Input Manual */
.manual-input-group { margin: 16px 24px; }
.manual-label { font-size: 11px; font-weight: 700; color: #94a3b8; display: block; margin-bottom: 8px; letter-spacing: 0.5px; }
.manual-input-wrapper { display: flex; gap: 8px; }
#scanner-manual-input {
  flex: 1; padding: 12px 16px; border: 1px solid #f1f5f9; background: #f8fafc;
  border-radius: 12px; font-size: 14px; color: #334155; outline: none;
}
.btn-input-manual {
  background: #0f172a; color: #fff; border: none; padding: 0 20px;
  border-radius: 12px; font-weight: 600; font-size: 13px; cursor: pointer;
}

/* Footer Selesai */
.modal-scanner-footer { padding: 8px 24px 24px 24px; text-align: center; }
.btn-selesai {
  width: 100%; background: none; border: none; color: #334155;
  font-weight: 700; font-size: 15px; cursor: pointer; padding: 10px 0;
}
