/* ============================================================
   YY卡密授权平台 — 视觉层
   设计语言对齐原站：薄荷绿主色 / 彩虹描边卡片 / 网格底纹 / 明暗双主题
   ============================================================ */

:root {
  --background: 240 10% 98%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 158 64% 42%;
  --radius: 0.75rem;
  --mint: #10b981;
  --mint-light: #34d399;
  --mint-dark: #059669;
  --mint-ring: rgba(16, 185, 129, 0.18);
  --shadow: 0 10px 40px -12px rgba(9, 9, 11, 0.12);
}

html.dark {
  --background: 0 0% 8.6%;
  --foreground: 0 0% 98%;
  --card: 0 0% 10.2%;
  --card-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 0 0% 9%;
  --muted: 0 0% 15%;
  --muted-foreground: 0 0% 65%;
  --accent: 0 0% 15%;
  --accent-foreground: 0 0% 98%;
  --border: 0 0% 15%;
  --input: 0 0% 15%;
  --ring: 158 64% 52%;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

::selection { background: rgba(16, 185, 129, 0.15); }

a { color: inherit; text-decoration: none; }

button, input, textarea, select { font-family: inherit; font-size: inherit; }

h1, h2, h3, h4, p { margin: 0; }

svg { display: block; }

/* ---------------------------- 背景装饰 ---------------------------- */
.grid-bg {
  position: fixed; inset: 0; z-index: -1;
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, hsl(var(--border) / 0.5) 1px, transparent 1px),
    linear-gradient(to bottom, hsl(var(--border) / 0.5) 1px, transparent 1px);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  pointer-events: none;
}

.bg-image {
  position: fixed; inset: 0; z-index: -2;
  background-size: cover; background-position: center; opacity: 0.1;
  pointer-events: none;
}

/* 前台自定义背景（后台「前台背景」设置，由 App.applyBackground 应用） */
html.has-bg { background-color: #0b0f19; }
html.has-bg body { background: transparent; }
html.has-bg .grid-bg { display: none; }
html.has-bg::before {
  content: '';
  position: fixed; inset: -32px; z-index: -1;
  background-image: var(--bg-image, none);
  background-color: transparent;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--bg-blur, 0px));
  pointer-events: none;
}
html.has-bg::after {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: rgba(0, 0, 0, var(--bg-overlay, 0.3));
  pointer-events: none;
}

/* ---------------------------- 站点头部 ---------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  width: 100%;
  border-bottom: 1px solid hsl(var(--border) / 0.4);
  background: hsl(var(--background) / 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex; align-items: center; gap: 8px;
  height: 64px; padding: 0 24px;
  max-width: 1200px; margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0; }

.brand-mark {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px;
  background: hsl(var(--foreground)); color: hsl(var(--background));
}

.brand-mark svg { width: 18px; height: 18px; }

.brand-text { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.brand-text .accent { color: var(--mint); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: hsl(var(--muted-foreground));
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.icon-btn svg { width: 17px; height: 17px; }

html:not(.dark) .icon-sun { display: none; }
html.dark .icon-moon { display: none; }

/* ---------------------------- 按钮 ---------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid transparent;
  background: transparent; color: hsl(var(--foreground));
  font-size: 13.5px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s, opacity 0.15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--mint-ring); }

.btn-primary {
  background: var(--mint); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(16, 185, 129, 0.6);
}
.btn-primary:hover:not(:disabled) { background: var(--mint-dark); }
.btn-primary:active:not(:disabled) { transform: scale(0.985); }

.btn-dark {
  background: #27272a; color: #fff; border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.btn-dark:hover:not(:disabled) { background: #3f3f46; }
.btn-dark:active:not(:disabled) { transform: scale(0.985); }
html.dark .btn-dark { background: #f4f4f5; color: #18181b; border-color: transparent; }
html.dark .btn-dark:hover:not(:disabled) { background: #e4e4e7; }

.btn-outline {
  border-color: hsl(var(--input)); background: transparent; color: hsl(var(--foreground));
}
.btn-outline:hover:not(:disabled) { background: hsl(var(--accent)); }

.btn-ghost { color: hsl(var(--muted-foreground)); }
.btn-ghost:hover:not(:disabled) { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

.btn-danger { color: #ef4444; }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.1); }

.btn-block { width: 100%; }
.btn-lg { height: 44px; font-size: 14.5px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-sm svg { width: 14px; height: 14px; }

/* ---------------------------- 表单 ---------------------------- */
.field { margin-bottom: 18px; }

.field-label {
  display: block; margin-bottom: 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: hsl(var(--muted-foreground)); padding-left: 2px;
}
.field-label .badge { margin-left: 6px; text-transform: none; letter-spacing: 0; }

.input, .textarea, .select {
  width: 100%; height: 42px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background) / 0.55);
  color: hsl(var(--foreground));
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground) / 0.75); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px var(--mint-ring);
  background: hsl(var(--card));
}
.input[readonly] { color: hsl(var(--muted-foreground)); background: hsl(var(--muted) / 0.6); cursor: default; }

.textarea { height: auto; min-height: 84px; padding: 11px 13px; resize: vertical; line-height: 1.6; }

.input-wrap { position: relative; }
.input-wrap .input { padding-left: 38px; }
.input-wrap .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: hsl(var(--muted-foreground)); pointer-events: none;
  transition: color 0.15s;
}
.input-wrap .input-icon svg { width: 16px; height: 16px; }
.input-wrap:focus-within .input-icon { color: var(--mint); }

.check-row { display: flex; align-items: center; gap: 8px; }
.checkbox {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; flex-shrink: 0;
  border: 1px solid hsl(var(--input));
  border-radius: 4px;
  background: hsl(var(--background));
  cursor: pointer; position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.checkbox:checked { background: var(--mint); border-color: var(--mint); }
.checkbox:checked::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 11px;
}
.check-label {
  font-size: 12.5px; color: hsl(var(--muted-foreground)); cursor: pointer;
  user-select: none;
}

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 42px; height: 24px; border-radius: 999px;
  background: hsl(var(--input)); transition: background 0.2s;
  position: relative; flex-shrink: 0;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--mint); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }

/* ---------------------------- 彩虹描边卡片 ---------------------------- */
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

@keyframes rotate-border { to { --angle: 360deg; } }

.rainbow-border {
  position: relative;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card) / 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 1;
}
.rainbow-border::before {
  content: ""; position: absolute; inset: -1px; padding: 2px;
  border-radius: var(--radius);
  background: conic-gradient(from var(--angle), transparent 70%, #10b981, #6ee7b7, #ffffff, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: rotate-border 3s linear infinite;
  pointer-events: none; z-index: -1;
}

.fade-in { animation: fadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; }
.fade-in.d1 { animation-delay: 0.06s; }
.fade-in.d2 { animation-delay: 0.12s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------- 登录页 ---------------------------- */
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; }
.auth-shell { width: 100%; max-width: 400px; }
.auth-card { box-shadow: 0 25px 60px -30px rgba(16, 185, 129, 0.35), var(--shadow); }
.auth-body { padding: 32px; }

.auth-head { text-align: center; margin-bottom: 26px; }
.auth-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin-bottom: 14px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.1); color: var(--mint);
}
.auth-icon svg { width: 24px; height: 24px; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: hsl(var(--muted-foreground)); }

.auth-form .field { margin-bottom: 16px; }
.auth-form .btn { margin-top: 4px; }

.auth-foot {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid hsl(var(--border) / 0.6);
  display: flex; justify-content: center; gap: 6px;
  font-size: 12px; color: hsl(var(--muted-foreground));
}
.auth-foot a { color: hsl(var(--muted-foreground)); transition: color 0.15s; }
.auth-foot a:hover { color: var(--mint); }

.fp-line {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 14px; font-size: 11px; color: hsl(var(--muted-foreground) / 0.8);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}
.fp-line svg { width: 12px; height: 12px; }

/* ---------------------------- 用户中心 ---------------------------- */
.page-main { flex: 1; padding: 24px; position: relative; }
.page-grid {
  width: 100%; max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 24px;
}
@media (min-width: 900px) { .page-grid { grid-template-columns: 1fr 2fr; } }

.stack { display: flex; flex-direction: column; gap: 24px; }

.card-body { padding: 24px; }

.profile { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 22px; }
.avatar {
  width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16, 185, 129, 0.1); color: var(--mint);
  margin-bottom: 12px;
}
.avatar svg { width: 36px; height: 36px; }
.profile-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.profile-status { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.profile-status.ok { color: var(--mint); font-weight: 600; }
.profile-status.err { color: #ef4444; font-weight: 600; }

.info-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.info-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: hsl(var(--muted-foreground)); }
.info-label svg { width: 15px; height: 15px; }
.info-value { font-size: 13px; font-weight: 500; text-align: right; }
.info-value.mono {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11.5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.info-value.mint { color: var(--mint); }

.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.section-icon {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
}
.section-icon svg { width: 17px; height: 17px; }
.section-icon.yellow { background: rgba(234, 179, 8, 0.12); color: #eab308; }
.section-icon.mint { background: rgba(16, 185, 129, 0.12); color: var(--mint); }
.section-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

.hint-list { display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: hsl(var(--muted-foreground)); line-height: 1.65; }
.hint-item { display: flex; gap: 10px; }
.hint-num {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(16, 185, 129, 0.1);
  color: var(--mint); font-size: 10px; font-weight: 700;
}
.hint-sign { text-align: right; font-size: 11.5px; font-style: italic; color: hsl(var(--foreground) / 0.35); padding-top: 6px; }

/* 公告 */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 18px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.18);
  font-size: 12.5px; line-height: 1.65;
  color: hsl(var(--foreground) / 0.85);
}
.notice svg { width: 15px; height: 15px; color: var(--mint); flex-shrink: 0; margin-top: 2px; }
.notice.hidden { display: none; }

.panel-title { font-size: 19px; font-weight: 700; text-align: center; letter-spacing: 0.01em; margin-bottom: 24px; }

.form-stack { display: flex; flex-direction: column; gap: 10px; max-width: 640px; margin: 0 auto; }

.btn-grid {
  display: grid; grid-template-columns: 1fr; gap: 10px;
  padding-top: 14px; max-width: 640px; margin: 0 auto;
}
@media (min-width: 640px) { .btn-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px) { .btn-grid { grid-template-columns: repeat(3, 1fr); } }
.btn-grid .btn { height: 44px; }

/* 监听状态 */
.listen-status {
  display: none; align-items: center; justify-content: center; gap: 8px;
  margin: 16px auto 0; padding: 12px; max-width: 640px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #22c55e; font-size: 13px; font-weight: 500;
}
.listen-status.show { display: flex; }
.listen-status .dot { position: relative; display: flex; width: 10px; height: 10px; }
.listen-status .dot i {
  position: absolute; inset: 0; border-radius: 50%;
  background: #4ade80; opacity: 0.75;
  animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.listen-status .dot b { position: relative; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; display: block; }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
.wave { display: flex; align-items: flex-end; gap: 3px; height: 15px; margin-left: 2px; }
.wave span { width: 3px; border-radius: 999px; background: #22c55e; animation: wave 1s ease-in-out infinite; }
.wave span:nth-child(1) { height: 55%; animation-delay: 0s; }
.wave span:nth-child(2) { height: 100%; animation-delay: 0.15s; }
.wave span:nth-child(3) { height: 40%; animation-delay: 0.3s; }
@keyframes wave { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }

.volume-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.volume-row svg { width: 16px; height: 16px; color: hsl(var(--muted-foreground)); }
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; max-width: 220px; height: 6px; border-radius: 999px;
  background: hsl(var(--muted)); outline: none; cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--mint); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); cursor: pointer;
}
html.dark .range::-webkit-slider-thumb { border-color: #1a1a1a; }
.range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--mint); border: 2px solid #fff; cursor: pointer;
}
.volume-text { font-size: 11.5px; font-family: ui-monospace, Consolas, monospace; width: 36px; text-align: right; color: hsl(var(--muted-foreground)); }

#player-container { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.site-footer { border-top: 1px solid hsl(var(--border) / 0.4); background: hsl(var(--background) / 0.5); margin-top: 40px; }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

/* ---------------------------- Toast ---------------------------- */
.toast {
  position: fixed; top: 18px; right: 18px; z-index: 100;
  display: flex; align-items: center; gap: 10px;
  max-width: 340px; padding: 13px 16px;
  background: hsl(var(--card));
  border-radius: 10px;
  border-left: 4px solid var(--mint);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
  font-size: 13px; font-weight: 500;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.show { transform: translateX(0); }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--mint); }
.toast.error { border-left-color: #ef4444; }
.toast.error svg { color: #ef4444; }
.toast.warn { border-left-color: #f59e0b; }
.toast.warn svg { color: #f59e0b; }

/* ============================================================
   后台
   ============================================================ */
.admin-main { flex: 1; padding: 24px; position: relative; }
.admin-shell { width: 100%; max-width: 1200px; margin: 0 auto; }

.admin-auth { max-width: 460px; margin: 8vh auto 0; }
.admin-auth .auth-body { padding: 30px; }

.admin-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.admin-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.admin-head p { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 5px; }

.env-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  background: rgba(16, 185, 129, 0.1); color: var(--mint);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.env-badge.off { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }

/* 标签页 */
.tabs {
  display: flex; gap: 4px; padding: 4px;
  border-radius: 11px;
  background: hsl(var(--muted) / 0.7);
  border: 1px solid hsl(var(--border) / 0.6);
  margin-bottom: 20px; overflow-x: auto;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 8px;
  border: none; background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: hsl(var(--foreground)); }
.tab.active {
  background: hsl(var(--card)); color: hsl(var(--foreground));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.tab.active svg { color: var(--mint); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s ease both; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-label { font-size: 12px; color: hsl(var(--muted-foreground)); }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.stat-value small { font-size: 12px; font-weight: 500; color: hsl(var(--muted-foreground)); margin-left: 3px; }
.stat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: rgba(16, 185, 129, 0.1); color: var(--mint);
}
.stat-icon svg { width: 15px; height: 15px; }

/* 面板 */
.panel {
  border-radius: 14px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--border) / 0.7);
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-head h2 svg { width: 16px; height: 16px; color: var(--mint); }
.panel-head .sub { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 3px; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 0; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input { height: 34px; width: 200px; font-size: 12.5px; }
.toolbar .select { height: 34px; width: 118px; font-size: 12.5px; padding-right: 6px; }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  padding: 11px 14px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.5);
  border-bottom: 1px solid hsl(var(--border));
}
tbody td { padding: 12px 14px; border-bottom: 1px solid hsl(var(--border) / 0.5); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: hsl(var(--muted) / 0.35); }
td.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
td .muted { color: hsl(var(--muted-foreground)); }
.row-actions { display: flex; gap: 4px; }
.empty { padding: 48px 20px; text-align: center; color: hsl(var(--muted-foreground)); font-size: 13px; }
.empty svg { width: 32px; height: 32px; margin: 0 auto 10px; opacity: 0.4; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
}
.badge.green { background: rgba(16, 185, 129, 0.12); color: var(--mint); }
.badge.red { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge.amber { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.badge.gray { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.badge.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid hsl(var(--border) / 0.6);
  font-size: 12px; color: hsl(var(--muted-foreground));
}

/* 配置表单 */
.form-section { margin-bottom: 26px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
}
.form-section-title svg { width: 14px; height: 14px; color: var(--mint); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 760px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.field-hint { margin-top: 5px; font-size: 11.5px; line-height: 1.6; color: hsl(var(--muted-foreground)); }
.field-hint code {
  padding: 1px 5px; border-radius: 4px;
  background: hsl(var(--muted)); color: var(--mint);
  font-family: ui-monospace, Consolas, monospace; font-size: 11px;
}
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 18px; margin-top: 6px;
  border-top: 1px solid hsl(var(--border) / 0.6);
}

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 90;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(9, 9, 11, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal.show { display: flex; }
.modal-card {
  width: 100%; max-width: 460px;
  border-radius: 14px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.22s ease both;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid hsl(var(--border) / 0.7);
}
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid hsl(var(--border) / 0.7);
  background: hsl(var(--muted) / 0.3);
}

.key-box {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px; line-height: 1.9;
  padding: 14px; border-radius: 10px;
  background: hsl(var(--muted) / 0.7);
  border: 1px solid hsl(var(--border));
  max-height: 240px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
  color: hsl(var(--foreground) / 0.9);
}

.hidden { display: none !important; }

/* 仪表盘小列表 */
.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid hsl(var(--border) / 0.5); font-size: 12.5px;
}
.mini-row:last-child { border-bottom: none; }
.mini-row .mono { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: hsl(var(--muted-foreground)); }
.mini-row .t { color: hsl(var(--muted-foreground)); white-space: nowrap; }

.quick-links { display: flex; flex-direction: column; gap: 8px; }
.quick-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 9px;
  border: 1px solid hsl(var(--border));
  background: transparent; color: hsl(var(--foreground));
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.quick-link:hover { background: hsl(var(--accent)); border-color: hsl(var(--border)); }
.quick-link svg { width: 15px; height: 15px; color: var(--mint); }
.quick-link .arrow { margin-left: auto; opacity: 0.35; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / 0.5); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
