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

/* Force light mode for the whole app so datalist/autocomplete dropdowns
   always show black text on white background, regardless of system dark mode */
:root, html, body { color-scheme: light; }

:root {
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
  --shadow-md: 0 6px 28px rgba(0,0,0,0.12);

  --billing-bg: #fffbf5;
  --billing-accent: #c0714a;
  --billing-light: #fdf0e6;
  --billing-border: #f0d9c8;

  --products-bg: #f5fbf5;
  --products-accent: #3a7d44;
  --products-light: #e8f5ea;
  --products-border: #c8e6cc;

  --analytics-bg: #f3f8ff;
  --analytics-accent: #2563b0;
  --analytics-light: #deeeff;
  --analytics-border: #bdd7f5;

  --pending-bg: #fff5f5;
  --pending-accent: #c0392b;
  --pending-light: #fde8e8;
  --pending-border: #f5c6c6;

  --stock-bg: #f5f3ff;
  --stock-accent: #6d28d9;
  --stock-light: #ede9fe;
  --stock-border: #c4b5fd;
}

body {
  font-family: var(--font-body);
  background: #f0ebe4;
  color: #1a1209;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
}

/* ── NAVBAR ── */
.navbar {
  background: #fff;
  border-bottom: 1px solid #ede8e3;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 10px rgba(0,0,0,0.07);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-icon { font-size: 24px; }
.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: #2d1f1a;
  display: block;
  line-height: 1.2;
}
.brand-name strong { color: #c0714a; }
.brand-gst { font-size: 10px; color: #a0826d; letter-spacing: 0.3px; display: block; }

.nav-tabs { display: flex; gap: 4px; }
.tab-btn {
  padding: 7px 16px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  background: transparent;
  color: #7a6a60;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.tab-btn:hover { background: #f5f0eb; color: #2d1f1a; transform: translateY(-1px); }
.tab-btn:active { transform: scale(0.95); }

.tab-btn.active[data-tab="billing"]   { background: var(--billing-light); border-color: var(--billing-border); color: var(--billing-accent); box-shadow: 0 3px 10px rgba(192,113,74,0.18); transform: translateY(-2px); }
.tab-btn.active[data-tab="products"]  { background: var(--products-light); border-color: var(--products-border); color: var(--products-accent); box-shadow: 0 3px 10px rgba(58,125,68,0.18); transform: translateY(-2px); }
.tab-btn.active[data-tab="analytics"] { background: var(--analytics-light); border-color: var(--analytics-border); color: var(--analytics-accent); box-shadow: 0 3px 10px rgba(37,99,176,0.18); transform: translateY(-2px); }
.tab-btn.active[data-tab="pending"]   { background: var(--pending-light); border-color: var(--pending-border); color: var(--pending-accent); box-shadow: 0 3px 10px rgba(192,57,43,0.18); transform: translateY(-2px); }
.tab-btn.active[data-tab="stock"]    { background: var(--stock-light); border-color: var(--stock-border); color: var(--stock-accent); box-shadow: 0 3px 10px rgba(109,40,217,0.18); transform: translateY(-2px); }

.pending-badge { background: #e24b4a; color: white; font-size: 9px; border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center; }

.logout-btn {
  padding: 7px 16px;
  border: 1px solid #e0d5cc;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #7a6a60;
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
}
.logout-btn:hover { background: #fff0e8; color: #c0714a; border-color: #c0714a; }

/* ── PAGES ── */
.page-container { padding: 20px; }
.page { display: none; animation: pageEnter 0.3s ease; }
.page.active { display: block; }
@keyframes pageEnter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

#page-billing  { background: var(--billing-bg); border-radius: var(--radius); padding: 18px; }
#page-products { background: var(--products-bg); border-radius: var(--radius); padding: 18px; }
#page-analytics{ background: var(--analytics-bg); border-radius: var(--radius); padding: 18px; }
#page-pending  { background: var(--pending-bg); border-radius: var(--radius); padding: 18px; }
#page-stock    { background: var(--stock-bg); border-radius: var(--radius); padding: 18px; }

/* ── LAYOUT ── */
.billing-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; }
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── PANELS ── */
.panel, .left-panel, .right-panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.05);
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: #1a1209;
  margin-bottom: 16px;
}
.item-count { font-size: 11px; color: #a0826d; }

/* ── CUSTOMER TYPE TOGGLE ── */
.ctype-toggle { display: flex; border: 1.5px solid #e0d5cc; border-radius: 8px; overflow: hidden; }
.ctype-btn {
  padding: 4px 12px; font-size: 11px; font-weight: 600; font-family: var(--font-body);
  border: none; cursor: pointer; background: transparent; color: #7a6a60;
  transition: all 0.15s;
}
.ctype-btn.active { background: #c0714a; color: white; }

/* ── FORMS ── */
.form-group { margin-bottom: 12px; }
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #7a6a60;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input, .search-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #e0d5cc;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: #1a1209;
  background: #fdfaf8;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  color-scheme: light;  /* forces datalist/autocomplete dropdown to render in light mode */
}
.form-input:focus, .search-input:focus { border-color: #c0714a; box-shadow: 0 0 0 3px rgba(192,113,74,0.12); background: #fff; }
.search-input { margin-bottom: 14px; }
.two-col-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── CUSTOM AUTOCOMPLETE DROPDOWN (replaces native datalist) ── */
.ac-wrap { position: relative; }
.custom-ac-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: #ffffff !important;
  border: 1.5px solid #c0714a;
  border-radius: 8px;
  z-index: 9999;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  display: none;
}
.ac-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #1a1209 !important;
  background: #ffffff !important;
  border-bottom: 1px solid #f0ebe3;
  font-family: var(--font-body);
  transition: background 0.12s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item:active { background: #fdf0e6 !important; color: #c0714a !important; font-weight: 600; }

/* ── PRICE BANNER ── */
.price-banner { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; background: linear-gradient(135deg,#fff9f5,#f5fbf5); border-radius: var(--radius-sm); padding: 12px; border: 1px solid #e8e0da; }
.price-vs { font-size: 11px; color: #a0826d; font-weight: 600; margin-top: 20px; flex-shrink: 0; }
.ptag { display: inline-block; padding: 1px 7px; border-radius: 8px; font-size: 10px; font-weight: 600; margin-left: 4px; }
.ptag.retail { background: #fff0e8; color: #c0714a; }
.ptag.wholesale { background: #e8f5ea; color: #3a7d44; }

/* ── GST SELECTOR ── */
.gst-selector-card {
  background: #fdf5ef;
  border: 1.5px solid #f0ddd0;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 4px;
}
.gst-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0; }
.gst-label { font-size: 13px; font-weight: 600; color: #2d1f1a; }
.gst-display { font-size: 12px; color: #c0714a; font-weight: 600; }
.gst-opts-row { display: flex; gap: 6px; margin-top: 10px; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ddd; border-radius: 24px;
  transition: 0.25s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: #c0714a; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }
.gst-opt {
  flex: 1; padding: 7px 4px;
  border: 1.5px solid #e0d5cc;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; font-family: var(--font-body);
  cursor: pointer; background: #fff; color: #7a6a60;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.gst-opt:hover { background: #f5f0eb; transform: translateY(-1px); }
.gst-opt.active { background: #c0714a; border-color: #c0714a; color: white; font-weight: 600; transform: translateY(-2px); box-shadow: 0 3px 8px rgba(192,113,74,0.3); }

/* ── PRODUCT GRID ── */
.product-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding-right: 4px;
}
.brand-section { }
.brand-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #5a4a40;
  background: linear-gradient(90deg, #fdf0e6, transparent);
  padding: 5px 10px;
  border-radius: 6px;
  border-left: 3px solid #c0714a;
  margin-bottom: 8px;
}
.brand-count { font-size: 10px; color: #b0a098; font-weight: 500; text-transform: none; letter-spacing: 0; }
.brand-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 8px;
}
.product-card {
  background: #fdfaf8;
  border: 1.5px solid #ede5dc;
  border-radius: var(--radius);
  padding: 12px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.product-card:hover { border-color: #c0714a; background: #fff5ef; transform: translateY(-4px); box-shadow: 0 6px 16px rgba(192,113,74,0.2); }
.product-card:active { transform: scale(0.96); }
.pc-emoji { font-size: 26px; margin-bottom: 5px; display: block; }
.pc-brand { font-size: 9px; color: #a0826d; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.pc-name { font-size: 12px; font-weight: 700; color: #1a1209; margin-bottom: 3px; line-height: 1.3; }
.pc-variant { font-size: 10px; color: #a0826d; margin-bottom: 4px; font-style: italic; }
.pc-price { font-size: 13px; color: #c0714a; font-weight: 700; }
.pc-stock { font-size: 10px; color: #b0a098; margin-top: 2px; }

/* ── CART ── */
.cart-items-wrap { min-height: 100px; max-height: 170px; overflow-y: auto; border-top: 1px solid #ede5dc; border-bottom: 1px solid #ede5dc; padding: 6px 0; margin: 8px 0; }
.cart-empty { text-align: center; color: #b0a098; font-size: 12px; padding: 24px 0; font-style: italic; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f5f0eb; }
.ci-name { flex: 1; font-size: 11px; font-weight: 600; color: #1a1209; }
.ci-qty { display: flex; align-items: center; gap: 4px; }
.qty-btn { width: 26px; height: 26px; border: 1px solid #e0d5cc; border-radius: 6px; background: #f5f0eb; cursor: pointer; font-size: 15px; color: #2d1f1a; display: flex; align-items: center; justify-content: center; transition: background 0.15s; flex-shrink:0; }
.qty-btn:hover { background: #ede5de; }
.qty-num { font-size: 12px; min-width: 18px; text-align: center; font-weight: 700; }
.qty-input {
  width: 46px; height: 26px;
  border: 1.5px solid #c0714a; border-radius: 6px;
  text-align: center; font-size: 13px; font-weight: 700;
  color: #2d1f1a; background: #fff;
  -moz-appearance: textfield;
  font-family: var(--font-body);
  padding: 0;
}
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { outline: none; border-color: #a05a30; box-shadow: 0 0 0 2px rgba(192,113,74,0.15); }
.ci-price { font-size: 12px; font-weight: 600; min-width: 60px; text-align: right; color: #1a1209; }
.ci-remove { color: #c0a090; cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; transition: color 0.15s; }
.ci-remove:hover { color: #c0392b; }

/* ── TOTALS ── */
.totals-box { font-size: 13px; padding: 4px 0; }
.total-row { display: flex; justify-content: space-between; padding: 4px 0; color: #7a6a60; }
.total-row.grand { font-size: 16px; font-weight: 700; color: #1a1209; border-top: 2px solid #ede5dc; padding-top: 8px; margin-top: 4px; font-family: var(--font-display); }

/* ── PAYMENT ── */
.payment-box { background: #fdf5ef; border: 1.5px solid #f0ddd0; border-radius: var(--radius-sm); padding: 12px; margin: 8px 0; }
.payment-title { font-size: 11px; font-weight: 700; color: #5a4a40; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.pay-opts-row { display: flex; gap: 6px; }
.pay-opt { flex: 1; padding: 8px 4px; border: 1.5px solid #e0d5cc; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; font-family: var(--font-body); cursor: pointer; background: #fff; color: #7a6a60; text-align: center; transition: all 0.15s; }
.pay-opt:hover { background: #f5f0eb; }
.pay-opt.active { background: #fff5ef; border-color: #c0714a; color: #c0714a; font-weight: 700; }

/* ── BUTTONS ── */
.primary-btn {
  width: 100%; padding: 12px;
  background: #c0714a; color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
}
.primary-btn:hover { background: #a85c39; }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { background: #d4c5bc; color: #9a8a80; cursor: not-allowed; }

.secondary-btn { padding: 12px 20px; background: #f5f0eb; color: #5a4a40; border: 1px solid #e0d5cc; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; font-family: var(--font-body); cursor: pointer; transition: background 0.15s; }
.secondary-btn:hover { background: #ede5de; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; max-height: 360px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 10px; font-size: 10px; font-weight: 700; color: #7a6a60; border-bottom: 2px solid #ede5dc; background: #fdfaf8; text-transform: uppercase; letter-spacing: 0.4px; }
.data-table td { padding: 10px 10px; border-bottom: 1px solid #f5f0eb; color: #1a1209; vertical-align: middle; }
.data-table tr:hover td { background: #fdf5ef; }
.empty-cell { text-align: center; color: #b0a098; padding: 32px; font-size: 13px; font-style: italic; }

.del-btn { background: none; border: none; color: #c0a090; cursor: pointer; font-size: 13px; padding: 3px 8px; border-radius: 4px; transition: all 0.15s; }
.del-btn:hover { background: #fde8e8; color: #c0392b; }
.edit-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 3px 8px; border-radius: 4px; transition: all 0.15s; opacity: 0.7; }
.edit-btn:hover { background: #fff3e0; opacity: 1; }

/* ── PILLS ── */
.pill { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill-paid    { background: #e8f5ea; color: #2e7d32; }
.pill-partial { background: #fff8e1; color: #f57f17; }
.pill-pending { background: #fde8e8; color: #c0392b; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 4px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid rgba(0,0,0,0.05); }
.stat-card.revenue  { border-left: 4px solid #c0714a; }
.stat-card.collected { border-left: 4px solid #3a7d44; }
.stat-card.bills-stat { border-left: 4px solid #2563b0; }
.stat-card.pending-stat { border-left: 4px solid #c0392b; }
.stat-label { font-size: 11px; font-weight: 700; color: #7a6a60; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-val { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: #1a1209; }
.stat-val.danger { color: #c0392b; }
.stat-sub { font-size: 11px; color: #b0a098; margin-top: 3px; }

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

/* ── CHART BARS ── */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { font-size: 12px; color: #5a4a40; min-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: #f5f0eb; border-radius: 4px; height: 10px; }
.bar-fill { height: 10px; border-radius: 4px; background: #c0714a; transition: width 0.5s ease; }
.bar-val { font-size: 11px; color: #a0826d; min-width: 50px; text-align: right; }

/* ── PENDING ── */
.pending-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 18px; }
.customer-card { background: #fff; border-radius: var(--radius); border: 1px solid #f0ddd0; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.cust-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.cust-name-el { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: #1a1209; }
.cust-phone-el { font-size: 12px; color: #a0826d; margin-top: 2px; }
.cust-total-pending { text-align: right; }
.pending-amt-big { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: #c0392b; }
.pending-amt-label { font-size: 10px; color: #a0826d; text-transform: uppercase; letter-spacing: 0.4px; }

.cust-bills-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 14px; }
.cust-bills-table th { text-align: left; padding: 7px 8px; font-size: 10px; font-weight: 700; color: #9a8a80; border-bottom: 1px solid #f5f0eb; text-transform: uppercase; }
.cust-bills-table td { padding: 8px 8px; border-bottom: 1px solid #f5f0eb; color: #1a1209; }

.record-payment-row { display: flex; gap: 8px; align-items: flex-end; background: #f5fbf5; border: 1.5px solid #c8e6cc; border-radius: var(--radius-sm); padding: 12px; }
.record-payment-row .form-group { flex: 1; margin: 0; }
.record-payment-row label { color: #3a7d44; }
.record-btn { padding: 10px 18px; background: #3a7d44; color: white; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; font-family: var(--font-body); cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.record-btn:hover { background: #2e6636; }
/* Slim inputs inside the payment modal */
#pay-modal .form-input { padding: 7px 11px; font-size: 13px; }
#pay-modal .form-group { margin-bottom: 10px; }
#pay-modal label { margin-bottom: 4px; }
.no-pending { text-align: center; padding: 60px 20px; color: #b0a098; font-size: 14px; }
.no-pending .np-icon { font-size: 52px; margin-bottom: 12px; }

/* ── TOAST ── */
.success-toast { background: #e8f5ea; color: #2e7d32; border: 1px solid #c8e6cc; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 12px; display: none; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ── MODAL ── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; animation: fadeIn 0.2s ease; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 26px; max-width: 460px; width: 92%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); animation: slideUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .primary-btn { flex: 1; }
.modal-actions .secondary-btn { min-width: 80px; width: auto; }

/* ── BILL PRINT ── */
.bill-header { text-align: center; margin-bottom: 14px; }
.bill-shop-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: #7c3b1e; }
.bill-shop-sub { font-size: 12px; color: #7a6a60; margin-top: 3px; }
.bill-shop-meta { font-size: 11px; color: #9a8a80; margin-top: 3px; }
.bill-divider { border: none; border-top: 1px solid #ede5dc; margin: 10px 0; }
.bill-divider.dashed { border-top-style: dashed; }
.bill-meta-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; color: #2d1f1a; }
.bill-items-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.bill-items-table th { text-align: left; padding: 5px 4px; border-bottom: 1px solid #ede5dc; font-size: 10px; color: #9a8a80; text-transform: uppercase; }
.bill-items-table td { padding: 5px 4px; border-bottom: 1px solid #f5f0eb; }
.bill-total-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12px; color: #7a6a60; }
.bill-total-row.grand { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: #1a1209; }
.bill-total-row.paid { color: #2e7d32; font-weight: 600; }
.bill-total-row.due { color: #c0392b; font-weight: 700; font-size: 13px; }
.bill-footer { text-align: center; font-size: 11px; color: #a0826d; margin-top: 12px; line-height: 1.7; font-style: italic; }

/* ── CUSTOMER HISTORY ── */
.cust-history-card { background: #fff; border-radius: var(--radius); border: 1px solid #bdd7f5; padding: 16px; }
.cust-history-name { font-family: var(--font-display); font-size: 15px; color: #1a1209; margin-bottom: 10px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 40px 20px; color: #b0a098; font-size: 13px; }
.empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4c5bc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b0a098; }

/* ── PRINT ── */
@media print {
  body * { visibility: hidden; }
  #bill-print-area, #bill-print-area * { visibility: visible; }
  #bill-print-area { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); width: 380px; }
}

/* ── PENDING COLLAPSIBLE ── */
.cust-card-header:hover { background: #fdf5ef; border-radius: 10px; }
.pending-toggle-icon {
  font-size: 13px; color: #b0a098; transition: transform 0.2s;
  min-width: 20px; text-align: center;
}
.pending-bills-section { border-top: 1px solid #f5f0eb; margin-top: 10px; padding-top: 10px; }

/* ── STOCK PAGE ── */
/* Sub-tabs (Inventory / Purchase Orders) */
.stock-subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: #f5f0eb;
  padding: 5px;
  border-radius: 12px;
  width: fit-content;
}
.stock-subtab {
  padding: 8px 22px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: #7a6a60;
  cursor: pointer;
  transition: all 0.18s;
}
.stock-subtab:hover  { background: rgba(255,255,255,0.7); color: #3d2b1f; }
.stock-subtab.active { background: #fff; color: var(--stock-accent); box-shadow: 0 1px 6px rgba(0,0,0,0.10); }

/* Inventory brand sections */
.stock-brand-section { margin-bottom: 22px; }
.stock-brand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: linear-gradient(90deg, var(--stock-light), #f9f7ff);
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 3px solid var(--stock-accent);
}
.stock-brand-name { font-size: 13px; font-weight: 700; color: var(--stock-accent); }
.stock-brand-meta  { font-size: 11px; color: #7a6a60; }

/* Purchase Orders — supplier sections */
.po-supplier-section { margin-bottom: 24px; }
.po-supplier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(90deg, #fdf3e7, #fff8f0);
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 3px solid #c0714a;
  flex-wrap: wrap;
  gap: 6px;
}
.po-supplier-name { font-size: 14px; font-weight: 700; color: #7c3b1e; }
.po-supplier-meta { font-size: 12px; color: #7a6a60; }

/* PO status pill */
.po-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* PO form styles */
.po-total-preview {
  padding: 10px 14px;
  background: #f0faf2;
  border-radius: 8px;
  font-size: 14px;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}
.po-pay-badge {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #fde8e8;
  color: #c0392b;
  border: 1px solid #f5c6c6;
}
.po-info-box {
  padding: 14px;
  background: #fdf6ef;
  border-radius: 10px;
  border: 1px solid #f0d9c8;
  font-size: 13px;
  line-height: 1.7;
}

/* icon-btn reuse */
.icon-btn {
  background: none;
  border: 1px solid #e8e0d8;
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.icon-btn:hover { background: #f5f0eb; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .billing-grid, .two-col-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .pending-summary { grid-template-columns: 1fr 1fr; }
}
