:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #152238;
  background: #f5f7fa;
  --surface: #fff;
  --ink: #152238;
  --muted: #53647a;
  --border: #e1e7ef;
  --accent: #2455b7;
  --accent-light: #eaf1ff;
  --danger: #a3243c;
  --radius: 12px;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.48rem 0.75rem;
}
button:hover:enabled {
  border-color: #a5b7ce;
  background: #f7faff;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 1.35rem;
}
h2 {
  font-size: 1.1rem;
}
p {
  line-height: 1.55;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 650;
}
.primary:hover:enabled {
  background: #19469f;
  color: #fff;
  border-color: #19469f;
}
input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 0.52rem 0.65rem;
  border: 1px solid #cbd6e2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #eaf0fb, #f6f7fb 48%, #eaf2f5);
}
.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: 18px;
  padding: 32px;
  background: #fff;
  border: 1px solid #d9e3f2;
  border-radius: 20px;
  box-shadow: 0 20px 65px #28456718;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  white-space: nowrap;
}
.brand strong {
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.logo {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: #203b65;
  color: #fff;
  font-size: 1.05rem;
}
.error {
  font-size: 0.87rem;
  color: var(--danger);
}
.workspace {
  display: grid;
  grid-template-columns: 220px minmax(285px, 370px) minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
  height: 100dvh;
}
.topbar {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: 185px minmax(180px, 510px) 1fr;
  gap: 20px;
  align-items: center;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.search {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #e3eaf2;
  align-items: center;
  gap: 9px;
  border-radius: 11px;
  padding: 0 10px;
}
.search span {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
}
.search input {
  border: 0;
  background: transparent;
  padding: 0.65rem 0.1rem;
}
.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 12px;
  border-right: 1px solid var(--border);
  overflow: auto;
}
.compose {
  padding: 0.8rem;
  text-align: left;
  padding-left: 16px;
}
.select-label {
  padding: 0 2px;
}
.folders {
  display: grid;
  gap: 3px;
}
.folder {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.63rem 0.75rem;
  font-size: 0.92rem;
}
.folder.active {
  background: var(--accent-light);
  color: #234e9c;
  font-weight: 650;
  border-color: #dce7ff;
}
.folder small {
  color: #345d9e;
  background: #e1ecff;
  border-radius: 7px;
  padding: 2px 7px;
}
.admin-link {
  margin-top: auto;
  text-align: left;
}
.list-pane {
  background: #fff;
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--border);
}
.list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 19px 15px;
}
.list-head span {
  color: var(--muted);
  font-size: 0.78rem;
}
.messages {
  display: grid;
}
.message {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  border-radius: 0;
  padding: 12px 15px;
  background: #fff;
  min-width: 0;
  color: var(--ink);
}
.message:hover,
.message.selected {
  background: #edf4ff;
}
.message.unread .subject {
  font-weight: 700;
}
.message-top {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: start;
}
.message-top > span,
.subject,
.preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-top > span,
.preview {
  font-size: 0.8rem;
  color: var(--muted);
}
.message time {
  font-size: 0.72rem;
  flex: none;
  color: var(--muted);
}
.subject {
  font-size: 0.93rem;
}
.next {
  display: block;
  margin: 12px auto;
}
.empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  min-height: 190px;
  padding: 24px;
}
.reader {
  background: #fff;
  min-width: 0;
  overflow: auto;
}
.reader > .empty {
  min-height: 100%;
  background: #fafbfd;
}
.reading {
  padding: 27px clamp(16px, 4vw, 48px);
  display: grid;
  gap: 16px;
  align-content: start;
}
.reading > h1 {
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  overflow-wrap: anywhere;
}
.details {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.message-content {
  border-top: 1px solid var(--border);
  padding: 14px 0;
  min-height: 120px;
  overflow-wrap: anywhere;
}
.message-content pre {
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.6;
}
.message-content iframe {
  width: 100%;
  min-height: 340px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.attachments,
.thread {
  display: grid;
  gap: 8px;
  font-size: 0.86rem;
}
.file-link {
  display: inline-flex;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 10px;
  background: #f0f5fc;
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.thread button {
  text-align: left;
  overflow-wrap: anywhere;
}
.thread .selected {
  border-color: #84a2d6;
}
.note {
  color: var(--muted);
  font-size: 0.84rem;
}
.badge {
  display: inline-flex;
  width: fit-content;
  padding: 0.24rem 0.45rem;
  background: #eaf2ff;
  color: #23549a;
  border-radius: 6px;
  font-size: 0.76rem;
}
.composer {
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 16px;
  width: min(690px, calc(100% - 30px));
  max-height: 90dvh;
  padding: 0;
  box-shadow: 0 24px 80px #192d4f38;
}
.composer::backdrop {
  background: #17305068;
}
.compose-inner {
  padding: 20px;
  display: grid;
  gap: 12px;
}
.compose-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.compose-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.compose-inner textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.5;
}
.compose-inner details textarea {
  min-height: 100px;
}
.compose-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 10;
  background: #152845;
  color: #fff;
  border-radius: 9px;
  padding: 12px 18px;
  max-width: calc(100vw - 36px);
  box-shadow: 0 8px 28px #182a483c;
}
.admin-pane {
  grid-column: 2/-1;
  overflow: auto;
  background: #f5f7fa;
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 16px;
}
.admin-pane h1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.card,
.admin-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 8px;
}
.card strong {
  font-size: 1.12rem;
}
.card span,
.admin-panel p,
.admin-panel li {
  font-size: 0.84rem;
  color: var(--muted);
}
.admin-panel ul {
  margin: 0;
  padding-left: 20px;
}
.admin-panel form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 9px;
  align-items: end;
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.55rem 0;
}
.inline-check input {
  width: auto;
}
.admin-panel li {
  margin: 0.35rem 0;
  overflow-wrap: anywhere;
}
@media (max-width: 850px) {
  .workspace {
    grid-template-columns: 172px minmax(225px, 310px) 1fr;
  }
  .topbar {
    grid-template-columns: 145px minmax(130px, 1fr) auto;
    gap: 10px;
    padding: 0 12px;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions span {
    display: none;
  }
  .sidebar {
    padding: 13px 8px;
  }
}
@media (max-width: 650px) {
  .workspace {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 8px 12px;
  }
  .search {
    grid-row: 2;
    grid-column: 1/-1;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    padding: 8px;
  }
  .select-label {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .folders {
    grid-column: 1/-1;
    display: flex;
    overflow: auto;
  }
  .folder {
    white-space: nowrap;
    min-width: max-content;
  }
  .admin-link {
    margin: 0;
  }
  .list-pane,
  .reader {
    border: 0;
    max-height: none;
  }
  .reader > .empty {
    display: none;
  }
  .reader {
    border-top: 1px solid var(--border);
  }
  .admin-pane {
    grid-column: 1;
    padding: 12px;
  }
  .compose-row {
    grid-template-columns: 1fr;
  }
}
