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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- Left brand panel ---- */
.login-brand {
  width: 460px;
  min-width: 460px;
  background: linear-gradient(160deg, #060d1f 0%, #0f1f45 35%, #0a2472 68%, #1340b0 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 52px 40px;
  position: relative;
  overflow: hidden;
}

/* Decorative radial orbs */
.login-orb { position: absolute; border-radius: 50%; pointer-events: none; }
.login-orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 70%);
  top: -220px; right: -180px;
}
.login-orb-2 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(59,130,246,0.14) 0%, transparent 70%);
  bottom: 60px; left: -110px;
}
.login-orb-3 {
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(16,185,129,0.1) 0%, transparent 70%);
  top: 52%; left: 42%;
}

.login-brand-content { position: relative; z-index: 1; }

.brand-icon {
  width: 58px; height: 58px;
  background: linear-gradient(135deg, rgba(99,102,241,0.45), rgba(59,130,246,0.3));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
}
.brand-title {
  font-size: 32px; font-weight: 800;
  color: #fff; line-height: 1.15;
  margin: 0; letter-spacing: -0.5px;
}

/* Tagline with left accent bar */
.brand-tagline-wrap {
  display: flex; align-items: stretch; gap: 12px;
}
.brand-tagline-accent {
  width: 3px; flex-shrink: 0;
  background: linear-gradient(180deg, #6366f1, #3b82f6, transparent);
  border-radius: 2px;
}
.brand-subtitle {
  font-size: 13px; color: rgba(255,255,255,0.58);
  margin: 0; letter-spacing: 0.02em; line-height: 1.55;
}

/* Enhanced feature list */
.brand-features { display: flex; flex-direction: column; gap: 18px; }
.brand-feature-item {
  display: flex; align-items: flex-start; gap: 14px;
}
.brand-feature-icon {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #93c5fd; flex-shrink: 0;
}
.brand-feature-title {
  font-size: 13.5px; font-weight: 600;
  color: rgba(255,255,255,0.95); line-height: 1.3; margin-bottom: 2px;
}
.brand-feature-desc {
  font-size: 11.5px; color: rgba(255,255,255,0.42); line-height: 1.4;
}

/* Stats row */
.brand-stats {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; padding: 14px 20px;
}
.brand-stat { flex: 1; text-align: center; }
.brand-stat-value {
  font-size: 15px; font-weight: 700; color: #93c5fd; line-height: 1.2;
}
.brand-stat-label {
  font-size: 10.5px; color: rgba(255,255,255,0.38);
  margin-top: 2px; text-transform: uppercase; letter-spacing: 0.07em;
}
.brand-stat-divider {
  width: 1px; height: 32px; background: rgba(255,255,255,0.12);
}

/* Footer */
.brand-footer {
  color: rgba(255,255,255,0.35); font-size: 11.5px;
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
}
.brand-footer-logo {
  display: flex; align-items: center; gap: 5px;
  color: rgba(255,255,255,0.5); font-weight: 500;
}

/* ---- Right form panel ---- */
.login-form-panel {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  padding: 48px;
  position: relative;
}

.login-form-topbar {
  position: absolute; top: 28px; right: 36px;
}
.login-form-brand {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: #94a3b8;
}

.login-form-container { width: 100%; max-width: 400px; }

/* Secure access badge */
.login-welcome-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 20px; padding: 5px 14px;
  font-size: 12px; font-weight: 500; color: #2563eb;
}

.login-heading {
  font-size: 30px; font-weight: 800; color: #0f172a;
  margin: 0; letter-spacing: -0.5px;
}
.login-subheading { color: #64748b; margin: 6px 0 0; font-size: 14px; }

.alert-error {
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 10px; padding: 12px 16px;
  color: #dc2626; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
}

.form-label-custom {
  display: block; font-size: 13px; font-weight: 600;
  color: #374151; margin-bottom: 7px;
}
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute; left: 14px;
  color: #9ca3af; font-size: 14px; pointer-events: none;
}
.form-input-custom {
  width: 100%; height: 48px;
  padding: 0 44px 0 42px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px; background: #f8fafc;
  font-size: 14px; color: #0f172a;
  transition: all 0.2s; outline: none;
}
.form-input-custom:focus {
  border-color: #3b82f6; background: #fff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-input-custom::placeholder { color: #94a3b8; }
.password-toggle {
  position: absolute; right: 14px;
  background: none; border: none; cursor: pointer;
  color: #9ca3af; padding: 0; font-size: 15px;
}
.password-toggle:hover { color: #3b82f6; }
.forgot-link { font-size: 13px; color: #3b82f6; text-decoration: none; font-weight: 500; }
.forgot-link:hover { color: #1d4ed8; text-decoration: underline; }

.btn-login {
  width: 100%; height: 50px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; border: none;
  border-radius: 12px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.25s;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,99,235,0.4), 0 1px 3px rgba(37,99,235,0.2);
  letter-spacing: 0.01em;
}
.btn-login:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 8px 24px rgba(37,99,235,0.5);
  transform: translateY(-2px);
}
.btn-login:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}
.btn-login:disabled { opacity: 0.75; cursor: not-allowed; transform: none; }

/* Security note below button */
.login-security-note {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; font-size: 12px; color: #94a3b8;
}
.login-security-note i { color: #10b981; font-size: 13px; }

.login-hint {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 16px 18px;
}
.hint-title { font-size: 12px; font-weight: 600; color: #64748b; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.hint-creds { display: flex; flex-direction: column; gap: 6px; }
.hint-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hint-label { font-size: 12px; color: #94a3b8; min-width: 120px; }
.hint-row code { font-size: 12px; background: #e2e8f0; padding: 2px 7px; border-radius: 5px; color: #334155; }
.hint-sep { color: #94a3b8; font-size: 12px; }

@media (max-width: 900px) {
  .login-brand { display: none; }
  .login-form-panel { padding: 32px 24px; }
}

/* =========================================
   DASHBOARD LAYOUT
   ========================================= */
.app-layout {
  display: flex; height: 100vh; overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 240px; min-width: 240px;
  background: #0f172a;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.25s ease;
}
.sidebar-collapsed { width: 64px; min-width: 64px; }
.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .sidebar-nav-item span:not(.nav-badge),
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .sidebar-user-info,
.sidebar-collapsed .sidebar-logout { display: none; }
.sidebar-collapsed .sidebar-nav-item { justify-content: center; padding: 0 20px; }
.sidebar-collapsed .sidebar-user { justify-content: center; }

.sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.sidebar-brand-icon {
  width: 38px; height: 38px; min-width: 38px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-brand-sub { font-size: 11px; color: rgba(255,255,255,0.45); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3); text-transform: uppercase;
  padding: 0 8px 8px; margin-top: 8px;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px; color: rgba(255,255,255,0.6);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: all 0.18s; margin-bottom: 2px;
  position: relative;
}
.sidebar-nav-item i { font-size: 15px; min-width: 16px; text-align: center; }
.sidebar-nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-nav-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.25), rgba(37,99,235,0.15));
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.2);
}
.nav-badge {
  margin-left: auto; background: #ef4444;
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; line-height: 1.4;
}

.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 8px; background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { display: block; font-size: 11px; color: rgba(255,255,255,0.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout {
  color: rgba(255,255,255,0.35); text-decoration: none;
  font-size: 16px; padding: 4px;
  transition: color 0.18s;
}
.sidebar-logout:hover { color: #f87171; }

/* Main content */
.main-content {
  margin-left: 240px;
  flex: 1; display: flex;
  flex-direction: column; height: 100vh; overflow: hidden;
  transition: margin-left 0.25s ease;
}
.main-expanded { margin-left: 64px; }

/* Top Header */
.top-header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  width: 36px; height: 36px; border: none;
  background: transparent; border-radius: 8px;
  cursor: pointer; color: #64748b; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
.sidebar-toggle:hover { background: #f1f5f9; }
.header-breadcrumb { display: flex; align-items: center; gap: 8px; }
.breadcrumb-root { font-size: 13px; color: #94a3b8; }
.breadcrumb-sep { font-size: 10px; color: #cbd5e1; }
.breadcrumb-current { font-size: 13px; font-weight: 600; color: #334155; }

.header-right { display: flex; align-items: center; gap: 8px; }
.header-icon-btn {
  width: 36px; height: 36px; border: none;
  background: transparent; border-radius: 8px;
  cursor: pointer; color: #64748b; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s; position: relative;
}
.header-icon-btn:hover { background: #f1f5f9; color: #334155; }
.notification-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: #ef4444; border-radius: 50%;
  border: 1.5px solid #fff;
}
.header-user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 99px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  cursor: default;
}
.header-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%; background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.header-user-name { font-size: 13px; font-weight: 500; color: #334155; }

/* Page Body */
.page-body {
  padding: 20px 28px;
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}

.page-title-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 16px;
  flex-shrink: 0;
}
.page-title { font-size: 22px; font-weight: 700; color: #0f172a; margin: 0; }
.page-subtitle { font-size: 13px; color: #64748b; margin: 4px 0 0; }
.btn-new-doc {
  height: 40px; padding: 0 18px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff; border: none; border-radius: 9px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.btn-new-doc:hover { box-shadow: 0 4px 14px rgba(37,99,235,0.4); transform: translateY(-1px); }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
  flex-shrink: 0;
}
.stat-card {
  background: #fff; border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  position: relative; overflow: hidden;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.stat-card-icon {
  width: 44px; height: 44px; min-width: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.stat-icon-total { background: #eff6ff; color: #2563eb; }
.stat-icon-pending { background: #fffbeb; color: #d97706; }
.stat-icon-approved { background: #f0fdf4; color: #16a34a; }
.stat-icon-value { background: #faf5ff; color: #7c3aed; }
.stat-card-body { flex: 1; }
.stat-value { display: block; font-size: 24px; font-weight: 700; color: #0f172a; line-height: 1.1; }
.stat-label { display: block; font-size: 12.5px; color: #64748b; margin-top: 3px; }
.stat-card-footer { display: none; }
.stat-text-warning { color: #d97706; font-weight: 600; }
.stat-text-success { color: #16a34a; font-weight: 600; }

/* Table Card */
.table-card {
  background: #fff; border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  flex: 1; display: flex; flex-direction: column; min-height: 0;
}
.table-card > .table-responsive {
  flex: 1; overflow-y: auto; min-height: 0;
}
.table-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.table-card-title { display: flex; align-items: center; gap: 10px; }
.table-card-title h3 { font-size: 15px; font-weight: 600; color: #0f172a; margin: 0; }
.table-doc-count {
  font-size: 11.5px; color: #2563eb;
  background: #dbeafe; border: 1px solid #bfdbfe;
  padding: 3px 10px; border-radius: 99px;
  font-weight: 600; letter-spacing: 0.01em;
}
.table-card-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.table-search-wrap { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 13px; }
.table-search-input {
  height: 36px; padding: 0 14px 0 36px;
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: 13px; color: #334155; background: #f8fafc;
  outline: none; width: 220px; transition: all 0.2s;
}
.table-search-input:focus { border-color: #3b82f6; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.table-search-input::placeholder { color: #94a3b8; }

.filter-tabs { display: flex; gap: 2px; background: #f1f5f9; padding: 3px; border-radius: 9px; }
.filter-tab {
  padding: 5px 13px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: #64748b;
  text-decoration: none; transition: all 0.18s;
  display: flex; align-items: center; gap: 5px;
}
.filter-tab:hover { color: #334155; background: rgba(255,255,255,0.7); }
.filter-tab.active { background: #fff; color: #2563eb; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.tab-count {
  font-size: 10.5px; background: #fef3c7; color: #92400e;
  padding: 1px 6px; border-radius: 99px; font-weight: 700;
}

/* Data Table */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px; table-layout: fixed;
}
/* Column widths: doc fills remaining space, action fixed */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: auto; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 220px; text-align: right; }

.data-table thead th {
  padding: 11px 16px; text-align: left;
  font-size: 11px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: #f8fafc; border-bottom: 1.5px solid #e2e8f0;
  white-space: nowrap;
}
.data-table thead th:first-child { padding-left: 24px; }
.data-table thead th:last-child { padding-right: 16px; text-align: center; }
.th-action { text-align: center; }
.table-row {
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer; transition: background 0.15s;
}
.table-row:hover { background: #f8fafc; }
.table-row:last-child { border-bottom: none; }
.data-table tbody td { padding: 12px 16px; vertical-align: middle; }
.data-table tbody td:first-child { padding-left: 20px; }
.data-table tbody td:last-child { padding-right: 16px; text-align: center; }

.doc-number-cell { display: flex; align-items: center; gap: 9px; }
.doc-icon { color: #94a3b8; font-size: 15px; }
.doc-number { font-weight: 600; color: #1e40af; font-size: 13.5px; font-family: 'SF Mono', 'Fira Code', monospace; }
.btn-compare-doc { background: #dbeafe; border: 1.5px solid #93c5fd; cursor: pointer; color: #1d4ed8; padding: 3px 8px; font-size: 12px; border-radius: 5px; transition: color 0.15s, background 0.15s, border-color 0.15s; line-height: 1; font-weight: 600; }
.btn-compare-doc:hover { color: #fff; background: #2563eb; border-color: #1d4ed8; }
.sel-vendor-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: #f0fdf4; border: 1px solid #86efac; border-radius: 20px; font-size: 11px; font-weight: 600; color: #15803d; white-space: nowrap; }
.sel-vendor-badge i { font-size: 9px; color: #22c55e; }
.req-date-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 20px; font-size: 11px; font-weight: 500; color: #0369a1; white-space: nowrap; }
.req-date-chip i { font-size: 9px; color: #38bdf8; }
.text-muted-cell { color: #64748b; }
.vendor-cell { display: flex; flex-direction: column; gap: 2px; }
.vendor-name { font-weight: 500; color: #0f172a; }
.vendor-po { font-size: 12px; color: #94a3b8; font-family: monospace; }
.amount-cell { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }

/* Status & Priority Badges */
.status-badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.status-pending { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.status-approved { background: #f0fdf4; color: #14532d; border: 1px solid #86efac; }
.status-rejected { background: #fef2f2; color: #7f1d1d; border: 1px solid #fca5a5; }

.priority-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600;
}
.priority-high { background: #fff1f2; color: #be123c; }
.priority-medium { background: #eff6ff; color: #1d4ed8; }
.priority-low { background: #f0fdf4; color: #15803d; }

.btn-view-doc {
  padding: 5px 12px; border-radius: 7px;
  border: 1.5px solid #e2e8f0;
  background: #fff; color: #374151;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all 0.18s;
  display: inline-flex; align-items: center;
}
.btn-view-doc:hover { border-color: #3b82f6; color: #2563eb; background: #eff6ff; }

.empty-state-cell { padding: 60px 20px !important; }
.empty-state { text-align: center; color: #94a3b8; }
.empty-state i { font-size: 40px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin: 0; }

/* =========================================
   DOCUMENT DETAIL MODAL
   ========================================= */
.doc-modal-content {
  border: none; border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
  overflow: hidden;
}
.doc-modal-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 20px;
  display: flex; align-items: center;
  justify-content: space-between;
}
.doc-modal-title-row { display: flex; align-items: center; gap: 14px; }
.doc-modal-icon {
  width: 44px; height: 44px; background: #eff6ff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #2563eb;
}
.doc-modal-title { font-size: 17px; font-weight: 700; color: #0f172a; margin: 0; font-family: monospace; }
.doc-modal-subtitle { font-size: 12.5px; color: #64748b; margin: 3px 0 0; }
.doc-modal-header-right { display: flex; align-items: center; gap: 12px; }
.modal-close-btn {
  width: 32px; height: 32px; border: none;
  background: #f1f5f9; border-radius: 7px;
  cursor: pointer; color: #64748b; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.modal-close-btn:hover { background: #e2e8f0; color: #0f172a; }

.doc-modal-body { padding: 0; background: #f8fafc; }
.modal-loading {
  padding: 60px 20px;
  text-align: center; color: #64748b;
}
.modal-loading p { margin: 16px 0 0; font-size: 14px; }

.doc-detail-body { padding: 2px; }
.detail-section {
  background: #fff; border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 12px 16px; margin: 8px;
}
.section-label {
  font-size: 11px; font-weight: 600;
  color: #64748b; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 10px;
  display: flex; align-items: center;
}
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px; }
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-key { font-size: 11px; color: #94a3b8; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.meta-val { font-size: 13px; color: #1e293b; font-weight: 400; }
.doc-ref-chip {
  font-family: monospace; font-size: 13px;
  background: #eff6ff; color: #1d4ed8;
  padding: 3px 9px; border-radius: 6px;
  display: inline-block; font-weight: 600;
}

/* ── Grouped document table ──────────────────────────────────── */

/* Document parent row — section divider */
.parent-row {
  background: #f0f4ff !important;
  cursor: pointer;
  border-top: 2px solid #e2e8f0 !important;
  border-bottom: 1px solid #dbeafe !important;
}
.parent-row > td { border-bottom: 1px solid #dbeafe !important; }
.parent-row > td:first-child { border-left: 4px solid #2563eb; padding-left: 16px !important; }
.parent-row:hover { background: #e8eeff !important; }

/* Vendor row — kept for any legacy usage */
.vendor-row { background: #fff; cursor: pointer; }
.vendor-row td { border-bottom: 1px solid #f1f5f9; }

/* Quotation detail sub-table row */
tr[data-group] > td, tr[data-doc-expand] > td { padding: 0 !important; border-left: none !important; }

/* ── Vendor tab bar ──────────────────────────────────────────── */
.vendor-tabs-wrap {
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
.vendor-tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 12px 20px 0;
  background: #f8fafc;
  border-bottom: 1.5px solid #dbeafe;
}
.vendor-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 160px;
  min-width: 160px;
  padding: 8px 12px 9px;
  border: 1.5px solid #e2e8f0;
  border-top: 3px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  margin-bottom: -1.5px;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}
.vendor-tab:hover {
  background: #fff;
  color: #334155;
  border-color: #bfdbfe;
  border-top-color: #93c5fd;
}
.vendor-tab.active {
  background: #fff;
  color: #1e40af;
  font-weight: 700;
  border-color: #bfdbfe;
  border-top: 3px solid #2563eb;
  border-bottom: 2px solid #fff;
  box-shadow: 0 -3px 10px rgba(37,99,235,.10);
}
.vendor-tab-panels {
  padding: 14px 20px 16px;
  background: #f4f7ff;
}
.vendor-tab-panel { } /* panels are always block when visible */

/* Cell layouts */
.ver-cell    { display: flex; align-items: center; gap: 8px; }
.vendor-cell { display: flex; align-items: center; gap: 9px; }

/* Version number pill */
.ver-number {
  font-size: 11.5px; font-weight: 700; color: #2563eb;
  background: #dbeafe; padding: 2px 10px; border-radius: 6px;
  letter-spacing: 0.03em; white-space: nowrap; border: 1px solid #93c5fd;
}

/* Latest badge */
.ver-latest-badge {
  font-size: 10px; font-weight: 700; color: #065f46;
  background: #d1fae5; border: 1px solid #6ee7b7;
  padding: 2px 7px; border-radius: 5px;
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* Vendor avatar chip */
.vendor-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  color: #2563eb; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; border: 1px solid #bfdbfe;
}

/* Count badges */
.ver-count-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600;
  color: #5b21b6; background: #ede9fe; border: 1px solid #c4b5fd;
  padding: 2px 8px; border-radius: 99px; margin-left: 6px;
  vertical-align: middle; white-space: nowrap;
}

/* Expand / collapse toggle */
.ver-toggle-btn {
  background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 7px;
  width: 28px; height: 28px; cursor: pointer; color: #94a3b8;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.18s; font-size: 11px; flex-shrink: 0;
}
.ver-toggle-btn:hover { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.ver-toggle-btn.open  { background: #eff6ff; color: #2563eb; border-color: #93c5fd; }

/* View button */
.btn-view-doc {
  padding: 5px 13px; border-radius: 7px;
  border: 1.5px solid #e2e8f0;
  background: #fff; color: #374151;
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.18s;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.btn-view-doc:hover {
  border-color: #2563eb; color: #2563eb;
  background: #eff6ff; box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

/* Detail table inside modal */
.detail-table {
  width: 100%; border-collapse: collapse;
  border: 1px solid #e2e8f0; border-radius: 10px;
  overflow: hidden; font-size: 13.5px;
}
.detail-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.detail-table tbody tr:last-child { border-bottom: none; }
.detail-table tbody tr:nth-child(even) { background: #f8fafc; }
.detail-tbl-key {
  padding: 10px 16px; width: 42%;
  font-size: 12px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: inherit; white-space: nowrap;
}
.detail-tbl-val {
  padding: 10px 16px; color: #1e293b;
  font-weight: 500; font-size: 13.5px;
}

/* Amount row */
.amount-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 12px 14px;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 10px;
}
.amount-label {
  font-size: 12.5px; font-weight: 600; color: #1d4ed8;
  white-space: nowrap; min-width: 60px;
}
.amount-input-wrap {
  flex: 1; position: relative; display: flex; align-items: center;
}
.amount-currency {
  position: absolute; left: 10px;
  font-size: 14px; color: #64748b; font-weight: 600;
}
.amount-input {
  width: 100%; height: 38px;
  padding: 0 12px 0 26px;
  border: 1.5px solid #bfdbfe; border-radius: 8px;
  font-size: 14px; color: #0f172a; background: #fff;
  outline: none; transition: border-color 0.2s;
}
.amount-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.btn-save-amount {
  height: 38px; padding: 0 16px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center;
  white-space: nowrap; transition: opacity 0.2s;
}
.btn-save-amount:hover:not(:disabled) { opacity: 0.88; }
.btn-save-amount:disabled { opacity: 0.65; cursor: not-allowed; }

/* Masterbox section */
.masterbox-section {
  margin-top: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.masterbox-section-header {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.masterbox-section-header i { font-size: 12px; color: #2563eb; }
.masterbox-section-label {
  font-size: 11.5px; font-weight: 700; color: #374151;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.masterbox-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.masterbox-table thead th {
  padding: 7px 14px;
  font-size: 11px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}
.masterbox-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.masterbox-table tbody tr:last-child { border-bottom: none; }
.masterbox-table tbody tr:nth-child(even) { background: #f8fafc; }
.masterbox-table tbody td { padding: 9px 14px; color: #1e293b; font-weight: 500; }
.masterbox-table tbody td:first-child { font-weight: 600; color: #374151; font-size: 12.5px; }
.masterbox-table tbody td:nth-child(2) { font-size: 13px; }
.masterbox-table tbody td:last-child { color: #64748b; font-size: 12px; }
.masterbox-empty {
  padding: 12px 14px; font-size: 12.5px; color: #94a3b8; font-style: italic;
}
.masterbox-loading-row {
  padding: 12px 14px; font-size: 12.5px; color: #94a3b8;
  display: flex; align-items: center; gap: 8px;
}

/* Items table inside modal */
.items-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.items-table thead th {
  padding: 9px 12px;
  font-size: 11.5px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}
.items-table thead th:first-child { border-radius: 8px 0 0 0; padding-left: 0; }
.items-table thead th:last-child { border-radius: 0 8px 0 0; }
.items-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.items-table tbody tr:last-child { border-bottom: none; }
.items-table tbody td { padding: 11px 12px; color: #334155; vertical-align: top; }
.items-table tbody td:first-child { padding-left: 0; }
.item-desc { font-weight: 500; color: #1e293b; }

.totals-section {
  margin-top: 16px; padding-top: 14px;
  border-top: 1.5px solid #e2e8f0;
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px;
}
.total-row {
  display: flex; gap: 80px; justify-content: flex-end;
  font-size: 13.5px; color: #64748b;
  min-width: 280px;
}
.total-row span:last-child { min-width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.total-final {
  padding-top: 10px; margin-top: 4px;
  border-top: 2px solid #0f172a;
  font-size: 16px; font-weight: 700; color: #0f172a;
}

.notes-box {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 14px;
  font-size: 13.5px; color: #334155; line-height: 1.6;
}

.approval-info-section { border-color: #86efac; background: #f0fdf4; }
.rejection-info-section { border-color: #fca5a5; background: #fef2f2; }
.rejection-reason-box {
  background: #fff; border: 1px solid #fca5a5;
  border-radius: 8px; padding: 14px;
  font-size: 13.5px; color: #7f1d1d; line-height: 1.6;
}
.rejection-reason-box p { margin: 0; }

/* Modal Footer */
.doc-modal-footer {
  background: #fff; border-top: 1px solid #e2e8f0;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-action-btns { display: flex; align-items: center; gap: 10px; }
.btn-modal-close {
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px solid #e2e8f0; background: #fff;
  color: #374151; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all 0.18s;
  display: flex; align-items: center;
}
.btn-modal-close:hover { border-color: #94a3b8; background: #f8fafc; }

.btn-reject-action {
  padding: 9px 18px; border-radius: 8px;
  border: 1.5px solid #fca5a5; background: #fef2f2;
  color: #dc2626; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center;
}
.btn-reject-action:hover { background: #fee2e2; border-color: #ef4444; }

.btn-approve-action {
  padding: 9px 20px; border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center;
  box-shadow: 0 2px 8px rgba(22,163,74,0.35);
}
.btn-approve-action:hover { box-shadow: 0 4px 14px rgba(22,163,74,0.45); transform: translateY(-1px); }
.btn-approve-action:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* Reject Modal */
.reject-modal-content {
  border: none; border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}
.reject-modal-header {
  padding: 20px 20px 16px 20px;
  border-bottom: 1px solid #fecaca;
  background: #fff5f5;
  display: flex; align-items: flex-start; gap: 14px;
}
.reject-icon-wrap {
  width: 42px; height: 42px; min-width: 42px;
  background: #fee2e2; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #dc2626;
}
.reject-modal-title { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0; }
.reject-modal-sub { font-size: 12.5px; color: #dc2626; margin: 3px 0 0; }
.reject-textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid #e2e8f0; border-radius: 9px;
  font-size: 13.5px; color: #334155;
  resize: vertical; outline: none;
  font-family: inherit; transition: border-color 0.2s;
  background: #f8fafc;
}
.reject-textarea:focus { border-color: #f87171; box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }
.reject-hint { font-size: 12px; color: #94a3b8; margin: 8px 0 0; }
.reject-modal-footer {
  padding: 16px 20px; border-top: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}
.btn-cancel-action {
  padding: 8px 16px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; background: #fff;
  color: #374151; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all 0.18s;
}
.btn-cancel-action:hover { border-color: #94a3b8; }
.btn-confirm-reject {
  padding: 9px 18px; border: none; border-radius: 8px;
  background: #dc2626; color: #fff;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center;
  box-shadow: 0 2px 8px rgba(220,38,38,0.35);
}
.btn-confirm-reject:hover { background: #b91c1c; }
.btn-confirm-reject:disabled { opacity: 0.65; cursor: not-allowed; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .table-card-header { flex-direction: column; align-items: flex-start; }
  .meta-grid { grid-template-columns: 1fr; }
}
