:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #7b8494;
  --line: #d6dde7;
  --bg: #e9edf3;
  --card: #ffffff;
  --blue: #3f6ef0;
  --danger: #d9534f;
  --green: #1f9d63;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { font-size: 15px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; letter-spacing: -.02em; }
h2 { margin-bottom: 14px; font-size: 19px; }
h3 { margin: 24px 0 12px; font-size: 17px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
small { line-height: 1.5; }
.muted { color: var(--muted); }
.note { margin-top: 12px; font-size: 13px; }
.footnote { margin: 28px 0 48px; color: #9aa3b0; font-size: 13px; line-height: 1.7; }
.positive { color: var(--green); }
.negative, .danger, .warn { color: #c2410c; }

.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 22px 16px; background: #111827; color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 28px; }
.brand__mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; background: #fff; color: #111827; font-size: 20px; font-weight: 800; }
.brand strong { display: block; font-size: 16px; }
.brand small { display: block; margin-top: 3px; color: #8995a8; font-size: 10px; letter-spacing: 1.5px; }
.nav { display: grid; gap: 6px; }
.nav__item { padding: 11px 12px; border-radius: 12px; color: #b7c0cf; font-size: 14px; }
.nav__item:hover, .nav__item.is-active { background: #263247; color: #fff; }
.sidebar__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid #2d384b; }
.sidebar__user { display: grid; gap: 6px; min-width: 0; }
.environment-select { width: 100%; height: 32px; border-color: #34445f; background: #1b2535; color: #fff; font-size: 12px; }
.sidebar__foot .muted { min-width: 0; overflow: hidden; color: #aeb8c8; text-overflow: ellipsis; white-space: nowrap; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: none; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.topbar__title { font-weight: 760; }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.topbar__right .environment-select { width: 106px; height: 32px; background: #f5f6f8; color: var(--ink); }
.topbar__user { color: var(--muted); font-size: 13px; }
.mobile-nav { display: none; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head p { margin-top: 8px; color: var(--muted); }
.eyebrow { margin-bottom: 8px; color: #8792a2; font-size: 11px; font-weight: 760; letter-spacing: 2.6px; }
.page-head--hero { margin: -28px -28px 28px; padding: 34px 28px; background: linear-gradient(140deg, #111827, #34445f); color: #fff; }
.page-head--hero p { color: #c2ccda; }
.page-head--hero .eyebrow { color: #aeb9cb; }
.section { margin-top: 30px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.card { border: 1px solid #d9e0e9; border-radius: 18px; background: var(--card); box-shadow: 0 7px 22px rgba(17,24,39,.09), 0 1px 2px rgba(17,24,39,.05); }
.panel, .form-card { padding: 22px; }
.form-card { display: grid; gap: 16px; }
.empty { padding: 38px 20px; color: #98a1b0; text-align: center; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 20px 16px; text-align: center; }
.metric strong { display: block; font-size: 27px; font-weight: 800; }
.metric span { display: block; margin-top: 7px; font-size: 13px; }
.metric small { display: block; margin-top: 4px; color: #a9b1bd; font-size: 11px; }
.range-tabs { display: flex; gap: 8px; }
.range-tab { padding: 8px 16px; border: 0; border-radius: 999px; background: rgba(255,255,255,.14); color: #c2ccda; }
.range-tab.is-active { background: #fff; color: #111827; font-weight: 700; }
.trend-row, .stay-row { display: grid; grid-template-columns: 54px minmax(0,1fr) 48px; align-items: center; gap: 10px; padding: 9px 0; }
.trend-row > span { color: #8b93a1; font-size: 12px; }
.trend-row > strong { text-align: right; }
.trend-bars { display: grid; gap: 4px; }
.trend-bars i { display: block; height: 7px; border-radius: 4px; }
.trend-created { background: var(--blue); }
.trend-failed { background: #f0776b; }
.legend { display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef1f5; color: #8b93a1; font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 3px; }
.dot--blue { background: var(--blue); }
.dot--red { background: #f0776b; }
.kv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 12px; }
.kv { text-align: center; }
.kv strong { display: block; font-size: 22px; }
.kv span { display: block; margin-top: 5px; color: #8b93a1; font-size: 12px; }
.rank-row { padding: 16px 0; border-bottom: 1px solid #f2f4f7; }
.rank-row:last-child { border-bottom: 0; }
.rank-row--compact { padding: 12px 0; }
.rank-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rank-head strong { min-width: 0; overflow-wrap: anywhere; }
.rank-bar, .funnel-bar { height: 9px; margin: 10px 0 8px; overflow: hidden; border-radius: 999px; background: #f2f4f7; }
.rank-bar i, .funnel-bar i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.rank-bar--danger i { background: #f0a06b; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 18px; color: #8b93a1; font-size: 12px; }
.tag, .status, .status-pill, .grant-tag { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-style: normal; }
.tag--local { background: #e6f6ee; color: #1f6f4a; }
.tag--model { background: #fdf1e0; color: #6b4a1f; }
.status, .status-pill.is-off { background: #f2f4f7; color: #7b8494; }
.status--ACTIVE, .status-pill.is-on { background: #e6f6ee; color: #1f6f4a; }
.funnel-row { padding: 12px 0; }
.funnel-bar i { background: linear-gradient(90deg, #3f6ef0, #6f9bff); }
.stay-row { grid-template-columns: minmax(80px,1fr) auto auto; border-bottom: 1px solid #f4f6f8; }
.event-row { display: grid; grid-template-columns: minmax(120px,1fr) minmax(140px,1.4fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f4f6f8; }
.event-row code { color: #a9b1bd; font-size: 11px; text-align: center; }
.event-row span { color: var(--blue); font-weight: 760; }

label { display: grid; gap: 7px; color: #596475; font-size: 13px; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid #e2e6ed; border-radius: 11px; outline: none; background: #f8f9fb; color: var(--ink); }
input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 110px; padding: 11px 12px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: #98b1fb; box-shadow: 0 0 0 3px rgba(63,110,240,.12); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; font-weight: 720; }
.btn--primary, .btn--dark { background: #111827; color: #fff; }
.btn--dark { background: #111827; }
.btn--ghost { border-color: #d9dee7; background: #fff; color: #111827; }
.btn--small { min-height: 32px; padding: 0 12px; font-size: 12px; }
.btn.is-active { border-color: #111827; background: #111827; color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { padding: 8px 14px; border: 1px solid #e0e4eb; border-radius: 999px; background: #fff; color: #626d7e; font-size: 12px; }
.chip.is-active { border-color: #111827; background: #111827; color: #fff; }
.searchbar { display: flex; gap: 10px; padding: 12px; }
.searchbar input { flex: 1; }
.notice { padding: 20px; border-left: 5px solid #f0a06b; }
.notice p { margin-top: 8px; color: #7b8494; line-height: 1.6; }
.warning { padding: 12px 14px; border-radius: 10px; background: #fff6e8; color: #8a5a1c; font-size: 13px; line-height: 1.55; }
.user-list, .plan-list, .workflow-list, .feedback-list, .version-list { display: grid; gap: 14px; }
/* 用户、套餐、反馈页顶部说明卡和下方列表之间补垂直间隔，避免两块 UI 贴在一起。 */
.users-page > .note,
.plans-page > .notice,
.feedback-page > .inline-form { margin-bottom: 18px; }
.user-card { overflow: hidden; }
.user-card.is-open { box-shadow: 0 10px 30px rgba(17,24,39,.12); }
.user-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 18px 20px; border: 0; background: transparent; text-align: left; }
.user-main { display: grid; gap: 5px; min-width: 0; }
.user-main strong { font-size: 16px; }
.user-main small { color: #8b93a1; }
.user-main .mono { word-break: break-all; }
.link-text { flex-shrink: 0; color: var(--blue); font-size: 13px; }
.detail { padding: 0 20px 20px; border-top: 1px solid #f2f4f7; }
.detail-empty { padding: 18px 20px; color: #98a1b0; font-size: 13px; }
.detail-head { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.detail-head > div { display: grid; gap: 4px; min-width: 0; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #eef1f5; }
.avatar--placeholder { display: grid; place-items: center; background: #111827; color: #fff; font-weight: 800; }
.detail p { margin-top: 12px; color: #657082; line-height: 1.55; }
.subcard { margin-top: 18px; padding: 16px; border-radius: 13px; background: #f8f9fb; }
.subcard label { margin-top: 12px; }
.subcard .btn { margin-top: 14px; }
.work-row, .ledger-row { padding: 14px 0; border-bottom: 1px solid #f2f4f7; }
.work-row p, .ledger-row small { display: block; margin-top: 6px; color: #7b8494; font-size: 12px; }
.workflow-card { display: grid; gap: 8px; width: 100%; padding: 20px; border: 1px solid #d9e0e9; text-align: left; }
.workflow-card > span { color: #717b8b; }
.workflow-card strong { color: #111827; }
.plan-card { display: grid; gap: 14px; padding: 20px; }
.readonly { display: grid; gap: 6px; padding: 12px; border-radius: 10px; background: #f5f6f8; color: #5c6675; font-size: 12px; }
.summary { color: #7b8494; line-height: 1.6; }
.inline-form { padding: 18px; }
.inline-form label { grid-template-columns: 130px minmax(0,180px); align-items: center; }
.inline-form p { margin-top: 10px; }
.feedback-card { padding: 20px; }
.feedback-card > p { margin-top: 10px; color: #657082; line-height: 1.6; }
.feedback-card > small { display: block; margin-top: 10px; }
.refs { margin-top: 14px; }
.ref-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ref { display: grid; place-items: center; width: 84px; height: 84px; overflow: hidden; border: 1px solid #e8ecf2; border-radius: 12px; background: #eef1f5; color: #a4acb8; }
.ref img { width: 100%; height: 100%; object-fit: cover; }
.feedback-actions { margin-top: 14px; }
.feedback-statuses { margin-top: 12px; }
.grant-tag { background: #e6f6ee; color: #1f6f4a; }
.pick-row { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 10px; padding: 13px 14px; border: 1px solid #eceff4; border-radius: 12px; background: #fff; text-align: left; }
.pick-row.is-on { border-color: #111827; background: #f7f8fa; }
.pick-row span { display: grid; gap: 3px; }
.pick-row small { color: #9aa3b0; }
.pick-row em { color: #8b93a1; font-size: 12px; font-style: normal; }
.entry-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.json-editor { min-height: 420px; margin-top: 14px; background: #111827; color: #dce5f2; font-family: ui-monospace, monospace; font-size: 12px; }
.parameter-editor { margin-top: 16px; padding: 16px; border: 1px solid #e5e9f0; border-radius: 14px; }
.parameter-editor .form-grid { margin-top: 10px; }
.link-danger { padding: 0; border: 0; background: transparent; color: #b42318; font-size: 12px; }
.option-list { display: grid; gap: 10px; margin-top: 12px; }
.option-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto auto; gap: 8px; align-items: center; }
.inline-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.inline-check input { width: auto; height: auto; }
.version-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; }
.version-row small { color: #8b93a1; }
.top-gap { margin-top: 18px; }
.label { color: #596475; font-size: 13px; font-weight: 650; }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: linear-gradient(145deg, #eef2f9, #f8f5ef); }
.login-card { width: min(420px, 100%); padding: 34px; }
.login-card__brand { color: #8b93a1; font-size: 11px; font-weight: 760; letter-spacing: 2px; }
.login-card h1 { margin-top: 8px; }
.login-card > p { margin-top: 10px; line-height: 1.6; }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.environment-picker { display: grid; gap: 7px; margin-top: 20px; color: #596475; font-size: 13px; font-weight: 650; }
.environment-picker select { height: 42px; }
.login-dev { width: 100%; margin-top: 10px; }
.login-card__hint { margin-top: 18px; color: #9aa3b0; font-size: 12px; line-height: 1.6; }
.toast { position: fixed; top: 18px; left: 50%; z-index: 30; max-width: min(420px, calc(100vw - 32px)); padding: 11px 16px; transform: translateX(-50%); border-radius: 11px; background: #111827; color: #fff; box-shadow: 0 10px 30px rgba(17,24,39,.2); }
.toast--success { background: #166534; }
.toast--error { background: #991b1b; }
.image-modal { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: auto minmax(0,1fr); padding: 18px; background: rgba(5,10,20,.92); }
.image-modal__bar { display: flex; align-items: center; justify-content: space-between; color: #fff; }
.image-modal__bar button { padding: 7px 12px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; background: transparent; color: #fff; }
.image-modal img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { display: block; padding-bottom: 66px; }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 10; display: flex; gap: 4px; overflow-x: auto; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
  .mobile-nav .nav__item { flex: 0 0 auto; padding: 8px 11px; color: #7b8494; font-size: 12px; }
  .mobile-nav .nav__item.is-active { background: #111827; color: #fff; }
  .page { padding: 18px 14px; }
  .page-head { display: block; }
  .page-head--hero { margin: -18px -14px 22px; padding: 28px 14px; }
  .page-head--hero .range-tabs { margin-top: 18px; }
  h1 { font-size: 25px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric strong { font-size: 23px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form label { grid-template-columns: 1fr; }
  .option-row { grid-template-columns: 1fr 1fr; }
  .option-row button { min-height: 34px; }
  .searchbar { padding: 8px; }
  .searchbar .btn { min-width: 70px; }
  .entry-card { align-items: flex-start; flex-direction: column; }
}
