:root {
    --bg: #f5f6f8; --panel: #fff; --text: #1f2329; --muted: #8f959e; --line: #e5e6eb;
    --primary: #3370ff; --primary-dark: #245bdb; --ok-bg: #e8f7ee; --ok: #1f8a4c;
    --err-bg: #fdecec; --err: #d83931; --info-bg: #eef3ff; --info: #245bdb;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 12px; }
input, select, button { font: inherit; }
input, select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0; }
button { padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.link { border: 0; background: none; color: var(--primary); padding: 0; }
.muted { color: var(--muted); }

.topbar { display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 600; margin-right: auto; }
.topbar form { margin: 0; }
.shell { display: flex; min-height: calc(100vh - 52px); }
.sidebar { width: 180px; flex: none; padding: 12px 0; background: var(--panel); border-right: 1px solid var(--line); }
.sidebar a { display: block; padding: 10px 20px; color: var(--text); }
.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a.active { color: var(--primary); background: #eef3ff; font-weight: 600; }
.content { flex: 1; min-width: 0; padding: 24px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.form { display: grid; gap: 14px; max-width: 520px; }
.form label { display: grid; gap: 4px; }
.form label.check { display: flex; align-items: center; gap: 8px; }
.form small, .hint { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.info { background: var(--info-bg); color: var(--info); }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table th { background: #fafbfc; color: var(--muted); font-weight: 500; }
.table td.num, .table th.num { text-align: right; }
.table .empty { text-align: center; color: var(--muted); padding: 32px; }
.pager { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.pager .disabled { color: var(--muted); }

.timeline { list-style: none; display: flex; gap: 0; padding: 0; margin: 0 0 20px; }
.timeline li { flex: 1; padding: 12px; border-top: 3px solid var(--line); color: var(--muted); }
.timeline li.done { border-top-color: var(--primary); color: var(--text); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.fields { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; word-break: break-all; }
.fields pre { margin: 0; white-space: pre-wrap; }

.funnel { display: grid; gap: 12px; max-width: 760px; }
.funnel-row { display: grid; grid-template-columns: 80px 1fr 70px 70px; align-items: center; gap: 12px; }
.funnel-label { color: var(--muted); }
.funnel-bar { height: 22px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--primary); }
.funnel-num { text-align: right; font-weight: 600; }
.funnel-rate { color: var(--muted); }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; }

@media (max-width: 720px) {
    .shell { flex-direction: column; }
    .sidebar { width: auto; display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar a { white-space: nowrap; }
    .content { padding: 16px; overflow-x: auto; }
    .fields { grid-template-columns: 1fr; }
    .timeline { flex-direction: column; }
}
