:root {
  color-scheme: light;
  --bg: #edf2ef;
  --surface: #ffffff;
  --surface-subtle: #f6f8f7;
  --surface-raised: #fbfcfb;
  --ink: #17211e;
  --ink-soft: #52615c;
  --ink-faint: #7e8b87;
  --line: #dfe7e3;
  --line-strong: #cbd7d2;
  --accent: #0f766e;
  --accent-strong: #095f59;
  --accent-soft: #dff3ef;
  --accent-faint: #eef9f7;
  --danger: #b64242;
  --danger-soft: #fbeaea;
  --warning: #9a6510;
  --shadow-sm: 0 1px 2px rgb(20 55 45 / 0.06), 0 8px 24px rgb(20 55 45 / 0.06);
  --shadow-lg: 0 28px 70px rgb(15 43 35 / 0.18), 0 4px 16px rgb(15 43 35 / 0.08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --header-height: 68px;
  --font-sans: "Segoe UI Variable", "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101815;
    --surface: #17211e;
    --surface-subtle: #1c2824;
    --surface-raised: #202d29;
    --ink: #edf5f2;
    --ink-soft: #b1c0bb;
    --ink-faint: #7f928b;
    --line: #2c3b36;
    --line-strong: #3b4d47;
    --accent: #4fc1b3;
    --accent-strong: #71d2c7;
    --accent-soft: #183f3a;
    --accent-faint: #19312d;
    --danger: #ef8585;
    --danger-soft: #472626;
    --warning: #e7b357;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.18), 0 8px 24px rgb(0 0 0 / 0.16);
    --shadow-lg: 0 28px 70px rgb(0 0 0 / 0.46), 0 4px 16px rgb(0 0 0 / 0.22);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
summary,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 2px;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

[hidden] {
  display: none !important;
}

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

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.icon--small {
  width: 14px;
  height: 14px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
  color: #fff;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.08em;
}

.brand-mark::after {
  position: absolute;
  right: -9px;
  bottom: -11px;
  width: 31px;
  height: 31px;
  border: 1px solid rgb(255 255 255 / 0.24);
  border-radius: 50%;
  content: "";
}

.brand-mark span {
  margin-top: -3px;
  margin-left: -2px;
}

.brand-mark--small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 20px;
}

.brand-mark--large {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  font-size: 36px;
}

.boot-screen {
  display: grid;
  min-height: 100dvh;
  place-content: center;
  justify-items: center;
  background: var(--surface);
}

.boot-screen p {
  margin: 20px 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

.boot-bar {
  width: 126px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.boot-bar span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: boot-slide 1s ease-in-out infinite alternate;
}

@keyframes boot-slide {
  from { transform: translateX(-10%); }
  to { transform: translateX(130%); }
}

.login-screen {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: minmax(360px, 1.08fr) minmax(440px, 0.92fr);
  background: var(--surface);
}

.login-intro {
  position: relative;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 4vw, 64px);
  background:
    linear-gradient(135deg, rgb(7 76 69 / 0.96), rgb(8 92 83 / 0.91)),
    var(--accent);
  color: #effcf9;
}

.login-intro::before,
.login-intro::after {
  position: absolute;
  border: 1px solid rgb(255 255 255 / 0.13);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.login-intro::before {
  top: 7%;
  right: -25%;
  width: min(54vw, 720px);
  height: min(54vw, 720px);
}

.login-intro::after {
  right: 8%;
  bottom: -22%;
  width: min(31vw, 420px);
  height: min(31vw, 420px);
  box-shadow: 0 0 0 70px rgb(255 255 255 / 0.025), 0 0 0 140px rgb(255 255 255 / 0.02);
}

.login-brand,
.login-copy,
.login-domain {
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-brand .brand-mark {
  background: rgb(255 255 255 / 0.13);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.2);
}

.login-copy {
  max-width: 680px;
  padding: 12vh 0 10vh;
}

.login-copy .eyebrow {
  color: #9ce1d7;
}

.login-copy h1 {
  max-width: 11ch;
  margin: 20px 0 28px;
  font-size: clamp(46px, 6.4vw, 94px);
  font-weight: 620;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.login-copy > p:last-child {
  max-width: 43ch;
  margin: 0;
  color: rgb(235 255 250 / 0.72);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.8;
}

.login-domain {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0;
  font-weight: 700;
}

.login-domain span {
  color: rgb(235 255 250 / 0.58);
  font-size: 12px;
  font-weight: 500;
}

.login-panel {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(32px, 7vw, 110px);
  background: var(--surface);
}

.login-form {
  width: min(100%, 430px);
}

.login-form__heading {
  margin-bottom: 40px;
}

.login-form__heading h2 {
  margin: 9px 0 8px;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 660;
  letter-spacing: -0.04em;
}

.login-form__heading > p:last-child,
.login-help {
  margin: 0;
  color: var(--ink-soft);
}

.login-help {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.field small {
  color: var(--ink-faint);
  font-weight: 450;
}

.field input,
.field select,
.compose-row input,
.compose-row select,
.global-search input,
.admin-search input {
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field > input,
.field > select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
}

.field input:hover,
.field select:hover,
.compose-row input:hover,
.compose-row select:hover {
  border-color: var(--ink-faint);
}

.field input:focus,
.field select:focus,
.compose-row input:focus,
.compose-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
  outline: 0;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  height: 48px;
  padding: 0 70px 0 14px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
}

.primary-button,
.secondary-button,
.danger-button,
.compose-button,
.reader-action,
.header-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 680;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.compose-button:active,
.reader-action:active,
.header-action:active,
.icon-button:active {
  transform: translateY(1px);
}

.primary-button {
  padding: 0 17px;
  border: 1px solid var(--accent);
  background: var(--accent);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent);
  color: #fff;
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.primary-button--wide {
  width: 100%;
  min-height: 51px;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 18px;
}

.secondary-button {
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--ink-faint);
  background: var(--surface-subtle);
}

.danger-button {
  padding: 0 16px;
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #fff;
}

.danger-button:hover {
  filter: brightness(0.92);
}

.text-button {
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
}

.text-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--ink);
}

.icon-button--danger:hover {
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.form-alert {
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100dvh;
  background: var(--bg);
}

.app-header {
  position: relative;
  z-index: 20;
  display: grid;
  height: var(--header-height);
  grid-template-columns: 260px minmax(240px, 680px) 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.header-brand-group,
.header-actions {
  display: flex;
  align-items: center;
}

.header-brand-group {
  gap: 6px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.app-brand__text {
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.app-brand__text b {
  color: var(--ink-faint);
  font-weight: 540;
}

.global-search {
  display: grid;
  height: 42px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--ink-faint);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.global-search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.global-search input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.global-search kbd {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-faint);
  font: 11px var(--font-sans);
}

.header-actions {
  min-width: 0;
  justify-content: flex-end;
  gap: 10px;
}

.header-action {
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  white-space: nowrap;
}

.header-action:hover {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--ink);
}

.account-menu {
  position: relative;
}

.account-menu summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  list-style: none;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.account-menu summary:hover {
  background: var(--surface-subtle);
}

.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 760;
  text-transform: uppercase;
}

.avatar--account {
  width: 36px;
  height: 36px;
}

.account-summary {
  display: grid;
  max-width: 150px;
  line-height: 1.28;
}

.account-summary strong,
.account-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-summary strong {
  font-size: 13px;
}

.account-summary small {
  color: var(--ink-faint);
  font-size: 11px;
}

.account-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 50;
  width: 250px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.account-popover__identity {
  display: grid;
  gap: 3px;
  padding: 10px 11px 13px;
  border-bottom: 1px solid var(--line);
}

.account-popover__identity span:not(.status-chip) {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
}

.account-popover button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.account-popover button:hover {
  background: var(--surface-subtle);
}

.status-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 730;
  letter-spacing: 0.05em;
}

.mail-workspace {
  display: grid;
  height: calc(100dvh - var(--header-height));
  grid-template-columns: 240px minmax(320px, 390px) minmax(420px, 1fr);
  overflow: hidden;
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface-subtle);
}

.compose-button {
  min-height: 47px;
  justify-content: flex-start;
  padding: 0 17px;
  border: 1px solid var(--accent);
  background: var(--accent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 16%, transparent);
  color: #fff;
}

.compose-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.sidebar-section {
  margin-top: 25px;
}

.sidebar-label {
  display: block;
  margin: 0 10px 8px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.folder-nav {
  display: grid;
  gap: 3px;
}

.folder-item {
  display: grid;
  min-height: 43px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}

.folder-item:hover {
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
  color: var(--ink);
}

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

.folder-count {
  min-width: 23px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 10px;
  text-align: center;
}

.select-control {
  position: relative;
  display: block;
}

.select-control select {
  width: 100%;
  height: 42px;
  appearance: none;
  padding: 0 35px 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

.select-control .icon {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  pointer-events: none;
}

.sidebar-footer {
  margin-top: auto;
  padding: 15px 9px 0;
  border-top: 1px solid var(--line);
}

.storage-summary__row {
  display: flex;
  justify-content: space-between;
  color: var(--ink-faint);
  font-size: 10px;
}

.storage-meter {
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.storage-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.sidebar-footer > p {
  margin: 16px 0 0;
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.message-column,
.reader-column {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
}

.message-column {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.column-toolbar {
  display: flex;
  min-height: 85px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--line);
}

.column-context {
  min-height: 16px;
  margin: 0 0 2px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-toolbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.035em;
}

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

.list-status {
  min-height: 0;
  padding: 0 18px;
  color: var(--ink-faint);
  font-size: 11px;
}

.list-status:not(:empty) {
  padding-top: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.message-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.message-item {
  position: relative;
  display: grid;
  min-height: 104px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  column-gap: 11px;
  padding: 16px 14px 14px 17px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease;
}

.message-item:hover {
  background: var(--surface-subtle);
}

.message-item.is-selected {
  background: var(--accent-faint);
}

.message-item.is-selected::before,
.message-item.is-unread::before {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: "";
}

.message-item .avatar {
  grid-row: 1 / span 2;
}

.message-item__from,
.message-item__subject,
.message-item__preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-item__from {
  align-self: center;
  font-size: 13px;
  font-weight: 590;
}

.message-item.is-unread .message-item__from,
.message-item.is-unread .message-item__subject {
  font-weight: 760;
}

.message-item__date {
  align-self: center;
  margin-left: 8px;
  color: var(--ink-faint);
  font-size: 10px;
  white-space: nowrap;
}

.message-item__subject {
  grid-column: 2 / 4;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 570;
}

.message-item__preview {
  grid-column: 2 / 4;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 11px;
}

.message-item__paperclip {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  color: var(--ink-faint);
}

.message-item__paperclip .icon {
  width: 12px;
  height: 12px;
}

.message-item--skeleton {
  cursor: default;
}

.message-item--skeleton > .skeleton {
  width: 38px;
  height: 38px;
  grid-row: 1 / span 3;
  border-radius: 50%;
}

.message-item--skeleton > div:last-child {
  display: grid;
  grid-column: 2 / 4;
  gap: 9px;
}

.message-item--skeleton > div:last-child .skeleton:nth-child(1) {
  width: 38%;
  height: 11px;
}

.message-item--skeleton > div:last-child .skeleton:nth-child(2) {
  width: 76%;
  height: 11px;
}

.message-item--skeleton > div:last-child .skeleton:nth-child(3) {
  width: 92%;
  height: 9px;
}

.empty-state,
.error-state {
  display: grid;
  min-height: 260px;
  align-content: center;
  justify-items: center;
  padding: 32px;
  text-align: center;
}

.empty-state__icon,
.confirm-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-state h2,
.empty-state h3,
.error-state h2,
.error-state h3 {
  margin: 15px 0 5px;
  font-size: 16px;
}

.empty-state p,
.error-state p {
  max-width: 33ch;
  margin: 0;
  color: var(--ink-faint);
  font-size: 12px;
}

.error-state > .icon {
  width: 31px;
  height: 31px;
  color: var(--danger);
}

.error-state .secondary-button {
  margin-top: 18px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 0 14px;
}

.load-more-wrap:has(button:not([hidden])) {
  padding-top: 12px;
  padding-bottom: 12px;
  border-top: 1px solid var(--line);
}

.reader-column {
  background: var(--surface-raised);
}

.reader-blank {
  display: grid;
  height: 100%;
  place-content: center;
  justify-items: center;
  color: var(--ink-faint);
}

.reader-blank__art {
  position: relative;
  width: 122px;
  height: 78px;
  margin-bottom: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transform: rotate(-2deg);
}

.reader-blank__art::before {
  position: absolute;
  top: -1px;
  left: 12px;
  width: 94px;
  height: 55px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  border-radius: 0 0 50% 50%;
  content: "";
}

.reader-blank__art span {
  position: absolute;
  border-radius: 50%;
  background: var(--accent-soft);
}

.reader-blank__art span:nth-child(1) { top: -12px; right: -19px; width: 22px; height: 22px; }
.reader-blank__art span:nth-child(2) { right: -26px; bottom: 5px; width: 9px; height: 9px; }
.reader-blank__art span:nth-child(3) { bottom: -13px; left: 10px; width: 15px; height: 15px; }

.reader-blank h2 {
  margin: 0 0 3px;
  color: var(--ink-soft);
  font-size: 15px;
}

.reader-blank p {
  margin: 0;
  font-size: 12px;
}

.reader-loading {
  padding: 72px clamp(30px, 6vw, 84px);
}

.skeleton {
  border-radius: 6px;
  background: linear-gradient(100deg, var(--line) 20%, var(--surface-subtle) 38%, var(--line) 55%);
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.25s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  to { background-position-x: -220%; }
}

.skeleton--title { width: min(70%, 520px); height: 34px; margin-bottom: 24px; }
.skeleton--meta { width: min(45%, 340px); height: 16px; margin-bottom: 60px; }
.skeleton--line { width: min(92%, 760px); height: 14px; margin-bottom: 13px; }
.skeleton--short { width: min(61%, 480px); }
.skeleton--row { height: 61px; margin: 8px 0; }

.error-state--reader {
  height: 100%;
}

.message-reader {
  height: 100%;
  overflow: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 8px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-raised) 95%, transparent);
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reader-action {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
}

.reader-action:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.reader-content {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(34px, 6vw, 74px) clamp(25px, 7vw, 94px) 80px;
}

.reader-content > h1 {
  margin: 11px 0 29px;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 620;
  letter-spacing: -0.045em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.sender-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.sender-identity {
  display: grid;
  min-width: 0;
}

.sender-identity strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-toggle {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 11px;
}

.recipient-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender-row time {
  color: var(--ink-faint);
  font-size: 11px;
  white-space: nowrap;
}

.recipient-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
}

.recipient-details dt {
  color: var(--ink-faint);
}

.recipient-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.attachment-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
}

.attachment-chip:hover,
.attachment-chip:focus-visible {
  border-color: var(--accent);
  background: var(--accent-faint);
}

.attachment-chip strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-body,
.message-frame,
.body-empty {
  margin-top: 34px;
}

.message-body {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-frame {
  width: 100%;
  min-height: 320px;
  border: 0;
  background: #fff;
}

.body-empty {
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-faint);
  text-align: center;
}

.dialog {
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.dialog::backdrop {
  background: rgb(9 23 19 / 0.58);
  backdrop-filter: blur(3px);
}

.dialog[open] {
  animation: dialog-in 170ms ease-out;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(9px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.dialog-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 23px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 5px 0 0;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.dialog-header > div > p:last-child:not(.eyebrow) {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 21px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.compose-dialog {
  width: min(760px, calc(100vw - 32px));
}

.compose-card {
  display: flex;
  height: min(760px, calc(100dvh - 42px));
  flex-direction: column;
}

.compose-fields {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 8px 23px 0;
}

.compose-row {
  display: grid;
  min-height: 48px;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 12px;
}

.compose-row input,
.compose-row select {
  width: 100%;
  height: 37px;
  padding: 0 9px;
  border-color: transparent;
  background: transparent;
}

.compose-extras-toggle {
  height: 0;
  text-align: right;
  transform: translateY(-33px);
  pointer-events: none;
}

.compose-extras-toggle button {
  pointer-events: auto;
}

.compose-body-label {
  display: block;
  margin-top: 15px;
  color: var(--ink-faint);
  font-size: 11px;
}

.compose-fields textarea {
  width: 100%;
  min-height: 290px;
  padding: 15px 0;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.form-alert--dialog {
  margin: 10px 22px;
}

.compose-footer {
  justify-content: space-between;
}

.compose-footer p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
}

.compose-footer > div {
  display: flex;
  gap: 9px;
}

.admin-dialog {
  width: min(1120px, calc(100vw - 32px));
}

.admin-card {
  height: min(760px, calc(100dvh - 40px));
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.admin-summary {
  display: grid;
  grid-template-columns: 120px 120px minmax(240px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 15px 21px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.admin-summary > div {
  display: grid;
  line-height: 1.25;
}

.admin-summary > div span {
  color: var(--ink-faint);
  font-size: 10px;
}

.admin-summary > div strong {
  font-size: 18px;
}

.admin-search {
  display: grid;
  height: 40px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  justify-self: end;
  width: min(100%, 330px);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-faint);
}

.admin-search input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.admin-loading {
  padding: 13px 21px;
}

.mailbox-table-wrap {
  height: calc(100% - 187px);
  overflow: auto;
}

.mailbox-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.mailbox-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 39px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.mailbox-table td {
  height: 67px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  vertical-align: middle;
}

.mailbox-table th:nth-child(1) { width: 30%; }
.mailbox-table th:nth-child(2) { width: 11%; }
.mailbox-table th:nth-child(3) { width: 11%; }
.mailbox-table th:nth-child(4) { width: 18%; }
.mailbox-table th:nth-child(5) { width: 18%; }
.mailbox-table th:nth-child(6) { width: 12%; }

.mailbox-identity {
  display: grid;
  min-width: 0;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.mailbox-identity .avatar {
  width: 36px;
  height: 36px;
  font-size: 11px;
}

.mailbox-identity > span:last-child {
  display: grid;
  min-width: 0;
}

.mailbox-identity strong,
.mailbox-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailbox-identity strong {
  color: var(--ink);
  font-size: 12px;
}

.mailbox-identity small {
  color: var(--ink-faint);
  font-size: 10px;
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.table-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  content: "";
}

.table-status--active { color: var(--accent); }
.table-status--active::before { background: var(--accent); }
.table-status--disabled { color: var(--warning); }
.table-status--disabled::before { background: var(--warning); }
.table-status--deleted { color: var(--danger); }
.table-status--deleted::before { background: var(--danger); }

.quota-cell {
  display: grid;
  gap: 5px;
}

.quota-cell__meter {
  width: min(110px, 100%);
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.quota-cell__meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.table-actions .icon-button {
  width: 34px;
  height: 34px;
}

.empty-state--admin {
  min-height: 360px;
}

.nested-dialog {
  width: min(520px, calc(100vw - 28px));
}

.form-dialog-card {
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

.form-dialog-body {
  padding: 22px;
}

.form-dialog-body .field:last-child,
.field-grid .field {
  margin-bottom: 0;
}

.address-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.address-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.address-field input {
  height: 46px;
  padding: 0 8px 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
}

.address-field b {
  padding-right: 14px;
  color: var(--ink-soft);
  font-weight: 600;
}

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

.dialog-lead {
  margin: 0 0 20px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.credential-result {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.credential-result span {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.credential-result strong {
  overflow-wrap: anywhere;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 15px;
}

.credential-result .secondary-button {
  width: fit-content;
  margin-top: 8px;
}

.credential-result p {
  margin: 3px 0 0;
  color: var(--danger);
  font-size: 11px;
}

.confirm-card {
  width: min(420px, calc(100vw - 28px));
  padding: 28px;
  text-align: center;
}

.confirm-icon {
  margin: 0 auto;
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-card h2 {
  margin: 17px 0 7px;
  font-size: 20px;
}

.confirm-card > p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 24px;
}

.toast-region {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 200;
  display: grid;
  width: min(370px, calc(100vw - 36px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  animation: toast-in 180ms ease-out;
  pointer-events: auto;
}

.toast > .icon {
  color: var(--accent);
}

.toast--error > .icon {
  color: var(--danger);
}

.toast p {
  margin: 0;
  font-size: 12px;
}

.toast button {
  width: 30px;
  height: 30px;
}

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

.mobile-only {
  display: none;
}

@media (max-width: 1120px) {
  .app-header {
    grid-template-columns: 220px minmax(220px, 1fr) auto;
  }

  .mail-workspace {
    grid-template-columns: 210px 350px minmax(390px, 1fr);
  }

  .account-summary,
  .header-action span {
    display: none;
  }

  .header-action {
    width: 40px;
    padding: 0;
  }
}

@media (max-width: 920px) {
  .mobile-only {
    display: inline-grid;
  }

  .app-header {
    grid-template-columns: auto minmax(160px, 1fr) auto;
    gap: 12px;
    padding: 0 12px;
  }

  .app-brand__text {
    display: none;
  }

  .mail-workspace {
    grid-template-columns: minmax(310px, 370px) minmax(390px, 1fr);
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 40;
    width: 260px;
    transform: translateX(-102%);
    box-shadow: var(--shadow-lg);
    transition: transform 190ms ease-out;
  }

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

  .nav-scrim {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 35;
    background: rgb(6 22 17 / 0.42);
  }

  .reader-toolbar {
    justify-content: space-between;
  }
}

@media (max-width: 680px) {
  :root {
    --header-height: 61px;
  }

  .login-screen {
    display: block;
    min-height: 100dvh;
    overflow: auto;
  }

  .login-intro {
    min-height: 37dvh;
    padding: 24px;
  }

  .login-copy {
    padding: 9vh 0 4vh;
  }

  .login-copy .eyebrow,
  .login-copy > p:last-child,
  .login-domain {
    display: none;
  }

  .login-copy h1 {
    max-width: 12ch;
    margin: 0;
    font-size: clamp(38px, 12vw, 58px);
  }

  .login-panel {
    min-height: 63dvh;
    padding: 38px 24px calc(34px + env(safe-area-inset-bottom));
  }

  .login-form__heading {
    margin-bottom: 28px;
  }

  .login-form__heading h2 {
    font-size: 28px;
  }

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

  .header-brand-group {
    gap: 2px;
  }

  .app-brand .brand-mark {
    display: none;
  }

  .global-search {
    height: 39px;
  }

  .global-search kbd {
    display: none;
  }

  .header-action {
    display: none;
  }

  .mail-workspace {
    display: block;
  }

  .message-column,
  .reader-column {
    position: absolute;
    inset: var(--header-height) 0 0;
  }

  .message-column {
    z-index: 2;
    border-right: 0;
  }

  .reader-column {
    z-index: 3;
    transform: translateX(102%);
    transition: transform 200ms ease-out;
  }

  body.reader-open .reader-column {
    transform: translateX(0);
  }

  .column-toolbar {
    min-height: 76px;
  }

  .message-item {
    min-height: 98px;
  }

  .reader-toolbar {
    padding: 7px 10px;
  }

  .reader-action span {
    display: none;
  }

  .reader-action {
    width: 40px;
    padding: 0;
  }

  .reader-content {
    padding: 31px 20px 60px;
  }

  .reader-content > h1 {
    margin-bottom: 23px;
    font-size: 25px;
  }

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

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

  .dialog,
  .compose-dialog,
  .admin-dialog,
  .nested-dialog {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
  }

  .dialog-card,
  .compose-card,
  .admin-card,
  .form-dialog-card {
    width: 100%;
    max-height: calc(100dvh - 14px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .compose-card,
  .admin-card {
    height: calc(100dvh - 14px);
  }

  .compose-fields {
    padding-right: 16px;
    padding-left: 16px;
  }

  .compose-row {
    grid-template-columns: 67px 1fr;
  }

  .compose-extras-toggle {
    height: auto;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    text-align: right;
    transform: none;
  }

  .compose-footer > p {
    display: none;
  }

  .compose-footer {
    justify-content: flex-end;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
  }

  .admin-header {
    align-items: flex-start;
  }

  .admin-header__actions .primary-button span {
    display: none;
  }

  .admin-header__actions .primary-button {
    width: 40px;
    padding: 0;
  }

  .admin-summary {
    grid-template-columns: 1fr 1fr;
  }

  .admin-search {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
  }

  .mailbox-table-wrap {
    height: calc(100% - 239px);
  }

  .mailbox-table {
    display: block;
    min-width: 0;
    table-layout: auto;
  }

  .mailbox-table thead {
    display: none;
  }

  .mailbox-table tbody {
    display: grid;
  }

  .mailbox-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }

  .mailbox-table td {
    display: block;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
  }

  .mailbox-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .mailbox-table td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    padding-left: 46px;
    color: var(--ink-faint);
    font-size: 10px;
  }

  .mailbox-table td:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .mailbox-table td:nth-child(4) {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 11px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
  }

  .mailbox-table td:nth-child(5) {
    grid-column: 1;
    grid-row: 4;
    align-self: center;
    margin-top: 6px;
    color: var(--ink-faint);
    font-size: 10px;
  }

  .mailbox-table td:nth-child(6) {
    grid-column: 2;
    grid-row: 4;
    margin-top: 3px;
  }

  .quota-cell__meter {
    width: 100%;
  }

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

  .form-dialog-card .dialog-footer {
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
  }

  .confirm-card {
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

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

@media (prefers-reduced-transparency: reduce) {
  .dialog::backdrop {
    background: #17211ee8;
    backdrop-filter: none;
  }

  .app-header,
  .reader-toolbar {
    background: var(--surface);
  }
}
