:root {
  color-scheme: light;
  --ink: #172a3a;
  --muted: #4c6072;
  --line: #d1dbe4;
  --surface: #fff;
  --paper: #f1f5f9;
  --primary: #205788;
  --primary-dark: #16446e;
  --selected: #dfecf8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
header {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  padding: 5px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
header form { margin: 0 0 0 auto; }
header button {
  color: var(--primary);
  background: var(--surface);
  border-color: var(--line);
}
header button:hover { color: var(--ink); background: var(--selected); }
.brand { color: var(--ink); font-size: 19px; font-weight: 750; text-decoration: none; }
.dot { color: var(--primary); }
.main-nav, .mode-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.main-nav a, .mode-nav a {
  padding: 5px 9px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
}
[aria-current="page"] { background: var(--selected); font-weight: 650; }
main { max-width: 1680px; margin: auto; padding: 0 24px 20px; }
.intro, .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.intro { margin: 12px 0 8px; }
h1 { font-size: 24px; line-height: 1.15; margin: 0; }
h2 { font-size: 17px; line-height: 1.2; margin: 0 0 7px; }
.section-heading h2, .connection h2 { margin: 0; }
h3 { font-size: 15px; margin: 8px 0 3px; }
p { margin: 0 0 6px; }
a { color: var(--primary-dark); text-underline-offset: 2px; }
.notice, .error {
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 1px solid #c9deef;
  border-radius: 4px;
  background: #edf5fc;
  font-size: 13px;
}
.notice p:last-child { margin-bottom: 0; }
.error { border-color: #e4b6b2; background: #fff2f1; color: #822f2c; }
.panel {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.panel>p, .results>p { color: var(--muted); }
.connection { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 14px; }
.connection p { margin: 0; }
.upload {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 1fr);
  align-items: start;
  gap: 12px 24px;
}
label { display: block; margin: 0 0 3px; font-size: 12px; font-weight: 650; }
input, textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid #9fadb9;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input[type="file"] { padding: 4px; margin-bottom: 6px; }
input[type="file"]::file-selector-button {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
textarea { height: 49px; min-height: 44px; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 6px; margin: 0; }
button {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  font: 650 13px/1.4 system-ui, sans-serif;
  cursor: pointer;
}
button:hover { background: var(--primary-dark); }
button:disabled { color: #526673; background: #e1e8ee; cursor: default; }
:where(button, a, input, textarea, select):focus-visible { outline: 2px solid #1668a8; outline-offset: 2px; }
small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.edit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px 12px; margin-top: 8px; }
.wide { grid-column: 1 / -1; }
.action, .table-actions { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.action { padding-top: 6px; border-top: 1px solid var(--line); }
.results { padding: 5px 0; }
.group-key { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 7px 0; }
.group-key span { padding: 5px 8px; background: var(--selected); border-radius: 4px; font-size: 12px; }
.table-actions { align-items: end; margin: 6px 0; }
.table-actions label { margin: 0; }
.table-wrap { overflow-x: auto; margin-bottom: 8px; }
.table-wrap table { width: 100%; min-width: 680px; border-collapse: collapse; background: var(--surface); }
.table-wrap th, .table-wrap td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table-wrap th { background: #e4ecf4; }
.table-wrap details { min-width: 10rem; }
.table-wrap summary { cursor: pointer; }
.login { width: min(100%, 410px); padding-top: 20px; }
.login h1 { margin-bottom: 10px; }
.login label { margin-bottom: 8px; }
.login input { margin-top: 3px; }
main > .panel:first-child { margin-top: 12px; }

.file-action, .search-action {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 6px 12px;
}
.file-action { margin: 6px 0; }
.file-action label, .search-action label { margin-bottom: 0; }
.file-action input[type="file"] { margin: 0; }
.file-field { flex: 0 1 330px; }
.application-title { margin: 8px 0 4px; font-weight: 650; }
.application-details summary { cursor: pointer; color: var(--primary-dark); }
.search-action input[type="number"] { display: block; max-width: 145px; }
.region-field { flex: 0 1 300px; }
.region-field small:empty { display: none; }
.search-action .check { align-self: center; }
.table-wrap details ul { margin: 5px 0; padding-left: 16px; }

@media (max-width: 900px) {
  .edit { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  main, header { padding-inline: 10px; }
  header { gap: 9px; }
  h1 { font-size: 20px; }
  .upload, .group-key { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .edit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 375px) {
  .edit { grid-template-columns: minmax(0, 1fr); }
}

.candidate-detail[open] { min-width: min(34vw, 440px); }
.candidate-detail q { color: var(--muted); }
#hh-upload-status { color: var(--muted); }
