* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #17202a;
  background: #f5f7fb;
}

header {
  background: #0f5f6f;
  color: #fff;
  padding: 18px 24px;
}

.submission-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  min-height: 100px;
  padding: 24px;
}

.submission-header h1 {
  flex: 0 0 auto;
  margin: 0;
}

.submission-help {
  max-width: min(680px, 100%);
  margin: 0;
  color: #d9f0f3;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.submission-help a {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-user {
  font-size: 14px;
  opacity: 0.9;
}

main {
  width: min(1080px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.panel {
  background: #fff;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.help {
  color: #52616f;
  font-size: 0.92rem;
  margin: 6px 0 0;
}

input,
select,
textarea,
button {
  width: 100%;
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #bdc9d4;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
}

.combobox {
  position: relative;
}

.combobox-input {
  padding-right: 34px;
}

.combobox::after {
  content: "";
  position: absolute;
  top: 19px;
  right: 13px;
  width: 9px;
  height: 9px;
  border-right: 2px solid #4c5967;
  border-bottom: 2px solid #4c5967;
  pointer-events: none;
  transform: rotate(45deg);
}

.combobox-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #bdc9d4;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 31, 45, 0.14);
}

.combobox-option {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #17202a;
  padding: 9px 11px;
  text-align: left;
  font-weight: 400;
}

.combobox-option:hover,
.combobox-option.active {
  background: #eef8fa;
}

.combobox-empty {
  padding: 9px 11px;
  color: #4c5967;
}

textarea {
  min-height: 120px;
}

button {
  border: 0;
  border-radius: 6px;
  background: #0f5f6f;
  color: #fff;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #4c5967;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a.button-link {
  display: inline-block;
  width: auto;
  border-radius: 6px;
  background: #0f5f6f;
  color: #fff;
  padding: 11px 14px;
  font-weight: 700;
  text-decoration: none;
}

a.button-link.secondary {
  background: #4c5967;
}

a.button-link.compact {
  padding: 7px 10px;
  font-size: 14px;
}

.hidden {
  display: none;
}

.status {
  border-left: 4px solid #0f5f6f;
  padding: 10px 12px;
  background: #eef8fa;
  margin: 12px 0;
}

.turnstile-widget {
  margin: 18px 0 14px;
}

.error {
  border-left-color: #b42318;
  background: #fff1f0;
}

.muted {
  color: #4c5967;
}

.thank-you-shell {
  width: min(760px, calc(100% - 32px));
}

.thank-you-panel {
  text-align: center;
  padding: 42px 28px;
}

.success-mark {
  display: inline-grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #e8f7ee;
  color: #16833a;
  font-size: 38px;
  font-weight: 700;
}

.lead {
  font-size: 18px;
  margin: 8px 0 10px;
}

.submission-code {
  display: inline-block;
  border: 1px solid #bdc9d4;
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px 14px;
  font-weight: 700;
}

.thank-you-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-toolbar button {
  max-width: 240px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.admin-tabs button {
  width: auto;
  min-width: 116px;
  background: #4c5967;
}

.admin-tabs button.active {
  background: #0f5f6f;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

output {
  display: block;
  min-height: 39px;
  border: 1px solid #bdc9d4;
  border-radius: 6px;
  padding: 10px 11px;
  background: #f8fafc;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.pagination-bar button {
  width: auto;
  min-width: 104px;
}

.pagination-bar span {
  color: #4c5967;
  font-weight: 700;
}

td button.secondary {
  width: auto;
  white-space: nowrap;
}

.smtp-toolbar {
  align-items: end;
  flex-wrap: wrap;
}

.smtp-toolbar p {
  flex: 1 1 280px;
  margin: 0;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button {
  min-width: 82px;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 45, 0.48);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: min(820px, calc(100vh - 56px));
  overflow: auto;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 24px 72px rgba(15, 31, 45, 0.28);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e3e8ee;
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.modal-header h3 {
  margin: 0;
}

.modal-eyebrow {
  margin: 0 0 4px;
  color: #4c5967;
  font-size: 13px;
  font-weight: 700;
}

.modal-close {
  width: auto;
  min-width: 86px;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-title {
  margin-top: 4px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  background: #eef8fa;
  color: #0f5f6f;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.detail-grid div {
  min-width: 0;
}

.detail-grid dt {
  color: #4c5967;
  font-size: 13px;
  font-weight: 700;
}

.detail-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.detail-section {
  margin-top: 18px;
}

#detail-files,
#detail-events,
#detail-tracking {
  overflow-x: auto;
}

.long-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f8fafc;
  border: 1px solid #d9e1e8;
  border-radius: 6px;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e3e8ee;
  padding: 9px 8px;
  text-align: left;
}

@media (max-width: 720px) {
  .submission-header {
    min-height: 0;
    padding: 20px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .submission-header h1 {
    font-size: 1.75rem;
  }

  .submission-help {
    font-size: 0.9rem;
  }

  .grid,
  .form-grid,
  .form-grid.compact {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
  }

  .detail-heading,
  .modal-header,
  .thank-you-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-toolbar button,
  .admin-tabs button {
    max-width: none;
    width: 100%;
  }

  .pagination-bar {
    justify-content: stretch;
  }

  .pagination-bar button {
    flex: 1;
    min-width: 0;
  }

  .pagination-bar span {
    min-width: 64px;
    text-align: center;
  }

  .modal-panel {
    max-height: calc(100vh - 32px);
    padding: 16px;
  }

  .modal-close {
    width: 100%;
  }
}
