@layer components {
  .captured-mails,
  .captured-mail {
    width: min(100%, 72rem);
    margin: 0 auto;
    padding: 1rem clamp(1rem, 2vw, 2rem) 3rem;
    color: #2f343b;
  }

  .captured-mail-topbar {
    margin-bottom: 0.5rem;
  }

  .captured-mail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #4b5563;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
  }

  .captured-mail-back:hover {
    color: #111827;
    text-decoration: none;
  }

  .captured-mail-hero,
  .captured-mail-panel {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .captured-mail-hero {
    padding: 0.8rem 1rem;
    margin-bottom: 0.85rem;
  }

  .captured-mail-kicker {
    margin-bottom: 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .captured-mail h1 {
    margin: 0;
    color: #111827;
    font-size: clamp(1.45rem, 2.1vw, 2rem);
    line-height: 1.12;
  }

  .captured-mail-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.8rem;
    margin-top: 0.55rem;
    color: #4b5563;
    font-size: 0.95rem;
  }

  .captured-mail-summary span + span::before {
    content: "";
    display: inline-block;
    width: 0.35rem;
    height: 0.35rem;
    margin-right: 0.8rem;
    border-radius: 999px;
    background: #d1d5db;
    vertical-align: 0.1em;
  }

  .captured-mail-panel {
    margin-top: 1rem;
    overflow: hidden;
  }

  .captured-mail-body-panel {
    margin-top: 0;
  }

  .captured-mail-html {
    display: block;
    width: 100%;
    min-height: 28rem;
    border: 0;
    background: #fff;
  }

  .captured-mail-text,
  .captured-mail-raw {
    margin: 0;
    padding: 1rem;
    overflow: auto;
    color: #1f2937;
    background: #fbfbfc;
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .captured-mail-raw {
    max-height: 32rem;
    background: #111827;
    color: #e5e7eb;
  }

  .captured-mail-tabs {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0;
    background: #f9fafb;
  }

  .captured-mail-tab-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .captured-mail-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0 1.5rem;
    border-right: 1px solid transparent;
    border-left: 1px solid transparent;
    color: #8b8f97;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
  }

  .captured-mail-tab:hover {
    color: #374151;
  }

  .captured-mail-tab-input:focus-visible + .captured-mail-tab {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
  }

  .captured-mail-tab-input:checked + .captured-mail-tab {
    z-index: 1;
    margin-top: -1px;
    border-color: #e5e7eb;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #fff;
    border-radius: 8px 8px 0 0;
    background: #fff;
    color: #111827;
  }

  .captured-mail-tab-panes {
    flex: 0 0 100%;
    min-width: 0;
    border-top: 1px solid #e5e7eb;
    background: #fff;
  }

  .captured-mail-tab-pane {
    display: none;
  }

  .captured-mail-tab-input:nth-of-type(1):checked ~ .captured-mail-tab-panes .captured-mail-tab-pane--html,
  .captured-mail-tab-input:nth-of-type(2):checked ~ .captured-mail-tab-panes .captured-mail-tab-pane--text,
  .captured-mail-tab-input:nth-of-type(3):checked ~ .captured-mail-tab-panes .captured-mail-tab-pane--raw {
    display: block;
  }

  .captured-mail-empty-body {
    margin: 0;
    padding: 1rem;
    color: #6b7280;
  }

  .captured-mails-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .captured-mails-header h1 {
    margin: 0;
    color: #111827;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
  }

  .captured-mails-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .captured-mails-table th,
  .captured-mails-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #eef0f3;
    text-align: left;
    vertical-align: middle;
  }

  .captured-mails-table th {
    color: #6b7280;
    background: #f9fafb;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .captured-mails-table tr:last-child td {
    border-bottom: 0;
  }

  .captured-mails-table a {
    color: #111827;
    font-weight: 650;
    text-decoration: none;
  }

  .captured-mails-table a:hover {
    text-decoration: underline;
  }

  .captured-mails-table td:nth-child(1) {
    width: 11rem;
    color: #4b5563;
    white-space: nowrap;
  }

  .captured-mails-table td:nth-child(2) {
    width: 18rem;
    max-width: 22rem;
    color: #4b5563;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .captured-mails-table td:last-child {
    width: 1%;
    text-align: right;
  }

  .captured-mails .empty-state {
    padding: 2rem;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    text-align: center;
  }

  .captured-mails .danger,
  .captured-mails .icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .captured-mails .danger {
    padding: 0.45rem 0.75rem;
    background: #dc2626;
    color: #fff;
  }

  .captured-mails .danger:hover {
    background: #b91c1c;
  }

  .captured-mails .icon-button {
    width: 2rem;
    height: 2rem;
    background: transparent;
    color: #991b1b;
  }

  .captured-mails .icon-button:hover {
    background: #fee2e2;
  }

  @media (max-width: 720px) {
    .captured-mails,
    .captured-mail {
      padding-inline: 0.75rem;
    }

    .captured-mail-summary span + span::before {
      display: none;
    }

    .captured-mail-tab {
      flex: 1 1 33.333%;
      min-width: 0;
      padding-inline: 0.6rem;
    }

    .captured-mails-header {
      align-items: flex-start;
      flex-direction: column;
    }

    .captured-mails-table {
      display: block;
      overflow-x: auto;
    }
  }
}
