:root {
  --bg: #f3f5f9; --panel: #fff; --line: #eceef2; --text: #1f2329; --muted: #7d8288;
  --brand: #ff7a0a; --brand-2: #ff9a3c; --brand-deep: #fd6e03; --brand-soft: #feede1; --brand-tint: #fdf6f2;
  --ok: #1faa4f; --warn: #e08a00; --err: #e5484d; --info: #2f6fe0;
  --radius: 12px; --shadow: 0 2px 10px rgba(31, 35, 41, .04);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- 顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: 76px; background: #fff; display: flex; align-items: center; padding: 0 32px 0 36px; box-shadow: 0 1px 0 var(--line); }
.topbar .logo { height: 46px; display: block; }
.topbar .sep { width: 1px; height: 30px; background: #e3e5e9; margin: 0 34px 0 38px; }
.topbar .sys { font-size: 25px; font-weight: 700; letter-spacing: 1px; color: #1f2329; }
.topbar .pill { margin-left: 18px; background: linear-gradient(90deg, var(--brand-deep), var(--brand)); color: #fff; font-size: 16px; font-weight: 600; padding: 3px 13px; border-radius: 16px; }
.topbar .grow { flex: 1; }
.topbar .icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #33363b; cursor: pointer; margin-left: 22px; background: none; border: none; }
.topbar .icon-btn svg.ic { width: 28px; height: 28px; }
.topbar .icon-btn:hover { background: #f5f6f8; }
.topbar .dot { position: absolute; top: 6px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: #f43f3f; border: 2px solid #fff; }
.topbar .user { display: flex; align-items: center; gap: 14px; margin-left: 40px; padding-left: 26px; border-left: 1px solid #eef0f3; cursor: pointer; position: relative; }
.topbar .avatar { width: 46px; height: 46px; border-radius: 50%; background: #d2e4fc; color: #4a86e8; display: flex; align-items: center; justify-content: center; }
.topbar .avatar svg.ic { width: 26px; height: 26px; }
.topbar .uname { font-size: 18px; font-weight: 600; }
.user-menu { position: absolute; right: 0; top: 56px; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; min-width: 180px; display: none; }
.user-menu.open { display: block; }
.user-menu .who { padding: 8px 12px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--text); }
.user-menu a:hover { background: var(--brand-tint); color: var(--brand); }

/* ---------- 侧栏 ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: calc(100vh - 76px); }
.side { background: #fff; padding: 30px 10px 24px; position: sticky; top: 76px; height: calc(100vh - 76px); overflow-y: auto; box-shadow: 1px 0 0 var(--line); }
.nav-item, .nav-group > .nav-head { display: flex; align-items: center; gap: 14px; padding: 0 16px 0 22px; height: 52px; margin-bottom: 7px; border-radius: 12px; color: #1f2329; font-size: 18px; cursor: pointer; user-select: none; }
.nav-item:hover, .nav-head:hover { background: #fafafb; }
.nav-item svg.ic, .nav-head > svg.ic:first-child { width: 26px; height: 26px; stroke-width: 1.6; }
.nav-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.on svg.ic { stroke-width: 2.2; }
.nav-head .chev { margin-left: auto; width: 16px; height: 16px; color: #33363b; transition: transform .15s; }
.nav-group.open .nav-head .chev { transform: rotate(180deg); }
.nav-group.has-on > .nav-head { color: var(--brand); }
.nav-sub { display: none; padding: 0 0 6px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub a, .nav-sub span { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 16px 0 56px; border-radius: 10px; color: #4a4f57; font-size: 15px; }
.nav-sub a:hover { background: var(--brand-tint); color: var(--brand); }
.nav-sub a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-sub span { color: #b3b7bd; cursor: default; }
.nav-sub span em { font-style: normal; font-size: 11px; border: 1px solid #e3e5e9; border-radius: 4px; padding: 0 5px; }
.main { min-width: 0; }
.content { padding: 26px 26px 40px 28px; }
.topbar .menu-btn { display: none; }

h1 { font-size: 22px; margin: 0 0 18px; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* ---------- 通用控件 ---------- */
.btn { border: 1px solid #e3e5e9; background: #fff; border-radius: 8px; padding: 7px 16px; cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn.primary { background: linear-gradient(90deg, var(--brand-deep), var(--brand-2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.05); color: #fff; }
.btn.danger { color: var(--err); }
.btn.link { border: none; background: none; color: var(--brand); padding: 2px 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=password], input[type=number], input:not([type]), select, textarea {
  border: 1px solid #e3e5e9; border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
textarea { min-height: 64px; resize: vertical; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }

.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f6f7f9; font-weight: 500; color: #4a4f57; position: sticky; top: 0; }
tr:hover td { background: #fffaf6; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #f1f2f4; color: var(--muted); }
.tag.ok { background: #e5f6eb; color: var(--ok); }
.tag.warn { background: #feebcb; color: var(--warn); }
.tag.err { background: #fed9d8; color: var(--err); }
.tag.info { background: #e6eefc; color: var(--info); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field label { display: block; color: var(--muted); margin-bottom: 4px; font-size: 13px; }
.field label b { color: var(--err); font-weight: 400; }
.field.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 6px; }

.mask { position: fixed; inset: 0; background: rgba(20, 22, 26, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 680px; }
.modal header { padding: 16px 22px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; }
.modal .bd { padding: 18px 22px; }
.modal footer { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, #fff7f0 0%, #ffe6d1 100%); }
.login .card { background: #fff; border-radius: 16px; padding: 36px 34px; width: 380px; box-shadow: 0 12px 40px rgba(253, 110, 3, .12); }
.login .card img { height: 42px; display: block; margin-bottom: 14px; }
.login h2 { margin: 0 0 4px; font-size: 20px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.login .field { margin-bottom: 14px; }
.login .btn { width: 100%; padding: 10px; font-size: 15px; }
.err-text { color: var(--err); min-height: 20px; margin-bottom: 8px; }

/* ---------- 首页 ---------- */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.dash-head h1 { font-size: 32px; margin: 4px 0 8px; letter-spacing: 1px; }
.dash-head .sub { font-size: 18px; color: #4a4f57; }
.datebox { display: flex; align-items: center; background: #fff; border-radius: 12px; box-shadow: var(--shadow); height: 54px; padding: 0 18px 0 20px; font-size: 18px; color: #33363b; gap: 14px; }
.datebox svg.ic { width: 24px; height: 24px; }
.datebox .vsep { width: 1px; height: 22px; background: #e3e5e9; }
.datebox select { border: none; background: transparent; font-size: 18px; padding: 0 22px 0 0; width: auto; cursor: pointer; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2333363b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right center; background-size: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 16px 18px; display: grid; grid-template-columns: 72px 1fr; column-gap: 16px; min-height: 154px; }
.kpi .ico { width: 72px; height: 72px; border-radius: 10px; background: linear-gradient(145deg, #fff1e6, #ffe2cc); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.kpi .ico svg.ic { width: 40px; height: 40px; stroke-width: 1.6; }
.kpi .lbl { font-size: 18px; font-weight: 600; margin-top: 8px; }
.kpi .val { font-size: 34px; font-weight: 700; margin-top: 4px; letter-spacing: .5px; }
.kpi .val small { font-size: 20px; font-weight: 600; margin-left: 4px; }
.kpi .cmp { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin: 12px 0 0 88px; font-size: 16px; color: #4a4f57; }
.kpi .cmp b { font-size: 22px; font-weight: 600; color: var(--ok); display: flex; align-items: center; gap: 4px; }
.kpi .cmp b.down { color: var(--ok); }
.kpi .cmp b.none { color: #b3b7bd; font-size: 16px; font-weight: 500; }
.kpi .cmp b svg.ic { width: 22px; height: 22px; stroke-width: 2.2; }
.dash-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 22px 22px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title h3 { margin: 0; font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 12px; letter-spacing: 1px; }
.card-title h3::before { content: ''; width: 4px; height: 22px; background: var(--brand); border-radius: 2px; }
.card-title .more { color: #4a4f57; font-size: 16px; display: flex; align-items: center; gap: 4px; }
.quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.quick a { background: var(--brand-tint); border-radius: 10px; height: 122px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #1f2329; font-size: 18px; transition: background .15s, transform .15s; }
.quick a:hover { background: #ffeadb; transform: translateY(-2px); }
.quick a svg.ic { width: 44px; height: 44px; color: var(--brand); stroke-width: 1.6; }
.progress-box { display: flex; align-items: center; gap: 38px; padding: 4px 6px 0 18px; }
.legend { flex: 1; display: grid; gap: 14px; }
.legend div { display: flex; align-items: center; font-size: 18px; color: #1f2329; }
.legend i { width: 11px; height: 11px; border-radius: 50%; margin-right: 16px; flex: none; }
.legend b { margin-left: auto; font-size: 18px; font-weight: 600; }
.seg { display: inline-flex; background: #f6f7f9; border-radius: 8px; padding: 3px; border: 1px solid #eceef2; }
.seg button { border: none; background: none; padding: 6px 22px; border-radius: 6px; font-size: 16px; color: #4a4f57; cursor: pointer; }
.seg button.on { background: linear-gradient(90deg, var(--brand-deep), var(--brand-2)); color: #fff; }
.chart-wrap { position: relative; }
.chart-note { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); background: rgba(255,255,255,.92); padding: 8px 16px; border-radius: 8px; color: var(--muted); font-size: 14px; box-shadow: var(--shadow); }
.alert-tbl th { background: #f6f7f9; font-size: 16px; padding: 12px 14px; color: #33363b; }
.alert-tbl td { font-size: 16px; padding: 11px 14px; border-bottom: none; }
.alert-tbl th:first-child, .alert-tbl td:first-child { padding-left: 24px; }
.alert-tbl td.num, .alert-tbl th.num { text-align: right; }
.alert-tbl .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 12px; vertical-align: 1px; }
.alert-tbl .st { display: inline-block; padding: 2px 12px; border-radius: 6px; font-size: 15px; }
.alert-tbl .st.low { background: #feebcb; color: #e07b00; }
.alert-tbl .st.out { background: #fed9d8; color: #e5484d; }

/* 首页之外 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .n { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .l { color: var(--muted); }
.wizard-steps { display: flex; gap: 8px; margin-bottom: 16px; }
.wizard-steps div { flex: 1; padding: 10px 14px; border-radius: 10px; background: #fff; color: var(--muted); box-shadow: var(--shadow); }
.wizard-steps div.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.map-grid { display: grid; grid-template-columns: 180px 1fr; gap: 8px 12px; align-items: center; max-width: 560px; }
.drop { border: 2px dashed #e3e5e9; border-radius: 12px; padding: 36px; text-align: center; color: var(--muted); cursor: pointer; }
.drop:hover { border-color: var(--brand-2); }
.hint { color: var(--muted); font-size: 13px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; }

#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100; }
#toast div { background: #1f2329; color: #fff; padding: 9px 18px; border-radius: 8px; margin-bottom: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
#toast div.err { background: var(--err); }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { height: 60px; padding: 0 12px; }
  .topbar .logo { height: 30px; }
  .topbar .sep, .topbar .sys, .topbar .pill, .topbar .uname, .topbar .icon-btn.help { display: none; }
  .topbar .user { margin-left: 8px; padding-left: 8px; border: none; }
  .topbar .avatar { width: 36px; height: 36px; }
  .topbar .menu-btn { display: inline-flex; margin-left: 0; }
  .shell { grid-template-columns: 1fr; min-height: calc(100vh - 60px); }
  .side { position: fixed; top: 60px; left: -250px; width: 236px; z-index: 40; transition: left .2s; height: calc(100vh - 60px); box-shadow: 4px 0 16px rgba(0,0,0,.08); }
  .side.open { left: 0; }
  .content { padding: 14px; }
  .dash-head { flex-direction: column; }
  .dash-head h1 { font-size: 24px; }
  .kpis { grid-template-columns: 1fr; }
  .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .progress-box { flex-direction: column; padding: 0; gap: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .map-grid { grid-template-columns: 1fr; }
}
