* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f3f8f7;
  color: #24364b;
  font-family: Arial, sans-serif;
  line-height: 1.5;
}
header {
  background: #087e83;
  color: white;
  padding: 22px max(22px, calc((100vw - 1120px) / 2));
  border-bottom: 4px solid #e87932;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
header strong {
  letter-spacing: 3px;
  font-size: 14px;
}
header h1 {
  margin: 2px 0;
  font-size: 25px;
}
header a {
  color: white;
}
main {
  max-width: 1120px;
  margin: auto;
  padding: 18px 20px 60px;
}
nav,
.actions,
.section-head,
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.section-head {
  justify-content: space-between;
}
nav {
  border-bottom: 1px solid #b8c9c8;
  padding: 12px 0;
}
h2 {
  font-size: 21px;
}
h3 {
  font-size: 17px;
}
.panel,
.item {
  background: white;
  border: 1px solid #d9e5e3;
  border-radius: 10px;
  padding: 22px;
  margin: 18px 0;
}
.panel {
  border-top: 4px solid #e87932;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0;
}
label {
  display: block;
  font-weight: bold;
  font-size: 14px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #b8c9c8;
  border-radius: 6px;
  color: inherit;
  font: inherit;
  background: white;
  margin: 5px 0;
}
input[type="checkbox"] {
  width: auto;
}
input[readonly] {
  background: #f3f8f7;
}
button {
  font: inherit;
  font-size: 14px;
  font-weight: bold;
  background: #087e83;
  color: white;
  border: 0;
  border-radius: 6px;
  padding: 10px 15px;
  cursor: pointer;
}
.secondary,
[role="tab"] {
  background: #e6f2f0;
  color: #07585c;
}
[role="tab"][aria-selected="true"] {
  background: #087e83;
  color: white;
}
.danger {
  background: #963f32;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
:focus-visible {
  outline: 3px solid #e87932;
  outline-offset: 3px;
}
small,
.muted {
  font-size: 13px;
  color: #586777;
}
#message {
  min-height: 24px;
  color: #07585c;
}
.tag {
  padding: 4px 10px;
  background: #e6f2f0;
  color: #07585c;
  border-radius: 20px;
  font-size: 13px;
}
ol li {
  margin: 10px 0;
}
ol li button {
  margin-left: 8px;
}
summary {
  cursor: pointer;
  font-weight: bold;
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  .grid {
    grid-template-columns: 1fr;
  }
  header {
    padding: 18px;
  }
  .panel {
    padding: 16px;
  }
}

.actions {
  margin-top: 18px;
  gap: 12px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
fieldset:disabled {
  opacity: 0.65;
}

.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
th,
td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid #d9e5e3;
}
th {
  font-size: 13px;
  color: #586777;
}
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.permission-grid fieldset {
  border: 1px solid #d9e5e3;
  border-radius: 8px;
  padding: 12px;
}
.permission-grid label {
  margin: 7px 0;
  font-weight: normal;
}
dialog {
  width: min(92vw, 480px);
  border: 1px solid #b8c9c8;
  border-radius: 10px;
  padding: 24px;
  color: #24364b;
}
dialog::backdrop {
  background: #24364b66;
}

.management-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; border-bottom: 1px solid #b8c9c8; margin-bottom: 16px; }
.management-bar nav { border: 0; margin: 0; }
.study-status-actions { margin-left: auto; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 0 12px 24px; }
.study-status-actions[hidden] { display: none; }
.study-status-actions .tag { margin: 0; white-space: nowrap; }
.study-status-actions .actions { margin: 0; }

#builder-content { margin-top: 28px; }

#form-list > input[type="search"] { max-width: 420px; margin: 12px 0; }
.library-table th, .library-table td { padding: 8px 10px; vertical-align: middle; }
.library-table td:last-child { white-space: nowrap; }
.library-table button { padding: 6px 10px; font-size: 13px; margin: 0 0 0 8px; }
.library-table button:first-child { margin-left: 0; }

.participant-visit-forms { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.participant-visit-forms button { text-align: left; max-width: 100%; }
