/* =========================================================================
   Aplikasi Manajemen Warung - Gaya Khusus
   ========================================================================= */

:root {
  --topbar-h: 56px;
  --sidebar-w: 248px;
  --brand: #0d6efd;
  --brand-dark: #0a58ca;
  --sidebar-bg: #16202f;
  --sidebar-fg: #c7d2e0;
}

* { scrollbar-width: thin; }
body {
  background: #f2f4f8;
  font-size: 14px;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

/* ---------- Halaman masuk ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 55%, #073b8c 100%);
}
.login-card { width: 100%; max-width: 430px; border: 0; border-radius: 14px; }
.brand-badge {
  width: 62px; height: 62px; border-radius: 16px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 26px; letter-spacing: .5px;
}
.brand-badge.sm { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; }

/* ---------- Kerangka aplikasi ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h);
  background: var(--sidebar-bg);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; z-index: 1030;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; font-weight: 600; letter-spacing: .3px;
}
.topbar-brand:hover { color: #fff; }

.app-body { padding-top: var(--topbar-h); min-height: 100vh; }

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
  width: var(--sidebar-w); background: var(--sidebar-bg);
  overflow-y: auto; z-index: 1025;
  display: flex; flex-direction: column;
  transition: transform .2s ease;
}
.sidebar-nav { padding: 10px 8px 20px; flex: 1; }
.sidebar-foot { padding: 10px 14px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .nav-section {
  color: #7c8da6; font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; padding: 14px 12px 6px;
}
.sidebar .nav-link {
  color: var(--sidebar-fg); border-radius: 8px; padding: 9px 12px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin-bottom: 2px;
}
.sidebar .nav-link i { font-size: 16px; width: 20px; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: var(--brand); color: #fff; font-weight: 600; }
.sidebar .nav-link .badge { font-size: 10px; }

.content { margin-left: var(--sidebar-w); padding: 18px; min-height: calc(100vh - var(--topbar-h)); }
.sidebar-backdrop {
  position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.45);
  z-index: 1020; display: none;
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .content { margin-left: 0; padding: 12px; }
}

/* ---------- Kartu dan tabel ---------- */
.card { border: 0; box-shadow: 0 1px 3px rgba(16,24,40,.08); border-radius: 10px; }
.card-header { background: #fff; border-bottom: 1px solid #e9edf3; font-weight: 600; border-radius: 10px 10px 0 0 !important; }
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-sub { color: #6b7a90; font-size: 13px; }
.stat-card { border-left: 4px solid var(--brand); }
.stat-card .stat-value { font-size: 22px; font-weight: 700; line-height: 1.15; }
.stat-card .stat-label { font-size: 12px; color: #6b7a90; text-transform: uppercase; letter-spacing: .4px; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }

.table thead th {
  background: #f7f9fc; font-size: 12px; text-transform: uppercase; letter-spacing: .3px;
  color: #5c6b80; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.table td { vertical-align: middle; }
.table-sm td, .table-sm th { padding: .4rem .5rem; }
.table-hover tbody tr:hover { background: #f7fbff; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.clickable { cursor: pointer; }
.text-tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.empty-state { padding: 38px 16px; text-align: center; color: #8b98a9; }
.empty-state i { font-size: 40px; display: block; margin-bottom: 8px; opacity: .45; }

/* ---------- Kasir (POS) ---------- */
.pos-wrap { display: flex; gap: 14px; align-items: flex-start; }
.pos-left { flex: 1 1 auto; min-width: 0; }
.pos-right { flex: 0 0 390px; max-width: 390px; }
@media (max-width: 1199.98px) {
  .pos-wrap { flex-direction: column; }
  .pos-right { flex: 1 1 auto; max-width: 100%; width: 100%; }
}
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.product-tile {
  background: #fff; border: 1px solid #e3e8ef; border-radius: 10px; padding: 10px;
  cursor: pointer; transition: .12s; position: relative; min-height: 96px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.product-tile:hover { border-color: var(--brand); box-shadow: 0 3px 10px rgba(13,110,253,.15); transform: translateY(-1px); }
.product-tile .pt-name { font-weight: 600; font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-tile .pt-price { color: var(--brand); font-weight: 700; font-size: 13.5px; }
.product-tile .pt-meta { font-size: 11px; color: #8593a6; }
.product-tile.out { opacity: .55; }
.product-tile .pt-badge { position: absolute; top: 6px; right: 6px; font-size: 10px; }

.cart-list { max-height: calc(100vh - 380px); min-height: 150px; overflow-y: auto; }
.cart-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px dashed #e6ebf2; }
.cart-item:last-child { border-bottom: 0; }
.cart-item .ci-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.cart-item .ci-sub { font-size: 11.5px; color: #7d8b9d; }
.qty-input { width: 62px; text-align: center; }
.total-box { background: #f7f9fc; border-radius: 8px; padding: 10px 12px; }
.total-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 13.5px; }
.total-row.grand { font-size: 20px; font-weight: 700; border-top: 1px solid #dde3ec; margin-top: 6px; padding-top: 8px; color: var(--brand-dark); }
.pay-quick .btn { min-width: 62px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keypad .btn { padding: 10px 0; font-weight: 600; }

/* ---------- Cetak ---------- */
.print-area { display: none; }

.receipt {
  width: 58mm; font-family: ui-monospace, "Courier New", Consolas, monospace;
  font-size: 11px; color: #000; line-height: 1.35;
}
.receipt.w80 { width: 76mm; font-size: 12px; }
.receipt .r-center { text-align: center; }
.receipt .r-right { text-align: right; }
.receipt .r-bold { font-weight: 700; }
.receipt .r-title { font-size: 14px; font-weight: 700; letter-spacing: .5px; }
.receipt .r-line { border-top: 1px dashed #000; margin: 4px 0; }
.receipt table { width: 100%; border-collapse: collapse; font-size: inherit; }
.receipt table td { padding: 0; vertical-align: top; }
.receipt .r-item-name { padding-top: 3px; }
.receipt .r-small { font-size: 10px; }
.receipt img.r-logo { max-width: 42mm; max-height: 18mm; }

/* Nota / struk ukuran A5 untuk surat jalan */
.doc-sheet { background: #fff; padding: 16px; }

@media print {
  body { background: #fff !important; }
  .topbar, .sidebar, .sidebar-backdrop, .no-print, .toast-container,
  #overlay, #loadingBar, #modalArea, .modal, .modal-backdrop, .app-body { display: none !important; }
  .print-area { display: block !important; }
  #printRoot { display: block !important; }
  a[href]:after { content: none !important; }
  .table thead th { background: #eee !important; }
  .print-page { page-break-after: always; }
  .print-page:last-child { page-break-after: auto; }
  @page { margin: 8mm; }
  .receipt-page { margin: 0; }
  @page receipt { size: 58mm auto; margin: 2mm; }
}

/* Struk cetak thermal: halaman terpisah */
.print-area.receipt-area .receipt { margin: 0 auto; }

/* ---------- Overlay / loading ---------- */
.app-overlay {
  position: fixed; inset: 0; background: rgba(15,22,33,.45);
  z-index: 1085; display: flex; align-items: center; justify-content: center;
}
.loading-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  background-size: 200% 100%; animation: loadingSlide 1.1s linear infinite; z-index: 1100;
}
@keyframes loadingSlide { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Lain-lain ---------- */
.badge-soft { font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.form-label { font-size: 13px; font-weight: 600; margin-bottom: .25rem; color: #43536b; }
.required:after { content: " *"; color: #dc3545; }
.help-text { font-size: 11.5px; color: #8593a6; }
.table-fixed-header { max-height: 62vh; overflow-y: auto; }
.table-fixed-header thead th { position: sticky; top: 0; z-index: 2; }
.report-header { border-bottom: 2px solid #222; margin-bottom: 12px; padding-bottom: 8px; }
.summary-line { display: flex; justify-content: space-between; border-bottom: 1px dotted #ccc; padding: 3px 0; }
.dash-chart { height: 280px; position: relative; }
.modal-body.scroll-y { max-height: 70vh; overflow-y: auto; }
.barcode-svg { max-width: 100%; height: 54px; }
.scan-input { font-family: ui-monospace, monospace; }
.nav-pills .nav-link { font-size: 13.5px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: #6b7a90; font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; }
.sticky-pay { position: sticky; bottom: 0; background: #fff; border-top: 1px solid #e9edf3; padding-top: 10px; }