:root {
  --bg: #f4f6fb;
  --side: #0f172a;
  --side-2: #111c33;
  --accent: #4f46e5;
  --accent-d: #4338ca;
  --accent-tint: rgba(79, 70, 229, 0.12);
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e6e8ef;
  --line-2: #eef0f6;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 10px 30px rgba(16, 24, 40, 0.10);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--side); color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px;
  color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff; box-shadow: 0 4px 10px rgba(79, 70, 229, 0.5);
}
.brand .name { font-size: 15.5px; font-weight: 700; letter-spacing: .3px; }
.brand .sub { font-size: 11px; color: #7c8aa5; margin-top: 1px; }
.nav { padding: 12px 12px; overflow-y: auto; flex: 1; }
.nav .group { font-size: 11px; color: #5b6b86; padding: 12px 10px 6px; letter-spacing: .12em; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 3px 0;
  border-radius: 9px; color: #cbd5e1; font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.active { background: var(--accent-tint); color: #fff; }
.nav a.active .chip { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }
.chip {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 5;
}
.crumb .t { font-size: 15px; font-weight: 600; }
.crumb .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.account { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.account .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.account a { color: var(--accent); margin-left: 8px; }
.content { padding: 26px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; }
.page-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 16px;
  border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer;
  color: var(--text); font-size: 13.5px; font-weight: 500; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #cdd2de; background: #fafbff; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-d); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { background: #fff; color: #e11d48; border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }

.search { display: flex; gap: 8px; }
.search input {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; width: 220px; font-size: 13.5px;
  transition: .15s; background: #fff;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-bar select, .filter-bar input[type=text] {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; font-size: 13.5px; background: #fff;
}
.filter-bar select:focus, .filter-bar input[type=text]:focus { outline: none; border-color: var(--accent); }

/* ---------- stat cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
  transition: .18s; text-decoration: none; color: inherit;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: #d9dcec; }
.card .ic {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 12px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800;
}
.card-num { font-size: 28px; font-weight: 700; line-height: 1.1; color: #111827; }
.card-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- panel / table ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line-2); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.panel-head .more { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.panel-body { padding: 16px 18px; }
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 13px 18px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--line-2); }
.grid th { background: #fafbfe; font-weight: 600; color: #475067; font-size: 12.5px; letter-spacing: .02em; }
.grid tbody tr { transition: .12s; }
.grid tbody tr:hover { background: #f7f9ff; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid .empty { text-align: center; color: var(--muted); padding: 38px; }
.grid .ops a { color: var(--accent); margin-right: 14px; font-size: 13px; }
.grid .ops a.del { color: #e11d48; }
.grid .right { text-align: right; }

/* ---------- badge ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.8; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.off { background: #f1f5f9; color: #475569; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.muted { background: #f1f5f9; color: #64748b; }

/* ---------- form ---------- */
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 26px; max-width: 760px; }
.form-card.wide { max-width: 1080px; }
.form-row { display: flex; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.form-row:last-child { border-bottom: none; }
.form-row > label { width: 150px; flex: 0 0 150px; padding-top: 9px; color: #475067; font-size: 13.5px; font-weight: 500; }
.form-row .req { color: #e11d48; margin-left: 3px; font-style: normal; }
.form-control { flex: 1; min-width: 0; }
.form-control input[type=text], .form-control input[type=number], .form-control input[type=date], .form-control input[type=password],
.form-control select, .form-control textarea {
  width: 100%; max-width: 460px; height: 40px; border: 1px solid #d1d5db; border-radius: 9px;
  padding: 0 12px; font-size: 14px; font-family: inherit; background: #fff; transition: .15s;
}
.form-control textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.form-control input:focus, .form-control select:focus, .form-control textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.form-control select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-control .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.form-actions { padding: 18px 0; display: flex; gap: 12px; }

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; transition: .2s; flex: 0 0 44px; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }

/* ---------- pager ---------- */
.pager { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.pager a, .pager .disabled, .pager .info { padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.pager a { color: var(--accent); }
.pager a:hover { background: var(--accent-tint); }
.pager .disabled { color: var(--muted); background: #fafbfe; }
.pager .info { border: none; color: var(--muted); }

/* ---------- login (split) ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #eaeef6; padding: 20px; }
.login-wrap { width: 880px; max-width: 100%; height: 540px; display: flex; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-2); }
.login-aside { width: 340px; flex: 0 0 340px; background: var(--side); color: #fff; padding: 44px 36px; display: flex; flex-direction: column; }
.login-aside .logo { width: 46px; height: 46px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; box-shadow: 0 6px 16px rgba(79,70,229,.5); }
.login-aside .bname { font-size: 22px; font-weight: 700; margin-top: 18px; }
.login-aside .btag { font-size: 13px; color: #93a1bd; margin-top: 6px; line-height: 1.7; }
.login-aside .feats { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.login-aside .feats div { display: flex; align-items: center; gap: 10px; color: #cbd5e1; font-size: 13px; }
.login-aside .feats .dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; flex: 0 0 7px; }
.login-main { flex: 1; padding: 50px 56px; display: flex; flex-direction: column; justify-content: center; }
.login-main h1 { font-size: 24px; }
.login-main .desc { color: var(--muted); margin: 8px 0 28px; }
.login-error { background: #fef2f2; color: #b91c1c; padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; border: 1px solid #fecaca; }
.login-main input[type=text], .login-main input[type=password] {
  width: 100%; height: 46px; border: 1px solid #d1d5db; border-radius: 10px; padding: 0 14px; margin-bottom: 16px;
  font-size: 14.5px; transition: .15s;
}
.login-main input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.login-main button {
  width: 100%; height: 46px; border: none; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: .15s;
}
.login-main button:hover { background: var(--accent-d); }
.login-tip { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }

/* ---------- misc ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .big { font-size: 15px; color: #475067; margin-bottom: 6px; }
.mt16 { margin-top: 16px; }
.mb16 { margin-bottom: 16px; }
@media (max-width: 720px) {
  .sidebar { display: none; }
  .login-aside { display: none; }
  .login-wrap { height: auto; }
}
