:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f6f8fc;
  --line: #e5eaf1;
  --line-strong: #d8dee8;
  --text: #172033;
  --text-soft: #364155;
  --muted: #6b7587;
  --muted-2: #9099a8;
  --accent: #5667f2;
  --accent-hover: #4556df;
  --accent-soft: #eef0ff;
  --accent-line: #dfe3ff;
  --danger: #c94141;
  --danger-soft: #fff0f0;
  --success: #23845a;
  --success-soft: #edf9f3;
  --shadow-sm: 0 1px 2px rgba(25, 36, 58, .04), 0 8px 24px rgba(25, 36, 58, .05);
  --shadow-md: 0 18px 50px rgba(25, 36, 58, .10);
  --radius: 16px;
  --radius-sm: 11px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { display: block; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Login */
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 22%, rgba(86, 103, 242, .11), transparent 32%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
}
.login-card {
  width: min(100%, 430px);
  padding: 42px;
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #6d7cf6, #4a5ce3);
  box-shadow: 0 10px 22px rgba(86, 103, 242, .24);
}
.login-brand {
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.login-card h1 {
  margin: 3px 0 8px;
  font-size: clamp(34px, 7vw, 46px);
  line-height: 1;
  letter-spacing: -.04em;
}
.login-copy {
  margin: 0 0 28px;
  color: var(--muted);
}
.login-form { display: grid; gap: 12px; }
.login-form input,
.compose-field input,
.compose-message-field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  outline: 0;
  background: #fff;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.login-form input {
  min-height: 50px;
  padding: 0 15px;
  border-radius: 12px;
}
.login-form input:focus,
.compose-field input:focus,
.compose-message-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(86, 103, 242, .10);
}
.primary-btn,
.send-button,
.compose-button {
  border: 0;
  text-decoration: none;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.primary-btn {
  min-height: 50px;
  border-radius: 12px;
  font-weight: 750;
}
.primary-btn:hover,
.send-button:hover,
.compose-button:hover { background: var(--accent-hover); }
.primary-btn:active,
.send-button:active,
.compose-button:active { transform: translateY(1px); }
.form-error {
  padding: 10px 12px;
  border: 1px solid #f3caca;
  border-radius: 10px;
  color: #9e2f2f;
  background: var(--danger-soft);
  font-size: 13px;
  font-weight: 600;
}

/* Main shell */
.mail-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  background: rgba(255, 255, 255, .94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 20;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 0 8px;
}
.small-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex: 0 0 auto;
}
.sidebar-brand strong,
.sidebar-brand span { display: block; }
.sidebar-brand strong {
  font-size: 15px;
  letter-spacing: -.01em;
}
.sidebar-brand span {
  margin-top: -2px;
  color: var(--muted);
  font-size: 12px;
}
.compose-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 22px 4px 18px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(86, 103, 242, .16);
}
.active-compose { box-shadow: 0 0 0 4px var(--accent-soft), 0 8px 18px rgba(86, 103, 242, .16); }
.folder-nav {
  display: grid;
  gap: 4px;
}
.nav-item {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border-radius: 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  transition: background .14s ease, color .14s ease;
}
.nav-item:hover { background: var(--surface-soft); color: var(--text-soft); }
.nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav-count {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--accent-line);
  font-size: 11px;
  font-weight: 800;
}
.sidebar-account {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--line);
}
.compact-account { grid-template-columns: 36px minmax(0, 1fr); }
.account-avatar,
.sender-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf0f6;
  color: #566177;
  font-weight: 800;
  user-select: none;
}
.account-avatar { width: 36px; height: 36px; font-size: 12px; }
.account-copy { min-width: 0; }
.account-copy strong,
.account-copy span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-copy strong { font-size: 11px; }
.account-copy span { color: var(--muted-2); font-size: 10px; margin-top: 1px; }

.icon-button,
.mobile-compose {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: color .14s ease, border-color .14s ease, background .14s ease, transform .14s ease;
}
.icon-button:hover,
.mobile-compose:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-soft);
}
.icon-button:active,
.mobile-compose:active { transform: translateY(1px); }
.danger-hover:hover { color: var(--danger); background: var(--danger-soft); border-color: #f0caca; }

.mail-main {
  min-width: 0;
  padding: 28px 30px 38px;
}
.mail-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.title-block h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.1;
  letter-spacing: -.035em;
}
.mail-stats {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.mail-stats strong { color: var(--text-soft); }
.dot-separator { margin: 0 5px; color: var(--muted-2); }
.top-actions { display: flex; gap: 8px; }
.mobile-compose { display: none; color: #fff; background: var(--accent); border-color: var(--accent); }
.mobile-brand { display: none; }

.search-wrap { margin-bottom: 16px; }
.search-form {
  position: relative;
  width: min(100%, 680px);
}
.search-form input {
  width: 100%;
  height: 48px;
  padding: 0 80px 0 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(25, 36, 58, .02);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.search-form input:focus { border-color: #cfd5f7; box-shadow: 0 0 0 4px rgba(86, 103, 242, .07); }
.search-form input::placeholder { color: var(--muted-2); }
.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}
.clear-search {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.mail-list-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.message-list { display: grid; }
.message-row {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 8px;
  gap: 13px;
  min-height: 82px;
  align-items: center;
  padding: 14px 18px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background .12s ease;
}
.message-row:last-child { border-bottom: 0; }
.message-row:hover { background: var(--surface-hover); }
.message-row.is-unread { background: linear-gradient(90deg, rgba(86, 103, 242, .042), #fff 32%); }
.message-row.is-unread:hover { background: #f7f8ff; }
.sender-avatar {
  width: 42px;
  height: 42px;
  font-size: 12px;
  letter-spacing: -.02em;
}
.message-row.is-unread .sender-avatar { color: var(--accent); background: var(--accent-soft); }
.message-content { min-width: 0; }
.message-line-one,
.message-subject-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sender-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}
.is-unread .sender-name { color: var(--text); font-weight: 800; }
.message-date {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 650;
}
.message-subject-line { margin-top: 2px; }
.message-subject {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 650;
}
.is-unread .message-subject { color: var(--text); font-weight: 800; }
.attachment-icon { flex: 0 0 auto; color: var(--muted-2); }
.message-preview {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(86, 103, 242, .08);
}
.empty-state {
  min-height: 340px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 40px 24px;
  text-align: center;
}
.empty-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 16px;
  color: var(--accent);
  background: var(--accent-soft);
}
.empty-state h2 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.02em; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}
.pager-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 700;
}
.pager-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.pager-button.disabled { opacity: .42; pointer-events: none; }

/* Reader */
.reader-main,
.compose-main { padding-top: 22px; }
.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.reader-toolbar-left,
.reader-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.reader-location span,
.reader-location strong { display: block; }
.reader-location span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.reader-location strong { margin-top: 1px; font-size: 14px; }
.secondary-action {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text-soft);
  background: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.secondary-action:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.reader-actions form { margin: 0; }

.reader-card {
  max-width: 1120px;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.message-header { padding: 28px 32px 22px; border-bottom: 1px solid var(--line); }
.message-header h1 {
  margin: 0 0 22px;
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1.2;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.sender-block {
  display: flex;
  align-items: center;
  gap: 12px;
}
.large-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
}
.sender-details { min-width: 0; flex: 1; }
.sender-topline {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.sender-topline strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.sender-topline time {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 11px;
  white-space: nowrap;
}
.sender-address {
  min-width: 0;
  display: flex;
  gap: 7px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.sender-address span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.to-line::before { content: "·"; margin-right: 7px; color: var(--muted-2); }

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.attachment-chip {
  min-width: 0;
  max-width: 360px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: #fff;
  text-decoration: none;
}
.attachment-chip:hover { border-color: var(--accent-line); color: var(--accent); }
.attachment-copy { min-width: 0; }
.attachment-copy strong,
.attachment-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-copy strong { color: var(--text-soft); font-size: 11px; }
.attachment-copy small { margin-top: 1px; color: var(--muted-2); font-size: 9px; }

.email-body {
  min-height: 300px;
  padding: 34px 38px 52px;
  color: #242b38;
  font-size: 15px;
  line-height: 1.72;
  overflow-wrap: anywhere;
  overflow-x: auto;
}
.email-body > :first-child { margin-top: 0 !important; }
.email-body > :last-child { margin-bottom: 0 !important; }
.email-body img { max-width: 100% !important; height: auto !important; }
.email-body table { max-width: 100% !important; }
.email-body a { color: #4659dd; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.email-body blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 3px solid var(--line-strong);
  color: #596477;
}
.email-plain { white-space: normal; }

/* Compose */
.compose-main { min-width: 0; }
.compose-card,
.sent-card {
  width: min(100%, 980px);
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.compose-card { overflow: hidden; }
.compose-heading {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.compose-heading div strong,
.eyebrow-label { display: block; }
.eyebrow-label {
  margin-bottom: 1px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.compose-heading strong { font-size: 12px; }
.compose-status {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 800;
}
.compose-form { display: block; }
.compose-field {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  min-height: 58px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}
.compose-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.compose-field input {
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
  font-size: 14px;
}
.compose-field input:focus { border: 0; }
.compose-field input::placeholder,
.compose-message-field textarea::placeholder { color: #a5acb8; }
.compose-message-field textarea {
  min-height: 390px;
  resize: vertical;
  padding: 24px 22px;
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
  line-height: 1.7;
}
.compose-error { margin: 0 22px 16px; }
.compose-footer {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}
.text-button {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.text-button:hover { color: var(--danger); }
.send-button {
  min-width: 108px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 7px 16px rgba(86, 103, 242, .17);
}
.sent-card {
  min-height: 430px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 42px 24px;
  text-align: center;
}
.success-ring {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-soft);
  font-size: 27px;
  font-weight: 850;
}
.sent-card h1 { margin: 18px 0 5px; font-size: 26px; letter-spacing: -.03em; }
.sent-card p { margin: 0; color: var(--muted); }
.sent-actions { display: flex; gap: 10px; margin-top: 22px; }
.link-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  text-decoration: none;
  font-size: 13px;
}

@media (max-width: 900px) {
  .mail-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .mail-main { padding-left: 20px; padding-right: 20px; }
  .message-header { padding-left: 24px; padding-right: 24px; }
  .email-body { padding-left: 28px; padding-right: 28px; }
  .attachment-strip { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  body { background: #f7f8fb; }
  .mail-shell { display: block; padding-bottom: calc(69px + env(safe-area-inset-bottom)); }
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(68px + env(safe-area-inset-bottom));
    display: block;
    padding: 6px 8px env(safe-area-inset-bottom);
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    z-index: 100;
  }
  .sidebar-brand,
  .sidebar > .compose-button,
  .sidebar-account { display: none; }
  .folder-nav {
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
  }
  .nav-item {
    min-width: 62px;
    min-height: 54px;
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 3px 4px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 750;
  }
  .nav-item.active { background: var(--accent-soft); }
  .nav-count { display: none; }
  .mail-main { padding: 19px 14px 22px; }
  .mail-topbar { align-items: center; margin-bottom: 14px; }
  .mobile-brand {
    display: block;
    margin-bottom: 2px;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .title-block h1 { font-size: 27px; }
  .mail-stats { margin-top: 4px; }
  .top-actions .icon-button { display: none; }
  .mobile-compose { display: inline-grid; box-shadow: 0 7px 16px rgba(86, 103, 242, .18); }
  .search-wrap { margin-bottom: 12px; }
  .search-form { width: 100%; }
  .search-form input { height: 44px; }
  .mail-list-card { border-radius: 14px; box-shadow: none; }
  .message-row {
    grid-template-columns: 38px minmax(0, 1fr) 7px;
    gap: 11px;
    min-height: 79px;
    padding: 12px 13px;
  }
  .sender-avatar { width: 38px; height: 38px; font-size: 11px; }
  .message-date { font-size: 10px; }
  .message-subject { font-size: 13px; }
  .message-preview { font-size: 11px; }
  .pager { margin-bottom: 4px; }

  .reader-main,
  .compose-main { padding-top: 12px; }
  .reader-toolbar { margin-bottom: 12px; }
  .reader-location span { display: none; }
  .reader-location strong { font-size: 13px; }
  .secondary-action { width: 40px; padding: 0; }
  .secondary-action span { display: none; }
  .reader-card,
  .compose-card,
  .sent-card { border-radius: 14px; box-shadow: none; }
  .message-header { padding: 22px 18px 18px; }
  .message-header h1 { margin-bottom: 18px; font-size: 25px; }
  .large-avatar { width: 42px; height: 42px; }
  .sender-topline { align-items: flex-start; gap: 7px; }
  .sender-topline time { font-size: 9px; }
  .sender-address { display: block; }
  .to-line { display: block !important; margin-top: 1px; }
  .to-line::before { content: "to "; margin: 0; }
  .attachment-strip { padding: 12px 18px; }
  .attachment-chip { width: 100%; max-width: none; }
  .email-body { min-height: 260px; padding: 25px 20px 38px; font-size: 14px; line-height: 1.68; }

  .compose-toolbar { margin-bottom: 12px; }
  .compose-heading { padding-left: 16px; padding-right: 16px; }
  .compose-field { grid-template-columns: 62px minmax(0, 1fr); padding: 0 16px; }
  .compose-message-field textarea { min-height: 330px; padding: 20px 16px; }
  .compose-error { margin-left: 16px; margin-right: 16px; }
  .compose-footer { padding-left: 16px; padding-right: 16px; }
  .sent-card { min-height: 360px; }
}

@media (max-width: 460px) {
  .login-page { padding: 16px; }
  .login-card { padding: 30px 23px; border-radius: 20px; }
  .message-row { grid-template-columns: 36px minmax(0, 1fr) 7px; }
  .sender-avatar { width: 36px; height: 36px; }
  .message-date { max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
  .reader-toolbar-left { gap: 7px; }
  .reader-actions { gap: 6px; }
  .sender-topline { display: block; }
  .sender-topline time { display: block; margin: 1px 0 0; }
  .compose-field { display: block; padding-top: 9px; padding-bottom: 4px; }
  .compose-field label { display: block; margin-bottom: -2px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
