/* Compliance Engine dashboard — clean, legible, honest about compliance state.
   Correctness of the display matters: each status category has a distinct, non-
   ambiguous colour, and "candidate" is never styled to look like "confirmed". */

:root {
  --bg: #0f1419;
  --surface: #171e26;
  --surface-2: #1f2833;
  --border: #2b3644;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4c8dff;
  --accent-ink: #0b1a33;

  --overdue: #ff5c5c;
  --open: #f0b429;
  --complied: #3fb950;
  --review: #a371f7;
  --cannot: #db6d28;
  --changed: #f778ba;

  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

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

.cite {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

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

.brand-mark {
  font-size: 28px;
  color: var(--accent);
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-msg {
  color: var(--muted);
  font-size: 12.5px;
}

/* ── Buttons ── */
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

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

/* ── Boundary banner (the legal boundary, stated up front) ── */
.boundary-banner {
  margin: 0;
  padding: 12px 24px;
  background: linear-gradient(90deg, rgba(76, 141, 255, 0.12), transparent);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}

.boundary-banner strong {
  color: var(--accent);
}

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 20px 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.panel h2,
.panel h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-head h3 {
  margin: 0;
}

/* ── Fleet roll-up ── */
.fleet-rollup table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.fleet-rollup th,
.fleet-rollup td {
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
}

.fleet-rollup th {
  color: var(--muted);
  font-weight: 500;
}

.fleet-rollup td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fleet-total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}

/* ── Aircraft list ── */
.aircraft-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aircraft-list li.item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.aircraft-list li.item:hover {
  border-color: var(--accent);
}

.aircraft-list li.item.selected {
  border-color: var(--accent);
  background: var(--surface-2);
}

.aircraft-list .nnum {
  font-weight: 650;
}

.aircraft-list .mm {
  color: var(--muted);
  font-size: 12.5px;
}

.aircraft-list .badges {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Detail ── */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.hidden {
  display: none !important;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.detail-head h2 {
  font-size: 20px;
}

.summary-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Chips / status pills ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.chip-overdue {
  color: var(--overdue);
  background: rgba(255, 92, 92, 0.12);
}
.chip-open {
  color: var(--open);
  background: rgba(240, 180, 41, 0.12);
}
.chip-complied {
  color: var(--complied);
  background: rgba(63, 185, 80, 0.12);
}
.chip-review {
  color: var(--review);
  background: rgba(163, 113, 247, 0.12);
}
.chip-cannot {
  color: var(--cannot);
  background: rgba(219, 109, 40, 0.12);
}
.chip-changed {
  color: var(--changed);
  background: rgba(247, 120, 186, 0.12);
}

.count-chip {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

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

.legend .chip {
  opacity: 0.85;
}

/* ── Status lines ── */
.status-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-line {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--surface-2);
}

.status-line.s-overdue {
  border-left-color: var(--overdue);
}
.status-line.s-open {
  border-left-color: var(--open);
}
.status-line.s-complied {
  border-left-color: var(--complied);
}
.status-line.s-requires_review {
  border-left-color: var(--review);
}
.status-line.s-cannot_compute {
  border-left-color: var(--cannot);
}
.status-line.s-changed {
  border-left-color: var(--changed);
}

.status-line .sl-label {
  font-size: 13px;
}

.status-line .sl-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.status-line .sl-due {
  text-align: right;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-right: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tag-confirmed {
  color: var(--complied);
  border-color: rgba(63, 185, 80, 0.4);
}

.tag-candidate {
  color: var(--open);
  border-color: rgba(240, 180, 41, 0.4);
}

.tag-actionable {
  color: var(--overdue);
  border-color: rgba(255, 92, 92, 0.4);
}

/* ── Candidates ── */
.candidates {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.candidate {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.candidate-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.candidate-head .adnum {
  font-weight: 650;
}

.candidate-verdict {
  font-size: 12px;
}

.evidence {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.evidence-item {
  font-size: 12px;
}

.evidence-item .matched {
  color: var(--text);
}

.evidence-item .adtext {
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

.confidence {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
}
.confidence.high {
  color: var(--complied);
}
.confidence.medium {
  color: var(--open);
}
.confidence.low {
  color: var(--cannot);
}

/* ── Confirm dialog ── */
.confirm-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: 520px;
  width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.confirm-dialog form {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.confirm-dialog label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
}

.confirm-dialog label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.confirm-dialog input,
.confirm-dialog select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
}

.confirm-dialog input[type="checkbox"] {
  width: auto;
}

.confirm-dialog fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-dialog legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.hint {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.confirm-error {
  color: var(--overdue);
  font-size: 12.5px;
  background: rgba(255, 92, 92, 0.1);
  border: 1px solid rgba(255, 92, 92, 0.3);
  border-radius: 7px;
  padding: 8px 10px;
  margin: 0;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .status-line {
    grid-template-columns: 1fr;
  }
  .status-line .sl-due {
    text-align: left;
  }
}
