/* ===================================================
   KALKULATOR & KASIR WARUNG BERAS - STYLESHEET
   =================================================== */

:root {
  --primary: #15803d; /* Emerald Green */
  --primary-hover: #166534;
  --primary-light: #dcfce7;
  --primary-dark: #14532d;
  
  --secondary: #d97706; /* Warm Amber */
  --secondary-light: #fef3c7;
  
  --success: #16a34a;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  
  --bg-main: #f4f6f8;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Brand */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #ffffff;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.85rem;
}

.logo-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fde047;
}

.brand-section h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-section .tagline {
  font-size: 0.8rem;
  opacity: 0.85;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.nav-btn.active {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

/* Main Container */
.app-main {
  padding: 1.5rem;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header.border-bottom {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.max-w-700 { max-width: 700px; margin: 0 auto; }
.max-w-800 { max-width: 850px; margin: 0 auto; }

/* Grid Layouts */
.pos-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 950px) {
  .pos-layout {
    grid-template-columns: 1fr;
  }
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 3px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

.input-prefix-wrapper {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #fff;
  overflow: hidden;
}

.input-prefix-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

.input-prefix-wrapper .prefix {
  padding: 0 12px;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  height: 100%;
  min-height: 42px;
}

.input-prefix-wrapper input {
  border: none;
  border-radius: 0;
  box-shadow: none !important;
}

.input-prefix-wrapper.big-input input {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 12px;
  color: var(--primary-dark);
}

/* Price Badges */
.price-badge-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 1.2rem;
}

.price-badge {
  text-align: center;
}

.badge-title {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.badge-val {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 2px;
}

/* Presets Buttons */
.quick-presets {
  margin-top: 0.75rem;
  margin-bottom: 1.25rem;
}

.preset-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-preset {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-preset:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: #86efac;
}

.btn-preset:active {
  transform: scale(0.96);
}

/* Nominal Result Display */
.nominal-result-card {
  background: #f0fdf4;
  border: 1.5px dashed #86efac;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 1.2rem;
}

.result-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.result-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.res-box {
  background: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #bbf7d0;
  text-align: center;
}

.res-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.res-number {
  font-size: 1.1rem;
  color: var(--primary-dark);
}

/* Item Subtotal Banner */
.item-subtotal-banner {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.subtotal-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.subtotal-desc {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fde047;
}

.subtotal-amount {
  font-size: 1.4rem;
  font-weight: 800;
  color: #4ade80;
}

/* Buttons */
.btn-action-group {
  display: flex;
  gap: 10px;
}

.btn-primary, .btn-secondary, .btn-success, .btn-outline-primary, .btn-outline-success, .btn-outline-danger {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  flex: 1;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text-main);
}
.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-outline-success {
  background: transparent;
  border: 1.5px solid var(--success);
  color: var(--success);
}
.btn-outline-success:hover {
  background: #f0fdf4;
}

.btn-outline-primary {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary-light);
}

.btn-outline-danger {
  background: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
}
.btn-outline-danger:hover {
  background: var(--danger-light);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 20px;
  font-size: 1.05rem;
}

.btn-icon-danger {
  background: #fee2e2;
  border: none;
  color: var(--danger);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-icon-danger:hover {
  background: #fca5a5;
}

/* Cart Specifics */
.cart-items-container {
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 4px;
}

.empty-cart-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  color: var(--text-muted);
  text-align: center;
}

.empty-cart-state p {
  font-weight: 600;
  margin-top: 8px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
}

.cart-item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cart-item-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-dark);
  margin-right: 12px;
}

.cart-item-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
}

/* Cart Summary & Payment */
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.total-highlight {
  font-size: 1.1rem;
  font-weight: 700;
}

.discount-row input {
  width: 120px;
  padding: 6px 10px;
  text-align: right;
  font-weight: 700;
}

.grand-total-row {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.grand-total-amount {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 12px 0;
}

/* Cash Buttons */
.payment-box {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.quick-cash-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.btn-cash {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-cash:hover {
  background: var(--blue-light);
  border-color: #93c5fd;
  color: var(--blue);
}

/* Change Display */
.change-display {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ecfdf5;
  border: 1.5px solid #6ee7b7;
  color: #065f46;
}

.change-display.underpaid {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.change-amount {
  font-size: 1.25rem;
  font-weight: 800;
}

.checkout-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Tab 2: HPP & Profit */
.section-subtitle {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--primary-light);
}

.hpp-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.hpp-item, .rec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.hpp-item:last-child, .rec-row:last-child {
  margin-bottom: 0;
}

.highlight-modal {
  padding: 8px 10px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

.recommendation-box {
  border-left: 4px solid var(--primary);
  background: #f0fdf4;
}

.recommendation-box h4, .profit-summary-box h4 {
  font-size: 0.88rem;
  margin-bottom: 10px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.profit-summary-box {
  border-left: 4px solid var(--secondary);
  background: var(--secondary-light);
}

/* Tab 3: Konversi Satuan */
.density-setting-banner {
  background: var(--blue-light);
  border: 1px solid #93c5fd;
  color: #1e40af;
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.density-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.converter-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.converter-box h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--primary-dark);
}

.conv-results {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conv-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

.conv-row strong {
  color: var(--primary);
  font-size: 0.95rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: #f1f5f9;
  padding: 10px 14px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border-color);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td {
  background: #f8fafc;
}

.btn-tbl-action {
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  cursor: pointer;
  margin-right: 4px;
}
.btn-tbl-action:hover {
  background: #f1f5f9;
}

/* Tab 5: Report Stats */
.report-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 1rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.bg-emerald { background: #059669; }
.bg-blue { background: #2563eb; }
.bg-amber { background: #d97706; }
.bg-green { background: #16a34a; }

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

.action-btn-row {
  display: flex;
  gap: 8px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-dialog form {
  padding: 18px;
}

.modal-footer {
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Receipt Paper Styles & Size Switcher */
.receipt-dialog {
  max-width: 440px;
  transition: max-width 0.2s ease;
}

/* Paper Size Selection Cards */
.paper-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.paper-card {
  display: block;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.paper-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.paper-card:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.paper-card.active {
  border-color: var(--primary);
  background: #f0fdf4;
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.2);
}

.paper-card-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.paper-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.paper-card.active .paper-card-icon {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.paper-card-info {
  display: flex;
  flex-direction: column;
}

.paper-card-info strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

.paper-card-info span {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Receipt Paper Styles & Size Switcher */
.receipt-dialog {
  max-width: 440px;
  transition: max-width 0.2s ease;
}

.receipt-dialog.dialog-a5 {
  max-width: 520px;
}

.receipt-dialog.dialog-a4 {
  max-width: 620px;
}

.receipt-size-toolbar {
  padding: 8px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.size-btn-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-size {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-size:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-size.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.receipt-paper {
  background: #ffffff;
  margin: 0 auto;
  font-family: 'Courier New', Courier, monospace;
  color: #000000;
  line-height: 1.35;
  transition: all 0.2s ease;
}

/* Ukuran 58mm (Mini POS / Bluetooth Thermal) */
.receipt-paper.size-58mm {
  width: 100%;
  max-width: 250px;
  padding: 12px 8px;
  font-size: 11px;
}
.receipt-paper.size-58mm .receipt-header h2 { font-size: 14px; }
.receipt-paper.size-58mm .calc-row.grand { font-size: 13px; }

/* Ukuran 76mm (Dot Matrix / POS 76mm) */
.receipt-paper.size-76mm {
  width: 100%;
  max-width: 310px;
  padding: 16px 12px;
  font-size: 12px;
}
.receipt-paper.size-76mm .receipt-header h2 { font-size: 15px; }
.receipt-paper.size-76mm .calc-row.grand { font-size: 14px; }

/* Ukuran 80mm (Standar POS Thermal) */
.receipt-paper.size-80mm {
  width: 100%;
  max-width: 360px;
  padding: 18px 16px;
  font-size: 13px;
}
.receipt-paper.size-80mm .receipt-header h2 { font-size: 17px; }
.receipt-paper.size-80mm .calc-row.grand { font-size: 15px; }

/* Ukuran A5 (Kwitansi / Setengah Folio) */
.receipt-paper.size-a5 {
  width: 100%;
  max-width: 480px;
  padding: 20px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.receipt-paper.size-a5 .receipt-header h2 { font-size: 18px; color: var(--primary-dark); }

/* Ukuran A4 (Faktur Lengkap / HVS) */
.receipt-paper.size-a4 {
  width: 100%;
  max-width: 560px;
  padding: 24px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.receipt-paper.size-a4 .receipt-header h2 { font-size: 20px; color: var(--primary-dark); }
.receipt-paper.size-a4 .receipt-table th, .receipt-paper.size-a5 .receipt-table th {
  background: #f8fafc;
  padding: 6px 8px;
  border-bottom: 2px solid #cbd5e1;
}
.receipt-paper.size-a4 .receipt-table td, .receipt-paper.size-a5 .receipt-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.receipt-header {
  text-align: center;
  margin-bottom: 8px;
}

.receipt-header h2 {
  font-weight: 800;
  margin: 4px 0 2px 0;
}

.receipt-header p {
  font-size: 0.9em;
  opacity: 0.85;
}

.receipt-logo {
  display: inline-block;
  color: #15803d;
}

.receipt-divider {
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: -1px;
  color: #333;
  margin: 6px 0;
}

.receipt-meta {
  font-size: 0.92em;
}

.meta-row, .calc-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  margin: 4px 0;
}

.receipt-table th {
  border-bottom: 1px dashed #000;
  padding: 4px 0;
}

.receipt-table td {
  padding: 4px 0;
  vertical-align: top;
}

.calc-row.grand {
  font-weight: bold;
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  padding: 4px 0;
  margin: 4px 0;
}

.receipt-footer {
  text-align: center;
  margin-top: 10px;
  font-size: 0.88em;
}

/* Print Styles & Thermal Printer Formatting */
@media print {
  @page {
    margin: 0;
  }
  
  body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body * {
    visibility: hidden;
  }

  .receipt-paper, .receipt-paper * {
    visibility: visible;
  }

  .receipt-paper {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  .receipt-paper.size-58mm {
    width: 58mm !important;
    max-width: 58mm !important;
    padding: 2mm 3mm !important;
    font-size: 10.5pt !important;
  }

  .receipt-paper.size-76mm {
    width: 76mm !important;
    max-width: 76mm !important;
    padding: 3mm 4mm !important;
    font-size: 11pt !important;
  }

  .receipt-paper.size-80mm {
    width: 80mm !important;
    max-width: 80mm !important;
    padding: 4mm 5mm !important;
    font-size: 12pt !important;
  }

  .receipt-paper.size-a5 {
    width: 148mm !important;
    max-width: 148mm !important;
    padding: 8mm !important;
  }

  .receipt-paper.size-a4 {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10mm !important;
  }

  .no-print {
    display: none !important;
  }
}

/* Status Badges */
.badge-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-paid {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.badge-tempo {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.badge-transfer {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

/* Low Stock Warning Box */
.low-stock-warning {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  color: #991b1b;
}

.low-stock-warning strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

/* Utility Helpers */
.icon-sm { width: 18px; height: 18px; vertical-align: middle; }
.icon-xl { width: 44px; height: 44px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-lg { font-size: 1.15rem; }
.mt-xs { margin-top: 0.4rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.gap-lg { gap: 1.5rem; }
.d-block { display: block; }

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-paid {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.badge-transfer {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}
.badge-piutang {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
}
.badge-tempo {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

/* Database Connection Status Badge */
.db-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  margin-left: auto;
  transition: all 0.2s ease;
}

.db-status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  display: inline-block;
}

.db-status-badge.connected {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(52, 211, 153, 0.6);
  color: #a7f3d0;
}

.db-status-badge.connected .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px #34d399;
}

.db-status-badge.offline {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(251, 191, 36, 0.5);
  color: #fde68a;
}

.db-status-badge.offline .status-dot {
  background: #f59e0b;
}


