:root {
  --bg: #f5f7fa;
  --surface: #fff;
  --surface-2: #f8fafc;
  --text: #17202a;
  --muted: #6b7280;
  --line: #e7eaf0;
  --primary: #ec5b37;
  --primary-dark: #d84b29;
  --teal: #0e766e;
  --shadow: 0 18px 50px rgba(31, 41, 55, 0.09);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: var(--text);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 0, #fff4ec 0, transparent 24rem), var(--bg);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
  margin: 0.25rem 0;
}
.fine-print {
  font-size: 0.78rem;
  color: #8b93a1;
  text-align: center;
  margin: 1.5rem 0 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(145deg, #f3744e, #e84f2b);
  color: #fff;
  font-size: 0.82rem;
  box-shadow: 0 8px 20px rgba(236, 91, 55, 0.27);
}
.brand-login {
  justify-content: center;
  margin-bottom: 2.2rem;
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-card {
  width: min(420px, 100%);
  padding: 2.8rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.login-card h1 {
  text-align: center;
  font-size: 1.9rem;
  margin: 0;
}
.login-card > p.muted {
  text-align: center;
  margin: 0.5rem 0 2rem;
}
.stack,
.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.stack-lg {
  gap: 1.2rem;
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.86rem;
  font-weight: 650;
  color: #3d4652;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #dfe3e9;
  border-radius: 11px;
  background: #fff;
  padding: 0.76rem 0.9rem;
  outline: none;
  color: var(--text);
  transition: 0.18s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #f38b6f;
  box-shadow: 0 0 0 3px rgba(236, 91, 55, 0.12);
}
textarea {
  resize: vertical;
}
.captcha-row {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 0.65rem;
}
.captcha-box {
  height: 52px;
  border: 1px solid #dfe3e9;
  border-radius: 11px;
  padding: 0;
  overflow: hidden;
  background: white;
}
.captcha-box img {
  display: block;
  width: 100%;
  height: 100%;
}
.button {
  border: 0;
  border-radius: 11px;
  padding: 0.72rem 1.05rem;
  font-weight: 700;
  color: #354052;
  background: #edf0f4;
}
.button.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 7px 18px rgba(236, 91, 55, 0.2);
}
.button.primary:hover {
  background: var(--primary-dark);
}
.button.ghost {
  background: #fff;
  border: 1px solid var(--line);
}
.button.full {
  width: 100%;
  padding: 0.85rem;
}
.app-shell {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.55rem 1.2rem;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.83);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
}
.sidebar .brand {
  padding: 0.2rem 0.5rem 1.5rem;
}
.compose {
  width: 100%;
  margin-bottom: 1.25rem;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: transparent;
  color: #56606d;
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  text-align: left;
}
.nav button:hover {
  background: #f5f6f8;
}
.nav button.active {
  background: #fff1ed;
  color: #bf3d1f;
  font-weight: 800;
}
.nav button b {
  font-size: 0.72rem;
  background: #ef5b37;
  color: #fff;
  padding: 0.08rem 0.42rem;
  border-radius: 1rem;
}
.admin-nav {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.admin-nav small {
  color: #9aa1ac;
  text-transform: uppercase;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.25rem 0.85rem;
  letter-spacing: 0.1em;
}
.account-card {
  margin-top: auto;
  display: grid;
  grid-template-columns: 38px 1fr auto auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.8rem 0.55rem;
  border-top: 1px solid var(--line);
}
.account-card strong,
.account-card small {
  display: block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-card strong {
  font-size: 0.83rem;
}
.account-card small {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7f5f3;
  color: var(--teal);
  font-weight: 900;
}
.icon-button {
  border: 0;
  background: transparent;
  color: #77818e;
  font-size: 1.3rem;
  padding: 0.25rem;
}
.workspace {
  min-width: 0;
}
.topbar {
  min-height: 100px;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.78);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h2 {
  margin: 0;
  font-size: 1.45rem;
}
.top-actions {
  display: flex;
  gap: 0.65rem;
}
.search {
  min-width: 280px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 0.75rem;
}
.search input {
  border: 0;
  box-shadow: none;
  padding: 0.68rem 0.25rem;
}
.content {
  padding: 1.5rem 2rem 3rem;
}
.mail-layout {
  display: grid;
  grid-template-columns: minmax(360px, 43%) minmax(420px, 1fr);
  min-height: calc(100vh - 150px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(31, 41, 55, 0.04);
}
.message-list {
  border-right: 1px solid var(--line);
  overflow: auto;
}
.message-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.15rem;
  text-align: left;
  background: #fff;
  color: inherit;
}
.message-row:hover,
.message-row.selected {
  background: #fff8f5;
}
.message-row.unread .sender,
.message-row.unread .subject {
  font-weight: 850;
}
.message-row .sender {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-row time {
  font-size: 0.72rem;
  color: var(--muted);
}
.message-row .subject {
  grid-column: 1/-1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
}
.message-row .preview {
  grid-column: 1/-1;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.77rem;
}
.empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 3rem;
}
.empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
}
.message-detail {
  min-width: 0;
  background: #fff;
}
.detail-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: #a1a8b1;
}
.detail-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.detail-header h3 {
  font-size: 1.32rem;
  margin: 0.4rem 0 1rem;
}
.detail-address {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.35rem;
  font-size: 0.82rem;
  margin: 0.28rem 0;
}
.detail-address span {
  color: var(--muted);
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.detail-body {
  padding: 1rem 1.5rem;
}
.mail-frame {
  width: 100%;
  height: 470px;
  border: 0;
  background: #fff;
}
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0 1.5rem 1.5rem;
}
.attachment {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  text-decoration: none;
  color: #384250;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 5px 20px rgba(31, 41, 55, 0.035);
}
.card h3 {
  margin: 0.15rem 0 0.4rem;
}
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
}
.status.on {
  background: #e8f7ef;
  color: #16764a;
}
.status.off {
  background: #f1f3f5;
  color: #737b86;
}
.metric {
  font-size: 2.1rem;
  font-weight: 850;
  letter-spacing: -0.04em;
  margin: 0.5rem 0;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7b8490;
  background: #fafbfc;
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.pill {
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  background: #f2f4f7;
  font-size: 0.7rem;
}
.switch-row {
  flex-direction: row;
  align-items: center;
}
.switch-row input {
  width: auto;
}
.inline-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.modal {
  border: 0;
  border-radius: 20px;
  padding: 0;
  width: min(650px, calc(100vw - 2rem));
  box-shadow: 0 28px 80px rgba(20, 30, 45, 0.24);
}
.modal::backdrop {
  background: rgba(30, 38, 49, 0.45);
  backdrop-filter: blur(4px);
}
.modal header,
.modal footer {
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.modal header h3 {
  margin: 0;
}
.modal footer {
  border: 0;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  gap: 0.6rem;
}
.modal-body {
  padding: 1.3rem 1.4rem;
  max-height: 68vh;
  overflow: auto;
}
.compose-modal {
  width: min(760px, calc(100vw - 2rem));
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.8rem;
}
details summary {
  cursor: pointer;
  color: #69727e;
  font-size: 0.82rem;
}
.file-label {
  border: 1px dashed #cfd5dc;
  border-radius: 11px;
  padding: 0.8rem;
}
.file-label input {
  border: 0;
  padding: 0.25rem 0;
}
.toast {
  position: fixed;
  z-index: 100;
  right: 1.5rem;
  top: 1.5rem;
  max-width: 360px;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #1f2937;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: 0.2s;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.error {
  background: #b42318;
}
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 78px 1fr;
  }
  .sidebar {
    padding: 1rem 0.65rem;
  }
  .sidebar .brand span:last-child,
  .compose:not(:focus),
  .nav button span,
  .admin-nav small,
  .account-card > div:nth-child(2),
  #logout-button {
    font-size: 0;
  }
  .sidebar .brand {
    justify-content: center;
    padding: 0.2rem 0 1.2rem;
  }
  .compose {
    font-size: 0;
  }
  .compose::after {
    content: "＋";
    font-size: 1.2rem;
  }
  .nav button {
    justify-content: center;
  }
  .nav button::before {
    font-size: 1.05rem;
  }
  .nav button[data-view="inbox"]::before {
    content: "✉";
  }
  .nav button[data-view="starred"]::before {
    content: "★";
  }
  .nav button[data-view="sent"]::before {
    content: "➤";
  }
  .nav button[data-view="trash"]::before {
    content: "⌫";
  }
  .nav button[data-view="domains"]::before {
    content: "◇";
  }
  .nav button[data-view="aliases"]::before {
    content: "♙";
  }
  .nav button[data-view="usage"]::before {
    content: "▥";
  }
  .nav button[data-view="audit"]::before {
    content: "≣";
  }
  .account-card > div:nth-child(2) {
    display: none;
  }
  .account-card {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .mail-layout {
    grid-template-columns: 1fr;
  }
  .message-detail {
    position: fixed;
    inset: 0 0 0 78px;
    z-index: 20;
    overflow: auto;
  }
  .detail-hidden {
    display: none;
  }
  .search {
    min-width: 180px;
  }
  .topbar,
  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
@media (max-width: 600px) {
  .topbar {
    align-items: center;
    gap: 0.65rem;
    flex-direction: row;
  }
  .search {
    min-width: 0;
    flex: 1;
  }
  .content {
    padding: 0.75rem;
  }
  .captcha-row {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 2rem 1.3rem;
  }
  .message-detail {
    left: 78px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
}
