:root {
  --bg: #f3efe6;
  --paper: #fffcf7;
  --ink: #1c2430;
  --muted: #5c6674;
  --line: #ddd4c6;
  --teal: #0f6e6b;
  --teal-2: #14918c;
  --danger: #b42318;
  --ok: #067647;
  --warn: #b54708;
  --badge: #e23d2b;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 500px at 10% -10%, #e7f3f1 0%, transparent 50%), var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1680px; margin: 0 auto; padding: 24px 28px 48px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--teal); color: #fff; display: grid; place-items: center;
  font-size: 16px;
}
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; cursor: pointer;
  text-decoration: none; font-family: inherit;
}
.nav a.active, .btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { background: #fff1f0; border-color: #f5c2c0; color: var(--danger); }
.btn.ghost { background: transparent; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 20px;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1.2fr .8fr; }
.grid.stats { grid-template-columns: repeat(3, 1fr); }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  font: inherit; background: #fff;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
.row .grow { flex: 2; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 1100px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.badge {
  display: inline-flex; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--teal); color: #fff;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.badge.zero { background: #d9d3c8; color: #4a5563; }
.badge.unread { background: var(--badge); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eaf6f4; color: var(--teal); }
.pill.off { background: #f3efe6; color: var(--muted); }
.pill.ok { background: #eaf8f0; color: var(--ok); }
.pill.bad { background: #fff1f0; color: var(--danger); }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.flash.ok { background: #eaf8f0; color: var(--ok); }
.flash.err { background: #fff1f0; color: var(--danger); }
.otp {
  font-size: 28px; letter-spacing: .18em; font-weight: 800; color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.login-box { max-width: 420px; margin: 8vh auto; }
.hint { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: nowrap !important; white-space: nowrap; align-items: center; }
td.actions {
  white-space: nowrap !important;
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 6px;
}
td.actions form { display: inline-flex; margin: 0; flex-shrink: 0; }
td.actions .btn, td.actions button.btn {
  padding: 4px 7px; font-size: 12px; flex-shrink: 0; white-space: nowrap;
}
.btn-source {
  margin-top: 8px;
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
}
.btn-source:hover { filter: brightness(1.08); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(28, 36, 48, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 80; padding: 24px;
}
.modal-mask[hidden] { display: none !important; }
.modal-box {
  background: var(--paper); border-radius: 16px; max-width: 760px; width: 100%;
  max-height: 80vh; overflow: auto; padding: 20px 44px 20px 20px; position: relative;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 10px; right: 12px; border: none; background: #eee;
  width: 32px; height: 32px; border-radius: 8px; font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-close:hover { background: #ddd; }
.mail { white-space: pre-wrap; line-height: 1.6; background: #f7f3eb; padding: 12px; border-radius: 10px; }
.code { font-family: Consolas, monospace; font-size: 12px; background: #1c2430; color: #e8e4da; padding: 12px; border-radius: 10px; overflow: auto; }
@media (max-width: 860px) {
  .grid.two, .grid.stats { grid-template-columns: 1fr; }
}
