/* Liquid-glass surface: translucent panels over a moving colour field.
   Every panel is a real backdrop-filter surface, so the blur is compositor
   work rather than a stack of fake gradients. */
:root {
  --bg: #0a0b10;
  --ink: #f2f5fb;
  --ink-dim: rgba(242, 245, 251, .62);
  --ink-faint: rgba(242, 245, 251, .38);
  --accent: #0088ff;
  --accent-2: #34c759;
  --warn: #ff9f0a;
  --danger: #ff453a;
  --glass: rgba(22, 24, 34, .46);
  --glass-2: rgba(30, 33, 46, .62);
  --stroke: rgba(255, 255, 255, .10);
  --stroke-2: rgba(255, 255, 255, .18);
  --radius: 22px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
body.light {
  --bg: #eef2f8;
  --ink: #10131a;
  --ink-dim: rgba(16, 19, 26, .62);
  --ink-faint: rgba(16, 19, 26, .38);
  --glass: rgba(255, 255, 255, .58);
  --glass-2: rgba(255, 255, 255, .74);
  --stroke: rgba(16, 19, 26, .08);
  --stroke-2: rgba(16, 19, 26, .14);
  --shadow: 0 18px 50px rgba(31, 45, 61, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
}

/* Colour field behind everything; the glass panels refract it. */
.orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; filter: blur(0px); }
.orbs i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(70px); opacity: .55; will-change: transform;
}
.orbs i:nth-child(1) { width: 46vw; height: 46vw; left: -8vw; top: -10vw;
  background: radial-gradient(circle at 30% 30%, #0a84ff, #0044cc 70%); animation: drift1 26s ease-in-out infinite; }
.orbs i:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 4vw;
  background: radial-gradient(circle at 60% 40%, #7b61ff, #4b2ecc 70%); animation: drift2 31s ease-in-out infinite; }
.orbs i:nth-child(3) { width: 44vw; height: 44vw; left: 18vw; bottom: -16vw;
  background: radial-gradient(circle at 40% 60%, #00c7be, #007a75 70%); animation: drift3 37s ease-in-out infinite; }
.orbs i:nth-child(4) { width: 30vw; height: 30vw; right: 12vw; bottom: -6vw;
  background: radial-gradient(circle at 50% 50%, #ff375f, #b3123a 70%); animation: drift1 42s ease-in-out infinite reverse; }
@keyframes drift1 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(6vw,4vw,0) scale(1.12); } }
@keyframes drift2 { 0%,100% { transform: translate3d(0,0,0) scale(1.05); } 50% { transform: translate3d(-5vw,6vw,0) scale(.95); } }
@keyframes drift3 { 0%,100% { transform: translate3d(0,0,0) scale(.98); } 50% { transform: translate3d(4vw,-5vw,0) scale(1.1); } }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .10);
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  font-weight: 800; letter-spacing: -.5px; font-size: 15px; color: #fff;
  background: linear-gradient(145deg, #0a84ff, #7b61ff);
  box-shadow: 0 8px 22px rgba(10, 132, 255, .45), inset 0 1px 0 rgba(255,255,255,.4);
}
.topbar h1 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.muted { color: var(--ink-dim); }
.tiny { font-size: 11.5px; }
.status-pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--stroke);
  color: var(--ink-dim); font-variant-numeric: tabular-nums;
}
.pill.live { color: var(--accent-2); }
.pill.dead { color: var(--danger); }

main { padding: 14px max(14px, env(safe-area-inset-left)) 60px; max-width: 1240px; margin: 0 auto; }

.hero { border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; }
.stat { padding: 12px 14px; border-radius: 16px; background: var(--glass-2); border: 1px solid var(--stroke); }
.stat .k { font-size: 11.5px; color: var(--ink-dim); letter-spacing: .2px; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.6px;
  font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stat .s { font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.stat.accent .v { color: var(--accent); }
.stat.green .v { color: var(--accent-2); }
.stat.warn .v { color: var(--warn); }
.stat.danger .v { color: var(--danger); }

.tabs {
  display: flex; gap: 4px; padding: 6px; border-radius: 999px; margin-bottom: 14px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; color: var(--ink-dim); font: inherit; font-size: 13.5px;
  padding: 9px 15px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  transition: color .2s, background .2s, transform .12s;
}
.tabs button:hover { color: var(--ink); }
.tabs button:active { transform: scale(.96); }
.tabs button.active {
  color: #fff; background: linear-gradient(145deg, #0a84ff, #5a7bff);
  box-shadow: 0 8px 20px rgba(10, 132, 255, .38), inset 0 1px 0 rgba(255,255,255,.35);
}

.panel { display: none; border-radius: var(--radius); padding: 16px; }
.panel.active { display: block; animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { font-size: 12.5px; color: var(--ink-dim); margin: 4px 0 12px; line-height: 1.6; }
.hint code, .mono { font-family: var(--mono); font-size: 12px;
  background: rgba(127, 127, 127, .16); padding: 1px 6px; border-radius: 6px; }

.btn {
  border: 1px solid var(--stroke-2); background: var(--glass-2); color: var(--ink);
  font: inherit; font-size: 13px; padding: 8px 14px; border-radius: 12px; cursor: pointer;
  transition: transform .12s, background .2s, border-color .2s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(145deg, #0a84ff, #5a7bff); border-color: transparent;
  color: #fff; box-shadow: 0 8px 20px rgba(10, 132, 255, .32); }
.btn.subtle { background: transparent; padding: 6px 9px; border-color: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255, 69, 58, .4); }
.btn.mini { font-size: 11.5px; padding: 5px 9px; border-radius: 9px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .3px;
  color: var(--ink-faint); text-transform: uppercase; padding: 8px 10px;
  border-bottom: 1px solid var(--stroke);
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.tbl.striped tbody tr:nth-child(even) { background: rgba(127, 127, 127, .06); }
.tbl tbody tr { transition: background .16s; }
.tbl tbody tr:hover { background: rgba(10, 132, 255, .10); }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; font-family: var(--mono); font-size: 12px; }
.tbl .ellip { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--stroke-2); color: var(--ink-dim); }
.tag.ok { color: var(--accent-2); border-color: rgba(52, 199, 89, .45); background: rgba(52, 199, 89, .12); }
.tag.bad { color: var(--danger); border-color: rgba(255, 69, 58, .45); background: rgba(255, 69, 58, .12); }
.tag.warn { color: var(--warn); border-color: rgba(255, 159, 10, .45); background: rgba(255, 159, 10, .12); }
.tag.acc { color: var(--accent); border-color: rgba(0, 136, 255, .45); background: rgba(0, 136, 255, .12); }

.bar { height: 6px; border-radius: 999px; background: rgba(127, 127, 127, .22); overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #0a84ff, #34c759); transition: width .5s cubic-bezier(.22,1,.36,1); }
.bar.hot > i { background: linear-gradient(90deg, #ff9f0a, #ff453a); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.card { border-radius: 18px; padding: 14px; }
.card h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: -.2px; }
.mt { margin-top: 18px; }

.chart-wrap { padding: 10px 6px 0; margin-bottom: 14px; }
canvas { width: 100%; display: block; }

.task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.task-card { border-radius: 18px; padding: 14px; background: var(--glass-2);
  border: 1px solid var(--stroke); cursor: pointer; transition: transform .16s, border-color .2s; }
.task-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.task-card:active { transform: scale(.985); }
.task-card h4 { margin: 0 0 4px; font-size: 14px; }
.task-card p { margin: 0; font-size: 12px; color: var(--ink-dim); }
.task-card .badge { margin-top: 10px; font-size: 11.5px; color: var(--ink-faint); }

.modal { position: fixed; inset: 0; z-index: 90; display: none; place-items: center;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); padding: 18px; }
.modal.show { display: grid; animation: fade .2s ease; }
.modal-card { width: min(560px, 100%); max-height: 86vh; overflow: auto;
  border-radius: var(--radius); padding: 16px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: rgba(127, 127, 127, .14); border: 1px solid var(--stroke-2);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 136, 255, .18);
}
.field .sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }
.inline { display: flex; gap: 10px; }
.inline > * { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  z-index: 120; padding: 11px 18px; border-radius: 14px; font-size: 13px;
  background: rgba(20, 22, 30, .92); color: #fff; border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 16px 40px rgba(0,0,0,.4); opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; max-width: 88vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(120, 22, 18, .95); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { display: none; }
.switch i { width: 40px; height: 23px; border-radius: 999px; background: rgba(127,127,127,.35);
  position: relative; transition: background .22s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; transition: transform .22s cubic-bezier(.3,1.4,.5,1);
  box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--accent-2); }
.switch input:checked + i::after { transform: translateX(17px); }

@media (max-width: 720px) {
  .tbl th:nth-child(n+5), .tbl td:nth-child(n+5) { display: none; }
  #tblModels th:nth-child(n+5), #tblModels td:nth-child(n+5),
  #tblLogs th:nth-child(n+4), #tblLogs td:nth-child(n+4) { display: none; }
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .tabs { border-radius: 18px; }
}

/* ---- 洞察页专属 ---- */
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 4px; }
.heat .cell { aspect-ratio: 1; border-radius: 3px; transition: transform .15s; }
.heat .cell:hover { transform: scale(1.35); }
.alert { padding: 8px 12px; border-radius: 12px; font-size: 12.5px; margin-bottom: 6px;
  border: 1px solid var(--stroke); background: var(--glass-2); }
.alert.error { border-color: rgba(255,69,58,.45); background: rgba(255,69,58,.12); color: var(--danger); }
.alert.warn { border-color: rgba(255,159,10,.45); background: rgba(255,159,10,.12); color: var(--warn); }
.alert.ok { border-color: rgba(52,199,89,.45); background: rgba(52,199,89,.10); color: var(--accent-2); }
.step { padding: 5px 0; font-size: 13px; color: var(--ink-dim); }
.step.done { color: var(--accent-2); }
.row-line { padding: 3px 0; font-size: 12px; word-break: break-all; }
a.link { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; margin-bottom: 14px; }
#alertsCard, #onboardingCard { margin-bottom: 12px; }

/* ---- 点选控件 ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 148px; overflow-y: auto;
  padding: 6px; border-radius: 12px; background: rgba(127,127,127,.10);
  border: 1px solid var(--stroke-2); }
.chip { padding: 5px 10px; border-radius: 999px; font-size: 11.5px; cursor: pointer;
  border: 1px solid var(--stroke-2); color: var(--ink-dim); background: transparent;
  transition: background .15s, color .15s, border-color .15s; user-select: none; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.on { background: var(--accent); border-color: transparent; color: #fff; }

@media (max-width: 720px) {
  .modal-card { width: 100%; max-height: 92vh; border-radius: 18px; }
  .modal { padding: 8px; align-items: flex-end; }
  .chips { max-height: 120px; }
  .field input, .field select, .field textarea { font-size: 16px; } /* 防 iOS 缩放 */
  .tabs button { padding: 8px 12px; font-size: 12.5px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .panel-head .row { justify-content: flex-start; overflow-x: auto; }
  #tblModels th:nth-child(n+6), #tblModels td:nth-child(n+6) { display: none; }
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---- 图标 ---- */
.ico { display: inline-block; vertical-align: -3px; flex: none; }
.tabs button .ico, .tabs .tab-link .ico { margin-right: 5px; opacity: .85; }
.tabs button.active .ico { opacity: 1; }
.tabs .tab-link { display: inline-flex; align-items: center; padding: 9px 15px;
  border-radius: 999px; font-size: 13.5px; color: var(--ink-dim); text-decoration: none;
  white-space: nowrap; transition: color .2s, background .2s; }
.tabs .tab-link:hover { color: var(--ink); background: rgba(127,127,127,.12); }

/* ---- 账号卡片里的套餐 ---- */
.pkgs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.pkg { font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
  background: rgba(10,132,255,.14); color: var(--accent);
  border: 1px solid rgba(10,132,255,.28); white-space: nowrap; }
.pkg b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pkg i { font-style: normal; color: var(--ink-faint); font-size: 9.5px; }
.pkg.more { background: transparent; color: var(--ink-faint);
  border-color: var(--stroke); }
@media (max-width: 720px) { .pkg { font-size: 10px; } }
