*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color: #18181b;
  background: #f7f7f5;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --surface: #ffffff;
  --surface-subtle: #f4f4f2;
  --surface-strong: #e9e9e5;
  --text: #18181b;
  --text-muted: #71717a;
  --line: #deded9;
  --accent: #16784a;
  --accent-hover: #105f3a;
  --accent-soft: #e2f2e9;
  --info: #245ea8;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --radius: 6px;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface-subtle);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  padding: 10px clamp(16px, 3vw, 44px);
  backdrop-filter: blur(12px);
}

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

.brand-link > span:last-child {
  display: grid;
}

.brand-link strong {
  font-size: 15px;
}

.brand-link small {
  color: var(--text-muted);
  font-size: 11px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.nav-links,
.summary-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-in-command {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.check-in-command:disabled {
  cursor: default;
  opacity: 0.62;
}

.nav-links > a:not(.icon-command) {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}

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

.icon-command,
.primary-command,
.danger-command,
.text-command,
.metric-command {
  border: 0;
  cursor: pointer;
}

.icon-command {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
}

.icon-command:hover {
  border-color: #b8b8b2;
  color: var(--text);
}

.icon-command:disabled {
  cursor: wait;
  opacity: 0.45;
}

.icon-command.danger:hover {
  border-color: #e0aaa5;
  background: var(--danger-soft);
  color: var(--danger);
}

.primary-command,
.danger-command {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 0 18px;
  color: #fff;
  font-weight: 700;
}

.primary-command {
  background: var(--accent);
}

.primary-command:hover {
  background: var(--accent-hover);
}

.primary-command:disabled {
  cursor: wait;
  opacity: 0.6;
}

.primary-command.compact {
  min-height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.danger-command {
  background: var(--danger);
}

.text-command {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  padding: 4px 0;
}

.section-kicker,
.auth-kicker {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-shell {
  display: grid;
  width: min(100% - 32px, 1080px);
  min-height: calc(100vh - 132px);
  margin: 32px auto;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #20231f;
  color: #fff;
  padding: clamp(36px, 6vw, 86px);
}

.auth-intro h1 {
  margin: 0 0 18px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.95;
}

.auth-intro > p:not(.auth-kicker) {
  max-width: 560px;
  margin: 0;
  color: #d2d5ce;
  font-size: 17px;
  line-height: 1.7;
}

.auth-intro ul {
  display: grid;
  gap: 12px;
  margin: 42px 0 0;
  padding: 0;
  list-style: none;
}

.auth-intro li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e6e8e2;
  font-size: 14px;
}

.auth-intro li::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5ad08e;
  content: "";
}

.auth-form-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 64px);
}

.auth-form-wrap h2 {
  margin: 30px 0 8px;
  font-size: 25px;
}

.form-hint {
  margin: 0 0 26px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 3px;
}

.segmented-control button {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 9%);
}

.segmented-control.compact {
  width: 230px;
}

.auth-form,
.dialog-form {
  display: grid;
  gap: 18px;
}

.auth-form label,
.dialog-form label {
  display: grid;
  gap: 7px;
}

.auth-form label > span,
.dialog-form label > span {
  color: #3f3f46;
  font-size: 12px;
  font-weight: 700;
}

.auth-form input,
.dialog-form input,
.address-field {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-form input,
.dialog-form input {
  outline: 0;
  padding: 0 12px;
}

.auth-form input:focus,
.dialog-form input:focus,
.address-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-with-icon {
  position: relative;
}

.field-with-icon .el-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--text-muted);
  transform: translateY(-50%);
}

.field-with-icon input {
  padding-left: 36px;
}

.workspace-shell {
  width: 100%;
  padding: 0 clamp(12px, 2.5vw, 36px) 32px;
}

.workspace-summary {
  display: grid;
  min-height: 104px;
  align-items: center;
  gap: 24px;
  grid-template-columns: minmax(210px, 1fr) auto auto;
  border-bottom: 1px solid var(--line);
}

.workspace-summary h1,
.panel-heading h2,
.message-header h2,
.settings-heading h1 {
  margin: 0;
  letter-spacing: 0;
}

.workspace-summary h1 {
  font-size: 25px;
}

.summary-metrics {
  display: flex;
  align-items: stretch;
}

.metric,
.metric-command {
  display: flex;
  min-width: 112px;
  align-items: center;
  gap: 10px;
  border-left: 1px solid var(--line);
  background: transparent;
  padding: 4px 18px;
  text-align: left;
}

.metric-command:hover {
  background: var(--accent-soft);
}

.metric-command .el-icon {
  color: var(--accent);
  font-size: 20px;
}

.metric span,
.metric-command span {
  display: grid;
}

.metric small,
.metric-command small,
.credit-overview small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong,
.metric-command strong {
  font-size: 19px;
}

.workspace-loading {
  display: grid;
  min-height: 500px;
  place-items: center;
  color: var(--text-muted);
}

.mail-workspace {
  display: grid;
  min-height: 640px;
  grid-template-columns: 270px 340px minmax(400px, 1fr);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.mailbox-rail,
.message-index,
.message-inspector {
  min-width: 0;
  padding: 22px;
}

.mailbox-rail,
.message-index {
  border-right: 1px solid var(--line);
}

.panel-heading,
.message-header {
  display: flex;
  min-height: 48px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2,
.message-header h2 {
  font-size: 17px;
}

.empty-panel {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  padding: 20px;
  text-align: center;
}

.empty-panel .el-icon {
  font-size: 28px;
}

.empty-panel p {
  margin: 0;
  font-size: 13px;
}

.mailbox-list,
.message-list {
  display: grid;
  gap: 3px;
  margin-top: 10px;
}

.mailbox-row,
.message-row {
  display: grid;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.mailbox-row {
  position: relative;
  align-items: center;
  gap: 10px;
  grid-template-columns: 8px minmax(0, 1fr) 28px;
  padding: 10px;
}

.mailbox-row:hover,
.message-row:hover {
  background: var(--surface-subtle);
}

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

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a1a1aa;
}

.status-dot.active {
  background: var(--accent);
}

.status-dot.revoked {
  background: var(--danger);
}

.mailbox-copy {
  display: grid;
  min-width: 0;
}

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

.mailbox-copy strong {
  font-size: 13px;
}

.mailbox-copy small {
  color: var(--text-muted);
  font-size: 10px;
}

.row-delete {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 4px;
  color: var(--text-muted);
  opacity: 0;
}

.mailbox-row:hover .row-delete,
.mailbox-row:focus .row-delete {
  opacity: 1;
}

.row-delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.quota-line {
  display: grid;
  align-items: center;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  margin: 8px 0 14px;
  color: var(--text-muted);
  font-size: 9px;
}

.quota-line > div {
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-strong);
}

.quota-line i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.message-row {
  gap: 3px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 11px 12px;
}

.message-row .message-from {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row strong {
  overflow: hidden;
  grid-column: 1;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row small {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  color: var(--text-muted);
  font-size: 9px;
}

.load-more {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.message-inspector {
  overflow: hidden;
}

.message-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.message-header > div {
  min-width: 0;
}

.message-header h2 {
  overflow-wrap: anywhere;
  font-size: 21px;
}

.message-header p:last-child {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.message-header p span {
  overflow-wrap: anywhere;
}

.privacy-note,
.billing-note {
  border-left: 3px solid var(--info);
  background: #edf4fc;
  color: #315b84;
  padding: 9px 12px;
  font-size: 11px;
  line-height: 1.5;
}

.inbox-cost {
  margin: 10px 0 0;
}

.message-body {
  max-height: 470px;
  overflow: auto;
  padding: 22px 4px;
  color: #27272a;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.message-body pre {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
}

.message-body table {
  max-width: 100%;
}

.message-body a {
  color: var(--info);
}

.attachment-list {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.attachment-list h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.attachment-list button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
}

.attachment-list button:hover {
  background: var(--surface-strong);
}

.attachment-list button span {
  display: grid;
}

.attachment-list small {
  color: var(--text-muted);
}

.address-field {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.address-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  box-shadow: none;
}

.address-field > span {
  flex: 0 1 auto;
  overflow: hidden;
  color: var(--text-muted);
  padding-right: 12px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-note {
  margin: 0;
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: #315d45;
}

.credit-overview {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.credit-overview > div {
  display: grid;
}

.credit-overview strong {
  font-size: 42px;
}

.credit-overview p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.transaction-list {
  margin: 0;
  padding: 8px 0 0;
  list-style: none;
}

.transaction-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
}

.transaction-list li > span {
  display: grid;
}

.transaction-list li > span:last-child {
  justify-items: end;
  font-weight: 800;
}

.transaction-list small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}

.transaction-list .positive {
  color: var(--accent);
}

.transaction-list .negative {
  color: var(--danger);
}

.settings-shell {
  width: min(100% - 32px, 960px);
  margin: 38px auto;
}

.settings-heading {
  border-bottom: 1px solid var(--line);
  padding: 0 0 24px;
}

.settings-heading h1 {
  font-size: 30px;
}

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

.settings-section h2 {
  margin: 0 0 5px;
  font-size: 16px;
}

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

.capability-list {
  display: flex;
  align-items: center;
  gap: 8px;
}

.capability-list > span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 11px;
}

.capability-list > span::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #a1a1aa;
  content: "";
}

.capability-list > span.online::before {
  background: var(--accent);
}

.danger-zone h2 {
  color: var(--danger);
}

@media (max-width: 1100px) {
  .mail-workspace {
    grid-template-columns: 240px 310px minmax(340px, 1fr);
  }

  .mailbox-rail,
  .message-index,
  .message-inspector {
    padding: 16px;
  }

  .workspace-summary {
    gap: 12px;
  }

  .metric,
  .metric-command {
    min-width: 94px;
    padding: 4px 10px;
  }
}

@media (max-width: 860px) {
  .account-email {
    display: none;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-intro {
    min-height: 310px;
  }

  .workspace-summary {
    align-items: start;
    grid-template-columns: 1fr auto;
    padding: 18px 0;
  }

  .summary-metrics {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .metric:first-child,
  .metric-command:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .summary-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .mail-workspace {
    grid-template-columns: minmax(210px, 0.8fr) minmax(300px, 1.2fr);
  }

  .message-inspector {
    min-height: 520px;
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

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

@media (max-width: 620px) {
  .app-header {
    min-height: 60px;
    padding: 9px 12px;
  }

  .brand-link small,
  .nav-links > a:not(.icon-command) {
    display: none;
  }

  .workspace-shell {
    padding: 0 10px 20px;
  }

  .workspace-summary {
    min-height: auto;
  }

  .workspace-summary h1 {
    font-size: 20px;
  }

  .summary-metrics {
    width: 100%;
    overflow-x: auto;
  }

  .metric,
  .metric-command {
    min-width: 105px;
    flex: 1 0 auto;
  }

  .primary-command.compact {
    width: 36px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
    white-space: nowrap;
  }

  .primary-command.compact .el-icon {
    flex: 0 0 auto;
    margin: 0;
    font-size: 15px;
  }

  .mail-workspace {
    display: block;
  }

  .mailbox-rail,
  .message-index {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mailbox-list {
    display: flex;
    overflow-x: auto;
  }

  .mailbox-row {
    min-width: 210px;
  }

  .message-inspector {
    min-height: 420px;
  }

  .settings-section {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .capability-list {
    flex-wrap: wrap;
  }

  .segmented-control.compact {
    width: 100%;
  }

  .auth-shell {
    width: 100%;
    min-height: calc(100vh - 60px);
    margin: 0;
    border: 0;
  }

  .auth-intro {
    min-height: 270px;
    padding: 32px 24px;
  }

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

  .auth-intro ul {
    margin-top: 24px;
  }

  .auth-form-wrap {
    padding: 28px 22px 44px;
  }
}
