:root {
  --vd-canvas: #f5f7fa;
  --vd-surface: #ffffff;
  --vd-on-accent: #ffffff;
  --vd-surface-muted: #f8fafc;
  --vd-surface-hover: #eef2f7;
  --vd-row-hover: #fbfcfe;
  --vd-ink: #182230;
  --vd-ink-muted: #586579;
  --vd-ink-subtle: #8491a3;
  --vd-line: #e4e9f0;
  --vd-line-soft: #edf0f4;
  --vd-accent: #2563eb;
  --vd-accent-hover: #1d4ed8;
  --vd-accent-soft: #eff6ff;
  --vd-success: #16824b;
  --vd-warning: #a86108;
  --vd-danger: #c43d45;
  --vd-space-1: 4px;
  --vd-space-2: 8px;
  --vd-space-3: 12px;
  --vd-space-4: 16px;
  --vd-space-5: 20px;
  --vd-space-6: 24px;
  --vd-space-8: 32px;
  --vd-radius-control: 8px;
  --vd-radius-panel: 12px;
  --vd-shadow-overlay: 0 16px 40px rgb(24 34 48 / 14%);
  --vd-overlay-scrim: rgb(24 34 48 / 32%);
  --vd-focus-wash: rgb(37 99 235 / 18%);
  color: var(--vd-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.vd-body { min-height: 100dvh; background: var(--vd-canvas); color: var(--vd-ink); }
.vd-header { height: 64px; background: var(--vd-surface); border-bottom: 1px solid var(--vd-line); box-shadow: none; }
.vd-header__inner { width: min(100%, 1440px); height: 100%; margin-inline: auto; padding-inline: 24px; }
.vd-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--vd-ink); text-decoration: none; }
.vd-brand__mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--vd-accent); color: var(--vd-on-accent); font-size: 14px; font-weight: 650; }
.vd-brand__name { font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.vd-header__actions { gap: 16px; }
.vd-header__mobile-menu { display: none; }
.vd-header__link { color: var(--vd-accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.vd-header__link:hover { color: var(--vd-accent-hover); text-decoration: underline; }
.vd-header__account { color: var(--vd-ink-muted); font-size: 13px; }
.vd-header__account strong { display: block; color: var(--vd-ink); font-size: 14px; font-weight: 600; }
.vd-header__account small { display: block; margin-top: 2px; color: var(--vd-ink-subtle); font-size: 12px; }
.vd-header__logout { border: 0; background: none; color: var(--vd-ink-subtle); font-size: 13px; cursor: pointer; }
.vd-header__logout:hover { color: var(--vd-danger); }

.vd-shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 32px; width: min(100%, 1440px); margin: 0 auto; padding: 32px 24px 56px; align-items: start; }
.vd-sidebar { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 4px; }
.vd-sidebar__scrim { display: none; }
.vd-nav-item { min-height: 40px; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--vd-ink-muted); text-align: left; font-family: inherit; font-size: 14px; font-weight: 550; line-height: 20px; cursor: pointer; transition: background-color 120ms ease-out, color 120ms ease-out; }
.vd-nav-item:hover { background: var(--vd-surface-hover); color: var(--vd-ink); }
.vd-nav-item.active { background: var(--vd-accent-soft); color: var(--vd-accent); }
.vd-nav-divider { height: 1px; margin: 12px 8px; border: 0; background: var(--vd-line); }
.vd-sidebar .nav-item.active { background: var(--vd-accent-soft); color: var(--vd-accent); }
.vd-sidebar .nav-item.active.bg-blue-600 { background: var(--vd-accent-soft); color: var(--vd-accent); }
.vd-main { min-width: 0; }
.vd-main > .hidden, .vd-main > [hidden] { display: none !important; }
.vd-overview { display: flex; flex-direction: column; gap: 24px; }
.vd-management { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.vd-management > .lg\:col-span-2 { display: contents; }
.vd-sidebar > .nav-item, .vd-sidebar > a { min-height: 40px; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--vd-ink-muted); text-align: left; font-family: inherit; font-size: 14px; font-weight: 550; line-height: 20px; text-decoration: none; cursor: pointer; }
.vd-sidebar > .nav-item:hover, .vd-sidebar > a:hover { background: var(--vd-surface-hover); color: var(--vd-ink); }
.vd-sidebar > .nav-item.active { background: var(--vd-accent-soft) !important; color: var(--vd-accent) !important; }
.vd-sidebar > hr { width: calc(100% - 16px); }
.vd-page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.vd-page-heading h1 { margin: 0; color: var(--vd-ink); font-size: 28px; font-weight: 650; line-height: 36px; letter-spacing: -.025em; }
.vd-page-heading p { max-width: 65ch; margin: 4px 0 0; color: var(--vd-ink-subtle); font-size: 14px; line-height: 22px; }
.vd-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vd-section-heading__copy { min-width: 0; }
.vd-section-heading h2, .vd-section-heading h3 { margin: 0; color: var(--vd-ink); font-size: 18px; line-height: 26px; font-weight: 600; }
.vd-section-heading p { margin: 4px 0 0; color: var(--vd-ink-subtle); font-size: 13px; line-height: 20px; }

.vd-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-control); background: var(--vd-surface); color: var(--vd-ink-muted); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 20px; text-decoration: none; cursor: pointer; transition: background-color 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out, transform 120ms ease-out; }
.vd-button:hover:not(:disabled) { background: var(--vd-surface-muted); color: var(--vd-ink); }
.vd-button:active:not(:disabled) { transform: translateY(1px); }
.vd-button:disabled { opacity: .5; cursor: not-allowed; }
.vd-button--primary { border-color: var(--vd-accent); background: var(--vd-accent); color: var(--vd-on-accent); }
.vd-button--primary:hover:not(:disabled) { border-color: var(--vd-accent-hover); background: var(--vd-accent-hover); color: var(--vd-on-accent); }
.vd-button--quiet { border-color: transparent; background: transparent; }
.vd-input, .vd-select { min-height: 40px; padding: 8px 12px; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-control); background: var(--vd-surface); color: var(--vd-ink); font-family: inherit; font-size: 14px; font-weight: 400; line-height: 20px; }
.vd-input:focus, .vd-select:focus { border-color: var(--vd-accent); outline: 2px solid var(--vd-focus-wash); outline-offset: 1px; }
:is(.vd-button, .vd-nav-item, .vd-header__mobile-menu, .vd-header__logout, .vd-header__link, .vd-menu-close):focus-visible { outline: 2px solid var(--vd-accent); outline-offset: 2px; }

.vd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.vd-stat { min-width: 0; padding: 18px 20px; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-panel); background: var(--vd-surface); }
.vd-stat__label { display: block; color: var(--vd-ink-subtle); font-size: 13px; line-height: 20px; }
.vd-stat__value { display: block; overflow: hidden; margin-top: 8px; color: var(--vd-ink); font-size: 26px; line-height: 32px; font-weight: 650; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.vd-stat__detail { display: block; margin-top: 4px; color: var(--vd-ink-subtle); font-size: 12px; line-height: 18px; }
.vd-panel { min-width: 0; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-panel); background: var(--vd-surface); }
.vd-panel__body { padding: 20px; }
.vd-projects { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
/* 项目卡的皮肤只服务厂商端那版旧内联结构。控制台（dashboard.html）已把项目卡
   重写成 .sd-proj*，DOM 形状不同但同样挂在 .vd-projects 下，这些 !important
   规则会把新设计压回旧外观（深色下指标块变白块）。故统一加 :not(.sd-projects)
   做边界；厂商端没有这个类，行为不变。 */
.vd-projects:not(.sd-projects) > div { border-color: var(--vd-line) !important; border-radius: var(--vd-radius-panel) !important; box-shadow: none !important; }
.vd-projects:not(.sd-projects) > div > div:nth-child(2) > div { background: var(--vd-surface-muted) !important; border-color: var(--vd-line-soft) !important; border-radius: var(--vd-radius-control) !important; }
.vd-projects:not(.sd-projects) > div > div:nth-child(2) > div p:first-child { color: var(--vd-ink-subtle) !important; font-size: 12px !important; font-weight: 500 !important; letter-spacing: 0 !important; }
.vd-projects:not(.sd-projects) > div > div:nth-child(2) > div p:last-child { color: var(--vd-ink) !important; font-size: 18px !important; }
.vd-projects:not(.sd-projects) > div > div:nth-child(n+3) span { color: var(--vd-ink-muted) !important; font-size: 12px !important; font-weight: 500 !important; letter-spacing: 0 !important; }
.vd-projects:not(.sd-projects) > div > div:nth-child(n+3) span[style*="margin-left:auto"] { color: var(--vd-ink-subtle) !important; }
.vd-projects:not(.sd-projects) > div > div:first-child button { min-height: 36px; padding: 6px 10px !important; border-color: var(--vd-line) !important; border-radius: var(--vd-radius-control) !important; color: var(--vd-ink-muted) !important; font-size: 12px !important; }
.vd-projects:not(.sd-projects) > div > div:first-child input { font-family: inherit; }
.vd-projects:not(.sd-projects) input, .vd-projects:not(.sd-projects) select, .vd-projects:not(.sd-projects) textarea { font-family: inherit; font-size: 13px !important; }
.vd-projects:not(.sd-projects) [style*="border-top:1px dashed"] { border-top-style: solid !important; border-color: var(--vd-line-soft) !important; }
.vd-key-panel { padding: 20px; }
.vd-key-panel .vd-section-heading { margin-bottom: 16px; }
.vd-key-panel #key-section-header { justify-content: flex-start !important; margin-bottom: 12px !important; }
.vd-key-panel #key-filter-bar { width: 100%; }
.vd-key-panel #key-filter-bar input { min-width: 180px; flex: 1; }
.vd-key-panel #btn-export-project-keys { border: 1px solid var(--vd-line) !important; border-radius: var(--vd-radius-control) !important; background: var(--vd-surface) !important; color: var(--vd-ink-muted) !important; }
.vd-key-panel #btn-export-project-keys:disabled { opacity: .5 !important; }
.vd-key-panel #btn-export-project-keys:not(:disabled) { opacity: 1 !important; }
.vd-key-panel #key-kpi-row { margin-bottom: 16px !important; }
.vd-key-panel #key-kpi-row > button { border-color: var(--vd-line) !important; border-radius: 8px !important; box-shadow: none !important; font-family: inherit; }
.vd-key-panel #key-kpi-row > button p:first-child { color: var(--vd-ink-subtle) !important; font-size: 12px !important; font-weight: 500 !important; letter-spacing: 0 !important; }
.vd-key-panel #key-kpi-row > button p:last-child { color: var(--vd-ink) !important; font-size: 18px !important; }
.vd-key-panel table { width: 100%; min-width: 0 !important; border-collapse: collapse; }
.vd-key-panel table thead { color: var(--vd-ink-subtle); background: var(--vd-surface-muted); }
.vd-key-panel table th { padding: 12px; color: var(--vd-ink-subtle); font-size: 12px; font-weight: 550; text-transform: none; }
.vd-key-panel table td { padding: 12px; border-top: 1px solid var(--vd-line-soft); color: var(--vd-ink-muted); vertical-align: middle; }
.vd-key-panel table tr:hover td { background: var(--vd-row-hover); }
.vd-key-panel table td:nth-child(2) { overflow-wrap: anywhere; }
.vd-key-panel table td:nth-child(2) .font-mono { color: var(--vd-ink) !important; }
.vd-key-panel #key-kpi-row button { font-family: inherit; }
.vd-key-panel #key-kpi-row button:focus-visible { outline: 2px solid var(--vd-accent); outline-offset: 2px; }
.vd-support { margin-top: 4px; }
.vd-support > summary { padding: 12px 0; border-top: 1px solid var(--vd-line); color: var(--vd-ink-muted); font-size: 14px; font-weight: 600; cursor: pointer; list-style-position: inside; }
.vd-support[open] > summary { margin-bottom: 16px; }
.vd-support__content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.vd-support__content > * { min-width: 0; }
.vd-support__content > .space-y-6 { display: contents; }
.vd-support__content > .space-y-6 > * { margin-block-start: 0 !important; }
.vd-support .vd-support__integration { grid-column: 1 / -1; background: var(--vd-surface) !important; color: var(--vd-ink) !important; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-panel) !important; box-shadow: none !important; }
.vd-support .vd-support__integration code { background: var(--vd-surface-muted) !important; color: var(--vd-ink-muted); overflow-wrap: anywhere; }
.vd-support .vd-support__integration h3 { color: var(--vd-ink-subtle) !important; }
.vd-support__content > .space-y-6 > div:nth-child(3) { grid-column: 1 / -1; background: var(--vd-surface) !important; color: var(--vd-ink) !important; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-panel) !important; box-shadow: none !important; }
.vd-support__content > .space-y-6 > div:nth-child(3) h3 { color: var(--vd-ink-subtle) !important; }
.vd-support__content > .space-y-6 > div:nth-child(3) code { display: block; padding: 8px; border-radius: var(--vd-radius-control); background: var(--vd-surface-muted); color: var(--vd-ink-muted); overflow-wrap: anywhere; }
/* ⚠️ 压平折叠区里的装饰性渐变。必须排除 button：历史上这条规则把「立即充值」按钮的
   渐变一起压成了 --vd-surface，而按钮自身 color:#fff 不变 → 白底白字，按钮"消失"。 */
.vd-support__content [style*="linear-gradient"]:not(button) { background: var(--vd-surface) !important; }
.vd-support__content [style*="border-radius:16px"] { border-color: var(--vd-line) !important; border-radius: var(--vd-radius-panel) !important; box-shadow: none !important; }
.vd-support__content [style*="border-radius:16px"] > div:first-child { background: var(--vd-surface-muted) !important; }
.vd-support__content [style*="border-radius:16px"] > div:first-child > div > span:first-child { display: none !important; }
.vd-support__content [style*="border-radius:16px"] h3 { color: var(--vd-ink) !important; }
.vd-mobile-key-cards { display: none; }

@media (max-width: 900px) {
  .vd-shell { grid-template-columns: 184px minmax(0, 1fr); gap: 20px; padding-inline: 16px; }
  .vd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .vd-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 700px) {
  .vd-header { height: 60px; }
  .vd-header__inner { padding-inline: 16px; }
  .vd-header__mobile-menu { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--vd-line); border-radius: 8px; background: white; color: var(--vd-ink); font-size: 18px; cursor: pointer; }
  .vd-brand { margin-right: auto; margin-left: 12px; }
  .vd-brand__name { font-size: 15px; }
  .vd-header__actions { gap: 12px; }
  .vd-shell { display: block; padding: 24px 16px 40px; }
  .vd-sidebar { position: fixed; z-index: 1001; inset: 0 auto 0 0; width: min(300px, 84vw); padding: 76px 16px 24px; background: var(--vd-surface); box-shadow: var(--vd-shadow-overlay); transform: translateX(-105%); visibility: hidden; transition: transform 200ms ease-in-out, visibility 200ms; overflow-y: auto; }
  body.vd-menu-open .vd-sidebar { transform: translateX(0); visibility: visible; }
  .vd-sidebar__scrim { position: fixed; z-index: 1000; inset: 0; display: block; border: 0; background: var(--vd-overlay-scrim); opacity: 0; visibility: hidden; transition: opacity 200ms ease-in-out, visibility 200ms; }
  body.vd-menu-open .vd-sidebar__scrim { opacity: 1; visibility: visible; }
  .vd-page-heading { align-items: flex-start; }
  .vd-page-heading h1 { font-size: 24px; line-height: 32px; }
  .vd-stat { padding: 16px; }
  .vd-stat__value { font-size: 22px; line-height: 28px; }
  .vd-section-heading { align-items: flex-start; }
  .vd-projects { grid-template-columns: 1fr; gap: 12px; }
  .vd-key-panel { padding: 16px; }
  .vd-key-panel .overflow-x-auto { overflow: visible; }
  .vd-key-panel table, .vd-key-panel tbody { display: block; }
  .vd-key-panel thead { display: none; }
  .vd-key-panel tbody { display: grid; gap: 10px; }
  .vd-key-panel tbody tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; padding: 12px; border: 1px solid var(--vd-line); border-radius: 10px; background: var(--vd-surface); }
  .vd-key-panel tbody td { min-width: 0; padding: 8px 0; border-top: 0; font-size: 13px; overflow-wrap: anywhere; }
  .vd-key-panel tbody td:first-child { position: absolute; top: 14px; left: 12px; padding: 0; }
  .vd-key-panel tbody td:nth-child(2) { grid-column: 1 / -1; padding: 0 0 10px 28px; border-bottom: 1px solid var(--vd-line-soft); }
.vd-key-panel tbody td:nth-child(2)::before { content: "Key / 短码 / 指纹"; display: block; margin-bottom: 5px; color: var(--vd-ink-subtle); font-size: 12px; font-weight: 500; line-height: 18px; }
.vd-key-panel tbody td:nth-child(3)::before, .vd-key-panel tbody td:nth-child(4)::before, .vd-key-panel tbody td:nth-child(5)::before, .vd-key-panel tbody td:nth-child(6)::before { display: block; margin-bottom: 5px; color: var(--vd-ink-subtle); font-size: 12px; font-weight: 500; line-height: 18px; }
  .vd-key-panel tbody td:nth-child(3)::before { content: "状态"; }
  .vd-key-panel tbody td:nth-child(4) { grid-column: 1 / -1; border-top: 1px solid var(--vd-line-soft); }
  .vd-key-panel tbody td:nth-child(4)::before { content: "当前消耗 / 余额"; }
  .vd-key-panel tbody td:nth-child(5)::before { content: "所属项目"; }
  .vd-key-panel tbody td:nth-child(6) { grid-column: 1 / -1; border-top: 1px solid var(--vd-line-soft); }
  .vd-key-panel tbody td:nth-child(6)::before { content: "操作"; }
  .vd-key-panel tbody td:nth-child(6) > div { justify-content: flex-start !important; flex-wrap: wrap; }
  .vd-key-panel tbody td:nth-child(6) > div > div { flex-direction: row !important; }
  .vd-key-panel #key-filter-bar > select, .vd-key-panel #key-filter-bar > button, .vd-key-panel #key-filter-bar > .relative { flex: 1 1 calc(50% - 8px); min-width: 0 !important; width: auto; max-width: none !important; }
  .vd-support__content { grid-template-columns: 1fr; }
  .vd-support .vd-support__integration { grid-column: auto; }
}
@media (max-width: 420px) {
  .vd-header__link { display: none; }
  .vd-header__account { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vd-header__account small { display: none; }
  .vd-shell { padding-inline: 12px; }
  .vd-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .vd-stat { padding: 12px 10px; }
  .vd-stat__detail { min-height: 36px; }
  .vd-button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
