:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #17202a;
  background: #f5f7f8;
  font-synthesis: none;
  letter-spacing: 0;
  --green: #0b7a53;
  --green-dark: #075c3e;
  --line: #dce2e5;
  --muted: #67737d;
  --danger: #b42318;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #f5f7f8; font-size: 14px; }
button, input { font: inherit; letter-spacing: 0; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: #16212a; color: #eef3f5; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px 20px; text-decoration: none; }
.brand > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.brand strong { font-size: 15px; }
.brand small { color: #aebbc2; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; background: #e9f8f0; color: #075c3e; font-weight: 800; }
.sidebar nav { display: grid; gap: 4px; }
.nav-link { min-height: 40px; padding: 10px 12px; border-radius: 6px; color: #bdc8cd; text-decoration: none; }
.nav-link:hover { background: #22313b; color: #fff; }
.nav-link.active { background: #e9f8f0; color: #075c3e; font-weight: 700; }
.sidebar-footer { margin-top: auto; }

.content { width: min(1180px, 100%); padding: 30px 36px 56px; }
.page-header { min-height: 64px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-header.compact { align-items: center; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 24px; line-height: 1.25; }
h2 { margin-bottom: 16px; font-size: 16px; line-height: 1.3; }
.page-header p, .muted { margin-bottom: 0; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--green); text-decoration: none; }

.button { min-height: 38px; border: 1px solid transparent; border-radius: 6px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; font-weight: 650; white-space: nowrap; }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: #aab5ba; background: #fff; color: #26343c; }
.button.quiet { border-color: transparent; background: transparent; color: #cad3d7; }
.content .button.quiet { color: #43515a; }
.button.danger { border-color: #f0b4ae; background: #fff; color: var(--danger); }
.button.full { width: 100%; }
.danger-text { color: var(--danger) !important; }

.notice { margin-bottom: 18px; padding: 10px 12px; border-left: 3px solid var(--green); background: #e9f8f0; color: #075c3e; }
.notice.error { border-color: var(--danger); background: #fff0ef; color: #8d1c14; }

.filter-bar { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
label { display: grid; gap: 6px; color: #44515a; font-weight: 600; }
label span { font-size: 12px; }
label.grow { flex: 1; }
input { width: 100%; min-height: 38px; border: 1px solid #b8c2c7; border-radius: 5px; padding: 8px 10px; background: #fff; color: #17202a; outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px #d7f0e4; }

.mail-list { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.mail-row { min-height: 62px; display: grid; grid-template-columns: 40px minmax(170px, .8fr) minmax(260px, 2fr) 110px; align-items: center; border-top: 1px solid #edf0f2; padding: 0 14px; text-decoration: none; }
.mail-row:first-child { border-top: 0; }
.mail-row:not(.mail-head):hover { background: #f1f8f5; }
.mail-head { min-height: 38px; color: var(--muted); background: #f8fafb; font-size: 12px; }
.mail-row.unread { background: #fbfefd; }
.mail-row.unread .mail-main strong { font-weight: 800; }
.status-dot { width: 8px; height: 8px; border: 1px solid #8b989f; border-radius: 50%; display: block; }
.unread .status-dot { border-color: var(--green); background: var(--green); }
.recipient { color: #314047; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-main { min-width: 0; display: grid; gap: 4px; padding-right: 20px; }
.mail-main strong, .mail-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-main small { color: var(--muted); }
.mail-row time { color: var(--muted); text-align: right; font-size: 12px; }

.empty-state { min-height: 180px; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted); }
.empty-state strong { color: #35434b; }
.split-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
.tool-panel { padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.stack-form { display: grid; gap: 16px; }
.input-suffix { display: flex; }
.input-suffix input { border-radius: 5px 0 0 5px; }
.input-suffix span { min-height: 38px; border: 1px solid #b8c2c7; border-left: 0; border-radius: 0 5px 5px 0; padding: 10px; background: #f2f4f5; color: var(--muted); white-space: nowrap; }
.section-heading { min-height: 42px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); }
.section-heading span { color: var(--muted); }
.data-list { background: #fff; }
.data-row { min-height: 64px; border-bottom: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.data-row > div { min-width: 0; display: grid; gap: 4px; }
.data-row strong, .data-row span { overflow-wrap: anywhere; }
.data-row span { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; min-height: 26px; border: 1px solid #cbd4d8; border-radius: 4px; padding: 3px 7px; color: #56636b !important; background: #f5f7f8; }
.check-label { grid-template-columns: 18px 1fr; align-items: center; }
.check-label input { width: 16px; min-height: 16px; accent-color: var(--green); }

.message-meta { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; padding: 14px 16px; }
.message-meta dl { margin: 0; display: grid; gap: 8px; }
.message-meta dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.message-meta dt { color: var(--muted); }
.message-meta dd { margin: 0; overflow-wrap: anywhere; }
.code-strip { margin: 16px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code-strip > span { color: var(--muted); margin-right: 4px; }
.code-button { min-width: 88px; height: 38px; border: 1px solid #9fcbb7; border-radius: 5px; background: #e9f8f0; color: #075c3e; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 800; cursor: pointer; }
.message-body { min-height: 360px; background: #fff; border: 1px solid var(--line); }
.message-body pre { padding: 22px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; line-height: 1.6; }
.message-frame { width: 100%; min-height: 520px; border: 0; background: #fff; }
.attachments { margin-top: 20px; }
.attachments > div { min-height: 48px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.attachments span { color: var(--muted); }

.secret-reveal { margin-bottom: 22px; padding: 14px; border: 1px solid #a9d5c0; background: #e9f8f0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.secret-reveal code { overflow-wrap: anywhere; font-size: 12px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; background: #eef2f3; padding: 24px; }
.auth-shell { width: min(420px, 100%); }
.auth-shell.wide { width: min(480px, 100%); }
.auth-brand { margin-bottom: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 17px; }
.auth-panel { border: 1px solid #d5dde0; border-radius: 6px; background: #fff; padding: 28px; box-shadow: 0 10px 30px rgba(23, 32, 42, .08); }
.auth-panel h1 { font-size: 20px; }
.qr-wrap { margin: 18px auto; width: 240px; height: 240px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; }

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 10px 14px; flex-direction: row; align-items: center; gap: 12px; overflow-x: auto; }
  .brand { min-width: 150px; padding: 0; }
  .brand small, .sidebar-footer { display: none; }
  .sidebar nav { display: flex; }
  .nav-link { white-space: nowrap; }
  .content { padding: 22px 16px 42px; }
  .page-header { min-height: 52px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .mail-head { display: none; }
  .mail-row { grid-template-columns: 22px minmax(0, 1fr) 74px; padding: 10px 12px; }
  .mail-row .recipient { grid-column: 2; font-size: 12px; }
  .mail-main { grid-column: 2 / -1; padding-right: 0; }
  .mail-row time { grid-column: 3; grid-row: 1; }
  .split-layout { grid-template-columns: 1fr; }
  .message-meta dl > div { grid-template-columns: 1fr; gap: 3px; }
  .secret-reveal { grid-template-columns: 1fr; }
}
