:root {
  --navy: #14243a;
  --navy-2: #1c3150;
  --blue: #2f6fed;
  --blue-soft: #eaf1ff;
  --green: #169873;
  --orange: #f59e42;
  --red: #d84b55;
  --ink: #182230;
  --muted: #667085;
  --line: #e5e9f0;
  --surface: #ffffff;
  --background: #f4f6f9;
  --shadow: 0 8px 24px rgba(20, 36, 58, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif; color: var(--ink); background: var(--background); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--navy); color: white; padding: 24px 16px; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #5488ff, #2f6fed); font-size: 21px; font-weight: 800; box-shadow: 0 8px 18px rgba(47,111,237,.35); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; letter-spacing: .04em; }
.brand span { margin-top: 3px; font-size: 12px; color: #aebbd0; }
nav { margin-top: 22px; display: grid; gap: 5px; }
.menu-item { border: 0; color: #bfc9d8; background: transparent; border-radius: 9px; padding: 11px 13px; display: flex; align-items: center; gap: 12px; text-align: left; transition: background .12s ease, color .12s ease; }
.menu-item:hover { background: rgba(255,255,255,.06); color: white; }
.menu-item.active { background: var(--blue); color: white; box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.menu-icon { width: 19px; text-align: center; font-weight: 700; }
.environment-card { margin-top: auto; padding: 13px; border-radius: 10px; background: rgba(255,255,255,.06); display: flex; gap: 10px; align-items: center; }
.environment-card strong, .environment-card small { display: block; }
.environment-card strong { font-size: 12px; }
.environment-card small { color: #aebbd0; margin-top: 4px; font-size: 10px; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #41d8a5; box-shadow: 0 0 0 4px rgba(65,216,165,.12); }

.main-area { min-width: 0; }
.topbar { height: 94px; padding: 19px 30px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.eyebrow { margin: 0 0 4px; font-size: 10px; letter-spacing: .16em; color: #8190a5; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.date-chip { padding: 8px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: white; background: var(--navy-2); font-size: 13px; }
.admin-name strong, .admin-name small { display: block; }
.admin-name strong { font-size: 12px; }
.admin-name small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.content { padding: 26px 30px 42px; max-width: 1600px; margin: 0 auto; }

.notice { border: 1px solid #d8e2f4; background: #f5f8ff; color: #3d587e; border-radius: 10px; padding: 12px 15px; font-size: 12px; margin-bottom: 18px; display: flex; gap: 9px; align-items: center; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 17px; box-shadow: 0 3px 12px rgba(20,36,58,.04); }
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card .value { margin-top: 10px; font-size: 25px; font-weight: 750; letter-spacing: -.03em; }
.stat-card .hint { margin-top: 7px; font-size: 10px; color: #97a2b2; }
.stat-card.accent { border-top: 3px solid var(--blue); }
.stat-card.warning { border-top: 3px solid var(--orange); }
.stat-card.success { border-top: 3px solid var(--green); }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 12px rgba(20,36,58,.04); overflow: hidden; }
.panel-header { min-height: 61px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 12px; }
.panel-header h2 { margin: 0; font-size: 15px; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 18px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar-copy h2 { margin: 0; font-size: 17px; }
.toolbar-copy p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.button { border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 650; font-size: 12px; }
.button.primary { background: var(--blue); color: white; box-shadow: 0 4px 12px rgba(47,111,237,.18); }
.button.secondary { background: #eef1f5; color: #475467; }
.button.small { padding: 6px 9px; font-size: 11px; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 13px; text-align: left; color: #667085; background: #f8f9fb; font-weight: 650; white-space: nowrap; }
td { padding: 12px 13px; border-top: 1px solid #edf0f4; vertical-align: middle; color: #344054; }
tbody tr:hover { background: #fafcff; }
.primary-text { color: var(--ink); font-weight: 650; }
.sub-text { display: block; margin-top: 3px; color: #8a95a5; font-size: 10px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: #eef2f6; color: #516072; font-weight: 650; font-size: 10px; white-space: nowrap; }
.badge.green { background: #e7f7f1; color: #087a59; }
.badge.blue { background: #e9f0ff; color: #285fcf; }
.badge.orange { background: #fff3e6; color: #b76517; }
.badge.red { background: #ffebed; color: #b62e39; }
.empty { padding: 38px; text-align: center; color: var(--muted); }
.loading { padding: 50px; text-align: center; color: var(--muted); }
.mini-list { display: grid; }
.mini-row { display: grid; grid-template-columns: 1.35fr 1fr auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.mini-row:last-child { border-bottom: 0; }
.mini-row strong { font-size: 12px; }
.mini-row small { color: var(--muted); display: block; margin-top: 4px; }
.money { font-variant-numeric: tabular-nums; font-weight: 750; color: var(--green); }

.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.detail-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fafbfd; }
.detail-item span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.detail-item strong { font-size: 12px; }
.section-gap { margin-top: 18px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card { border: 1px solid var(--line); padding: 15px; border-radius: 10px; background: white; }
.mode-card strong { display: block; font-size: 12px; }
.mode-card span { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.mode-card.legacy { border-style: dashed; background: #fffaf3; }
.integration-box { padding: 24px; display: grid; grid-template-columns: 82px 1fr; gap: 18px; align-items: center; }
.integration-score { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: #e7f7f1; color: var(--green); font-size: 22px; font-weight: 800; border: 7px solid #f3fbf8; }
.integration-score.warning { background: #fff4e5; color: #b54708; border-color: #fffaf2; }
.check-list { display: grid; gap: 9px; margin-top: 14px; }
.check-item { display: flex; gap: 9px; align-items: center; font-size: 12px; color: #475467; }
.check-item small { display: block; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.check-item.failed .check { color: var(--red); }
.check { color: var(--green); font-weight: 900; }
.text-link { color: var(--blue); font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 15px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.filter-bar label { color: var(--muted); font-size: 11px; font-weight: 650; }
.filter-bar select { min-width: 280px; border: 1px solid #d6dce5; border-radius: 8px; padding: 8px 10px; background: white; }
code { color: #344054; font-size: 10px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(12,22,36,.48); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(760px, 100%); max-height: 90vh; overflow-y: auto; background: white; border-radius: 14px; box-shadow: 0 24px 70px rgba(12,22,36,.28); }
.modal-header { padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 18px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: #f2f4f7; font-size: 22px; color: #667085; }
.form-grid { padding: 20px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #475467; font-size: 11px; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d6dce5; border-radius: 8px; padding: 10px 11px; color: var(--ink); background: white; outline: none; }
.field textarea { min-height: 78px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.field small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.checkbox-field label { display: flex; align-items: center; gap: 8px; }
.checkbox-field input { width: auto; }
.modal-actions { padding: 15px 22px 20px; display: flex; justify-content: flex-end; gap: 9px; }
.form-error { margin: 0 22px; color: var(--red); background: #fff1f2; border-radius: 7px; padding: 9px 11px; font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--navy); color: white; padding: 12px 16px; border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; z-index: 80; }
.toast[hidden] { display: none; }
.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: #eef2f7; }
.login-screen[hidden] { display: none; }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 16px; padding: 34px; box-shadow: 0 24px 70px rgba(20,36,58,.16); display: grid; gap: 16px; }
.login-card .brand-mark { margin-bottom: 4px; }
.login-card h2 { margin: 0; }
.login-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-card label { display: grid; gap: 7px; font-size: 12px; font-weight: 650; }
.login-card input { border: 1px solid #d6dce5; border-radius: 8px; padding: 11px; outline: none; }
.login-card .form-error { margin: 0; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 20px 10px; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .brand > div:last-child, .menu-label, .environment-card > div { display: none; }
  .menu-item { justify-content: center; padding: 12px; }
  .environment-card { justify-content: center; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .two-column, .detail-grid { grid-template-columns: 1fr; }
  .admin-name, .date-chip { display: none; }
}
