* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, Roboto, sans-serif; background: #f7f8fb; color: #222; }
a { color: inherit; }

.admin { display: flex; min-height: 100vh; }
.side { width: 236px; background: #fff; flex-shrink: 0; border-right: 1px solid #f4e5eb; display: flex; flex-direction: column; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px; font-size: 15px; font-weight: 700; color: #ff2e63; border-bottom: 1px solid #f7eef1; text-decoration: none; }
.logo-img { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg,#fff0f5,#ffe0ea); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.nav-groups { display: flex; flex-direction: column; gap: 10px; padding: 12px 10px; flex: 1; }
.nav-home { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 10px; background: #fff5f8; color: #333; text-decoration: none; font-size: 14px; font-weight: 600; }
.nav-home:hover { color: #ff2e63; }
.nav-home.active { background: #ff2e63; color: #fff; box-shadow: 0 3px 10px rgba(255,46,99,.28); }
.nav-home .ic { font-size: 16px; }
.nav-group { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); border: 1px solid #f7f1f3; overflow: hidden; }
.nav-group.is-active { box-shadow: 0 0 0 2px rgba(255,46,99,.14); }
.nav-group__head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; font-size: 13px; font-weight: 700; color: #555; }
.nav-group.is-active .nav-group__title { color: #ff2e63; }
.nav-group__body { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 10px 12px; }
.nav-group__body a { padding: 6px 12px; border-radius: 999px; color: #777; text-decoration: none; font-size: 13px; }
.nav-group__body a:hover { background: #fff0f5; color: #ff2e63; }
.nav-group__body a.active { background: #ff2e63; color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(255,46,99,.25); }
.side-foot { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px 18px; border-top: 1px solid #f7eef1; font-size: 12px; color: #999; }
.side-foot a { text-decoration: none; }
.side-foot a:hover { color: #ff2e63; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid #f4e5eb; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.topbar .path { font-weight: 600; color: #333; }
.topbar .user { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #666; }
.topbar .logout { color: #ff2e63; text-decoration: none; }
.content { padding: 22px; overflow: auto; }

.page { max-width: 1280px; }
.pg-title { font-size: 20px; margin: 0 0 6px; color: #222; }
.pg-sub { margin: 0 0 16px; color: #999; font-size: 13px; line-height: 1.6; }
.muted { color: #aaa; }
.green-text { color: #059669; font-weight: 600; }
code { background: #f6f6f8; color: #d6336c; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.inp { border: 1px solid #e5e6eb; border-radius: 8px; padding: 8px 12px; font-size: 13px; background: #fff; color: #333; min-width: 150px; }
.inp:focus { outline: none; border-color: #ff8fab; box-shadow: 0 0 0 3px rgba(255,46,99,.08); }
textarea.inp { min-height: 90px; resize: vertical; width: 100%; }
.btn { border: 0; background: #ff2e63; color: #fff; padding: 9px 20px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #e51e56; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn-ghost { background: #fff; color: #ff2e63; border: 1px solid #ffc2d2; }
.btn-ghost:hover { background: #fff5f8; }
.btn-primary { background: linear-gradient(135deg,#ff5c86,#ff2e63); }
.btn-primary:hover { background: linear-gradient(135deg,#ff4d7a,#e51e56); }
.btn-sm { border: 1px solid #e5e6eb; background: #fff; color: #555; padding: 5px 11px; border-radius: 6px; cursor: pointer; font-size: 12px; margin-right: 6px; }
.btn-sm:hover { border-color: #ff8fab; color: #ff2e63; }
.btn-sm.ok { color: #047857; border-color: #a7f3d0; }
.btn-sm.danger { color: #b91c1c; border-color: #fecaca; }
.btn-sm:disabled { opacity: .4; cursor: not-allowed; }

.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.035); font-size: 13px; }
.grid th { background: #faf7f8; color: #888; font-weight: 600; text-align: left; padding: 12px 14px; white-space: nowrap; border-bottom: 1px solid #f4e5eb; }
.grid td { padding: 11px 14px; border-bottom: 1px solid #f6f2f4; color: #444; vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr:hover td { background: #fffafd; }
.ops { white-space: nowrap; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; }
.badge-wait { color: #b26a00 !important; background: #fff4e0 !important; }
.badge-ok { color: #1d9e75 !important; background: #e1f5ee !important; }
.badge-no { color: #999 !important; background: #f0f0f0 !important; }
.badge-risk { color: #b91c1c !important; background: #fee2e2 !important; }
.cell-clip { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 16px; font-size: 13px; color: #666; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 14px; padding: 16px 20px; box-shadow: 0 2px 8px rgba(0,0,0,.04); border-left: 4px solid #ff2e63; }
.stat-card .sc-val { font-size: 27px; font-weight: 700; color: #ff2e63; }
.stat-card .sc-label { font-size: 13px; color: #999; margin-top: 6px; }
.stat-card.green { border-left-color: #10b981; } .stat-card.green .sc-val { color: #059669; }
.stat-card.blue { border-left-color: #3b82f6; } .stat-card.blue .sc-val { color: #2563eb; }
.stat-card.orange { border-left-color: #f59e0b; } .stat-card.orange .sc-val { color: #d97706; }
.stat-card.purple { border-left-color: #8b5cf6; } .stat-card.purple .sc-val { color: #7c3aed; }
.panel { background: #fff; border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.panel-h { font-size: 15px; font-weight: 700; color: #333; margin-bottom: 16px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.bar-col .bar { width: 58%; max-width: 40px; background: linear-gradient(180deg,#ff7ba1,#ff2e63); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar-col .bar.b2 { background: linear-gradient(180deg,#7dd3fc,#3b82f6); }
.bar-col .bl { font-size: 11px; color: #999; }
.bar-legend { display: flex; gap: 18px; font-size: 12px; color: #888; margin-top: 12px; justify-content: center; }
.bar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 13px; }
.cat-row .cat-name { width: 48px; color: #666; }
.cat-row .cat-track { flex: 1; height: 10px; border-radius: 6px; background: #f5f5f7; overflow: hidden; }
.cat-row .cat-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg,#ff7ba1,#ff2e63); }
.cat-row .cat-amt { width: 100px; text-align: right; color: #ff2e63; font-weight: 600; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.42); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 440px; max-width: 92vw; max-height: 90vh; overflow: auto; box-shadow: 0 18px 50px rgba(0,0,0,.2); }
.modal.wide { width: 680px; }
.modal-h { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: #ff2e63; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.form-row label { width: 92px; text-align: right; color: #666; font-size: 13px; flex-shrink: 0; }
.form-row .inp { flex: 1; min-width: 0; }
.err { font-size: 12px; color: #b91c1c; margin: 8px 0 0; }
.detail-label { font-size: 12px; color: #999; font-weight: 600; margin: 16px 0 6px; }
.detail-box { background: #fafbfc; border: 1px solid #eee; border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; }
.finding { border-left: 3px solid #f59e0b; background: #fffbeb; padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.finding.high { border-left-color: #dc2626; background: #fef2f2; }
.finding.good { border-left-color: #059669; background: #ecfdf5; }
.finding b { color: #333; }
.finding p { margin: 4px 0 0; color: #777; }

.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 12px; }
.cfg-card { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 2px 8px rgba(0,0,0,.03); border: 1px solid #f7f1f3; }
.cfg-title { font-weight: 700; color: #222; font-size: 14px; line-height: 1.5; }
.cfg-key { font-weight: 500; color: #ff2e63; font-size: 12px; margin-top: 2px; font-family: Consolas, Monaco, monospace; }
.cfg-remark { font-size: 12px; color: #aaa; margin: 4px 0 12px; }
.cfg-line { display: flex; gap: 8px; }
.cfg-line .inp { flex: 1; min-width: 0; }
.cfg-note { font-size: 12px; color: #c25b7a; background: #fff5f8; border-radius: 8px; padding: 10px 14px; line-height: 1.6; margin-bottom: 14px; }
.ok-box { background: #ecfdf5; color: #047857; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.llm-panel { background: #fff; border: 1px solid #f7e1e9; border-left: 4px solid #ff2e63; }
.llm-tip { font-size: 12px; color: #999; line-height: 1.6; margin: 0 0 14px; }
.llm-key-line { display: flex; gap: 8px; flex: 1; }
.llm-key-line .inp { flex: 1; min-width: 0; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#ff5c86,#ff2e63,#f0145a); }
.login-card { width: 390px; max-width: 92vw; background: #fff; border-radius: 20px; padding: 38px 34px; box-shadow: 0 20px 60px rgba(0,0,0,.2); text-align: center; }
.login-logo { width: 62px; height: 62px; margin: 0 auto 10px; border-radius: 18px; background: linear-gradient(135deg,#fff0f5,#ffe0ea); display: flex; align-items: center; justify-content: center; font-size: 32px; }
.login-card h1 { font-size: 21px; margin: 0 0 6px; color: #222; }
.login-sub { color: #999; font-size: 13px; margin: 0 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card .inp { width: 100%; min-width: 0; }
.btn-login { border: 0; background: #ff2e63; color: #fff; padding: 12px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 6px; }
.btn-login:hover { background: #e51e56; }
.login-err { background: #fef2f2; color: #b91c1c; padding: 10px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.login-tip { color: #bbb; font-size: 11px; margin-top: 18px; }

@media (max-width: 760px) {
  .side { width: 190px; }
  .content { padding: 14px; }
}
