/* 玄机阁管理后台 — 中文 · 深色侧栏 + 高对比工作区 */
:root {
  --side: #0c0f20;
  --side-2: #141830;
  --bg: #f4f5f9;
  --card: #fff;
  --ink: #1a1d2b;
  --muted: #6b7182;
  --line: #e3e6ef;
  --gold: #b8891c;
  --gold-soft: #f6eed8;
  --violet: #6d5bd0;
  --green: #16855b;
  --red: #c0392b;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(20, 25, 50, .06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--ink); font-size: 13px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: var(--side); color: #c9cde0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-brand .mark { width: 34px; height: 34px; border-radius: 50%; border: 1px solid #d4af37; color: #f3dfa0; display: grid; place-items: center; font-size: 18px; }
.side-brand b { color: #f3dfa0; font-size: 16px; letter-spacing: .08em; display: block; line-height: 1.2; }
.side-brand small { font-size: 9px; letter-spacing: .22em; color: #767c96; }
.side-group { padding: 18px 12px 4px; font-size: 10px; letter-spacing: .16em; color: #656b84; text-transform: uppercase; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 2px 8px; border-radius: 9px; font-size: 13px; transition: .15s; }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a.active { background: rgba(212,175,55,.14); color: #f3dfa0; box-shadow: inset 3px 0 0 #d4af37; }
.side-nav .ico { width: 18px; text-align: center; opacity: .9; }
.side-foot { padding: 18px 20px; margin-top: 20px; border-top: 1px solid rgba(255,255,255,.07); font-size: 11px; color: #6f7590; }

.main { flex: 1; min-width: 0; }
.topbar { height: 66px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 26px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }
.save-state { font-size: 11px; color: var(--muted); }
.save-state.dirty { color: var(--red); font-weight: 600; }
.topbar .btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; font-size: 12px; }
.topbar .btn.primary { background: var(--side); color: #fff; border-color: var(--side); }
.topbar .btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }

.content { padding: 26px; max-width: 1440px; }
.view-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h2 { font-size: 20px; margin: 0 0 4px; }
.view-head p { margin: 0; color: var(--muted); font-size: 12px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.kpi .label { font-size: 11px; color: var(--muted); }
.kpi .value { font-size: 28px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -.02em; }
.kpi .sub { font-size: 11px; color: var(--green); }
.kpi .sub.warn { color: #b7791f; }
.kpi.gold .value { color: var(--gold); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
th { background: #fafbfd; color: var(--muted); font-weight: 600; font-size: 11px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfe; }
td .sub { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.tag.green { background: #e6f6ef; color: var(--green); }
.tag.red { background: #fdecea; color: var(--red); }
.tag.yellow { background: var(--gold-soft); color: var(--gold); }
.tag.gray { background: #eef0f5; color: var(--muted); }
.tag.violet { background: #efecfd; color: var(--violet); }
.row-actions { display: flex; gap: 6px; }
.mini { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 8px; font-size: 11px; color: var(--muted); }
.mini:hover { border-color: var(--gold); color: var(--gold); }
.mini.danger:hover { border-color: var(--red); color: var(--red); }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-row .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font-size: 12.5px; color: var(--ink); background: #fff; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,28,.12); }
.field input[readonly] { background: #f7f8fb; color: var(--muted); }
.field textarea { min-height: 72px; resize: vertical; }
.hint { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pay-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.pay-top { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.pay-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.pay-top b { display: block; font-size: 14px; }
.pay-top small { color: var(--muted); font-size: 10.5px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--gold); }
.pay-card .field { margin-top: 10px; }

.bar-chart { display: flex; align-items: end; gap: 10px; height: 150px; padding: 10px 0 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: end; }
.bar { width: 60%; max-width: 34px; background: linear-gradient(180deg, #d4af37, #b8891c); border-radius: 5px 5px 0 0; min-height: 4px; }
.bar-col span { font-size: 10px; color: var(--muted); }

.i18n-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.i18n-toolbar select, .i18n-toolbar input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; background: #fff; }
.i18n-table td:first-child { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); width: 180px; }
.i18n-table input { width: 100%; border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 6px; font-size: 12px; }
.i18n-table input:hover { border-color: var(--line); }
.i18n-table input:focus { border-color: var(--gold); background: #fff; outline: none; }
.i18n-table tr.changed input { background: #fffaf0; }

.modal-back { position: fixed; inset: 0; background: rgba(8,10,20,.6); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-back.show { display: flex; }
.modal { width: min(560px, 96vw); max-height: 90vh; overflow: auto; background: #fff; border-radius: 16px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .close { float: right; border: 0; background: none; font-size: 22px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.btn2 { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 16px; font-size: 12px; }
.btn2.primary { background: var(--side); color: #fff; border-color: var(--side); }
.btn2.gold { background: var(--gold); color: #fff; border-color: var(--gold); }

.toast2 { position: fixed; bottom: 24px; right: 24px; background: #161a2e; color: #fff; border-radius: 10px; padding: 12px 18px; font-size: 12px; z-index: 200; opacity: 0; pointer-events: none; transition: .25s; }
.toast2.show { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px; font-size: 12px; }
.loading2 { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 300; color: var(--gold); }
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2,1fr); } .pay-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 760px) { .sidebar { width: 64px; } .side-brand span:last-child, .side-nav a span:not(.ico), .side-group, .side-foot { display: none; } .side-nav a { justify-content: center; } .cards, .pay-grid, .form-row { grid-template-columns: 1fr; } .content { padding: 16px; } }

/* ── 后台登录 ───────────────────────────────────────────── */
#login-screen { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% 0%, #1a2145 0%, #0c0f20 60%, #070912 100%); z-index: 400; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 28px 26px 22px; box-shadow: 0 24px 70px rgba(0,0,0,.45); }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand .mark { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid #d4af37; color: #b8891c; font-size: 24px; margin-bottom: 10px; }
.login-brand b { display: block; font-size: 17px; letter-spacing: .1em; color: #1a1d2b; }
.login-brand small { display: block; margin-top: 4px; font-size: 9px; letter-spacing: .26em; color: #9aa0b2; }
.login-hint { font-size: 12px; color: #6b7182; text-align: center; margin: 0 0 14px; min-height: 17px; }
#login-form { display: grid; gap: 10px; }
#login-pass { width: 100%; padding: 11px 12px; border: 1px solid #dfe3ee; border-radius: 9px; font-size: 14px; outline: none; }
#login-pass:focus { border-color: #b8891c; box-shadow: 0 0 0 3px rgba(184,137,28,.14); }
#login-form .btn2 { padding: 11px; border: 0; border-radius: 9px; background: linear-gradient(180deg,#d4af37,#b8891c); color: #23180a; font-weight: 700; letter-spacing: .06em; }
.login-foot { margin-top: 16px; text-align: center; font-size: 12px; color: #8a90a2; }
.login-foot a { color: #b8891c; }
