/* ==========================================================================
   PROJECT NEMESIS — GLOBAL FUNDING INTELLIGENCE & CAPITAL ACQUISITION SYSTEM
   Stylesheet: src/public/nemesis-funding-admin.css
   Supports Light Default Theme (html.light) & Dark Theme Option (html.dark)
   Compact enterprise forensic intelligence aesthetic — zero decorative fluff
   ========================================================================== */

:root,
html.light {
  --fnd-bg: #f8fafc;
  --fnd-surface: #ffffff;
  --fnd-surface-alt: #f1f5f9;
  --fnd-border: #cbd5e1;
  --fnd-border-subtle: #e2e8f0;
  --fnd-text: #0f172a;
  --fnd-text-secondary: #334155;
  --fnd-text-muted: #64748b;
  --fnd-accent: #0284c7;
  --fnd-accent-strong: #0369a1;
  --fnd-accent-soft: #e0f2fe;
  --fnd-navy: #0a2540;
  --fnd-ok-bg: #dcfce7;
  --fnd-ok-text: #166534;
  --fnd-warn-bg: #fef3c7;
  --fnd-warn-text: #92400e;
  --fnd-err-bg: #fee2e2;
  --fnd-err-text: #991b1b;
  --fnd-info-bg: #e0f2fe;
  --fnd-info-text: #075985;
}

html.dark,
html[data-theme="dark"] {
  --fnd-bg: #040814;
  --fnd-surface: #0b1120;
  --fnd-surface-alt: #111a2e;
  --fnd-border: #1e293b;
  --fnd-border-subtle: #172033;
  --fnd-text: #f1f5f9;
  --fnd-text-secondary: #cbd5e1;
  --fnd-text-muted: #94a3b8;
  --fnd-accent: #38bdf8;
  --fnd-accent-strong: #0284c7;
  --fnd-accent-soft: rgba(56, 189, 248, 0.14);
  --fnd-navy: #070f26;
  --fnd-ok-bg: rgba(16, 185, 129, 0.16);
  --fnd-ok-text: #6ee7b7;
  --fnd-warn-bg: rgba(245, 158, 11, 0.16);
  --fnd-warn-text: #fcd34d;
  --fnd-err-bg: rgba(239, 68, 68, 0.18);
  --fnd-err-text: #fca5a5;
  --fnd-info-bg: rgba(56, 189, 248, 0.16);
  --fnd-info-text: #7dd3fc;
}

.fnd-shell {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fnd-text);
}

.fnd-panel {
  background: var(--fnd-surface);
  border: 1px solid var(--fnd-border);
  border-radius: 8px;
  padding: 14px 16px;
}

.fnd-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--fnd-border);
}

.fnd-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fnd-text);
  margin: 0;
}

.fnd-subtitle {
  font-size: 12px;
  color: var(--fnd-text-muted);
  margin: 2px 0 0 0;
}

.fnd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fnd-kpi {
  background: var(--fnd-surface);
  border: 1px solid var(--fnd-border);
  border-left: 3px solid var(--fnd-accent);
  border-radius: 6px;
  padding: 10px 12px;
}

.fnd-kpi-label {
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fnd-text-muted);
}

.fnd-kpi-val {
  font-size: 20px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fnd-text);
  margin-top: 3px;
}

.fnd-kpi-sub {
  font-size: 11px;
  color: var(--fnd-text-muted);
  margin-top: 2px;
}

.fnd-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.fnd-input,
.fnd-select,
.fnd-textarea {
  background: var(--fnd-surface);
  color: var(--fnd-text);
  border: 1px solid var(--fnd-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}

.fnd-input:focus,
.fnd-select:focus,
.fnd-textarea:focus {
  border-color: var(--fnd-accent);
}

.fnd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--fnd-border);
  background: var(--fnd-surface-alt);
  color: var(--fnd-text);
  text-decoration: none;
}

.fnd-btn:hover {
  border-color: var(--fnd-accent);
}

.fnd-btn-primary {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
}

.fnd-btn-primary:hover {
  background: #0369a1 !important;
}

.fnd-btn-success {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
}

.fnd-btn-danger {
  background: var(--fnd-err-bg);
  color: var(--fnd-err-text);
  border-color: transparent;
}

.fnd-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--fnd-border);
  border-radius: 6px;
  background: var(--fnd-surface);
}

.fnd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.fnd-table th {
  background: var(--fnd-surface-alt);
  color: var(--fnd-text-secondary);
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--fnd-border);
  white-space: nowrap;
}

.fnd-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--fnd-border-subtle);
  color: var(--fnd-text);
  vertical-align: top;
}

.fnd-table tr:hover td {
  background: var(--fnd-surface-alt);
}

.fnd-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.fnd-badge-ok { background: var(--fnd-ok-bg); color: var(--fnd-ok-text); }
.fnd-badge-warn { background: var(--fnd-warn-bg); color: var(--fnd-warn-text); }
.fnd-badge-err { background: var(--fnd-err-bg); color: var(--fnd-err-text); }
.fnd-badge-info { background: var(--fnd-info-bg); color: var(--fnd-info-text); }

.fnd-bar-row {
  display: grid;
  grid-template-columns: 165px 1fr 48px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  margin-bottom: 6px;
}

.fnd-bar-track {
  height: 9px;
  background: var(--fnd-surface-alt);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--fnd-border-subtle);
}

.fnd-bar-fill {
  height: 100%;
  background: #0284c7;
  border-radius: 3px;
}

.fnd-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.72);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.fnd-drawer-backdrop.open {
  display: flex;
}

.fnd-drawer-card {
  background: var(--fnd-surface);
  color: var(--fnd-text);
  border: 1px solid var(--fnd-border);
  border-radius: 10px;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
  .fnd-bar-row {
    grid-template-columns: 110px 1fr 38px;
  }
  .fnd-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #admin-sidebar:not(.sidebar-open-mobile) {
    display: none;
  }
  #admin-sidebar.sidebar-open-mobile {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 90;
    width: 268px !important;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  }
}

.fnd-subnav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 8px;
  margin-bottom: 12px;
  background: var(--fnd-surface);
  border: 1px solid var(--fnd-border);
  border-radius: 8px;
  scrollbar-width: thin;
}

.fnd-subnav-btn {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fnd-text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.fnd-subnav-btn:hover {
  background: var(--fnd-surface-alt);
  color: var(--fnd-text);
}

.fnd-subnav-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
}

/* Preserve crisp high-contrast sidebar text on dark #070d19 rail in Light Mode */
#admin-sidebar button[id^="nav-funding_"] {
  color: #e2e8f0 !important;
}
#admin-sidebar button[id^="nav-funding_"].nav-tab-active {
  color: #7dd3fc !important;
  background: rgba(2, 132, 199, 0.22) !important;
  border-color: rgba(56, 189, 248, 0.65) !important;
}
#admin-sidebar [data-funding-group-title="1"] {
  color: #38bdf8 !important;
}


