/*
 * Corporate / neutral theme layered on top of Bootstrap 5.
 * Keep this file small: brand colours, a few component tweaks, nothing exotic.
 */

:root {
  --brand-900: #1f2d3d;   /* navbar / headings */
  --brand-700: #2c4a6e;   /* primary accent */
  --brand-600: #34567a;
  --brand-500: #3f6592;   /* hover */
  --ink: #1f2933;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --canvas: #f4f6f9;
}

body.app-body {
  background: var(--canvas);
  color: var(--ink);
  font-size: 0.925rem;
}

/* Constrain very wide screens but stay fluid below. */
.app-container {
  max-width: 1440px;
}

/* ---- Navbar ---------------------------------------------------------- */
.app-navbar {
  background: var(--brand-900);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.18);
}

.app-navbar .navbar-brand {
  letter-spacing: 0.2px;
}

.app-navbar .nav-link {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
}

.app-navbar .nav-link:hover {
  color: #ffffff;
}

.app-navbar .nav-link.active {
  color: #ffffff;
  box-shadow: inset 0 -2px 0 #ffffff;
}

/* ---- Headings -------------------------------------------------------- */
.page-heading {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-heading h1 {
  color: var(--brand-900);
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
}

.page-heading .subtitle {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

/* ---- Cards / surfaces ------------------------------------------------ */
.card {
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-header {
  background: #f8fafc;
  color: var(--brand-900);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Stat / metric tiles */
.metric-card {
  color: inherit;
  display: block;
  text-decoration: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

a.metric-card:hover {
  border-color: var(--brand-500);
  box-shadow: 0 2px 8px rgba(44, 74, 110, 0.12);
}

.metric-card .metric-value {
  color: var(--brand-700);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

.metric-card .metric-label {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---- Tables ---------------------------------------------------------- */
.table {
  --bs-table-bg: var(--surface);
  margin-bottom: 0;
}

.table > thead th {
  background: #eef2f7;
  border-bottom: 1px solid var(--line);
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-card {
  overflow: hidden;
}

.table-card .table {
  border: 0;
}

/* ---- Brand-coloured primary ----------------------------------------- */
.btn-primary {
  --bs-btn-bg: var(--brand-700);
  --bs-btn-border-color: var(--brand-700);
  --bs-btn-hover-bg: var(--brand-500);
  --bs-btn-hover-border-color: var(--brand-500);
  --bs-btn-active-bg: var(--brand-900);
  --bs-btn-active-border-color: var(--brand-900);
}

a {
  color: var(--brand-700);
}

a:hover {
  color: var(--brand-500);
}

/* ---- Definition lists for detail pages ------------------------------ */
.field-list {
  display: grid;
  grid-template-columns: minmax(140px, 34%) 1fr;
  margin: 0;
}

.field-list dt,
.field-list dd {
  border-bottom: 1px solid var(--line);
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 0.55rem 0.85rem;
}

.field-list dt {
  color: var(--muted);
  font-weight: 600;
}

.field-list dt:nth-last-of-type(1),
.field-list dd:nth-last-of-type(1) {
  border-bottom: 0;
}

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

/* Flag tiles */
.flag-item {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
}

.flag-item.active {
  background: #e7f1ea;
  border-color: #b7d8c5;
  color: #1e6b46;
}

.comments {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  margin: 0;
  padding: 0.75rem;
  white-space: pre-wrap;
}

@media (max-width: 576px) {
  .field-list {
    grid-template-columns: 1fr;
  }

  .field-list dt {
    padding-bottom: 0;
  }
}
