/* ============================================================
   Vendor Payment Portal — Global Stylesheet
   Glass-morphism, light theme, Inter font
   ============================================================ */

/* --- Google Font --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --accent:       #667eea;
  --accent-dark:  #5a6fd6;
  --accent-grad:  linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-light: rgba(102,126,234,0.08);
  --purple:       #764ba2;

  --bg-page:      #f4f6fb;
  --bg-card:      rgba(255,255,255,0.75);
  --bg-card-solid:#ffffff;
  --glass-border: 1px solid rgba(255,255,255,0.85);
  --glass-blur:   blur(20px);

  --text-primary:   #1a1d2e;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --text-white:     #ffffff;

  --border:       #e5e7eb;
  --border-focus: #667eea;

  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(102,126,234,0.1), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg:  0 20px 60px rgba(102,126,234,0.12), 0 8px 24px rgba(0,0,0,0.08);
  --shadow-modal: 0 32px 80px rgba(0,0,0,0.16), 0 8px 24px rgba(0,0,0,0.08);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --sidebar-w:  248px;
  --topbar-h:   64px;
  --transition: all .2s cubic-bezier(.4,0,.2,1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: 'Inter', sans-serif; cursor: pointer; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ============================================================
   LAYOUT — Sidebar + Content
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(255,255,255,0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 2px 0 16px rgba(102,126,234,0.06);
  transition: transform .3s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: var(--accent-grad);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand .brand-text h2 {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  white-space: nowrap;
}
.sidebar-brand .brand-text span {
  font-size: 11px; color: var(--text-muted); font-weight: 400;
}

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

.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none; background: none; width: 100%; text-align: left;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(102,126,234,0.12), rgba(118,75,162,0.08));
  color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent-grad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.user-details .user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.user-details .user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.btn-logout {
  width: 100%; margin-top: 8px;
  padding: 8px; border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: none; color: var(--text-secondary);
  font-size: 12px; font-weight: 500;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.3); color: var(--danger); }

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Bar --- */
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 90;
  box-shadow: 0 1px 12px rgba(102,126,234,0.06);
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text-primary); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.select-glass {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px; font-family: 'Inter', sans-serif;
  background: rgba(255,255,255,0.8);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.select-glass:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }

/* --- Page Body --- */
.page-body {
  flex: 1;
  padding: 28px;
  overflow-x: hidden;
}

/* ============================================================
   CARDS & GLASS PANELS
   ============================================================ */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(229,231,235,0.6);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 20px; }

/* ============================================================
   TILES / STAT CARDS
   ============================================================ */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 1100px) { .tiles-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .tiles-grid { grid-template-columns: 1fr; } }

.tile {
  background: rgba(255,255,255,0.82);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.tile::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--tile-color, var(--accent-grad));
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tile.active { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); }

.tile-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.tile-count { font-size: 38px; font-weight: 800; color: var(--text-primary); line-height: 1.1; margin: 6px 0 4px; }
.tile-sublabel { font-size: 12px; color: var(--text-muted); }
.tile-icon {
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 36px; opacity: 0.1;
}
.tile-pending   { --tile-color: linear-gradient(90deg, #f59e0b, #fbbf24); }
.tile-checked   { --tile-color: linear-gradient(90deg, #3b82f6, #60a5fa); }
.tile-cheque    { --tile-color: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.tile-passed    { --tile-color: linear-gradient(90deg, #10b981, #34d399); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif;
  border: none; cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed !important; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(102,126,234,0.4); }

.btn-secondary {
  background: rgba(255,255,255,0.9);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: #f9fafb; border-color: #d1d5db; }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,185,129,0.4); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(239,68,68,0.4); }

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}
.btn-warning:hover { transform: translateY(-1px); }

.btn-ghost {
  background: none; border: none;
  color: var(--text-secondary);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--accent-light); color: var(--accent); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; font-weight: 600; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
  letter-spacing: .02em;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px; font-family: 'Inter', sans-serif;
  background: rgba(255,255,255,0.85);
  color: var(--text-primary);
  transition: var(--transition);
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
  background: #fff;
}
.form-control:disabled { background: #f9fafb; color: var(--text-muted); cursor: not-allowed; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }

.form-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

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 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Checkbox & Radio */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox],
.form-check input[type=radio] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--accent);
}
.form-check label { font-size: 13px; color: var(--text-secondary); cursor: pointer; margin: 0; }

/* Radio group */
.radio-group { display: flex; gap: 16px; }
.radio-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px; color: var(--text-secondary);
  background: rgba(255,255,255,0.7);
}
.radio-pill input { display: none; }
.radio-pill:has(input:checked),
.radio-pill.checked {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

/* File Upload Drop Zone */
.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255,255,255,0.5);
}
.file-drop:hover, .file-drop.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.file-drop input[type=file] { display: none; }
.file-drop-icon { font-size: 28px; margin-bottom: 8px; }
.file-drop-text { font-size: 13px; color: var(--text-muted); }
.file-drop-text span { color: var(--accent); font-weight: 500; }
.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px; color: var(--text-secondary);
}
.file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--text-muted); flex-shrink: 0; }
.file-item .file-remove { color: var(--danger); cursor: pointer; flex-shrink: 0; font-size: 14px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: rgba(248,249,252,0.9);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.data-table thead th:hover { color: var(--accent); }
.data-table thead th.sorted-asc::after  { content: ' ↑'; }
.data-table thead th.sorted-desc::after { content: ' ↓'; }

.data-table tbody tr {
  border-bottom: 1px solid rgba(229,231,235,0.5);
  transition: background .15s;
}
.data-table tbody tr:hover { background: rgba(102,126,234,0.035); }
.data-table tbody td {
  padding: 11px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr:last-child { border-bottom: none; }

/* Table search + controls */
.table-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(229,231,235,0.6);
  flex-wrap: wrap;
}
.table-search {
  flex: 1; min-width: 180px;
  padding: 7px 12px 7px 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px; font-family: 'Inter', sans-serif;
  background: rgba(255,255,255,0.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
  transition: var(--transition);
}
.table-search:focus { outline: none; border-color: var(--accent); }
.table-pagination {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid rgba(229,231,235,0.6);
  font-size: 12px; color: var(--text-muted);
}
.page-btn {
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.8);
  font-size: 12px; cursor: pointer;
  transition: var(--transition);
}
.page-btn:hover, .page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-new        { background: rgba(245,158,11,0.1);  color: #d97706; }
.badge-checked    { background: rgba(59,130,246,0.1);  color: #2563eb; }
.badge-cheque_ready { background: rgba(139,92,246,0.1); color: #7c3aed; }
.badge-passed     { background: rgba(16,185,129,0.1);  color: #059669; }
.badge-rejected   { background: rgba(239,68,68,0.1);   color: #dc2626; }
.badge-active     { background: rgba(16,185,129,0.1);  color: #059669; }
.badge-inactive   { background: rgba(156,163,175,0.1); color: #6b7280; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17,24,39,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%; max-height: 90vh;
  display: flex; flex-direction: column;
  transform: scale(0.96) translateY(16px);
  transition: transform .25s ease;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-sm { max-width: 420px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1080px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(229,231,235,0.6);
  flex-shrink: 0;
}
.modal-title {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.modal-title .modal-icon {
  width: 30px; height: 30px;
  background: var(--accent-light);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 14px;
}
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: rgba(229,231,235,0.5);
  color: var(--text-muted); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition); flex-shrink: 0;
}
.modal-close:hover { background: rgba(239,68,68,0.1); color: var(--danger); }

.modal-body {
  flex: 1; overflow-y: auto;
  padding: 24px;
}
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid rgba(229,231,235,0.6);
  flex-shrink: 0;
}

/* Section divider within modals */
.modal-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(229,231,235,0.6);
}
.modal-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.modal-section-title {
  font-size: 12px; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.modal-section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(102,126,234,0.2), transparent);
}

/* Repeater rows */
.repeater-row {
  background: rgba(248,249,252,0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}
.repeater-row .remove-row {
  position: absolute; top: 10px; right: 10px;
  background: rgba(239,68,68,0.08); border: none;
  color: var(--danger); border-radius: 6px;
  width: 24px; height: 24px; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.repeater-row .remove-row:hover { background: rgba(239,68,68,0.15); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 9px 18px;
  border: none; background: none;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer; border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: var(--transition);
  position: relative;
}
.tab-btn:hover { color: var(--accent); background: var(--accent-light); }
.tab-btn.active {
  color: var(--accent); font-weight: 600;
  background: rgba(102,126,234,0.06);
}
.tab-btn.active::after {
  content: '';
  position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: var(--accent);
}
.tab-btn .tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600;
  width: 18px; height: 18px; border-radius: 50%;
  margin-left: 6px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 260px; max-width: 360px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; gap: 10px;
  animation: toastIn .3s ease forwards;
  pointer-events: all;
  border-left: 3px solid var(--accent);
}
.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-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-msg { font-size: 13px; color: var(--text-primary); line-height: 1.4; flex: 1; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateX(24px); } to { opacity:1; transform: translateX(0); } }
@keyframes toastOut { to   { opacity:0; transform: translateX(24px); } }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.d-flex   { display: flex; }
.d-none   { display: none !important; }
.d-block  { display: block !important; }
.align-center { align-items: center; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.gap-16   { gap: 16px; }
.flex-1   { flex: 1; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-accent  { color: var(--accent)  !important; }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.fs-12   { font-size: 12px; }
.fs-13   { font-size: 13px; }
.mb-0    { margin-bottom: 0 !important; }
.mb-8    { margin-bottom: 8px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.p-0     { padding: 0 !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-100   { width: 100%; }

.loading-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(102,126,234,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* Amount display */
.amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-positive { color: var(--success); }
.amount-negative { color: var(--danger); }

/* Preview split pane */
.preview-pane {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  height: 520px;
}
.preview-frame { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.preview-frame iframe, .preview-frame img {
  width: 100%; height: 100%; object-fit: contain; border: none;
}
.detail-pane { overflow-y: auto; }

/* Info rows in detail view */
.info-row {
  display: flex; padding: 8px 0;
  border-bottom: 1px solid rgba(229,231,235,0.5);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-label { width: 140px; flex-shrink: 0; color: var(--text-muted); font-weight: 500; }
.info-value { flex: 1; color: var(--text-primary); font-weight: 400; }

/* Attachment thumbnails */
.att-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att-thumb {
  width: 80px; height: 80px;
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: #f9fafb; transition: var(--transition);
  position: relative;
}
.att-thumb:hover { border-color: var(--accent); transform: scale(1.04); }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb .att-ext {
  font-size: 11px; font-weight: 600; color: var(--accent);
  text-transform: uppercase;
}

/* Progress bar for file uploads */
.upload-progress { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.upload-progress-bar { height: 100%; background: var(--accent-grad); border-radius: 99px; transition: width .3s; }

/* Vendor search dropdown */
.vendor-search-wrap { position: relative; }
.vendor-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 200px; overflow-y: auto;
  display: none;
}
.vendor-dropdown.open { display: block; }
.vendor-option {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background .1s;
  display: flex; justify-content: space-between; align-items: center;
}
.vendor-option:hover { background: var(--accent-light); }
.vendor-option .vpan { font-size: 11px; color: var(--text-muted); }

/* Net payable highlight */
.net-payable-display {
  background: linear-gradient(135deg, rgba(102,126,234,0.06), rgba(118,75,162,0.04));
  border: 1px solid rgba(102,126,234,0.15);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.net-payable-display .label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.net-payable-display .value { font-size: 22px; font-weight: 800; color: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .preview-pane { grid-template-columns: 1fr; height: auto; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .topbar, .toast-container { display: none; }
  .main-content { margin-left: 0; }
  .modal-overlay { position: static; background: none; }
  .modal { box-shadow: none; }
}
