:root {
  --soft-bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --brand: #1f3a8a;
  --brand-2: #2563eb;
  --sidebar: #0f172a;
}
* { box-sizing: border-box; }
body { background: var(--soft-bg); color: var(--ink); font-size: 14px; }
a { text-decoration: none; }
h1, h2, h3, h4, h5 { letter-spacing: -.02em; }
.card { border: 0; border-radius: 14px; box-shadow: 0 8px 22px rgba(15,23,42,.06); }
.card-body { padding: 14px 16px; }
.table { margin-bottom: 0; font-size: .88rem; }
.table > :not(caption) > * > * { vertical-align: middle; padding: .46rem .55rem; }
.table-sm > :not(caption) > * > * { padding: .32rem .42rem; }
.table thead th { color: #475569; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; border-bottom-color: #e2e8f0; white-space: nowrap; }
.form-label { margin-bottom: .25rem; font-weight: 600; font-size: .82rem; color: #334155; }
.form-control, .form-select { border-radius: 10px; border-color: #dbe3ef; padding: .42rem .62rem; font-size: .9rem; min-height: 36px; }
textarea.form-control { min-height: auto; }
.form-control:focus, .form-select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 .16rem rgba(37,99,235,.12); }
.btn { border-radius: 10px; font-weight: 600; padding: .4rem .75rem; }
.btn-sm { padding: .25rem .48rem; font-size: .78rem; border-radius: 8px; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 0; }
.badge { font-weight: 600; border-radius: 999px; padding: .34em .58em; }
.alert { padding: .55rem .85rem; border-radius: 12px; }

.app-shell { min-height: 100vh; display: flex; }
.app-sidebar { width: 232px; min-height: 100vh; position: fixed; left: 0; top: 0; bottom: 0; padding: 14px; background: radial-gradient(circle at top left, #2745a6 0, #0f172a 42%, #111827 100%); color: #fff; display: flex; flex-direction: column; z-index: 1030; }
.app-content { flex: 1; min-width: 0; margin-left: 232px; }
.sidebar-brand { display: flex; gap: 10px; align-items: center; color: #fff; padding: 8px 6px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand:hover { color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.sidebar-brand small { display: block; color: rgba(255,255,255,.68); line-height: 1.2; font-size: .76rem; }
.sidebar-nav { padding: 14px 0; display: grid; gap: 6px; }
.sidebar-link { color: rgba(255,255,255,.76); padding: 9px 10px; border-radius: 12px; display: flex; gap: 9px; align-items: center; transition: .15s ease; font-size: .92rem; }
.sidebar-link:hover, .sidebar-link.active { color: #fff; background: rgba(255,255,255,.12); }
.sidebar-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); flex: 0 0 7px; }
.sidebar-link.active .sidebar-dot { background: #60a5fa; box-shadow: 0 0 0 4px rgba(96,165,250,.14); }
.sidebar-user { margin-top: auto; padding: 12px; border-radius: 15px; background: rgba(255,255,255,.09); }
.app-topbar { margin: 12px 16px 0; padding: 10px 14px; border-radius: 16px; background: rgba(255,255,255,.9); box-shadow: 0 8px 22px rgba(15,23,42,.05); display: flex; align-items: center; justify-content: space-between; backdrop-filter: blur(8px); }
.app-content main { padding: 16px !important; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at top left, #dbeafe 0, #f4f7fb 36%, #eef2ff 100%); }
.login-card { max-width: 440px; width: 100%; }
.stat-card { overflow: hidden; min-height: 82px; }
.stat-card .card-body { padding: 13px 15px; }
.stat-card .display-6 { font-weight: 800; color: var(--brand); line-height: 1.05; }
.page-title-row { margin-bottom: 12px; }
.compact-muted { color: var(--muted); font-size: .85rem; }
.action-buttons { display: flex; flex-wrap: nowrap; gap: 5px; }
.logo-preview { max-height: 70px; max-width: 220px; object-fit: contain; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 6px; }
.brand-logo-print { max-height: 58px; max-width: 190px; object-fit: contain; }
.print-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #e2e8f0; }
.print-header .print-title { font-size: 1.1rem; font-weight: 800; }

.receipt { max-width: 760px; margin: 0 auto; background: white; padding: 14px; border: 1px solid #333; }
.receipt-copy { border: 1px dashed #333; padding: 12px; margin-bottom: 0; }
.receipt-title { font-size: 20px; font-weight: 800; text-align: center; }
.receipt-logo { max-height: 70px; max-width: 220px; object-fit: contain; display: block; margin: 0 auto 6px; }
.receipt-table { font-size: 13px; }
.receipt-table td { padding: 4px 6px; border-bottom: 1px solid #ddd; }
.qr-svg { width: 150px; height: 150px; max-width: 100%; }
.tag { width: 380px; background: #fff; border: 1px solid #111; padding: 10px; margin: 15px auto; font-size: 13px; }
.barcode-svg { max-width: 100%; height: auto; }

@media (max-width: 991px) {
  .app-shell { display: block; }
  .app-sidebar { position: static; width: 100%; min-height: auto; border-radius: 0 0 20px 20px; }
  .app-content { margin-left: 0; }
  .sidebar-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-user { margin-top: 8px; }
  .app-topbar { margin: 10px; }
  .app-content main { padding: 12px !important; }
}

@media print {
  .no-print, .app-sidebar, .app-topbar, .navbar, .btn, form, .modal { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .app-content { margin-left: 0 !important; }
  main { padding: 0 !important; }
  .card { box-shadow: none; border: 0; }
  .card-body { padding: 8px 0; }
  .table > :not(caption) > * > * { padding: .25rem .35rem; }
  .receipt, .tag { page-break-inside: avoid; }
  .receipt { border: 0; padding: 0; }
  .print-header { display: flex !important; }
}
.report-section { page-break-inside: avoid; }
.report-section h6 { font-size: .95rem; }
@media print {
  .report-section { margin-bottom: 10px; }
  .table-danger > * { background: #fff !important; }
  .table-warning > * { background: #fff !important; }
}


/* Step 05: Print report fix - remove Chrome print-preview horizontal scrollbars and force wide tables to fit A4 portrait */
@media print {
  @page { size: A4 portrait; margin: 9mm; }
  html, body, .app-shell, .app-content, main { width: 100% !important; max-width: 100% !important; overflow: visible !important; }
  .container, .container-fluid { width: 100% !important; max-width: 100% !important; padding-left: 0 !important; padding-right: 0 !important; margin: 0 !important; }
  .table-responsive { display: block !important; width: 100% !important; max-width: 100% !important; overflow-x: visible !important; overflow-y: visible !important; -webkit-overflow-scrolling: auto !important; }
  .table-responsive::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none !important; }
  .report-section { width: 100% !important; max-width: 100% !important; overflow: visible !important; page-break-inside: avoid; break-inside: avoid; }
  .report-section .table { width: 100% !important; max-width: 100% !important; table-layout: fixed !important; border-collapse: collapse !important; font-size: 8.6px !important; }
  .report-section .table th, .report-section .table td { white-space: normal !important; word-break: break-word !important; overflow-wrap: anywhere !important; padding: 2px 3px !important; line-height: 1.18 !important; }
  .report-section .table thead th { font-size: 7.6px !important; letter-spacing: 0 !important; }
  .report-section .badge { font-size: 7px !important; padding: 2px 4px !important; white-space: normal !important; }
  .row, .col-xl-4, .col-xl-8, [class*="col-"] { break-inside: avoid; page-break-inside: avoid; }
  .print-header { width: 100% !important; max-width: 100% !important; overflow: visible !important; }
}
