* { box-sizing: border-box; }
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #16233a;
  --muted: #6b7893;
  --line: #e5eaf3;
  --brand: #2f6bff;
  --brand-dark: #2357d8;
  --green: #12a06a;
  --orange: #e8901a;
  --red: #e05a5a;
}
html, body { margin: 0; padding: 0; min-height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
button, input, select { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }
.btn { border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--brand); border-color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #fff; color: var(--ink); outline: none; }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,107,255,.1); }

/* 登录 */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #dbe7ff 0, transparent 40%), radial-gradient(circle at 85% 80%, #e2f5ef 0, transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 460px; background: var(--panel); border-radius: 18px; padding: 32px; box-shadow: 0 20px 60px rgba(22,35,58,.1); }
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.auth-brand h1 { font-size: 19px; margin: 0 0 6px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.brand-mark { width: 46px; height: 46px; border-radius: 13px; background: linear-gradient(135deg, #2f6bff, #56a6ff); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex: none; }
.brand-mark.small { width: 36px; height: 36px; border-radius: 10px; font-size: 17px; }
.oauth-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.btn-oauth { background: #fff; border-color: var(--line); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; width: 100%; }
.btn-oauth:hover { border-color: var(--brand); background: #f8faff; }
.oauth-icon { display: inline-flex; width: 20px; height: 20px; border-radius: 5px; background: var(--brand); color: #fff; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.oauth-icon.green { background: #07c160; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: #9aa6bc; font-size: 11px; margin-bottom: 14px; }
.auth-divider:before, .auth-divider:after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.auth-tab { background: none; border: none; padding: 10px 4px; margin-right: 22px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.auth-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.auth-form label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.auth-form label input { display: block; width: 100%; margin-top: 6px; color: var(--ink); font-size: 14px; }
.inline-row { display: flex; gap: 8px; margin-bottom: 14px; }
.inline-row input { flex: 1; min-width: 0; }
.auth-actions { margin-top: 6px; }
.auth-actions .btn { width: 100%; }
.auth-hint, .auth-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 12px; }
.auth-note { background: #f5f8ff; border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; padding: 10px 0 0; font-size: 12px; }
.auth-error { margin-top: 14px; background: #fff1f1; color: #c33; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.auth-footer { display: flex; flex-direction: column; gap: 4px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); color: #97a2b8; font-size: 11px; }

/* 后台骨架 */
.admin-screen { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: none; background: #12203a; color: #dbe4f7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand strong { display: block; font-size: 15px; color: #fff; }
.side-brand span { font-size: 11px; color: #8ea3c8; }
.side-nav { padding: 14px 10px; flex: 1; }
.nav-group-title { font-size: 10px; color: #6f82a6; letter-spacing: 1px; padding: 12px 14px 4px; text-transform: uppercase; }
.nav-item { display: block; width: 100%; text-align: left; border: none; background: transparent; color: #a9b9d6; padding: 11px 14px; border-radius: 9px; cursor: pointer; margin-bottom: 2px; font-size: 13px; }
.nav-item span { display: inline-block; width: 22px; font-size: 16px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.side-bottom { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.account-box { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #2f6bff; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.account-info { min-width: 0; }
.account-info strong { display: block; font-size: 13px; color: #fff; }
.account-info span { display: block; font-size: 11px; color: #8ea3c8; overflow: hidden; text-overflow: ellipsis; }
.side-bottom .btn { width: 100%; padding: 7px; background: rgba(255,255,255,.06); color: #c4d1e8; border-color: rgba(255,255,255,.1); }
.main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.topbar h2 { margin: 0 0 4px; font-size: 21px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-text { color: var(--muted); font-size: 12px; margin-right: 8px; }

/* 数据驾驶舱 */
.section-head { font-size: 13px; font-weight: 600; color: var(--ink); margin: 22px 0 12px; padding-left: 10px; border-left: 3px solid var(--brand); }
.kpi-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-card { position: relative; overflow: hidden; border-radius: 14px; padding: 18px 20px; color: #fff; min-height: 112px; }
.kpi-card:after { content: ''; position: absolute; right: -18px; top: -18px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.12); }
.kpi-card .kpi-label { font-size: 12px; opacity: .85; }
.kpi-card .kpi-value { font-size: 30px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -.5px; }
.kpi-card .kpi-sub { font-size: 11px; opacity: .8; }
.kpi-blue { background: linear-gradient(135deg,#2f6bff,#5b9bff); }
.kpi-green { background: linear-gradient(135deg,#0e9f6e,#38c795); }
.kpi-orange { background: linear-gradient(135deg,#e8841a,#f6b35c); }
.kpi-purple { background: linear-gradient(135deg,#7048d8,#9d7bf0); }
.todo-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.todo-chip { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; }
.todo-chip:hover { border-color: var(--brand); }
.todo-chip b { font-size: 16px; color: var(--brand); }
.todo-chip.hot b { color: var(--red); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card .card-title { display: flex; justify-content: space-between; align-items: center; }
.chart-box { min-height: 200px; }
.quick-grid.vert { display: grid; grid-template-columns: 1fr; gap: 8px; }
.quick-grid.vert .quick-card { padding: 10px 12px; }
.muted-text { color: var(--muted); font-weight: 400; font-size: 12px; }
.settings-list { display: grid; gap: 12px; margin-bottom: 18px; max-width: 640px; }
.setting-row { display: flex; align-items: center; gap: 14px; }
.setting-row label { flex: none; width: 180px; color: var(--muted); font-size: 12px; }
.setting-row label small { display: block; color: #a3aec2; font-size: 10px; }
.setting-row input, .setting-row select { flex: 1; }

/* 小程序配置中心（选项卡式） */
.cfg-intro { display: flex; gap: 14px; align-items: flex-start; background: linear-gradient(120deg, #eef3ff 0%, #f7faff 100%); border: 1px solid #dbe5ff; border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.cfg-intro-icon { width: 40px; height: 40px; flex: none; border-radius: 11px; background: linear-gradient(135deg, #2f6bff, #6a9bff); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.cfg-intro h3 { margin: 0 0 5px; font-size: 15px; }
.cfg-intro p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.cfg-shell { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cfg-tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #fafbfe; overflow-x: auto; }
.cfg-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: 14px 15px 12px; cursor: pointer; font-size: 13px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.cfg-tab span { font-size: 16px; line-height: 1; }
.cfg-tab:hover { color: var(--brand); }
.cfg-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.cfg-panel { display: none; padding: 22px 24px 24px; }
.cfg-panel.active { display: block; }
.cfg-panel-head { margin-bottom: 18px; }
.cfg-panel-head h4 { margin: 0 0 6px; font-size: 15px; }
.cfg-panel-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cfg-field { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.cfg-field:hover { border-color: #bcd0ff; box-shadow: 0 4px 14px rgba(47,107,255,.06); }
.cfg-field.is-secret { background: #fbfcff; }
.cfg-field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.cfg-field-head label { font-size: 13px; font-weight: 600; color: var(--ink); }
.cfg-lock { font-size: 10px; color: var(--orange); background: #fff4e5; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.cfg-field-body input, .cfg-field-body select, .cfg-field-body textarea { width: 100%; }
.cfg-field-body textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; font-family: Menlo, Consolas, monospace; resize: vertical; min-height: 120px; outline: none; }
.cfg-field-body textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,107,255,.1); }
.cfg-field-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; color: #9aa6bc; font-size: 11px; }
.cfg-field-limit { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.cfg-field-limit input { width: 70px; padding: 4px 6px; text-align: center; font-size: 12px; }
.secret-cell { display: flex; align-items: center; gap: 6px; }
.secret-cell input, .secret-cell textarea { flex: 1; min-width: 0; }
.secret-toggle { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 7px; padding: 6px 9px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.secret-toggle:hover { color: var(--brand); border-color: var(--brand); }
.cfg-panel-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.cfg-panel .footnote { margin-top: 14px; }
.connection-result { margin-top: 16px; background: #f6f9ff; border: 1px solid #dbe6ff; border-radius: 10px; padding: 12px 16px; }
@media (max-width: 980px) { .cfg-grid { grid-template-columns: 1fr; } }
.connection-result .result-title { font-weight: 600; margin-bottom: 8px; }
.connection-result ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.connection-result li { font-size: 12px; color: var(--ink); }
.connection-result li.ok:before { content: '✓'; color: var(--green); font-weight: 700; margin-right: 8px; }
.connection-result li.warn:before { content: '!'; color: var(--orange); font-weight: 700; margin-right: 8px; }
.connection-result li.fail:before { content: '×'; color: var(--red); font-weight: 700; margin-right: 8px; }
.stars { color: #f5a623; letter-spacing: 2px; }

/* 折线图 */
.line-chart { width: 100%; height: 210px; }
.line-chart .grid-line { stroke: #e9edf5; stroke-width: 1; }
.line-chart .axis-label { fill: #94a0b6; font-size: 10px; }
.line-chart .line-orders { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.line-chart .line-gmv { fill: none; stroke: var(--green); stroke-width: 2.5; }
.line-chart .area-orders { fill: url(#areaGrad); }
.line-chart .dot-orders { fill: var(--brand); }
.line-chart .dot-gmv { fill: var(--green); }
.chart-legend { display: flex; gap: 18px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* 环形图 */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-svg { width: 150px; height: 150px; flex: none; }
.donut-center { text-align: center; }
.donut-center .num { font-size: 22px; font-weight: 700; }
.donut-center .lbl { font-size: 10px; color: var(--muted); }
.donut-legend { flex: 1; min-width: 130px; }
.donut-legend div { display: flex; justify-content: space-between; font-size: 11px; padding: 4px 0; color: var(--muted); }
.donut-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 12px; }
.bar-row .bar-label { width: 72px; flex: none; color: var(--muted); text-align: right; }
.bar-row .bar-track { flex: 1; height: 12px; background: #eef2f8; border-radius: 6px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 6px; }
.bar-row .bar-value { width: 36px; flex: none; text-align: right; font-weight: 600; }

/* 概览旧卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat-card .label { color: var(--muted); font-size: 12px; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 8px; }
.stat-card.accent .value { color: var(--brand); }
.panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.card-title { font-weight: 600; margin-bottom: 14px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-card { text-align: left; border: 1px solid var(--line); background: #fafbfe; border-radius: 10px; padding: 14px; cursor: pointer; }
.quick-card:hover { border-color: var(--brand); background: #f4f8ff; }
.quick-card strong { display: block; margin-bottom: 4px; }
.quick-card span { color: var(--muted); font-size: 12px; }

/* 表格与工具条 */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-group, .toolbar-right { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-btn { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 18px; padding: 6px 12px; cursor: pointer; }
.filter-btn.active { background: #eef3ff; border-color: #bcd0ff; color: var(--brand); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 500; background: #fafbfe; }
tbody tr:hover { background: #fafcff; }
td .sub { color: var(--muted); font-size: 11px; display: block; margin-top: 2px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; background: #eef2f8; color: #667; }
.tag.success { background: #e6f7f0; color: var(--green); }
.tag.warn { background: #fff4e3; color: var(--orange); }
.tag.muted { background: #f0f2f6; color: #889; }
.tag.danger { background: #ffecec; color: var(--red); }
.row-btn { border: none; background: none; color: var(--brand); cursor: pointer; padding: 4px 6px; font-size: 12px; }
.row-btn.danger { color: var(--red); }
.footnote { color: var(--muted); font-size: 12px; margin-top: 12px; }
.no-auth { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 40px; text-align: center; }
.no-auth p { color: var(--muted); margin-bottom: 20px; }
.notice-form { display: flex; gap: 8px; flex-wrap: wrap; }
.notice-form input:first-child { width: 220px; }
.notice-form input:nth-child(2) { flex: 1; min-width: 200px; }

/* 反馈 */
.toast { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); background: #16233a; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.modal { position: fixed; inset: 0; background: rgba(16,26,45,.45); display: flex; align-items: center; justify-content: center; z-index: 110; padding: 20px; }
.modal-card { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 440px; max-height: 80vh; overflow: auto; }
.modal-card h3 { margin: 0 0 14px; }
.modal-card input, .modal-card select { width: 100%; margin-bottom: 10px; }
.modal-card p { color: var(--muted); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; }
.detail-grid > div { display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.detail-grid span { font-size: 11px; color: var(--muted); }
.detail-grid b { font-size: 13px; font-weight: 500; }
.timeline-item { border-left: 2px solid var(--brand); padding: 6px 0 6px 12px; margin-bottom: 8px; font-size: 12px; }
.timeline-item b { font-size: 13px; }
.timeline-item span { color: var(--muted); margin-left: 8px; font-size: 11px; }
.timeline-item div { color: var(--muted); margin-top: 3px; }
.photo-list { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-list img { width: 100px; height: 130px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.empty-row { text-align: center; color: var(--muted); padding: 36px 0 !important; }

@media (max-width: 1100px) { .stat-grid, .quick-grid, .kpi-hero, .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chart-card.wide { grid-column: 1 / -1; } }
@media (max-width: 720px) { .sidebar { width: 68px; } .side-brand > div:last-child, .nav-item { font-size: 0; } .nav-item span { font-size: 18px; } .nav-group-title { display: none; } .account-info, .side-bottom .btn { display: none; } .side-bottom { text-align: center; } .main { padding: 16px; } .stat-grid, .quick-grid, .kpi-hero, .chart-grid { grid-template-columns: 1fr; } .topbar { flex-direction: column; align-items: flex-start; gap: 10px; } }

/* 服务内容管理 */
.service-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.service-edit { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; }
.service-edit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.service-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.service-edit-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #6b7484; }
.service-edit-grid label.full { grid-column: 1 / -1; }
.service-edit-grid input, .service-edit-grid textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: #1f2329; background: #fff; resize: vertical; }
.service-edit-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.service-edit-foot .inline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #6b7484; }
.btn-sm { padding: 6px 16px; font-size: 13px; }
@media (max-width: 900px) { .service-list { grid-template-columns: 1fr; } }
