/* ============================================
   TRANSPORT BILLING SYSTEM — Master Stylesheet
   ============================================ */

/* === CSS Variables === */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  
  --accent: #F59E0B;
  --accent-hover: #D97706;
  --accent-light: rgba(245, 158, 11, 0.1);
  --accent-glow: rgba(245, 158, 11, 0.15);
  
  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border: #e2e8f0;
  --border-focus: #F59E0B;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Base Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* === Layout === */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #f97316);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-brand h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.nav-section-label {
  padding: 16px 12px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item svg, .nav-item i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg, .nav-item.active i {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

.nav-badge.pending {
  background: var(--warning);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* === Main Content === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 0;
}

.page-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.9);
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.page-body {
  padding: 24px 32px;
  --radius-xl: 20px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Base Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* === Layout === */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #f97316);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-brand h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.nav-section-label {
  padding: 16px 12px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item svg, .nav-item i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg, .nav-item.active i {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

.nav-badge.pending {
  background: var(--warning);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* === Main Content === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 0;
  min-width: 0; /* Fix flexbox shrink bug */
}

.page-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.9);
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.page-body {
  padding: 24px 32px;
}

/* === Mobile Hamburger === */
.hamburger {
  display: none;
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1100;
  background: var(--sidebar-bg);
  border: none;
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* === Cards === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(248,250,252,0.8), rgba(248,250,252,0));
}

.card-header h3 {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
}

.card-body {
  padding: 22px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-info {
  background: var(--info);
  color: #fff;
}
.btn-info:hover {
  background: #2563eb;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 7px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled, .btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Forms === */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }

.form-section {
  margin-bottom: 28px;
}

.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title svg {
  color: var(--accent);
}

/* Autocomplete */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.autocomplete-list.show { display: block; }

.autocomplete-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

/* === Tables === */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.data-table tbody tr:hover {
  background: var(--accent-light);
}

.data-table tbody tr.row-pending {
  background: #fffbeb;
}

.data-table tbody tr.row-pending:hover {
  background: #fef3c7;
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.3px;
}

.badge-pending {
  background: var(--warning-bg);
  color: #b45309;
}

.badge-printed {
  background: var(--info-bg);
  color: #1d4ed8;
}

.badge-collected {
  background: var(--success-bg);
  color: #047857;
}

.badge-company {
  background: #f0f9ff;
  color: #0369a1;
  font-weight: 700;
}

.badge-repeat {
  background: var(--accent-light);
  color: #b45309;
  border: 1px solid rgba(245,158,11,0.2);
}

.badge-category {
  font-size: 10px;
  padding: 2px 8px;
}

.badge-driver { background: #dbeafe; color: #1e40af; }
.badge-loadman { background: #fce7f3; color: #9d174d; }
.badge-cleaner { background: #d1fae5; color: #065f46; }
.badge-lorry-owner { background: #fef3c7; color: #92400e; }
.badge-vendor { background: #ede9fe; color: #5b21b6; }
.badge-client { background: #f0f9ff; color: #0369a1; }
.badge-other { background: #f1f5f9; color: #475569; }

/* === Profit/Money Display === */
.money-positive { color: var(--success); font-weight: 600; }
.money-negative { color: var(--danger); font-weight: 600; }
.money-display { font-family: 'Inter', monospace; font-weight: 600; }

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--accent);
  min-width: 320px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13.5px;
  font-weight: 500;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  font-size: 16px;
  line-height: 1;
}

.toast.removing {
  animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

/* === Filter Panel === */
.filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.filter-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}

.filter-toggle:hover { 
  color: var(--accent); 
  background: var(--accent-light);
}

.filter-toggle svg {
  transition: transform 0.3s;
}

.filter-toggle.active svg {
  transform: rotate(180deg);
}

.filter-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-body.open {
  max-height: 500px;
}

.filter-content {
  padding: 0 20px 20px;
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* === Attachment Slots === */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.attachment-slot {
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  background: var(--bg-input);
}

.attachment-slot:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.attachment-slot.filled {
  border-style: solid;
  border-color: var(--success);
}

.attachment-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 2px);
}

.attachment-slot .slot-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.attachment-slot .slot-icon {
  font-size: 22px;
  color: var(--text-muted);
}

.attachment-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.2s;
}

.attachment-slot:hover .attachment-remove {
  opacity: 1;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 40px;
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}

.pagination a, .pagination span {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.pagination a {
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.pagination .active {
  background: var(--accent);
  color: #000;
  border: 1px solid var(--accent);
  font-weight: 700;
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* === Client Cards Grid === */
.client-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.client-card {
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: var(--transition);
  position: relative;
}

.client-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.client-card.repeat {
  border-left: 4px solid var(--accent);
}

.client-card .vehicle-number {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 1px;
  font-family: 'Inter', monospace;
}

.client-card .transport-name {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.client-card .stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.client-card .stat {
  text-align: center;
}

.client-card .stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.client-card .stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.client-card .card-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* === Contact Cards === */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--transition);
}

.contact-card:hover {
  box-shadow: var(--shadow-md);
}

.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.contact-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.contact-info p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* === Tabs === */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 4px;
}

.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* === Lightbox === */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.show { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

/* === Utility === */
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }

/* === Responsive === */
@media (max-width: 1024px) {
  .client-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .hamburger {
    display: flex;
  }
  .main-content {
    margin-left: 0;
  }
  .page-header {
    padding: 16px 20px;
    padding-right: 66px;
  }
  .page-body {
    padding: 16px;
  }
  .client-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .attachment-grid { grid-template-columns: repeat(3, 1fr); }
  .page-header-actions { flex-wrap: wrap; }
}

@media (max-width: 768px) {
  .attachment-grid { grid-template-columns: repeat(2, 1fr); }
  
  /* Larger action buttons on mobile */
  .btn {
    padding: 12px 20px;
    font-size: 14px;
    justify-content: center;
  }
  .rc__action-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* === Document Grid (Responsive) === */
.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.document-card {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.document-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (max-width: 1200px) {
  .document-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .document-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }
  .view-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .document-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* === Receipt Cards (rc__) === */
.receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

/* === View Page Grid === */
.view-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

/* === Print Wrapper === */
.receipt-print-wrapper {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 20px;
}

/* Card shell */
.rc {
  position: relative;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e8ecf1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.02);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  display: flex;
}

.rc:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  transform: translateY(-3px);
}

/* Left accent strip */
.rc__accent {
  width: 5px;
  flex-shrink: 0;
}

.rc--srk .rc__accent { background: linear-gradient(180deg, #f472b6, #ec4899); }
.rc--stl .rc__accent { background: linear-gradient(180deg, #6ee7b7, #34d399); }
.rc--gr  .rc__accent { background: linear-gradient(180deg, #93c5fd, #60a5fa); }

/* Pastel body tints */
.rc--srk { background: #fdf2f8; border-color: #fbcfe8; }
.rc--stl { background: #f0fdf4; border-color: #bbf7d0; }
.rc--gr  { background: #eff6ff; border-color: #bfdbfe; }

/* Inner content */
.rc__inner {
  flex: 1;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Top row: number + status */
.rc__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.rc__number {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.rc__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
}

.rc__dot {
  font-size: 16px;
  line-height: 1;
  color: #cbd5e1;
}

.rc__company-tag {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 1px 7px;
  border-radius: 4px;
}

.rc--srk .rc__company-tag { background: #fce7f3; color: #be185d; }
.rc--stl .rc__company-tag { background: #d1fae5; color: #047857; }
.rc--gr  .rc__company-tag { background: #dbeafe; color: #1d4ed8; }

/* Status pill */
.rc__status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.rc__status--pending  { background: #fef3c7; color: #92400e; }
.rc__status--printed  { background: #dbeafe; color: #1e40af; }
.rc__status--collected { background: #d1fae5; color: #065f46; }

/* Info grid */
.rc__info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rc__info-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.rc__info-icon {
  font-size: 14px;
  line-height: 1.4;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.rc__info-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  line-height: 1.2;
}

.rc__info-value {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  margin-top: 1px;
  word-break: break-word;
}

/* Route row */
.rc__route {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  background: rgba(255,255,255,0.6);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.04);
}

.rc__route-arrow {
  color: var(--accent);
  font-weight: 800;
  font-size: 15px;
}

/* Financial summary bar */
.rc__finance {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 10px;
  padding: 10px 0;
}

.rc__fin-item {
  flex: 1;
  text-align: center;
  padding: 0 8px;
}

.rc__fin-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.rc__fin-value {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
  font-family: 'Inter', monospace;
}

.rc__fin-value--pos { color: #059669; }
.rc__fin-value--neg { color: #dc2626; }

.rc__fin-divider {
  width: 1px;
  height: 28px;
  background: rgba(0,0,0,0.08);
  flex-shrink: 0;
}

/* Actions */
.rc__actions { justify-content: flex-end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.rc__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.8);
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.rc__action-btn:hover {
  background: #fff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.rc__action-btn--primary {
  flex: 1;
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
}

.rc__action-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(245,158,11,0.25);
}

.rc__action-btn--danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* Responsive */
@media (max-width: 1200px) {
  .receipt-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 768px) {
  .receipt-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .rc__info {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .rc__inner {
    padding: 16px;
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .receipt-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .rc__finance {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }

  .rc__fin-divider {
    display: none;
  }

  .rc__fin-item {
    min-width: calc(50% - 6px);
    padding: 6px 4px;
    border-radius: 6px;
    background: rgba(255,255,255,0.5);
  }

  .rc__actions { justify-content: flex-end;
    flex-wrap: wrap;
  }

  .rc__action-btn--primary {
    flex-basis: 100%;
  }
}


/* Monochrome Icons */
.icon-bw { filter: grayscale(100%) contrast(150%); opacity: 0.85; font-style: normal; display: inline-block; }


/* === Enterprise Mobile App Overrides === */
.mobile-bottom-nav { 
  display: none; 
  position: fixed; 
  bottom: 0; 
  left: 0; 
  width: 100%; 
  height: 64px; 
  background: rgba(255, 255, 255, 0.95); 
  backdrop-filter: blur(10px); 
  -webkit-backdrop-filter: blur(10px); 
  border-top: 1px solid rgba(0,0,0,0.08); 
  z-index: 1000; 
  padding-bottom: env(safe-area-inset-bottom); 
}
.bottom-nav-item { 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  color: var(--text-muted); 
  text-decoration: none; 
  font-size: 10px; 
  font-weight: 600; 
  transition: color 0.2s; 
  background: none; 
  border: none; 
  cursor: pointer; 
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item svg { width: 22px; height: 22px; margin-bottom: 2px; stroke-width: 2.5; }
.bottom-nav-item.active svg { stroke: var(--accent); }
.bottom-nav-fab { position: relative; top: -20px; flex: 0 0 60px; }
.bottom-nav-fab .fab-inner { 
  width: 56px; 
  height: 56px; 
  background: linear-gradient(135deg, var(--accent), #f97316); 
  border-radius: 50%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  color: #fff; 
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4); 
  border: 4px solid var(--bg-primary); 
}
.bottom-nav-fab svg { color: #fff; margin: 0; }

@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; }
  .hamburger { display: none !important; }
  .main-content { padding-bottom: 80px; }
  .page-header {
    position: sticky;
    top: 0;
    z-index: 99;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin: 0 0 20px 0;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-header h2 {
    font-size: 18px;
    margin: 0;
  }
  .page-header-actions { 
    display: flex;
    flex-direction: row; 
    flex-wrap: nowrap; 
    align-items: center; 
    justify-content: flex-start; 
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .page-header-actions::-webkit-scrollbar {
    display: none;
  }
  .page-header-actions .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    margin-right: 8px;
  }
  .card {
    border-radius: 20px;
    border: none;
    box-shadow: 0 6px 24px rgba(0,0,0,0.04);
  }
  .form-control {
    border-radius: 12px;
    height: 48px;
    background: var(--bg-input);
    border: 1px solid transparent;
  }
  .form-control:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
  }
  .btn {
    border-radius: 12px;
    height: 48px;
  }
  .page-body {
    padding: 16px 12px;
  }
}

@media (max-width: 768px) {
  .attachment-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .d-flex.justify-content-end.mt-4 {
    flex-direction: column;
    width: 100%;
  }
  .d-flex.justify-content-end.mt-4 .btn {
    width: 100%;
    margin-bottom: 8px;
  }
}
@media (max-width: 768px) {
  .attachment-grid { grid-template-columns: 1fr !important; }
}

/* === Form Actions Desktop === */
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin: 20px 0 40px;
}
@media (max-width: 768px) {
  .form-actions {
    flex-direction: column;
    width: 100%;
  }
  .form-actions .btn {
    width: 100%;
    margin-bottom: 8px;
  }
}
.main-content { min-width: 0 !important; }
@media (max-width: 768px) { .page-body { padding: 0 24px !important; } }
@media (max-width: 768px) { .hide-on-mobile { display: none !important; } }
.filter-toggle.active #filterIcon { transform: rotate(180deg) !important; }
.page-loader { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--bg-primary); z-index: 9999; display: flex; align-items: center; justify-content: center; transition: opacity 0.4s ease, visibility 0.4s ease; } .page-loader.hidden { opacity: 0; visibility: hidden; } .spinner { width: 40px; height: 40px; border: 3px solid var(--accent-light); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
