:root {
  --bg: #f2f2f6;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-strong: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, 0.10);
  --accent: #007aff;
  --danger: #ff3b30;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
  max-width: 100%;
}
button { cursor: pointer; }
code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.06);
}





.app-shell::before,
.app-shell::after {
  content: "";
  position: fixed;
  left: 50%;
  z-index: 20;
  transform: translateX(-50%);
  width: min(100%, 920px);
  height: calc(59px + var(--safe-bottom));
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.app-shell::before {
  top: 0;
  background: linear-gradient(
    180deg,
    rgba(242, 242, 246, 0.98) 0%,
    rgba(242, 242, 246, 0.92) 48%,
    rgba(242, 242, 246, 0.72) 72%,
    rgba(242, 242, 246, 0) 100%
  );
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 58%, rgba(0, 0, 0, 0.68) 78%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 58%, rgba(0, 0, 0, 0.68) 78%, transparent 100%);
}

.app-shell::after {
  bottom: 0;
  background: linear-gradient(
    180deg,
    rgba(242, 242, 246, 0) 0%,
    rgba(242, 242, 246, 0.72) 42%,
    rgba(242, 242, 246, 0.96) 100%
  );
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.65) 48%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.65) 48%, #000 100%);
}

.app-shell {
  width: min(100%, 920px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 54px;
  padding: 8px 16px;
  background: rgba(245, 245, 247, 0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.app-topbar__title {
}
.app-topbar__left { justify-self: start; }
.app-topbar__right { justify-self: end; }
.top-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--accent);
}
.app-content {
  padding: 14px 18px calc(90px + var(--safe-bottom));
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 15;
  transform: translateX(-50%);
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: rgba(250, 250, 252, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.bottom-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  color: var(--muted);
  font-size: 11px;
}
.bottom-tab__icon { font-size: 20px; line-height: 1; color: var(--accent); }
.tab-badge {
  position: absolute;
  top: 2px;
  right: 20%;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
}

.flash-list { padding: 12px 55px 0; }
.flash {
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(0, 122, 255, 0.10);
  color: #074e9a;
}
.flash--success { background: rgba(52, 199, 89, 0.14); color: #166534; }
.flash--error { background: rgba(255, 59, 48, 0.12); color: #991b1b; }

.section-heading, .mailbox-header, .thread-title, .hero-card, .note-card, .form-card, .compose-card, .reply-card, .actions-panel, .empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.section-heading, .hero-card, .note-card, .form-card, .compose-card, .reply-card, .actions-panel, .empty-state {
  padding: 18px;
  margin-bottom: 14px;
}
.section-heading h1, .hero-card h1, .mailbox-header h1, .thread-title h1, .empty-state h1 {
  margin: 0;
  font-size: clamp(26px, 7vw, 42px);
  line-height: 1.05;
}
.section-heading p, .hero-card p, .mailbox-header p, .thread-title p, .note-card p, .empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.hero-card--center { text-align: center; }
.mail-logo {
  width: 74px;
  height: 74px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(180deg, #48a7ff, #007aff);
  color: #fff;
  font-size: 38px;
  box-shadow: 0 16px 40px rgba(0, 122, 255, 0.28);
}

.account-list { display: grid; gap: 12px; }
.account-card {
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.account-card__main {
  display: flex;
  gap: 14px;
  padding: 16px;
  align-items: center;
}
.avatar, .message-row__avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
}
.account-card__text { display: grid; gap: 3px; min-width: 0; }
.account-card__text b { font-size: 18px; }
.account-card__text small { color: var(--muted); overflow-wrap: anywhere; }
.account-card__counts {
  border-top: 1px solid var(--line);
  display: grid;
  background: rgba(17, 24, 39, 0.02);
}
.account-card__counts a {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid rgba(17, 24, 39, 0.06);
}
.account-card__counts a:first-child { border-top: 0; }

.mailbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  margin-bottom: 12px;
}
.round-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 12px 28px rgba(0, 122, 255, 0.30);
}
.search-box { margin-bottom: 12px; }
.search-box input {
  width: 100%;
  border: 0;
  border-radius: 16px;
  min-height: 46px;
  padding: 0 16px;
  background: rgba(118, 118, 128, 0.12);
  outline: none;
}
.segmented-scroll, .folder-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}
.segmented-scroll::-webkit-scrollbar, .folder-strip::-webkit-scrollbar { display: none; }
.chip, .folder-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.chip--active, .folder-pill--active { background: var(--text); color: #fff; }
.message-list { display: grid; gap: 12px; }
.message-row {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}
.message-row--unread { border-color: rgba(0, 122, 255, 0.45); }
.message-row__link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px;
}
.message-row__body { min-width: 0; }
.message-row__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.message-row__top b, .message-row__subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-row__top time { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.message-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.message-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.message-row__meta span, .synthetic-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(0, 122, 255, 0.10);
  color: #075985;
  font-size: 12px;
}

.thread-title { padding: 18px; margin-bottom: 12px; }
.thread-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
}
.icon-action {
  border: 1px solid var(--line);
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}
.icon-action--danger { color: var(--danger); }
.conversation { display: grid; gap: 14px; }
.bubble {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}
.bubble--sent { background: #e8f2ff; border-color: rgba(0, 122, 255, 0.18); }
.bubble__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.bubble__header div { min-width: 0; }
.bubble__header b, .bubble__header small { display: block; overflow-wrap: anywhere; }
.bubble__header small, .bubble__to, .bubble__header time { color: var(--muted); font-size: 12px; }
.bubble__body { margin-top: 12px; line-height: 1.48; overflow-wrap: anywhere; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.attachment-pill {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.8);
}
.reply-card { margin-top: 14px; }
.reply-card h2 { margin: 0 0 10px; }

.form-card, .compose-card, .reply-card { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; }
.field {
  display: grid;
  gap: 7px;
}
.field input, .field select, .field textarea, .compose-card input, .compose-card select, .compose-card textarea, .reply-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  min-height: 46px;
  padding: 11px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
.field textarea, .compose-card textarea, .reply-card textarea { resize: vertical; min-height: 130px; }
.field input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
}
.field--clear_existing {
  grid-template-columns: auto 1fr;
  align-items: center;
}
.field--clear_existing span { grid-column: 2; grid-row: 1; }
.field--clear_existing input { grid-column: 1; grid-row: 1; }

.btn {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  width: 100%;
}
.btn--primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn--ghost { background: transparent; color: var(--muted); }
.actions-panel { display: grid; gap: 10px; }
.empty-state { text-align: center; }
.empty-state--large { margin-top: 40px; }

@media (min-width: 760px) {
  .account-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--clear_existing { grid-column: 1 / -1; }
  .actions-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-color-scheme: dark) {

  .app-shell::before {
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.98) 0%,
      rgba(0, 0, 0, 0.92) 48%,
      rgba(0, 0, 0, 0.72) 72%,
      rgba(0, 0, 0, 0) 100%
    );
  }

  .app-shell::after {
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0.68) 42%,
      rgba(0, 0, 0, 0.96) 100%
    );
  }
  :root {
    --bg: #000000;
    --surface: rgba(28, 28, 30, 0.92);
    --surface-strong: #1c1c1e;
    --text: #f8fafc;
    --muted: #a1a1aa;
    --line: rgba(255, 255, 255, 0.12);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  }
  .app-shell { background: #000000; }
  .app-topbar, .bottom-tabs { background: rgba(17, 17, 19, 0.86); }
  body { background: #000000; }
  .search-box input, .chip, .folder-pill, .icon-action, .field input, .field select, .field textarea, .compose-card input, .compose-card select, .compose-card textarea, .reply-card textarea, .bubble, .btn { background: #1c1c1e; }
  .bubble--sent { background: rgba(0, 122, 255, 0.16); }
  code { background: rgba(255,255,255,0.10); }
}



.mailboxes-floating-title {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: 50%;
  z-index: 60;
  transform: translateX(-50%) translateY(-4px);
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 140px;
  color: var(--text);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.mailboxes-floating-title b {
  font-size: 15px;
  line-height: 1.1;
}

.mailboxes-floating-title small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.mailboxes-screen--scrolled .mailboxes-floating-title {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* iOS-like mailbox home screen */
.mailboxes-screen .app-shell {
  background: var(--bg);
}
.mailboxes-screen .app-content {
  min-height: 100vh;
}
.mailboxes-page {
  width: 100%;
}
.mailboxes-header {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding-top: 42px;
}
.mailboxes-header__top {
  display: flex;
  pointer-events: none;
}
.mailboxes-header h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1;
}
.mailboxes-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}
.mailboxes-edit-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 11px 13px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #000000;
  font-size: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  pointer-events: auto;
}
.ios-mail-list {
  overflow: hidden;
  display: grid;
  margin: 0 0 28px;
  background: var(--surface-strong);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.ios-mail-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 47px;
  padding: 7px 14px;
  font-size: 17px;
}
.ios-mail-row + .ios-mail-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 54px;
  right: 0;
  height: 1px;
  background: var(--list-line, rgba(60, 60, 67, 0.16));
}
.ios-mail-row__mail-icon {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
}
.ios-mail-row__right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ios-mail-row__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ios-mail-row__chevron-icon {
  display: block;
  width: 10px;
  height: 18px;
  object-fit: contain;
}
.ios-mail-row__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ios-mail-row__count {
  color: var(--muted);
  font-size: 16px;
}

.ios-mail-list--top .ios-mail-row {
  transition: padding-left 0.18s ease;
}

.ios-mail-row__edit-check {
  position: absolute;
  left: 14px;
  top: 50%;
  z-index: 2;
  width: 22px;
  height: 22px;
  transform: translateY(-50%) scale(0.92);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #007aff;
  color: #ffffff;
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.ios-mail-row__handle {
  display: none;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-direction: column;
}

.ios-mail-row__handle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--muted);
}

.mailboxes-screen--edit .ios-mail-list--top .ios-mail-row {
  padding-left: 48px;
}

.mailboxes-screen--edit .ios-mail-row__edit-check {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

.mailboxes-screen--edit .mailboxes-edit-button {
  background: #007aff;
  color: #ffffff;
}

.mailboxes-screen--edit .ios-mail-list--top .ios-mail-row__chevron {
  display: none;
}


.mailboxes-edit-button,
.ios-mail-list--top .ios-mail-row {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.mailboxes-edit-button:focus,
.mailboxes-edit-button:active,
.ios-mail-list--top .ios-mail-row:focus,
.ios-mail-list--top .ios-mail-row:active,
.ios-mail-row__edit-check:focus,
.ios-mail-row__edit-check:active {
  outline: none;
}

.mailboxes-screen--edit .ios-mail-row__edit-check {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}


.mailboxes-screen--edit .ios-mail-list--top .ios-mail-row__edit-check {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

.ios-mail-row__edit-check.is-unchecked {
  background: transparent;
  color: transparent;
  box-shadow: inset 0 0 0 2px rgba(142, 142, 147, 0.9);
}

.mailboxes-screen--edit .ios-mail-list--top .ios-mail-row__handle {
  display: inline-flex;
}

.mailboxes-section-title {
  margin: 0 0 8px;
  padding-left: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}
.compose-floating-button {
  pointer-events: auto;
  position: fixed;
  right: max(22px, calc((100vw - 920px) / 2 + 22px));
  bottom: calc(24px + var(--safe-bottom));
  z-index: 80;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}
.compose-floating-button__icon {
  display: block;
  width: 21px;
  height: 21px;
  object-fit: contain;
}



.compose-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.compose-modal-sheet {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  top: calc(38px + var(--safe-top));
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-radius: 28px 28px 0 0;
  background: var(--surface-strong);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translate(var(--compose-modal-x, 0), var(--compose-modal-y, 220px)) scale(0.08);
  transform-origin: 100% 100%;
  transition: transform 0.34s cubic-bezier(0.18, 0.88, 0.22, 1), opacity 0.22s ease;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

.compose-modal-handle {
  width: 100%;
  min-height: 64px;
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 10px 16px 8px;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}


.compose-modal-handle-line {
  width: 42px;
  height: 5px;
  justify-self: center;
  display: block;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.38);
  pointer-events: none;
}

.compose-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
}

.compose-modal-round-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(118, 118, 128, 0.14);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.compose-modal-round-button:focus,
.compose-modal-round-button:active,
.compose-modal-round-button:focus-visible {
  outline: none;
}

.compose-modal-send {
  background: #007aff;
  color: #ffffff;
  font-size: 22px;
}

.compose-modal-title {
  margin: 18px 18px 8px;
  font-size: 30px;
  line-height: 1.1;
}

.compose-modal-form {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  padding: 0 18px calc(18px + var(--safe-bottom));
}

.compose-modal-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
}

.compose-modal-field input,
.compose-modal-body {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  box-shadow: none;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.compose-modal-field input {
  min-height: 42px;
  padding: 0;
}

.compose-modal-body {
  flex: 1 1 auto;
  min-height: 220px;
  resize: none;
  padding: 14px 0 0;
  line-height: 1.45;
}

.compose-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.compose-modal-sheet.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, 0) scale(1);
}

.compose-modal-sheet.is-dragging {
  transition: none;
}


@media (prefers-color-scheme: dark) {
  .compose-modal-overlay {
    background: rgba(0, 0, 0, 0.42);
  }

  .compose-modal-round-button {
    background: rgba(118, 118, 128, 0.24);
  }
}

.compose-floating-button,
.compose-floating-button:focus,
.compose-floating-button:active,
.compose-floating-button:focus-visible,
.compose-floating-button__icon {
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.compose-floating-button:focus,
.compose-floating-button:active,
.compose-floating-button:focus-visible {
  outline: none;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --list-line: rgba(84, 84, 88, 0.62);
  }
  .mailboxes-edit-button,
  .ios-mail-list {
    background: #1c1c1e;
  }
  .mailboxes-edit-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 11px 13px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #000000;
  font-size: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  pointer-events: auto;
}
  .mailboxes-header p,
  .mailboxes-section-title,
  .ios-mail-row__count {
    color: #8e8e93;
  }
}


/* iOS-like inbox page */
.mailbox-screen .app-content {
  min-height: 100vh;
  padding: 0 18px calc(118px + var(--safe-bottom));
}

.mailbox-page {
  min-height: 100vh;
  padding-top: 74px;
  transform: translateX(0);
}

@keyframes mailboxSlideFromRight {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

.mail-ios-fixed-actions {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: 50%;
  right: auto;
  z-index: 120;
  transform: translateX(-50%);
  width: min(100%, 920px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  pointer-events: none;
}

.mail-ios-fixed-actions > * {
  pointer-events: auto;
}

.mail-ios-fixed-actions--right {
  justify-content: flex-end;
}

.mail-ios-fixed-actions.mailboxes-header__top {
  position: fixed;
  pointer-events: none;
}


.mail-ios-circle-button,
.mail-ios-pill-button {
  border: 0;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  -webkit-tap-highlight-color: transparent;
  outline: none;
  pointer-events: auto;
}

.mail-ios-circle-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
}

.mail-ios-pill-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 16px;
}

.mail-ios-circle-button:focus,
.mail-ios-circle-button:active,
.mail-ios-circle-button:focus-visible,
.mail-ios-pill-button:focus,
.mail-ios-pill-button:active,
.mail-ios-pill-button:focus-visible {
  outline: none;
}


.mailbox-select-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 11px 13px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #000000;
  font-size: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  pointer-events: auto;
}

.mail-ios-back-chevron {
  display: block;
  width: 12px;
  height: 18px;
  object-fit: contain;
  transform: rotate(180deg);
}


.mail-ios-fixed-actions.mailbox-page-actions {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 10px;
}

.mailbox-floating-title {
  align-self: center;
  justify-self: start;
  display: grid;
  justify-items: start;
  gap: 2px;
  min-width: 0;
  color: var(--text);
  text-align: left;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.mailbox-floating-title b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.1;
}

.mailbox-floating-title small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.mailbox-screen--scrolled .mailbox-floating-title {
  opacity: 1;
  transform: translateY(0);
}

.mailbox-page-header {
  margin-bottom: 16px;
}

.mailbox-page-header h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1;
}

.mailbox-page-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.mailbox-message-list {
  overflow: hidden;
  display: grid;
  margin: 0 0 120px;
  background: var(--surface-strong);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.mailbox-message-row {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 74px;
  padding: 11px 14px;
}

.mailbox-message-row + .mailbox-message-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 0;
  height: 1px;
  background: var(--list-line, rgba(60, 60, 67, 0.16));
}

.mailbox-message-row__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
}

.mailbox-message-row__top b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  line-height: 1.2;
}

.mailbox-message-row__top time {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
}

.mailbox-message-row__preview {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mailbox-empty-state {
  padding: 18px 14px;
}

.mailbox-empty-state p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.mailbox-bottom-bar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 75;
  transform: translateX(-50%);
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  pointer-events: none;
}

.mailbox-bottom-bar > * {
  pointer-events: auto;
}

.mailbox-filter-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.mailbox-filter-button span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.mailbox-filter-button span:nth-child(1) {
  width: 18px;
}

.mailbox-filter-button span:nth-child(2) {
  width: 14px;
}

.mailbox-filter-button span:nth-child(3) {
  width: 10px;
}

.mailbox-bottom-search {
  min-height: 46px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.mailbox-bottom-search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  box-shadow: none;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.mailbox-bottom-search span {
  font-size: 30px;
  line-height: 1;
}

.mailbox-bottom-bar .compose-floating-button {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
}

@media (prefers-color-scheme: dark) {

  .mailbox-select-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 11px 13px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  pointer-events: auto;
}
  .mail-ios-circle-button,
  .mail-ios-pill-button,
  .mailbox-message-list,
  .mailbox-bottom-search {
    background: #1c1c1e;
  }
}


@keyframes mailboxesSlideFromLeft {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes mailboxSlideToRight {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(100%);
  }
}



html.mail-opening-mailbox-preload,
html.mail-opening-mailbox-preload body,
html.mail-returning-home-preload,
html.mail-returning-home-preload body {
  background: var(--bg);
  overflow-x: hidden;
}

html.mail-opening-mailbox-preload body.mailbox-screen .mailbox-page {
  transform: translateX(100%);
  will-change: transform;
}

html.mail-opening-mailbox-preload.mail-opening-mailbox-animate body.mailbox-screen .mailbox-page {
  animation: mailboxSlideFromRight 0.34s cubic-bezier(0.22, 0.82, 0.2, 1) both;
}

html.mail-returning-home-preload body.mailboxes-screen .mailboxes-page {
  transform: translateX(-100%);
  will-change: transform;
}

html.mail-returning-home-preload.mail-returning-home-animate body.mailboxes-screen .mailboxes-page {
  animation: mailboxesSlideFromLeft 0.34s cubic-bezier(0.22, 0.82, 0.2, 1) both;
}

/* Dark buttons text fix */

@media (prefers-color-scheme: dark) {
  .mailboxes-edit-button,
  .mail-ios-circle-button,
  .mail-ios-pill-button,
  .mailbox-select-button,
  .compose-modal-round-button {
    color: #ffffff;
  }

  .compose-modal-send {
    color: #ffffff;
  }
}


/* iOS-like thread page */
.thread-screen .app-content {
  min-height: 100vh;
  padding: 0 0 calc(118px + var(--safe-bottom));
}

.thread-page {
  min-height: 100vh;
  width: 100%;
  padding-top: 74px;
  padding-bottom: 124px;
  transform: translateX(0);
}

.thread-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.thread-pager {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  pointer-events: auto;
}

.thread-pager-button {
  width: 42px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.thread-pager-button + .thread-pager-button {
  border-left: 1px solid var(--line);
}

.thread-pager-button:disabled {
  opacity: 0.35;
}

.thread-pager-chevron {
  display: block;
  width: 12px;
  height: 18px;
  object-fit: contain;
}

.thread-pager-chevron--up {
  transform: rotate(-90deg);
}

.thread-pager-chevron--down {
  transform: rotate(90deg);
}

.thread-letter-card {
  width: 100%;
  overflow: hidden;
  display: grid;
  background: var(--surface-strong);
  border-radius: 24px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.thread-letter-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
}

.thread-letter-sender {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.thread-letter-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #007aff;
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
}

.thread-letter-sender-text {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.thread-letter-sender-text b,
.thread-letter-sender-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-letter-sender-text b {
  font-size: 17px;
  line-height: 1.15;
}

.thread-letter-sender-text small,
.thread-letter-date,
.thread-letter-to {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.thread-letter-date {
  justify-self: end;
  padding-top: 3px;
}

.thread-letter-to {
  grid-column: 1 / -1;
  padding-left: 52px;
}

.thread-letter-content {
  padding: 16px;
  background: #ffffff;
  color: #111827;
}

.thread-letter-content h1,
.thread-letter-body {
  color: #111827;
  font-size: 17px;
  line-height: 1.45;
}

.thread-letter-content h1 {
  margin: 0 0 14px;
  color: #111827;
  font-size: 28px;
  line-height: 1.08;
}

.thread-letter-body {
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
}

.thread-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.thread-attachment-pill {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
  color: var(--text);
  font-size: 14px;
}

.thread-letter-content .thread-attachment-pill {
  color: #111827;
}

.thread-attachment-pill small {
  color: var(--muted);
}

.thread-letter-empty {
  padding: 18px;
}

.thread-letter-empty h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.thread-letter-empty p {
  margin: 8px 0 0;
  color: var(--muted);
}

.thread-bottom-bar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 75;
  transform: translateX(-50%);
  width: min(100%, 920px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  pointer-events: none;
}

.thread-bottom-bar > * {
  pointer-events: auto;
}

.thread-bottom-actions {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.thread-bottom-actions form {
  margin: 0;
}

.thread-bottom-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 21px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.thread-bottom-button:first-child,
.thread-bottom-actions form:first-child .thread-bottom-button {
  border-left: 0;
}


.thread-bottom-button-icon {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.thread-bottom-button:disabled {
  opacity: 0.35;
}

.thread-bottom-bar .compose-floating-button {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
}

@keyframes threadSlideFromRight {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes mailboxSlideFromLeft {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}

html.mail-opening-thread-preload,
html.mail-opening-thread-preload body,
html.mail-returning-mailbox-preload,
html.mail-returning-mailbox-preload body {
  background: var(--bg);
  overflow-x: hidden;
}

html.mail-opening-thread-preload body.thread-screen .thread-page {
  min-height: 100vh;
  width: 100%;
  padding-top: 74px;
  padding-bottom: 124px;
  transform: translateX(0);
}

html.mail-opening-thread-preload.mail-opening-thread-animate body.thread-screen .thread-page {
  min-height: 100vh;
  width: 100%;
  padding-top: 74px;
  padding-bottom: 124px;
  transform: translateX(0);
}

html.mail-returning-mailbox-preload body.mailbox-screen .mailbox-page {
  transform: translateX(-100%);
  will-change: transform;
}

html.mail-returning-mailbox-preload.mail-returning-mailbox-animate body.mailbox-screen .mailbox-page {
  animation: mailboxSlideFromLeft 0.34s cubic-bezier(0.22, 0.82, 0.2, 1) both;
}

@media (prefers-color-scheme: dark) {
  .thread-pager,
  .thread-letter-card {
    background: #1c1c1e;
  }

  .thread-bottom-actions {
    background: #ffffff;
  }

  .thread-pager-button {
    color: #ffffff;
  }

  .thread-bottom-button {
    color: #111827;
  }
}

/* Thread white content block */

@media (prefers-color-scheme: dark) {
  .thread-letter-content {
    background: #ffffff;
    color: #111827;
  }

  .thread-letter-content h1,
  .thread-letter-body,
  .thread-letter-content .thread-attachment-pill {
    color: #111827;
  }
}


/* Thread bottom actions white background */
.thread-bottom-actions {
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .thread-bottom-actions {
    background: #ffffff;
  }
}


.mailbox-infinite-loader {
  min-height: 42px;
  display: grid;
  place-items: center;
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.3;
}

.mailbox-infinite-loader.is-loading {
  opacity: 0.72;
}


.compose-editor-page {
  padding: 18px 0 calc(110px + var(--safe-bottom));
}

.compose-editor-header {
  padding: 18px;
  margin-bottom: 12px;
}

.compose-editor-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
}

.compose-editor-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.compose-editor-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: var(--surface-strong);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.compose-editor-field {
  display: grid;
  gap: 7px;
}

.compose-editor-field span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
}

.compose-editor-field input,
.compose-editor-field select,
.compose-editor-field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 10px 12px;
  outline: none;
}

.compose-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compose-editor-toolbar button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 12px;
}

.compose-html-editor {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  color: #111827;
  padding: 14px;
  line-height: 1.45;
  outline: none;
  overflow-wrap: anywhere;
}

.compose-html-editor p {
  margin: 0 0 12px;
}

.mail-message-inline-image,
.thread-letter-body--html img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  margin: 12px 0;
}

.thread-letter-body--html p {
  margin: 0 0 12px;
}

.thread-letter-body--html a {
  color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .compose-html-editor {
    background: #ffffff;
    color: #111827;
  }
}
