:root {
  --bg: #f4f6f8;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --brand: #16a34a;
  --brand-dark: #15803d;
  --brand-soft: #dcfce7;
  --danger: #dc2626;
  --warn: #d97706;
  --info: #0284c7;
  --shadow: 0 8px 24px rgba(15, 23, 42, .05);
  --radius: 14px;
  --sidebar: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
.app { min-height: 100vh; display: flex; }
.sidebar { width: var(--sidebar); background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 18px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; color: #334155; margin-bottom: 4px; }
.nav a.active, .nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.main { flex: 1; min-width: 0; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.topbar > div:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page { padding: 0 24px 32px; }
.card { background: var(--card); border: 1px solid #eef0f3; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.btn { border: 0; border-radius: 10px; padding: 8px 14px; cursor: pointer; background: #e2e8f0; color: #0f172a; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-ghost { background: #fff; border: 1px solid var(--line); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.input, .select { height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; min-width: 160px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid #f1f5f9; text-align: left; font-size: 13px; }
.table th { color: var(--muted); font-weight: 600; background: #fafbfc; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-fail { background: #fee2e2; color: #991b1b; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.muted { color: var(--muted); }
.userbox { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #ecfdf3; color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 13px; color: #334155; }
.textarea { min-height: 88px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.toast { position: fixed; top: 18px; right: 18px; background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px; display: none; z-index: 50; }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.35); display: none; align-items: center; justify-content: center; z-index: 40; }
.modal .box { width: 460px; background: #fff; border-radius: 16px; padding: 20px; }
.pager { margin-top: 16px; }
.pager ul { display: flex; gap: 6px; list-style: none; padding: 0; }
.pager li a, .pager li span { display: inline-block; padding: 6px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.chips { display: flex; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(180deg, #ecfdf3, #f8fafc); }
.login-card { width: 420px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.help p { line-height: 1.8; color: #334155; }
.var-row { display: grid; grid-template-columns: 1.2fr 1.4fr .6fr 1fr 40px; gap: 8px; margin-bottom: 8px; }
.preview-frame { width: 100%; min-height: 720px; border: 0; background: #f3f5f8; border-radius: 12px; }
.menu-btn { display: none; background: #fff; border: 1px solid var(--line); }
.sync-bar { margin:-4px 0 16px; padding:10px 14px; border-radius:10px; background:#fff7ed; color:#9a3412; font-size:13px; }
.sync-bar.ok { background:#ecfdf3; color:#166534; }
.chart-wrap { flex:1; min-width:220px; }
.bars { display:flex; align-items:flex-end; gap:3px; height:120px; padding-top:8px; }
.bars i { flex:1; background:#16a34a; min-height:2px; border-radius:3px 3px 0 0; display:block; }
.bar-labels { display:flex; gap:3px; margin-top:6px; color:#94a3b8; font-size:10px; }
.bar-labels span { flex:1; text-align:center; }
.tpl-tabs { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.tpl-tab { min-width:180px; background:#fff; border:1px solid var(--line); border-radius:12px; padding:12px 14px; }
.tpl-tab b { display:block; margin-bottom:4px; }
.tpl-tab span { color:var(--muted); font-size:12px; }
.tpl-tab.active { border-color:var(--brand); background:var(--brand-soft); }
@media (max-width: 1100px) {
  .grid-5, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 20; box-shadow: var(--shadow); }
  .sidebar.open { display: block; }
  .menu-btn { display: inline-flex; }
}
