:root {
  --brand: #1677ff;
  --brand-hover: #0958d9;
  --ink: #1f2329;
  --muted: #8c8c8c;
  --line: #eef0f3;
  --field: #f5f6f8;
  --bg: #fff;
  --soft: #f7f8fa;
  --danger: #ff4d4f;
  --ok: #52c41a;
  --shadow: 0 10px 40px rgba(22, 119, 255, 0.08);
  --radius: 6px;
  --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}
button, input, select { font-family: inherit; }
[hidden] { display: none !important; }

/* login */
.login-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px 72px;
  position: relative;
}
.lang-float {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 5;
}
.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo {
  display: block;
  width: 132px;
  height: 132px;
  margin: 0 auto 6px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.12));
}
.login-title {
  margin: 4px 0 28px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1.25;
}
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--field);
  border-radius: 8px;
  height: 50px;
  padding: 0 14px;
  margin-bottom: 16px;
}
.field svg { flex: 0 0 18px; color: #9aa0a6; }
.field input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
}
.field input::placeholder { color: #b0b4ba; }
.eye-btn {
  border: 0;
  background: none;
  color: #9aa0a6;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}
.login-extra {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 2px 0 20px;
  color: var(--brand);
  font-size: 14px;
  user-select: none;
}
.login-extra input { accent-color: var(--brand); width: 16px; height: 16px; }
.login-btn, .btn-primary {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.login-btn:hover, .btn-primary:hover { background: var(--brand-hover); }
.login-btn:disabled { opacity: 0.7; cursor: wait; }
.err {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

/* shell */
.app-shell { min-height: 100%; display: flex; flex-direction: column; background: var(--soft); }
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.top-left { display: flex; align-items: center; gap: 10px; }
.top-left img { width: 36px; height: 36px; object-fit: contain; }
.top-title { font-weight: 700; font-size: 16px; }
.top-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #595959; }
.linkish {
  border: 0;
  background: none;
  color: var(--brand);
  cursor: pointer;
  font-size: 13px;
}
.layout { flex: 1; display: flex; min-height: 0; }
.sider {
  width: 200px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 12px 8px;
}
.nav-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  color: #434343;
  cursor: pointer;
  font-size: 14px;
}
.nav-btn.active { background: #e6f4ff; color: var(--brand); font-weight: 600; }
.nav-btn:hover:not(.active) { background: #f5f5f5; }
.main { flex: 1; padding: 20px; overflow: auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.stat b { display: block; font-size: 26px; color: var(--brand); margin-top: 6px; }
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select, .pager select {
  height: 36px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}
.btn {
  height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
.btn.ghost { background: #f0f0f0; color: #434343; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: #8c8c8c; font-weight: 600; }
.pager { display: flex; justify-content: flex-end; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; }
.empty { padding: 28px 0; text-align: center; color: var(--muted); }
.lang-picker { position: relative; }
.lang-trigger {
  height: 36px;
  min-width: 148px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #434343;
}
.lang-trigger .flag { font-size: 16px; line-height: 1; }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  max-height: 320px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
  padding: 6px;
  z-index: 30;
}
.lang-item {
  width: 100%;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.lang-item:hover, .lang-item.is-on { background: #e6f4ff; color: var(--brand); }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; justify-content: flex-end; z-index: 20;
}
.drawer {
  width: min(520px, 100%);
  background: #fff;
  height: 100%;
  overflow: auto;
  padding: 20px;
  box-shadow: var(--shadow);
}
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 10px; font-size: 13px; }
.kv span { color: #8c8c8c; }
@media (max-width: 800px) {
  .sider { display: none; }
  .login-title { font-size: 22px; }
  .login-logo { width: 112px; height: 112px; }
}
[dir="rtl"] .sider { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .login-extra, [dir="rtl"] .top-left { direction: rtl; }
[dir="rtl"] .lang-float { right: auto; left: 20px; }
