:root {
  --bg: #eef3f8;
  --card: #ffffff;
  --ink: #16233b;
  --muted: #6b7a90;
  --line: #dce5ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #0f9b6c;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 12px 32px rgba(22, 35, 59, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 0%, #dceafe 0, transparent 38%), var(--bg);
}
.shell { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #4f8df7); color: #fff; font-size: 22px; font-weight: 700;
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.badge { padding: 7px 12px; border-radius: 999px; background: #e8f0fe; color: var(--primary-dark); font-size: 12px; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 16px; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button-link { display: inline-block; text-decoration: none; line-height: 1.2; }
.filters { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.filters label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.filters input, .filters select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--ink); background: #fbfdff; outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr; } }
.muted { color: var(--muted); font-size: 13px; }

.menu { display: flex; gap: 8px; padding: 8px; margin-bottom: 18px; }
.menu-item {
  border: 0; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600;
  padding: 10px 20px; border-radius: 10px; cursor: pointer;
}
.menu-item:hover { background: #f3f7ff; color: var(--primary); }
.menu-item.active { background: var(--primary); color: #fff; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 12px 0 14px; }
.kv div { display: flex; gap: 10px; font-size: 14px; }
.kv dt { color: var(--muted); min-width: 52px; }
.kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.sys-card { margin-bottom: 18px; }
@media (max-width: 760px) { .kv { grid-template-columns: 1fr; } }

.auth-card { max-width: 460px; margin: 40px auto; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tab {
  flex: 1; padding: 11px; border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); font-size: 15px; font-weight: 600; cursor: pointer;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.form { display: grid; gap: 15px; }
.form.compact { gap: 12px; }
.form label { display: grid; gap: 7px; font-size: 13px; color: #41516b; font-weight: 600; }
.form input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; color: var(--ink); background: #fbfdff; outline: none;
}
.form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; color: var(--ink); background: #fbfdff; outline: none;
}
.form select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 68px; }
.toggle-pw {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px;
}
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline select {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: #fbfdff; color: var(--ink); font-size: 13px; outline: none;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button.primary, button.secondary {
  border-radius: 9px; padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
button.primary { border: 0; background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.secondary { border: 1px solid var(--line); background: #fff; color: var(--primary); white-space: nowrap; }
button.secondary:hover { background: #f3f7ff; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.link { border: 0; background: transparent; color: var(--primary); font-size: 13px; cursor: pointer; }
.message { min-height: 20px; margin-top: 14px; font-size: 13px; color: var(--danger); }
.message.success { color: var(--ok); }
.hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.recovery-note { margin: 0; padding: 11px 12px; border-radius: 9px; background: #fff7e6; color: #8a5a00; font-size: 13px; line-height: 1.6; }
.notes { margin: 0; padding-left: 18px; color: #4d5d76; font-size: 13px; line-height: 1.9; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; }

.userbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.userbar strong { display: block; font-size: 16px; }
.bind-panel { margin-bottom: 18px; border-color: #bfdbfe; }
.bind-panel h2 { margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; background: #e8f0fe; color: var(--primary); font-size: 12px; font-weight: 600; }
.pill.ok { background: #e5f7f0; color: var(--ok); }
.pill.warn { background: #fff3e2; color: var(--warn); }
.pill.danger { background: #feecec; color: var(--danger); }
.list { display: grid; gap: 10px; max-height: 280px; overflow-y: auto; }
.item { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; line-height: 1.6; }
.item.unread { border-left: 3px solid var(--primary); background: #f7faff; }
.item time { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.empty { color: var(--muted); font-size: 13px; padding: 12px 0; }
.reply-box { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.reply-box label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.toast {
  position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 18px;
  background: #16233b; color: #fff; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; line-height: 1.6;
}
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .badge { max-width: 130px; text-align: center; }
}
