#delivery-page {
  min-width: 0;
}
.email-delivery [hidden],
#delivery-page [role="status"]:empty {
  display: none !important;
}
.delivery-filters {
  display: grid;
  grid-template-columns: minmax(12rem, 1.5fr) minmax(9rem, 1fr) auto;
  align-items: end;
  gap: .75rem;
}
.delivery-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
#delivery-page .form-field input,
#delivery-page .form-field select {
  box-sizing: border-box;
  min-height: 40px;
  height: auto;
  line-height: 1.4;
  padding: 8px 12px;
  color: var(--text-main);
}
.delivery-channel {
  position: relative;
}
#delivery-page .delivery-channel select {
  appearance: none;
  padding-right: 32px;
}
.delivery-channel::after {
  position: absolute;
  right: 14px;
  bottom: 17px;
  width: 7px;
  height: 7px;
  content: "";
  border: solid var(--text-main);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
#load-status {
  margin: 1rem 0 .5rem;
}
#message-table .table {
  min-width: 40rem;
}
#message-table small {
  display: block;
  color: var(--text-muted);
  font-size: .85em;
  margin-top: .25rem;
}
#message-table details {
  margin-top: .4rem;
}
#message-table summary {
  color: var(--primary);
}
#delivery-page summary {
  cursor: pointer;
}
#sender-settings > summary {
  font-size: 17px;
  font-weight: 600;
}
#sender-form {
  display: grid;
  gap: .75rem;
  max-width: 32rem;
  margin-top: 1rem;
}
#sender-form button {
  justify-self: start;
}
.delivery-receipts dt {
  color: var(--text-muted);
  font-size: .875em;
}
.delivery-receipts dd {
  margin: .1rem 0 .45rem;
}
#message-table .delivery-row-action {
  display: block;
  margin-top: .5rem;
}
.delivery-state {
  display: inline-block;
  border-radius: 5px;
  padding: .15rem .45rem;
  background: var(--bg-main);
  color: var(--text-main);
  font-weight: 600;
  font-size: .9em;
}
.delivery-state:is([data-state="delivered"], [data-state="read"]) {
  color: #166534;
  background: #e7f5ec;
}
.delivery-state:is([data-state="failed"], [data-state="undelivered"], [data-state="rejected"], [data-state="review"]) {
  color: #854d0e;
  background: #fff2d5;
}
:root[data-theme="dark"] .delivery-state:is([data-state="delivered"], [data-state="read"]) {
  color: #a7efc1;
  background: #193c2a;
}
:root[data-theme="dark"] .delivery-state:is([data-state="failed"], [data-state="undelivered"], [data-state="rejected"], [data-state="review"]) {
  color: #ffdf9b;
  background: #45351c;
}
#delivery-page :focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
#delivery-page button:disabled {
  opacity: .55;
}
:root[data-theme="dark"] .email-delivery #adminSidebarContainer .sidebar {
  background: var(--bg-card);
  border-color: var(--border);
}
:root[data-theme="dark"] #delivery-page .card,
:root[data-theme="dark"] #delivery-page input,
:root[data-theme="dark"] #delivery-page select {
  color-scheme: dark;
  background-color: var(--bg-card);
  transition: none;
}
:root[data-theme="dark"] #delivery-page .btn-secondary {
  color: var(--text-main);
  background-color: var(--bg-card);
  transition: none;
}
:root[data-theme="dark"] #delivery-page :is(h1, h2, #sender-settings > summary) {
  color: var(--text-main);
}
:root[data-theme="dark"] #delivery-page :is(p, small, label) {
  color: var(--text-muted);
}
:root[data-theme="dark"] .email-delivery #adminSidebarContainer .sidebar a {
  color: var(--text-muted);
}
:root[data-theme="dark"] .email-delivery #adminSidebarContainer .sidebar a.active,
:root[data-theme="dark"] .email-delivery #adminSidebarContainer .sidebar a:hover {
  background: #1e355a;
  color: #c9ddff;
}
:root[data-theme="dark"] #message-table summary,
:root[data-theme="dark"] #message-table button.link {
  color: #93c5fd;
}
:root[data-theme="dark"] #delivery-page .btn-primary {
  background: var(--primary-hover);
}
@container (max-width: 680px) {
  .delivery-filters {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  }
  .delivery-filter-actions {
    grid-column: 1 / -1;
  }
}
@container (max-width: 420px) {
  .delivery-filters {
    grid-template-columns: minmax(0, 1fr);
  }
}
@container (max-width: 540px) {
  #message-table .table,
  #message-table tbody {
    display: block;
    min-width: 0;
  }
  #message-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  #message-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    grid-template-areas: "message status" "learner status" "time time";
    align-items: start;
    padding: .75rem;
    gap: .4rem .75rem;
    border-bottom: 1px solid var(--border);
  }
  #message-table tbody tr:last-child {
    border-bottom: 0;
  }
  #message-table .table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .message-time { grid-area: time; }
  .message-who { grid-area: learner; }
  .message-primary { grid-area: message; }
  .message-status { grid-area: status; }
  #message-table .message-time {
    color: var(--text-muted);
    font-size: .85em;
  }
}
@media (max-width: 640px) {
  #delivery-page,
  #delivery-page .card {
    padding: 16px;
  }
}

.wa-release-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.wa-release-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border-color, #d0d6df);
  overflow-wrap: anywhere;
}
.wa-send-record:not([hidden]) {
  display: grid;
  gap: .65rem;
  max-width: 46rem;
  margin-top: 1rem;
}
.wa-send-record textarea {
  resize: vertical;
  font: inherit;
  line-height: 1.5;
  padding: .75rem;
  width: 100%;
  box-sizing: border-box;
}
