:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --border: #e2e8f0;
  --accent: #0C2F6E;
  --accent-hover: #1a3f7a;
  --accent-light: #eef2ff;
  --success: #15803d;
  --danger: #b91c1c;
  --warning: #d97706;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 28px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

.app {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* atau center, sesuai selera */
  gap: 8px;
  margin-bottom: 8px;
}

.logo-icon {
  color: var(--accent);
  width: 36px;
  height: 36px;
}

/* Logo baru */
.brand-logo {
  display: block;
  height: 80px;        /* sesuaikan tinggi logo, bisa 40px - 50px */
  width: auto;         /* jaga proporsi */
  margin-right: 12px;  /* jarak ke tagline jika masih sejajar */
}

.tagline {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  /* padding-left: 52px; */
  line-height: 1.3;
}

.nav-menu {
  list-style: none;
  margin-top: 24px;
}

.nav-menu li {
  padding: 12px 18px;
  margin: 8px 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.95rem;
}

.nav-menu li:hover {
  background: var(--accent-light);
}

.nav-menu li.active {
  background: var(--accent);
  color: white;
}

.nav-menu li .material-icons {
  font-size: 22px;
}

/* Main content */
.content {
  margin-left: 280px;
  flex: 1;
  padding: 32px 40px;
  transition: margin-left 0.3s;
}

/* Dashboard */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

/* Products grid - default desktop */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px;
  margin-top: 28px;
}

.product-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.08);
}

.product-img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: var(--accent-light);
}

.product-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-name {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.product-variant, .product-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin: 4px 0 2px;
  line-height: 1.3;
}

.product-price {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.15rem;
  margin: 8px 0 16px;
}

.add-to-cart {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 40px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
}
.add-to-cart:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}
input, textarea, select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'Roboto', sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12,47,110,0.1);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary {
  background: var(--accent);
  color: white;
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 0.85rem;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn-secondary {
  background: #e2e8f0;
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 0.85rem;
}
.btn-secondary:hover {
  background: #cbd5e1;
  transform: translateY(-1px);
}
.btn-danger {
  background: #fecaca;
  color: var(--danger);
  padding: 8px 16px;
  border-radius: 40px;
  font-size: 0.8rem;
}
.btn-danger:hover {
  background: #f87171;
  color: white;
}

/* Edit & Delete product buttons */
.edit-product, .delete-product {
  padding: 8px 18px;
  border-radius: 40px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.edit-product {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--border);
}
.edit-product:hover {
  background: var(--accent);
  color: white;
}
.delete-product {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fecaca;
}
.delete-product:hover {
  background: var(--danger);
  color: white;
}

/* Invoice table action buttons */
.mark-paid, .mark-cancelled, .view-detail, .delete-invoice {
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.75rem;
  margin: 0 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: none;
}
.mark-paid { background: #d1fae5; color: #065f46; }
.mark-paid:hover { background: #065f46; color: white; }
.mark-cancelled { background: #fee2e2; color: #991b1b; }
.mark-cancelled:hover { background: #991b1b; color: white; }
.view-detail { background: #e0e7ff; color: #1e40af; }
.view-detail:hover { background: #1e40af; color: white; }
.delete-invoice { background: #fee2e2; color: #991b1b; }
.delete-invoice:hover { background: #991b1b; color: white; }

/* Cart item quantity buttons */
.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 48px;
  padding: 4px 8px;
}
.qty-btn-modern {
  background: white;
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.qty-btn-modern:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: scale(1.05);
}
.qty-number {
  font-weight: 600;
  min-width: 28px;
  text-align: center;
  font-size: 0.9rem;
}
.remove-item-modern {
  background: white;
  border: 1px solid #fecaca;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.remove-item-modern:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  transform: scale(1.05);
}

/* Cart panel */
.cart-panel {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}
.cart-panel h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--accent);
}
.cart-items-list {
  margin-bottom: 24px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.cart-item-info {
  flex: 2;
  min-width: 120px;
}
.cart-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.cart-item-price {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.cart-item-subtotal {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 85px;
  text-align: right;
  color: var(--accent);
}
.extra-fees {
  margin: 20px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.fee-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fee-row label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 65px;
}
.fee-row input {
  width: 130px;
  padding: 8px 12px;
  text-align: right;
}
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 800;
  font-size: 1.3rem;
  margin: 20px 0 24px;
  padding-top: 12px;
  border-top: 2px dashed var(--border);
}
.cart-actions {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

/* Tables */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  display: block;
  margin-top: 20px;
}
.invoice-table th, .invoice-table td {
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) {
  white-space: nowrap;
  width: 1%;
}
.status-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 40px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-unpaid { background: #fef3c7; color: #b45309; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.invoice-preview {
  background: #ffffff;
  padding: 24px;
  border-radius: 24px;
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  font-family: 'Roboto', sans-serif;
}

/* Mobile menu button - default hidden */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1100;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Dashboard smoothing */
.stat-card {
  transition: transform 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
}
#salesChart {
  max-height: 260px;
}
.invoice-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background: #f8fafc;
}



/* ========== RESPONSIVE BREAKPOINTS ========== */
/* Tablet (ipad) */
@media (min-width: 768px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  .content {
    padding: 24px 30px;
  }
}

/* Mobile (HP) - lebar maksimal 768px */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .content {
    margin-left: 0;
    padding: 16px;
    padding-top: 70px;
  }
  /* Grid untuk HP: 2 kolom untuk layar sangat kecil, 3 kolom untuk layar >400px */
  .products-grid {
    display: grid;
    gap: 12px;
    margin-top: 16px;
  }
  /* Default 2 kolom */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Jika lebar minimal 400px, jadi 3 kolom */
  @media (min-width: 400px) {
    .products-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }
  .product-img {
    height: 120px;
  }
  .product-info {
    padding: 12px;
  }
  .product-name {
    font-size: 0.85rem;
  }
  .product-variant, .product-desc {
    font-size: 0.6rem;
  }
  .product-price {
    font-size: 0.85rem;
    margin: 6px 0 10px;
  }
  .add-to-cart {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
  .edit-product, .delete-product {
    padding: 4px 10px;
    font-size: 0.7rem;
  }
  /* Layout POS vertical */
  .pos-layout {
    display: flex !important;
    flex-direction: column;
    gap: 20px;
  }
  .cart-panel {
    position: static;
    margin-bottom: 20px;
    max-height: none;
    border-radius: 20px;
    padding: 16px;
  }
  .cart-item {
    padding: 12px 0;
    gap: 8px;
  }
  .cart-item-actions {
    gap: 4px;
    padding: 2px 6px;
  }
  .qty-btn-modern, .remove-item-modern {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  .qty-number {
    min-width: 24px;
    font-size: 0.8rem;
  }
  .extra-fees {
    flex-direction: column;
    gap: 8px;
  }
  .fee-row {
    justify-content: space-between;
  }
  .cart-total {
    font-size: 1.1rem;
    margin: 12px 0 16px;
  }
  .cart-actions {
    flex-direction: column;
    gap: 12px;
  }
  .cart-actions button {
    width: 100%;
  }
  .invoice-table th, .invoice-table td {
    padding: 8px 6px;
    font-size: 0.7rem;
  }
  .status-badge {
    padding: 3px 8px;
    font-size: 0.6rem;
  }
  .dashboard-stats {
    gap: 16px;
  }
  .stat-card {
    padding: 16px;
  }
  .stat-number {
    font-size: 1.5rem;
  }
}

/* Tambahan untuk layar sangat kecil (di bawah 400px) tetap 2 kolom */
@media (max-width: 399px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .product-img {
    height: 100px;
  }
  .product-name {
    font-size: 0.75rem;
  }
  .product-price {
    font-size: 0.75rem;
  }
}

/* ========== KERANJANG MELAYANG UNTUK MOBILE & TABLET ========== */
@media (max-width: 1024px) {
    /* Pada tablet dan HP, keranjang menjadi fixed di bawah */
    .cart-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        z-index: 1000;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
        max-height: 45vh;
        overflow-y: auto;
        padding: 16px;
        transition: transform 0.3s ease;
        border-top: 1px solid var(--border);
    }

    /* Beri padding bawah pada konten agar tidak tertutup keranjang */
    .content {
        padding-bottom: 50vh;
    }

    /* Sembunyikan keranjang versi asli yang statis (agar tidak dobel) */
    .pos-layout .cart-panel:not(.fixed-cart) {
        /* Tidak perlu, karena kita mengubah langsung .cart-panel */
    }

    /* Perbaiki layout pos-layout agar produk tidak terdesak */
    .pos-layout {
        display: block !important;
    }

    /* Tinggi keranjang lebih kecil untuk HP */
    .cart-panel {
        max-height: 40vh;
    }

    /* Atur ulang ukuran font dan padding di keranjang agar pas */
    .cart-panel h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .cart-items-list {
        max-height: 180px;
        overflow-y: auto;
        margin-bottom: 8px;
    }

    .cart-item {
        padding: 8px 0;
    }

    .cart-item-name {
        font-size: 0.85rem;
    }

    .cart-item-price {
        font-size: 0.7rem;
    }

    .cart-item-actions {
        gap: 4px;
        padding: 2px 6px;
    }

    .qty-btn-modern, .remove-item-modern {
        width: 28px;
        height: 28px;
    }

    .qty-number {
        min-width: 24px;
        font-size: 0.8rem;
    }

    .cart-item-subtotal {
        font-size: 0.8rem;
        min-width: 70px;
    }

    .extra-fees {
        margin: 8px 0;
        padding: 8px 0;
        gap: 8px;
    }

    .fee-row {
        gap: 8px;
    }

    .fee-row input {
        width: 100px;
        padding: 6px 8px;
    }

    .cart-total {
        font-size: 1rem;
        margin: 8px 0 12px;
    }

    .cart-actions {
        flex-direction: row;
        gap: 10px;
    }

    .cart-actions button {
        flex: 1;
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* Untuk HP layar sempit (max-width 480px), perkecil padding-bottom konten */
@media (max-width: 480px) {
    .content {
        padding-bottom: 45vh;
    }
    .cart-panel {
        max-height: 45vh;
    }
    .cart-items-list {
        max-height: 150px;
    }
}

/* Untuk tablet (768px - 1024px), keranjang tetap melayang tapi lebih besar */
@media (min-width: 768px) and (max-width: 1024px) {
    .content {
        padding-bottom: 40vh;
    }
    .cart-panel {
        max-height: 38vh;
    }
    .cart-items-list {
        max-height: 200px;
    }
}

/* ========== PERBAIKAN TABEL DAFTAR INVOICE ========== */
/* Hilangkan kotak putih berlebih pada container tabel */
.invoice-table {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: none;
}

/* Pastikan sel tabel tidak memiliki latar ganda */
.invoice-table th,
.invoice-table td {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 14px 12px;
  white-space: nowrap;
}

/* Untuk HP, buat tabel bisa scroll horizontal */
@media (max-width: 768px) {
  .invoice-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .invoice-table th,
  .invoice-table td {
    white-space: normal;
    word-break: break-word;
  }
}

/* Hilangkan background putih pada area kosong di sekitar tabel */
.content .invoice-table + *,
.invoice-table + div {
  background: transparent;
}

/* Perbaiki aksi tombol dalam tabel agar rapi */
.invoice-table td:last-child {
  display: table-cell;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .invoice-table td:last-child {
    white-space: normal;
  }
}

/* ========== JARAK ANTARA TOMBOL EDIT & HAPUS ========== */
.product-actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.edit-product,
.delete-product {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 40px;
  font-size: 0.8rem;
}

/* Pastikan di HP juga ada jarak */
@media (max-width: 768px) {
  .product-actions {
    gap: 12px;
  }
  .edit-product,
  .delete-product {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
}

/* Perbaikan tombol Edit & Hapus di HP */
@media (max-width: 768px) {
  .product-card {
    overflow: visible !important;
  }
  .product-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 12px;
  }
  .edit-product, .delete-product {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    padding: 8px 4px;
    font-size: 0.75rem;
  }
}

/* ========== PERBAIKAN TABEL INVOICE UNTUK HP ========== */
@media (max-width: 768px) {
  /* Buat tabel bisa di-scroll horizontal */
  .invoice-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Izinkan teks di sel tertentu untuk wrap */
  .invoice-table th,
  .invoice-table td {
    white-space: normal;
    word-break: break-word;
    min-width: 100px;
    padding: 10px 8px;
    font-size: 0.75rem;
  }
  
  /* Kolom aksi (tombol) biar wrap ke bawah */
  .invoice-table td:last-child {
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  
  /* Perkecil tombol aksi agar muat */
  .mark-paid, .mark-cancelled, .view-detail, .delete-invoice {
    padding: 4px 8px;
    font-size: 0.65rem;
    white-space: nowrap;
  }
  
  /* Filter status tidak memakan banyak tempat */
  #statusFilter {
    width: auto;
    display: inline-block;
    margin: 0 0 12px 0;
  }
}

/* ========== DESKTOP (LAPTOP/PC) - KOLOM PRODUK PROPORSIONAL ========== */
@media (min-width: 1025px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 24px !important;
  }
  
  .product-img {
    height: 160px;
  }
  
  .product-name {
    font-size: 1rem;
  }
  
  .product-price {
    font-size: 1.05rem;
  }
  
  .add-to-cart {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}

/* Untuk layar sangat lebar (≥ 1600px) bisa paksa 5 kolom */
@media (min-width: 1600px) {
  .products-grid {
    grid-template-columns: repeat(6, 1fr) !important;
  }
}

/* Mobile (lebar <= 768px) */
@media (max-width: 768px) {
  .pos-layout {
    display: block !important;
  }
  .products-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    margin-top: 16px;
  }
  /* Untuk HP yang lebih lebar (min-width 480px) bisa 3 kolom */
  @media (min-width: 480px) and (max-width: 768px) {
    .products-grid {
      grid-template-columns: repeat(3, 1fr) !important;
      gap: 14px !important;
    }
  }
  .cart-panel {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    max-height: 45vh;
    overflow-y: auto;
    padding: 12px;
  }
  .content {
    padding-bottom: 50vh;
  }
  /* Perbaiki card produk agar tidak terlalu besar */
  .product-img {
    height: 110px;
  }
  .product-info {
    padding: 10px;
  }
}

/* ========== IPAD LANDSCAPE - CARD RAPI & TEKS TERBACA ========== */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
  /* Ubah grid agar card memiliki lebar minimal 180px (tidak terlalu sempit) */
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 20px !important;
  }
  
  /* Tinggi gambar lebih proporsional */
  .product-img {
    height: 140px;
    object-fit: cover;
  }
  
  /* Teks tidak terpotong */
  .product-name {
    font-size: 0.9rem;
    white-space: normal;
    overflow: visible;
    line-height: 1.3;
  }
  
  .product-variant, .product-desc {
    font-size: 0.7rem;
    white-space: normal;
  }
  
  .product-price {
    font-size: 0.9rem;
    margin: 8px 0 10px;
  }
  
  .add-to-cart {
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  
  /* Pastikan card tidak terpotong */
  .product-card {
    overflow: visible;
  }
  
  .product-info {
    padding: 14px;
  }
}

/* Toggle keranjang */
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cart-header h3 {
  margin-bottom: 0;
}
.toggle-cart-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  padding: 4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.toggle-cart-btn:hover {
  background: var(--accent-light);
}
.cart-panel.minimized {
  padding-bottom: 12px;
}

.order-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border-radius: 24px;
  overflow: hidden;
}
.order-table th, .order-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.order-table th {
  background: #f8fafc;
  font-weight: 600;
}

/* ========== TABEL PESANAN MODERN & CLEAN ========== */
.order-table {
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 20px;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 2px 6px rgba(0, 0, 0, 0.02);
}

.order-table thead tr {
  background: #f9fafb;
}

.order-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.order-table td {
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: left;
}

.order-table tbody tr:last-child td {
  border-bottom: none;
}

.order-table tbody tr:hover {
  background: var(--accent-light);
  transition: background 0.15s ease;
}

/* Badge status di dalam tabel */
.order-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 40px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-production {
  background: #fff3e0;
  color: #b45f2b;
}

.status-ready {
  background: #e0f2fe;
  color: #0369a1;
}

.status-delivery {
  background: #dbeafe;
  color: #1e40af;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

/* Dropdown status */
.order-status-select {
  padding: 6px 12px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-family: 'Roboto', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.order-status-select:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Tombol aksi */
.order-table .btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.order-table .btn-icon:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.order-table td {
  vertical-align: top;
}
.order-table tbody tr:hover td {
  background-color: var(--accent-light);
}

/* ===== WARNA DROPDOWN STATUS PESANAN ===== */
.order-status-select {
  padding: 6px 12px;
  border-radius: 30px;
  border: 1px solid var(--border);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  min-width: 110px;
  text-align: center;
}

.order-status-select.status-production {
  background: #fff3e0;
  color: #b45f2b;
  border-color: #ffe0b3;
}

.order-status-select.status-ready {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #b8e1fc;
}

.order-status-select.status-delivery {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfd9fe;
}

.order-status-select.status-completed {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.order-status-select:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

/* Hover tetap nyaman */
.order-table tbody tr:hover {
  background-color: var(--accent-light);
}

/* ========== HILANGKAN GARIS ANTAR ITEM PADA INVOICE ========== */
/* Untuk invoice di POS preview */
.invoice-preview table td,
.invoice-preview .invoice-table td,
.invoice-preview table tr,
.invoice-preview .invoice-table tr {
  border-bottom: none !important;
}

/* Untuk invoice di modal detail */
#modalInvoiceContent table td,
#modalInvoiceContent .invoice-table td,
#modalInvoiceContent table tr,
#modalInvoiceContent .invoice-table tr {
  border-bottom: none !important;
}

/* Opsional: beri jarak antar baris agar tetap rapi */
#modalInvoiceContent table td,
.invoice-preview table td {
  padding: 8px 4px !important;
}

/* ========== TABEL PESANAN MODERN DENGAN GARIS ========== */
.order-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.order-table thead tr {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.order-table th {
  padding: 14px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.order-table td {
  padding: 12px 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

/* Hover pada baris */
.order-table tbody tr:hover {
  background: var(--accent-light);
  transition: background 0.2s;
}

/* Dropdown status */
.order-status-select {
  padding: 6px 12px;
  border-radius: 30px;
  border: 1px solid var(--border);
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-secondary);
  min-width: 110px;
  text-align: center;
}

.order-status-select.status-production { background: #fff3e0; color: #b45f2b; border-color: #ffe0b3; }
.order-status-select.status-ready { background: #e0f2fe; color: #0369a1; border-color: #b8e1fc; }
.order-status-select.status-delivery { background: #dbeafe; color: #1e40af; border-color: #bfd9fe; }
.order-status-select.status-completed { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }

/* Tombol aksi */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
}

.btn-icon:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.order-table th:nth-child(1), /* Tanggal */
.order-table td:nth-child(1) {
  white-space: nowrap;
  width: 1%;
  text-align: center;
  vertical-align: middle;
}
.order-table th:nth-child(2), /* Pelanggan */
.order-table td:nth-child(2) {
  white-space: nowrap;
  width: 1%;
}
.order-table th:nth-child(3), /* Produk */
.order-table td:nth-child(3) {
  text-align: left !important;
  white-space: normal !important;
  word-break: break-word;
}
.order-table th:nth-child(4), /* Qty */
.order-table td:nth-child(4) {
  white-space: nowrap;
  width: 1%;
  text-align: center;
}
.order-table th:nth-child(5), /* Status */
.order-table td:nth-child(5) {
  white-space: nowrap;
  width: 1%;
}
.order-table th:nth-child(6), /* Aksi */
.order-table td:nth-child(6) {
  white-space: nowrap;
  width: 1%;
}

/* Responsif HP */
@media (max-width: 768px) {
  .order-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .order-table th,
  .order-table td {
    white-space: normal;
    min-width: 120px;
  }
  .order-table th:nth-child(3),
  .order-table td:nth-child(3) {
    min-width: 200px;
    width: auto;
  }
}

/* Pastikan kolom pesanan rata kiri dan teks bisa wrap */
.order-table td:nth-child(3) {
  text-align: left !important;
  white-space: normal !important;
  word-break: break-word;
}

/* Responsif untuk HP */
@media (max-width: 768px) {
  .order-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .order-table th,
  .order-table td {
    white-space: normal;
    min-width: 120px;
    padding: 10px 12px;
    font-size: 0.75rem;
  }
  .order-status-select {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
}

/* ========== PERBAIKAN: KERANJANG STICKY DI DESKTOP ========== */
@media (min-width: 1025px) {
  /* Pastikan keranjang sticky meskipun ada toggle */
  .cart-panel {
    position: sticky !important;
    top: 24px;
    align-self: start;
  }
  /* Saat minimized, tetap sticky */
  .cart-panel.minimized {
    position: sticky !important;
    top: 24px;
  }
  /* Pastikan body cart tidak merusak sticky */
  .cart-body {
    display: block; /* atau sesuai, tidak mengganggu */
  }
}

/* ========== UNTUK MOBILE & TABLET: KERANJANG FIXED DI BAWAH ========== */
@media (max-width: 1024px) {
  .cart-panel {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    max-height: 45vh;
    overflow-y: auto;
    padding: 16px;
  }
  .content {
    padding-bottom: 50vh;
  }
  /* Saat minimized di mobile, tetap fixed di bawah */
  .cart-panel.minimized {
    position: fixed !important;
    bottom: 0;
  }
}

@media (min-width: 1025px) {
  .pos-layout {
    grid-template-columns: 1fr 360px !important;
  }
}

@media (min-width: 1025px) {
  /* Susun semua baris biaya secara vertikal */
  .cart-panel .extra-fees {
    flex-direction: column;
    gap: 12px;
  }
  /* Setiap baris (label + input) memenuhi lebar panel */
  .cart-panel .fee-row {
    width: 100%;
    justify-content: space-between;
  }
  /* Input rata kanan dengan lebar yang pas */
  .cart-panel .fee-row input {
    width: 150px;
    text-align: right;
  }
} 

/* ========== MODAL DETAIL INVOICE SAMA PERSIS DENGAN PREVIEW POS ========== */
#modalInvoiceContent {
  background: #ffffff;
  padding: 24px;
  border-radius: 24px;
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  font-family: 'Roboto', sans-serif;
}

/* Tabel di dalam modal harus display TABLE (bukan block) agar kolom bisa diatur */
#modalInvoiceContent .invoice-table,
#modalInvoiceContent table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 24px;
  margin-top: 20px;
  display: table; /* Kunci: agar perataan teks bekerja */
}

#modalInvoiceContent .invoice-table th,
#modalInvoiceContent .invoice-table td,
#modalInvoiceContent table th,
#modalInvoiceContent table td {
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

/* Harga produk rata kanan (paksa dengan !important) */
#modalInvoiceContent table td:last-child,
#modalInvoiceContent .invoice-table td:last-child {
  text-align: right !important;
}

/* Nama produk rata kiri */
#modalInvoiceContent table td:first-child,
#modalInvoiceContent .invoice-table td:first-child {
  text-align: left !important;
}

/* Status badge */
#modalInvoiceContent .status-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 40px;
  font-size: 0.7rem;
  font-weight: 600;
}
#modalInvoiceContent .status-unpaid {
  background: #fef3c7;
  color: #b45309;
}
#modalInvoiceContent .status-paid {
  background: #d1fae5;
  color: #065f46;
}
#modalInvoiceContent .status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Elemen lain (judul, hr, total, dll) */
#modalInvoiceContent h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #0C2F6E;
}
#modalInvoiceContent hr {
  margin: 16px 0;
  border: none;
  border-top: 1px solid #e2e8f0;
}
#modalInvoiceContent .total-line {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
}
#modalInvoiceContent .grand-total {
  font-weight: bold;
  font-size: 1.1rem;
  border-top: 1px solid #ccc;
  padding-top: 8px;
  margin-top: 8px;
}
#modalInvoiceContent ul {
  margin-left: 20px;
  padding-left: 0;
}

/* Perbaiki tombol Edit/Hapus agar tidak meluber dari kartu */
.product-actions {
  flex-wrap: wrap;          /* izinkan tombol turun ke baris baru */
  gap: 8px;
}

.edit-product,
.delete-product {
  flex: 0 1 auto;           /* jangan dipaksa memenuhi lebar */
  padding: 6px 12px;
  font-size: 0.75rem;
  white-space: nowrap;      /* teks tidak pecah */
}

/* Untuk layar kecil, sedikit lebih ringkas */
@media (max-width: 480px) {
  .edit-product,
  .delete-product {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
}