:root {
  color-scheme: light;
  --bg: #f6f7fa;
  --card: #ffffff;
  --line: #e9ebf2;
  --text: #16192b;
  --text-2: #4b4f66;
  --muted: #9094ab;
  --primary: #17192b;
  --primary-600: #3a3f55;
  --primary-soft: #eef0f4;
  --ok: #12b886;
  --ok-soft: #e6f9f1;
  --warn: #d98b0a;
  --warn-soft: #fff5e6;
  --danger: #f04452;
  --danger-soft: #fff0f2;
  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --shadow: none;
  --shadow-lg: 0 10px 34px rgba(22, 25, 43, 0.16);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 60px;
  --font: 'Quicksand', 'HarmonyOS Sans SC', 'MiSans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }
.hidden { display: none !important; }
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; outline: none; border: none; background: none; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
img { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 22px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: #fff; font-size: 14.5px; font-weight: 600;

}
.btn-primary:disabled { opacity: .5; box-shadow: none; }
.btn-block { width: 100%; height: 48px; border-radius: 14px; font-size: 15.5px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px;
  border-radius: 999px;
  background: var(--bg); color: var(--text-2);
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--line);
}
.btn-ghost.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex: none;
  overflow: hidden;
}
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }

.badge { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.badge-published { background: var(--ok-soft); color: var(--ok); }
.badge-running { background: var(--ok-soft); color: var(--ok); }
.badge-stopped { background: #eef0f5; color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 18, 34, 0.5); backdrop-filter: blur(4px); }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); animation: pop .22s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-meta { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--bg); flex-wrap: wrap; }
.modal-meta span:first-child { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.modal-frame { flex: 1; min-height: 340px; background: var(--bg); }
.modal-frame iframe { width: 100%; height: 100%; min-height: 340px; border: none; background: #fff; }
.modal-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .btn-primary { height: 36px; padding: 0 18px; font-size: 13px; border-radius: 999px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 28px + var(--safe-b));
  transform: translateX(-50%) translateY(16px);
  background: #16192b; color: #fff;
  padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; max-width: 86vw; text-align: center;
  opacity: 0; pointer-events: none; transition: .28s; z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-emoji { font-size: 46px; margin-bottom: 8px; }
.empty p { font-size: 15.5px; font-weight: 600; color: var(--text-2); }
.empty span { font-size: 13px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .3s ease both; }

.ui-modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 22, 38, 0.42); opacity: 0; transition: opacity .2s; }
.ui-modal.show { opacity: 1; }
.ui-box { background: #fff; border-radius: 16px; width: 100%; max-width: 340px; padding: 20px; transform: scale(.96); transition: transform .2s; }
.ui-modal.show .ui-box { transform: scale(1); }
.ui-msg { font-size: 14px; line-height: 1.65; color: var(--text); }
.ui-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.ui-input { width: 100%; height: 42px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 14px; margin-bottom: 14px; }
.ui-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.ui-btn { padding: 8px 18px; border-radius: 9px; font-size: 13px; font-weight: 600; background: #eef0f3; color: var(--text-2); }
.ui-btn.ok { background: var(--primary); color: #fff; }
.ui-btn.ok.danger { background: var(--danger); }

.detail-sub {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: #fff;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.detail-url { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-2); word-break: break-all; }
.detail-url:hover { color: var(--primary); text-decoration: underline; }

.tool-call.is-unknown .tool-mark.unknown { color: var(--muted); }
.tool-mark.unknown { font-weight: 700; }

.pt-delta.zero { color: var(--muted); }

.sk, .sk-lines i, .sk-mini { background: #eceef3; border-radius: 999px; }
.sk-circle { width: 40px; height: 40px; border-radius: 50%; background: #eceef3; }
.sk-lines { display: flex; flex-direction: column; gap: 9px; width: 100%; }
.sk-lines i { display: block; height: 12px; flex: none; }
.sk-mini { display: inline-block; width: 52px; height: 11px; flex: none; }
.sk-mini.sm { width: 36px; }
.sk-row { display: flex; align-items: center; gap: 12px; }
.sk-row > .sk-lines { flex: 1; width: auto; }
.sk-card-item { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px; margin-bottom: 10px; }
.sk-site-ico { width: 36px; height: 36px; border-radius: 10px; background: #eceef3; flex: none; }
.sk-frow { display: flex; align-items: center; gap: 12px; padding: 13px 2px; }
.sk-frow .sk-lines { flex: 1; }
.chat-sk { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.chat-sk .sk-lines { flex: 1; }

.global-loading {
  position: fixed; inset: 0; z-index: 9999; overflow-y: auto;
  background: var(--bg, #f6f7fa);
  opacity: 0; visibility: hidden;
  transition: opacity .16s ease, visibility .16s ease;
}
.global-loading.show { opacity: 1; visibility: visible; }
.global-loading.hidden { display: none !important; }
.gl-sk { max-width: 560px; margin: 0 auto; padding: calc(18px + var(--safe-t, 0px)) 16px 84px; }
.gl-sk-top { display: flex; align-items: center; gap: 14px; padding: 6px 4px 18px; }
.gl-sk-top .sk-circle { width: 46px; height: 46px; flex: none; }
.gl-sk-top .sk-lines { gap: 10px; }
.gl-sk-top .sk-lines i { height: 14px; }
.gl-sk-card { background: #fff; border-radius: 18px; padding: 18px; margin-bottom: 14px; }
.gl-sk-card .sk-lines i { height: 13px; }

.up-progress {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  width: min(86vw, 380px); z-index: 2000;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(23, 25, 43, 0.12);
  padding: 11px 14px;
}
.up-progress.hidden { display: none; }
.up-txt { font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 6px; border-radius: 999px; background: #eef0f5; overflow: hidden; }
.up-fill { display: block; height: 100%; width: 0%; border-radius: 999px; background: var(--primary); transition: width .18s ease; }
.gl-text { font-size: 13px; color: var(--text-2); }

.fm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fm-toolbar .btn-ghost.active { border-color: var(--primary); color: var(--primary); background: rgba(99, 102, 241, 0.08); }
.fm-selectbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: rgba(99, 102, 241, 0.08); border: 1px dashed rgba(99, 102, 241, 0.45);
  border-radius: 10px; padding: 8px 12px; margin: 8px 0;
  font-size: 13px; color: var(--text-2);
}
.fm-selectbar b { color: var(--primary); }
.fm-upload {
  margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff;
}
.fm-upload-info { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-2); }
.fm-upload-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-upload-info b { color: var(--primary); font-variant-numeric: tabular-nums; }
.fm-upload-bar { height: 6px; border-radius: 99px; background: rgba(23, 25, 43, 0.1); overflow: hidden; margin-top: 6px; }
.fm-upload-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), #7c6cf6); transition: width .15s ease; }
.fm-row { position: relative; }
.fm-row.sel-mode { cursor: pointer; }
.fm-row.sel-mode .fm-check { display: inline-flex; }
.fm-check {
  display: none; width: 18px; height: 18px; align-items: center; justify-content: center;
  border: 1.5px solid #c6c9d6; border-radius: 5px; margin-right: 8px; color: transparent; flex: none;
}
.fm-check.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.fm-row.is-sel { background: rgba(99, 102, 241, 0.07); }
.fm-row.is-sel .fm-name { color: var(--primary); }
.fm-actions { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; }
.fm-actions .act-ico { display: inline-flex; align-items: center; padding: 2px 6px; text-decoration: none; vertical-align: middle; }
.btn-ghost.btn-sm.danger { color: #e5484d; }
.btn-ghost.btn-sm.danger:hover { border-color: #e5484d; background: rgba(229, 72, 77, 0.06); }

.points-page { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.points-balance-card { display: flex; flex-direction: column; gap: 4px; padding: 18px; }
.points-balance-card .muted { font-size: 12px; }
.points-balance-card b { font-size: 28px; color: var(--primary); font-weight: 700; }
.rule-card { padding: 14px 16px; }
.rule-card h3 { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--text-1); }
.rule-list { display: flex; flex-direction: column; gap: 12px; }
.rule-row { display: flex; gap: 10px; align-items: flex-start; }
.rule-row svg { flex: none; margin-top: 2px; color: var(--primary); opacity: .85; }
.rule-row b { display: block; font-size: 14px; color: var(--text-1); }
.rule-row small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.5; color: var(--text-2); }
.points-history-card { padding: 14px 16px; }
.points-history-card h3 { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.points-log { max-height: 340px; overflow: auto; }
.points-log .log-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.points-log .log-item:last-child { border-bottom: none; }
.points-log .log-what { color: var(--text-1); }
.points-log .log-time { color: var(--text-3); font-size: 11px; margin-top: 2px; }
.points-log .log-delta { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.points-log .log-delta.plus { color: #16a34a; }
.points-log .log-delta.minus { color: #e5484d; }

.dev-elapsed, .btn-ghost, .msg-att, .site-act, .att-ico { display: inline-flex; align-items: center; gap: 5px; }
.dev-elapsed svg { vertical-align: -2px; }

.points-balance-card { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.points-balance-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.btn-recharge { flex: none; height: 38px; padding: 0 20px; font-size: 14px; border-radius: 999px; }
.recharge-box { max-width: 380px; }
.rc-loading { padding: 44px 22px; text-align: center; color: var(--text-2); font-size: 14px; }
.rc-amount { padding: 22px 20px 4px; text-align: center; }
.rc-amount-label { display: block; font-size: 12px; color: var(--text-3); }
.rc-amount-num { display: block; margin: 6px 0 8px; font-size: 34px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.rc-amount-tip { display: block; font-size: 12.5px; line-height: 1.6; color: var(--text-2); }
.rc-amount-tip b { color: #e5484d; }
.rc-qr { padding: 12px 20px 4px; text-align: center; }
.rc-qr img { width: 190px; height: 190px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.rc-status { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 20px 4px; font-size: 13px; color: var(--text-2); text-align: center; }
.rc-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; animation: rcPulse 1.2s infinite; }
@keyframes rcPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.rc-countdown { padding: 4px 20px 20px; text-align: center; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rc-success { padding: 34px 24px 26px; text-align: center; }
.rc-success-ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 30px; line-height: 56px; font-weight: 700; }
.rc-success h3 { margin: 0 0 6px; font-size: 17px; color: var(--text-1); }
.rc-success-amt { margin: 0 0 4px; font-size: 26px; font-weight: 800; color: #16a34a; }
.rc-success-bal { margin: 0 0 20px; font-size: 13px; color: var(--text-2); }
.rc-success .btn-primary { height: 40px; padding: 0 30px; border-radius: 999px; }
