:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #151515;
  background: #fff;
  font-size: 15px;
  line-height: 1.5;
  --muted: #595959;
  --line: #d9d9d9;
  --soft: #f6f6f6;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 18rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 5vw, 2.65rem); font-weight: 650; line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.25rem; line-height: 1.25; }
h3 { font-size: 1rem; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
:focus-visible { outline: 2px solid #151515; outline-offset: 3px; }
.muted { color: var(--muted); }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .dashboard { max-width: 76rem; margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 3.25rem); }
.header-inner { min-height: 4.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand, .account { display: flex; align-items: center; gap: .85rem; }
.brand strong { font-size: 1.2rem; letter-spacing: -.035em; }
.brand span { color: var(--muted); border-left: 1px solid var(--line); padding-left: .85rem; font-size: .9rem; }
.account { font-size: .875rem; }
#account-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.button, input, select { border: 1px solid #bcbcbc; border-radius: 5px; background: #fff; color: inherit; min-height: 2.75rem; }
.button { display: inline-flex; justify-content: center; align-items: center; padding: .5rem .95rem; font-weight: 600; white-space: nowrap; }
.button:hover:not(:disabled) { background: var(--soft); border-color: #6b6b6b; }
.button-primary { background: #151515; color: #fff; border-color: #151515; }
.button-primary:hover:not(:disabled) { background: #353535; border-color: #353535; }
.button-small { min-height: 2.25rem; font-size: .875rem; padding: .3rem .75rem; }
input, select { padding: .5rem .7rem; width: 100%; }
input::placeholder { color: #686868; }
label { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .875rem; }

.sign-in-layout { min-height: calc(100dvh - 4.25rem); display: grid; place-items: center; padding: 2rem 1.25rem 4.5rem; }
.sign-in-card { width: min(100%, 26rem); border: 1px solid var(--line); border-radius: 8px; padding: clamp(1.4rem, 6vw, 2.25rem); }
.sign-in-card h1 { font-size: 2rem; }
.sign-in-card > p { margin-top: .6rem; }
.sign-in-card form { margin-top: 1.6rem; }
.sign-in-card input + label { margin-top: .95rem; }
.sign-in-card button { margin-top: 1.3rem; width: 100%; }

.dashboard { padding-top: clamp(1.75rem, 5vw, 3.5rem); padding-bottom: 3rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1.75rem; }
.page-heading p { margin-top: .5rem; overflow-wrap: anywhere; }
.sync { display: grid; justify-items: end; gap: .35rem; text-align: right; }
.sync span { font-size: .8rem; }
.notice { border: 1px solid var(--line); border-left: 3px solid #151515; border-radius: 4px; background: var(--soft); margin: .85rem 0; padding: .75rem .9rem; font-size: .9rem; overflow-wrap: anywhere; }
.warnings { padding-left: 2rem; }
.warnings li + li { margin-top: .35rem; }
.toolbar { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(11rem, auto) minmax(9rem, auto); align-items: end; gap: .75rem; }
.status-note { color: var(--muted); font-size: .86rem; margin-top: .75rem; max-width: 66ch; }
.result-count { font-size: .875rem; margin: 1.4rem 0 .5rem; min-height: 1.3rem; }
.table-wrap, .empty-state { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--soft); text-align: left; font-size: .84rem; font-weight: 650; }
th, td { border-bottom: 1px solid var(--line); padding: .78rem .85rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafa; }
.subject-cell { width: 38%; }
.subject-button { text-align: left; padding: .15rem 0; border: 0; background: none; color: inherit; font-weight: 650; overflow-wrap: anywhere; }
.subject-button:hover { text-decoration: underline; text-underline-offset: .16em; }
.recipient-cell { overflow-wrap: anywhere; }
.extra-recipients { display: block; font-size: .8rem; color: var(--muted); }
.date-cell { white-space: nowrap; font-size: .9rem; }
.badge { display: inline-flex; align-items: center; border: 1px solid #a6a6a6; border-radius: 1rem; padding: .14rem .55rem; font-size: .79rem; font-weight: 550; line-height: 1.3; white-space: nowrap; }
.badge-replied, .badge-delivered { background: #151515; border-color: #151515; color: #fff; }
.badge-bounced { border-color: #151515; font-weight: 750; }
.badge-delayed { border-style: dashed; border-color: #5d5d5d; }
.empty-state { padding: 2rem 1.1rem; text-align: center; }
.empty-state p { margin-top: .4rem; }

dialog { width: min(calc(100% - 2rem), 44rem); max-height: calc(100dvh - 2rem); padding: 0; color: inherit; background: #fff; border: 1px solid #a6a6a6; border-radius: 8px; }
dialog::backdrop { background: #0005; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--line); }
.dialog-header h2 { overflow-wrap: anywhere; }
.dialog-label { font-size: .84rem; margin-bottom: .3rem; }
.dialog-content { padding: 1rem 1.25rem 1.3rem; }
.metadata { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1rem; margin: 0 0 1.2rem; font-size: .9rem; }
.metadata dt { color: var(--muted); }
.metadata dd { margin: 0; overflow-wrap: anywhere; }
.recipient-detail { border: 1px solid var(--line); border-radius: 5px; margin-top: .65rem; padding: .8rem; }
.recipient-heading { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .45rem; }
.recipient-heading h3 { overflow-wrap: anywhere; min-width: 0; }
.recipient-kind { font-size: .83rem; color: var(--muted); margin-right: .4rem; }
.timeline { list-style: none; margin: .7rem 0 0; padding: 0; font-size: .86rem; }
.timeline li { border-top: 1px solid var(--line); padding: .65rem 0 0; margin-top: .65rem; }
.event-heading { display: flex; flex-wrap: wrap; gap: .15rem .7rem; align-items: baseline; }
.event-heading time { color: var(--muted); }
.event-detail { margin-top: .2rem; overflow-wrap: anywhere; white-space: pre-wrap; }

@media (max-width: 48rem) {
  #account-name { display: none; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: .75rem; gap: .3rem .6rem; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { display: block; padding: 0; border: 0; min-width: 0; }
  .subject-cell { grid-column: 1 / -1; width: auto; }
  .date-cell { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; }
  .recipient-cell { font-size: .88rem; }
}

@media (max-width: 31rem) {
  .brand, .account { gap: .5rem; }
  .brand span { padding-left: .5rem; }
  .toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .search-field { grid-column: 1 / -1; }
  .page-heading { gap: .5rem; }
  .sync { max-width: 8rem; }
}
