/* ---------------------------------------------------------------- tokens */

:root {
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --accent: #4f7cff;
  --accent-strong: #3f6bea;
  --star: #f0a020;
  --danger: #e5484d;
  --success: #2f9e44;
  --radius: 10px;
  --radius-lg: 14px;
}

:root,
:root[data-theme='light'] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --sunken: #eef2f8;
  --border: #e3e8f1;
  --border-strong: #d1d9e6;
  --text: #151f2e;
  --text-2: #48566b;
  --muted: #7c879b;
  --accent-soft: #eaf0ff;
  --hover: #f1f5fc;
  --shadow: 0 18px 40px rgba(17, 32, 60, 0.14);
  --shadow-soft: 0 1px 2px rgba(17, 32, 60, 0.06);
}

:root[data-theme='dark'] {
  --bg: #0b1119;
  --surface: #121b26;
  --surface-2: #0e1621;
  --sunken: #0c1420;
  --border: #1d2735;
  --border-strong: #2b3748;
  --text: #e7eef8;
  --text-2: #a7b5c8;
  --muted: #78879c;
  --accent-soft: #1a2740;
  --hover: #16202d;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
}

input,
select {
  font: inherit;
  color: inherit;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------------------------------------------------------------- shell */

.app {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  height: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: 244px 372px minmax(320px, 1fr);
  min-height: 0;
  overflow: hidden;
}

.workspace.single {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px;
}

.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  animation: fade-in 240ms ease-out;
}

.splash h1 {
  margin: 10px 0 2px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

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

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ---------------------------------------------------------------- titlebar */

.titlebar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
  z-index: 20;
}

:root[data-platform='win32'] .titlebar {
  padding-right: 150px;
}

:root[data-platform='linux'] .titlebar {
  padding-right: 24px;
}

:root[data-platform='darwin'] .titlebar {
  padding-left: 88px;
}

.titlebar button,
.titlebar input {
  -webkit-app-region: no-drag;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.brand-mark {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, #6f95ff, #3f63e0);
  box-shadow: 0 4px 10px rgba(79, 124, 255, 0.35);
}

.brand-mark.large {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}

.brand-name {
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 14.5px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 460px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--sunken);
  border: 1px solid transparent;
  color: var(--muted);
  transition: border-color 120ms ease, background 120ms ease;
}

.search-field:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.14);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
}

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

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

/* ---------------------------------------------------------------- buttons */

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(180deg, #5d87ff, #466fe8);
  box-shadow: 0 1px 2px rgba(24, 56, 148, 0.3), 0 6px 16px rgba(79, 124, 255, 0.26);
  transition: filter 120ms ease, transform 120ms ease;
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.06);
}

.primary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.primary-button.compact {
  height: 32px;
  padding: 0 13px;
  font-size: 12.5px;
}

.secondary-button {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.secondary-button:hover:not(:disabled) {
  background: var(--hover);
}

.ghost-button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}

.ghost-button:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.ghost-button.small {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.ghost-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.ghost-icon:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.ghost-icon.tiny {
  width: 22px;
  height: 22px;
}

.ghost-icon.danger:hover {
  background: rgba(229, 72, 77, 0.12);
  color: var(--danger);
}

.ghost-icon.is-starred {
  color: var(--star);
}

.ghost-icon:disabled {
  opacity: 0.6;
  cursor: default;
}

.ghost-icon.is-busy svg {
  animation: spin 900ms linear infinite;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  padding: 0 2px;
  white-space: nowrap;
}

.text-button:hover {
  text-decoration: underline;
}

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

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  min-height: 0;
  overflow: hidden;
}

.sidebar-block {
  padding: 12px 10px 4px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-block.grow {
  flex: 1;
  overflow: hidden;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

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

.account-row.is-active {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}

.account-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

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

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

.pill {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  padding-bottom: 8px;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.folder-row span:first-of-type {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-row:hover {
  background: var(--hover);
  color: var(--text);
}

.folder-row.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.folder-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.folder-row.is-active .folder-count {
  background: rgba(79, 124, 255, 0.16);
  color: var(--accent-strong);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.footer-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12.2px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

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

.version {
  font-size: 11px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- list */

.list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.list-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.list-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 660;
  letter-spacing: -0.02em;
}

.list-subtitle {
  margin: 2px 0 0;
  font-size: 11.8px;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--sunken);
  align-self: flex-start;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.8px;
  font-weight: 550;
  padding: 4px 11px;
  border-radius: 6px;
  cursor: pointer;
}

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

.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.list-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.list-pane.is-loading .list-scroll {
  opacity: 0.55;
  transition: opacity 160ms ease;
}

.message-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 120ms ease;
  outline: none;
}

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

.message-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.message-row.is-selected {
  background: var(--accent-soft);
}

.message-row.is-selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.row-body {
  min-width: 0;
}

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

.row-from {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.message-row.is-unread .row-from {
  color: var(--text);
  font-weight: 650;
}

.row-time {
  flex: none;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.row-subject {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row.is-unread .row-subject {
  font-weight: 650;
}

.message-row:not(.is-unread) .row-subject {
  color: var(--text-2);
}

.row-snippet {
  margin-top: 3px;
  font-size: 12.2px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-flags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 1px;
}

.star-button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--border-strong);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease;
}

.message-row:hover .star-button,
.star-button.is-on,
.message-row.is-selected .star-button {
  opacity: 1;
}

.star-button:hover {
  color: var(--star);
  background: rgba(240, 160, 32, 0.12);
}

.star-button.is-on {
  color: var(--star);
}

.row-clip {
  color: var(--muted);
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.18);
}

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

.empty-title {
  margin: 12px 0 4px;
  font-size: 14px;
  font-weight: 620;
  color: var(--text);
}

.empty-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 300px;
  margin-inline: auto;
}

/* ---------------------------------------------------------------- reader */

.reader {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.8px;
  cursor: pointer;
}

.tool-button:hover {
  background: var(--hover);
  color: var(--text);
}

.reader-head {
  padding: 18px 24px 14px;
  background: var(--surface);
  flex: none;
}

.reader-subject {
  margin: 0 0 14px;
  font-size: 21px;
  line-height: 1.28;
  font-weight: 670;
  letter-spacing: -0.02em;
  color: var(--text);
  word-break: break-word;
}

.reader-meta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.reader-meta-text {
  flex: 1;
  min-width: 0;
}

.reader-from {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.reader-from strong {
  font-weight: 640;
}

.reader-address {
  color: var(--muted);
  font-size: 12.3px;
}

.reader-to {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.2px;
  cursor: pointer;
}

.reader-to:hover {
  color: var(--accent);
}

.reader-details {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  gap: 5px;
  font-size: 12.2px;
  color: var(--text-2);
  animation: fade-in 140ms ease-out;
}

.reader-details span {
  display: inline-block;
  width: 46px;
  color: var(--muted);
}

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

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 14px;
  background: var(--surface);
  flex: none;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 300px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.4px;
  cursor: pointer;
}

.attachment:hover {
  border-color: var(--accent);
  color: var(--text);
}

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

.attachment-size {
  color: var(--muted);
  font-size: 11.4px;
}

.attachment-save {
  opacity: 0.6;
}

.attachment:hover .attachment-save {
  opacity: 1;
  color: var(--accent);
}

.reader-body {
  flex: 1;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
  background: #fff;
  min-height: 0;
}

:root[data-theme='dark'] .reader-body {
  margin: 0 12px 12px;
  width: calc(100% - 24px);
  border-radius: 10px;
  border-top: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.reader-empty {
  margin: auto;
  text-align: center;
  padding: 40px;
  animation: fade-in 220ms ease-out;
}

.reader-empty-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 660;
  letter-spacing: 0.02em;
  flex: none;
  user-select: none;
}

.avatar.avatar-square {
  border-radius: 9px;
}

.flip {
  transform: rotate(180deg);
}

/* ---------------------------------------------------------------- modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(10, 17, 28, 0.44);
  backdrop-filter: blur(3px);
  animation: fade-in 130ms ease-out;
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.modal-head p {
  margin: 4px 0 0;
  font-size: 12.4px;
  color: var(--muted);
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.field > span {
  flex: none;
  width: 54px;
  font-size: 12.4px;
  color: var(--muted);
}

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  padding: 11px 0;
  font-size: 13px;
}

.field:focus-within {
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);
}

.field.stacked {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  border-bottom: 0;
}

.field.stacked > span {
  width: auto;
  font-size: 11.6px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.field.stacked input,
.field.stacked select {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-2);
  outline: none;
}

.field.stacked input:focus,
.field.stacked select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
  background: var(--surface);
}

.field.stacked input::placeholder {
  color: var(--muted);
}

.hint-row {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12.2px;
  line-height: 1.5;
  color: var(--muted);
}

.advanced-toggle {
  align-self: flex-start;
}

.advanced {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  animation: fade-in 140ms ease-out;
}

.server-group {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}

.server-group legend {
  font-size: 11.6px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 6px;
}

.server-group input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
}

.server-group input.host {
  flex: 1;
  min-width: 0;
}

.server-group input.port {
  width: 76px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
}

.form-error,
.compose-error {
  margin: 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(229, 72, 77, 0.1);
  border: 1px solid rgba(229, 72, 77, 0.28);
  color: #d33a3f;
  font-size: 12.4px;
  line-height: 1.5;
}

:root[data-theme='dark'] .form-error,
:root[data-theme='dark'] .compose-error {
  color: #ff8f92;
}

.connected {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connected h3 {
  margin: 0;
  font-size: 11.6px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.connected-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.6px;
}

.connected-mail {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: none;
}

/* ---------------------------------------------------------------- compose */

.compose {
  width: min(780px, 100%);
  height: min(640px, calc(100vh - 90px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.compose-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.compose-fields {
  padding: 4px 18px 0;
  flex: none;
}

.compose-fields .field:last-child {
  border-bottom: 0;
}

.compose-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex: none;
}

.compose-toolbar button {
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.compose-toolbar button:hover {
  background: var(--hover);
  color: var(--text);
}

.toolbar-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
}

.compose-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  outline: none;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--text);
  min-height: 0;
}

.compose-body:empty::before {
  content: 'Write your message…';
  color: var(--muted);
}

.compose-body a {
  color: var(--accent);
}

.compose-error {
  margin: 0 18px 10px;
}

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

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

.compose-hint {
  font-size: 11.6px;
  color: var(--muted);
  text-align: right;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(520px, calc(100vw - 48px));
  padding: 10px 12px 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 12.8px;
  color: var(--text);
  animation: toast-in 180ms ease-out;
}

.toast-error {
  border-color: rgba(229, 72, 77, 0.4);
  color: var(--danger);
}

.toast-success {
  border-color: rgba(47, 158, 68, 0.4);
  color: var(--success);
}

.toast-close {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 2px;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 220px 336px minmax(280px, 1fr);
  }

  .tool-button span {
    display: none;
  }
}
