/* ============================================================
   Member mail (#mail, mail.js). Built on the settings vocabulary
   (profile-settings.css .nets-*) and the shared glass/nordic tokens.
   ============================================================ */

.mail-wrap { max-width: 760px; }

.mail-muted {
  font-size: 13px;
  color: var(--glass-label);
  margin: 12px 0 0;
}

/* ── claim: the same card as the onboarding step (simple-mode .sm-sheet) ── */

.mail-claim {
  display: grid;
  gap: 16px;
  width: min(520px, 100%);
  margin-top: 8px;
  padding: 28px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-card, 20px);
  background: var(--nordic-surface, #fff);
  min-width: 0;
}

.mail-claim-orb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
  color: var(--glass-ink);
}
.mail-claim-orb svg { stroke-width: 1.5; }

.mail-claim-eyebrow {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--glass-label);
}

.mail-claim-title {
  margin: 0;
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--glass-ink);
}

.mail-claim-lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--glass-body);
}

.mail-claim .nets-field,
.sm-ob-mailfield .nets-field { margin-top: 0; }

/* The domain reads as the tail of the address being typed. */
.nets-field .mail-address-shell { min-height: 40px; }
.nets-field .mail-address-shell input { padding: 10px 2px 10px 13px; font-size: 13px; box-shadow: none; }
.mail-address-shell .mail-domain {
  padding: 0 13px 0 0;
  color: var(--glass-label);
  font-size: 13px;
}

.mail-claim-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--glass-label);
}

.mail-claim-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.mail-claim .mail-claim-cta { min-height: 48px; padding: 0 24px; font-size: 14px; font-weight: 600; }

/* ── address bar ───────────────────────────────────────────── */

.mail-addressbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding: 4px 4px 18px;
}

.mail-address { display: grid; gap: 2px; min-width: 0; }

.mail-address-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--glass-label);
}

.mail-address-value {
  font-size: clamp(18px, 3.4vw, 24px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--glass-ink);
  overflow-wrap: anywhere;
}

/* ── list ──────────────────────────────────────────────────── */

.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.mail-row + .mail-row { border-top: 1px solid var(--glass-line); }

/* `.mail-row .mail-row-button` outranks the global nordic button skin. */
.mail-row .mail-row-button {
  position: relative;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 14px 18px 14px 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--glass-body);
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  cursor: pointer;
}

.mail-row .mail-row-button:hover:not(:disabled) {
  transform: none;
  background: var(--nordic-hover, rgb(0 0 0 / 4%));
}

.mail-row .mail-row-button:focus-visible {
  outline: 2px solid var(--glass-ink);
  outline-offset: -2px;
}

.mail-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.mail-row-from {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--glass-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-row-clip { color: var(--glass-label); display: inline-flex; align-self: center; }

.mail-row-date {
  flex: none;
  font-size: 12px;
  color: var(--glass-label);
  font-variant-numeric: tabular-nums;
}

.mail-row-subject,
.mail-row-snippet {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-row-subject { font-size: 13px; color: var(--glass-ink); }
.mail-row-snippet { font-size: 12px; color: var(--glass-label); }

.mail-row.is-unread .mail-row-from,
.mail-row.is-unread .mail-row-subject { font-weight: 700; }

.mail-row-dot {
  position: absolute;
  left: 13px;
  top: 21px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--glass-ink);
}

.mail-empty {
  display: grid;
  gap: 6px;
  padding: 28px 22px;
  font-size: 13px;
  color: var(--glass-label);
  line-height: 1.55;
}

.mail-empty strong { color: var(--glass-ink); font-size: 14px; }

.mail-more { margin: 14px auto 0; display: block; }
.mail-more[hidden] { display: none; }

.mail-storage {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-line);
}

/* ── reader ────────────────────────────────────────────────── */

.mail-reader { padding-top: 4px; }

/* A text link, not a pill: the global nordic skin would box it. */
.mail-reader .mail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--glass-label);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.mail-reader .mail-back:hover:not(:disabled) {
  background: none;
  transform: none;
  color: var(--glass-ink);
}

.mail-reader-head { margin-top: 14px; }

.mail-reader-subject {
  margin: 0;
  font-size: clamp(20px, 3.6vw, 26px);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--glass-ink);
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.mail-reader-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 14px;
  margin: 14px 0 0;
  font-size: 13px;
}

.mail-reader-meta dt { color: var(--glass-label); }
.mail-reader-meta dd { margin: 0; color: var(--glass-ink); overflow-wrap: anywhere; min-width: 0; }

.mail-reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.mail-reader-actions .mail-action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
/* The nordic button skin outranks the plain settings class. */
.mail-reader-actions .mail-action.nets-btn-danger { border-color: rgba(163, 32, 32, 0.4); color: var(--nordic-error, #a32020); }
.mail-reader-actions .mail-action.nets-btn-danger:hover:not(:disabled) { background: rgba(163, 32, 32, 0.08); border-color: rgba(163, 32, 32, 0.6); }

/* Attachments: 200px cards under the letter (Gmail-like), wrapping. */
.mail-files { margin-top: 22px; }

.mail-files-label {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--glass-label);
}

.mail-attachments {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.mail-attachment {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  width: 200px;
  padding: 10px 8px 10px 10px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini, 13px);
  background: var(--nordic-surface, #fff);
  color: var(--glass-ink);
  text-decoration: none;
  transition: border-color 0.12s ease;
}

.mail-attachment:hover { border-color: var(--glass-ink); }
.mail-attachment:focus-visible { outline: 2px solid var(--glass-ink); outline-offset: 2px; }

.mail-attachment-badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
  color: var(--glass-ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.mail-attachment-meta { display: block; min-width: 0; }

.mail-attachment-name {
  display: block;
  font-size: 12px;
  color: var(--glass-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-attachment-size { display: block; font-size: 11px; color: var(--glass-label); font-variant-numeric: tabular-nums; }

.mail-attachment-download {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--glass-label);
}
.mail-attachment:hover .mail-attachment-download { background: var(--nordic-hover, rgb(0 0 0 / 5%)); color: var(--glass-ink); }

/* Plain-text links: a grey "opens a new tab" mark (the HTML body gets the same in src/mail.ts). */
.mail-link { color: var(--glass-ink); text-decoration: underline; text-underline-offset: 2px; }
.mail-link::after {
  content: "";
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-left: 0.25em;
  background-color: var(--glass-label);
  -webkit-mask: var(--mail-external-icon) center / contain no-repeat;
  mask: var(--mail-external-icon) center / contain no-repeat;
}

.mail-reader {
  --mail-external-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6'/%3E%3Cpath d='M20 4l-9 9'/%3E%3Cpath d='M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E");
}


/* The letter: one bordered sheet; the "images hidden" strip sits on top. */
.mail-letter {
  margin-top: 20px;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.mail-letter-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--glass-line);
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
  font-size: 11px;
  color: var(--glass-label);
}

/* Email HTML is authored for a white page in any theme. */
.mail-frame {
  display: block;
  width: 100%;
  height: min(75vh, 900px);
  border: 0;
  background: #fff;
}

.mail-text {
  padding: 22px 20px 26px;
  background: #fff;
  color: #111;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .mail-attachments { display: grid; grid-template-columns: 1fr; }
  .mail-attachment { width: 100%; }
  .mail-claim { padding: 22px 18px; }
  .mail-claim .mail-claim-cta { width: 100%; }
  .mail-row .mail-row-button { padding: 12px 14px 12px 26px; }
  .mail-row-dot { left: 11px; top: 19px; }
  .mail-reader-meta { grid-template-columns: 1fr; gap: 0; }
  .mail-reader-meta dd + dt { margin-top: 8px; }
}

/* ── shared bits (mail.js) ─────────────────────────────────── */

.mail-ico { display: inline-flex; flex: none; }
.mail-i { display: block; flex: none; }

/* Long copy on wide screens, the prototype's short copy on phones. */
.mail-label-short { display: none; }
@media (max-width: 560px) {
  .mail-label-long { display: none; }
  .mail-label-short { display: inline; }
}

/* A link that looks like the nordic button (and .primary). */
.mail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini, 13px);
  background: var(--nordic-surface, #fff);
  color: var(--glass-ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s ease;
}
.mail-btn:hover { background: var(--nordic-hover, rgb(0 0 0 / 5%)); }
.mail-btn.primary { background: var(--glass-ink); border-color: var(--glass-ink); color: #fff; }
.mail-btn.primary:hover { background: rgb(0 0 0 / 82%); }
.mail-btn.lg { min-height: 40px; padding: 9px 20px; }
.mail-btn:focus-visible { outline: 2px solid var(--glass-ink); outline-offset: 2px; }

.mail-copy { display: inline-flex; align-items: center; gap: 7px; }

.mail-meter {
  height: 3px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
  overflow: hidden;
}
.mail-meter i { display: block; height: 100%; border-radius: 2px; background: var(--glass-ink); }
.mail-meter.is-warn i { background: var(--nordic-warn, #a06700); }

/* claim field: "available" reads calm, with a check */
.nets-field .nets-hint.is-ok { display: flex; align-items: center; gap: 5px; color: var(--glass-body); }

/* Mail page: status line under the list */
.mail-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 14px 4px 0;
  font-size: 12px;
  color: var(--glass-label);
}
.mail-foot a { color: var(--glass-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.mail-foot-sep { color: var(--nordic-line-strong, rgb(0 0 0 / 18%)); }

/* Mail page: storage warning, only from 80% */
.mail-warnline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 0 0 12px;
  padding: 12px 16px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-nested, 15px);
  font-size: 13px;
  color: var(--glass-body);
}
.mail-warnline b { color: var(--nordic-warn, #a06700); font-weight: 600; }
.mail-warnline .mail-meter { flex-basis: 100%; margin-top: 2px; }

.mail-empty-try {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-line);
}

/* reader meta: sender address muted, "N files below" link */
.mail-muted-inline { color: var(--glass-label); }
.mail-meta-files {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--glass-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.mail-files { scroll-margin-top: 96px; }

/* Settings → Mail (settings.js + mail.js) */
#settingsMail { scroll-margin-top: 96px; }
.mail-settings-field { margin-top: 0; }
.mail-address-ro { background: var(--nordic-fill, rgb(0 0 0 / 4%)); }
.mail-address-ro-value {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--glass-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-address-ro .mail-inline-copy.mail-inline-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 12px;
}
.mail-address-ro .mail-inline-copy:hover:not(:disabled) { background: var(--nordic-hover, rgb(0 0 0 / 5%)); }
.mail-settings-storage {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-line);
}
.mail-settings-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 20px;
}
.mail-settings-cta > div { flex: 1 1 260px; min-width: 0; }
/* The CTA copy uses the toggle-row type outside a toggle row. */
.mail-settings-cta .nets-toggle-copy { font-size: 13px; font-weight: 600; color: var(--glass-ink); }
.mail-settings-cta .nets-toggle-hint { font-size: 12px; color: var(--glass-label); margin: 4px 0 0; line-height: 1.5; max-width: 52ch; }
.nets-togglerow .nets-toggle-hint { line-height: 1.5; max-width: 52ch; }
.mail-cta-phone { display: none; }

/* Settings → Notifications: a list of toggle rows */
.nets-togglelist .nets-togglerow + .nets-togglerow {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--glass-line);
}

/* sidebar: quiet "new" mark until the member opens Mail */
.nav-item em.nav-new {
  padding: 2px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: var(--glass-label);
}
.nav-item em.nav-new[hidden] { display: none; }

/* Onboarding step "Your address" (simple-mode.js) */
.sm-ob-mailorb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
  color: var(--glass-ink);
}
.sm-ob-mailfield .nets-field { margin-top: 0; }
.sm-ob-mailfield .nets-field input { width: 100%; padding: 10px 13px; font-size: 13px; }
.sm-ob-addr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini, 13px);
  background: var(--nordic-fill, rgb(0 0 0 / 4%));
  font-size: 15px;
  font-weight: 600;
}
.sm-ob-addr > span { min-width: 0; overflow-wrap: anywhere; }
.sm-ob-mailorb svg { stroke-width: 1.5; }
.sm-sheet .sm-ob-addr .sm-ob-copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 30px;
  padding: 5px 12px;
  font-size: 12px;
}

@media (max-width: 560px) {
  /* Phone: the CTA sits under the "free now" line, full width (prototype 375). */
  .mail-settings-cta .mail-cta-wide { display: none; }
  .mail-cta-phone { display: flex; }
  .nets-row-end.mail-row-stack { flex-direction: column-reverse; }
  .nets-row-end.mail-row-stack .mail-btn { width: 100%; }
  .nets-togglerow { align-items: flex-start; }
  /* Onboarding step as a bottom sheet: no orb, full-width claim, then Not now and Back. */
  .sm-ob-mail .sm-ob-mailorb { display: none; }
  .sm-ob-mail .sm-title { font-size: 26px; }
  .sm-ob-mail:has(.sm-ob-mailactions) .sm-row.split { display: grid; grid-template-columns: 1fr auto; gap: 16px 10px; }
  .sm-ob-mail .sm-ob-mailactions { display: contents; }
  .sm-ob-mail .sm-ob-mailactions .sm-cta { grid-column: 1 / -1; grid-row: 1; width: 100%; }
  .sm-ob-mail .sm-ob-mailactions [data-ob="back"] { grid-column: 2; grid-row: 2; }
  .sm-ob-mail .sm-row.split > .sm-link { grid-column: 1; grid-row: 2; justify-self: start; }
  .mail-address-ro .mail-inline-copy span:not(.mail-ico) { display: none; }
}
