* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', Arial, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
}

/* ─── Side Nav ─── */
.side-nav {
  width: 220px;
  min-height: 100vh;
  background: #0b1f4a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-nav-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}

.side-nav-logo img {
  width: 140px;
  height: auto;
  display: block;
}

.side-nav-links {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 2px;
}

.side-nav-bottom {
  padding: 8px 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.side-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.side-nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.side-nav-link.active {
  background: rgba(11,77,162,0.22);
  color: #fff;
  font-weight: 700;
  border-left: 4px solid #0b4da2;
  padding-left: 8px;
}

.side-nav-link svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.side-nav-link.active svg {
  opacity: 1;
}

/* Collapsible group */
.side-nav-group { }
.side-nav-group-row { display: flex; align-items: center; }
.side-nav-group-row .side-nav-link { flex: 1; }
.side-nav-chevron-btn { background: none; border: none; color: rgba(255,255,255,0.45); cursor: pointer; padding: 6px 8px; border-radius: 6px; display: flex; align-items: center; transition: color 0.15s; flex-shrink: 0; margin-right: 4px; }
.side-nav-chevron-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.side-nav-chevron-btn svg { transition: transform 0.2s; }
.side-nav-chevron-btn.collapsed svg { transform: rotate(-90deg); }
.side-nav-sub { overflow: hidden; transition: max-height 0.2s ease; }
.side-nav-sub.collapsed { display: none; }
.side-nav-child { padding-left: 30px !important; font-size: 12px !important; }

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  padding: 24px 16px;
  min-width: 0;
  overflow-x: auto;
}

/* ─── Top Bar ─── */
.top-bar {
  max-width: 960px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar select {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  background: #fff;
}

/* ─── Data Source Panel ─── */
.data-source-panel {
  max-width: 960px;
  margin: 0 auto 16px;
  background: #fff;
  border: 1px solid #e0e7ff;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.ds-label {
  font-size: 11px;
  font-weight: 700;
  color: #4f46e5;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.ds-divider {
  width: 1px;
  height: 22px;
  background: #e0e7ff;
  flex-shrink: 0;
}

.ds-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.ds-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 14px;
  pointer-events: none;
}

.ds-search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  font-size: 12px;
  background: #f9fafb;
  color: #111827;
  transition: border-color 0.15s, background 0.15s;
}

.ds-search-input:focus {
  outline: none;
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

/* Import buttons */
.ds-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  position: relative;
}

.ds-btn:hover:not(.ds-btn-disabled) { background: #e0e7ff; border-color: #a5b4fc; }
.ds-btn:disabled, .ds-btn.ds-btn-disabled { opacity: 0.45; cursor: not-allowed; }

.ds-btn-secondary {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #e5e7eb;
}
.ds-btn-secondary:hover { background: #e5e7eb; color: #374151; }

.ds-btn .ds-btn-spinner { display: none; }
.ds-btn.loading .ds-btn-spinner { display: inline; animation: spin 0.8s linear infinite; }
.ds-btn.loading span:not(.ds-btn-spinner) { opacity: 0.6; }

/* Borrower Search (legacy class kept for JS) */
.search-box {
  max-width: 960px;
  margin: 0 auto 16px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 15px;
}

/* ─── Source Badges ─── */
.source-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.source-badge-hubspot { background: #ff7a59; color: #fff; }
.source-badge-google-doc { background: #4285f4; color: #fff; }
.source-badge-onedrive { background: #0078d4; color: #fff; }

.field-autofilled {
  border-color: #86efac !important;
  background: #f0fdf4 !important;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}

.search-results.visible { display: block; }

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f0f7ff; }

.search-result-item .sr-name { font-weight: 600; font-size: 13px; color: #111827; }
.search-result-item .sr-email { font-size: 11px; color: #6b7280; margin-top: 1px; }

.search-loading {
  padding: 12px 14px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

/* ─── Form wrapper ─── */
.wrapper {
  max-width: 960px;
  margin: 0 auto;
  background: #ffffff;
  padding: 28px 36px 36px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* ─── Header ─── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #e1e4ea;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-img {
  height: 56px;
  width: auto;
}

.header-logo { height: 44px; width: auto; display: block; }
.logo-box {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: #0b4da2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.brand-text { line-height: 1.3; }
.brand-text .name { font-size: 20px; font-weight: 800; color: #0b4da2; }
.brand-text .tagline { font-size: 11px; color: #6b7280; }

.header-right { text-align: right; font-size: 11px; color: #6b7280; line-height: 1.8; }
.header-right strong { color: #111827; }

/* ─── Page title ─── */
h1 { font-size: 22px; margin: 0 0 4px; color: #111827; font-weight: 800; }
.subheading { font-size: 11px; color: #9ca3af; margin-bottom: 20px; }

/* ─── Section title ─── */
.section-title {
  margin-top: 22px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 700;
  color: #0b4da2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

/* ─── Grids ─── */
.grid-3, .grid-2 { display: grid; gap: 14px; margin-bottom: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ─── Fields ─── */
.field { display: flex; flex-direction: column; font-size: 12px; }
.field label { font-weight: 600; margin-bottom: 4px; color: #6B7280; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

.field input,
.field select,
.field textarea {
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
  color: #111827;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #0b4da2;
  box-shadow: 0 0 0 3px rgba(11,77,162,0.08);
}

.field textarea { min-height: 60px; resize: vertical; }

.field input[readonly] {
  background: #f9fafb;
  color: #6b7280;
}

/* ─── Fetch buttons ─── */
.fetch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #0b4da2;
  background: #fff;
  color: #0b4da2;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.15s;
}

.fetch-btn:hover { background: #0b4da2; color: #fff; }
.fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fetch-btn .spinner { display: none; }
.fetch-btn.loading .spinner { display: inline; animation: spin 0.8s linear infinite; }
.fetch-btn.loading .btn-text { opacity: 0.6; }

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

.fetch-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  align-items: center;
}

.fetch-bar .fetch-label {
  font-size: 11px;
  font-weight: 600;
  color: #1e40af;
  margin-right: 4px;
}

.fetch-note {
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
  margin-top: 4px;
}

/* ─── Pills ─── */
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.prepayment-panel { background: #f4f7ff; border: 1px solid #d0d9f0; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.pp-declining-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 10px; }
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.pill:hover { background: #e0e7ff; }
.pill input[type="checkbox"] { width: 13px; height: 13px; margin: 0; cursor: pointer; }

/* ─── Fee table ─── */
.fee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 14px;
}

.fee-table th,
.fee-table td {
  border: 1px solid #e5e7eb;
  padding: 7px 10px;
  text-align: left;
}

.fee-table th { background: #f8fafc; font-weight: 700; color: #374151; font-size: 11px; text-transform: uppercase; }
.fee-table tfoot td { font-weight: 700; background: #f0f7ff; color: #0b4da2; }
.fee-table input[type="text"], .fee-table input[type="number"], .fee-table select { border: none; background: transparent; width: 100%; font-size: 12px; padding: 2px 4px; }
.fee-table input[type="text"]:focus, .fee-table input[type="number"]:focus, .fee-table select:focus { outline: 1px solid #0b4da2; border-radius: 4px; }
.fee-pct-row { display: flex; align-items: center; gap: 3px; }
.fee-pct-input { width: 48px !important; flex-shrink: 0; color: #0b4da2; font-weight: 600; border: 1px solid #bfdbfe !important; border-radius: 4px; background: #eff6ff !important; padding: 2px 4px; }
.fee-pct-input:focus { outline: 1px solid #0b4da2; border-color: #0b4da2 !important; }
.fee-pct-label { font-size: 11px; color: #6b7280; flex-shrink: 0; }

.fee-table tr.fee-category-header td { background: #dbeafe; color: #1e40af; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 5px 8px; border-top: 1px solid #93c5fd; }
.fee-table .ai-filled { background: #f0fdf4; }
.fee-table td.ai-filled-cell { position: relative; }
.fee-table td.ai-filled-cell::after {
  content: 'AI';
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 9px;
  background: #16a34a;
  color: white;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

/* ─── Footer / LO Signature ─── */
.footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid #e5e7eb;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  font-size: 11px;
}

.lo-block { display: flex; align-items: center; gap: 14px; }

.lo-photo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #e5e7eb;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #e0e7ff;
}

.lo-photo img { width: 100%; height: 100%; object-fit: cover; }

.lo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 24px;
  font-weight: 700;
}

.lo-info .lo-name { font-weight: 800; color: #111827; font-size: 14px; }
.lo-info .lo-title { color: #6b7280; font-size: 12px; margin-bottom: 4px; }
.lo-info .lo-detail { color: #374151; font-size: 11px; line-height: 1.7; }
.lo-info .lo-detail a { color: #0b4da2; text-decoration: none; }

.disclaimer {
  max-width: 340px;
  font-size: 10px;
  color: #9ca3af;
  line-height: 1.5;
}

/* ─── Buttons ─── */
.buttons {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: #0b4da2; color: #fff; }
.btn-primary:hover { background: #0a3d82; box-shadow: 0 4px 12px rgba(11,77,162,0.3); }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-outline { background: transparent; color: #0b4da2; border: 1px solid #0b4da2; }
.btn-outline:hover { background: #0b4da2; color: #fff; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  max-width: 360px;
}

.toast.visible { opacity: 1; transform: translateY(0); }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }

/* ─── No LO selected state ─── */
.lo-placeholder-msg {
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
  padding: 10px 0;
}

/* ─── Responsive ─── */
@media (max-width: 700px) {
  .wrapper { padding: 20px 16px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .footer { flex-direction: column; }
  .disclaimer { max-width: 100%; }
}

/* ─── Top-bar custom select stretch ─── */
.top-bar .cs-wrapper { flex: 1; }

/* ─── Custom Searchable Select ─── */
.cs-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

.cs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #111827;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
  gap: 4px;
}

.cs-trigger:focus {
  outline: none;
  border-color: #0b4da2;
  box-shadow: 0 0 0 3px rgba(11,77,162,0.08);
}

.cs-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.cs-is-placeholder .cs-trigger-text { color: #9ca3af; }

.cs-trigger-arrow {
  flex-shrink: 0;
  color: #9ca3af;
  font-size: 10px;
  line-height: 1;
  transition: transform 0.15s;
}
.cs-open .cs-trigger-arrow { transform: rotate(180deg); }

.cs-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
  z-index: 600;
  overflow: hidden;
}

.cs-open .cs-dropdown { display: block; }

.cs-search {
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  font-family: inherit;
  background: #f9fafb;
  color: #111827;
  outline: none;
}

.cs-search:focus { background: #fff; }

.cs-list {
  max-height: 200px;
  overflow-y: auto;
}

.cs-option {
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #111827;
  transition: background 0.1s;
}

.cs-option:hover,
.cs-option.cs-focused { background: #eff6ff; color: #0b4da2; }

.cs-option.cs-selected { font-weight: 600; color: #0b4da2; }

.cs-option.cs-placeholder { color: #9ca3af; }

/* Compact variant — fee table & small contexts */
.cs-compact .cs-trigger {
  border: none;
  background: transparent;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  box-shadow: none;
}
.cs-compact .cs-trigger:focus { outline: 1px solid #0b4da2; box-shadow: none; }
.cs-compact .cs-trigger-arrow { display: none; }
.cs-compact .cs-dropdown {
  min-width: 110px;
  max-width: 200px;
}

/* ─── Print / PDF ─── */
@media print {
  body { background: white; padding: 0; display: block; }
  .side-nav, .main-content { display: block; padding: 0; }
  .side-nav { display: none !important; }
  .top-bar, .search-box, .buttons, .fetch-bar, .fetch-btn, .data-source-panel { display: none !important; }
  .wrapper { box-shadow: none; border-radius: 0; padding: 20px; }
}

/* ─── Admin page ─── */
.admin-wrapper {
  max-width: 860px;
  margin: 40px auto;
  width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  overflow: hidden;
}

.admin-header {
  background: #0b4da2;
  color: #fff;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header h1 { font-size: 18px; font-weight: 700; margin: 0; }
.admin-header .subtitle { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.admin-body { padding: 28px 32px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 24px;
}

.admin-table th, .admin-table td {
  border-bottom: 1px solid #f3f4f6;
  padding: 10px 12px;
  text-align: left;
}

.admin-table th { font-size: 11px; text-transform: uppercase; color: #9ca3af; font-weight: 600; }
.admin-table td { color: #374151; }
.admin-table tr:hover td { background: #fafafa; }

.admin-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.admin-table th.sortable-th:hover { color: #6b7280; }
.admin-table th.sortable-th.sort-active { color: #0b4da2; }
.sort-arrow { margin-left: 3px; font-style: normal; }

.admin-table .lo-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7eb;
  vertical-align: middle;
}

.admin-table .thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
  vertical-align: middle;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  width: 540px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal { position: relative; }

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.modal-close-btn:hover { color: #374151; background: #f3f4f6; }

.modal h2 { font-size: 17px; font-weight: 700; color: #111827; margin-bottom: 20px; }

.modal .field { margin-bottom: 14px; }
.modal .field label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #6b7280; margin-bottom: 4px; display: block; }
.modal .field input, .modal .field select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 13px;
}

.modal .field input:focus, .modal .field select:focus {
  outline: none;
  border-color: #0b4da2;
  box-shadow: 0 0 0 3px rgba(11,77,162,0.08);
}

.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ─── Admin Tabs ─── */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  background: #f8fafc;
  padding: 0 32px;
}

.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
}

.admin-tab:hover { color: #0b4da2; }
.admin-tab.active { color: #0b4da2; border-bottom-color: #0b4da2; }

/* ─── Report Stat Cards ─── */
.report-stat-card {
  background: #f8fafc;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px 20px;
}

.report-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 6px;
}

.report-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #111827;
  line-height: 1.1;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.85);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 36px 40px;
  width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box .login-logo { font-size: 32px; font-weight: 900; color: #0b4da2; margin-bottom: 8px; }
.login-box h2 { font-size: 16px; color: #374151; margin-bottom: 20px; font-weight: 600; }
.login-box input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  margin-bottom: 14px;
}
.login-box input:focus { outline: none; border-color: #0b4da2; }
.login-box .login-error { color: #dc2626; font-size: 12px; margin-top: 8px; }

.photo-preview {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e0e7ff;
  margin-top: 8px;
  display: none;
}

.btn-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.btn-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-sm { padding: 5px 12px; font-size: 11px; border-radius: 6px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ─── Preview Modal ─── */
.preview-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 0;
}
.preview-modal {
  display: flex; flex-direction: column;
  width: 100%; max-width: 980px; height: 100vh;
  background: #f1f5f9;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}
/* ─── Nav User Menu ─────────────────────────────────────────────────────────── */
.nav-user-menu { position: relative; }

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  text-align: left;
  transition: background 0.15s;
}
.nav-user-btn:hover { background: rgba(255,255,255,0.08); }

.nav-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.nav-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-user-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-admin-badge {
  display: none;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.nav-user-chevron {
  flex-shrink: 0;
  color: rgba(255,255,255,0.35);
  transition: transform 0.2s;
}
.nav-user-menu.open .nav-user-chevron { transform: rotate(180deg); }

/* Card-style popup */
.nav-user-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
  overflow: hidden;
  z-index: 500;
}
.nav-user-menu.open .nav-user-popup { display: block; }

.nav-user-popup-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.nav-user-popup-item:hover { background: #f0f7ff; color: #0b4da2; }
.nav-user-popup-item + .nav-user-popup-item { border-top: 1px solid #f3f4f6; }

.nav-user-popup-logout { color: #dc2626; }
.nav-user-popup-logout:hover { background: #fef2f2; color: #b91c1c; }

/* Keep old sub-link styles for backward compat on any remaining usage */
.nav-user-sub {
  display: none;
  flex-direction: column;
  padding: 4px 0 2px;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: 2px;
}
.nav-user-menu.open .nav-user-sub { display: flex; }

.nav-user-sub-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 12px;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
  text-align: left;
}
.nav-user-sub-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-user-sub-logout { color: rgba(248,113,113,0.8); }
.nav-user-sub-logout:hover { color: #fca5a5; background: rgba(239,68,68,0.12); }

.preview-toolbar {
  display: flex; align-items: center; gap: 12px;
  background: #0b4da2; color: #fff;
  padding: 10px 16px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.preview-toolbar-title {
  flex: 1; font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
.preview-toolbar-actions { display: flex; gap: 8px; }
.preview-toolbar-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.preview-close-btn { background: rgba(255,255,255,0.15); color: #fff; }
.preview-close-btn:hover { background: rgba(255,255,255,0.28); }
.preview-print-btn { background: rgba(255,255,255,0.15); color: #fff; }
.preview-print-btn:hover { background: rgba(255,255,255,0.28); }
.preview-email-btn { background: rgba(255,255,255,0.15); color: #fff; }
.preview-email-btn:hover { background: rgba(255,255,255,0.28); }
.preview-email-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.preview-download-btn { background: #fff; color: #0b4da2; }
.preview-download-btn:hover { background: #dbeafe; }
.preview-download-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.preview-body {
  flex: 1; overflow-y: auto;
  padding: 32px 24px;
  display: flex; justify-content: center;
}
#previewContent {
  width: 900px; max-width: 100%; background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border-radius: 4px;
}
