:root {
  --primary: #635bff; --bg: #f6f7fb; --card: #ffffff;
  --text: #1f2126; --text2: #4b505a; --muted: #8b909b;
  --line: #e9ebf2; --soft: #f4f5f9; --shadow: 0 2px 10px rgba(30,35,70,.04);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; display: block; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; outline: none; }
button { cursor: pointer; border: 0; background: none; color: inherit; }

/* Login */
.login-view { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 20px; }
.login-bg { position: absolute; inset: 0; background: radial-gradient(900px 500px at 15% 10%, #e9e6ff 0%, transparent 60%), radial-gradient(800px 500px at 85% 90%, #e3ecff 0%, transparent 60%), #f6f7fb; }
.login-card { position: relative; width: min(390px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 34px; box-shadow: 0 22px 60px rgba(25,30,50,.12); }
.login-brand { display: flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 700; font-size: 15px; }
.login-brand svg { width: 22px; height: 22px; }
.login-card h1 { margin: 26px 0 6px; font-size: 24px; }
.login-card p { margin: 0 0 26px; font-size: 12.5px; color: var(--muted); }
.login-card label { display: block; font-size: 12px; color: var(--text2); margin: 14px 0 7px; font-weight: 600; }
.login-card input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font-size: 13px; background: var(--soft); }
.login-card input:focus { border-color: var(--primary); background: #fff; }
.login-err { color: #e1383c; font-size: 12px; height: 18px; margin-top: 8px; }
.login-hint { text-align: center; margin-top: 18px; font-size: 11.5px; color: var(--muted); }
.login-hint b { color: var(--text2); }

/* Layout */
.app-view { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 18px; border-bottom: 1px solid var(--line); }
.side-brand svg { width: 25px; height: 25px; color: var(--primary); }
.side-brand b { display: block; font-size: 14px; }
.side-brand small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.side-nav { padding: 12px 9px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.side-nav button { display: flex; align-items: center; gap: 10px; height: 37px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; color: var(--text2); text-align: left; transition: all .16s; }
.side-nav button svg { width: 16px; height: 16px; opacity: .8; }
.side-nav button:hover { background: var(--soft); color: var(--text); }
.side-nav button.active { background: color-mix(in srgb, var(--primary) 9%, #fff); color: var(--primary); font-weight: 700; }
.side-nav .badge { margin-left: auto; font-size: 9px; font-weight: 700; background: var(--primary); color: #fff; padding: 2px 5px; border-radius: 4px; }
.side-foot { padding: 10px 9px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.side-foot a:hover, .side-foot button:hover { background: var(--soft); color: var(--primary); }
.side-foot svg { width: 15px; height: 15px; }
.admin-main { flex: 1; min-width: 0; }
.topbar { height: 70px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 30; }
.topbar h2 { margin: 0; font-size: 17px; }
.topbar p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.dirty-tip { font-size: 11.5px; color: #e08a1e; margin-right: 6px; }
.content { padding: 22px 26px 60px; max-width: 1400px; }

/* Buttons */
.btn-primary, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 35px; padding: 0 15px; border-radius: 8px; font-size: 12.5px; font-weight: 600; transition: all .18s; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 26%, transparent); }
.btn-primary:hover { filter: brightness(.95); transform: translateY(-1px); }
.btn-ghost { border: 1px solid var(--line); background: var(--card); color: var(--text2); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary svg, .btn-ghost svg { width: 15px; height: 15px; }
.btn-mini { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 27px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); font-size: 11.5px; color: var(--text2); transition: all .16s; }
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini svg { width: 13px; height: 13px; }
.btn-mini.danger:hover { color: #e1383c; border-color: #e1383c; }
.btn-mini.square { width: 25px; padding: 0; }
.btn-mini:disabled { opacity: .4; cursor: not-allowed; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h3::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--primary); }
.card-head .sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -18px; top: -18px; width: 74px; height: 74px; border-radius: 50%; background: color-mix(in srgb, var(--primary) 7%, transparent); }
.stat-card .label { font-size: 11.5px; color: var(--muted); }
.stat-card .num { font-size: 26px; font-weight: 800; margin-top: 7px; }
.stat-card .tip { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stat-card .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; margin-bottom: 10px; }
.stat-card .ic svg { width: 17px; height: 17px; }

/* Charts */
.chart-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; }
.chart-grid.two { grid-template-columns: 1fr 1fr; }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 16px 18px; }
.chart-card h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.chart-card h3::before { content: ""; width: 3px; height: 13px; background: var(--primary); border-radius: 2px; }
.chart-card .chart-sub { font-size: 11px; color: var(--muted); margin: 0 0 12px; }
.chart-svg { width: 100%; height: 190px; display: block; }
.bar-list { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.bar-row { display: flex; align-items: center; gap: 9px; font-size: 11.5px; }
.bar-row span:first-child { width: 76px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 15px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ffc24d, #f5a623); }
.bar-row b { width: 28px; text-align: right; color: var(--text2); font-size: 11px; }
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-list div { display: flex; justify-content: space-between; font-size: 12.5px; padding-bottom: 9px; border-bottom: 1px dashed var(--line); }
.info-list div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }
.info-list b { font-weight: 600; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { display: block; font-size: 12px; color: var(--text2); font-weight: 600; margin-bottom: 6px; }
.field > label .hint { font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 5px; }
.field input[type="text"], .field input[type="number"], .field input[type="password"], .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); color: var(--text); font-size: 12.5px; padding: 8px 11px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.field textarea { resize: vertical; min-height: 68px; line-height: 1.7; }
.field input[type="color"] { width: 42px; height: 35px; border: 1px solid var(--line); border-radius: 7px; padding: 3px; background: var(--card); cursor: pointer; }
.color-wrap { display: flex; gap: 8px; align-items: center; }
.color-wrap input[type="text"] { flex: 1; }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-wrap input[type="range"] { flex: 1; accent-color: var(--primary); }
.range-wrap b { font-size: 12px; min-width: 38px; text-align: center; color: var(--text2); }
.form-note { font-size: 11.5px; color: var(--muted); line-height: 1.8; margin-top: 8px; }
.notice-box { background: #fff8ec; border: 1px solid #ffe1ad; color: #8a6220; border-radius: 9px; padding: 12px 14px; font-size: 11.5px; line-height: 1.85; margin-bottom: 16px; }
.notice-box b { color: #a45a00; }
.notice-box.blue { background: #eef1ff; border-color: #d6dbff; color: #404a9c; }
.notice-box.blue b { color: #2d3585; }

/* switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd3da; border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--soft); padding: 10px 13px; white-space: nowrap; }
.tbl td { padding: 10px 13px; border-bottom: 1px solid var(--line); color: var(--text2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--primary) 2.5%, #fff); }
.tbl td b { color: var(--text); font-weight: 600; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl input.cell-input, .tbl select.cell-input { width: 100%; min-width: 68px; border: 1px solid transparent; background: transparent; border-radius: 5px; padding: 5px 7px; font-size: 12.5px; color: var(--text2); }
.tbl input.cell-input:hover, .tbl select.cell-input:hover { border-color: var(--line); background: var(--soft); }
.tbl input.cell-input:focus { border-color: var(--primary); background: #fff; }
.table-scroll { overflow-x: auto; }
.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { display: flex; align-items: center; gap: 7px; height: 33px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); padding: 0 10px; min-width: 220px; }
.toolbar .search svg { width: 15px; height: 15px; color: var(--muted); }
.toolbar .search input { flex: 1; border: 0; background: none; font-size: 12.5px; min-width: 60px; }
.toolbar .spacer { flex: 1; }
.tag-pill { display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 5px; background: color-mix(in srgb, var(--primary) 8%, #fff); color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line)); }
.tag-pill.off { background: var(--soft); color: var(--muted); border-color: var(--line); }
.tag-pill.warn { background: #fff3e0; color: #b8791a; border-color: #ffe1ad; }

/* Module switch list */
.module-list { display: flex; flex-direction: column; gap: 8px; }
.module-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.module-item .mi-icon { width: 29px; height: 29px; border-radius: 7px; background: color-mix(in srgb, var(--primary) 9%, #fff); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.module-item .mi-icon svg { width: 15px; height: 15px; }
.module-item .mi-name { flex: 1; font-size: 12.5px; font-weight: 600; min-width: 0; }
.module-item .mi-name small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.module-item .mi-ops { display: flex; gap: 5px; }

/* Config cards */
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.cfg-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.cfg-card .cc-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
.cfg-card .cc-head b { font-size: 12.5px; }
.cfg-card .cc-body { padding: 13px 14px; display: grid; gap: 9px; }
.cfg-card .cc-row { display: flex; gap: 8px; align-items: center; }
.cfg-card .cc-row label { font-size: 11px; color: var(--muted); width: 62px; flex-shrink: 0; }
.cfg-card input, .cfg-card select, .cfg-card textarea { width: 100%; border: 1px solid var(--line); background: var(--soft); border-radius: 6px; padding: 6px 9px; font-size: 12px; color: var(--text); }
.cfg-card input:focus, .cfg-card select:focus, .cfg-card textarea:focus { border-color: var(--primary); background: #fff; }
.cfg-card textarea { resize: vertical; min-height: 48px; font-family: Consolas, Monaco, monospace; font-size: 11px; }
.cfg-card .cc-foot { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-top: 1px solid var(--line); }
.cfg-card .cc-foot .en { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); }

/* Modal */
.modal-mask { position: fixed; inset: 0; background: rgba(15,18,26,.55); z-index: 100; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px); }
.modal { width: min(620px, 100%); max-height: 86vh; overflow: auto; background: var(--card); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 15px; }
.modal-head button { color: var(--muted); }
.modal-head svg { width: 16px; height: 16px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px); background: #1f2126; color: #fff; padding: 11px 22px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: all .26s; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty-row { text-align: center; padding: 36px; color: var(--muted); font-size: 12.5px; }

/* Design preview */
.design-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.preview-card { position: sticky; top: 88px; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.preview-bar .dots { display: flex; gap: 5px; }
.preview-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: #e4e6eb; }
.preview-bar .dots i:first-child { background: #ffb3b5; }
.preview-bar .dots i:nth-child(2) { background: #ffe0a3; }
.preview-bar .dots i:nth-child(3) { background: #b8e2c0; }
.preview-bar b { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.preview-frame { width: 100%; height: 600px; border: 0; display: block; background: #fff; }
.preview-tip { padding: 10px 14px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); background: var(--soft); line-height: 1.7; }
@media (max-width: 1250px) { .design-grid { grid-template-columns: 1fr; } .preview-card { position: static; } .preview-frame { height: 460px; } }

@media (max-width: 1000px) { .chart-grid, .chart-grid.two { grid-template-columns: 1fr; } .stat-grid { grid-template-columns: repeat(2, 1fr); } .form-grid, .form-grid.three { grid-template-columns: 1fr; } .logo-row { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .sidebar { width: 60px; } .side-brand div, .side-nav button, .side-foot a, .side-foot button { font-size: 0; justify-content: center; padding: 0; } .side-nav .badge { display: none; } .content { padding: 16px; } .topbar { padding: 0 14px; } }

/* Logo 设置 */
.logo-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 16px; }
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--soft); text-align: center; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 72px; object-fit: contain; display: block; }
.logo-empty { font-size: 12px; color: var(--muted); line-height: 1.7; }
.logo-empty small { display: block; font-size: 10.5px; opacity: .8; }
.logo-fields .field + .field { margin-top: 12px; }

/* 页面风格预设 */
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; margin-bottom: 14px; }
.skin-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--card); transition: border-color .18s, box-shadow .18s, transform .18s; }
.skin-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.skin-card.active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent); }
.skin-swatch { position: relative; display: flex; height: 42px; border-radius: 7px; overflow: hidden; margin-bottom: 4px; }
.skin-swatch i { flex: 1; display: block; }
.skin-swatch i:first-child { border-right: 1px solid rgba(255,255,255,.35); }
.skin-card b { font-size: 12.5px; font-weight: 700; }
.skin-card small { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.skin-check { position: absolute; right: 8px; top: 8px; padding: 2px 7px; border-radius: 20px; background: rgba(255,255,255,.9); color: #111; font-size: 9.5px; font-weight: 700; }
