:root {
  --navy: #0D2757;
  --navy-dark: #091b3d;
  --leaf: #56B847;
  --deep-green: #146C2E;
  --orange: #F27C22;
  --orange-dark: #d96a16;
  --white: #FFFFFF;
  --surface: #F8FAFC;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-muted: #64748B;

  /* Contrast-checked pairs (see tests/contrast.test.js). */
  --sidebar: #0D2757;
  --sidebar-bg: #0D2757;
  --sidebar-fg: #FFFFFF;
  --nav-active-bg: var(--orange);
  --nav-active-fg: #0D2757;
  --btn-primary-bg: var(--leaf);
  --btn-primary-fg: #0D2757;
  --btn-secondary-bg: var(--deep-green);
  --btn-secondary-fg: #FFFFFF;
}

* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', 'Roboto', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ---------- shared components ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
}

.btn-primary:hover {
  background: #4aa93d;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  border-color: var(--btn-secondary-bg);
}

.btn-secondary:hover {
  background: #11522a;
  border-color: #11522a;
}

.btn-green {
  background: var(--leaf);
  color: var(--navy);
}

.btn-green:hover {
  background: var(--deep-green);
  color: #fff;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.input,
.select,
.textarea {
  width: 100%;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s ease, background-color .15s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  background: var(--white);
  border-color: var(--navy);
  box-shadow: 0 0 0 1px var(--navy);
}

.input.invalid,
.select.invalid,
.textarea.invalid {
  border-color: #dc2626;
}

.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.table-wrap {
  overflow-x: auto;
}

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

table.data thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  white-space: nowrap;
}

table.data tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-green {
  background: #ecfdf3;
  color: var(--deep-green);
  border-color: #bbf7d0;
}

.badge-orange {
  background: #fff7ed;
  color: #b45309;
  border-color: #fed7aa;
}

.badge-slate {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.badge-red {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}

.metric-card .metric-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric-card .metric-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
  margin-top: 6px;
  line-height: 1.1;
}

.metric-card .metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .02em;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  width: 28px;
  height: 28px;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.empty-state span {
  font-size: 12px;
  margin-top: 4px;
}

.error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .15);
  box-shadow: 0 8px 24px rgba(13, 39, 87, .25);
  animation: toast-in .25s ease;
}

.toast.success {
  background: var(--deep-green);
}

.toast.error {
  background: #b91c1c;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .2);
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0 0 12px 12px;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  min-width: 200px;
  overflow: hidden;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--surface);
}