.app-main { padding: 2.75rem 0 3.5rem; }
.app-wrap { max-width: 34rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem 1.5rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.panel h1 {
  margin: 0 0 0.35rem;
  font-size: 1.7rem;
}

.panel > .muted { margin-top: 0.15rem; }

.compose-header { margin-bottom: 0.25rem; }
.compose-header .muted { margin-top: 0.25rem; }

.app-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 0.85rem;
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--text);
}

.unread-badge {
  display: inline-block;
  min-width: 1.35rem;
  margin-left: 0.4rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.folder-label {
  margin: 1rem 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.folder-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0;
}

.folder-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.folder-tab[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
  border-color: transparent;
}

.folder-tab:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin-top: 1.15rem;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.form input,
.form textarea,
.mailbox-password-input {
  font: inherit;
  font-weight: 400;
  font-size: 1rem;
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--bg);
  color: var(--text);
}

.form input::placeholder,
.form textarea::placeholder {
  color: #93a3bd;
  opacity: 1;
}

.form textarea { resize: vertical; min-height: 9rem; }

.from-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-top: 1.15rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
}

.from-line span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.error,
.status {
  margin: 1rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-size: 0.95rem;
}

.error {
  color: var(--danger);
  background: var(--danger-surface);
  border: 1px solid var(--danger-border);
}

.status {
  color: var(--success);
  background: var(--success-surface);
  border: 1px solid var(--success-border);
  word-break: break-word;
}

.status-detail {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.form .btn { width: 100%; margin-top: 0.15rem; }
.form .btn:disabled,
.btn-oauth:disabled { opacity: 0.6; cursor: not-allowed; }

.btn.is-busy:disabled,
.form .btn.is-busy:disabled,
.btn-oauth.is-busy:disabled,
.folder-tab.is-busy:disabled {
  opacity: 1;
  cursor: progress;
}

.btn.is-busy::before,
.folder-tab.is-busy::before {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: btn-spin 0.7s linear infinite;
  flex: none;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.oauth-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.btn-oauth {
  width: 100%;
  justify-content: flex-start;
  padding-left: 0.95rem;
  background: var(--bg);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-oauth:hover {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.btn-oauth svg { flex: none; }

.oauth-note { margin: 0.85rem 0 0; font-size: 0.85rem; }

.auth-switch { margin: 0.85rem 0 0; }
.auth-switch .btn { width: 100%; }

.gate-actions,
.pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

#pendingAccounts { margin-top: 0.35rem; }

.pending-account {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
}

.pending-account h2 {
  margin: 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.pending-account .muted { margin: 0.3rem 0 0; }

.allowlist-block {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
}

.allowlist-block h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.allowlist-audit-heading {
  margin: 1.35rem 0 0.35rem;
  font-size: 1rem;
}

.allowlist-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.allowlist-domain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.allowlist-row .btn {
  width: auto;
  flex: none;
}

.allowlist-audit-row {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.allowlist-audit-row p { margin: 0.2rem 0 0; }

.account-list {
  margin: 1.15rem 0 1.25rem;
  display: grid;
  gap: 0;
}

.account-list div {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.account-list dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.account-list dd {
  margin: 0.25rem 0 0;
  font-size: 1.02rem;
}

.settings-actions { margin-top: 0.25rem; }

.agent-admin {
  margin-top: 1.35rem;
  padding-top: 0.35rem;
}

.agent-admin h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.agent-admin .account-list { margin-top: 0.85rem; }

#creditsRemaining {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.agent-admin .settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .app-main { padding-top: 1.5rem; }
  .panel { padding: 1.25rem 1rem 1.15rem; }
  .from-line { flex-direction: column; gap: 0.2rem; }
  .inbox-tools { width: 100%; }
}

.app-wrap.is-workspace { max-width: 68rem; }

.app-wrap.is-workspace #settingsPanel > h1,
.app-wrap.is-workspace #settingsPanel > .muted,
.app-wrap.is-workspace #settingsPanel > .account-list,
.app-wrap.is-workspace #settingsPanel > .fine,
.app-wrap.is-workspace #settingsPanel > .agent-admin,
.app-wrap.is-workspace #settingsPanel > .settings-actions {
  max-width: 40rem;
}

@media (min-width: 900px) {
  .app-wrap.is-workspace #composePanel {
    display: grid;
    grid-template-columns: minmax(0, 42rem) minmax(16rem, 1fr);
    column-gap: 2rem;
    align-items: start;
  }

  .app-wrap.is-workspace #composePanel > * { grid-column: 1; }

  .app-wrap.is-workspace #composePanel .draft-box {
    grid-column: 2;
    grid-row: 1 / span 12;
    margin-top: 0;
    padding: 0.15rem 0 0 1.25rem;
    border-left: 1px solid var(--border);
  }
}

.app-switch { flex-wrap: wrap; }

.inbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.inbox-head h1 { margin: 0; }

.inbox-head .btn { width: auto; }

.inbox-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.mailbox-picker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  min-width: 0;
}

.mailbox-picker span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.mailbox-picker select {
  width: 16rem;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
}

.forward-notes {
  margin-top: 0.65rem;
}

.forward-notes p {
  margin: 0.25rem 0 0;
}

.mailbox-kind { margin: 0.15rem 0 0.35rem; }

.client-mail {
  margin-top: 1.35rem;
  padding-top: 0.35rem;
}

.client-mail h2,
.client-card h3 {
  margin: 0 0 0.45rem;
  overflow-wrap: anywhere;
}

.client-mail h2 { font-size: 1.25rem; }

.client-card {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.client-card .account-list { margin: 0.55rem 0 0.75rem; }

.client-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
}

.client-value code {
  overflow-wrap: anywhere;
  word-break: break-all;
}

.client-pending { margin: 0.45rem 0 0; }

.client-secret {
  margin: 0.35rem 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(157, 222, 181, 0.08);
}

.client-secret code {
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}

.mailbox-block > .btn { width: auto; margin-bottom: 0.35rem; }

.inbox-note { margin: 0.75rem 0 0; }

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.85rem;
}

.search-label { flex: 1 1 14rem; min-width: 0; }

.search-label input {
  width: 100%;
  font: inherit;
  font-weight: 400;
  font-size: 1rem;
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--bg);
  color: var(--text);
}

.search-form .btn,
.inbox-head .btn { width: auto; min-height: 44px; }

.search-form .btn:disabled,
.inbox-head .btn:disabled { opacity: 0.6; cursor: progress; }

.compose-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.compose-actions .btn { width: auto; }

.draft-box { margin-top: 1.25rem; }

.draft-heading {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border);
}

.draft-open {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-item.is-current .draft-open { font-weight: 700; }

.draft-item .btn { width: auto; }

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 16.5rem) minmax(0, 1fr);
  min-height: 16rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.inbox-list {
  max-height: 28rem;
  overflow: auto;
  border-right: 1px solid var(--border);
}

.inbox-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0.85rem 0.75rem 0;
  cursor: pointer;
}

.inbox-item.is-selected { background: color-mix(in srgb, var(--accent) 16%, transparent); }

.inbox-item.is-unread {
  box-shadow: inset 3px 0 0 var(--accent);
}
.inbox-item.is-unread .inbox-subject { font-weight: 700; }

.unread-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.inbox-from,
.inbox-subject {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-from { font-size: 0.82rem; color: var(--muted); }

.inbox-subject { font-size: 0.98rem; }

.inbox-preview {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-read {
  min-width: 0;
  padding: 0.85rem 0 0.25rem 1rem;
}

.inbox-read h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.inbox-meta { margin: 0 0 0.85rem; }

.inbox-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
}

.inbox-read .btn { width: auto; margin-top: 1rem; }

.thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.inbox-read .thread-actions .btn { margin-top: 0; }

.inbox-subject-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.inbox-subject-row .inbox-subject {
  flex: 1;
  min-width: 0;
}

.thread-count {
  flex: none;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 0.75rem;
  font-weight: 700;
}

.thread-stream {
  max-height: 32rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.thread-message {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.thread-message:first-child { border-top: 0; padding-top: 0; }

.thread-message h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.thread-message.is-hit {
  margin: 0.35rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-hit-label {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.thread-message.is-outbound {
  margin-top: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.thread-message .inbox-body { margin-top: 0.55rem; }

.attach-field .fine { font-weight: 400; color: var(--muted); }
.form input[type="file"] { font-size: 0.88rem; }

.pending-files,
.attach-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pending-file,
.attach-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  font-size: 0.88rem;
  font-weight: 400;
}

.attach-name { min-width: 0; word-break: break-word; }

.attach-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.pending-file .btn,
.attach-actions .btn,
.thread-actions .btn,
.compose-thread-note .btn,
.draft-item .btn {
  width: auto;
  margin: 0;
  min-height: 44px;
  padding: 0.45rem 0.85rem;
}

.attach-preview {
  display: block;
  width: 100%;
  max-width: 16rem;
  max-height: 12rem;
  margin-top: 0.2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.attach-text {
  width: 100%;
  margin: 0.2rem 0 0;
  max-height: 10rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.85rem;
}

.compose-thread-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.75rem 0 0;
}

.back-to-threads { display: none; }

.thread-id {
  color: var(--muted);
  font-size: 0.82rem;
}

.draft-empty { margin: 0.35rem 0 0; }

.inbox-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 0.85rem 0.85rem 0;
}

.inbox-skeleton span {
  display: block;
  height: 2.75rem;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04),
    color-mix(in srgb, var(--accent) 28%, transparent),
    rgba(255, 255, 255, 0.04)
  );
  background-size: 200% 100%;
  animation: inbox-shimmer 1.1s ease-in-out infinite;
}

.inbox-skeleton span:nth-child(2) { width: 92%; }
.inbox-skeleton span:nth-child(3) { width: 80%; }

@keyframes inbox-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.inbox-empty { margin: 0.85rem 0.75rem 0.85rem 0; }

@media (max-width: 720px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox-list {
    max-height: none;
    border-right: 0;
    border-bottom: 0;
  }
  .inbox-read { display: none; padding-left: 0; }
  .inbox-layout.is-reading .inbox-list { display: none; }
  .inbox-layout.is-reading .inbox-read { display: block; }
  .back-to-threads {
    display: inline-flex;
    min-height: 44px;
    margin: 0 0 0.75rem;
  }
}

.domain-card {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.domain-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.7rem;
}

.domain-head h2 {
  margin: 0;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.domain-status {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.domain-status.is-verified { color: #9ddeb5; }
.domain-status.is-failed { color: #ffb4b4; }
.domain-status.is-pending { color: #f3d48a; }

.domain-card > .error { margin: 0.55rem 0 0; }

.domain-publish-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.domain-hold {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(243, 212, 138, 0.08);
}

.customer-home,
#domainPanel,
.domain-card {
  min-width: 0;
  max-width: 100%;
}

.dns-scroll {
  overflow-x: auto;
  max-width: 100%;
  margin-top: 0.75rem;
}

.dns-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.dns-table th:nth-child(1),
.dns-table td:nth-child(1) { width: 7.5rem; }
.dns-table th:nth-child(2),
.dns-table td:nth-child(2) { width: 9rem; }
.dns-table th:nth-child(3),
.dns-table td:nth-child(3) { width: 5rem; }
.dns-table th:nth-child(5),
.dns-table td:nth-child(5) { width: 5.5rem; }

.dns-table caption { caption-side: bottom; }

.dns-table th,
.dns-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--border);
}

.dns-table th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dns-value {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: 0.82rem;
}

.dns-table .fine { display: block; margin-top: 0.3rem; }

.dns-recommended {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #f3d48a;
}

.dns-guide {
  display: block;
  margin-top: 0.35rem;
}

.domain-notes {
  margin: 0.75rem 0 0;
  padding-left: 1.15rem;
}

.domain-notes li { margin: 0.28rem 0; color: var(--muted); }

.domain-card > .btn { margin-top: 0.85rem; }

.spam-filter { margin-top: 1.25rem; }

.spam-filter h2 { margin: 0 0 0.35rem; font-size: 1.25rem; }

.spam-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin-top: 0.85rem;
}

.spam-row p { margin: 0; }

.spam-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mailbox-heading {
  margin: 1.15rem 0 0.3rem;
  font-size: 1.05rem;
}

.mailbox-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(9rem, 0.7fr) minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.mailbox-address { margin: 0; overflow-wrap: anywhere; }

.mailbox-row select,
.mailbox-row input,
.mailbox-form input,
.mailbox-form select {
  width: 100%;
  min-height: 44px;
}

.mailbox-form { margin-top: 0.85rem; }

.mode-choices { display: flex; flex-wrap: wrap; gap: 0.55rem; }

.mailbox-form .mode-choice,
.mailbox-edit .mode-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  flex: 1 1 100%;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.mode-choice input {
  width: auto;
  min-height: 1.15rem;
  margin: 0 0 0.2rem;
}

.mode-choice.is-selected {
  border-color: rgba(157, 222, 181, 0.75);
  background: rgba(157, 222, 181, 0.08);
}

.mode-title { font-weight: 700; }

.mode-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.forward-editor { margin-top: 0.85rem; }

.forward-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.forward-list { display: flex; flex-direction: column; gap: 0.45rem; }

.forward-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.forward-row input { flex: 1 1 12rem; min-width: 0; }

.forward-row .btn,
.forward-editor > .btn { width: auto; min-height: 44px; }

.forward-editor > .btn { margin-top: 0.45rem; }

.field-error {
  margin: 0.35rem 0 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.mailbox-edit { margin-top: 0.45rem; }

.mailbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.mailbox-actions .btn {
  width: auto;
  min-height: 44px;
  margin-top: 0;
}

.mailbox-delete-confirm {
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.mailbox-delete-confirm p {
  margin: 0;
}

.mailbox-delete-confirm .mailbox-actions {
  margin-top: 0.65rem;
}

.mailbox-meta {
  margin: 0.2rem 0 0.15rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (min-width: 721px) {
  .mailbox-form .mode-choice,
  .mailbox-edit .mode-choice { flex: 1 1 14rem; }
}

.mailbox-form fieldset,
.mailbox-edit fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.mailbox-form legend,
.mailbox-edit legend {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .mailbox-row { grid-template-columns: 1fr; }

  .dns-table { table-layout: auto; }
  .dns-table th:nth-child(1),
  .dns-table td:nth-child(1),
  .dns-table th:nth-child(2),
  .dns-table td:nth-child(2),
  .dns-table th:nth-child(3),
  .dns-table td:nth-child(3),
  .dns-table th:nth-child(5),
  .dns-table td:nth-child(5) { width: auto; }
  .dns-table thead { display: none; }
  .dns-table,
  .dns-table tbody,
  .dns-table tr,
  .dns-table td { display: block; width: 100%; }
  .dns-table tr {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }
  .dns-table td { border: 0; padding: 0.12rem 0; }
}

.account-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 0.5rem;
}

.acct-mount { margin-top: 0.85rem; }

.acct-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 1.1rem 0 0.75rem;
}

.acct-toolbar h2,
.acct-toolbar h3,
.acct-section-title {
  margin: 0.9rem 0 0.45rem;
}

.acct-cards,
.dns-stack {
  display: grid;
  gap: 0.75rem;
  align-items: start;
}

.acct-card,
.acct-mailbox,
.dns-record,
.acct-empty,
.acct-callout,
.acct-danger,
.acct-spam {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.acct-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.acct-card > .btn { margin-top: 0.85rem; }

.acct-inbox { margin-top: 0.75rem; }

.acct-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.7rem;
}

.acct-card-top h2,
.acct-card-top h3,
.acct-empty h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.acct-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.acct-badge.is-verified,
.acct-badge.is-active { color: #9ddeb5; }
.acct-badge.is-pending { color: #f3d48a; }
.acct-badge.is-failed,
.acct-badge.is-removed,
.acct-badge.is-unknown { color: #ffb4b4; }

.acct-kicker {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.acct-next { margin: 0.55rem 0 0.2rem; }
.acct-callout-title { font-weight: 600; margin-top: 0.15rem; }
.acct-empty p,
.acct-callout p,
.acct-danger p,
.acct-forward { margin: 0.35rem 0 0; overflow-wrap: anywhere; }
.acct-empty .btn,
.acct-back { margin-top: 0.75rem; }

.acct-preview {
  margin: 0.75rem 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--muted);
}

.acct-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.acct-copy code {
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.acct-copy-btn { min-height: 44px; }

.acct-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.acct-actions .btn,
.acct-toolbar .btn,
.acct-back { min-height: 44px; }

.acct-mount .btn:disabled { opacity: 0.6; cursor: not-allowed; }
.acct-removed { margin-top: 0.9rem; }
.acct-removed:not([open]) > .acct-cards { display: none; }
.acct-removed summary {
  cursor: pointer;
  min-height: 44px;
  padding: 0.35rem 0;
  font-weight: 600;
}
.acct-removed-title,
.acct-removed summary .fine { display: block; }
.acct-removed summary .fine {
  margin-top: 0.2rem;
  font-weight: 400;
}
.acct-removed .acct-cards { margin: 0.75rem 0 0.35rem; }

.acct-modes {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.55rem;
}

.acct-mode {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  align-items: start;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.acct-mode input { grid-row: 1 / span 2; margin-top: 0.35rem; width: 1.1rem; height: 1.1rem; }
.acct-mode .fine { grid-column: 2; }

.acct-danger { border-color: var(--danger-border); }
.dns-record-type { margin: 0; font-weight: 700; }
.dns-recommended { margin-left: 0.45rem; }

@media (min-width: 800px) {
  .acct-cards { grid-template-columns: 1fr 1fr; }
  .dns-stack { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .acct-actions .btn,
  .acct-toolbar .btn,
  .acct-form .btn { width: 100%; }
}

/* A calm, compact sign-in and consistent, readable workspace. */
.app-main { padding-block: 3rem 4rem; }
#authPanel { padding: clamp(1.3rem, 4vw, 2.5rem); }
#authPanel h1 { font-size: 2rem; letter-spacing: -0.04em; }
#authPanel .oauth-row { gap: 0.65rem; }
.password-field { display: flex; align-items: stretch; position: relative; }
.password-field input { width: 100%; padding-right: 4.5rem; }
.password-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); padding-inline: 0.85rem; cursor: pointer; min-width: 44px; font-weight: 600; }
.password-toggle:hover { background: var(--surface-2); }
.auth-recovery { display: flex; justify-content: flex-end; margin-top: 0.3rem; }
.text-button { border: 0; background: transparent; color: var(--accent); min-height: 44px; padding: 0.5rem 0; cursor: pointer; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 0.2em; }
.auth-switch { margin-top: 0.2rem; }
.oauth-note { border-top: 1px solid var(--border); padding-top: 1.2rem; line-height: 1.6; }
.panel, .workspace, .customer-home, .inbox-layout > * { min-width: 0; }
.mailbox-picker select { appearance: auto; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 0.65rem; min-height: 44px; }
.app-switch, .account-switch { border-radius: 12px; }
.app-switch .tab, .account-switch .tab { border-radius: 8px; }
.from-line code { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 640px) {
  .app-main { padding-top: 1.5rem; }
  .panel { padding: 1.15rem; }
  .inbox-tools, .settings-actions { width: 100%; }
  .inbox-head { flex-direction: column; align-items: stretch; }
  .inbox-tools { min-width: 0; justify-content: flex-start; }
  .mailbox-picker { width: 100%; flex-direction: column; align-items: stretch; }
  .mailbox-picker select { width: 100%; min-width: 0; }
  .app-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .app-switch .tab { padding-inline: 0.4rem; font-size: 0.84rem; }
  .from-line { flex-wrap: wrap; gap: 0.35rem; }
}

.mailbox-setup { padding: 2rem 1.25rem; margin-top: 1.25rem; border: 1px dashed var(--border); border-radius: 12px; background: var(--bg-alt); text-align: center; }
.mailbox-setup h2 { margin: 0 0 0.65rem; font-size: 1.35rem; }
.mailbox-setup p { color: var(--muted); max-width: 36rem; margin: 0 auto 1.25rem; }
.mailbox-setup > a { display: block; margin-top: 0.9rem; }

.customer-verification { margin-bottom: 1rem; }
.customer-verification h2 { margin: 0 0 0.65rem; font-size: 1.35rem; }
.customer-verification .fine { margin-top: 0.75rem; }
.customer-verification .gate-actions { flex-wrap: wrap; }

.staff-signup { margin-bottom: 1rem; }
.staff-signup h2 { margin: 0 0 0.75rem; }

/* Email content is displayed only in an isolated sandbox. */
.email-view-tools { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; margin:.75rem 0; }
.email-view-tools .fine { flex-basis:100%; max-width:70ch; }
.email-html-frame { display:block; width:100%; height:420px; min-height:220px; resize:vertical; border:1px solid var(--line, #d7dfda); border-radius:10px; background:#fff; }
.email-html-frame[hidden], .inbox-body[hidden] { display:none; }
.html-compose-controls { display:flex; align-items:center; gap:.75rem; flex-wrap:wrap; }
.html-compose-controls label { display:flex; align-items:center; gap:.5rem; }
.html-compose-controls input { width:auto; }
.html-compose-preview { margin:.75rem 0; }
.html-compose-preview[hidden], #htmlFields[hidden] { display:none; }
#html { font-family:ui-monospace,SFMono-Regular,Consolas,monospace; }

/* Mailbox management keeps long domain names inside a labelled native picker. */
.acct-domain-picker { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; width: min(100%, 32rem); font-weight: 600; }
.acct-domain-picker select { width: 100%; min-width: 0; max-width: 100%; min-height: 2.75rem; font: inherit; padding: 0.65rem 0.75rem; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.acct-domain-picker select:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.acct-product-note { padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); }

/* Selected tenant and team access stay distinct from sign-in identity. */
.tenant-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.tenant-bar[hidden] { display: none; }
.tenant-picker { display: grid; gap: .35rem; min-width: 14rem; max-width: 100%; flex: 1; }
.tenant-picker select { width: 100%; min-height: 44px; padding: .65rem; color: var(--text); background: var(--surface, #101827); border: 1px solid var(--border); border-radius: 10px; }
.tenant-summary { flex: 2; min-width: 12rem; }
.tenant-summary p { margin: .25rem 0; }
.tenant-bar .error { flex-basis: 100%; margin: 0; }
.team-list { display: grid; gap: .6rem; }
.team-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; padding: .9rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.team-row p { margin: .3rem 0 0; }
.team-invite { margin: 1.5rem 0; max-width: 42rem; }
.team-review { margin: 1.25rem 0; padding: 1.15rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface, #101827); overflow-wrap: anywhere; }
.team-review h2 { margin-top: 0; }
.team-key { width: 100%; padding: .75rem; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 520px) {
  .tenant-bar, .team-row { align-items: stretch; }
  .tenant-bar > *, .team-row > *, .team-row .btn { width: 100%; }
  .team-row .acct-actions { flex-wrap: wrap; }
}

/* Mailbox setup: bounded readable forms and tap-sized controls. */
.acct-mode-badge { flex-shrink: 0; align-self: flex-start; border-radius: 999px; background: var(--surface-2, #203449); color: var(--text, #1b2450); font-size: .78rem; font-weight: 600; padding: .3rem .65rem; }
.acct-mailbox .acct-card-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; width: 100%; }
.acct-mailbox .acct-card-top .acct-mode-badge { justify-self: end; }
.acct-mailbox .acct-card-top h3 { min-width: 0; overflow-wrap: anywhere; }
.mailbox-password, .mailbox-connections, .mailbox-delivery { margin-block: 1.25rem; }
.mailbox-password { padding: 1.15rem; border: 1px solid var(--border, #dce1ea); border-radius: 14px; background: var(--surface, #fff); }
.mailbox-password-input { width: 100%; min-width: 0; min-height: 2.75rem; font-family: ui-monospace, monospace; }
.mailbox-password .acct-actions { margin-block: .75rem; }
.mailbox-strength { width: 100%; height: 1rem; display: block; }
.mailbox-strength::-webkit-meter-bar { background: #e9ecf2; border: 0; border-radius: 12px; }
.mailbox-strength::-webkit-meter-optimum-value { background: #25885b; }
.mailbox-strength[data-strength="0"]::-webkit-meter-optimum-value, .mailbox-strength[data-strength="1"]::-webkit-meter-optimum-value { background: #bd4c2c; }
.mailbox-settings-list { margin: .75rem 0; }
.mailbox-setting { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 3fr); gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--border, #dce1ea); }
.mailbox-setting dt { padding-top: .65rem; font-weight: 600; font-size: .88rem; }
.mailbox-setting dd { margin: 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem .75rem; min-width: 0; }
.mailbox-setting code { overflow-wrap: anywhere; min-width: 0; }
.mailbox-setting button { min-height: 44px; }
.mailbox-provisioning h3 { margin-top: 0; }
@media (max-width: 540px) {
  .mailbox-password { padding: .85rem; }
  .mailbox-password .acct-actions { display: grid; grid-template-columns: 1fr; }
  .mailbox-setting { grid-template-columns: 1fr; gap: .2rem; }
  .mailbox-setting dt { padding-top: .25rem; }
}

/* Measurement time stays visible beside authoritative per-mailbox disk usage. */
.acct-storage-observed { display: block; margin-top: .25rem; overflow-wrap: anywhere; }
