:root {
  --brand: #07c160;
  --brand-dark: #06ad56;
  --brand-soft: #e8f8ef;
  --ink: #16181d;
  --ink-2: #4a5160;
  --ink-3: #8b93a3;
  --line: #e6e9f0;
  --bg: #f5f7fa;
  --card: #ffffff;
  --blue: #2b6cf6;
  --amber: #f5a623;
  --red: #e5484d;
  --purple: #7c5cff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; }

/* ---------- layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar .inner { display: flex; align-items: center; gap: 14px; height: 58px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; }
.logo .dot {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand);
  color: #fff; display: grid; place-items: center; font-size: 13px;
}
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-size: 13px;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #cfd6e4; background: #fafbfd; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue:hover { filter: brightness(.94); }
.btn.danger { color: var(--red); border-color: #f6c9ca; }
.btn.danger:hover { background: #fff5f5; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .sub { color: var(--ink-3); font-size: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .g4, .g3, .g2 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .g4, .g3, .g2 { grid-template-columns: 1fr; } }

/* ---------- stat ---------- */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .k { color: var(--ink-3); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 4px; }
.stat .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat.accent .v { color: var(--brand); }
.stat.blue .v { color: var(--blue); }
.stat.purple .v { color: var(--purple); }
.stat.amber .v { color: var(--amber); }

/* ---------- table ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: #f7f9fc; text-align: left; padding: 10px 12px; font-weight: 600;
  color: var(--ink-2); border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px;
}
td { padding: 10px 12px; border-bottom: 1px solid #f0f2f7; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-empty { padding: 34px; text-align: center; color: var(--ink-3); }

/* ---------- form ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 13px; font-family: inherit; background: #fff; color: var(--ink);
  outline: none; transition: .15s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 78px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7,193,96,.12); }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline .field { margin-bottom: 0; flex: 1; min-width: 130px; }

/* ---------- tag ---------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px;
  background: #eef1f6; color: var(--ink-2); font-weight: 500;
}
.tag.green { background: var(--brand-soft); color: #068144; }
.tag.red { background: #fdecec; color: var(--red); }
.tag.amber { background: #fef4e2; color: #b47500; }
.tag.blue { background: #e8f0fe; color: var(--blue); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 9px 14px; cursor: pointer; font-size: 13px; color: var(--ink-2);
  border-bottom: 2px solid transparent; white-space: nowrap; background: none; border-top: none;
  border-left: none; border-right: none;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.pane { display: none; }
.pane.on { display: block; }

/* ---------- misc ---------- */
.alert { padding: 10px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; }
.alert.info { background: #eef4ff; color: #1c4bb3; border: 1px solid #d4e2ff; }
.alert.warn { background: #fff8e8; color: #905c00; border: 1px solid #ffe4a8; }
.alert.err { background: #fdeeee; color: #a3282c; border: 1px solid #f7cfcf; }
.alert.ok { background: var(--brand-soft); color: #068144; border: 1px solid #bde8cf; }

.linkbox {
  display: flex; gap: 8px; align-items: center; background: #f7f9fc;
  border: 1px dashed #c9d2e3; border-radius: 10px; padding: 11px 13px;
}
.linkbox .url { flex: 1; overflow-x: auto; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-row .nm { width: 96px; font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 9px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 6px; transition: width .5s; }
.bar-row .vv { width: 62px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #16181d; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 999;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.hero {
  background: linear-gradient(135deg, #07c160 0%, #0aa96b 45%, #2b6cf6 100%);
  color: #fff; border-radius: 18px; padding: 34px 30px; margin: 20px 0;
}
.hero h1 { margin: 0 0 8px; font-size: 25px; letter-spacing: -.4px; }
.hero p { margin: 0; opacity: .92; font-size: 14px; }
.hero .chips { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hero .chip { background: rgba(255,255,255,.18); padding: 4px 11px; border-radius: 20px; font-size: 12px; }

.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 800px) { .entry-grid { grid-template-columns: 1fr; } }
.entry {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: .18s; display: block; color: inherit;
}
.entry:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfd6e4; }
.entry .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; margin-bottom: 11px; }
.entry h4 { margin: 0 0 5px; font-size: 15px; }
.entry p { margin: 0; font-size: 12.5px; color: var(--ink-3); }

.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin: 6px 0 0; }
.flow .node { flex: 1; min-width: 120px; background: #fff; border: 1px solid var(--line); padding: 12px; position: relative; }
.flow .node:first-child { border-radius: 12px 0 0 12px; }
.flow .node:last-child { border-radius: 0 12px 12px 0; }
.flow .node + .node { border-left: none; }
.flow .n-t { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.flow .n-d { font-size: 11.5px; color: var(--ink-3); }
