/* Minimal base styles for CMMC Copilot */
:root {
  /* Base palette (legacy dark defaults) */
  --bg: #0b0c10;
  --panel: #151820;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --link: #60a5fa;
  --accent: #22c55e;

  /* Light theme utilities for app pages */
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --surface-info: #e3f2fd;
  --surface-warning: #fff3cd;
  --surface-success: #d4edda;
  --surface-danger: #f8d7da;
  --surface-page: #f5f5f5;
  --border: #dee2e6;
  --border-strong: #c3cfe0;
  --border-light: #dddddd;
  --text-dark: #333333;
  --text-muted-dark: #666666;
  --primary: #0066cc;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
  --purple: #6f42c1;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Header nav removed - using .nav-bar styling instead */
main {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 12px;
}

p {
  color: var(--muted);
}

form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input,
button {
  font: inherit;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  background: #0f1219;
  color: var(--text);
  border: 1px solid #242938;
  border-radius: 6px;
  padding: 10px 12px;
}

input[type="text"][readonly],
input[type="number"][readonly],
input[type="date"][readonly],
textarea[readonly],
select:disabled {
  color: var(--text-dark);
}

button {
  background: var(--link);
  color: #0b0c10;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

.error {
  color: #f87171;
}

/* Tooltip helpers */
.info-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  background: #6c757d;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  cursor: help;
  position: relative;
  vertical-align: middle;
}

.info-icon:focus {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
}

.tooltip {
  display: none;
  position: absolute;
  background: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  width: 220px;
  z-index: 1000;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  white-space: normal;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tooltip::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #333;
}

.info-icon:hover .tooltip,
.info-icon:focus .tooltip,
.info-icon:focus-visible .tooltip {
  display: block;
}

.hover-shadow {
  transition: box-shadow 0.2s;
}

.hover-shadow:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .tooltip {
    left: auto;
    right: calc(100% + 8px);
    width: 180px;
  }

  .tooltip::before {
    right: auto;
    left: 100%;
    border-right-color: transparent;
    border-left-color: #333;
  }
}

/* Layout */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.page-container--xl {
  max-width: 1400px;
}

.page-container--lg {
  max-width: 1200px;
}

.page-container--md {
  max-width: 900px;
}

.page-title {
  margin: 0 0 10px 0;
  font-size: 32px;
  color: var(--text-dark);
}

.page-title--compact {
  margin-bottom: 0;
}

.page-subtitle {
  color: var(--text-muted-dark);
}

.section {
  margin-bottom: 30px;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-between-start {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.catalog-typeahead {
  position: relative;
}

.catalog-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  z-index: 20;
}

.catalog-result {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.catalog-result:hover,
.catalog-result.is-active {
  background: var(--surface-muted);
}

.catalog-result--add {
  color: var(--primary);
  font-weight: 500;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 10px;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-info);
  border: 1px solid #90caf9;
  border-radius: 6px;
  padding: 10px 15px;
  margin-bottom: 15px;
}

.catalog-bulk-check {
  margin-right: 10px;
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.catalog-bulk-delete-btn {
  color: var(--danger) !important;
}

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

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

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  color: var(--text-muted-dark);
}

.modal-close:hover {
  color: var(--text-dark);
}

.modal-body {
  padding: 20px;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 540px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    border-radius: 14px 14px 0 0;
    max-width: 100%;
    max-height: 85dvh;
  }
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-start {
  align-items: flex-start;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: end;
}

.gap-5 {
  gap: 5px;
}

.gap-8 {
  gap: 8px;
}

.gap-10 {
  gap: 10px;
}

.gap-12 {
  gap: 12px;
}

.gap-15 {
  gap: 15px;
}

.gap-20 {
  gap: 20px;
}

.col-gap-30 {
  column-gap: 30px;
}

.col-gap-40 {
  column-gap: 40px;
}

.grid {
  display: grid;
}

.grid-auto-280 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-250 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-auto-320 {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-full-width {
  grid-column: 1 / -1;
}

/* Card + tile */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  color: var(--text-dark);
}

.card--compact {
  padding: 15px;
  border-radius: 6px;
}

.card--muted {
  background: var(--surface-muted);
}

.card--info {
  background: var(--surface-info);
  border-color: #90caf9;
}

.card--warning {
  background: var(--surface-warning);
  border-color: #ffeaa7;
}

.card--success {
  background: var(--surface-success);
  border-color: #c3e6cb;
}

.card--danger {
  background: var(--surface-danger);
  border-color: #f5c6cb;
}

.card-hover {
  transition: box-shadow 0.2s;
}

.card-hover:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-slide {
  transition: transform 0.1s;
}

.card-slide:hover {
  transform: translateX(4px);
}

.tile-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* Metrics */
.metric-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted-dark);
  text-transform: uppercase;
}

.metric-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.metric-value--info {
  color: #1976d2;
}

.metric-value--success {
  color: var(--success);
}

.metric-value--warning {
  color: #856404;
}

.metric-icon {
  font-size: 32px;
}

.metric-subtitle {
  font-size: 13px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 4px;
  border: none;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  /* font: inherit; */
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-warning {
  background: var(--warning);
  color: var(--text-dark);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-secondary {
  background: #6c757d;
  color: #ffffff;
}

.btn-teal {
  background: #17a2b8;
  color: #ffffff;
}

.btn-purple {
  background: var(--purple);
  color: #ffffff;
}

.btn-block {
  width: 100%;
}

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

.btn-loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn-loading::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  flex-shrink: 0;
}

.link-primary {
  color: var(--primary);
  text-decoration: none;
}

.link-primary:hover {
  text-decoration: underline;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-lg {
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 14px;
}

.badge--muted {
  background: #6c757d;
  color: #ffffff;
}

.badge--success {
  background: var(--success);
  color: #ffffff;
}

.badge--warning {
  background: var(--warning);
  color: var(--text-dark);
}

.badge--teal {
  background: #17a2b8;
  color: #ffffff;
}

.badge--blue {
  background: #007bff;
  color: #ffffff;
}

.badge--danger {
  background: var(--danger);
  color: #ffffff;
}

.badge--info {
  background: #e3f2fd;
  color: #1976d2;
}

.badge--purple {
  background: #f3e5f5;
  color: var(--purple);
}

.badge--orange {
  background: #fff3e0;
  color: #fd7e14;
}

/* Remediation status badges */
.badge--remediation-in_progress {
  background: #fff3e0;
  color: #e65100;
}

.badge--remediation-patched {
  background: var(--success);
  color: #ffffff;
}

.badge--remediation-removed {
  background: #6c757d;
  color: #ffffff;
}

.badge--remediation-risk_accepted {
  background: var(--warning);
  color: var(--text-dark);
}

/* Remediation action expand/collapse */
.remediation-action {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
}

.remediation-action summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
}

.remediation-action summary::-webkit-details-marker {
  display: none;
}

.remediation-action[open] summary {
  margin-bottom: 0;
}

.cmmc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: var(--cmmc-badge-bg, #6c757d);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.cmmc-badge__icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Policies */
.policy-icon-cell {
  width: 32px;
  text-align: center;
}

.policy-status-icon {
  font-size: 18px;
  color: var(--status-color, #2e7d32);
}

.policy-doc-desc {
  font-size: 13px;
}

.policy-template-chip {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  background: #e3f2fd;
  color: #1565c0;
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: middle;
  cursor: default;
}

.policy-l1-disclaimer {
  background: #fff8e1;
  border: 1px solid #f9a825;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 15px;
  font-size: 13px;
  color: #5d4037;
  line-height: 1.5;
}

.policy-hint {
  font-size: 13px;
  margin-bottom: 15px;
}

.policy-empty {
  font-size: 13px;
}

.policy-group-row {
  background: var(--bg-subtle, #f9fafb);
}

.policy-group-cell {
  padding: 8px 12px 6px;
  border-bottom: none;
}

.policy-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.policy-group-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
  margin: 0;
}

.policy-domain-abbr {
  font-family: monospace;
  background: var(--bg-subtle, #eef0f2);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 6px;
}

.policy-group-badge {
  font-size: 11px;
}

.policy-level-label {
  font-size: 14px;
  font-weight: 400;
}

.policy-cmmc-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #ffffff;
  background: var(--cmmc-chip-bg, #1565c0);
  white-space: nowrap;
}

.policy-cmmc-chip--l1 {
  --cmmc-chip-bg: #28a745;
}

.policy-cmmc-chip--l2 {
  --cmmc-chip-bg: #1565c0;
}

/* Forms */
.form-field {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-inline {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.form-inline__field {
  flex: 1;
  min-width: 220px;
}

.form-section {
  margin-bottom: 15px;
}

.form-help-text {
  margin: 0 0 10px 0;
  font-size: 13px;
}

.form-hint {
  font-size: 13px;
  color: var(--text-muted-dark);
  margin-top: 4px;
  margin-bottom: 0;
}

.input {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--surface);
  font: inherit;
  padding: 10px;
  color: var(--text-dark);
  box-sizing: border-box;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.input-sm {
  padding: 5px 10px;
}

.input-wide {
  min-width: 250px;
}

.textarea-vertical {
  resize: vertical;
}

.textarea-monospace {
  font-family: monospace;
  font-size: 13px;
}

.textarea-inherit {
  font-family: inherit;
}

.input-file {
  margin-bottom: 15px;
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-dark);
  font-weight: 500;
}

.input-file:hover {
  border-color: var(--primary);
  background: var(--surface-info);
}

.input-file::-webkit-file-upload-button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 12px;
  font-weight: 600;
  font-size: 14px;
}

.input-file::-webkit-file-upload-button:hover {
  background: #0052a3;
}

.input-file::-moz-file-upload-button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 12px;
  font-weight: 600;
  font-size: 14px;
}

.input-file::file-selector-button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 12px;
  font-weight: 600;
  font-size: 14px;
}

/* Segmented Control */
.segmented-control {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-muted);
}

.segmented-control input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control label {
  padding: 8px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted-dark);
  background: transparent;
  border-right: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
  display: flex;
  gap: 0;
}

.segmented-control label:last-of-type {
  border-right: none;
}

.segmented-control input[type="radio"]:checked + label {
  background: var(--primary);
  color: #ffffff;
}

.segmented-control input[type="radio"]:focus + label {
  box-shadow: inset 0 0 0 2px rgba(0, 102, 204, 0.3);
}

/* Filters */
.filters {
  background: var(--surface-muted);
  padding: 15px;
  border-radius: 4px;
  display: flex;
  gap: 20px;
}

.filters form {
  max-width: unset;
}

/* Full-width embedded form — overrides default form display:grid / max-width:420px */
.form-full {
  display: block;
  max-width: none;
}

/* Inline action form (e.g. a single submit button inside a flex row) */
.form-action {
  display: inline-block;
  max-width: none;
  margin: 0;
}

.filter-flex {
  flex: 1;
}

/* Callouts + Empty */
.callout {
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.callout--info {
  background: #e7f3ff;
  border-left: 3px solid #2196f3;
  color: #1976d2;
}

.callout--primary {
  background: var(--surface-muted);
  border-left: 4px solid var(--primary);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted-dark);
}

.empty-state-text {
  font-size: 18px;
}

.empty-state-link {
  color: #0066cc;
  text-decoration: none;
}

/* Dividers */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 30px 0;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 10px;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 2px solid var(--border);
}

.table td {
  padding: 12px;
  color: var(--text-muted-dark);
  border-bottom: 1px solid #eee;
}

.table td.text-right,
.table th.text-right {
  text-align: right;
}

.table td.text-center,
.table th.text-center {
  text-align: center;
}

/* Tabs */
.tabs {
  border-bottom: 2px solid var(--border);
  margin-bottom: 30px;
}

.tab-links {
  display: flex;
  gap: 5px;
}

.tab-link {
  padding: 12px 24px;
  text-decoration: none;
  color: var(--text-muted-dark);
  border-bottom: 3px solid transparent;
  font-weight: 400;
}

.tab-link.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Status + Chips */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot--fresh {
  background: var(--success);
}

.status-dot--expiring {
  background: var(--warning);
}

.status-dot--stale {
  background: var(--danger);
}

.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 4px;
  margin-bottom: 4px;
}

.chip--primary {
  background: #e3f2fd;
  color: #1976d2;
  font-weight: 500;
}

.chip--neutral {
  background: #e9ecef;
  color: var(--text-muted-dark);
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 25px;
}

.panel-title {
  margin: 0 0 20px 0;
  font-size: 20px;
  color: var(--text-dark);
}

/* Navigation */
.nav-bar {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  gap: 30px;
}

.nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.nav-list a {
  color: var(--text-dark);
  text-decoration: none;
  padding: 10px 6px;
  display: inline-block;
}

.nav-list a:hover {
  color: var(--primary);
}

.nav-spacer {
  margin-left: auto;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  color: var(--text-muted-dark);
  font-size: 14px;
  border-left: 1px solid var(--border);
}

.nav-user-name {
  color: var(--text-dark);
  font-weight: 500;
}

.nav-user-email {
  font-weight: 500;
  color: var(--text-dark);
}

.nav-role {
  padding: 2px 6px;
  background: #e3f2fd;
  color: #1976d2;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.nav-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  background: var(--danger);
  color: #ffffff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-overlay.modal-overlay--active {
  display: block;
}

.modal {
  position: relative;
  max-width: 600px;
  margin: 50px auto;
  background: var(--surface);
  border-radius: 8px;
  padding: 30px;
  color: var(--text-dark);
}

.modal-title {
  margin: 0 0 20px 0;
}

.modal-close {
  position: absolute;
  right: 15px;
  top: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

/* Login Page */
.login-body {
  background: var(--surface-page) !important;
  color: var(--text-dark) !important;
}

.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-container .logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-container .logo img {
  max-height: 48px !important;
  width: auto !important;
  max-width: 100%;
  display: inline-block;
}

.login-container label {
  color: var(--text-dark) !important;
  display: block !important;
}

.login-container h1 {
  color: var(--text-dark) !important;
}

.login-title {
  text-align: center;
  margin-bottom: 30px;
  color: var(--text-dark);
}

.login-error {
  color: #dc3545;
  text-align: center;
  margin-bottom: 20px;
}

.login-success {
  color: #28a745;
  text-align: center;
  margin-bottom: 20px;
  padding: 12px;
  background: #d4edda;
  border-radius: 4px;
}

.signup-subtitle {
  text-align: center;
  color: var(--text-muted-dark);
  margin-top: -20px;
  margin-bottom: 30px;
  font-size: 15px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted-dark);
  font-size: 14px;
}

.auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-link:hover {
  text-decoration: underline;
}

.login-sso-container,
.signup-sso-container {
  margin-bottom: 30px;
}

.signup-sso-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted-dark);
  margin-top: 8px;
  margin-bottom: 0;
}

.login-sso-button {
  display: block;
  width: 100%;
  padding: 12px;
  background: #2f2f2f;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.2s;
}

.login-sso-button:hover {
  background: #3f3f3f;
}

.login-sso-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 8px;
}

.login-divider {
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted-dark);
  position: relative;
}

.login-divider-text {
  background: var(--surface-page);
  padding: 0 10px;
  position: relative;
  z-index: 1;
}

.login-divider-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-light);
  z-index: 0;
}

.btn-submit {
  width: 100%;
  padding: 12px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  box-sizing: border-box;
  /* font: inherit; */
  font-weight: 500;
  transition: background 0.2s;
}

.btn-submit:hover {
  background: #45a049;
}

/* Dashboard */
.item-flex {
  flex: 1;
}

.item-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-dark);
}

.item-meta {
  font-size: 13px;
  color: var(--text-muted-dark);
}

.expiration-status {
  font-size: 20px;
  font-weight: 700;
}

.expiration-status--expired {
  color: #721c24;
}

.expiration-status--today {
  color: #856404;
}

.expiration-status--warning {
  color: #856404;
}

.expiration-status--success {
  color: #155724;
}

.expiration-detail {
  font-size: 12px;
}

.expiration-detail--expired {
  color: #721c24;
}

.expiration-detail--muted {
  color: var(--text-muted-dark);
}

.section-header {
  margin-bottom: 20px;
}

.section-header-title {
  margin-bottom: 0;
}

.section-header-link {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

/* Evidence page */
.evidence-card-header {
  margin-bottom: 12px;
}

.evidence-card-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #0066cc;
}

.evidence-card-description {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text-muted-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.evidence-card-reviewer {
  margin-bottom: 12px;
}

.evidence-card-controls {
  margin-bottom: 12px;
}

.evidence-card-meta {
  font-size: 13px;
  color: var(--text-muted-dark);
  margin-bottom: 10px;
}

.evidence-card-tags {
  margin-bottom: 10px;
}

.evidence-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.evidence-detail__back {
  margin-bottom: 20px;
}

.evidence-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 20px;
}

.evidence-detail__title {
  margin: 0 0 10px 0;
}

.evidence-detail__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.evidence-section {
  margin-bottom: 20px;
}

.evidence-section--lg {
  margin-bottom: 30px;
}

.evidence-status-badge {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 12px;
}

.evidence-freshness {
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.evidence-freshness--fresh {
  background: var(--surface-success);
  border-color: #c3e6cb;
  color: #155724;
}

.evidence-freshness--expiring {
  background: var(--surface-warning);
  border-color: #ffeaa7;
  color: #856404;
}

.evidence-freshness--stale {
  background: var(--surface-danger);
  border-color: #f5c6cb;
  color: #721c24;
}

.evidence-freshness__title {
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 15px;
}

.evidence-freshness__detail {
  font-size: 14px;
  font-weight: 500;
}

.evidence-viewer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 20px;
  overflow: hidden;
}

.evidence-viewer__header {
  background: var(--surface-muted);
  padding: 10px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.evidence-viewer__title {
  font-weight: 500;
}

.evidence-viewer__content {
  min-height: 400px;
  max-height: 800px;
  overflow: auto;
}

.evidence-viewer__pdf {
  width: 100%;
  height: 800px;
  border: 0;
  display: block;
}

.evidence-viewer__image-wrap {
  padding: 20px;
  text-align: center;
  background: var(--surface-muted);
}

.evidence-viewer__image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.evidence-viewer__text-wrap {
  padding: 20px;
  background: var(--surface-muted);
}

.evidence-viewer__code {
  background: var(--surface);
  padding: 15px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dark);
}

.evidence-viewer-message {
  padding: 40px;
  text-align: center;
  color: var(--text-muted-dark);
}

.evidence-viewer-message--error {
  color: var(--danger);
}

.evidence-viewer-message__title {
  font-size: 18px;
  margin-bottom: 10px;
}

.evidence-viewer-message__detail {
  font-size: 14px;
  margin-bottom: 20px;
}

.evidence-info {
  background: var(--surface-muted);
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.evidence-info__title {
  margin-top: 0;
  margin-bottom: 10px;
}

.evidence-info__body {
  font-size: 14px;
  color: var(--text-muted-dark);
}

.evidence-info__row {
  margin-bottom: 5px;
}

.evidence-hash {
  font-size: 11px;
  background: var(--surface);
  padding: 2px 4px;
  border-radius: 2px;
}

.evidence-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-tag {
  display: inline-block;
  padding: 6px 12px;
  background: #495057;
  color: #ffffff;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.evidence-tag--editable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.evidence-tag__remove {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0.8;
  padding: 0;
}

.evidence-tag__remove:hover,
.evidence-tag__remove:focus-visible {
  opacity: 1;
}

.evidence-version {
  background: var(--surface-muted);
  padding: 15px;
  border-radius: 4px;
}

.evidence-version__title {
  margin-top: 0;
}

.evidence-meta {
  font-size: 14px;
  color: var(--text-muted-dark);
  margin-bottom: 5px;
}

.evidence-meta__small {
  font-size: 12px;
  color: var(--text-muted-dark);
}

.review-status {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 15px;
  color: var(--text-dark);
}

.review-notes {
  margin-top: 10px;
  padding: 10px;
  background: var(--surface);
  border-radius: 4px;
}

.review-timeline {
  position: relative;
  padding-left: 30px;
}

.review-timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.review-timeline-entry {
  position: relative;
  margin-bottom: 15px;
  padding-bottom: 15px;
}

.review-timeline-entry--border {
  border-bottom: 1px solid #f0f0f0;
}

.review-timeline-marker {
  position: absolute;
  left: -26px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid;
  background: var(--surface);
}

.review-timeline-marker--approved {
  border-color: var(--success);
}

.review-timeline-marker--rejected {
  border-color: var(--danger);
}

.review-timeline-marker--request {
  border-color: #ff9800;
}

.review-timeline-marker--info {
  border-color: #17a2b8;
}

.review-timeline-title {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.review-timeline-meta {
  font-size: 13px;
  color: var(--text-muted-dark);
  margin-bottom: 4px;
}

.review-timeline-notes {
  font-size: 13px;
  color: var(--text-dark);
  margin-top: 6px;
  padding: 8px;
  background: var(--surface-muted);
  border-radius: 4px;
}

.card-title {
  margin: 0 0 10px 0;
  color: var(--text-dark);
  font-weight: 600;
}

/* Evidence tags chips */
.tags-chips-container {
  margin-top: 8px;
  min-height: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: #e9ecef;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-dark);
}

.tag-chip__remove {
  background: none;
  border: none;
  margin-left: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted-dark);
  padding: 0;
}

.tag-chip__remove:hover,
.tag-chip__remove:focus-visible {
  color: var(--text-dark);
}

/* Control list */
.control-list {
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 10px;
  background: var(--surface);
}

.control-list-item {
  display: block;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dark);
}

.control-list-checkbox {
  margin-right: 8px;
  cursor: pointer;
}

/* Controls page */
.controls-domain-header {
  margin-bottom: 15px;
  padding: 10px 15px;
  font-size: 18px;
}

.control-card-content {
  flex: 1;
}

.control-card-title {
  margin: 0 0 8px 0;
  color: #0066cc;
}

.control-card-subtitle {
  margin: 0 0 8px 0;
  font-weight: 500;
}

.control-card-description {
  margin: 0;
  color: var(--text-muted-dark);
  font-size: 14px;
}

.control-card-status {
  margin-left: 20px;
  text-align: right;
  min-width: 150px;
}

.status-badge {
  margin-bottom: 8px;
  display: inline-block;
}

.badge--reviewed {
  background: #17a2b8;
  color: #fff;
}

.badge--implemented {
  background: #007bff;
  color: #fff;
}

.control-meta-item {
  font-size: 12px;
  color: var(--text-muted-dark);
  margin-top: 4px;
}

/* Exports page */
.export-header {
  gap: 10px;
  margin-bottom: 6px;
}

.export-id {
  font-weight: 600;
  margin-right: 10px;
  color: var(--text-dark);
}

.export-item-divider {
  border-bottom: 1px solid var(--border);
}

.export-item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  margin-right: 12px;
}

.export-status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.export-status-badge--completed {
  background: var(--success);
  color: white;
}

.export-status-badge--generating {
  background: var(--warning);
  color: #333;
}

.export-status-badge--failed {
  background: var(--danger);
  color: white;
}

.export-item-meta {
  font-size: 14px;
  color: var(--text-muted-dark);
  margin-bottom: 8px;
}

.export-item-details {
  font-size: 13px;
  color: var(--text-muted-dark);
}

.export-download-button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.export-view-button {
  padding: 8px 16px;
  background: #6c757d;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.exports-empty-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.exports-info-item-title {
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--primary);
}

.exports-info-note {
  margin-top: 20px;
  padding: 15px;
  background: var(--surface);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
}

/* Scope page */
.scope-text-normal {
  margin: 0;
  line-height: 1.6;
}

.scope-text-italic {
  margin: 0;
  font-style: italic;
}

.scope-distribution-item {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.scope-distribution-value {
  font-weight: 600;
  color: var(--text-dark);
}

.scope-form-help {
  margin: 5px 0 0 0;
  font-size: 13px;
}

.scope-form-help-small {
  margin: 5px 0 0 0;
  font-size: 12px;
}

/* Import form */
.import-form {
  display: none;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.import-form.import-form--active {
  display: block;
}

.import-form-title {
  margin: 0 0 5px 0;
  font-size: 16px;
  color: var(--text-dark);
}

.import-form-help {
  margin: 0 0 10px 0;
  font-size: 13px;
}

.add-asset-header {
  margin-bottom: 20px;
}

.add-asset-title {
  margin-bottom: 0;
}

/* Progress bars */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.3s;
}

.progress-fill--success {
  background: var(--success);
}

.progress-fill--warning {
  background: var(--warning);
}

.progress-fill--empty {
  background: transparent;
}

/* Getting Started checklist */
.setup-steps {
  display: grid;
  gap: 8px;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  font-size: 14px;
  color: var(--text-dark);
}

.setup-step--done {
  background: var(--surface-success);
  border-color: #c3e6cb;
  color: var(--text-muted-dark);
}

.setup-step__icon {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted-dark);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.setup-step--done .setup-step__icon {
  color: var(--success);
}

/* Domain stats */
.domain-stats {
  display: grid;
  gap: 14px;
}

.domain-stat__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

/* Misc utilities */
.text-muted-dark {
  color: var(--text-muted-dark);
}

.text-primary {
  color: var(--primary);
}

.text-purple {
  color: var(--purple);
}

.text-orange {
  color: #fd7e14;
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: #856404;
}

.text-danger {
  color: #721c24;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-sm {
  font-size: 12px;
}

.text-md {
  font-size: 14px;
}

.fs-13 {
  font-size: 13px;
}

.fs-14 {
  font-size: 14px;
}

.fs-18 {
  font-size: 18px;
}

.fs-28 {
  font-size: 28px;
}

.lh-16 {
  line-height: 1.6;
}

.font-weight-500 {
  font-weight: 500;
}

.font-weight-600 {
  font-weight: 600;
}

.font-weight-700 {
  font-weight: 700;
}

.font-mono {
  font-family: monospace;
}

.text-dark {
  color: var(--text-dark);
}

.link-plain {
  text-decoration: none;
}

.flex-1 {
  flex: 1;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.whitespace-nowrap {
  white-space: nowrap;
}

.user-select-none {
  user-select: none;
}

.cursor-pointer {
  cursor: pointer;
}

.cursor-default {
  cursor: default;
}

.sort-icon {
  margin-left: 4px;
}

.sort-icon--dim {
  opacity: 0.3;
}

.patch-section-title {
  margin: 0 0 15px 0;
  font-size: 18px;
}

.patch-section-title--danger {
  color: var(--danger);
}

.patch-section-title--warning {
  color: var(--warning);
}

.patch-section-title--muted {
  color: #6c757d;
}

.card-border-left {
  border-left-width: 4px;
  border-left-style: solid;
}

.card-border-left.card--danger {
  border-left-color: var(--danger);
}

.card-border-left.card--warning {
  border-left-color: var(--warning);
}

.card-border-left.card--muted {
  border-left-color: #6c757d;
}

.color-error {
  color: #dc3545;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-5 {
  margin-bottom: 5px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-15 {
  margin-bottom: 15px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mb-30 {
  margin-bottom: 30px;
}

.mt-4 {
  margin-top: 4px;
}

.mt-15 {
  margin-top: 15px;
}

.mt-20 {
  margin-top: 20px;
}

.my-5 {
  margin-top: 5px;
  margin-bottom: 5px;
}

.ml-15 {
  margin-left: 15px;
}

.inventory-help-spacer {
  margin-top: 8px;
}

.inventory-preview-panel {
  display: none;
  margin-top: 20px;
}

.inventory-preview-actions {
  margin-top: 12px;
}

.inventory-help-caption {
  font-size: 12px;
  margin-top: 6px;
}

.inventory-quick-add-note {
  margin: 0 0 10px 0;
  font-size: 13px;
}

.inventory-modal-intro {
  margin: 0 0 16px;
  font-size: 13px;
}

.inventory-modal-error {
  margin-top: 12px;
  display: none;
}

.ml-20 {
  margin-left: 20px;
}

.w-200 {
  width: 200px;
}

.is-hidden {
  display: none;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-page {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface-muted);
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}

.btn-page:hover:not(:disabled):not(.btn-page--ellipsis) {
  background: #e2e6ea;
  border-color: #adb5bd;
}

.btn-page.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-page:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn-page--ellipsis {
  border: none;
  background: transparent;
  cursor: default;
  color: var(--text-muted-dark);
  padding: 0 4px;
  min-width: auto;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted-dark);
  text-align: center;
  margin-top: 6px;
}

/* ============ Detail page components ============ */

/* Section h3 with blue border for form panels */
.form-section-heading {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: var(--text-muted-dark);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
}

/* Read-only pill display for boolean/value fields */
.readonly-value {
  display: inline-block;
  padding: 8px 16px;
  background: var(--surface-muted);
  border-radius: 4px;
  color: var(--text-dark);
}

/* Disabled/readonly input background */
.input--readonly {
  background: var(--surface-muted) !important;
}

/* Metadata key-value row with separator */
.metadata-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.metadata-row:last-child {
  border-bottom: none;
}

/* CMMC L1 Health check list */
.cmmc-health-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cmmc-health-check {
  display: grid;
  grid-template-columns: 20px 90px 1fr;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 12px;
  background: var(--surface-muted);
  border-radius: 6px;
  font-size: 14px;
}

.cmmc-health-check__note {
  grid-column: 2 / -1;
  color: var(--text-muted-dark);
  font-size: 13px;
}

@media (max-width: 600px) {
  .cmmc-health-check {
    grid-template-columns: 20px 1fr;
  }
  .cmmc-health-check__practice {
    display: none;
  }
  .cmmc-health-check__note {
    grid-column: 2 / -1;
  }
}

/* Collapsible sub-form container */
.subsection {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}
