:root {
  color-scheme: light;
  --brand: #003976;
  --brand-hover: #082f5c;
  --ink: #142f4b;
  --muted: #52647a;
  --text: #273a4d;
  --canvas: #f4f7fa;
  --surface: #fff;
  --line: #d7e0e8;
  --control-line: #8293a3;
  --tint: #edf3fa;
  --link: #174f89;
  --focus: #1775bd;
  --radius: 12px;
  --field-height: 44px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  color: var(--text);
  background: var(--canvas);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; overflow-wrap: break-word; }
h1 { margin: 0; font-size: clamp(1.8rem, 2.5vw, 2.5rem); letter-spacing: -.035em; }
h2 { margin: 1.4em 0 .8em; font-size: 1.18rem; letter-spacing: -.014em; }
h3 { margin: 1.1em 0 .55em; font-size: 1rem; }
:lang(zh) :is(h1, h2, h3) { letter-spacing: 0; }
p { max-width: 82ch; margin: .55rem 0 1rem; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--brand-hover); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.skip {
  position: fixed;
  inset-block-start: .65rem;
  inset-inline-start: .65rem;
  z-index: 50;
  transform: translateY(-180%);
  padding: .6rem .9rem;
  color: var(--ink);
  background: white;
  border-radius: 6px;
}
.skip:focus { transform: translateY(0); }
.muted, small, .empty { color: var(--muted); }
small { font-size: .83em; }
.empty { padding-block: .375rem; }
hr { height: 0; border: 0; border-block-start: 1px solid var(--line); margin: 1.25rem 0; }
details { margin-block: .875rem; }
summary { cursor: pointer; font-weight: 600; }
code, pre {
  background: #edf2f6;
  border-radius: 4px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
pre { padding: .75rem; }
dl { display: grid; grid-template-columns: minmax(6rem, auto) 1fr; gap: .55rem 1rem; }
dt { font-weight: 600; }
dd { margin: 0; overflow-wrap: anywhere; }

.panel, .card, .auth-box {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel, article.card { margin-block: 1.15rem; padding: clamp(1rem, 2vw, 1.65rem); }
.card { padding: 1.125rem; }
.grid > .card, .cards > .card { margin: 0; }
.panel > :first-child, .card > :first-child { margin-block-start: 0; }
.panel > :last-child, .card > :last-child { margin-block-end: 0; }
.cards, .grid, .split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  align-items: start;
  gap: 1rem 1.25rem;
  min-width: 0;
}
.stack { display: grid; gap: .75rem; }
:is(.stack, .grid, .cards, .split) > * { min-width: 0; }
.card > .metric { font-size: 1.8rem; line-height: 1.25; font-weight: 700; }
.badge, .tag, .pill {
  display: inline-block;
  padding: .17rem .55rem;
  border-radius: 5px;
  color: #29547c;
  background: #eaf1f8;
  font-size: .8rem;
  font-weight: 600;
}
.notice, .callout, .alert {
  margin: .8rem 0 1rem;
  padding: .8rem 1rem;
  background: #edf4fc;
  color: #23496e;
  border-inline-start: 3px solid #4477aa;
  border-radius: 3px 8px 8px 3px;
}
.actions, .member-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .85rem;
  margin: .85rem 0;
}
.actions > h2 { margin: 0; }
form { min-width: 0; }
.actions form, .member-actions form { margin: 0; }

.button, .btn, button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 40px;
  max-width: 100%;
  padding: .5rem .95rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font: inherit;
  font-size: .875rem;
  font-weight: 630;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
:is(.button, .btn, button, input[type="submit"]):hover {
  color: #fff;
  background: var(--brand-hover);
}
:is(.button, .btn, button).secondary, .member-actions form button {
  color: #214c77;
  background: var(--surface);
  border-color: #bac8d4;
}
:is(.button, .btn, button).secondary:hover, .member-actions form button:hover {
  color: var(--brand);
  background: var(--tint);
  border-color: #96acc0;
}
button:disabled { opacity: .55; cursor: default; }
.button svg, button svg { flex: none; }
form > button { margin-block-start: 1rem; }
.actions button, .member-actions button { margin: 0; }

label { display: block; color: #304458; font-size: .875rem; font-weight: 600; }
.field {
  display: grid;
  align-content: start;
  gap: .375rem;
  min-width: 0;
  margin: 0 0 .875rem;
  line-height: 1.4;
}
.grid > .field, .stack > .field { margin: 0; }
.field > small, .field > .muted { font-weight: 400; }
:is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"]), select, textarea, .field output) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--field-height);
  max-width: 100%;
  margin: 0;
  padding: .6rem .76rem;
  background-color: white;
  border: 1px solid var(--control-line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  font-size: .9375rem;
  font-weight: 400;
  line-height: 1.4;
}
:is(input, textarea)::placeholder { color: #5f7082; opacity: 1; }
:where(input, textarea, select):focus { border-color: var(--focus); }
select:not([multiple]):not([size]) { padding-inline-end: 1.25rem; }
select[multiple] { padding: .35rem; }
select[multiple] option { padding: .25rem .4rem; }
input[type="file"] { padding: .45rem; }
textarea { min-height: 5.5rem; resize: vertical; }
.field output, input[readonly] {
  background: #f2f5f8;
  border-color: #d9e2ea;
  color: var(--muted);
}
.field output { display: flex; align-items: center; }
input[type="checkbox"], input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0 .25rem 0 0;
  accent-color: var(--brand);
  vertical-align: middle;
}
.agency-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 54rem;
  gap: 1.25rem 1.5rem;
}
.supplier-id-field { grid-column: 1 / -1; }
form:has(> .agency-fields) > button { margin-block-start: 1.5rem; }
.member-details { max-width: 42rem; }
.member-details .actions { margin: 1.35rem 0 0; }
.member-actions { gap: .4rem; margin: 0; }
.member-details [data-member-regions] .field { margin-block-end: .375rem; }
.button.member-remove, button.member-danger {
  border-color: #ceaaac;
  color: #932d37;
  background: #fff;
}
.button.member-remove:hover { color: #77232c; background: #fff1f2; }
button.member-danger { background: #98323b; color: white; border-color: #98323b; }
button.member-danger:hover { background: #762029; }
.fieldwork-methods, .method-filter { min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldwork-methods legend, .method-filter legend { padding: 0; color: #304458; font-size: .875rem; font-weight: 600; }
.method-options { display: flex; flex-wrap: wrap; gap: .35rem .65rem; margin: .45rem 0; }
.method-options label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 32px;
  padding: .125rem .45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
}
.method-options label:has(:checked) { color: var(--brand); background: var(--tint); border-color: #7798b8; }
progress { display: block; width: min(100%, 26rem); accent-color: var(--brand); }
.upload-status { margin-block: .625rem; color: var(--muted); font-size: .875rem; }

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
div.table-wrap {
  margin: .875rem 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  color: var(--text);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}
th, td {
  padding: .8rem 1rem;
  border-bottom: 1px solid #e1e7ec;
  text-align: start;
  vertical-align: middle;
  overflow-wrap: break-word;
}
th {
  color: #46596c;
  background: #f1f5f8;
  font-size: .8rem;
  font-weight: 650;
}
tbody tr:last-child td { border-block-end: none; }
tbody tr:hover { background: #f8fafc; }
td a:not(.button) { overflow-wrap: anywhere; }
td :is(.button, button) { padding: .34rem .65rem; min-height: 34px; font-size: .8125rem; }
td form { margin: .3rem 0; }
td form button { margin: 0; }
td small { display: inline-block; margin-top: .18rem; }

.directory-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: none;
  margin: 0 0 1rem;
  gap: .25rem .55rem;
}
.directory-tools a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 34px;
  padding: .26rem .6rem;
  border-radius: 6px;
  color: #35516a;
  font-size: .875rem;
  font-weight: 550;
  text-decoration: none;
}
.directory-tools a:hover { color: var(--brand); background: #e7edf4; }
.directory-tools svg, .directory-results header svg { flex: none; }
.directory-filter { container-type: inline-size; }
.directory-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.directory-filter-grid > button { justify-self: start; margin: 0; min-height: var(--field-height); }
@container (min-width: 55rem) {
  .directory-filter-grid {
    grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)) auto;
    gap: 1rem;
  }
}
@container (max-width: 30rem) {
  .directory-filter-grid { grid-template-columns: minmax(0, 1fr); }
}
.directory-results { padding: 0; }
.directory-results > header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .45rem 1rem;
  padding: 1.05rem clamp(1rem, 2vw, 1.65rem);
}
.directory-results > header h2 { margin: 0; }
.directory-results > header a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--link);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}
.directory-results > header a:hover { text-decoration: underline; }
.directory-results .directory-table > .table-wrap {
  margin: 0;
  border: 0;
  border-block-start: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}
.directory-results :is(td, th):first-child { padding-inline-start: clamp(1rem, 2vw, 1.65rem); }
.directory-results :is(td, th):last-child { padding-inline-end: clamp(1rem, 2vw, 1.65rem); }
.directory-results td:first-child a { font-weight: 650; text-decoration: none; }
.directory-results td:first-child a:hover { text-decoration: underline; }
.directory-results td:nth-child(2) { white-space: nowrap; }
.agency-status {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 5px;
  color: #3d5770;
  background: #edf2f7;
  font-size: .79rem;
  font-weight: 600;
  line-height: 1.45;
}
.agency-status.status-approved { color: #24594b; background: #e5f3eb; }
.agency-status:is(.status-pending, .status-needs_info) { color: #765219; background: #faf0d9; }
.agency-status:is(.status-rejected, .status-suspended) { color: #813942; background: #fae9ea; }
.agency-status.status-archived { color: #535c67; background: #edf0f2; }

.lang-control { display: inline-flex; flex: 0 0 auto; }
.lang-control form {
  display: inline-flex;
  align-items: stretch;
  gap: 1px;
  margin: 0;
  padding: 2px;
  border: 1px solid #cbd6e1;
  border-radius: 8px;
  background: #f2f5f8;
}
.lang-control button {
  min-height: 30px;
  margin: 0;
  padding: .28rem .6rem;
  border: 0;
  border-radius: 5px;
  color: #42586c;
  background: transparent;
  font-size: .8rem;
  line-height: 1.3;
  white-space: nowrap;
}
.lang-control button:hover { color: var(--brand); background: #e1eaf2; }
.lang-control button.selected:disabled { opacity: 1; color: #fff; background: var(--brand); }

.public {
  min-height: 70vh;
  padding: clamp(2rem, 8vh, 5rem) 1rem 3rem;
}
.auth-box {
  width: min(100%, 32.5rem);
  margin-inline: auto;
  padding: clamp(1.4rem, 4vw, 2.6rem);
  box-shadow: 0 10px 28px rgb(17 42 67 / 6%);
}
.auth-box h1 { font-size: clamp(1.75rem, 3vw, 2rem); margin: 0 0 1.5rem; }
.auth-box .panel { margin: 0; padding: 0; border: 0; }
.auth-box form > button { width: 100%; margin-block-start: .25rem; }
.auth-box .grid { grid-template-columns: minmax(0, 1fr); }
.auth-box .actions {
  margin: 0;
  padding-block-start: .9rem;
  justify-content: space-between;
  border-block-start: 1px solid var(--line);
  font-size: .875rem;
}
.auth-box .actions a { padding-block: .25rem; }

@media (max-width: 700px) {
  .table-wrap:has(th:nth-child(5)) table { min-width: 38rem; }
  .table-wrap:has(th:nth-child(8)) table { min-width: 56rem; }
  th, td { padding: .65rem .75rem; }
  th { white-space: normal; }
}

@media (max-width: 560px) {
  .agency-fields { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
  .directory-tools { gap: .15rem .3rem; }
  .directory-tools a { padding-inline: .35rem; }
  .panel { margin-block: .85rem; }
  .public { padding-block-start: 1.5rem; }
  .lang-control button { min-height: 34px; }
  select, textarea, input:not([type="checkbox"], [type="radio"], [type="hidden"]) { font-size: 1rem; }
}
