/* 控制台样式:深色极光 + 玻璃拟态。视觉资源全部是纯 CSS 与内联 SVG,不依赖外部字体或图片。 */

@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

/* ------------------------------------------------------------------
   主题层:三套配色共用同一份结构样式,只切换这里的 token。
   paper(默认)米白纸感,midnight 深靛夜色,matcha 抹茶奶油。
   ------------------------------------------------------------------ */
:root {
  color-scheme: light;
  /* 间距刻度:区块之间只用这套值 */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;
  --bar-gap: 9px;
  --radius: 18px;
  --radius-sm: 12px;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.16, 1.1, .3, 1);
}

/* 深灰蓝:中性石板灰打底,冷调钢蓝做主色。默认主题。 */
:root, [data-theme="slate"] {
  color-scheme: dark;
  --bg: #161b23;
  --bg-2: #10141a;
  --surface: rgba(30, 37, 48, .86);
  --surface-2: rgba(36, 44, 57, .92);
  --surface-solid: rgba(24, 30, 40, .98);
  --card-a: #1e2531;
  --card-b: #171d26;
  --sunken: rgba(18, 23, 31, .92);
  --control-bg: #1f2733;
  --control-hover: #27303e;
  --control-focus: #1b222c;
  --input-bg: #161c25;
  --menu-bg: #1d242f;
  --chip-bg: #1c232d;
  --th-bg: #1a212b;
  --rail-a: #1a2029;
  --rail-b: #12161d;
  --drawer-a: #1a212b;
  --line: rgba(133, 152, 179, .16);
  --line-strong: rgba(133, 152, 179, .3);
  --line-rgb: 133, 152, 179;
  --text: #e6ebf3;
  --muted: #98a6ba;
  --dim: #6c7889;
  --mint: #5b9bff;
  --mint-2: #82b7ff;
  --mint-deep: #2f6fd0;
  --mint-rgb: 91, 155, 255;
  --on-mint: #07121f;
  --violet: #9c8cf0;
  --violet-rgb: 156, 140, 240;
  --violet-soft: #c6bcf8;
  --on-violet: #0e0a24;
  --rose: #ee7d76;
  --danger: #f0736b;
  --danger-deep: #cf5148;
  --danger-soft: #f4a49e;
  --danger-rgb: 240, 115, 107;
  --danger-text: #ffcfcb;
  --ok-text: #b9e6c8;
  --sky: #63c7d8;
  --sky-soft: #a9e2ec;
  --sky-rgb: 99, 199, 216;
  --sky-text: #c8eef5;
  --warn: #e0a340;
  --warn-soft: #f0cd8d;
  --warn-rgb: 224, 163, 64;
  --on-warn: #241703;
  --knob: #eef2f8;
  --shadow-rgb: 4, 8, 14;
  --overlay-rgb: 3, 6, 10;
  --shadow: 0 18px 46px rgba(var(--shadow-rgb), .55);
  --glow: 0 0 0 rgba(0, 0, 0, 0);
}

/* 纸感:暖白纸面 + 墨色文字 + 珊瑚主色,硬朗投影 */
:root, [data-theme="paper"] {
  --bg: #f6f1e6;
  --bg-2: #efe8d9;
  --surface: #fffdf8;
  --surface-2: #fdf8ee;
  --surface-solid: #fffdf8;
  --card-a: #ffffff;
  --card-b: #fdf7ec;
  --sunken: #f4ecdd;
  --control-bg: #fffdf8;
  --control-hover: #f6efe0;
  --control-focus: #fffdf8;
  --input-bg: #fffefb;
  --menu-bg: #fffdf8;
  --chip-bg: #fbf5e9;
  --th-bg: #f3ecdd;
  --rail-a: #fffdf8;
  --rail-b: #f7f1e3;
  --drawer-a: #fffdf8;
  --line: rgba(60, 48, 32, .18);
  --line-strong: rgba(60, 48, 32, .32);
  --line-rgb: 60, 48, 32;
  --text: #241f16;
  --muted: #6a6151;
  --dim: #8c8371;
  --mint: #1f8a5a;
  --mint-2: #3fae76;
  --mint-deep: #14724a;
  --mint-rgb: 31, 138, 90;
  --on-mint: #f4fff9;
  --violet: #6b4fd8;
  --violet-rgb: 107, 79, 216;
  --violet-soft: #c3b4f5;
  --on-violet: #fdfbff;
  --rose: #d94a3d;
  --danger: #c0392b;
  --danger-deep: #a52b1f;
  --danger-soft: #f0a79c;
  --danger-rgb: 192, 57, 43;
  --danger-text: #7d2318;
  --ok-text: #14603f;
  --sky: #1f7fa8;
  --sky-soft: #a7d8ea;
  --sky-rgb: 31, 127, 168;
  --sky-text: #14566f;
  --warn: #b57511;
  --warn-soft: #f5d68e;
  --warn-rgb: 181, 117, 17;
  --on-warn: #fffaf0;
  --knob: #fffdf8;
  --shadow-rgb: 60, 48, 32;
  --overlay-rgb: 40, 32, 20;
  --shadow: 6px 6px 0 rgba(var(--shadow-rgb), .10), 0 18px 40px rgba(var(--shadow-rgb), .10);
  --glow: 0 0 0 rgba(0, 0, 0, 0);
}

/* 午夜:深靛蓝夜色,去掉花哨紫粉 */
[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #0c111e;
  --bg-2: #080c16;
  --surface: rgba(21, 28, 46, .82);
  --surface-2: rgba(28, 36, 58, .9);
  --surface-solid: rgba(18, 24, 40, .98);
  --card-a: rgba(26, 34, 54, .92);
  --card-b: rgba(12, 17, 28, .9);
  --sunken: rgba(12, 17, 28, .7);
  --control-bg: rgba(22, 30, 48, .88);
  --control-hover: rgba(36, 46, 70, .94);
  --control-focus: rgba(18, 25, 41, .96);
  --input-bg: rgba(12, 17, 28, .86);
  --menu-bg: rgba(18, 24, 40, .98);
  --chip-bg: rgba(22, 30, 48, .8);
  --th-bg: rgba(16, 22, 37, .97);
  --rail-a: rgba(13, 18, 31, .9);
  --rail-b: rgba(8, 11, 19, .94);
  --drawer-a: rgba(15, 21, 35, .99);
  --line: rgba(150, 172, 214, .18);
  --line-strong: rgba(150, 172, 214, .32);
  --line-rgb: 150, 172, 214;
  --text: #e9eefb;
  --muted: #9aa8c7;
  --dim: #6d7a99;
  --mint: #4fd6a0;
  --mint-2: #7de9bd;
  --mint-deep: #2fae7f;
  --mint-rgb: 79, 214, 160;
  --on-mint: #04231a;
  --violet: #9d8bf5;
  --violet-rgb: 157, 139, 245;
  --violet-soft: #c9bdff;
  --on-violet: #0f0a26;
  --rose: #fb7185;
  --danger: #ff8181;
  --danger-deep: #e8536a;
  --danger-soft: #ffa8b3;
  --danger-rgb: 255, 129, 129;
  --danger-text: #ffd2d2;
  --ok-text: #b6f3d6;
  --sky: #5fc7e8;
  --sky-soft: #a5e6f7;
  --sky-rgb: 95, 199, 232;
  --sky-text: #bdefff;
  --warn: #f3b13c;
  --warn-soft: #f8d78c;
  --warn-rgb: 243, 177, 60;
  --on-warn: #241703;
  --knob: #ffffff;
  --shadow-rgb: 2, 6, 16;
  --overlay-rgb: 2, 5, 12;
  --shadow: 0 20px 56px rgba(var(--shadow-rgb), .55);
  --glow: 0 0 0 rgba(0, 0, 0, 0);
}

/* 抹茶:浅绿奶油,清爽可爱 */
[data-theme="matcha"] {
  color-scheme: light;
  --bg: #f2f7ec;
  --bg-2: #e8f0e0;
  --surface: #ffffff;
  --surface-2: #f7fbf2;
  --surface-solid: #ffffff;
  --card-a: #ffffff;
  --card-b: #f6fbef;
  --sunken: #edf4e6;
  --control-bg: #ffffff;
  --control-hover: #eef6e6;
  --control-focus: #ffffff;
  --input-bg: #ffffff;
  --menu-bg: #ffffff;
  --chip-bg: #f4faea;
  --th-bg: #eaf2e0;
  --rail-a: #ffffff;
  --rail-b: #eff6e7;
  --drawer-a: #ffffff;
  --line: rgba(52, 84, 48, .18);
  --line-strong: rgba(52, 84, 48, .32);
  --line-rgb: 52, 84, 48;
  --text: #1d2a1c;
  --muted: #556b52;
  --dim: #7d9179;
  --mint: #3f8f5f;
  --mint-2: #5cb47c;
  --mint-deep: #2b7048;
  --mint-rgb: 63, 143, 95;
  --on-mint: #f5fff8;
  --violet: #6d63c9;
  --violet-rgb: 109, 99, 201;
  --violet-soft: #c6c1f0;
  --on-violet: #fdfbff;
  --rose: #cf5544;
  --danger: #b8452f;
  --danger-deep: #9c3623;
  --danger-soft: #eda99b;
  --danger-rgb: 184, 69, 47;
  --danger-text: #7a2a1b;
  --ok-text: #23613f;
  --sky: #2b7fa5;
  --sky-soft: #aad6e8;
  --sky-rgb: 43, 127, 165;
  --sky-text: #17536b;
  --warn: #a8791a;
  --warn-soft: #f2dca0;
  --warn-rgb: 168, 121, 26;
  --on-warn: #fffaf0;
  --knob: #ffffff;
  --shadow-rgb: 44, 70, 42;
  --overlay-rgb: 30, 46, 30;
  --shadow: 0 16px 38px rgba(var(--shadow-rgb), .12);
  --glow: 0 0 0 rgba(0, 0, 0, 0);
}


* { box-sizing: border-box; }

/* hidden 必须压过一切 display 规则:登录卡片用 display:grid 布局时,
   仅仅设置 hidden 属性并不会隐藏它。 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 0 0 0 96px;
  min-height: 100dvh;
  font: 14.5px/1.7 var(--sans);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(var(--mint-rgb), .18);
}

/* 键盘用户先看到跳转入口,鼠标用户看不到 */
.skip-link {
  position: fixed; top: var(--s3); left: var(--s3); z-index: 60;
  padding: 10px 16px; border-radius: 999px;
  background: var(--surface-solid); border: 1px solid rgba(var(--mint-rgb), .5);
  color: var(--mint); font-size: 13px; text-decoration: none;
  transform: translateY(-160%); opacity: 0;
  transition: transform .2s var(--spring), opacity .2s ease;
}
.skip-link:focus-visible { transform: none; opacity: 1; }

/* ---------- 背景:随主题变化的柔和色场 + 细网格 + 纸纹 ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.blob {
  position: absolute;
  width: 52vw;
  height: 52vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .28;
  animation: drift 30s ease-in-out infinite alternate;
}
.blob-a { background: radial-gradient(circle, var(--mint), transparent 66%); top: -18vw; left: -10vw; }
.blob-b { background: radial-gradient(circle, var(--sky), transparent 66%); top: 4vw; right: -16vw; animation-delay: -9s; opacity: .2; }
.blob-c { background: radial-gradient(circle, var(--violet), transparent 70%); bottom: -22vw; left: 20vw; animation-delay: -16s; opacity: .16; }
.mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--line-rgb), .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--line-rgb), .07) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(1000px 640px at 50% 0%, #000 28%, transparent 76%);
}
/* 纸纹:极淡的斜向颗粒,让浅色主题不像纯色画布 */
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image: repeating-linear-gradient(115deg,
    rgba(var(--line-rgb), .05) 0 1px, transparent 1px 4px);
}
[data-theme="midnight"] .aurora::after { opacity: .25; }
[data-theme="midnight"] .blob { opacity: .34; filter: blur(100px); }

/* ---------- 左侧导航 ---------- */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 24px 0 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--rail-a), var(--rail-b));
  backdrop-filter: blur(14px);
  z-index: 5;
}
.brand { display: grid; place-items: center; text-decoration: none; }

/* 吉祥物:圆润的小光团,会眨眼、会浮动 */
/* ---------- 品牌 IP「小狐狸信使」 ----------
   母体:Character(身份来自轮廓、耳朵、尾巴)。
   语义:它是把你请求"送出去"的信使;尾巴摆动=链路活跃。
   真实尺寸优先:侧栏 46px 只保留剪影级细节,登录页 96px 才显示腮红与鼻子。
   状态由 JS 写入 data-state:idle / busy / cooling / warn。 */
.mascot {
  display: block;
  width: 46px;
  height: 46px;
  overflow: visible;
  animation: float 6s ease-in-out infinite;
  filter: drop-shadow(0 6px 14px rgba(var(--shadow-rgb), .28));
}
.mascot-lg { width: 96px; height: 96px; margin: 0 auto var(--s5); }

.f-head { fill: url(#fox-head); }
/* SVG 表现属性不支持 var(),渐变停止点在这里重定向到主题变量 */
.mascot stop:first-of-type { stop-color: var(--mint-2); }
.mascot stop:last-of-type { stop-color: var(--mint-deep); }
.mascot-lg .f-head { fill: url(#fox-head-lg); }
.f-ear { fill: var(--mint-deep); transform-box: fill-box; transform-origin: center bottom; }
.f-tail {
  fill: none; stroke: var(--mint-deep); stroke-width: 5; stroke-linecap: round;
  transform-box: fill-box; transform-origin: left center;
  animation: tailWag 3.4s ease-in-out infinite;
}
.f-eye { fill: var(--on-mint); transform-box: fill-box; transform-origin: center; animation: blink 4.8s ease-in-out infinite; }
.f-blush { fill: var(--rose); opacity: .35; }
.f-nose { fill: var(--on-mint); opacity: .8; }
/* 46px 下腮红和鼻子会糊成一团,隐藏掉 */
.rail .mascot .f-blush, .rail .mascot .f-nose { display: none; }

@keyframes tailWag {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}

/* 状态 */
.mascot[data-state="busy"] { animation: float 2.6s ease-in-out infinite; }
.mascot[data-state="busy"] .f-tail { animation-duration: 1.1s; }
.mascot[data-state="busy"] .f-ear { animation: earTwitch 1.4s ease-in-out infinite; }
.mascot[data-state="cooling"] .f-eye { animation: none; transform: scaleY(.18); }
.mascot[data-state="cooling"] .f-ear { transform: rotate(-9deg) translateY(1px); }
.mascot[data-state="cooling"] .f-tail { animation-duration: 5s; opacity: .6; }
.mascot[data-state="cooling"] .f-head { filter: saturate(.75); }
.mascot[data-state="warn"] { animation: shake 1.6s ease-in-out infinite; }
.mascot[data-state="warn"] .f-eye { animation: none; transform: scaleY(.4) rotate(10deg); }
.mascot[data-state="warn"] .f-head { filter: hue-rotate(-24deg) saturate(1.1); }

@keyframes earTwitch {
  0%, 100% { transform: rotate(0) translateY(0); }
  40% { transform: rotate(3deg) translateY(-1px); }
  70% { transform: rotate(-2deg); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-1.4px) rotate(-1.6deg); }
  75% { transform: translateX(1.4px) rotate(1.6deg); }
}

/* 主题切换按钮 */
.theme-toggle {
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--control-bg);
  color: var(--text); font-size: 13px; font-weight: 700;
  transition: transform .2s var(--spring), border-color .2s ease, background .2s ease;
}
.theme-toggle:hover { transform: rotate(-6deg) scale(1.06); border-color: rgba(var(--mint-rgb), .6); }
.theme-toggle:active { transform: scale(.94); }

.rail-bottom { margin-top: auto; display: grid; justify-items: center; gap: 14px; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(var(--mint-rgb), .7);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--mint-rgb), .55); }
  70% { box-shadow: 0 0 0 12px rgba(88, 226, 182, 0); }
  100% { box-shadow: 0 0 0 0 rgba(88, 226, 182, 0); }
}
#logout { writing-mode: vertical-rl; padding: 10px 6px; }

/* ---------- 主区域 ---------- */
main { width: min(1200px, 100%); margin: 0 auto; padding: var(--s7) var(--s8) var(--s9); }

/* 视图内部统一用 grid 间距,不再靠各自的 margin 拼凑 */
#usage-view, #keys-view, #channels-view { display: grid; gap: var(--s6); align-content: start; }
#overview { display: grid; gap: var(--s5); align-content: start; }

h1, h2, h3 { text-wrap: balance; }
section[id], h1[id], h2[id] { scroll-margin-top: var(--s6); }
button, a, select, .select-trigger { touch-action: manipulation; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); }
.api-chip {
  margin: 0;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 12.5px;
  transition: border-color .2s ease, background .2s ease;
}
.api-chip:hover { border-color: var(--line-strong); background: var(--control-bg); }
.api-chip code { font: 12.5px var(--mono); color: var(--mint); }

h1 { margin: 0; font-size: 28px; letter-spacing: -.5px; }
h2 { margin: 0; font-size: 15.5px; letter-spacing: .2px; }
p { margin: 0; }
.subtle, .field-help, .updated { color: var(--muted); font-size: 13px; }

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s4) var(--s6); flex-wrap: wrap;
}
.page-header p { margin-top: var(--s2); }

/* 视图切换时的入场动画:display 从 none 恢复后动画会重新播放 */
#usage-view:not([hidden]), .channel-view:not([hidden]) { animation: viewIn .34s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 按钮 ---------- */
button {
  position: relative;
  overflow: hidden;
  font: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--control-bg);
  color: var(--text);
  padding: 10px 18px;
  min-height: 40px;
  cursor: pointer;
  transition: transform .16s var(--spring), box-shadow .2s ease, background .2s ease, border-color .2s ease, opacity .2s;
}
button:hover {
  border-color: rgba(var(--line-rgb), .55);
  background: var(--control-hover);
  box-shadow: 0 6px 18px rgba(var(--shadow-rgb), .32), inset 0 1px 0 rgba(255, 255, 255, .06);
  filter: brightness(1.07);
}
button:active { transform: scale(.97); filter: brightness(.96); }
button:disabled { opacity: .5; cursor: progress; transform: none; box-shadow: none; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(var(--mint-rgb), .85);
  outline-offset: 2px;
}
.primary {
  border: 0;
  color: var(--on-mint);
  font-weight: 700;
  background: linear-gradient(135deg, var(--mint-2), var(--mint) 55%, var(--mint-deep));
  box-shadow: 0 14px 30px rgba(var(--mint-rgb), .3);
}
.primary::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .65s ease;
}
.primary:hover::after { transform: translateX(120%); }
.accent {
  border-color: rgba(var(--violet-rgb), .5);
  background: linear-gradient(135deg, rgba(var(--violet-rgb), .95), rgba(var(--violet-rgb), .95));
  color: var(--on-violet); font-weight: 700;
  box-shadow: 0 12px 26px rgba(var(--violet-rgb), .3);
}
.ghost { background: var(--control-bg); }
.ghost:hover { background: var(--control-hover); }
.wide { width: 100%; padding: 13px; }
.quiet-button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 19px; line-height: 1; padding: 6px 10px; border-radius: 12px;
  transition: color .18s ease, background .18s ease, transform .18s var(--spring);
}
.quiet-button:hover { color: var(--text); background: rgba(var(--line-rgb), .14); }

/* 点击涟漪:由 console.js 注入 span.ripple */
.ripple {
  position: absolute;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--mint-rgb), .38), transparent 62%);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: ripple .6s ease-out forwards;
}
@keyframes ripple { to { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } }

/* ---------- 分段控件 ---------- */
.segmented {
  display: inline-flex; gap: 4px; padding: 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--control-bg);
}
.segmented button {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 16px; min-height: 34px; border-radius: 999px; font-size: 13px;
  transition: color .2s ease, background .2s ease, transform .2s var(--spring);
}
.segmented button:hover { color: var(--text); background: rgba(var(--line-rgb), .12); }
.segmented button[aria-pressed="true"] {
  color: var(--on-mint);
  background: linear-gradient(135deg, var(--mint-2), var(--mint));
  box-shadow: 0 8px 18px rgba(var(--mint-rgb), .3);
  font-weight: 700;
  animation: tabPop .3s var(--spring);
}
@keyframes tabPop { 0% { transform: scale(.9); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.filters { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
select {
  font: inherit; color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  max-width: min(220px, 60vw);
  transition: border-color .18s ease, box-shadow .18s ease;
}
select:hover { border-color: rgba(var(--line-rgb), .5); }

/* ---------- 登录 ---------- */
.login { min-height: calc(100dvh - 60px); display: grid; place-items: center; padding: 20px; }
.login-card {
  position: relative;
  width: min(430px, 100%);
  padding: 36px 32px 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, var(--card-a), var(--surface-solid));
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise .55s var(--spring) both;
}
/* 柔和流动的渐变描边 */
.login-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--angle),
    rgba(var(--mint-rgb), .8), rgba(var(--violet-rgb), .75), rgba(var(--sky-rgb), .75), rgba(var(--mint-rgb), .8));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderSpin 9s linear infinite;
  pointer-events: none;
}
@keyframes borderSpin { to { --angle: 360deg; } }
.login-card h1 { font-size: 25px; }
.login-hint { color: var(--muted); font-size: 13px; margin: 10px 0 26px; }
.login-card label { display: block; text-align: left; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.login-foot { margin-top: 18px; color: var(--dim); font-size: 11.5px; }

/* ---------- 输入框 ---------- */
input[type="text"], input[type="password"], input[type="url"], input:not([type]), textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color .18s ease, box-shadow .22s ease, background .18s ease, transform .18s var(--spring);
}
input:hover, textarea:hover { border-color: rgba(var(--line-rgb), .45); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(var(--mint-rgb), .7);
  box-shadow: 0 0 0 4px rgba(var(--mint-rgb), .16);
  background: var(--control-focus);
}
input::placeholder { color: var(--dim); }

/* ---------- 指标卡 ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s5);
}
@media (max-width: 1080px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metric {
  position: relative;
  overflow: hidden;
  padding: var(--s5) var(--s5) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--card-a), var(--sunken));
  box-shadow: var(--shadow);
  animation: rise .55s var(--spring) both;
  transition: transform .24s var(--spring), border-color .24s ease, box-shadow .24s ease;
}
.metric:hover { transform: translateY(-5px); border-color: var(--line-strong); box-shadow: 0 26px 50px rgba(var(--shadow-rgb), .6); }
.metric:nth-child(1) { animation-delay: .04s; }
.metric:nth-child(2) { animation-delay: .1s; }
.metric:nth-child(3) { animation-delay: .16s; }
.metric:nth-child(4) { animation-delay: .22s; }
.metric h2 { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .7px; }
.metric strong { display: block; margin: 10px 0 6px; font-size: 33px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.metric p { color: var(--dim); font-size: 12px; }
.metric-icon {
  position: absolute; top: 18px; right: 20px;
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 12px; font-size: 15px;
  border: 1px solid var(--line);
  transition: transform .28s var(--spring);
}
.metric:hover .metric-icon { transform: rotate(-8deg) scale(1.08); }
.metric-glow { position: absolute; inset: auto -20% -62% -20%; height: 100px; filter: blur(24px); opacity: .5; transition: opacity .3s ease; }
.metric:hover .metric-glow { opacity: .8; }
.metric[data-tone="mint"] strong, .metric[data-tone="mint"] .metric-icon { color: var(--mint); }
.metric[data-tone="mint"] .metric-glow { background: radial-gradient(circle, var(--mint), transparent 70%); }
.metric[data-tone="violet"] strong, .metric[data-tone="violet"] .metric-icon { color: var(--violet); }
.metric[data-tone="violet"] .metric-glow { background: radial-gradient(circle, #8b5cf6, transparent 70%); }
.metric[data-tone="rose"] strong, .metric[data-tone="rose"] .metric-icon { color: var(--rose); }
.metric[data-tone="rose"] .metric-glow { background: radial-gradient(circle, #fb7185, transparent 70%); }
.metric[data-tone="sky"] strong, .metric[data-tone="sky"] .metric-icon { color: var(--sky); }
.metric[data-tone="sky"] .metric-glow { background: radial-gradient(circle, var(--sky), transparent 70%); }

/* ---------- 面板与图表 ---------- */
.panel {
  padding: var(--s6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise .55s var(--spring) both;
}
.panel + .panel { margin-top: 0; }
.panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s3) var(--s5); flex-wrap: wrap; margin-bottom: var(--s5);
}
.panel-header p { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.chart { display: flex; gap: var(--s4); height: 260px; }
.ticks {
  display: flex; flex-direction: column; justify-content: space-between;
  font: 11px var(--mono); color: var(--dim); width: 48px; text-align: right;
}
.plot { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bars {
  flex: 1; display: flex; align-items: stretch; gap: var(--bar-gap);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  /* 兜底高度:即使外层容器被压扁,柱子依然有可见的绘制区域。 */
  min-height: 160px;
}
.bar {
  /* 高度必须确定:柱内各段用百分比高度,父级高度自适应会让它们退化成 0。 */
  flex: 1; height: 100%; display: flex; flex-direction: column-reverse; justify-content: flex-start;
  gap: 3px; padding: 0; border: 0; border-radius: 10px 10px 5px 5px;
  background: transparent; cursor: pointer; overflow: visible;
  transition: background .18s ease;
}
.bar:hover { background: rgba(var(--line-rgb), .12); }
.segment {
  display: block; width: 100%; min-height: 3px; border-radius: 6px;
  transform-origin: bottom;
  animation: grow .7s var(--spring) both;
}
.segment.success { background: linear-gradient(180deg, var(--mint-2), var(--mint-deep)); box-shadow: 0 0 16px rgba(var(--mint-rgb), .35); }
.segment.failure { background: linear-gradient(180deg, var(--danger-soft), var(--danger-deep)); }
.segment.cancelled { background: linear-gradient(180deg, var(--violet-soft), #8b5cf6); }
.segment.tokens { background: linear-gradient(180deg, var(--sky-soft), var(--sky)); box-shadow: 0 0 16px rgba(var(--sky-rgb), .3); }
@keyframes grow { from { transform: scaleY(.02); opacity: .2; } to { transform: scaleY(1); opacity: 1; } }
.labels {
  display: flex; gap: var(--bar-gap);
  color: var(--dim); font: 11px var(--mono); padding-top: var(--s2);
}
.labels span { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: var(--s2) var(--s5); flex-wrap: wrap; justify-content: center; margin-top: var(--s5); color: var(--muted); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; transition: transform .18s var(--spring); }
.legend span:hover { color: var(--text); }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--dim); }
.legend .key-success::before { background: var(--mint); }
.legend .key-failure::before { background: var(--rose); }
.legend .key-cancelled::before { background: var(--violet); }
.legend .key-tokens::before { background: var(--sky); }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; max-height: 56vh; border-radius: var(--radius-sm); scrollbar-gutter: stable; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 15px; text-align: left; font-size: 13px; white-space: nowrap; }
th {
  position: sticky; top: 0; z-index: 1;
  background: var(--th-bg);
  color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: .4px;
  border-bottom: 1px solid var(--line-strong);
  backdrop-filter: blur(8px);
}
tbody tr {
  border-bottom: 1px solid rgba(var(--line-rgb), .08);
  animation: rowIn .34s var(--ease) both;
  transition: background .16s ease;
}
tbody tr:nth-child(1) { animation-delay: .01s; }
tbody tr:nth-child(2) { animation-delay: .04s; }
tbody tr:nth-child(3) { animation-delay: .07s; }
tbody tr:nth-child(4) { animation-delay: .1s; }
tbody tr:nth-child(5) { animation-delay: .13s; }
tbody tr:nth-child(n+6) { animation-delay: .16s; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
tbody tr:hover { background: rgba(var(--line-rgb), .07); }
td small { display: block; color: var(--dim); font-size: 11px; margin-top: 4px; }
td.empty { text-align: center; color: var(--dim); padding: 32px; }
.low-quota { color: var(--amber); }
.cooling { color: var(--violet); }
.updated { text-align: right; }

/* ---------- 渠道卡片 ---------- */
.channel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--s5); }
.channel-card {
  position: relative;
  padding: var(--s6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--card-a), var(--card-b));
  box-shadow: var(--shadow);
  animation: rise .5s var(--spring) both;
  transition: transform .24s var(--spring), border-color .24s ease, box-shadow .24s ease;
}
.channel-card:hover { transform: translateY(-4px); border-color: rgba(var(--mint-rgb), .35); box-shadow: 0 28px 54px rgba(var(--shadow-rgb), .62); }
.channel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.channel-identity { min-width: 0; display: grid; gap: var(--s2); }
.channel-identity h2 { font-size: 17px; }
.channel-identity code { font: 11.5px var(--mono); color: var(--muted); overflow-wrap: anywhere; white-space: normal; }
.channel-status {
  flex: none; padding: 5px 12px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid var(--line-strong);
  transition: transform .2s var(--spring);
}
.channel-card:hover .channel-status { transform: scale(1.04); }
.channel-status.ready { color: var(--mint); border-color: rgba(var(--mint-rgb), .45); background: rgba(var(--mint-rgb), .12); }
.channel-status.paused { color: var(--amber); border-color: rgba(var(--warn-rgb), .4); background: rgba(var(--warn-rgb), .1); }
.channel-status.pending { color: var(--muted); }
.channel-models { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: var(--s2); }
.channel-models li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; flex-wrap: wrap; }
.channel-models code {
  font: 11.5px var(--mono); background: rgba(var(--line-rgb), .1);
  padding: 3px 9px; border-radius: 8px;
  transition: background .18s ease, color .18s ease;
}
.channel-models li:hover code { background: rgba(var(--mint-rgb), .16); color: #c8ffee; }
.mapping-arrow { color: var(--dim); }
.channel-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s5); }
.channel-actions button { padding: 8px 14px; min-height: 36px; font-size: 12.5px; }
.channel-source { color: var(--dim); font-size: 11.5px; align-self: center; }
.probe-result {
  margin-top: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  background: rgba(var(--mint-rgb), .1); border: 1px solid rgba(var(--mint-rgb), .28);
  color: var(--ok-text); font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere;
  animation: rise .32s var(--spring) both;
}
.probe-error { background: rgba(var(--danger-rgb), .1); border-color: rgba(var(--danger-rgb), .35); color: var(--danger-text); }
.egress-warning { color: var(--amber) !important; }

/* ---------- 密钥表动作 ---------- */
.key-actions { display: inline-flex; gap: 8px; align-items: center; }
.key-actions button { padding: 6px 12px; font-size: 12px; border-radius: 10px; }
.pin-button.pinned { color: var(--on-warn); background: linear-gradient(135deg, var(--warn-soft), var(--warn)); border-color: transparent; font-weight: 700; }
.key-result { color: var(--mint); font-size: 12px; margin-left: 8px; }
.key-result.bad { color: var(--danger); }
.key-result.testing { color: var(--sky); animation: flash 1s ease-in-out infinite; }
@keyframes flash { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ---------- 抽屉 ---------- */
.drawer {
  width: min(720px, 94vw);
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: linear-gradient(180deg, var(--surface-solid), var(--drawer-a));
  color: var(--text);
  box-shadow: 0 34px 90px rgba(var(--shadow-rgb), .78);
  overflow: hidden;
  overscroll-behavior: contain;
}
.drawer[open] { animation: pop .38s var(--spring) both; }
.drawer.closing { animation: popOut .2s ease both; }
.drawer::backdrop { background: rgba(var(--overlay-rgb), .66); backdrop-filter: blur(7px); animation: fade .26s ease both; }
.drawer.closing::backdrop { animation: fadeOut .2s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(22px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
#channel-form { display: flex; flex-direction: column; max-height: 88dvh; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s5) var(--s6); border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 18px; }
.drawer-fields { padding: var(--s5) var(--s6) var(--s6); overflow: auto; display: grid; gap: var(--s5); overscroll-behavior: contain; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.drawer-fields label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: var(--s2); }
.drawer-fields legend { font-size: 12.5px; color: var(--muted); padding: 0 6px; }
.model-editor {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--s4); margin: 0; background: var(--sunken);
  display: grid; gap: var(--s3);
  animation: rise .4s var(--spring) both;
}
.model-row, .key-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--s3); align-items: start; }
.key-row { grid-template-columns: .8fr 1.4fr auto; }
.model-row input, .key-row input { margin: 0; font: 12px var(--mono); }
.model-field { display: grid; gap: 6px; animation: rise .3s var(--spring) both; }
.model-field label { font-size: 11px; color: var(--dim); margin: 0; }
.model-field input { margin: 0; }
.remove-model { align-self: center; }
.preset { display: flex; gap: 10px; }
.preset button { font-size: 12.5px; }
.provider-note {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(var(--sky-rgb), .1); border: 1px solid rgba(var(--sky-rgb), .28);
  color: var(--sky-text); font-size: 12.5px; display: grid; gap: 6px;
}
.provider-note a { color: var(--sky); text-underline-offset: 3px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); cursor: pointer; }
/* 开关样式:滑块的过渡让切换有反馈 */
.check-row input {
  appearance: none;
  width: 38px; height: 22px; border-radius: 999px;
  background: rgba(var(--line-rgb), .25);
  position: relative; cursor: pointer; margin: 0;
  transition: background .22s ease;
}
.check-row input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--knob);
  transition: transform .26s var(--spring);
}
.check-row input:checked { background: linear-gradient(135deg, var(--mint-2), var(--mint)); }
.check-row input:checked::after { transform: translateX(16px); }
.drawer-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: var(--s4) var(--s6); border-top: 1px solid var(--line);
  background: var(--drawer-a);
}

/* ---------- 提示与通知 ---------- */
.notice {
  margin: 0; padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--danger-text);
  background: rgba(var(--danger-rgb), .12); border: 1px solid rgba(var(--danger-rgb), .32);
  animation: rise .32s var(--spring) both;
}
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  margin: 0; padding: 12px 22px; border-radius: 999px;
  background: var(--surface-solid); border: 1px solid rgba(var(--mint-rgb), .4);
  color: var(--mint); font-size: 12.5px; box-shadow: var(--shadow);
  animation: toastIn .34s var(--spring) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 加载中的扫光 */
.channel-list[aria-busy="true"] { position: relative; }
.channel-list[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  background: linear-gradient(100deg, transparent 20%, rgba(var(--line-rgb), .12) 45%, transparent 70%);
  animation: sweep 1.4s linear infinite;
}
@keyframes sweep { from { transform: translateX(-60%); } to { transform: translateX(60%); } }

/* ---------- 自定义下拉:系统 select 的弹层无法美化,这里只把它当取值来源 ---------- */
.select { position: relative; display: inline-flex; min-width: 172px; max-width: min(260px, 70vw); }
.select-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.select-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: var(--s3);
  width: 100%; min-height: 40px; padding: 9px 14px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--control-bg); color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .2s ease, filter .2s ease;
}
.select-trigger:hover { border-color: rgba(var(--line-rgb), .55); background: var(--control-hover); filter: brightness(1.06); }
.select-trigger[aria-expanded="true"] {
  border-color: rgba(var(--mint-rgb), .7);
  box-shadow: 0 0 0 4px rgba(var(--mint-rgb), .14);
}
.select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-caret {
  flex: none; width: 0; height: 0; opacity: .6;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor;
  transition: transform .22s var(--spring), opacity .2s ease;
}
.select-trigger[aria-expanded="true"] .select-caret { transform: rotate(180deg); opacity: 1; }
.select-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  min-width: 100%; max-height: 300px; overflow: auto;
  padding: 6px; border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--menu-bg);
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
  transform-origin: top center;
  animation: menuIn .18s var(--spring) both;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.select-option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 9px 12px; border-radius: 11px; font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
  transition: background .14s ease, color .14s ease;
}
.select-option[data-active="true"] { background: rgba(var(--line-rgb), .14); }
.select-option[aria-selected="true"] { color: var(--mint); font-weight: 600; }
.select-option[aria-selected="true"]::after { content: "✓"; font-size: 12px; }

#navigation { display: flex; flex-direction: column; gap: var(--s2); width: 100%; align-items: center; }
#navigation a {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 74px;
  padding: 10px 0 8px;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11.5px;
  letter-spacing: .4px;
  transition: color .18s ease, background .18s ease;
}
#navigation a svg {
  width: 21px; height: 21px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .22s var(--spring);
}
#navigation a:hover { color: var(--text); background: rgba(var(--line-rgb), .12); }
#navigation a:hover svg { transform: translateY(-1px) scale(1.06); }
#navigation a:active { background: rgba(var(--line-rgb), .18); }
#navigation a[aria-current="page"] {
  color: var(--mint-2);
  background: rgba(var(--mint-rgb), .14);
  font-weight: 700;
}
/* 选中项用左侧竖条标识,比整块填充更安静 */
#navigation a[aria-current="page"]::before {
  content: "";
  position: absolute; left: -10px; top: 50%;
  width: 3px; height: 22px; border-radius: 3px;
  background: var(--mint);
  transform: translateY(-50%);
  box-shadow: 0 0 12px rgba(var(--mint-rgb), .6);
}
#navigation a[aria-current="page"] svg { transform: none; }

.rail-bottom {
  margin-top: auto;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s3); width: 100%;
}
#logout, .logout {
  writing-mode: horizontal-tb;
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}
#logout:hover, .logout:hover { color: var(--text); border-color: var(--line-strong); background: rgba(var(--line-rgb), .12); }
.live-dot { width: 8px; height: 8px; }

/* ---------- 响应式 ---------- */
/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  body { padding: 0 0 86px; }
  .rail {
    inset: auto 0 0 0; width: 100%; height: 76px; flex-direction: row;
    justify-content: space-between; padding: 0 18px;
    border-right: 0; border-top: 1px solid var(--line);
  }
  .brand .mascot { width: 40px; height: 40px; border-radius: 13px; }
  #navigation { flex-direction: row; justify-content: center; gap: var(--s2); width: auto; }
  #navigation a { width: 68px; padding: 7px 0 5px; }
  .theme-toggle { width: 36px; height: 36px; }
  #navigation a[aria-current="page"]::before { display: none; }
  .rail-bottom { margin: 0; display: flex; flex-direction: row; align-items: center; gap: var(--s3); }
  #logout { writing-mode: horizontal-tb; padding: 7px 12px; font-size: 12px; }
  main { padding: var(--s5) var(--s4) var(--s8); }
  .chart { height: 200px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: var(--s4); }
  .field-grid { grid-template-columns: 1fr; }
  .select { flex: 1; min-width: 0; max-width: none; }
  .model-row, .key-row { grid-template-columns: 1fr 1fr auto; }
  .channel-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
