:root {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  color: #183e36;
  background: #f3f6f4;
  --green: #185c4b;
  --line: #d8e2db;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  background: white;
  padding: 24px 4vw;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 24px;
  font-weight: 800;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
}
.brand small {
  font-size: 12px;
  display: block;
  font-weight: 500;
  margin-top: 4px;
}
.badge {
  border-radius: 24px;
  background: #edf2eb;
  padding: 8px 12px;
  font-size: 12px;
}
main {
  max-width: 1280px;
  padding: 32px;
  margin: auto;
}
h1 {
  font-size: 32px;
  margin-top: 10px;
}
h2 {
  font-size: 22px;
}
h3 {
  font-size: 16px;
}
.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
#login {
  max-width: 460px;
  margin: 7vh auto;
}
form {
  display: grid;
  gap: 16px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
input,
select,
textarea {
  font: inherit;
  padding: 10px;
  border: 1px solid #a8bbb0;
  border-radius: 6px;
  background: white;
  min-width: 0;
  width: 100%;
  color: #183e36;
}
select[multiple] {
  min-height: 120px;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
}
input[readonly] {
  background: #edf2eb;
}
button {
  cursor: pointer;
  font: inherit;
  border-radius: 6px;
  padding: 10px 15px;
  background: var(--green);
  border: 1px solid var(--green);
  color: white;
  font-size: 13px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.secondary {
  background: white;
  color: var(--green);
  border-color: var(--line);
}
button:hover {
  filter: brightness(0.95);
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
nav button[aria-current="page"] {
  background: #092e25;
}
nav button {
  background: white;
  color: var(--green);
  border-color: var(--line);
}
nav button[aria-current="page"] {
  color: white;
}
.toolbar,
.actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
  margin: 16px 0;
}
.toolbar label {
  min-width: 240px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}
.card,
article {
  background: white;
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 10px;
  margin: 12px 0;
}
.card strong {
  display: block;
  font-size: 32px;
  margin-top: 10px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 13px;
}
th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  max-width: 360px;
  overflow-wrap: anywhere;
}
th {
  background: #eaf0eb;
}
.deleted-badge {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 3px 8px;
  border-radius: 24px;
  background: #fbe9e7;
  color: #8c2920;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
dl {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 3fr;
  gap: 10px;
  font-size: 14px;
}
dt {
  font-weight: 600;
}
dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.muted,
small {
  color: #597066;
  font-size: 12px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(700px, 94vw);
  max-height: 90vh;
  padding: 28px;
  overflow: auto;
}
dialog::backdrop {
  background: #0c251e66;
}
.close {
  float: right;
  background: white;
  color: #183e36;
  border: 0;
  font-size: 24px;
}
.error {
  color: #9d2c22;
  background: #fff0ec;
  padding: 14px;
  border-radius: 6px;
  white-space: pre-line;
}
.success {
  color: #185c4b;
}
.array-row {
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 12px;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 12px;
}
svg.map {
  width: 100%;
  height: 360px;
  background: #e7eee6;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.map circle,
.map polygon {
  fill: #22775b66;
  stroke: #165d50;
  stroke-width: 2;
}
.map a:focus circle {
  stroke: #d66024;
  stroke-width: 5;
}
a {
  color: #185c4b;
}
:focus-visible {
  outline: 3px solid #d09221;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  main {
    padding: 16px;
  }
  header {
    padding: 16px;
  }
  .badge {
    display: none;
  }
  dl {
    grid-template-columns: 1fr;
  }
  dd {
    margin-bottom: 8px;
  }
  dialog {
    padding: 20px;
  }
}

.territory-fields {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 16px 0;
  align-items: end;
}
.territory-fields [role="status"] {
  grid-column: 1 / -1;
  margin: 0;
}
.territory-fields button {
  justify-self: start;
}

.searchable-select {
  position: relative;
  margin-top: 6px;
  min-width: 0;
}
.searchable-select > input {
  padding-right: 34px;
}
.searchable-select .select-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--green);
}
.select-popup {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  min-width: min(260px, 80vw);
  z-index: 20;
  background: white;
  border: 1px solid #a8bbb0;
  border-radius: 6px;
  box-shadow: 0 5px 16px #183e3622;
}
.select-popup [role="listbox"] {
  max-height: 220px;
  overflow-y: auto;
}
.select-option {
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.select-option:hover,
.select-option.active {
  background: #eaf0eb;
}
.select-option[aria-selected="true"] {
  font-weight: 700;
}
.select-feedback {
  font-size: 12px;
  padding: 8px 10px;
  margin: 0;
  color: #597066;
  border-top: 1px solid var(--line);
}
.searchable-select > input:disabled {
  background: #edf2eb;
  cursor: not-allowed;
}
@media (max-width: 650px) {
  .select-popup {
    min-width: 100%;
  }
}
