.achmc-wrap {
  width: 100%;
  max-width: 100%;
}

.achmc-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.achmc-status {
  font-size: 13px;
  opacity: 0.85;
}

.achmc-status.is-error {
  opacity: 1;
}

.achmc-wrap.is-loading .achmc-table {
  opacity: 0.55;
  filter: blur(0.2px);
}

.achmc-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.achmc-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: auto;
  background: #fff;
  border-radius: 12px;
}

.achmc-table th,
.achmc-table td {
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.achmc-table thead th {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.03);
}

.achmc-code {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
  font-weight: 700;
}

/* Copy button base */
.achmc-copy {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  min-height: 40px;
}

.achmc-copy:active {
  transform: translateY(1px);
}

@media (hover: none) and (pointer: coarse) {
  .achmc-copy,
  .achmc-refresh {
    min-height: 40px;
    padding: 10px 12px;
  }
}

/* ---------- Alignment: Code + Copy (LTR & RTL safe) ---------- */
.achmc-codecell {
  display: inline-flex;
  align-items: center;     /* fixes vertical misalignment */
  justify-content: center;
  gap: 8px;
}

/* direction-aware spacing (works in both RTL/LTR) */
.achmc-codecell .achmc-copy {
  margin: 0;
}

/* ---------- Email wrapping fix (desktop too) ---------- */
/* allow wrapping for recipient cell, despite nowrap on all tds */
.achmc-table td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
}

/* ---------- Empty state ---------- */
.achmc-empty-cell {
  text-align: center;
}

/* ---------- Mobile card layout ---------- */
@media (max-width: 640px) {
  .achmc-table-container {
    overflow-x: visible;
  }

  .achmc-table,
  .achmc-table thead,
  .achmc-table tbody,
  .achmc-table th,
  .achmc-table td,
  .achmc-table tr {
    display: block;
    width: 100%;
  }

  .achmc-table thead {
    display: none;
  }

  .achmc-table tr {
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
  }

  .achmc-table td {
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    white-space: normal;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    text-align: start; /* start = right in RTL, left in LTR */
  }

  .achmc-table td:last-child {
    border-bottom: 0;
  }

  .achmc-table td::before {
    content: attr(data-label);
    font-weight: 600;
    opacity: 0.8;
    white-space: nowrap;
  }

  /* Code row: stack code + button nicely */
  .achmc-table td:nth-child(3) {
    align-items: flex-start;
  }

  .achmc-codecell {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  html[dir="rtl"] .achmc-codecell {
    align-items: flex-end;
  }

  .achmc-codecell .achmc-copy {
    width: 100%;
    max-width: none;
  }

  /* ---- Empty row should NOT behave like normal card rows ---- */
  .achmc-table tr.achmc-empty {
    margin-bottom: 0;
  }

  .achmc-table tr.achmc-empty td {
    display: block !important;
    text-align: center !important;
    justify-content: center !important;
    align-items: center !important;
    border-bottom: 0 !important;
  }

  .achmc-table tr.achmc-empty td::before {
    content: none !important;
  }
}
/* Force-center empty state on mobile (stronger selectors) */
@media (max-width: 640px) {
  .achmc-table tbody tr.achmc-empty > td.achmc-empty-cell {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
    gap: 0 !important;
  }

  .achmc-table tbody tr.achmc-empty > td.achmc-empty-cell::before {
    content: "" !important;
    display: none !important;
  }
}
