:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: #f5f7fb;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

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

.topbar {
  height: 58px;
  border-bottom: 1px solid #dce3ef;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-size: 18px;
  font-weight: 760;
}

.top-actions,
.row-actions,
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 28px auto 60px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.25;
}

h2 {
  font-size: 17px;
}

p,
.muted,
.status {
  color: #63708a;
}

.panel {
  background: #ffffff;
  border: 1px solid #dce3ef;
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.narrow {
  max-width: 440px;
  margin: 80px auto;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 640;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfe;
  color: #172033;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

textarea {
  resize: vertical;
}

.grid-3,
.grid-4,
.grid-2,
.settings-grid {
  display: grid;
  gap: 14px;
  margin: 14px 0;
}

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

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

.grid-4 {
  grid-template-columns: 1.4fr 1.4fr 1fr 0.5fr;
}

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

.split {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.4fr);
  gap: 16px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

button,
.link-button {
  border: 0;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.primary {
  background: #172033;
  color: #ffffff;
}

.secondary {
  background: #e9eef7;
  color: #172033;
}

.ghost {
  background: transparent;
  color: #2f6fed;
}

.alias-list,
.message-list,
.mailbox-list {
  display: grid;
  gap: 10px;
}

.alias-item,
.message-item,
.mailbox-item {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.alias-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  gap: 10px;
  align-items: center;
}

.mailbox-actions {
  justify-content: flex-start;
  margin: 6px 0 14px;
}

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

.email-line {
  font-weight: 760;
  word-break: break-all;
}

.small {
  font-size: 12px;
  color: #63708a;
  margin-top: 4px;
}

.code {
  display: inline-flex;
  min-width: 74px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e7f7ee;
  color: #09683d;
  font-weight: 760;
}

.empty-code {
  background: #eef1f5;
  color: #63708a;
}

.totp-code {
  background: #eef4ff;
  color: #184da6;
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.subject {
  font-weight: 760;
}

.snippet {
  color: #3d485d;
  line-height: 1.55;
  word-break: break-word;
}

.error {
  margin-top: 12px;
  color: #b42318;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #172033;
  color: #ffffff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 12px 32px rgba(23, 32, 51, 0.22);
}

.hidden {
  display: none !important;
}

details {
  margin: 6px 0 14px;
}

summary {
  cursor: pointer;
  color: #2f6fed;
  font-weight: 640;
}

@media (max-width: 860px) {
  .title-row,
  .split {
    grid-template-columns: 1fr;
    display: grid;
  }

  .grid-3,
  .grid-4,
  .grid-2,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .alias-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}
