/* Почтовый клиент Рамблер/Почта */

:root {
  --header-h: 64px;
}

.mail-body {
  --mail-bg: #f4f5f8;
  --mail-card: #ffffff;
  --mail-sidebar: #fbfbfd;
  --mail-line: #e8e8ef;
  --mail-line-strong: #d9d9e2;
  --mail-text: #17171d;
  --mail-muted: #73737f;
  --mail-soft: #f3f4f7;
  --mail-soft-hover: #ececf2;
  --mail-row-hover: #f8f8fb;
  --mail-active: #fff4f3;
  --mail-input-bg: #ffffff;
  --mail-filter-active: #1a1a21;
  --mail-filter-active-text: #ffffff;
  --mail-shadow: 0 12px 40px rgba(20, 20, 40, 0.12);
  margin: 0;
  min-height: 100vh;
  background: var(--mail-bg);
  color: var(--mail-text);
  overflow: hidden;
}

[data-theme='dark'] {
  color-scheme: dark;
}

[data-theme='dark'] .mail-body {
  --mail-bg: #0f0f13;
  --mail-card: #16161c;
  --mail-sidebar: #121217;
  --mail-line: #292930;
  --mail-line-strong: #3a3a44;
  --mail-text: #f0f0f4;
  --mail-muted: #9a9aa6;
  --mail-soft: #1d1d24;
  --mail-soft-hover: #26262f;
  --mail-row-hover: #1b1b22;
  --mail-active: #241a1b;
  --mail-input-bg: #111116;
  --mail-filter-active: #f0f0f4;
  --mail-filter-active-text: #16161c;
  --mail-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
}

[data-theme='dark'] .mail-body .brand-mark {
  box-shadow: 0 5px 14px rgba(197, 21, 14, 0.18);
}

.mail-body * {
  scrollbar-color: #c6c6d0 transparent;
}

[data-theme='dark'] .mail-body * {
  scrollbar-color: #3b3b46 transparent;
}

/* ---------- Иконки ---------- */

.svg-icon {
  display: block;
  flex: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--mail-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--mail-soft);
  color: var(--mail-text);
}

.icon-btn.small {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.icon-btn.danger:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

/* ---------- Шапка ---------- */

.mail-header {
  position: relative;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 22px;
  height: var(--header-h);
  padding: 0 20px;
  background: var(--mail-card);
  border-bottom: 1px solid var(--mail-line);
}

.mail-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: none;
}

.menu-toggle {
  display: none;
}

.mail-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.mail-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 18px;
}

.mail-brand-word {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.mail-brand-word em {
  color: var(--brand);
  font-style: normal;
}

.mail-search {
  position: relative;
  flex: 1;
  max-width: 590px;
  margin: 0 auto;
}

.mail-search input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--mail-soft);
  color: var(--mail-text);
  font-size: 13.5px;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme='dark'] .mail-search input {
  background: #1d1d24;
}

.mail-search input::placeholder {
  color: var(--mail-muted);
}

.mail-search input:focus {
  background: var(--mail-input-bg);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(226, 35, 26, 0.1);
}

.mail-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mail-muted);
  display: flex;
  pointer-events: none;
}

.mail-search-icon svg {
  width: 16px;
  height: 16px;
}

.mail-search-clear {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--mail-muted);
}

.mail-search-clear:hover {
  background: var(--mail-soft-hover);
  color: var(--mail-text);
}

.mail-search-clear svg {
  width: 14px;
  height: 14px;
}

.mail-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.portal-link {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mail-muted);
}

.portal-link:hover {
  background: var(--mail-soft);
  color: var(--mail-text);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.account {
  position: relative;
  margin-left: 2px;
}

.account-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--mail-line);
  border-radius: 10px;
  background: var(--mail-card);
  padding: 4px 8px 4px 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.account-btn:hover {
  border-color: var(--mail-line-strong);
  background: var(--mail-soft);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ff6b61, #c5150e);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
}

.account-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.account-chevron {
  display: flex;
  color: var(--mail-muted);
}

.account-chevron svg {
  width: 14px;
  height: 14px;
}

.account-unread {
  position: absolute;
  top: 1px;
  left: 26px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--mail-card);
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  padding: 7px;
  border: 1px solid var(--mail-line);
  border-radius: 12px;
  background: var(--mail-card);
  box-shadow: var(--mail-shadow);
  z-index: 90;
  animation: pop-in 0.14s ease;
}

.account-menu-head {
  padding: 9px 10px 11px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--mail-line);
}

.account-menu-head strong {
  display: block;
  font-size: 13px;
}

.account-menu-head span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--mail-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-menu button,
.account-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--mail-text);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
}

.account-menu button:hover,
.account-menu a:hover {
  background: var(--mail-soft);
}

.account-menu .danger {
  color: #dc2626;
}

.account-menu .danger:hover {
  background: rgba(220, 38, 38, 0.09);
}

.account-menu [data-icon] svg {
  width: 15px;
  height: 15px;
}

/* ---------- Каркас ---------- */

.mail-shell {
  display: flex;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
}

.mail-sidebar {
  display: flex;
  flex-direction: column;
  width: 244px;
  flex: none;
  padding: 16px 12px 12px;
  background: var(--mail-sidebar);
  border-right: 1px solid var(--mail-line);
  height: 100%;
}

.compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 43px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 7px 18px rgba(226, 35, 26, 0.22);
  flex: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.compose-btn:hover {
  background: var(--brand-dark);
}

.compose-btn:active {
  transform: translateY(1px);
}

.compose-btn svg {
  width: 17px;
  height: 17px;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 18px;
  padding-right: 2px;
}

.folder-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: background 0.14s ease;
}

.folder-row:hover {
  background: var(--mail-soft);
}

.folder-row.is-active {
  background: var(--mail-soft);
}

.folder-row.is-active .folder-link {
  color: var(--mail-text);
  font-weight: 700;
}

.folder-row.is-active .folder-link svg {
  color: var(--brand);
}

.folder-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--mail-muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.folder-link svg {
  width: 17px;
  height: 17px;
  color: var(--mail-muted);
  flex: none;
}

.folder-link span.label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

.folder-badge.muted {
  background: var(--mail-soft-hover);
  color: var(--mail-muted);
}

.folder-edit {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mail-muted);
  opacity: 0;
  flex: none;
}

.folder-row:hover .folder-edit {
  opacity: 1;
}

.folder-edit:hover {
  background: var(--mail-soft-hover);
  color: var(--mail-text);
}

.folder-edit svg {
  width: 13px;
  height: 13px;
}

.folder-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 4px 7px 10px;
  color: var(--mail-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.folder-add {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--mail-muted);
}

.folder-add:hover {
  background: var(--mail-soft-hover);
  color: var(--brand);
}

.folder-add svg {
  width: 13px;
  height: 13px;
}

.empty-folders {
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--mail-muted);
  line-height: 1.45;
}

.sidebar-storage {
  margin: 20px 4px 0;
  padding: 12px;
  border: 1px solid var(--mail-line);
  border-radius: 10px;
  background: var(--mail-card);
}

.storage-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: var(--mail-muted);
}

.storage-top b {
  font-weight: 600;
  color: var(--mail-text);
}

.storage-track {
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--mail-soft-hover);
  overflow: hidden;
}

.storage-track span {
  display: block;
  height: 100%;
  width: 0;
  min-width: 2px;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.3s ease;
}

.sidebar-storage p {
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--mail-muted);
}

.storage-open-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding: 5px 0 0;
  border: 0;
  border-top: 1px solid var(--mail-line);
  width: 100%;
  background: transparent;
  color: var(--brand);
  font-size: 10px;
  font-weight: 600;
}

.storage-open-btn svg {
  width: 12px;
  height: 12px;
}

.storage-open-btn:hover {
  text-decoration: underline;
}

.sidebar-footer {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--mail-line);
}

.sidebar-footer button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--mail-muted);
  font-size: 12.5px;
  text-align: left;
}

.sidebar-footer button:hover {
  background: var(--mail-soft);
  color: var(--mail-text);
}

.sidebar-footer svg {
  width: 16px;
  height: 16px;
}

.sidebar-backdrop {
  display: none;
}

.compose-fab {
  display: none;
}

/* ---------- Список и просмотр ---------- */

.mail-main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(340px, 42%) minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
}

.message-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--mail-card);
  border-right: 1px solid var(--mail-line);
  overflow: hidden;
}

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

.pane-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.pane-heading h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-count {
  font-size: 11.5px;
  color: var(--mail-muted);
  white-space: nowrap;
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--mail-line);
  flex: none;
}

.check-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  cursor: pointer;
}

.check-wrap input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--mail-line-strong);
  border-radius: 4px;
  background: var(--mail-card);
  display: inline-block;
  position: relative;
  transition: background 0.13s ease, border-color 0.13s ease;
}

.check-wrap:hover .checkbox {
  border-color: var(--brand);
}

.check-wrap input:checked + .checkbox,
.check-wrap input:indeterminate + .checkbox {
  background: var(--brand);
  border-color: var(--brand);
}

.check-wrap input:checked + .checkbox::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.check-wrap input:indeterminate + .checkbox::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 6px;
  width: 8px;
  height: 1.5px;
  background: #fff;
  border-radius: 2px;
}

.check-wrap input:focus-visible + .checkbox {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  border: 0;
  background: transparent;
  padding: 6px 9px;
  border-radius: 7px;
  color: var(--mail-muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}

.filter:hover {
  background: var(--mail-soft);
  color: var(--mail-text);
}

.filter.is-active {
  background: var(--mail-filter-active);
  color: var(--mail-filter-active-text);
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--mail-line);
  background: var(--mail-active);
  min-height: 44px;
  flex: none;
}

.bulk-bar > span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}

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

.bulk-actions select {
  height: 28px;
  max-width: 126px;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--mail-line-strong);
  border-radius: 7px;
  background: var(--mail-card);
  color: var(--mail-text);
  font-size: 11px;
  outline: none;
}

.message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 10px;
}

.message-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px 11px 12px;
  border-bottom: 1px solid var(--mail-line);
  background: var(--mail-card);
  cursor: pointer;
  transition: background 0.13s ease;
}

.message-row:hover {
  background: var(--mail-row-hover);
}

.message-row.is-active {
  background: var(--mail-active);
  box-shadow: inset 3px 0 0 var(--brand);
}

.row-check {
  margin-top: 8px;
}

.star-btn {
  width: 22px;
  height: 24px;
  margin-top: 4px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #c7c7d1;
  flex: none;
  border-radius: 5px;
}

[data-theme='dark'] .star-btn {
  color: #5a5a66;
}

.star-btn:hover {
  color: #f0a325;
  background: rgba(240, 163, 37, 0.1);
}

.star-btn.is-starred {
  color: #f0a325;
}

.star-btn.is-starred svg {
  fill: currentColor;
}

.star-btn svg {
  width: 15px;
  height: 15px;
}

.row-avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  margin-top: 1px;
  border-radius: 50%;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
  letter-spacing: 0.01em;
}

.row-content {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

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

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

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

.message-row.is-unread .row-from::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: 1px;
}

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

.row-subject {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--mail-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-subject > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.draft-badge {
  flex: none;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(226, 35, 26, 0.1);
  color: var(--brand);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.row-snippet {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--mail-muted);
}

.row-clip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  color: var(--mail-muted);
  font-size: 9.5px;
}

.row-clip svg {
  width: 12px;
  height: 12px;
}

.row-flags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 280px;
  padding: 40px 24px;
  text-align: center;
  color: var(--mail-muted);
}

.list-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--mail-soft);
  color: var(--mail-muted);
}

.list-empty-icon svg {
  width: 24px;
  height: 24px;
}

.list-empty b {
  color: var(--mail-text);
  font-size: 14px;
}

.list-empty span {
  max-width: 260px;
  font-size: 12px;
  line-height: 1.5;
}

.list-error {
  padding: 26px;
  text-align: center;
  color: var(--mail-muted);
  font-size: 12.5px;
}

/* Скелетон */

.mail-skeleton {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 15px 16px;
  border-bottom: 1px solid var(--mail-line);
}

.sk-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  flex: none;
  background: var(--mail-soft-hover);
  animation: pulse 1.4s ease-in-out infinite;
}

.sk-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.sk-lines span {
  height: 8px;
  border-radius: 4px;
  background: var(--mail-soft-hover);
  animation: pulse 1.4s ease-in-out infinite;
}

.sk-lines span:nth-child(1) {
  width: 42%;
}

.sk-lines span:nth-child(2) {
  width: 74%;
}

.sk-lines span:nth-child(3) {
  width: 55%;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 12px;
  border-top: 1px solid var(--mail-line);
  flex: none;
  background: var(--mail-card);
}

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mail-muted);
  font-size: 11.5px;
  font-weight: 600;
}

.page-btn:hover {
  background: var(--mail-soft);
  color: var(--mail-text);
}

.page-btn.is-active {
  background: var(--mail-filter-active);
  color: var(--mail-filter-active-text);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.page-dots {
  padding: 0 4px;
  font-size: 11px;
  color: var(--mail-muted);
}

/* ---------- Просмотр письма ---------- */

.reader {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--mail-card);
}

.reader-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px;
  text-align: center;
  background:
    radial-gradient(80% 60% at 50% 0%, var(--mail-active) 0%, transparent 65%),
    var(--mail-card);
}

.reader-empty-art {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 32px;
  background: linear-gradient(145deg, var(--mail-soft), var(--mail-card));
  border: 1px solid var(--mail-line);
  box-shadow: var(--shadow-sm);
}

.reader-empty-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(140deg, #ff3b30, #c5150e);
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 2px;
  box-shadow: 0 8px 20px rgba(197, 21, 14, 0.25);
}

.reader-empty-envelope {
  position: absolute;
  right: 2px;
  bottom: 3px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--mail-card);
  border: 1px solid var(--mail-line);
  color: var(--mail-muted);
  box-shadow: 0 4px 12px rgba(20, 20, 35, 0.1);
}

.reader-empty-envelope svg {
  width: 16px;
  height: 16px;
}

.reader-empty h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.reader-empty p {
  max-width: 300px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--mail-muted);
}

.reader-shortcuts {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 11px;
  font-size: 10px;
  color: var(--mail-muted);
  flex-wrap: wrap;
  justify-content: center;
}

.reader-shortcuts kbd {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  margin-right: 3px;
  border: 1px solid var(--mail-line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--mail-soft);
  color: var(--mail-text);
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 600;
}

.reader-view {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--mail-line);
  flex: none;
}

.reader-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.reader-toolbar-right .btn {
  padding: 7px 11px;
  font-size: 11.5px;
  gap: 6px;
  border-radius: 8px;
}

.reader-toolbar-right .btn svg {
  width: 14px;
  height: 14px;
}

.reader-toolbar .star-btn {
  width: 32px;
  height: 32px;
  margin-top: 0;
  border-radius: 7px;
}

.reader-toolbar .star-btn svg {
  width: 17px;
  height: 17px;
}

.mobile-only {
  display: none;
}

.reader-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px clamp(18px, 3.2vw, 34px) 30px;
}

.reader-subject {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--mail-line);
  margin-bottom: 18px;
}

.reader-subject h2 {
  font-size: clamp(20px, 2.2vw, 25px);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.thread-count {
  flex: none;
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--mail-soft);
  color: var(--mail-muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 4px;
}

.thread-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thread-message {
  padding: 16px 18px;
  border: 1px solid var(--mail-line);
  border-radius: 12px;
  background: var(--mail-card);
}

.thread-message.is-sent {
  background: var(--mail-soft);
}

.thread-message.is-current {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--mail-line));
}

.thread-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.thread-avatar {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

.thread-who {
  flex: 1;
  min-width: 0;
}

.thread-who strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-who span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--mail-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-date {
  flex: none;
  font-size: 10.5px;
  color: var(--mail-muted);
  white-space: nowrap;
  padding-top: 2px;
}

.thread-body {
  margin-top: 13px;
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--mail-text);
  overflow-wrap: anywhere;
}

.thread-body a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.thread-body .empty-body {
  color: var(--mail-muted);
  font-style: italic;
}

.thread-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--mail-line);
  border-radius: 8px;
  background: var(--mail-card);
  color: var(--mail-text);
  font-size: 11px;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.attach-chip:hover {
  border-color: var(--mail-line-strong);
  background: var(--mail-soft);
}

.attach-chip svg {
  width: 14px;
  height: 14px;
  color: var(--brand);
  flex: none;
}

.attach-chip .attach-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.attach-chip .attach-size {
  color: var(--mail-muted);
  font-size: 9.5px;
  white-space: nowrap;
}

.thread-reply-teaser {
  width: 100%;
  margin-top: 16px;
  padding: 11px 15px;
  border: 1px dashed var(--mail-line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--mail-muted);
  font-size: 12px;
  text-align: left;
  transition: border-color 0.14s ease, color 0.14s ease;
}

.thread-reply-teaser:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.reader-footer {
  padding-top: 17px;
  margin-top: 6px;
}

/* ---------- Диалоги ---------- */

.app-dialog {
  width: min(720px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--mail-line);
  border-radius: 16px;
  background: var(--mail-card);
  color: var(--mail-text);
  box-shadow: 0 28px 80px rgba(15, 15, 25, 0.3);
  overflow: hidden;
}

.app-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: pop-in 0.18s ease;
}

.app-dialog::backdrop {
  background: rgba(15, 15, 22, 0.5);
  backdrop-filter: blur(3px);
}

.dialog-mid {
  width: min(680px, calc(100vw - 40px));
}

.dialog-small {
  width: min(430px, calc(100vw - 40px));
}

.dialog-head,
.compose-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--mail-line);
  flex: none;
}

.dialog-kicker {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.dialog-head h2,
.compose-head h2 {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.dialog-head p {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--mail-muted);
}

.dialog-body {
  padding: 20px 22px;
  overflow-y: auto;
  min-height: 0;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px;
  border-top: 1px solid var(--mail-line);
  background: var(--mail-card);
  flex: none;
  flex-wrap: wrap;
}

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

.dialog-footer .btn {
  height: 38px;
  padding: 0 16px;
  font-size: 12.5px;
}

.dialog-status {
  font-size: 11.5px;
  color: var(--mail-muted);
  line-height: 1.4;
}

.dialog-status.is-error {
  color: #dc2626;
}

/* Редактор */

.compose-dialog {
  width: min(740px, calc(100vw - 40px));
  height: min(700px, calc(100vh - 40px));
}

.compose-head {
  align-items: center;
  padding: 15px 20px 13px;
}

.compose-head h2 {
  font-size: 17px;
}

.compose-fields {
  flex: none;
}

.compose-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 5px 20px;
  border-bottom: 1px solid var(--mail-line);
}

.compose-line .compose-label {
  width: 54px;
  flex: none;
  font-size: 11.5px;
  color: var(--mail-muted);
  font-weight: 500;
}

.compose-line input {
  flex: 1;
  min-width: 0;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--mail-text);
  font-size: 13px;
  outline: none;
}

.compose-line input::placeholder {
  color: var(--mail-muted);
  opacity: 0.75;
}

.compose-cc-toggle {
  flex: none;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  color: var(--mail-muted);
  font-size: 10.5px;
  font-weight: 600;
}

.compose-cc-toggle:hover {
  color: var(--brand);
}

.cc-line {
  background: var(--mail-soft);
}

.compose-text-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
}

.compose-text-wrap textarea {
  flex: 1;
  width: 100%;
  min-height: 160px;
  padding: 16px 20px;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--mail-text);
  font-size: 13.5px;
  line-height: 1.65;
  outline: none;
}

.compose-text-wrap textarea::placeholder {
  color: var(--mail-muted);
  opacity: 0.8;
}

.compose-dialog.is-dragover .compose-text-wrap {
  background: var(--mail-active);
  outline: 2px dashed var(--brand);
  outline-offset: -8px;
}

.compose-attachments {
  flex: none;
  padding: 9px 20px 10px;
  border-top: 1px solid var(--mail-line);
  max-height: 150px;
  overflow-y: auto;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.attachment-list:not(:empty) {
  margin-bottom: 9px;
}

.attachment-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 7px 6px 9px;
  border: 1px solid var(--mail-line);
  border-radius: 7px;
  background: var(--mail-soft);
  font-size: 10.5px;
}

.attachment-pill svg {
  width: 13px;
  height: 13px;
  color: var(--brand);
  flex: none;
}

.attachment-pill .name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-pill .size {
  color: var(--mail-muted);
  font-size: 9px;
}

.attachment-pill button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--mail-muted);
}

.attachment-pill button:hover {
  background: var(--mail-soft-hover);
  color: #dc2626;
}

.attachment-pill button svg {
  width: 11px;
  height: 11px;
  color: currentColor;
}

.attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mail-muted);
  font-size: 11px;
  font-weight: 500;
}

.attach-btn:hover {
  background: var(--mail-soft);
  color: var(--mail-text);
}

.attach-btn svg {
  width: 15px;
  height: 15px;
}

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

.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--mail-line);
  flex: none;
}

.send-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.send-btn {
  height: 40px;
  padding: 0 20px;
  font-size: 12.5px;
  gap: 8px;
}

.send-btn svg {
  width: 15px;
  height: 15px;
}

.autosave-status {
  font-size: 10.5px;
  color: var(--mail-muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autosave-status.is-error {
  color: #dc2626;
}

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

/* Настройки */

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section + .settings-section {
  padding-top: 22px;
  border-top: 1px solid var(--mail-line);
}

.settings-section h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mail-muted);
}

.settings-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ff6b61, #c5150e);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex: none;
}

.settings-profile strong {
  display: block;
  font-size: 13px;
}

.settings-profile span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--mail-muted);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mail-muted);
}

.field-label input,
.field-label textarea {
  width: 100%;
  border: 1px solid var(--mail-line-strong);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--mail-input-bg);
  color: var(--mail-text);
  font-size: 12.5px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-label input {
  height: 38px;
}

.field-label input:focus,
.field-label textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(226, 35, 26, 0.09);
}

.field-hint {
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--mail-muted);
}

.theme-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.theme-option {
  display: grid;
  grid-template-columns: 54px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  padding: 10px;
  border: 1.5px solid var(--mail-line);
  border-radius: 9px;
  background: transparent;
  color: var(--mail-text);
  text-align: left;
}

.theme-option:hover {
  border-color: var(--mail-line-strong);
}

.theme-option.is-active {
  border-color: var(--brand);
  background: var(--mail-active);
}

.theme-preview {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 54px;
  height: 38px;
  padding: 6px;
  border-radius: 5px;
  border: 1px solid var(--mail-line);
  overflow: hidden;
}

.theme-preview i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: #d9d9e1;
}

.theme-preview i:first-child {
  width: 65%;
  background: #e2231a;
}

.theme-preview-light {
  background: #fff;
}

.theme-preview-dark {
  background: #17171d;
  border-color: #33333c;
}

.theme-preview-dark i {
  background: #3c3c47;
}

.theme-option b {
  font-size: 11.5px;
  font-weight: 600;
}

.theme-option > span:last-child {
  font-size: 9.5px;
  color: var(--mail-muted);
}

.switch-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-ui {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--mail-soft-hover);
  transition: background 0.15s ease;
}

.switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 20, 30, 0.2);
  transition: transform 0.15s ease;
}

.switch-row input:checked + .switch-ui {
  background: var(--brand);
}

.switch-row input:checked + .switch-ui::after {
  transform: translateX(14px);
}

.switch-row input:focus-visible + .switch-ui {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.switch-text {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.switch-text small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 400;
  color: var(--mail-muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 9px;
}

/* Файлы */

.drive-body {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.drive-storage-panel {
  padding: 12px 14px;
  border: 1px solid var(--mail-line);
  border-radius: 9px;
  background: var(--mail-soft);
}

.drive-storage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  color: var(--mail-muted);
}

.drive-storage-top strong {
  color: var(--mail-text);
  font-weight: 600;
}

.drive-storage-panel .storage-track {
  margin-top: 7px;
}

.drive-dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 15px;
  border: 1.5px dashed var(--mail-line-strong);
  border-radius: 11px;
  background: var(--mail-soft);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drive-dropzone.is-dragover {
  border-color: var(--brand);
  background: var(--mail-active);
}

.drive-drop-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--mail-card);
  color: var(--brand);
  border: 1px solid var(--mail-line);
  flex: none;
}

.drive-drop-icon svg {
  width: 19px;
  height: 19px;
}

.drive-drop-copy {
  flex: 1;
  min-width: 150px;
}

.drive-drop-copy strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.drive-drop-copy span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--mail-muted);
}

.drive-dropzone .btn {
  height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.drive-dropzone small {
  flex-basis: 100%;
  font-size: 9.5px;
  color: var(--mail-muted);
}

.drive-status {
  min-height: 14px;
  margin-top: -3px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--mail-muted);
}

.drive-status.is-error {
  color: #dc2626;
}

.drive-search {
  margin: 0;
}

.drive-list {
  min-height: 90px;
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid var(--mail-line);
}

.drive-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--mail-line);
}

.drive-file-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 8px;
  background: var(--mail-soft);
  color: var(--mail-muted);
  flex: none;
}

.drive-file-icon.is-image {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
}

.drive-file-icon.is-doc {
  color: #d97706;
  background: rgba(217, 119, 6, 0.1);
}

.drive-file-icon.is-archive {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.drive-file-icon svg {
  width: 17px;
  height: 17px;
}

.drive-file-info {
  flex: 1;
  min-width: 0;
}

.drive-file-info strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
}

.drive-file-info span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--mail-muted);
}

.drive-file-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
}

.drive-file-actions .icon-btn {
  width: 28px;
  height: 28px;
}

.drive-empty {
  padding: 26px 12px;
  text-align: center;
  color: var(--mail-muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* Контакты */
.contacts-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.contacts-search {
  position: relative;
  display: block;
}

.contacts-search span {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: var(--mail-muted);
}

.contacts-search svg {
  width: 15px;
  height: 15px;
}

.contacts-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--mail-line-strong);
  border-radius: 8px;
  background: var(--mail-input-bg);
  color: var(--mail-text);
  font-size: 12px;
  outline: none;
}

.contacts-search input:focus {
  border-color: var(--brand);
}

.contact-add-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 7px;
}

.contact-add-form input {
  height: 36px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--mail-line-strong);
  border-radius: 8px;
  background: var(--mail-input-bg);
  color: var(--mail-text);
  font-size: 12px;
  outline: none;
}

.contact-add-form input:focus {
  border-color: var(--brand);
}

.contact-add-form .btn {
  height: 36px;
  padding: 0 13px;
  font-size: 11.5px;
}

.contacts-list {
  display: flex;
  flex-direction: column;
  max-height: 340px;
  overflow-y: auto;
  border-top: 1px solid var(--mail-line);
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--mail-line);
}

.contact-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-info strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-info span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--mail-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-count {
  flex: none;
  font-size: 9.5px;
  color: var(--mail-muted);
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.contact-actions .icon-btn {
  width: 29px;
  height: 29px;
}

.contacts-empty {
  padding: 28px 10px;
  text-align: center;
  font-size: 11.5px;
  color: var(--mail-muted);
}

/* Подтверждение */

.confirm-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--mail-muted);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger-ghost {
  background: transparent;
  color: #dc2626;
  border-color: transparent;
  padding-left: 0;
}

.btn-danger-ghost:hover {
  text-decoration: underline;
}

.dialog-small .dialog-body {
  padding-top: 16px;
  padding-bottom: 16px;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1180px) {
  .mail-header {
    gap: 14px;
  }

  .account-name {
    max-width: 80px;
  }

  .mail-main {
    grid-template-columns: minmax(320px, 44%) minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .mail-main {
    display: block;
    position: relative;
  }

  .message-pane {
    border-right: 0;
  }

  .reader {
    display: none;
  }

  body.reader-open .reader {
    display: block;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    height: auto;
    background: var(--mail-card);
  }

  .reader-toolbar .mobile-only {
    display: inline-flex;
  }

  .mail-sidebar {
    width: 236px;
  }

  .portal-link {
    display: none;
  }
}

@media (max-width: 900px) {
  .mail-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    z-index: 80;
    width: 262px;
    height: auto;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 20px 0 60px rgba(10, 10, 20, 0.16);
  }

  body.sidebar-open .mail-sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0;
    z-index: 75;
    background: rgba(15, 15, 22, 0.35);
    backdrop-filter: blur(2px);
  }

  .sidebar-scroll {
    margin-top: 16px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .compose-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 18px;
    bottom: 22px;
    z-index: 60;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 10px 26px rgba(226, 35, 26, 0.35);
  }

  .compose-fab:hover {
    background: var(--brand-dark);
  }

  .compose-fab svg {
    width: 20px;
    height: 20px;
  }

  .mail-brand-word {
    font-size: 17px;
  }

  .mail-brand-word em {
    display: none;
  }

  .mail-search {
    max-width: none;
  }
}

@media (max-width: 700px) {
  :root {
    --header-h: 58px;
  }

  .mail-header {
    padding: 0 12px;
    gap: 8px;
  }

  .mail-brand .brand-mark {
    width: 29px;
    height: 29px;
    border-radius: 8px;
    font-size: 16px;
  }

  .mail-brand-word {
    display: none;
  }

  .mail-search input {
    height: 36px;
    font-size: 12.5px;
    padding-left: 33px;
    padding-right: 32px;
  }

  .mail-search-icon {
    left: 10px;
  }

  .mail-search-clear {
    right: 4px;
  }

  .mail-header-right {
    gap: 1px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  .account-btn {
    padding: 3px;
    border-color: transparent;
    background: transparent;
  }

  .account-chevron,
  .account-name {
    display: none;
  }

  .account-menu {
    width: 232px;
  }

  .pane-toolbar {
    min-height: 56px;
    padding: 0 14px;
  }

  .pane-heading h1 {
    font-size: 18px;
  }

  .filter-bar {
    padding: 0 10px;
    gap: 6px;
  }

  .filter {
    padding: 6px 8px;
    font-size: 11px;
  }

  .message-row {
    padding: 11px 10px 10px 9px;
    gap: 7px;
  }

  .star-btn {
    width: 19px;
  }

  .row-avatar {
    width: 33px;
    height: 33px;
    font-size: 10px;
  }

  .row-snippet {
    display: none;
  }

  .row-subject {
    margin-top: 2px;
  }

  .reader-scroll {
    padding: 18px 14px 24px;
  }

  .reader-toolbar {
    padding: 6px 8px;
  }

  .reader-toolbar-right .btn .btn-text {
    display: none;
  }

  .reader-toolbar-right .btn {
    padding: 7px 9px;
  }

  .thread-message {
    padding: 13px 13px;
  }

  .reader-subject h2 {
    font-size: 19px;
  }

  .thread-body {
    font-size: 13px;
  }

  .app-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .compose-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    margin: 0;
  }

  .compose-head {
    padding: 13px 16px 11px;
  }

  .compose-line {
    padding: 4px 16px;
  }

  .compose-line .compose-label {
    width: 45px;
  }

  .compose-cc-toggle {
    font-size: 9.5px;
  }

  .compose-text-wrap textarea {
    padding: 14px 16px;
  }

  .compose-attachments {
    padding: 8px 16px;
  }

  .compose-footer {
    padding: 10px 14px;
  }

  .autosave-status {
    display: none;
  }

  .dialog-head {
    padding: 16px 18px 13px;
  }

  .dialog-body {
    padding: 16px 18px;
  }

  .dialog-footer {
    padding: 12px 18px;
  }

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

  .contact-add-form {
    grid-template-columns: 1fr 1fr;
  }

  .contact-add-form .btn {
    grid-column: 1 / -1;
  }

  .theme-options {
    grid-template-columns: 1fr;
  }

  .bulk-actions select {
    max-width: 104px;
  }

  .folder-heading {
    margin-top: 16px;
  }

  .mail-sidebar {
    width: min(272px, 84vw);
  }
}

@media (max-width: 460px) {
  .mail-search {
    min-width: 0;
  }

  .mail-header {
    gap: 5px;
  }

  .mail-header-left {
    gap: 4px;
  }

  .mail-header-right {
    gap: 0;
  }

  .filter-bar .check-wrap {
    display: none;
  }

  .filter {
    padding: 6px 7px;
  }

  .row-date {
    font-size: 9.5px;
  }

  .row-top {
    gap: 5px;
  }

  .row-from {
    font-size: 12.5px;
  }

  .row-subject {
    font-size: 12px;
  }

  .bulk-actions select {
    display: none;
  }

  .pagination {
    padding: 8px;
  }

  .theme-toggle {
    display: none;
  }

  .thread-attachments {
    flex-direction: column;
    align-items: flex-start;
  }

  .attach-chip {
    max-width: 100%;
  }

  .attach-chip .attach-name {
    max-width: 160px;
  }

  .settings-profile {
    align-items: flex-start;
  }

  .dialog-footer {
    align-items: flex-start;
  }
}

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