* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.material-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  line-height: 1;
  font-weight: 800;
}

.icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex: none;
  vertical-align: middle;
}

.folder-link .icon,
.compose-button .icon {
  width: 21px;
  height: 21px;
}

.empty-state .icon {
  width: 44px;
  height: 44px;
  color: var(--accent);
  stroke-width: 1.5;
}

:root {
  --bg: #eef3f2;
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --surface-3: #e6eeec;
  --text: #172a3a;
  --muted: #657680;
  --line: #dce7e4;
  --line-soft: #edf3f1;
  --hover: #eff8f5;
  --accent: #176b87;
  --accent-strong: #0f4c5c;
  --accent-soft: #dff3ef;
  --warm: #ef8354;
  --good: #2d936c;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(23, 42, 58, .08), 0 10px 28px rgba(23, 42, 58, .08);
  --shadow-lg: 0 24px 70px rgba(12, 35, 45, .18);
}

body {
  background:
    linear-gradient(135deg, rgba(23, 107, 135, .08), transparent 36%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body.theme-dark {
  --bg: #101716;
  --surface: #17201f;
  --surface-2: #1d2927;
  --surface-3: #263431;
  --text: #edf7f4;
  --muted: #a9bab5;
  --line: #2b3b37;
  --line-soft: #21302d;
  --hover: #203430;
  --accent-soft: rgba(127, 209, 185, .16);
  --shadow: none;
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .42);
}

@media (prefers-color-scheme: dark) {
  body.theme-system {
    --bg: #101716;
    --surface: #17201f;
    --surface-2: #1d2927;
    --surface-3: #263431;
    --text: #edf7f4;
    --muted: #a9bab5;
    --line: #2b3b37;
    --line-soft: #21302d;
    --hover: #203430;
    --accent-soft: rgba(127, 209, 185, .16);
    --shadow: none;
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .42);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .18));
  border-right: 1px solid var(--line);
}

body.theme-dark .sidebar,
body.theme-system .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .01));
}

.sidebar-top,
.folders,
.sidebar-section,
.sidebar-footer {
  display: flex;
  flex-direction: column;
}

.sidebar-top {
  gap: 18px;
}

.brand {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  font-size: 21px;
  font-weight: 800;
}

.brand-mark,
.login-logo,
.avatar {
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #2d936c 58%, var(--warm));
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(23, 107, 135, .24);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.brand-mark.mini {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 12px;
}

.brand-title {
  white-space: nowrap;
}

.compose-button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 162px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-weight: 850;
  box-shadow: 0 16px 36px rgba(23, 107, 135, .22);
  transition: transform .15s ease, box-shadow .15s ease;
}

.compose-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 44px rgba(23, 107, 135, .28);
}

.folders,
.sidebar-section {
  gap: 4px;
}

.sidebar-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-section p {
  margin: 0 0 6px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.folder-link {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
}

.folder-link:hover {
  background: var(--surface-3);
}

.folder-link.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 850;
}

body.theme-dark .folder-link.active,
body.theme-system .folder-link.active {
  color: #7fd1b9;
}

.folder-name,
.account-chip strong,
.account-chip em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-count {
  min-width: 24px;
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 7px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.sidebar-footer {
  gap: 12px;
  margin-top: auto;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-chip > span:last-child {
  flex: 1 1 auto;
  min-width: 0;
}

.account-chip strong,
.account-chip em {
  display: block;
  max-width: 100%;
}

.account-chip em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.signout {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800;
}

.signout .icon {
  width: 17px;
  height: 17px;
}

.signout:hover {
  background: var(--surface-3);
}

.signout:hover {
  color: var(--text);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 24px;
  background: rgba(238, 243, 242, .86);
  border-bottom: 1px solid rgba(220, 231, 228, .72);
  backdrop-filter: blur(16px);
}

body.theme-dark .topbar,
body.theme-system .topbar {
  background: rgba(16, 23, 22, .86);
  border-bottom-color: var(--line);
}

.topbar-brand-mobile {
  display: none;
  align-items: center;
  gap: 10px;
}

.search {
  flex: 1;
  max-width: 780px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search:focus-within {
  border-color: rgba(23, 107, 135, .35);
  box-shadow: 0 0 0 4px rgba(23, 107, 135, .1);
}

.search input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.filter-button,
.icon-button {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
}

.icon-button:hover,
.filter-button:hover {
  color: var(--text);
  background: var(--surface-3);
}

.menu-button {
  display: none;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 14px;
}

.avatar.small {
  width: 36px;
  height: 36px;
  box-shadow: none;
  font-size: 12px;
}

.avatar.large {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  margin-bottom: 16px;
  font-size: 24px;
}

.mailbox-view,
.message-view,
.compose-view,
.settings-view,
.productivity-view {
  padding: 22px 24px 42px;
}

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

.mail-card {
  overflow: hidden;
}

.mail-toolbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  color: var(--muted);
  font-size: 13px;
}

.mailbox-title-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-left: 8px;
}

.mailbox-title-block h1 {
  margin: 0;
  font-size: 21px;
}

.mailbox-title-block p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-icon {
  min-width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
}

.toolbar-icon:hover {
  color: var(--text);
  background: var(--surface-3);
}

.toolbar-icon.disabled {
  opacity: .35;
  pointer-events: none;
}

.bulk-select {
  max-width: 150px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--text);
  background: var(--surface);
}

.bulk-action-bar {
  min-height: 54px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.bulk-action-bar button,
.bulk-action-bar label {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  font-weight: 800;
  font-size: 13px;
}

.bulk-action-bar button:hover {
  background: var(--hover);
}

.bulk-action-bar label {
  color: var(--muted);
}

.bulk-status {
  margin-right: 4px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-icon.labelled {
  width: auto;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.compact-card {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
}

.checkbox-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.checkbox-wrap input {
  position: absolute;
  opacity: 0;
}

.checkbox-wrap span {
  width: 16px;
  height: 16px;
  border: 2px solid #aebbb8;
  border-radius: 4px;
}

.checkbox-wrap input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.category-tab {
  height: 74px;
  border: 0;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.category-tab strong,
.category-tab em {
  display: block;
}

.category-tab strong {
  color: var(--text);
  font-size: 15px;
}

.category-tab em {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-style: normal;
}

.category-tab.active {
  color: var(--accent);
  border-bottom-color: var(--warm);
  background: rgba(239, 131, 84, .08);
}

.message-list {
  min-height: 360px;
}

.message-row {
  position: relative;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1fr);
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  font-weight: 450;
  transition: background .12s ease, box-shadow .12s ease;
}

.density-compact .message-row {
  min-height: 44px;
}

.message-row:hover {
  background: var(--hover);
  box-shadow: inset 4px 0 0 var(--accent);
}

.message-row.unread {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 800;
}

@supports not (background: color-mix(in srgb, red 10%, blue)) {
  .message-row.unread {
    background: var(--accent-soft);
  }
}

.message-row.unread::before {
  content: none;
}

.message-row.focused {
  background: var(--hover);
  box-shadow: inset 4px 0 0 var(--accent), 0 0 0 1px var(--line) inset;
}

.message-star {
  display: inline-grid;
  place-items: center;
  color: #b7c1bd;
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  padding: 0;
  border-radius: 8px;
  text-align: center;
  user-select: none;
  transition: color .12s ease, transform .12s ease;
}

.message-star .icon {
  width: 18px;
  height: 18px;
}

.message-star.active .icon {
  fill: currentColor;
}

.message-star:active {
  transform: scale(.86);
}

.message-star:hover,
.message-star:focus,
.message-star:active {
  outline: 0;
}

.message-star:hover {
  color: var(--warm);
}

.message-star.active {
  color: var(--warm);
}

.message-link {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(120px, 238px) minmax(0, 1fr) 92px;
  gap: 16px;
  align-items: center;
}

.message-sender,
.message-subject,
.message-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-sender {
  font-weight: 430;
}

.message-main {
  min-width: 0;
  display: flex;
  gap: 7px;
}

.message-subject {
  min-width: 0;
  font-weight: 400;
}

.message-row.unread .message-subject,
.message-row.unread .message-sender {
  font-weight: 900;
}

.message-main em {
  color: var(--muted);
  font-weight: 400;
  font-style: normal;
}

.message-date {
  color: var(--muted);
  text-align: right;
  font-size: 13px;
}

.message-row.unread .message-date {
  color: var(--text);
  font-weight: 850;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 44px;
  color: var(--muted);
  text-align: center;
}

.empty-state .material-symbol {
  width: auto;
  color: var(--accent);
  font-size: 42px;
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 20px;
}

.empty-state p {
  margin: 6px 0 0;
}

.message-card {
  max-width: 1120px;
  padding: 28px;
}

.thread-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.thread-message {
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
}

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

.message-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.message-heading h1 {
  margin: 0 0 22px;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;
}

.message-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.unread-pill {
  border-color: transparent;
  color: var(--accent);
  background: var(--accent-soft);
}

.sender-block {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0 20px;
  border-bottom: 1px solid var(--line-soft);
}

.sender-block strong,
.sender-block p {
  display: block;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender-block p,
.sender-block time {
  color: var(--muted);
  font-size: 13px;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
}

.attachments a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-2);
  font-size: 14px;
}

.attachments em {
  color: var(--muted);
  font-style: normal;
}

.message-body {
  margin-top: 18px;
}

.remote-content-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.remote-content-notice a {
  color: var(--accent);
  font-weight: 800;
}

.message-body iframe {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color-scheme: light;
}

.message-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.65;
}

.reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.reply-actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 850;
}

.reply-actions a:hover {
  background: var(--hover);
}

.danger-link {
  color: var(--danger) !important;
}

.compose-view {
  display: flex;
  justify-content: center;
}

.compose-window {
  overflow: hidden;
  width: min(980px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.compose-titlebar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.compose-titlebar h1 {
  margin: 0;
  font-size: 15px;
}

.compose-titlebar button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .82);
  font-size: 24px;
  line-height: 1;
  padding: 4px;
}

.compose-titlebar button:hover {
  color: #fff;
}

.compose-form {
  padding: 0 18px 18px;
}

.from-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}

.from-preview strong {
  color: var(--text);
}

.from-preview a {
  margin-left: auto;
  color: var(--accent);
  font-weight: 850;
}

.field-line {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
}

.field-line label {
  color: var(--muted);
  font-size: 14px;
}

.field-line input {
  width: 100%;
  height: 44px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.field-line.split {
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-line.split > div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
}

.compose-form textarea {
  width: 100%;
  min-height: 360px;
  border: 0;
  outline: 0;
  resize: vertical;
  padding: 18px 0;
  color: var(--text);
  background: transparent;
  line-height: 1.55;
}

.compose-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.compose-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compose-actions button,
.settings-actions button,
.auth-form button {
  border: 0;
  border-radius: 999px;
  padding: 11px 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-weight: 900;
}

.attach-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--muted);
}

.attach-button:hover {
  background: var(--surface-3);
}

.attach-button input {
  display: none;
}

.discard-link {
  color: var(--muted);
  font-weight: 850;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(250px, 360px) minmax(0, 760px);
  gap: 18px;
  align-items: start;
}

.settings-side {
  display: grid;
  gap: 18px;
}

.settings-summary,
.settings-form,
.settings-tools {
  padding: 24px;
}

.settings-summary h1 {
  margin: 0 0 8px;
}

.settings-summary p {
  color: var(--muted);
  line-height: 1.5;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
}

.summary-line strong {
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.settings-tools h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.settings-tool-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-2);
}

.settings-tool-link:hover {
  background: var(--surface-3);
}

.settings-tool-link strong,
.settings-tool-link em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-tool-link em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.settings-form h2 {
  margin: 4px 0 18px;
}

.settings-form label,
.auth-form label {
  display: block;
  margin: 16px 0 7px;
  color: var(--text);
  font-weight: 850;
}

.settings-form input:not([type="radio"]):not([type="color"]),
.settings-form textarea,
.settings-form select,
.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface);
}

.settings-form input:focus,
.settings-form textarea:focus,
.settings-form select:focus,
.auth-form input:focus {
  outline: 0;
  border-color: rgba(23, 107, 135, .45);
  box-shadow: 0 0 0 4px rgba(23, 107, 135, .1);
}

.settings-form textarea {
  resize: vertical;
}

.field-help {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-card {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  margin: 0 !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.option-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option-card em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.colour-input {
  width: 70px !important;
  height: 44px;
  padding: 4px !important;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
}

.settings-actions a {
  color: var(--accent);
  font-weight: 850;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 34px;
  background:
    linear-gradient(90deg, rgba(7, 35, 41, .92) 0%, rgba(7, 35, 41, .76) 42%, rgba(7, 35, 41, .28) 100%),
    url("ziretek-mail-hero.png") center / cover no-repeat,
    #0d333d;
}

.login-hero {
  width: min(1120px, 100%);
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 34px;
  align-items: center;
}

.login-intro {
  max-width: 600px;
  color: #fff;
}

.login-logo {
  width: 64px;
  height: 64px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 18px;
  margin-bottom: 26px;
  background: linear-gradient(135deg, #7fd1b9, var(--accent), var(--warm));
}

.eyebrow {
  margin: 0 0 12px;
  color: #9de2d1;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-intro h1 {
  margin: 0 0 16px;
  color: #fff;
  font-size: 54px;
  line-height: 1.02;
}

.login-intro .muted {
  max-width: 520px;
  color: rgba(255, 255, 255, .78);
  font-size: 18px;
}

.login-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-highlights span {
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 999px;
  padding: 8px 13px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-weight: 850;
}

.login-card {
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --surface-3: #e6eeec;
  --text: #172a3a;
  --muted: #657680;
  --line: #dce7e4;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 8px;
  padding: 30px;
  color: var(--text);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.login-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.login-card-header span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-card-header strong {
  color: #172a3a;
  font-size: 25px;
}

.auth-form button {
  width: 100%;
  margin-top: 18px;
}

.small-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-weight: 850;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.alert {
  margin: 14px 0;
  border-radius: 8px;
  padding: 12px 14px;
}

.alert.danger {
  border: 1px solid #ffd7d2;
  color: var(--danger);
  background: #fef3f2;
}

.alert.warning {
  border: 1px solid #ffe08a;
  color: #7a4d00;
  background: #fff8e1;
}

.alert.success {
  border: 1px solid #abefc6;
  color: #067647;
  background: #ecfdf3;
}

.productivity-view {
  max-width: 1600px;
}

.productivity-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.productivity-toolbar h1 {
  margin: 2px 0 4px;
  font-size: 28px;
  letter-spacing: 0;
}

.productivity-toolbar span,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.tool-search,
.month-nav,
.import-export,
.import-export form,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-search {
  min-width: min(420px, 100%);
}

.tool-search input,
.tool-form input,
.tool-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
}

.tool-search input:focus,
.tool-form input:focus,
.tool-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tool-search button,
.tool-form button,
.secondary-button,
.month-nav a,
.import-export button,
.inline-delete button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-2);
  font-weight: 850;
}

.tool-search button,
.tool-form button[type="submit"] {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.secondary-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.productivity-grid {
  display: grid;
  gap: 16px;
}

.contacts-grid {
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
}

.calendar-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
}

.tool-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.contact-list {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.contact-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.contact-item:hover,
.contact-item.active {
  background: var(--hover);
}

.avatar.tiny {
  width: 34px;
  height: 34px;
  box-shadow: none;
  font-size: 12px;
}

.contact-item strong,
.contact-item em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-item em {
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.empty-panel {
  padding: 26px 16px;
  color: var(--muted);
  text-align: center;
}

.tool-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.tool-form label {
  display: grid;
  gap: 7px;
}

.tool-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tool-form textarea {
  min-height: 116px;
  resize: vertical;
}

.two-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.inline-delete {
  padding: 0 16px 16px;
}

.inline-delete button {
  color: var(--danger);
}

.import-export {
  flex-wrap: wrap;
  padding: 16px;
  border-top: 1px solid var(--line-soft);
}

.file-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  cursor: pointer;
}

.file-pill input {
  display: none;
}

.calendar-panel {
  overflow: hidden;
}

.calendar-weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays span {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.calendar-day {
  min-height: 126px;
  padding: 10px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day.muted-day {
  background: var(--surface-2);
  color: var(--muted);
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.day-number {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 850;
}

.calendar-day.today .day-number {
  color: #fff;
  background: var(--accent);
}

.day-events {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.event-chip {
  min-width: 0;
  display: block;
  overflow: hidden;
  border-left: 4px solid var(--event-color);
  border-radius: 6px;
  padding: 5px 7px;
  color: var(--text);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagnostics-page {
  background:
    linear-gradient(90deg, rgba(7, 35, 41, .88), rgba(7, 35, 41, .52)),
    url("ziretek-mail-hero.png") center / cover no-repeat,
    #0d333d;
}

.diagnostics-page .login-card {
  width: min(760px, 100%);
}

.login-card.wide {
  width: min(760px, 100%);
}

.diagnostic-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagnostic-row {
  display: grid;
  grid-template-columns: 1fr 1fr 70px;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.diagnostic-row:last-child {
  border-bottom: 0;
}

.diagnostic-row em {
  border-radius: 999px;
  padding: 4px 9px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.diagnostic-row.ok em {
  color: #067647;
  background: #ecfdf3;
}

.diagnostic-row.bad em {
  color: var(--danger);
  background: #fef3f2;
}

.error-card {
  max-width: 760px;
  margin: 34px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.error-card h1 {
  margin-top: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -320px;
    z-index: 40;
    width: min(320px, calc(100vw - 54px));
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transition: left .18s ease;
  }

  body.theme-dark .sidebar,
  body.theme-system .sidebar {
    background: var(--surface);
  }

  .sidebar.open {
    left: 0;
  }

  .menu-button {
    display: inline-grid;
  }

  .topbar-brand-mobile {
    display: flex;
  }

  .search {
    max-width: none;
  }

  .mailbox-view,
  .message-view,
  .compose-view,
  .settings-view,
  .productivity-view {
    padding: 14px 12px 28px;
  }

  .contacts-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .contact-list {
    max-height: none;
  }

  .calendar-day {
    min-height: 104px;
  }

  .settings-grid,
  .login-hero {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: auto;
  }

  .category-tabs {
    grid-template-columns: 1fr;
  }

  .category-tab {
    height: 58px;
  }

  .message-link {
    grid-template-columns: minmax(95px, 160px) minmax(0, 1fr) 70px;
  }

  .message-main {
    display: block;
  }

  .from-preview a {
    margin-left: 0;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .sender-block {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .sender-block time {
    grid-column: 2;
  }
}

@media (max-width: 620px) {
  .topbar {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }

  .topbar-brand-mobile strong {
    display: none;
  }

  .search {
    order: 10;
    flex: 1 0 100%;
    width: 100%;
    height: 42px;
    margin-top: 2px;
    border-radius: 10px;
    box-shadow: none;
  }

  .search input {
    min-width: 0;
    font-size: 14px;
  }

  .mailbox-view,
  .message-view,
  .compose-view,
  .settings-view,
  .productivity-view {
    padding: 8px 0 24px;
  }

  .productivity-toolbar {
    align-items: stretch;
    flex-direction: column;
    margin: 0 0 10px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 14px;
  }

  .productivity-toolbar h1 {
    font-size: 24px;
  }

  .tool-search,
  .month-nav {
    width: 100%;
  }

  .tool-search {
    min-width: 0;
  }

  .tool-search button,
  .month-nav a {
    flex: 0 0 auto;
  }

  .tool-panel {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .calendar-weekdays {
    display: none;
  }

  .month-grid {
    grid-template-columns: 1fr;
  }

  .calendar-day,
  .calendar-day:nth-child(7n) {
    min-height: 70px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 8px;
    border-right: 0;
  }

  .calendar-day.muted-day {
    display: none;
  }

  .day-events {
    margin-top: 0;
  }

  .two-fields {
    grid-template-columns: 1fr;
  }

  .import-export,
  .import-export form {
    align-items: stretch;
    flex-direction: column;
  }

  .message-row {
    min-height: 76px;
    grid-template-columns: 32px 24px minmax(0, 1fr);
    align-items: start;
    padding: 10px 8px 10px 14px;
  }

  .message-row.unread::before {
    left: 3px;
    top: 28px;
  }

  .row-check,
  .message-star {
    margin-top: 2px;
  }

  .message-link {
    height: auto;
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 8px;
    align-items: start;
  }

  .message-sender {
    font-size: 14px;
    line-height: 1.2;
  }

  .message-subject,
  .message-main em {
    display: block;
  }

  .message-sender,
  .message-main {
    grid-column: 1;
  }

  .message-date {
    grid-column: 2;
    grid-row: 1 / 3;
    font-size: 12px;
  }

  .mail-toolbar {
    min-height: 64px;
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 10px;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
  }

  .toolbar-right {
    align-self: stretch;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .bulk-action-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .bulk-action-bar::-webkit-scrollbar {
    display: none;
  }

  .bulk-action-bar button,
  .bulk-action-bar label,
  .bulk-status {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .bulk-action-bar button,
  .bulk-action-bar label {
    min-height: 38px;
    padding: 0 11px;
  }

  .bulk-select {
    width: 126px;
    max-width: 126px;
  }

  .category-tabs {
    display: none;
  }

  .mailbox-title-block {
    display: none;
  }

  .field-line,
  .field-line.split,
  .field-line.split > div {
    grid-template-columns: 1fr;
  }

  .field-line label {
    padding-top: 10px;
  }

  .compose-bottom {
    align-items: flex-start;
    flex-direction: column;
  }

  .message-heading {
    display: block;
  }

  .message-card {
    padding: 18px;
  }

  .message-heading h1 {
    font-size: 22px;
  }

  .login-page {
    padding: 18px;
  }

  .login-intro h1 {
    font-size: 38px;
  }

  .login-intro .muted {
    font-size: 16px;
  }

  .login-card {
    padding: 22px;
  }

  .diagnostic-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Modern UI additions: icons, toasts, shortcuts, attachments
   ============================================================ */

/* Elements with the hidden attribute must never be shown, regardless of
   their CSS display rules (fixes the reading-pane placeholder covering
   loaded conversations). */
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--accent-soft);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--line) padding-box;
}

.folder-link.as-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: var(--text);
}

.folder-link.as-button:hover {
  background: var(--surface-3);
}

.kbd-hint {
  margin-left: auto;
  min-width: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.thread-count {
  display: inline-block;
  min-width: 20px;
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

body.theme-dark .thread-count,
body.theme-system .thread-count {
  color: #7fd1b9;
}

/* Toast notifications */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(480px, calc(100vw - 32px));
  border-radius: 12px;
  padding: 12px 18px;
  color: #fff;
  background: #1f2d3a;
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in .22s ease;
}

.toast.success { background: #14532d; }
.toast.warning { background: #7a4d00; }
.toast.danger { background: #7f1d1d; }

.toast.leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Keyboard shortcuts modal */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 20, 24, .48);
  backdrop-filter: blur(3px);
}

.shortcuts-overlay[hidden] {
  display: none;
}

.shortcuts-modal {
  width: min(560px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease;
}

.shortcuts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.shortcuts-head h2 {
  margin: 0;
  font-size: 20px;
}

.shortcuts-grid {
  display: grid;
  gap: 4px;
}

.shortcuts-grid > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.shortcuts-grid > div:last-child {
  border-bottom: 0;
}

.shortcuts-grid span {
  margin-left: auto;
  color: var(--text);
}

kbd {
  display: inline-block;
  min-width: 26px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 3px 7px;
  background: var(--surface-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

/* Compose: attachments and drag-drop */
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 8px 7px 13px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
}

.file-chip em {
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
}

.file-chip span {
  overflow: hidden;
  max-width: 260px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  line-height: 1;
}

.file-chip button:hover {
  color: var(--danger);
  background: var(--surface-3);
}

.file-chip.too-big {
  border-color: var(--danger);
  color: var(--danger);
}

.drop-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 22px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.compose-window.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.compose-hint {
  color: var(--muted);
  font-size: 12px;
}

.compose-actions button[data-send-button] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

button[data-send-button][disabled] {
  opacity: .65;
  cursor: progress;
}

button .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* Error card */
.error-card {
  max-width: 520px;
  margin: 60px auto;
  padding: 36px;
  text-align: center;
}

.error-card .error-icon {
  width: 42px;
  height: 42px;
  color: var(--warm);
  stroke-width: 1.6;
}

.error-card h1 {
  margin: 14px 0 8px;
  font-size: 24px;
}

.error-card p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.error-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.primary-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 11px 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-weight: 900;
}

/* Small touches */
.content-card {
  border-radius: 12px;
}

.toolbar-icon,
.folder-link,
.bulk-action-bar button,
.reply-actions a,
.attachments a {
  transition: background .12s ease, color .12s ease;
}

.compose-actions button,
.settings-actions button,
.auth-form button {
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.compose-actions button:hover,
.settings-actions button:hover,
.auth-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 107, 135, .28);
}

@media (max-width: 620px) {
  .compose-hint {
    display: none;
  }

  .toast-region {
    bottom: 16px;
  }

  .shortcuts-modal {
    padding: 16px;
  }
}

/* ============================================================
   v3 — Ultra-modern inbox: two-line rows, avatars, snippets,
   hover quick actions and the split reading pane
   ============================================================ */

.search {
  border-radius: 999px;
}

.message-row {
  grid-template-columns: 30px 28px 44px minmax(0, 1fr);
  gap: 2px;
  min-height: 66px;
  padding: 8px 16px 8px 14px;
}

.density-compact .message-row {
  min-height: 54px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.message-row.unread::before {
  left: 4px;
}

.row-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 6px;
  border-radius: 50%;
  color: #fff;
  background: hsl(var(--hue, 200), 42%, 46%);
  font-size: 14px;
  font-weight: 800;
  user-select: none;
}

body.theme-dark .row-avatar,
body.theme-system .row-avatar {
  background: hsl(var(--hue, 200), 34%, 38%);
}

.density-compact .row-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.message-link {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  height: auto;
}

.row-top,
.row-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.message-sender {
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-date {
  margin-left: auto;
  flex: none;
  font-size: 12px;
}

.row-bottom {
  color: var(--muted);
  font-size: 13px;
}

.message-subject {
  flex: none;
  max-width: 68%;
  color: var(--text);
  font-weight: 480;
}

.message-snippet {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.message-row.unread .message-sender,
.message-row.unread .message-subject {
  font-weight: 800;
}

/* Clear unread dot beside the sender name */
.message-row.unread .message-sender::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4c9ffe;
  box-shadow: 0 0 0 3px rgba(76, 159, 254, .18);
}

.message-row.unread .row-bottom {
  color: var(--muted);
}

.message-row.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Hover quick actions */
.row-actions {
  position: absolute;
  top: 50%;
  right: 10px;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}

.message-row:hover .row-actions,
.message-row.focused .row-actions {
  display: inline-flex;
}

.message-row:hover .message-date,
.message-row.focused .message-date {
  visibility: hidden;
}

.row-actions button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.row-actions button:hover {
  color: var(--text);
  background: var(--surface-3);
}

.row-actions button[data-quick="delete"]:hover {
  color: var(--danger);
}

.row-actions .icon {
  width: 17px;
  height: 17px;
}

/* Category tabs: slimmer */
.category-tab {
  height: 52px;
  gap: 9px;
}

.category-tab em {
  display: none;
}

/* Split reading pane — viewport-locked: list and pane scroll independently */
body.pane-view-active .mailbox-view {
  padding: 16px 20px;
}

.mailbox-split.pane-active {
  display: grid;
  grid-template-columns: minmax(390px, 34%) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  height: calc(100vh - 72px - 32px);
}

.mailbox-split.pane-active .mail-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.mailbox-split.pane-active .mail-toolbar,
.mailbox-split.pane-active .bulk-action-bar,
.mailbox-split.pane-active .category-tabs {
  flex: none;
}

.mailbox-split.pane-active .message-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mailbox-split.pane-active .mail-card {
  min-width: 0;
}

.mailbox-split.pane-active .mail-toolbar {
  flex-wrap: wrap;
}

.mailbox-split.pane-active .mailbox-title-block p {
  display: none;
}

.mailbox-split.pane-active .message-subject {
  max-width: 100%;
}

.mailbox-split.pane-active .row-bottom {
  flex-wrap: nowrap;
}

.mailbox-split.pane-active .message-snippet {
  display: none;
}

.mailbox-split.pane-active .category-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mailbox-split.pane-active .category-tab {
  padding: 0 12px;
}

.mailbox-split.pane-active .bulk-action-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.mailbox-split.pane-active .bulk-action-bar::-webkit-scrollbar {
  display: none;
}

.mailbox-split.pane-active .bulk-action-bar button,
.mailbox-split.pane-active .bulk-action-bar label {
  flex: none;
  white-space: nowrap;
}

.reading-pane {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 12px;
}

.reading-pane-empty {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.reading-pane-empty .icon {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  color: var(--accent);
  stroke-width: 1.4;
}

.reading-pane-empty strong {
  color: var(--text);
  font-size: 18px;
}

.reading-pane-empty p {
  margin: 0;
}

.reading-pane .message-view {
  padding: 14px;
}

.reading-pane .message-card {
  max-width: none;
  border: 0;
  box-shadow: none;
  padding: 10px 6px;
}

.reading-pane .compact-card {
  margin-bottom: 8px;
  border: 0;
  box-shadow: none;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
}

.reading-pane [data-back-link] {
  display: none;
}

.reading-pane .message-heading h1 {
  font-size: 21px;
  margin-bottom: 12px;
}

.reading-pane .message-body iframe {
  min-height: 420px;
}

.pane-loading {
  display: grid;
  place-items: center;
  min-height: 220px;
}

.pane-skeleton {
  display: grid;
  gap: 14px;
  padding: 26px 22px;
}

.skeleton-line,
.skeleton-block {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 300% 100%;
  animation: skeleton-shimmer 1.1s ease-in-out infinite;
}

.skeleton-line {
  height: 16px;
  width: 55%;
}

.skeleton-line.wide {
  height: 24px;
  width: 80%;
}

.skeleton-block {
  height: 320px;
  width: 100%;
}

@keyframes skeleton-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.pane-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.pane-error {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.pane-error a {
  color: var(--accent);
  font-weight: 800;
}

@media (max-width: 1199px) {
  .reading-pane {
    display: none;
  }
}

@media (max-width: 620px) {
  .message-row {
    grid-template-columns: 26px 24px 38px minmax(0, 1fr);
    padding: 8px 10px;
    min-height: 66px;
  }

  .row-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .message-subject {
    max-width: 100%;
  }

  .message-snippet {
    display: none;
  }

  .row-actions {
    display: none !important;
  }

  .message-row:hover .message-date {
    visibility: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
