/* ============================================================================
 * TempFox Multi Mail + OTP — Web Edition
 * Full-page stylesheet. Design language ported from the Firefox extension
 * (popup.css + options.css) and expanded to a responsive app layout.
 * ==========================================================================*/
:root {
  color-scheme: light;
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f8fc;
  --text: #1c1c2c;
  --muted: #707186;
  --line: #e6e6ef;
  --line-strong: #d9d9e6;
  --primary: #6759e8;
  --primary-2: #8174ff;
  --primary-soft: #efedff;
  --teal: #179b87;
  --teal-soft: #e7f8f5;
  --danger: #d9455d;
  --danger-soft: #fff0f2;
  --amber: #b77a12;
  --amber-soft: #fff6df;
  --shadow: 0 12px 32px rgba(39, 36, 82, .08);
  --shadow-sm: 0 4px 14px rgba(39, 36, 82, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10101a;
  --surface: #191926;
  --surface-2: #1e1e2e;
  --text: #ececf6;
  --muted: #9a9bb0;
  --line: #2a2a3d;
  --line-strong: #36364d;
  --primary: #8b7df7;
  --primary-2: #9f93ff;
  --primary-soft: #262143;
  --teal: #34c2ab;
  --teal-soft: #12312d;
  --danger: #f2738c;
  --danger-soft: #3a1b26;
  --amber: #e0a63a;
  --amber-soft: #33290f;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

/* The hidden attribute must always win over display utilities such as
   flex/inline-flex used on banners, chips, skeletons, and code cards. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(104, 89, 232, .10), transparent 32%),
    radial-gradient(circle at 96% 12%, rgba(23, 155, 135, .08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(103, 89, 232, .25);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  padding: 10px 14px; border-radius: 0 0 10px 0;
  background: var(--primary); color: #fff; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  border-bottom: 1px solid rgba(230, 230, 239, .8);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
html[data-theme="dark"] .site-header { border-bottom-color: rgba(42, 42, 61, .8); }

.header-inner {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 11px; box-shadow: 0 5px 14px rgba(103, 89, 232, .28); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 16px; letter-spacing: -.01em; }
.brand-copy span { color: var(--muted); font-size: 11px; }

.main-nav { display: flex; gap: 4px; margin-left: 8px; }
.nav-link {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.unread-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.unread-chip span {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px;
  background: var(--primary); color: #fff;
  font-size: 11px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s;
}
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-2); }
.icon-button svg { width: 19px; height: 19px; }
.icon-button.rotating svg { animation: spin .8s linear infinite; }

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

/* theme toggle */
#themeToggle .icon-moon { display: none; }
html[data-theme="dark"] #themeToggle .icon-sun { display: none; }
html[data-theme="dark"] #themeToggle .icon-moon { display: block; }

/* -------------------------------------------------------------------- page */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 70px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 13px 15px;
  border-radius: 13px;
}
.error-banner { border: 1px solid #f1bbc5; background: var(--danger-soft); color: #942b40; }
html[data-theme="dark"] .error-banner { color: #f6a6b8; }
.banner-icon {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--danger); color: #fff;
  font-weight: 900;
}
.banner-copy { display: flex; flex-direction: column; min-width: 0; }
.banner-copy strong { font-size: 13px; }
.banner-copy span { font-size: 12px; opacity: .9; word-break: break-word; }
.banner-close {
  margin-left: auto;
  border: 0; background: none;
  font-size: 20px; line-height: 1;
  color: inherit; opacity: .7;
}
.banner-close:hover { opacity: 1; }

/* --------------------------------------------------------------- hero strip */
.hero-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.hero-copy { max-width: 640px; }
.kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 11px; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase;
}
.hero-copy h1 { margin: 0 0 8px; font-size: clamp(24px, 4.4vw, 36px); letter-spacing: -.035em; line-height: 1.12; }
.hero-copy p { margin: 0; color: var(--muted); font-size: 14px; }

.hero-stats { display: flex; gap: 26px; flex: 0 0 auto; }
.hero-stats div { display: flex; flex-direction: column; align-items: flex-end; }
.hero-stats strong { font-size: 24px; letter-spacing: -.02em; color: var(--primary); }
.hero-stats span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

/* ------------------------------------------------------------------ layout */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  align-items: start;
}

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-heading h2, .danger-zone h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; }
.card-heading p, .danger-zone p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.heading-icon {
  display: grid; flex: 0 0 auto;
  width: 40px; height: 40px;
  place-items: center;
  border-radius: 12px;
}
.heading-icon svg { width: 20px; height: 20px; }
.heading-icon.purple { background: var(--primary-soft); color: var(--primary); }
.heading-icon.teal { background: var(--teal-soft); color: var(--teal); }
.heading-icon.amber { background: var(--amber-soft); color: var(--amber); }

/* ------------------------------------------------------------ address card */
.address-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px; font-weight: 700;
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #c3c4d6; }
.status-pill.online i { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.status-pill.busy i { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.status-pill.offline i { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

.empty-address { text-align: center; padding: 6px 2px 2px; }
.empty-orb {
  display: grid; place-items: center;
  width: 58px; height: 58px;
  margin: 0 auto 12px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
}
.empty-orb svg { width: 28px; height: 28px; }
.empty-address h2 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.02em; }
.empty-address p { margin: 0 auto 16px; max-width: 280px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.domain-label { display: block; text-align: left; margin-bottom: 6px; font-size: 11px; font-weight: 700; color: var(--muted); }

.domain-select, .credential-field input, .address-suffix-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}
.domain-select:focus, input:focus { outline: 3px solid rgba(103, 89, 232, .2); border-color: var(--primary); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 13px;
  transition: filter .15s, transform .15s, background .15s;
}
.button svg { width: 17px; height: 17px; }
.button:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--primary-2); }
.button.secondary { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.button.danger { background: var(--danger); color: #fff; }
.button.wide { width: 100%; margin-top: 12px; }
.button.code-button { background: var(--primary-soft); color: var(--primary); }

.domain-count { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; }

.provider-row { display: flex; gap: 6px; margin-bottom: 12px; }
.provider-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px; font-weight: 800;
}
.domain-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px; font-weight: 700;
}

.address-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
  transition: border-color .15s, background .15s;
}
.address-display:hover { border-color: var(--primary); background: var(--primary-soft); }
.address-display #addressText { font-size: 15px; font-weight: 750; letter-spacing: -.01em; word-break: break-all; }
.copy-mark { color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.copy-mark svg { width: 18px; height: 18px; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.quick-button {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 11px; font-weight: 700;
  transition: border-color .15s, background .15s;
}
.quick-button svg { width: 17px; height: 17px; }
.quick-button:hover { border-color: var(--primary); color: var(--primary); }
.quick-button.accent { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.address-tools { margin-top: 16px; }
.address-tools > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12.5px; font-weight: 700;
  color: var(--muted);
  padding: 8px 2px;
  user-select: none;
}
.address-tools > summary::-webkit-details-marker { display: none; }
.address-tools > summary::before { content: '▸ '; }
.address-tools[open] > summary::before { content: '▾ '; }

.custom-form { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.custom-form label, .credentials-block label, .recent-block label { font-size: 11px; font-weight: 700; color: var(--muted); margin: 8px 0 5px; }
.custom-form label:first-child { margin-top: 0; }

.address-suffix-field { display: flex; align-items: center; }
.address-suffix-field input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.address-suffix-field span {
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden; text-overflow: ellipsis;
}

.divider { height: 1px; margin: 16px 0; background: var(--line); }

.credentials-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.credentials-heading > div { display: flex; flex-direction: column; }
.credentials-heading strong { font-size: 13px; }
.credentials-heading span { color: var(--muted); font-size: 11px; }

.credential-field { display: flex; gap: 6px; }
.credential-field input { flex: 1; min-width: 0; }
.credential-field button {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px; font-weight: 700;
}
.credential-field button:hover { border-color: var(--primary); color: var(--primary); }
.credentials-block > small { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.45; }

.input-action { display: flex; gap: 6px; }
.input-action select { flex: 1; min-width: 0; }
.icon-button.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ----------------------------------------------------------------- API card */
.apis-card { margin-top: 22px; }
.provider-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.provider-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px; font-weight: 700;
}
.provider-chip i { width: 7px; height: 7px; border-radius: 50%; background: #c3c4d6; }
.provider-chip.ok i { background: var(--teal); }
.provider-chip.ok { color: var(--teal); }
.provider-chip.ok.via { border-style: dashed; }
.provider-chip.ok.via i { background: var(--primary); }
.provider-chip.ok.via { color: var(--primary); }
.provider-chip.down i { background: var(--danger); }
.provider-chip.down { color: var(--danger); }
.provider-chip.relay i { background: var(--amber); }
.provider-chip.relay { color: var(--amber); border-style: dashed; }
.provider-chip.unknown { color: var(--muted); }
.api-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.channel-note {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid #b9e4dc;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal);
}
.channel-note strong { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.channel-note span { font-size: 12px; line-height: 1.5; }
.channel-note.bad { border-color: rgba(183, 122, 18, .4); background: var(--amber-soft); color: var(--amber); }

/* ------------------------------------------------------------------- inbox */
.column-right { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.inbox-card { min-height: 480px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; gap: 6px; }

.count-badge {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px; font-weight: 800;
}

.message-skeletons { display: flex; flex-direction: column; gap: 10px; }
.skeleton-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}
.skeleton-card i {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  flex: 0 0 auto;
}
.skeleton-card span, .skeleton-card b {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-card span { width: 40%; }
.skeleton-card b { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-inbox { text-align: center; padding: 46px 16px; }
.radar { position: relative; width: 84px; height: 84px; margin: 0 auto 18px; }
.radar i { position: absolute; inset: 0; border: 1.5px solid var(--primary); border-radius: 50%; opacity: .25; animation: ripple 2.6s ease-out infinite; }
.radar i:nth-child(2) { animation-delay: .9s; }
.radar i:nth-child(3) { animation-delay: 1.8s; }
.radar::after {
  content: '';
  position: absolute; inset: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
}
@keyframes ripple { 0% { transform: scale(.55); opacity: .35; } 100% { transform: scale(1.15); opacity: 0; } }
.empty-inbox h3 { margin: 0 0 5px; font-size: 16px; }
.empty-inbox p { margin: 0; color: var(--muted); font-size: 12.5px; }

.message-list { display: flex; flex-direction: column; gap: 9px; }
.message-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
}
.message-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.message-card.unread { background: var(--primary-soft); border-color: rgba(103, 89, 232, .3); }

.message-avatar {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--primary);
  font-weight: 800;
}
.message-card.unread .message-avatar { background: var(--primary); color: #fff; border-color: var(--primary); }

.message-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.message-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.message-meta strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-meta time { color: var(--muted); font-size: 11px; flex: 0 0 auto; }
.message-subject { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-preview {
  color: var(--muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.message-code {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .06em;
}
.message-arrow { flex: 0 0 auto; color: var(--muted); font-size: 18px; }

/* --------------------------------------------------------------- detail */
.detail-card { min-height: 480px; }
.detail-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.back-button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 700;
}
.back-button svg { width: 16px; height: 16px; }
.back-button:hover { border-color: var(--primary); color: var(--primary); }

.detail-loading { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.big-skeleton, .line-skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.big-skeleton { height: 26px; width: 60%; }
.line-skeleton { height: 14px; width: 100%; }
.line-skeleton.short { width: 40%; }

.detail-time { color: var(--muted); font-size: 12px; }
#detailSubject { margin: 6px 0 14px; font-size: 21px; letter-spacing: -.02em; line-height: 1.25; }
.sender-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sender-avatar {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800; font-size: 17px;
}
.sender-row > div:last-child { display: flex; flex-direction: column; min-width: 0; }
.sender-row strong { font-size: 14px; }
.sender-row span { color: var(--muted); font-size: 12px; }

.code-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(103, 89, 232, .35);
  border-radius: 13px;
  background: var(--primary-soft);
}
.code-card > div { display: flex; flex-direction: column; }
.code-card span { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.code-card strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: .14em;
  color: var(--text);
}

.email-body {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow-y: auto;
}

/* ------------------------------------------------------------- hint card */
.hint-card { display: flex; align-items: center; gap: 16px; padding: 26px; }
.hint-orb {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 52px; height: 52px;
  border-radius: 18px;
  background: var(--primary-soft);
  color: var(--primary);
}
.hint-orb svg { width: 26px; height: 26px; }
.hint-card h3 { margin: 0 0 4px; font-size: 16px; }
.hint-card p { margin: 0; color: var(--muted); font-size: 12.5px; }

/* --------------------------------------------------------------- settings */
.settings-wrap { max-width: 780px; margin: 0 auto; }
.settings-hero { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.brand-mark {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 72px; height: 72px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.brand-mark img { border-radius: 16px; }
.settings-hero h1 { margin: 4px 0; font-size: clamp(24px, 4.5vw, 32px); letter-spacing: -.035em; }
.settings-hero p { margin: 0; color: var(--muted); }

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #b9e4dc;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 13px; font-weight: 650;
}
.notice.error { border-color: #f1bbc5; background: var(--danger-soft); color: var(--danger); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--line); }
.setting-row.first-row { border-top: 0; padding-top: 0; }
.setting-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setting-row label { font-size: 13px; font-weight: 700; }
.setting-row small { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.setting-row select {
  flex: 0 0 auto;
  max-width: 210px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}
.setting-row input[type="url"] {
  flex: 0 0 auto;
  width: 100%;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}
.setting-row input[type="url"]:focus { outline: 3px solid rgba(103, 89, 232, .2); border-color: var(--primary); }
.setting-row small code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.5px; color: var(--primary); }

.switch { position: relative; display: inline-block; flex: 0 0 auto; width: 46px; height: 26px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s;
}
.switch span::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  transition: transform .18s;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid rgba(103, 89, 232, .3); outline-offset: 2px; }

.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.provider-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}
.provider-card strong { font-size: 13px; }
.provider-card span { color: var(--muted); font-size: 11px; }
.provider-card code {
  margin-top: 6px;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
}

.button-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.provider-result { color: var(--muted); font-size: 12.5px; }
.relay-test-row { flex-wrap: wrap; }
.relay-test-row .provider-result { flex: 1 1 280px; }

.permission-panel {
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.permission-panel > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.permission-panel strong { font-size: 13px; }
.permission-panel p { margin: 8px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.access-status { font-size: 12px; font-weight: 700; color: var(--muted); }
.access-status.granted { color: var(--teal); }

.otp-note {
  margin-top: 16px;
  padding: 13px 15px;
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
  background: var(--primary-soft);
}
.otp-note strong { display: block; font-size: 12.5px; margin-bottom: 3px; }
.otp-note span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.otp-note b { color: var(--text); }

.caution { border-color: rgba(183, 122, 18, .35); }
.caution ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; }
.links a { font-size: 12.5px; font-weight: 700; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; }

.savebar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.savebar span { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-weight: 700; }

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px; font-weight: 650;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .hero-strip { flex-direction: column; align-items: flex-start; }
  .hero-stats { width: 100%; justify-content: flex-start; }
  .hero-stats div { align-items: flex-start; }
  .provider-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page { padding: 18px 14px 50px; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .brand-copy span { display: none; }
  .main-nav { margin-left: 0; }
  .nav-link { padding: 8px 10px; }
  #headerUnread { display: none; }
  .hero-copy h1 { font-size: 24px; }
  .quick-actions { grid-template-columns: 1fr 1fr 1fr; }
  .danger-zone { flex-direction: column; align-items: flex-start; }
  .savebar { flex-direction: column; align-items: stretch; }
  .setting-row { flex-direction: column; align-items: flex-start; }
  .setting-row select { max-width: 100%; width: 100%; }
  .setting-row input[type="url"] { max-width: 100%; }
  .code-card { flex-direction: column; align-items: stretch; }
}
