/* Tyre ERP - Custom Styles */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Layout ===== */
#app { min-height: 100vh; }

.app-shell { display: flex; min-height: 100vh; }
.shell-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.main-content { flex: 1; overflow-y: auto; padding-bottom: 80px; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: #fff; border-top: 1px solid #e5e7eb;
  display: flex; align-items: stretch;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 8px 4px; font-size: 10px; color: #6b7280;
  text-decoration: none; transition: color 0.15s;
}
.bottom-nav a.active { color: #1e40af; }
.bottom-nav a i { font-size: 20px; margin-bottom: 2px; }

/* ===== Top Bar ===== */
.top-bar {
  background: #1e40af; color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
}
.top-bar h1 { font-size: 18px; font-weight: 700; }

/* ===== Cards ===== */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.card-compact { padding: 12px 16px; }
.card-body { padding: 16px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 15px; color: #111827; background: #fff; outline: none; transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-control:focus { border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
.form-control.error { border-color: #ef4444; }
select.form-control { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e"); background-position: right 10px center; background-repeat: no-repeat; background-size: 16px; padding-right: 36px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.15s; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: #1e40af; color: #fff; }
.btn-primary:hover { background: #1e3a8a; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 17px; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-yellow { background: #fef9c3; color: #ca8a04; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-orange { background: #ffedd5; color: #ea580c; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #f8fafc; padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; color: #1e293b; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ===== List Items ===== */
.list-item { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; gap: 12px; }
.list-item:last-child { border-bottom: none; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-overlay.center { align-items: center; }
.modal-box {
  background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-height: 92vh;
  overflow-y: auto; padding: 20px; animation: slideUp 0.25s ease;
}
.modal-overlay.center .modal-box { border-radius: 12px; max-width: 480px; margin: 16px; max-height: calc(100vh - 32px); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 700; color: #111827; }
.modal-close { background: none; border: none; font-size: 22px; color: #6b7280; cursor: pointer; padding: 4px; }

/* ===== Search ===== */
.search-box { position: relative; }
.search-box input { padding-left: 38px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; }

/* ===== Stats ===== */
.stat-card { padding: 16px; border-radius: 12px; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 13px; font-weight: 500; margin-top: 4px; opacity: 0.8; }

/* ===== Sale Items (legacy) ===== */
.sale-item-row { background: #f8fafc; border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.sale-item-row:last-child { margin-bottom: 0; }

/* ===== New Sale Modal Layout ===== */

/* Top bar: customer row + location/date row */
.ns-top-bar { margin-bottom: 10px; }
.ns-customer-wrap { position: relative; margin-bottom: 8px; }
.ns-walkin-btn { flex-shrink: 0; }
.ns-loc-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Dropdowns (customer results / product results) */
.ns-dropdown {
  position: absolute; left: 0; right: 0; z-index: 50;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); max-height: 220px; overflow-y: auto;
}
.ns-product-dropdown { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; }

.ns-cust-result-item, .ns-prod-result-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; gap: 10px;
  transition: background 0.1s;
}
.ns-cust-result-item:last-child, .ns-prod-result-item:last-child { border-bottom: none; }
.ns-cust-result-item:hover, .ns-cust-result-item:focus,
.ns-prod-result-item:hover, .ns-prod-result-item:focus { background: #eff6ff; outline: none; }

.ns-no-result { padding: 12px 14px; font-size: 13px; color: #9ca3af; }

/* Customer selected chip */
.ns-customer-chip {
  display: flex; align-items: center; gap: 6px;
  background: #dbeafe; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 8px 12px; margin-top: 6px; font-size: 14px; color: #1e3a8a;
}

/* Product search bar (always-visible, prominent) */
.ns-product-bar { position: relative; margin-bottom: 8px; }
.ns-product-input { font-size: 15px !important; padding-left: 40px !important; border: 2px solid #1e40af !important; }
.ns-product-input:focus { border-color: #1d4ed8 !important; box-shadow: 0 0 0 3px rgba(29,78,216,0.15) !important; }

/* Stock badge in product results */
.ns-stock-badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.ns-stock-ok   { background: #dcfce7; color: #166534; }
.ns-stock-low  { background: #fef3c7; color: #92400e; }
.ns-stock-zero { background: #fee2e2; color: #991b1b; }

/* Line-item table */
.ns-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 8px; }
.ns-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ns-items-table thead { background: #f8fafc; }
.ns-items-table th { padding: 8px 6px; font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.ns-th-product { width: 35%; text-align: left; padding-left: 10px; }
.ns-th-num    { width: 16%; text-align: center; }
.ns-th-total  { width: 17%; text-align: right; }
.ns-th-del    { width: 6%;  text-align: center; }

.ns-item-row { border-bottom: 1px solid #f1f5f9; transition: background 0.15s; }
.ns-item-row:last-child { border-bottom: none; }
.ns-item-row:hover { background: #fafbff; }
.ns-row-highlight { background: #fef9c3 !important; }

.ns-td-product { padding: 8px 6px 8px 10px; vertical-align: top; }
.ns-td-num     { padding: 6px 4px; text-align: center; vertical-align: middle; }
.ns-td-total   { padding: 8px 8px 8px 4px; text-align: right; vertical-align: middle; font-weight: 700; font-size: 13px; color: #1e40af; white-space: nowrap; }
.ns-td-del     { padding: 6px 6px; text-align: center; vertical-align: middle; }

.ns-cell-input {
  width: 100%; border: 1px solid #e5e7eb; border-radius: 6px; padding: 5px 4px;
  font-size: 13px; text-align: center; background: #fff; color: #111827;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
.ns-cell-input::-webkit-outer-spin-button,
.ns-cell-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ns-cell-input:focus { border-color: #1e40af; box-shadow: 0 0 0 2px rgba(30,64,175,0.15); outline: none; }

.ns-empty-cell {
  padding: 32px 12px; text-align: center; color: #9ca3af; font-size: 14px; line-height: 1.8;
}

.ns-del-btn {
  background: none; border: none; color: #d1d5db; font-size: 13px; cursor: pointer;
  padding: 6px; border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.ns-del-btn:hover { color: #ef4444; background: #fee2e2; }

/* Summary footer (sticky at bottom of modal scroll area) */
.ns-summary-footer {
  background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 14px 16px; position: sticky; bottom: 0;
}
.ns-summary-grid {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-bottom: 10px;
}
.ns-summary-total {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; border-top: 2px solid #e5e7eb;
}

/* ===== Loading ===== */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-dark { border: 2px solid #e5e7eb; border-top-color: #1e40af; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Section ===== */
.section-header { padding: 12px 16px 6px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7280; }

/* ===== Login ===== */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-title { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.login-sub { font-size: 15px; color: rgba(255,255,255,0.7); margin-bottom: 32px; }
.login-card { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }

/* ===== Tabs ===== */
.tab-bar { display: flex; border-bottom: 2px solid #e5e7eb; margin-bottom: 16px; overflow-x: auto; gap: 0; -webkit-overflow-scrolling: touch; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 600; color: #6b7280; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tab.active { color: #1e40af; border-bottom-color: #1e40af; }

/* ===== Number formatting ===== */
.amount { font-family: 'SF Mono', 'Courier New', monospace; font-weight: 700; }
.amount-positive { color: #16a34a; }
.amount-negative { color: #dc2626; }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 48px 24px; color: #9ca3af; }
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 16px; }

/* ===== Floating Action Button ===== */
.fab { position: fixed; bottom: 88px; right: 20px; width: 56px; height: 56px; border-radius: 28px; background: #1e40af; color: #fff; border: none; box-shadow: 0 4px 16px rgba(30,64,175,0.4); font-size: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 45; transition: all 0.2s; }
.fab:active { transform: scale(0.93); }

/* ===== Desktop Sidebar Layout ===== */
/* App shell on desktop: sidebar + content column */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar — desktop only */
.sidebar {
  display: none; /* hidden on mobile */
}

/* Mobile: content takes full width */
.shell-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  /* Show sidebar, hide bottom nav */
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 220px;
    flex-shrink: 0;
    background: #1e3a8a;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }

  .bottom-nav { display: none !important; }
  .fab { display: none !important; }

  .main-content {
    padding-bottom: 24px;
    max-width: none;
  }

  .modal-overlay { align-items: center; }
  .modal-box { border-radius: 16px; max-width: 720px; margin: 16px auto; max-height: calc(100vh - 32px); }

  /* Top bar on desktop: no need for sticky since sidebar handles nav */
  .top-bar { position: sticky; top: 0; z-index: 40; }
}

/* Sidebar internals */
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-logo-title {
  font-size: 17px; font-weight: 800; color: #fff; line-height: 1.2;
}
.sidebar-logo-sub {
  font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sidebar-nav a.active {
  background: rgba(255,255,255,0.13);
  color: #fff;
  border-left-color: #60a5fa;
  font-weight: 700;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 8px 18px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}
.sidebar-footer .sidebar-user {
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  margin-bottom: 6px;
}
.sidebar-logout-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}
.sidebar-logout-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ===== Dashboard Specific ===== */
.dash-action-bar {
  display: flex;
  gap: 12px;
  padding: 20px 20px 4px;
  flex-wrap: wrap;
}
.dash-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  white-space: nowrap;
  min-height: 52px;
}
.dash-action-btn:active { transform: scale(0.97); }
.dash-action-btn i { font-size: 18px; }
.dash-btn-sale { background: #1e40af; color: #fff; }
.dash-btn-sale:hover { background: #1e3a8a; }
.dash-btn-payment { background: #16a34a; color: #fff; }
.dash-btn-payment:hover { background: #15803d; }

.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 16px 20px;
}
.dash-stat {
  background: #fff;
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  border-left: 5px solid transparent;
}
.dash-stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.dash-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-stat-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}
.dash-stat-blue   { border-left-color: #1e40af; }
.dash-stat-orange { border-left-color: #f59e0b; }
.dash-stat-red    { border-left-color: #ef4444; }
.dash-stat-green  { border-left-color: #16a34a; }

/* Dashboard tables */
.dash-section {
  padding: 0 20px 20px;
}
.dash-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.dash-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.dash-section-link {
  font-size: 13px;
  color: #1e40af;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.dash-table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  overflow: hidden;
}
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.dash-table th {
  background: #f8fafc;
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid #f1f5f9;
}
.dash-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr { cursor: default; }
.dash-table tr.clickable { cursor: pointer; }
.dash-table tr.clickable:hover td { background: #f0f7ff; }

/* Critical stock row */
.dash-table tr.stock-critical td { background: #fff5f5; color: #991b1b; }
.dash-table tr.stock-critical:hover td { background: #fee2e2; }
.dash-table tr.stock-low td { background: #fffbeb; }

.dash-empty {
  text-align: center;
  padding: 32px 16px;
  color: #94a3b8;
  font-size: 14px;
}

/* Mobile responsive for stat cards */
@media (max-width: 899px) {
  .dash-stats-row { grid-template-columns: repeat(2, 1fr); padding: 12px 16px; gap: 10px; }
  .dash-stat-value { font-size: 20px; }
  .dash-action-bar { padding: 16px 16px 4px; gap: 10px; }
  .dash-action-btn { padding: 12px 16px; font-size: 15px; flex: 1; justify-content: center; }
  .dash-section { padding: 0 12px 16px; }
}

/* ===== Responsive (legacy mobile tweaks) ===== */
@media (max-width: 899px) {
  .main-content { padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom))); }
}

/* ===== Analytics ===== */
.an-chart-toggle.active { background: #1e40af !important; color: #fff !important; }
canvas { display: block; }
.animate-pulse { animation: pulse 1.5s cubic-bezier(0.4,0,0.6,1) infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ===== PWA safe areas (mobile only) ===== */
@supports (padding: max(0px)) {
  .bottom-nav { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

/* ===== Utilities ===== */
.text-money { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: #f1f5f9; margin: 8px 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.no-scroll { overflow: hidden; }

/* ===== Shipment Line-Item Table ===== */
.sh-table-wrap { overflow-x: auto; margin: 0 -4px; }
.sh-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sh-items-table th {
  background: #f1f5f9; padding: 6px 8px; text-align: left;
  font-size: 11px; font-weight: 600; color: #64748b;
  border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.sh-item-row { border-bottom: 1px solid #f1f5f9; }
.sh-item-row:last-child { border-bottom: none; }
.sh-item-name { padding: 6px 8px; font-size: 12px; font-weight: 600; color: #1e293b; min-width: 120px; }
.sh-cell-input {
  width: 100%; border: 1px solid #d1d5db; border-radius: 6px;
  padding: 4px 6px; font-size: 12px; text-align: right;
  background: #fff; font-variant-numeric: tabular-nums;
}
.sh-cell-input:focus { outline: none; border-color: #3b82f6; background: #eff6ff; }
.sh-item-line-total { padding: 6px 8px; font-size: 12px; font-weight: 600; color: #0f4c81; white-space: nowrap; }
.sh-remove-btn {
  background: none; border: none; color: #ef4444; font-size: 14px;
  cursor: pointer; padding: 4px 6px; border-radius: 4px; line-height: 1;
}
.sh-remove-btn:hover { background: #fee2e2; }
.sh-empty-row { text-align: center; color: #94a3b8; font-size: 12px; padding: 16px 8px; }
.sh-totals-bar {
  display: flex; gap: 12px; align-items: center;
  background: #f8fafc; border-top: 1px solid #e2e8f0;
  padding: 8px 10px; font-size: 13px; color: #475569;
  border-radius: 0 0 10px 10px; margin: 0 -12px -12px;
  flex-wrap: wrap;
}
.sh-totals-bar strong { color: #0f172a; }

/* ===== Receivables / Payments Tab ===== */

/* Page wrapper */
.rcv-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 16px;
  gap: 12px;
}

/* Search bar row */
.rcv-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Loading / empty states */
.rcv-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: #64748b;
  font-size: 15px;
}
.rcv-empty {
  text-align: center;
  padding: 56px 16px;
  color: #64748b;
  font-size: 15px;
}

/* Table wrapper — horizontal scroll on narrow screens */
.rcv-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Main table */
.rcv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}

/* Header */
.rcv-th {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

/* Data cells */
.rcv-td {
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

/* Row base */
.rcv-row {
  transition: background 0.1s;
}
.rcv-row:last-child .rcv-td {
  border-bottom: none;
}
.rcv-row:hover {
  background: #f0f7ff;
}

/* High-outstanding row — bold red tint */
.rcv-row-high {
  background: #fff5f5;
}
.rcv-row-high:hover {
  background: #ffe4e4;
}

/* High + inactive row — orange/amber warning */
.rcv-row-warn {
  background: #fffbeb;
}
.rcv-row-warn:hover {
  background: #fef3c7;
}

/* Customer name + phone in first cell */
.rcv-name {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
  line-height: 1.3;
}
.rcv-phone {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Outstanding amount */
.rcv-amt {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1e293b;
}
.rcv-amt-high {
  color: #dc2626;
  font-size: 16px;
}

/* Discount credit badge */
.rcv-disc {
  display: inline-block;
  background: #f3e8ff;
  color: #7c3aed;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Last purchase date badges */
.rcv-date-ok  { font-size: 12px; font-weight: 600; color: #16a34a; }
.rcv-date-mid { font-size: 12px; font-weight: 600; color: #d97706; }
.rcv-date-old { font-size: 12px; font-weight: 600; color: #dc2626; }

/* Recent-sale chips cell */
.rcv-chips-cell {
  min-width: 200px;
}

/* Individual chip: "29 Mar → ₹28,792" */
.rcv-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 20px;
  padding: 3px 10px;
  margin: 2px 3px 2px 0;
  font-size: 12px;
  white-space: nowrap;
}
.rcv-chip-date {
  color: #64748b;
  font-weight: 500;
}
.rcv-chip-arr {
  color: #94a3b8;
  font-size: 10px;
}
.rcv-chip-amt {
  color: #0f172a;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Pay button */
.rcv-pay-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.rcv-pay-btn:hover {
  background: #15803d;
}
.rcv-pay-btn:active {
  background: #166534;
}

/* Footer totals bar */
.rcv-footer {
  background: #fff;
  border-top: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.rcv-footer-inner {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}
.rcv-footer-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rcv-footer-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.rcv-footer-value {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}
.rcv-footer-outstanding {
  color: #dc2626;
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .rcv-page {
    padding: 10px;
    gap: 8px;
  }
  .rcv-table {
    font-size: 13px;
    min-width: 560px;
  }
  .rcv-th, .rcv-td {
    padding: 8px 10px;
  }
  .rcv-footer-value {
    font-size: 17px;
  }
  .rcv-footer-inner {
    gap: 16px;
  }
}
