:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #e5e6eb;
  --text: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --gold: #c79a3a;
  --gold-deep: #a47b1e;
  --primary: #2f6bdd;
  --primary-deep: #2057c0;
  --danger: #e23d3d;
  --ok: #15a15a;
  --shadow: 0 2px 10px rgba(0,0,0,0.05);
  --radius: 12px;
  --sidebar-w: 210px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.55; font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg,#2b2620,#3a3128); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 32px 28px; width: 100%; max-width: 360px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card h1 { font-size: 19px; text-align: center; color: var(--gold-deep); margin-bottom: 4px; }
.login-card p { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.login-card label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 6px; }
.login-card input { width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; font-size: 15px; outline: none; }
.login-card input:focus { border-color: var(--gold); }
.btn-primary { width: 100%; height: 44px; border: none; border-radius: 10px; background: linear-gradient(135deg,#f0c75e,#c79a3a); color: #2b2620; font-weight: 700; font-size: 15px; margin-top: 20px; }
.btn-primary:active { transform: scale(.99); }
.login-err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }

/* 布局 */
.admin { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #23211c; color: #cdbf9e; position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 18px 18px 14px; font-weight: 800; color: #f0c75e; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar nav a { display: block; padding: 11px 18px; color: #cdbf9e; font-size: 14px; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); }
.sidebar nav a.active { background: rgba(240,199,94,.12); border-left-color: #f0c75e; color: #f0c75e; }
.sidebar .foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar .foot button { width: 100%; background: transparent; border: 1px solid rgba(255,255,255,.2); color: #cdbf9e; padding: 8px; border-radius: 8px; font-size: 13px; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.main .topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 10; }
.main .topbar h2 { font-size: 17px; font-weight: 700; }
.main .topbar .user { font-size: 13px; color: var(--text-2); }
.content { padding: 22px; max-width: 1100px; }

.view { display: none; }
.view.active { display: block; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 8px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 800; color: var(--gold-deep); }
.stat .l { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-top: 16px; }
.panel h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.panel h3 .acts { display: flex; gap: 8px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--bg); }
table.tbl th { color: var(--text-3); font-weight: 600; background: var(--bg); position: sticky; top: 0; }
table.tbl tr:hover td { background: #fafbff; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--bg); color: var(--text-2); }
.tag.on { background: #e6f6ee; color: var(--ok); }
.tag.off { background: #fdeaea; color: var(--danger); }
.tag.gold { background: var(--gold-soft, #fbf3df); color: var(--gold-deep); }

.btn { border: 1px solid var(--border); background: #fff; color: var(--text-2); padding: 7px 13px; border-radius: 8px; font-size: 13px; }
.btn:hover { border-color: var(--gold); color: var(--gold-deep); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.gold { background: linear-gradient(135deg,#f0c75e,#c79a3a); border-color: transparent; color: #2b2620; font-weight: 600; }
.btn.gold:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); border-color: #f3c6c6; }
.btn.danger:hover { background: #fdeaea; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-deep); }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 14px; }
.field.full { grid-column: 1/-1; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 14px;
  background: #fff; color: var(--text); outline: none; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field textarea { resize: vertical; min-height: 76px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 30px 16px; overflow-y: auto; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal .m-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal .m-head .x { cursor: pointer; color: var(--text-3); font-size: 22px; line-height: 1; }
.modal .m-body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal .m-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #23211c; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 200; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

.log-line { font-size: 12.5px; padding: 6px 10px; border-bottom: 1px solid var(--bg); }
.log-line .t { color: var(--text-3); }
.log-line .s-ok { color: var(--ok); }
.log-line .s-error { color: var(--danger); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-3); font-size: 13px; }
.empty { text-align: center; color: var(--text-3); padding: 30px; }

/* ---------- 采集策略面板 ---------- */
.sch-val { color: var(--gold-deep); font-weight: 700; }
.rng { width: 100%; margin-top: 4px; accent-color: var(--gold); }
.field input[type="range"] { height: 22px; }

.risk-pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.risk-low { background: #e6f6ee; color: var(--ok); }
.risk-medium { background: #fff4e0; color: #c8821e; }
.risk-high { background: #fdeaea; color: var(--danger); }

.load-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.load-stat { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.load-stat .n { font-size: 20px; font-weight: 800; color: var(--gold-deep); }
.load-stat .l { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.gauge { height: 12px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 999px; transition: width 0.3s ease, background 0.3s ease; }
.gauge-fill.risk-low { background: var(--ok); }
.gauge-fill.risk-medium { background: #f0a13a; }
.gauge-fill.risk-high { background: var(--danger); }

.sub-h { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 16px 0 8px; }

.timeline { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.tl-cell { height: 26px; border-radius: 4px; background: #eef1f5; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.tl-cell span { font-size: 9px; color: var(--text-3); line-height: 1; }
.tl-cell.quiet { background: #d9c79a; }
.tl-cell.now { box-shadow: 0 0 0 2px var(--gold); }
.tl-cell.now span { color: var(--gold-deep); font-weight: 700; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 20px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--border); padding: 6px 0; font-size: 13px; }
.kv-row span { color: var(--text-3); }
.kv-row b { color: var(--text); font-weight: 600; }

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; z-index: 80; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-block !important; }
}
.menu-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--text-2); }
