:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --border: #e6e8f0;
  --border-strong: #d3d7e3;
  --text: #101322;
  --text-2: #454b60;
  --muted: #7b8199;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-2: #0d9488;
  --accent-2-soft: #e6f7f5;
  --danger: #dc2626;
  --danger-soft: #fdeeee;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --ok: #15803d;
  --ok-soft: #e9f8ef;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 19, 34, .04), 0 8px 24px -16px rgba(16, 19, 34, .18);
  --shadow-lg: 0 24px 60px -28px rgba(16, 19, 34, .32);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- 认证页 */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}
.auth-brand {
  position: relative;
  padding: 56px 60px;
  background: linear-gradient(145deg, #1e1b4b 0%, #312e81 48%, #4338ca 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  right: -180px; bottom: -220px;
  background: radial-gradient(circle, rgba(94, 234, 212, .35), transparent 65%);
  border-radius: 50%;
}
.auth-brand h1 { font-size: 30px; line-height: 1.35; margin: 28px 0 14px; letter-spacing: -.4px; }
.auth-brand p { color: rgba(255,255,255,.76); max-width: 440px; }
.auth-brand .bullets { margin-top: 26px; display: grid; gap: 12px; }
.auth-brand .bullet { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.86); font-size: 13.5px; }
.auth-brand .bullet span.dot {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  background: rgba(94, 234, 212, .18); color: #5eead4;
  display: grid; place-items: center; font-size: 12px; margin-top: 2px;
}
.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; margin: 0 0 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; font-size: 13px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

.brand-mark { display: flex; align-items: center; gap: 11px; font-weight: 650; letter-spacing: .2px; }
.brand-mark .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.14);
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.18);
}
.brand-mark .logo svg { width: 19px; height: 19px; }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(79, 70, 229, .12);
}
.textarea { resize: vertical; min-height: 170px; font-family: var(--mono); font-size: 13px; line-height: 1.75; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s, transform .06s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: #4338ca; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; padding: 11px; }
.btn.ghost { background: #fff; border-color: var(--border-strong); color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #f6d5d5; }
.btn.danger:hover { background: #fbe0e0; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.link { background: none; border: none; color: var(--accent); padding: 4px 6px; }

/* ---------------------------------------------------------------- 骨架 */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100dvh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 20px; font-weight: 700; font-size: 14.5px; letter-spacing: -.1px;
}
.sidebar .brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), #6366f1);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 14px -8px rgba(79,70,229,.9);
}
.sidebar .brand .logo svg { width: 17px; height: 17px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; background: none; text-align: left; width: 100%;
}
.nav-item svg { width: 17px; height: 17px; opacity: .72; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.nav-item.active svg { opacity: 1; }
.sidebar .spacer { flex: 1; }
.sidebar .userbox {
  border-top: 1px solid var(--border);
  padding-top: 12px; margin-top: 8px;
  display: flex; align-items: center; gap: 9px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
}
.userbox .u-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.userbox .u-mail { font-size: 11px; color: var(--muted); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { padding: 26px 34px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.3px; }
.page-head .desc { color: var(--muted); font-size: 13px; }
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 650; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 18px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 17px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.8px; margin-top: 7px; line-height: 1.15; }
.stat .foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat .value small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .3px;
  color: var(--muted); text-transform: uppercase;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .q { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- 标签 */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; line-height: 1.7;
  background: #eef0f6; color: var(--text-2); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.mute { background: #f1f2f7; color: var(--muted); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.progress { height: 6px; background: #edeef5; border-radius: 20px; overflow: hidden; }
.progress > i {
  display: block; height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  transition: width .4s ease;
}

/* ---------------------------------------------------------------- 平台选择 */
.plat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plat-chip {
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 11px 13px; cursor: pointer; background: #fff;
  display: flex; align-items: center; gap: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s;
  position: relative;
}
.plat-chip:hover { border-color: #b9bdd2; }
.plat-chip.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.plat-chip .pname { font-weight: 620; font-size: 13px; }
.plat-chip .pmeta { font-size: 11.5px; color: var(--muted); }
.plat-chip .mark {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-strong);
  margin-left: auto; display: grid; place-items: center; flex: 0 0 17px;
  background: #fff; color: #fff; font-size: 11px;
}
.plat-chip.on .mark { background: var(--accent); border-color: var(--accent); }
.plat-chip .noacc { font-size: 11px; color: var(--danger); font-weight: 600; }
.plat-logo {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  background: #f2f3f9; color: var(--text-2);
}
.plat-logo.ds { background: #eaf2ff; color: #2563eb; }
.plat-logo.yb { background: #e8f7ff; color: #0284c7; }
.plat-logo.qw { background: #f3ecff; color: #7c3aed; }
.plat-logo.kimi { background: #eef1f6; color: #111827; }
.plat-logo.db { background: #fff1e8; color: #ea580c; }
.plat-logo.wx { background: #eaf6ff; color: #1d4ed8; }

/* ---------------------------------------------------------------- 任务详情 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  padding: 9px 14px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 550; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.console {
  background: #0f1222; color: #cfd3e6; border-radius: var(--radius-sm);
  padding: 13px 15px; font-family: var(--mono); font-size: 12px; line-height: 1.85;
  max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.console .ok { color: #6ee7a8; }
.console .warn { color: #fcd34d; }
.console .error { color: #fca5a5; }
.console .ts { color: #5b6285; margin-right: 8px; }

.item-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; background: #fff; }
.item-head { padding: 13px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.item-head:hover { background: var(--surface-2); }
.item-head .qi { font-size: 13.5px; font-weight: 560; flex: 1; min-width: 0; }
.item-body { padding: 0 16px 16px; border-top: 1px solid var(--border); display: none; }
.item-card.open .item-body { display: block; }
.answer {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; max-height: 300px; overflow: auto;
  white-space: pre-wrap; color: var(--text-2);
}
.cite-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.cite-row:last-child { border-bottom: none; }
.cite-idx {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.cite-title { font-weight: 550; color: var(--text); }
.cite-meta { color: var(--muted); font-size: 11.5px; }
.shots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.shot-thumb {
  width: 108px; height: 70px; object-fit: cover; object-position: top;
  border-radius: 7px; border: 1px solid var(--border); cursor: zoom-in; background: #fafbfe;
}
.shot-thumb:hover { border-color: var(--accent); }

.matrix td.cell { text-align: center; font-variant-numeric: tabular-nums; }
.matrix td.cell.zero { color: #c3c8d8; }
.matrix td.cell.hot { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 46px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12.5px; }
.bar-track { height: 8px; background: #eef0f7; border-radius: 20px; overflow: hidden; }
.bar-track > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent), #8b8cf7); }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 600; }

/* ---------------------------------------------------------------- 账号页 */
.acc-card { display: flex; flex-direction: column; gap: 12px; }
.acc-top { display: flex; align-items: center; gap: 11px; }
.acc-top .pname { font-weight: 650; font-size: 14px; }
.acc-top .phint { font-size: 11.5px; color: var(--muted); }
.acc-list { display: grid; gap: 7px; }
.acc-line {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px;
}
.acc-line .grow { flex: 1; min-width: 0; }
.acc-line .nm { font-weight: 600; }
.acc-line .mt { color: var(--muted); font-size: 11px; }
.acc-empty { font-size: 12.5px; color: var(--muted); padding: 10px; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: 8px; }

/* ---------------------------------------------------------------- 弹窗 */
.overlay {
  position: fixed; inset: 0; background: rgba(16,19,34,.5);
  display: grid; place-items: center; z-index: 60; padding: 24px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(1000px, 100%); max-height: 92dvh; overflow: auto;
}
.modal.sm { width: min(460px, 100%); }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.x-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.x-btn:hover { background: var(--surface-2); color: var(--text); }

.screen-wrap { display: grid; grid-template-columns: 1fr 232px; gap: 16px; }
.screen {
  border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden;
  background: #f0f1f7; position: relative; aspect-ratio: 1280 / 820;
}
.screen img { width: 100%; height: 100%; display: block; cursor: crosshair; }
.screen .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.remote-side { display: grid; gap: 9px; align-content: start; }
.remote-side .tip { font-size: 12px; color: var(--muted); line-height: 1.7; }
.key-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 其他 */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 90; display: grid; gap: 8px; }
.toast {
  background: #101322; color: #fff; padding: 10px 15px; border-radius: 9px;
  font-size: 13px; box-shadow: var(--shadow-lg); max-width: 380px;
  animation: slidein .18s ease;
}
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }

.empty {
  text-align: center; padding: 52px 20px; color: var(--muted);
}
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 15px; }
.empty p { margin: 0 0 16px; font-size: 13px; }

.notice {
  display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid #dcdffb; color: #3730a3;
  font-size: 12.5px; line-height: 1.7;
}
.notice.warn { background: var(--warn-soft); border-color: #f3e0bd; color: #7c4a03; }
.notice.err { background: var(--danger-soft); border-color: #f6d5d5; color: #991b1b; }

.lightbox {
  position: fixed; inset: 0; background: rgba(9,11,20,.86); z-index: 80;
  display: grid; place-items: center; padding: 28px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 92dvh; border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .plat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; align-items: center; }
  .sidebar .brand, .sidebar .userbox { display: none; }
  .main { padding: 18px; }
  .screen-wrap { grid-template-columns: 1fr; }
}
