/*!
 * Автор: Чепела Даниэль Максимович x0do.it
 * GitHub: https://github.com/x0doit
 * Код зарегистрирован как программа для ЭВМ. Использование, копирование,
 * модификация и распространение без лицензии автора запрещены.
 */

:root {
  color-scheme: dark;
  --bg: #0b0b0e;
  --panel: #15151a;
  --panel-2: #1c1b22;
  --panel-3: #24222b;
  --line: #2a2833;
  --line-soft: #201f27;
  --text: #f1effa;
  --text-soft: #c8c2d8;
  --muted: #807991;
  --muted-2: #5e596e;
  --accent: #7c5cff;
  --accent-2: #a88cff;
  --success: #3bd179;
  --danger: #ef6c79;
  --warning: #f4b84f;
  --shadow: 0 24px 80px rgba(0, 0, 0, .5);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

body[data-theme="graphite"] {
  --bg: #101114;
  --panel: #191b20;
  --panel-2: #20232a;
  --panel-3: #292d35;
  --line: #323743;
  --line-soft: #262a33;
  --text: #f3f5f8;
  --text-soft: #c6ccd8;
  --muted: #8a91a0;
  --accent: #8f7cff;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #f0f2f7;
  --panel-3: #e7eaf2;
  --line: #d7dce7;
  --line-soft: #e2e6ef;
  --text: #171821;
  --text-soft: #343848;
  --muted: #737a8d;
  --muted-2: #8e96a8;
  --shadow: 0 24px 80px rgba(16, 24, 40, .18);
}

body[data-typography="jetbrains-mono"] {
  --font: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

body[data-typography="system"] {
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-density="compact"] {
  font-size: 13px;
}

body[data-density="comfortable"] {
  font-size: 15px;
}

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

button {
  color: inherit;
}

.mail-shell {
  min-height: 100vh;
  background: var(--bg);
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  gap: 14px;
  color: var(--muted);
}

.boot-screen > div:last-child {
  display: grid;
  gap: 4px;
  text-align: center;
}

.boot-screen strong {
  color: var(--text);
  font-size: 17px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #6f4dff);
  box-shadow: 0 10px 28px rgba(124, 92, 255, .3);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-frame {
  display: grid;
  grid-template-columns: 240px 344px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  background: var(--bg);
}

body[data-layout="wide-reader"] .app-frame {
  grid-template-columns: 240px 304px minmax(0, 1fr);
}

body[data-layout="wide-list"] .app-frame {
  grid-template-columns: 240px minmax(420px, 42vw) minmax(0, 1fr);
}

body[data-layout="focused"] .app-frame {
  grid-template-columns: 0 360px minmax(0, 1fr);
}

body[data-layout="focused"] .sidebar {
  visibility: hidden;
  pointer-events: none;
}

.app-frame.sidebar-collapsed {
  grid-template-columns: 0 344px minmax(0, 1fr);
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
  background: #151519;
}

.sidebar-collapsed .sidebar {
  visibility: hidden;
  border-right: 0;
  pointer-events: none;
}

.sidebar-top {
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 61px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.auth-brand {
  border: 0;
  padding: 0;
}

.brand-name {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-name span:last-child {
  color: var(--accent-2);
}

.icon-btn,
.plain-btn,
.nav-item,
.folder-action,
.seg-btn,
.settings-tab,
.mail-action {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.icon-btn {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}

.brand-row .icon-btn {
  margin-left: auto;
}

.icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: currentColor;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compose-main {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: calc(100% - 20px);
  height: 40px;
  margin: 13px 10px;
  padding: 0 16px;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 9px 24px rgba(124, 92, 255, .25);
}

.compose-main:hover,
.compose-main:focus-visible {
  background: #8b72ff;
  outline: none;
}

.nav-section {
  padding: 0 8px 8px;
}

.nav-rule {
  height: 1px;
  margin: 8px 4px;
  background: var(--line-soft);
}

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 31px;
  margin: 1px 0;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-soft);
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: #22212a;
  color: var(--text);
  outline: none;
}

.nav-item.active {
  background: var(--panel-3);
  color: var(--text);
}

.nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-pill {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.account-card {
  padding: 8px 8px 3px;
}

.account-head {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 22px;
  align-items: center;
  min-height: 50px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-soft);
}

.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.account-name {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-email {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-list {
  padding-left: 24px;
}

.folder-action {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 27px;
  padding: 4px 10px;
  color: var(--muted);
  text-align: left;
}

.folder-inline {
  display: grid;
  grid-template-columns: 1fr 24px 24px;
  gap: 3px;
  align-items: center;
  padding: 3px 10px 3px 50px;
}

.folder-inline input {
  width: 100%;
  height: 26px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 8px;
}

.folder-inline button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
}

.sidebar-footer {
  padding: 10px 8px 15px;
  border-top: 1px solid var(--line-soft);
}

.message-list {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-width: 0;
  border-right: 1px solid var(--line-soft);
  background: #101014;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 51px;
  padding: 11px 16px 8px;
}

.mobile-menu-btn {
  display: none;
}

.sidebar-collapsed .mobile-menu-btn {
  display: inline-grid;
  flex: 0 0 auto;
}

.list-title {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-total {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 13px;
}

.seg-btn,
.list-size {
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.seg-btn {
  min-width: 56px;
  padding: 0 10px;
}

.seg-btn.active {
  border-color: rgba(124, 92, 255, .7);
  color: var(--text);
}

.list-size {
  width: 58px;
  padding: 0 8px;
}

.search-row {
  padding: 0 16px 10px;
}

.search-box {
  position: relative;
}

.search-box .icon {
  position: absolute;
  top: 10px;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted-2);
}

.search-box input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px 0 36px;
  outline: none;
}

.search-box input:focus {
  border-color: rgba(124, 92, 255, .75);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .14);
}

.messages-scroll {
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--line-soft);
}

.message-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  min-height: 76px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.message-row:hover {
  background: rgba(255, 255, 255, .025);
}

.message-row.active {
  background: var(--panel-3);
}

.message-row.unread .message-from,
.message-row.unread .message-subject {
  color: var(--text);
}

.message-from {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.unread-dot {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.read-spacer {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
}

.message-date {
  color: var(--muted);
  font-size: 12px;
}

.message-subject,
.message-snippet {
  grid-column: 1 / 3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-subject {
  color: var(--text-soft);
  font-weight: 650;
}

.message-snippet {
  color: var(--muted);
  font-size: 13px;
}

.list-empty,
.list-end {
  padding: 26px 12px;
  color: var(--muted-2);
  text-align: center;
  font-size: 12px;
}

.reader {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background: var(--bg);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 28px;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.mail-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px;
  color: var(--text-soft);
  border-radius: 7px;
}

.mail-action:hover,
.mail-action:focus-visible {
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.reader-spacer {
  flex: 1 1 auto;
}

.reader-body {
  min-height: 0;
  overflow: auto;
  padding: 28px;
}

.empty-reader {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
}

.empty-reader-inner {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.empty-reader .empty-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
}

.message-card {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #111115;
}

.message-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.message-head h1 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.25;
}

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

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.sender-meta {
  min-width: 0;
}

.sender-main {
  overflow: hidden;
  color: var(--text);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender-main span {
  color: var(--muted);
  font-weight: 500;
}

.sender-sub {
  color: var(--muted);
  font-size: 13px;
}

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

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.account-chip::before {
  width: 6px;
  height: 6px;
  content: "";
  border-radius: 50%;
  background: var(--accent);
}

.message-content {
  max-width: 900px;
  padding: 26px 0 0;
  color: var(--text);
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-plain {
  line-height: 1.65;
}

.message-html-frame {
  width: min(100%, 980px);
  min-height: 68vh;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) 430px;
  background: radial-gradient(circle at 18% 20%, rgba(124, 92, 255, .16), transparent 25%), var(--bg);
}

.auth-copy {
  align-self: center;
  max-width: 720px;
  padding: 64px;
}

.auth-copy h1 {
  max-width: 780px;
  margin: 18px 0 18px;
  color: var(--text);
  font-size: clamp(44px, 6vw, 82px);
  line-height: .92;
}

.auth-copy p {
  max-width: 560px;
  color: var(--text-soft);
  font-size: 18px;
}

.security-grid {
  display: grid;
  max-width: 780px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}

.security-tile {
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
}

.security-tile strong {
  display: block;
  margin-bottom: 8px;
}

.security-tile span {
  color: var(--muted);
  font-size: 13px;
}

.auth-panel {
  align-self: center;
  margin-right: 54px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-panel h2 {
  margin: 0;
  font-size: 26px;
}

.auth-panel p {
  margin: 6px 0 22px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}

.field input,
.field select {
  height: 38px;
  padding: 0 12px;
}

.field textarea {
  min-height: 170px;
  padding: 10px 12px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(124, 92, 255, .75);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .14);
}

.primary-btn,
.soft-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  gap: 8px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 750;
}

.primary-btn {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.soft-btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.danger-btn {
  border: 1px solid rgba(239, 108, 121, .45);
  background: rgba(239, 108, 121, .08);
  color: #ff98a2;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .72);
}

.settings-dialog {
  display: grid;
  width: min(680px, calc(100vw - 32px));
  height: min(700px, calc(100vh - 48px));
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.settings-nav {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  min-width: 0;
  padding: 18px 10px;
  border-right: 1px solid var(--line);
}

.settings-label {
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.settings-tab {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  gap: 9px;
  border-radius: 7px;
  color: var(--text-soft);
  text-align: left;
}

.settings-tab:hover,
.settings-tab.active {
  background: var(--panel-3);
  color: var(--text);
}

.settings-tab.active {
  outline: 2px solid var(--accent);
}

.settings-close {
  justify-self: start;
  color: var(--muted);
}

.settings-panel {
  min-width: 0;
  overflow: auto;
  padding: 30px 24px;
}

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

.settings-panel > p {
  margin: 0 0 24px;
  color: var(--muted);
}

.setting-list {
  display: grid;
  gap: 12px;
}

.option-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-soft);
  text-align: left;
}

.option-card.selected {
  border-color: rgba(124, 92, 255, .8);
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .5);
}

.option-card strong {
  color: var(--text);
}

.option-card span,
.muted {
  color: var(--muted);
}

.account-settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.account-portal {
  margin-top: 2px;
  font-size: 11px;
}

.mailbox-switcher {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px 18px;
}

.mailbox-pill {
  display: flex;
  width: 100%;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.mailbox-pill.active,
.mailbox-pill:hover {
  border-color: rgba(124, 92, 255, .65);
  background: rgba(124, 92, 255, .1);
  color: var(--text);
}

.account-settings-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.status-dot {
  color: var(--success);
  font-size: 12px;
}

.server-line {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 12px 16px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.settings-form,
.credentials-grid {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.settings-form h2 {
  margin: 0;
}

.credentials-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.credentials-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.credentials-grid input,
.settings-form input,
.settings-form select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101015;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

.toggle-line {
  display: flex;
  align-items: center;
  min-height: 38px;
  gap: 10px;
  color: var(--text-soft);
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.credentials-grid input {
  font-family: var(--mono);
  font-size: 12px;
}

.mailbox-create-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.mailbox-create-line > span {
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
}

.mailbox-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.mailbox-row.active {
  border-color: rgba(124, 92, 255, .7);
}

.mailbox-row div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.mailbox-row span {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warning-box {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 197, 87, .45);
  border-radius: 8px;
  background: rgba(255, 197, 87, .08);
  color: #ffd98a;
}

.security-key {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  font-family: var(--mono);
}

.key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.compose-window {
  position: fixed;
  right: 24px;
  bottom: 0;
  z-index: 25;
  display: grid;
  width: min(540px, calc(100vw - 48px));
  max-height: min(620px, calc(100vh - 80px));
  grid-template-rows: auto auto auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.compose-head {
  display: flex;
  align-items: center;
  min-height: 43px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.compose-head strong {
  font-size: 14px;
}

.compose-head .icon-btn {
  width: 25px;
  height: 25px;
  margin-left: auto;
}

.compose-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  min-height: 38px;
  border-bottom: 1px solid var(--line-soft);
}

.compose-row label {
  display: grid;
  place-items: center start;
  padding-left: 14px;
  color: var(--muted);
}

.compose-row input,
.compose-row select {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  padding: 0 10px;
}

.compose-body {
  min-height: 210px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  padding: 16px;
  resize: none;
}

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

.compose-actions .plain-btn {
  margin-left: auto;
  color: var(--muted);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(239, 108, 121, .5);
}

.mobile-scrim {
  display: none;
}

@media (max-width: 1040px) {
  .app-frame {
    grid-template-columns: 240px minmax(320px, 38vw) minmax(0, 1fr);
  }

  .app-frame.sidebar-collapsed {
    grid-template-columns: 0 minmax(320px, 38vw) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  body {
    overflow: hidden;
  }

  .app-frame {
    grid-template-columns: 1fr;
  }

  .app-frame.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: min(320px, 82vw);
    transform: translateX(-105%);
    transition: transform .18s ease;
  }

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

  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, .68);
  }

  .message-list {
    grid-column: 1;
    border-right: 0;
  }

  .mobile-menu-btn {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .list-header {
    padding-left: 12px;
    gap: 6px;
  }

  .list-title {
    font-size: 15px;
  }

  .reader {
    position: fixed;
    inset: 0;
    z-index: 20;
    transform: translateX(100%);
    transition: transform .18s ease;
  }

  .reader.has-message {
    transform: translateX(0);
  }

  .reader-toolbar {
    padding: 0 12px;
  }

  .reader-body {
    padding: 16px;
  }

  .message-head {
    grid-template-columns: 1fr;
  }

  .message-time {
    text-align: left;
  }

  .auth-screen {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .auth-copy {
    padding: 32px 20px 10px;
  }

  .auth-copy h1 {
    font-size: 42px;
  }

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

  .auth-panel {
    margin: 12px 16px 32px;
  }

  .settings-dialog {
    width: 100vw;
    height: 100vh;
    grid-template-columns: 1fr;
    border-radius: 0;
  }

  .settings-nav {
    grid-template-rows: auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-nav-list {
    display: flex;
    overflow: auto;
    gap: 8px;
  }

  .settings-tab {
    width: auto;
    white-space: nowrap;
  }

  .settings-close {
    position: absolute;
    right: 12px;
    bottom: 12px;
  }

  .credentials-grid,
  .mailbox-create-line,
  .mailbox-row {
    grid-template-columns: 1fr;
  }

  .compose-window {
    inset: auto 0 0;
    width: 100vw;
    max-height: 78vh;
    border-radius: 12px 12px 0 0;
  }
}

.landing-body {
  overflow: auto;
  background: var(--bg);
}

.landing-page {
  min-height: 100vh;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  text-decoration: none;
}

.landing-brand span span {
  color: var(--accent-2);
}

.landing-nav-actions,
.landing-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-hero {
  position: relative;
  display: flex;
  max-width: 1280px;
  min-height: calc(100vh - 140px);
  align-items: flex-start;
  margin: 0 auto;
  padding: 48px 24px 88px;
  overflow: hidden;
}

.landing-copy {
  position: relative;
  z-index: 2;
  max-width: 620px;
  padding-top: min(9vh, 80px);
}

.landing-eyebrow {
  margin: 0 0 14px;
  color: var(--accent-2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.landing-copy h1 {
  max-width: 620px;
  margin: 0;
  color: var(--text);
  font-size: clamp(52px, 6.6vw, 88px);
  line-height: .94;
}

.landing-lead {
  max-width: 640px;
  margin: 24px 0 30px;
  color: var(--text-soft);
  font-size: 18px;
}

.mail-preview {
  position: absolute;
  inset: 34px 24px 38px min(350px, 31vw);
  z-index: 1;
  display: grid;
  grid-template-columns: 170px 240px minmax(0, 1fr);
  min-height: 500px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 15, 20, .85);
  box-shadow: var(--shadow);
  opacity: .72;
}

.preview-sidebar,
.preview-list,
.preview-reader {
  min-width: 0;
  border-right: 1px solid var(--line-soft);
}

.preview-sidebar {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-content: start;
  gap: 14px 9px;
  padding: 28px 18px;
  color: var(--text-soft);
}

.preview-sidebar span {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.preview-sidebar small {
  color: var(--muted);
}

.preview-list {
  display: grid;
  align-content: start;
}

.preview-list div {
  display: grid;
  gap: 7px;
  min-height: 92px;
  padding: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.preview-list strong,
.preview-reader strong {
  color: var(--text);
}

.preview-list span,
.preview-reader p,
.landing-band span {
  color: var(--muted);
}

.preview-reader {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 34px;
  border-right: 0;
}

.landing-band {
  display: grid;
  max-width: 1180px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

.landing-band article {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
}

.landing-band strong {
  display: block;
  margin-bottom: 9px;
  color: var(--text);
}

@media (max-width: 980px) {
  .landing-hero {
    min-height: calc(100vh - 90px);
  }

  .landing-copy {
    padding-top: 32px;
  }

  .mail-preview {
    inset: 210px 12px 18px;
    grid-template-columns: 1fr;
    min-height: 340px;
    opacity: .42;
  }

  .preview-sidebar,
  .preview-list {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .landing-band {
    grid-template-columns: 1fr;
  }
}
