:root {
  --ink: #16212b;
  --ink-soft: #4a5b68;
  --line: #dde3e8;
  --panel: #ffffff;
  --bg: #f4f6f8;
  --brand: #1f4e78;
  --brand-dark: #163a58;
  --accent: #c96f3e;
  --ok: #1f7a4d;
  --warn: #b8862c;
  --bad: #b0392f;
  --radius: 6px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--brand-dark);
  color: #dce8f2;
  padding: 24px 16px;
}

.sidebar h1 {
  font-size: 1.05rem;
  color: #fff;
  margin: 0 0 24px;
  letter-spacing: 0.02em;
}

.sidebar a {
  display: block;
  color: #cfe0ee;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.sidebar a:hover, .sidebar a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1550px;
}

h2 { font-size: 1.5rem; margin: 0 0 6px; }
h3 { font-size: 1.1rem; margin: 24px 0 10px; color: var(--brand-dark); }
.subtitle { color: var(--ink-soft); margin-bottom: 24px; font-size: 0.95rem; }

.flash {
  background: #eaf3ea;
  border: 1px solid #b9d9bd;
  color: var(--ok);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

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

th {
  text-align: left;
  background: var(--brand);
  color: #fff;
  padding: 8px 10px;
  font-weight: 600;
  position: sticky;
  top: 0;
}

td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr:hover td { background: #f7fafc; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.secondary:hover { background: #eaf1f7; }
.btn.small { padding: 4px 10px; font-size: 0.8rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

.form-grid.full { grid-template-columns: 1fr; }

label {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 4px;
  font-weight: 600;
}

input[type=text], input[type=email], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
}

textarea { min-height: 70px; resize: vertical; }

.field { margin-bottom: 4px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge.ok { background: #e4f3e8; color: var(--ok); }
.badge.mismatch { background: #fbeae8; color: var(--bad); }
.badge.unknown { background: #f2f1e8; color: var(--warn); }

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  font-size: 0.88rem;
}

.filter-bar select { width: auto; }

.empty-state {
  color: var(--ink-soft);
  padding: 40px 0;
  text-align: center;
  font-size: 0.95rem;
}

.stat-row {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 110px;
}

.stat .n { font-size: 1.5rem; font-weight: 700; color: var(--brand-dark); }
.stat .label { font-size: 0.78rem; color: var(--ink-soft); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a {
  padding: 8px 16px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.88rem;
  border-bottom: 2px solid transparent;
}
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

@media print {
  .sidebar, .no-print { display: none; }
  main { max-width: 100%; padding: 0; }
}

/* Multi-select autocomplete widget */
.multiselect {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 8px;
  position: relative;
  background: #fff;
}
.ms-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.ms-chip {
  background: #eaf1f7;
  color: var(--brand-dark);
  border-radius: 20px;
  padding: 3px 6px 3px 10px;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
}
.ms-chip a { color: var(--brand-dark); text-decoration: none; margin-left: 6px; font-weight: bold; }
.ms-input {
  border: none !important;
  outline: none;
  padding: 4px 2px !important;
  font-size: 0.9rem;
  width: 100%;
}
.ms-dropdown {
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
}
.ms-option { padding: 7px 12px; font-size: 0.88rem; cursor: pointer; }
.ms-option:hover { background: #eaf1f7; }

/* Repeatable occupation rows */
.occ-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.occ-row input { flex: 1; }
.occ-row .remove-occ { color: var(--bad); text-decoration: none; font-size: 0.85rem; white-space: nowrap; }
