/* ScreenSync Admin Dashboard — dark theme, aligned to the landing page
   (landing/colors_and_type.css). Dark-first: cinematic black, brand blue,
   top-lit gradient card borders, Manrope/Clash Display/Geist Mono/Archivo Black. */

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Poppins:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;700&display=swap");

@font-face {
  font-family: "Clash Display";
  src: url("assets/fonts/ClashDisplay-Variable.ttf") format("truetype");
  font-weight: 200 700;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Archivo Black";
  src: url("assets/fonts/ArchivoBlack-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  /* Brand */
  --brand: #3c84ff;
  --brand-strong: #2e78f0;
  --brand-tint: #6f98ff;
  --violet: #632288;
  --accent: var(--brand);
  --accent-soft: rgba(60, 132, 255, 0.16);

  /* Surfaces (dark) */
  --bg: #000000;
  --bg-subtle: #0a0a0b;
  --bg-elevated: #121214;
  --bg-card: #0b0b0b;
  --bg-inset: #27272b;
  --bg-hover: #1c1c20;

  /* Tooltip — matches the Figma plugin (dark surface + Apple-style hairline ring). */
  --tooltip-bg: #1d1d1f;
  --tooltip-arrow-border: rgba(255, 255, 255, 0.12);
  --shadow-popover:
    0 0 0 0.5px rgba(255, 255, 255, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.5);

  /* Text */
  --fg: #ffffff;
  --fg-secondary: rgba(255, 255, 255, 0.6);
  --fg-tertiary: rgba(255, 255, 255, 0.46);
  --fg-muted: rgba(255, 255, 255, 0.4);
  --fg-faint: rgba(255, 255, 255, 0.28);
  --fg-inverse: #000000;

  /* Lines */
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.24);
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-faint: rgba(255, 255, 255, 0.06);
  --border-card: rgba(214, 235, 253, 0.19);

  /* Top-lit card border: bright spotlight on the top-center edge, fading down/sides */
  --card-border-grad: radial-gradient(135% 96% at 50% 0%, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.16) 30%, rgba(255, 255, 255, 0.045) 66%);
  --card-border-grad-hover: radial-gradient(135% 96% at 50% 0%, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.46) 34%, rgba(255, 255, 255, 0.14) 72%);

  /* Membership / status */
  --membership-gold: #ffa800;
  --membership-gold-soft: rgba(255, 168, 0, 0.16);
  --membership-gold-edge: rgba(255, 184, 40, 0.5);
  --success: #00ac47;
  --success-soft: rgba(0, 172, 71, 0.16);
  --warn: #ffba00;
  --danger: #ff5555;
  --danger-soft: rgba(255, 85, 85, 0.16);

  /* Radius (landing scale) */
  --radius-xs: 4px;
  --radius-s: 8px;
  --radius-m: 8px;
  --radius-l: 16px;
  --radius-pill: 32px;
  --radius-full: 9999px;

  /* Form controls — single source of truth for every input box / control row
     (search, qty, stepper, segmented, gen CTA). Override --control-height in a
     media query to scale them all at once for touch targets. */
  --control-height: 32px;
  --control-radius: var(--radius-m);
  --control-bg: var(--bg-inset);
  --control-border: var(--border);
  --control-border-focus: var(--brand);
  --control-pad-x: 12px;
  --icon-btn-size: 28px;
  --icon-btn-svg-size: 14px;
  --icon-btn-size-lg: 32px;
  --icon-btn-svg-size-lg: 20px;
  --table-state-body-height: 220px;

  /* Motion */
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-spring: cubic-bezier(0.25, 0.8, 0.25, 1);
  --ring-focus: 0 0 0 3px rgba(60, 132, 255, 0.4);

  /* Fonts */
  --font-display: "Clash Display", "Manrope", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-sans: "Manrope", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-ui: "Poppins", "Noto Sans SC", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-logo: "Archivo Black", "Clash Display", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.modal-scroll-locked {
  overflow: hidden;
  overscroll-behavior: none;
}

body.modal-scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

[hidden] {
  display: none !important;
}

body.auth-pending [data-auth-required],
body:not(.is-authenticated) [data-auth-required] {
  display: none !important;
}


/* ── Ambient backdrop (landing-style glow + faint grid) ──────────────────── */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(62% 48% at 50% -12%, rgba(60, 132, 255, 0.18), transparent 70%),
    radial-gradient(42% 40% at 86% -6%, rgba(99, 34, 136, 0.14), transparent 72%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(1000px 520px at 50% -40px, #000, transparent 76%);
  mask-image: radial-gradient(1000px 520px at 50% -40px, #000, transparent 76%);
}

/* ── Top bar (landing dark-glass header) ────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.72);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1) 35%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.1) 65%, transparent);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand .brand-logo {
  width: 23.4px;
  height: 23.4px;
  display: block;
  flex: none;
}

.topbar-brand .brand-wordmark {
  font-family: var(--font-logo);
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--fg);
  line-height: 1;
}

.topbar-brand .brand-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.topbar-time.is-stale {
  color: var(--warn);
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--border-faint);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.16s var(--ease-out), border-color 0.16s var(--ease-out);
}

.refresh-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.refresh-btn:active {
  transform: scale(0.97);
}

.refresh-btn svg {
  width: 14px;
  height: 14px;
}

.topbar-icon-btn {
  width: 30px;
  padding: 0;
  border-radius: var(--radius-s);
}

.topbar-icon-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

.logout-btn svg path {
  fill: currentColor;
}

.refresh-btn.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-card {
  width: min(100%, 390px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
  border: 1px solid transparent;
  border-radius: var(--radius-l);
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--card-border-grad) border-box;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.login-brand .brand-logo {
  width: 28.8px;
  height: 28.8px;
  flex: none;
}

.login-wordmark {
  margin: 0;
  font-family: var(--font-logo);
  /* 与顶栏 wordmark(span,默认 normal)统一:Archivo Black 仅 400,
     h1 的默认 bold(700)会触发伪加粗,显式压回 400 才与首页导航一致 */
  font-weight: 400;
  font-size: 19px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.login-form,
.login-field {
  display: flex;
  flex-direction: column;
}

.login-form {
  gap: 14px;
}

.login-field {
  gap: 7px;
}

.login-field .field-input {
  width: 100%;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  min-height: 28px;
  color: var(--fg-secondary);
  font-size: 12.5px;
  font-weight: 500;
  user-select: none;
}

.remember-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkmark {
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  transition: background 0.16s var(--ease-out), border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}

.remember-row:hover .checkmark {
  border-color: var(--brand-tint);
}

.remember-row input:focus-visible + .checkmark {
  box-shadow: var(--ring-focus);
}

.remember-row input:checked + .checkmark {
  border-color: transparent;
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4 8.2 2.4 2.4L12 5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px 12px no-repeat,
    var(--brand);
}

.login-submit {
  width: 100%;
  height: 40px;
  margin-top: 2px;
}

.login-error {
  margin: 0;
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

section+section {
  margin-top: 48px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-head>div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.overview-range-control {
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
}

.overview-range-native {
  display: none;
}

.custom-select-trigger {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  height: var(--control-height);
  padding: 0 28px 0 10px;
  border: 0;
  border-radius: var(--control-radius);
  background-color: var(--bg-inset);
  color: var(--fg-secondary);
  cursor: default;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: left;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

.custom-select-trigger:hover,
.custom-select.is-open .custom-select-trigger {
  background-color: var(--bg-hover);
  color: var(--fg);
}

.custom-select-trigger:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.menu-popover {
  position: absolute;
  min-width: 96px;
  padding: 4px;
  z-index: 60;
  display: none;
  cursor: default;
  background: var(--tooltip-bg);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  box-shadow: var(--shadow-popover);
}

.floating-layer {
  position: fixed !important;
  z-index: 3600;
}

.menu-popover.is-open {
  display: block;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: calc(var(--control-radius) - 2px);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: left;
  white-space: nowrap;
  transition: background 0.12s var(--ease-out), color 0.12s var(--ease-out);
}

.menu-item:hover {
  background: var(--bg-hover);
}

.menu-popover .menu-item.is-selected {
  color: var(--brand);
  font-weight: 600;
}

.custom-select-menu {
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
}

.custom-select-menu.floating-layer {
  top: auto;
  left: auto;
  right: auto;
}

.custom-select-option {
  justify-content: space-between;
  padding-right: 10px;
}

.section-action {
  margin-left: auto;
  min-height: 36px;
}

.section-title {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.018em;
  margin: 0;
  background-image: linear-gradient(to bottom right, var(--fg) 26%, rgba(255, 255, 255, 0.56));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 0;
}

/* ── Top-lit card base (the landing technique) ──────────────────────────── */
.metric-card,
.card {
  position: relative;
  border: 1px solid transparent;
  border-radius: var(--radius-l);
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--card-border-grad) border-box;
}

/* Hover: the top-lit line burns brighter (nothing moves).
   z-index sits ABOVE the table scroll feather (z:4): the ring is painted on the
   padding-box inner edge, which overlaps the feather's 16px strip — without this
   the feather would cover the selected card's top-lit border on the left/right. */
.metric-card::after,
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
  padding: 1px;
  background: var(--card-border-grad-hover);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.metric-card:hover::after,
.card:hover::after {
  opacity: 1;
}

/* ── Metric cards ───────────────────────────────────────────────────────── */
.metric-grid {
  display: flex;
  align-items: stretch;
}

.metric-card {
  min-width: 0;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 92px;
}

.metric-card.revenue {
  flex: 0 0 204px;
  justify-content: center;
}

.metric-sep {
  flex: 0 0 16px;
}

/* The equation panel: 总用户数 = Premium + Free in ONE container, total highlighted */
.equation {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-l);
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--card-border-grad) border-box;
}

.eq-total,
.eq-cell {
  flex: 1 1 0;
  min-width: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 82px;
}

.eq-total {
  border-radius: var(--radius-m);
  background: linear-gradient(155deg, #3c84ff 0%, #2e6ff0 56%, #5566f2 100%);
  box-shadow: 0 6px 22px rgba(60, 132, 255, 0.28);
}

.eq-total .metric-label {
  color: rgba(255, 255, 255, 0.85);
}

.eq-total .metric-value {
  color: #fff;
}

.eq-group {
  flex: 2 1 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.eq-group .eq-cell+.eq-op+.eq-cell {
  border-left: 1px solid var(--border-soft);
}

/* Operator badge straddling the seam between cells (per reference) */
.eq-op {
  flex: 0 0 0;
  width: 0;
  align-self: center;
  position: relative;
  z-index: 4;
  pointer-events: none;
}

.eq-op span {
  width: 30px;
  height: 30px;
  transform: translateX(-50%);
  /* center the badge on the seam (no grid on parent) */
  border-radius: 50%;
  border: 1px solid transparent;
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--card-border-grad) border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  /* system sans centers +/= within the circle better than the display face */
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--fg-secondary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.metric-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-secondary);
  letter-spacing: -0.01em;
}

.metric-value {
  /* 大数字字体对齐 landing 订阅价格卡的金额:Manrope(--font-sans)+ bold */
  font-family: var(--font-sans);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  height: 34px;
  letter-spacing: 0;
  color: var(--fg);
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.metric-value .unit {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-muted);
}

.metric-value.accent {
  color: var(--membership-gold);
}

.metric-value.metric-placeholder {
  color: var(--fg-tertiary);
}

.eq-total .metric-value.metric-placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.metric-card.revenue .metric-value {
  align-items: flex-end;
}

/* Revenue amount: currency symbol smaller, baseline-aligned to the digits */
.rev-amount {
  display: inline-flex;
  align-items: baseline;
}

.rev-amount .cur-sym {
  font-size: 0.62em;
  font-weight: 600;
  margin-right: 2px;
}

.metric-delta {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--danger);
  /* 今日新增 ↑ shares the global red token */
}

.metric-delta.is-loading {
  width: 15px;
  height: 15px;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.metric-delta.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.metric-foot {
  font-size: 11.5px;
  color: var(--fg-tertiary);
  margin-top: auto;
}

/* Revenue breakdown — small info icon after the amount; details via the shared
   tooltip portal (data-tooltip). */
.rev-info {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  color: var(--fg-muted);
}

.metric-card.revenue .rev-info {
  align-self: flex-end;
}

.rev-info svg {
  width: 15px;
  height: 15px;
}

.rev-info:hover,
.rev-info:focus-visible {
  color: var(--fg-secondary);
  outline: none;
}

/* ── Usage trend area chart ─────────────────────────────────────────────── */
.usage-trend-card {
  margin-top: 20px;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(152px, 196px) minmax(0, 1fr);
  align-items: stretch;
  column-gap: 24px;
  overflow: hidden;
}

.usage-trend-head {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  align-items: flex-start;
  gap: 0;
}

.usage-trend-summary {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-trend-title-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.usage-trend-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--fg-secondary);
  letter-spacing: -0.01em;
}

.usage-trend-range {
  margin: 0;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

.usage-trend-total {
  height: 34px;
  display: flex;
  align-items: flex-end;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.usage-trend-legend {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  grid-row: 3;
}

.usage-trend-chart {
  min-width: 0;
}

.usage-legend-item {
  display: grid;
  grid-template-columns: 12px max-content 1fr;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.usage-legend-item b {
  justify-self: end;
  color: var(--fg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.usage-percent {
  display: inline-block;
  width: 4ch;
  color: var(--fg-secondary);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.usage-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}

.usage-dot.screenshot {
  color: #4f8dff;
  background: #4f8dff;
}

.usage-dot.recording {
  color: #ffc44d;
  background: #ffc44d;
}

.usage-dot.gif {
  color: #21d07a;
  background: #21d07a;
}

.usage-trend-chart {
  position: relative;
  height: 258px;
  min-height: 230px;
  isolation: isolate;
}

.usage-trend-chart::before {
  content: "";
  position: absolute;
  inset: 18px 8px 36px 22px;
  z-index: -1;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    radial-gradient(80% 70% at 50% 35%, rgba(79, 141, 255, 0.08), transparent 72%);
  filter: blur(8px);
  transform: translateZ(0);
  pointer-events: none;
}

.usage-trend-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--fg-muted);
  font-size: 13.5px;
  text-align: center;
}

.usage-trend-state svg {
  width: 82px;
  height: auto;
  margin-bottom: 12px;
}

.usage-area-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.usage-area-grid-line line {
  stroke: rgba(255, 255, 255, 0.055);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.usage-area-x-label {
  fill: var(--fg-tertiary);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 500;
}

.usage-area-y-label {
  fill: var(--fg-secondary);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.usage-area-layer {
  stroke: none;
  opacity: 0.94;
  vector-effect: non-scaling-stroke;
}

.usage-area-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.usage-hover-point {
  stroke: none;
  stroke-width: 0;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  filter: drop-shadow(0 2px 7px rgba(0, 0, 0, 0.4));
}

.usage-area-screenshot {
  filter: drop-shadow(0 10px 18px rgba(79, 141, 255, 0.16));
}

.usage-area-recording {
  filter: drop-shadow(0 10px 18px rgba(255, 196, 77, 0.12));
}

.usage-area-gif {
  filter: drop-shadow(0 10px 18px rgba(33, 208, 122, 0.13));
}

.usage-chart-hover-line {
  position: absolute;
  top: 22px;
  bottom: 38px;
  left: var(--usage-hover-x, 0);
  width: 1px;
  background: rgba(255, 255, 255, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-0.5px);
  transition: opacity 0.12s var(--ease-out);
}

.usage-trend-chart.is-hovering .usage-chart-hover-line {
  opacity: 1;
}

.usage-chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 148px;
  padding: 8px 9px;
  border-radius: 10px;
  background: var(--tooltip-bg);
  color: var(--fg);
  box-shadow: var(--shadow-popover);
  pointer-events: none;
  transform: translateX(-50%);
}

.usage-chart-tip-date {
  margin-bottom: 6px;
  color: var(--fg-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
}

.usage-chart-tip-row {
  display: grid;
  grid-template-columns: 10px max-content 1fr;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--fg-secondary);
}

.usage-chart-tip-row + .usage-chart-tip-row {
  margin-top: 4px;
}

.usage-chart-tip-row b {
  justify-self: end;
  color: var(--fg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Tooltip portal (plugin-matched: dark surface, hairline ring, arrow) ───── */
.tt-portal {
  position: fixed;
  box-sizing: border-box;
  width: max-content;
  max-width: calc(100vw - 16px);
  /* Above modal overlays (3000) and floating layers (3600): clipped-cell
     tooltips must stay visible for tables inside the settings/picker modals. */
  z-index: 3650;
  background: var(--tooltip-bg);
  color: var(--fg);
  padding: 5px 8px;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-align: center;
  box-shadow: var(--shadow-popover);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.92);
  transform-origin: top center;
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
  display: none;
}

.tt-portal.show {
  opacity: 1;
  transform: scale(1);
}

.tt-portal.align-left {
  text-align: left;
}

/* 裁切单元格 tooltip 的一键复制:仅 has-copy(= data-table-tooltip 目标)时
   气泡可交互;固定按钮/说明类 tooltip 保持 pointer-events:none,不拦截点击。 */
.tt-portal.has-copy {
  pointer-events: auto;
  align-items: center;
  gap: 7px;
}

.tt-portal-copy {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: -3px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-tint);
  transition: background 0.14s var(--ease-out), color 0.14s var(--ease-out);
}

.tt-portal-copy[hidden] {
  display: none;
}

.tt-portal-copy:hover {
  background: var(--accent-soft);
}

.tt-portal-copy:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.tt-portal-copy.done {
  color: var(--success);
  background: var(--success-soft);
}

.tt-portal-copy svg {
  width: 13px;
  height: 13px;
  display: block;
}

.tt-portal.is-log-tooltip {
  max-width: min(520px, calc(100vw - 16px));
  white-space: pre-wrap;
  text-align: left;
}

.tt-portal-arrow {
  position: fixed;
  z-index: 3651;
  width: 8px;
  height: 8px;
  box-sizing: border-box;
  background: var(--tooltip-bg);
  border: 1px solid transparent;
  border-left: 0.5px solid var(--tooltip-arrow-border);
  border-top: 0.5px solid var(--tooltip-arrow-border);
  border-radius: 1px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) rotate(45deg);
  transform-origin: center;
  transition: opacity 0.18s var(--ease-out);
  display: none;
}

.tt-portal-arrow.show {
  opacity: 1;
}

/* ── Cards / tables ─────────────────────────────────────────────────────── */
.card {
  overflow: hidden;
}

.card-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

/* Right-side controls (filters + copy). Stay right-aligned and, when they wrap to
   their own row under a narrow toolbar, the copy button stays flush right. */
.toolbar-right {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Form controls (unified) ───────────────────────────────────────────────
   .field-input is the single base for every input box; variants/wrappers only
   add what's specific (icon room, numeric display). All chrome comes from the
   --control-* tokens so heights/borders never drift apart again. */
.field-input {
  height: var(--control-height);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  padding: 0 var(--control-pad-x);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg);
  outline: none;
  transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}

.field-input::placeholder {
  color: var(--fg-muted);
}

.field-input:focus {
  border-color: var(--control-border-focus);
  box-shadow: var(--ring-focus);
}

/* Numeric variant: centered input, regular text rendering */
.field-input--num {
  width: 60px;
  padding: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 400;
  font-variant-numeric: normal;
}

.search {
  position: relative;
  flex: 1 1 200px;
  max-width: 320px;
}

.search .field-input {
  width: 100%;
  padding-left: 34px;
  transition: padding-left 0.24s var(--ease-out), color 0.16s var(--ease-out), border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}

/* room for the leading icon */
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--fg-muted);
  pointer-events: none;
  transition: left 0.24s var(--ease-out), transform 0.24s var(--ease-out), color 0.18s var(--ease-out);
}

.responsive-search-toolbar.toolbar-search-compact {
  --toolbar-inner-gap: 8px;
  --toolbar-search-icon-left: calc((var(--control-height) - 15px) / 2);
  flex-wrap: nowrap;
  gap: var(--toolbar-inner-gap);
}

.responsive-search-toolbar.toolbar-search-compact .search {
  flex: 0 0 var(--control-height);
  width: var(--control-height);
  min-width: var(--control-height);
  max-width: var(--control-height);
  overflow: visible;
  transition: flex-basis 0.28s var(--ease-out), width 0.28s var(--ease-out), min-width 0.28s var(--ease-out), max-width 0.28s var(--ease-out);
}

.responsive-search-toolbar.toolbar-search-compact .search .field-input {
  padding: 0;
  color: transparent;
  caret-color: transparent;
}

.responsive-search-toolbar.toolbar-search-compact .search .field-input::placeholder {
  color: transparent;
}

.responsive-search-toolbar.toolbar-search-compact .search svg {
  left: var(--toolbar-search-icon-left);
  transform: translateY(-50%);
  color: var(--fg-secondary);
}

.responsive-search-toolbar.toolbar-search-compact .toolbar-right {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: var(--toolbar-inner-gap);
  margin-left: auto;
  min-width: 0;
}

.responsive-search-toolbar.toolbar-search-compact .filter-pills {
  flex-wrap: nowrap;
  gap: 4px;
  max-width: var(--toolbar-filter-pills-width, 240px);
  overflow: hidden;
  opacity: 1;
  transform: translateX(0) scaleX(1);
  transform-origin: right center;
  transition: max-width 0.26s var(--ease-out), opacity 0.16s var(--ease-out), transform 0.26s var(--ease-out), margin-right 0.26s var(--ease-out);
}

.responsive-search-toolbar.toolbar-search-compact .filter-pill,
.responsive-search-toolbar.toolbar-search-compact .toolbar-right > .btn {
  height: var(--control-height);
  min-height: var(--control-height);
}

.responsive-search-toolbar.toolbar-search-compact .filter-pill {
  padding: 0 10px;
}

.responsive-search-toolbar.toolbar-search-compact .toolbar-right > .btn {
  padding: 0 10px;
}

.responsive-search-toolbar.toolbar-search-compact.toolbar-search-expanded .search {
  flex: 0 1 var(--toolbar-search-expanded-width, 260px);
  width: var(--toolbar-search-expanded-width, 260px);
  min-width: 0;
  max-width: var(--toolbar-search-expanded-width, 260px);
}

.responsive-search-toolbar.toolbar-search-compact.toolbar-search-expanded .search .field-input {
  padding-left: 34px;
  color: var(--fg);
  caret-color: auto;
}

.responsive-search-toolbar.toolbar-search-compact.toolbar-search-expanded .search .field-input::placeholder {
  color: var(--fg-muted);
}

.responsive-search-toolbar.toolbar-search-compact.toolbar-search-expanded .search svg {
  left: var(--toolbar-search-icon-left);
  transform: translateY(-50%);
  color: var(--fg-muted);
}

.responsive-search-toolbar.toolbar-search-compact.toolbar-search-expanded .toolbar-right {
  margin-left: 0;
}

.responsive-search-toolbar.toolbar-search-compact.toolbar-search-expanded .filter-pills {
  max-width: 0;
  margin-right: calc(-1 * var(--toolbar-inner-gap, 8px));
  opacity: 0;
  transform: translateX(-6px) scaleX(0.94);
  pointer-events: none;
}

.responsive-search-toolbar.toolbar-search-compact.toolbar-search-expanded.toolbar-search-no-trailing {
  gap: 0;
}

/* Filter pills */
.filter-pills {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  height: 30px;
  padding: 0 14px;
  flex: 0 0 auto; /* 搜索框展开/收起动画收窄 pills 容器时,pill 不被压缩(由容器 overflow 裁剪) */
  white-space: nowrap; /* 避免瞬时被挤窄导致「全/部」换行 */
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  color: var(--fg-secondary);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.16s var(--ease-out), color 0.16s var(--ease-out), border-color 0.16s var(--ease-out);
}

.filter-pill:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

/* 选中态:用弱的 brand 微染(--accent-soft 16%)+ 实色文字 + 清晰描边,
   而不是纯蓝实底,避免与页面 primary CTA 抢戏;与全局 segmented/tab 选中风格一致。 */
.filter-pill.active {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--fg);
}

.filter-pill.active:hover {
  background: var(--accent-soft);
  color: var(--fg);
}

.filter-pill:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.spacer {
  flex: 1;
}

/* Tables keep fixed column widths and scroll horizontally as a whole when the
   viewport is too narrow, instead of letting columns shrink. min-width equals the
   desktop content width plus the usage column, so width:100% (capped by the
   container) and min-width coincide → the table is always wide enough and
   columns never resize; narrower viewports scroll .table-scroll. */
.table-scroll-shell {
  position: relative;
  overflow: hidden;
}

.table-scroll-shell::before,
.table-scroll-shell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s var(--ease-out);
}

.table-scroll-shell::before {
  left: 0;
  background: linear-gradient(90deg, rgba(18, 18, 20, 0.98), rgba(18, 18, 20, 0.72) 42%, rgba(18, 18, 20, 0));
}

.table-scroll-shell::after {
  right: 0;
  background: linear-gradient(270deg, rgba(18, 18, 20, 0.98), rgba(18, 18, 20, 0.72) 42%, rgba(18, 18, 20, 0));
}

.table-scroll-shell.has-left-fade::before {
  opacity: 1;
}

.table-scroll-shell.has-right-fade::after {
  opacity: 1;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll table {
  min-width: 1320px;
  table-layout: fixed;
  /* columns honor their widths so any cell can ellipsis-clip */
}

/* 激活码表只有 6 列且用百分比列宽(同买断方案,见 index.html thead):
   floor = 各列完整内容宽之和(230+120+100+240+120+78),窄于 floor 才横向滚动;
   宽于 floor 时所有列等比放缩,「使用者」不再独吞剩余空隙。
   买断模式的 body.is-buyout 覆盖(1110px)特异性更高,仍然生效。 */
#licensesSection .table-scroll table {
  min-width: 888px;
}

.table-pagination {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border-soft);
}

.table-pagination[hidden] {
  display: none;
}

.pagination-group,
.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination-btn,
.pagination-ellipsis {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--control-radius);
  font-family: var(--font-ui);
  line-height: 1;
}

.pagination-btn {
  border: 1px solid var(--border-soft);
  background: var(--bg-inset);
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: default;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out), color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  color: var(--fg);
}

.pagination-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.pagination-btn.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--bg-inset));
  color: var(--brand);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent);
}

.pagination-btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  color: var(--fg-faint);
}

.pagination-nav svg {
  width: 15px;
  height: 15px;
  display: block;
}

.pagination-ellipsis {
  border: 1px solid transparent;
  background: var(--bg-inset);
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 700;
}

.pagination-size {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
}

.pagination-size-trigger {
  height: 34px;
  min-width: 86px;
}

.pagination-size-menu {
  left: auto;
  right: 0;
}

.pagination-compact {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  color: var(--fg);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.pagination-compact-current {
  cursor: default;
}

.pagination-jump-input {
  padding: 0;
  text-align: center;
  cursor: text;
  appearance: none;
  -webkit-appearance: none;
}

.pagination-compact-divider,
.pagination-compact-total {
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.pagination-compact-divider {
  color: var(--fg-muted);
}

thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--fg-muted);
  padding: 8px 18px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.table-head-with-info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.table-head-info {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-faint);
  outline: none;
}

.table-head-info svg {
  width: 13px;
  height: 13px;
  display: block;
}

.table-head-info:hover,
.table-head-info:focus-visible {
  color: var(--fg-secondary);
}

.quota-head-th {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

tbody td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
  color: var(--fg);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.12s var(--ease-out);
}

/* 空态 / 加载态行(.empty-row)不参与 hover 交互:不变背景、不显示可点光标 */
tbody tr:not(.empty-row):hover {
  background: var(--bg-hover);
}

tbody tr.empty-row,
tbody tr.empty-row td {
  cursor: default;
}

td.num {
  font-variant-numeric: tabular-nums;
}

/* Provider icon (Apple tinted white; Google keeps brand colors) */
.provider-icon-apple {
  color: var(--fg);
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.pill.free {
  background: var(--bg-inset);
  color: var(--fg-secondary);
}

.pill.premium {
  background: var(--membership-gold-soft);
  color: var(--membership-gold);
}

.pill.activation {
  background: var(--accent-soft);
  color: var(--brand-tint);
}

.pill.used {
  background: var(--success-soft);
  color: var(--success);
}

.pill.unused {
  background: var(--bg-inset);
  color: var(--fg-secondary);
}

/* Quota cell */
.quota-column {
  text-align: left;
}

.quota-cell {
  --quota-pair-gap: clamp(6px, 4%, 12px);
  --quota-row-min-gap: 4px;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  vertical-align: middle;
}

.quota-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--quota-pair-gap);
  min-width: 0;
}

.quota-segment {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  width: 100%;
  min-width: 0;
}

.quota-value {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 2px;
  min-width: 0;
  padding-right: var(--quota-row-min-gap);
  font-size: 11px;
  line-height: 1;
  color: var(--fg-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quota-reset-btn {
  flex: 0 0 var(--icon-btn-size);
  margin-left: auto;
}

.quota-value b {
  color: var(--fg);
  font-size: 13px;
  font-weight: 650;
}

.quota-value.depleted b {
  color: var(--danger);
}

.quota-bar {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  /* light-grey track, clearly above the card bg */
  overflow: hidden;
}

.quota-bar i {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--brand);
  /* default blue fill */
}

.quota-bar i.depleted {
  background: var(--danger);
}

.quota-dash {
  color: var(--fg-faint);
  font-size: 14px;
}

.quota-na {
  font-size: 12px;
  color: var(--fg-tertiary);
}

/* Code / account cells */
.code-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: var(--fg);
  white-space: nowrap;
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-id-wrap {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
  outline: none;
}

.account-id-wrap:focus-visible {
  box-shadow: var(--ring-focus);
  border-radius: var(--radius-xs);
}

.account-id {
  display: inline-block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* 行内复制按钮:订阅模式隐藏(用悬停 popover 复制);买断模式列宽,直接展示在 ID 旁边。 */
.account-id-copy {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--brand-tint);
  transition: background 0.14s var(--ease-out), color 0.14s var(--ease-out);
}

.account-id-copy svg {
  width: var(--icon-btn-svg-size);
  height: var(--icon-btn-svg-size);
  display: block;
}

.account-id-copy:hover {
  background: var(--accent-soft);
}

.account-id-copy:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.account-id-copy.done {
  color: var(--success);
  background: var(--success-soft);
}

/* 买断模式:账号 ID 列足够宽 → 完整展示(不省略)+ 行内复制按钮,取消悬停 popover。 */
body.is-buyout .account-id {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

body.is-buyout .account-id-wrap {
  gap: 3px;
}

body.is-buyout .account-id-copy {
  display: inline-flex;
}

/* Interactive 账号 ID popover — full id + copy button, portaled to <body> */
.id-popover {
  position: fixed;
  z-index: 2100;
  display: none;
  align-items: center;
  gap: 6px;
  max-width: min(380px, calc(100vw - 16px));
  padding: 6px 6px 6px 11px;
  background: var(--tooltip-bg);
  border-radius: 10px;
  box-shadow: var(--shadow-popover);
  opacity: 0;
  transform: scale(0.96);
  transform-origin: top left;
  transition: opacity 0.16s var(--ease-out), transform 0.16s var(--ease-out);
}

.id-popover.show {
  opacity: 1;
  transform: scale(1);
}

.id-pop-text {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.id-pop-copy {
  flex: 0 0 auto;
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  aspect-ratio: auto;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--brand-tint);
  transition: background 0.14s var(--ease-out), color 0.14s var(--ease-out);
}

.id-pop-copy:hover {
  background: var(--accent-soft);
}

.id-pop-copy:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.id-pop-copy.done {
  color: var(--success);
  background: var(--success-soft);
}

.id-pop-copy svg {
  width: var(--icon-btn-svg-size);
  height: var(--icon-btn-svg-size);
  display: block;
}

.nowrap {
  white-space: nowrap;
}

.table-ellipsis-tooltip {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-col-hug {
  width: var(--table-col-hug-width);
  min-width: var(--table-col-hug-width);
  max-width: var(--table-col-hug-width);
  white-space: nowrap;
}

.table-action-cell {
  padding-left: 0;
  padding-right: var(--table-action-right-inset, 18px);
  text-align: left;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--table-action-gap, 4px);
  width: max-content;
  min-width: 0;
}

.col-codeterm {
  display: table-cell;
}

.usedby {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  color: var(--fg-secondary);
}

.usedby svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.account-email {
  display: block;
}

/* Bare inline spans can't ellipsis-clip (overflow needs a block-level box).
   账号 ID(设置弹窗/选择用户)与激活码列的 span 直接落在 td 里,必须显式
   转 block 才能打点省略并让按需 tooltip 检测到裁切。 */
.account-id-text,
.code-mono.table-ellipsis-tooltip {
  display: block;
}

.muted {
  color: var(--fg-faint);
}

.cell-time {
  font-size: 12.5px;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
}

.device-count {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-secondary);
  font-variant-numeric: tabular-nums;
}

.usage-total {
  display: inline-block;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* 会员期限 cell */
.term-range {
  display: block;
  font-size: 12.5px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.term-range i {
  font-style: normal;
  color: var(--fg-faint);
  margin: 0 6px;
}

.term-perm {
  font-size: 12.5px;
  color: var(--fg-muted);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background 0.16s var(--ease-out), transform 0.1s var(--ease-out), border-color 0.16s var(--ease-out);
}

.btn:hover {
  background: var(--bg-hover);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
}

.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn--primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-strong);
}

.btn--primary:disabled {
  background: var(--brand);
}

.btn--sm {
  /* 高度对齐 .btn 基础 32px,只收紧内边距/字号 → 同排 primary/ghost 小按钮
     (生成激活码 / 复制未使用 / 添加)高度一致;图标按钮走 .icon-btn 的
     --icon-btn-size(28px)覆盖,不受此高度影响,仍是 28px 方形。 */
  height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand-tint);
}

.btn--ghost:hover {
  background: var(--accent-soft);
}

/* Square icon-only buttons: hover background is a consistent square (w == h),
   width tracks height so it stays square at any breakpoint. */
.icon-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  aspect-ratio: auto;
  padding: 0;
  border-color: transparent;
}

.icon-btn:hover {
  background: var(--accent-soft);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.icon-btn svg {
  width: var(--icon-btn-svg-size);
  height: var(--icon-btn-svg-size);
  display: block;
  flex: none;
}

/* 重置图标在 1024 viewBox 内自带留白(图形仅占 ~83%),按默认 14px 渲染时可见箭头
   只有 ~11.7px,比点击后的 loading spinner(14px 环)小。放大到 17px 让可见箭头≈14px,
   两态尺寸一致,消除点击瞬间的跳变。 */
.reset-btn svg {
  width: var(--icon-btn-svg-size);
  height: var(--icon-btn-svg-size);
}

/* Code row actions (copy + delete).
   Delete confirmation swaps trash → check without changing the square icon
   button footprint, so no column or row action shifts when it is armed. */
#licensesSection {
  /* 2 icon buttons (28 + 28) + 4px gap + the normal 18px right table inset. */
  --code-action-column-width: 78px;
}

.license-action-col {
  --table-col-hug-width: var(--code-action-column-width);
}

.code-del {
  color: var(--fg-muted);
}

.code-del:hover {
  color: var(--danger);
  background: var(--accent-soft);
}

.code-del.confirming {
  color: #fff;
  background: var(--danger);
}

.code-del.confirming svg {
  width: var(--icon-btn-svg-size);
  height: var(--icon-btn-svg-size);
}

.btn.is-loading {
  color: transparent;
  position: relative;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  color: #fff;
}

.btn--primary.is-loading::after {
  color: #fff;
}

.btn:not(.btn--primary).is-loading::after {
  color: var(--fg-secondary); /* 灰色 loading spinner(重置等 ghost 按钮) */
}

.btn.is-done {
  color: var(--success);
  border-color: transparent;
  background: var(--success-soft);
}

/* ── Activation-code generator ──────────────────────────────────────────── */
/* 生成器与列表合并到同一张 .card 内:生成器自带内边距,并用底部分隔线与列表区分隔
   (与下方 .card-toolbar 的 border-bottom 同源,横向 18px 与搜索框左缘对齐)。 */
.gen-row {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  flex-wrap: wrap;
  padding: 16px 18px 0px 18px;
}

.field {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.login-card .login-field {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 7px;
}

.field-cta {
  margin-left: auto;
}

/* 生成激活码 CTA pinned to the right */
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-secondary);
  letter-spacing: -0.005em;
}

/* Segmented control */
.segmented {
  display: inline-flex;
  align-items: stretch;
  height: var(--control-height);
  /* border-box: matches every other control exactly */
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  padding: 3px;
  gap: 2px;
}

.segmented button {
  border: 0;
  background: transparent;
  border-radius: calc(var(--control-radius) - 3px);
  height: 100%;
  /* fills the inner area; total stays = --control-height */
  padding: 0 16px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg-secondary);
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out);
}

.segmented button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.segmented button.active {
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* 时限 dropdown — replaces the segmented control at the smallest breakpoint.
   Hidden on desktop; shown (and the segmented hidden) inside the 760px query. */
.seg-dropdown {
  display: none;
  position: relative;
}

.seg-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--control-height);
  min-width: 104px;
  padding: 0 12px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
  transition: background 0.16s var(--ease-out), border-color 0.16s var(--ease-out);
}

.seg-dropdown-trigger:hover {
  background: var(--bg-hover);
}

.seg-dropdown.is-open .seg-dropdown-trigger {
  border-color: var(--control-border-focus);
  box-shadow: var(--ring-focus);
}

.seg-dropdown-trigger:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.seg-dropdown-caret {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--fg-muted);
  transition: transform 0.18s var(--ease-out);
}

.seg-dropdown.is-open .seg-dropdown-caret {
  transform: rotate(180deg);
}

.seg-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  box-shadow: var(--shadow-popover);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s var(--ease-out), transform 0.16s var(--ease-out);
}

.seg-dropdown.is-open .seg-dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.seg-dropdown-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.seg-dropdown-menu.floating-layer {
  top: auto;
  left: auto;
  right: auto;
}

.seg-dropdown-option {
  height: 36px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  border-radius: calc(var(--control-radius) - 2px);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg-secondary);
  text-align: left;
  transition: background 0.14s var(--ease-out), color 0.14s var(--ease-out);
}

.seg-dropdown-option:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.seg-dropdown-option.is-active {
  background: var(--bg-inset);
  color: var(--fg);
}

/* Stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  height: var(--control-height);
}

.stepper button {
  width: 36px;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 18px;
  color: var(--brand-tint);
  border-radius: var(--control-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stepper button:hover {
  background: var(--bg-hover);
}

.stepper button:disabled {
  color: var(--fg-faint);
}

.stepper button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.stepper:focus-within {
  border-color: var(--control-border-focus);
  box-shadow: var(--ring-focus);
}

.stepper input {
  width: 52px;
  height: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  outline: none;
  font-variant-numeric: tabular-nums;
}

#licensesSection input,
.gen-modal input {
  font-family: var(--font-sans);
  font-weight: 400;
  font-variant-numeric: normal;
}

.stepper .unit {
  padding-right: 12px;
  font-size: 12.5px;
  color: var(--fg-muted);
}

.gen-btn {
  height: var(--control-height);
  padding: 0 22px;
}

/* 用 .modal.gen-modal 提高优先级:.modal 在源码中位于其后,同特异性会覆盖单类 .gen-modal */
.modal.gen-modal {
  gap: 0; /* 去掉 modal 各段间距,靠 form 自身的上下 margin 控制留白 */
}

.gen-modal-form {
  display: grid;
  gap: 14px;
  margin: 20px 0 22px;
}

.gen-modal-form .field {
  justify-content: space-between;
}

.gen-modal-form .gen-qty-field {
  justify-content: flex-start;
}

.gen-modal-form .field-input--num {
  padding: 0 var(--control-pad-x);
  text-align: left;
}

.field[hidden] {
  display: none;
}

/* Empty / loading states */
.empty {
  min-height: var(--table-state-body-height);
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--fg-muted);
  font-size: 13.5px;
}

/* Empty-folder illustration: opaque grey ramp baked into the SVG */
.empty svg {
  width: 92px;
  height: auto;
  margin-bottom: 14px;
  display: inline-block;
}

/* Empty state stays centered in the visible viewport while the header scrolls:
   the inner box is sticky to the scroll container's left edge, its width pinned
   to the client width (JS), so its centered content never leaves the window. */
.empty-row td {
  padding: 0;
  border-bottom: 0;
}

.empty-sticky {
  position: sticky;
  left: 0;
  display: flex;
  min-height: var(--table-state-body-height);
  justify-content: center;
}

/* Centered loading placeholder for list areas: spinner + 正在加载中… */
.loading-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg-muted);
  font-size: 13.5px;
}
.loading-spin {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.skeleton-row td {
  color: transparent;
}

.skeleton-row .sk {
  display: inline-block;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-inset) 25%, var(--bg-hover) 50%, var(--bg-inset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  width: 70%;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-spring);
  /* 全局反馈层,必须盖过 modal(3000)/floating-layer(3600)/tooltip(3650):
     弹窗内表格 tooltip 的一键复制也会 toast。 */
  z-index: 3700;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast svg {
  width: 16px;
  height: 16px;
}

.toast.success svg {
  color: var(--success);
}

.toast.error svg {
  color: var(--danger);
}

/* ── Publish operations ─────────────────────────────────────────────────── */
.sim-badge {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--warn);
  background: rgba(255, 186, 0, 0.12);
  border: 1px solid rgba(255, 186, 0, 0.3);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  vertical-align: middle;
}

.publish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.publish-card {
  /* Publish cards share the same structure (head + bottom), so the grid stretch
     keeps them equal height while each release action retains one clear CTA. */
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pub-head {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.pub-head > div,
.pub-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.pub-icon {
  flex: none;
  width: 45px;
  height: 45px;
  border-radius: var(--radius-s);
  background: var(--accent-soft);
  color: var(--brand-tint);
  display: grid;
  place-items: center;
}

.pub-icon svg {
  width: 24px;
  height: 24px;
}

.pub-title {
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pub-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  margin-bottom: 4px;
}

.pub-success-note {
  position: relative;
  flex: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(190px, 48%);
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--success);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: default;
}

.pub-success-note.is-cancel {
  max-width: none;
  color: var(--fg-secondary);
  transition: color 0.16s var(--ease-out), opacity 0.16s var(--ease-out);
}

.pub-success-note.is-default {
  max-width: min(210px, 54%);
  color: var(--fg-secondary);
  cursor: default;
  pointer-events: none;
}

.pub-success-note.is-cancel:hover {
  color: var(--fg);
}

.pub-success-note.is-cancelling {
  opacity: 0.62;
  cursor: default;
}

.pub-success-note[hidden] {
  display: none !important;
}

.pub-success-text,
.pub-success-time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pub-success-time {
  font-weight: 500;
}

.pub-success-close {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: scale(0.86);
  pointer-events: none;
  transition: opacity 0.14s var(--ease-out), transform 0.14s var(--ease-out), color 0.14s var(--ease-out), background 0.14s var(--ease-out);
}

.pub-success-note:hover .pub-success-close,
.pub-success-note:focus-visible .pub-success-close {
  opacity: 1;
  transform: scale(1);
  /* × 约六成面积悬在按钮盒外:显形后必须自己可命中,否则鼠标移进"盒外"
     部分时父级 :hover 丢失,× 边显边隐、无法点中。点击经冒泡走 note 的
     既有 click 处理。隐藏态保持 none,避免留下隐形热区。 */
  pointer-events: auto;
}

.pub-success-note.is-cancel .pub-success-close {
  display: none;
}

.pub-success-note.is-default .pub-success-close {
  display: none;
}

.pub-success-note:hover .pub-success-close {
  color: var(--fg);
  background: var(--bg-inset);
}

.pub-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--fg-secondary);
}

.pub-fail-link {
  position: relative;
  flex: none;
  margin-left: auto;
  margin-top: 1px;
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* 失败提示右上角的关闭 ×:与 .pub-success-close 同规格。悬停/聚焦显形,
   点击只清除失败提示(app.js 里拦截,不打开详情弹窗)。 */
.pub-fail-close {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: scale(0.86);
  pointer-events: none;
  transition: opacity 0.14s var(--ease-out), transform 0.14s var(--ease-out), color 0.14s var(--ease-out), background 0.14s var(--ease-out);
}

.pub-fail-link:hover .pub-fail-close,
.pub-fail-link:focus-visible .pub-fail-close {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.pub-fail-close:hover {
  color: var(--fg);
  background: var(--bg-inset);
}

.pub-fail-link:hover {
  color: var(--danger-strong, var(--danger));
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pub-fail-link[hidden] {
  display: none;
}

/* Log sits above the button; button pinned to the card bottom */
.pub-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pub-actions .btn {
  width: 100%;
  height: 38px;
  overflow: hidden;
  min-width: 0;
}

.pub-status-button {
  position: relative;
}

.pub-status-button .publish-label-viewport {
  position: relative;
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 1.25em;
  line-height: 1.25;
  overflow: hidden;
  text-align: center;
}

.publish-label-current,
.publish-label-next {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  will-change: transform, opacity;
  transition: transform 0.34s var(--ease-out), opacity 0.24s var(--ease-out);
}

#publishSection .is-log-label .publish-label-current,
#publishSection .is-log-label .publish-label-next {
  color: var(--fg-secondary);
}

#publishSection .pub-status-button.is-log-label > svg {
  display: none;
}

.publish-label-next {
  position: absolute;
  inset: 0;
  transform: translateY(115%);
  opacity: 0;
}

.publish-label-next.is-active {
  transform: translateY(0);
  opacity: 1;
}

.publish-label-current.is-exiting {
  transform: translateY(-115%);
  opacity: 0;
}

.pub-status-button.is-loading {
  color: var(--fg);
  padding-left: 38px;
  pointer-events: auto;
  cursor: default;
}

.pub-status-button.is-loading::after {
  left: 15px;
  top: calc(50% - 7px);
  color: var(--fg-secondary);
}

.pub-status-button.btn--primary.is-loading {
  color: #fff;
}

.pub-status-button.btn--primary.is-loading::after {
  color: #fff;
}

.pub-log {
  display: none !important;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--fg-secondary);
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  max-height: 46px; /* show ~one line; older output scrolls within */
  overflow-y: auto;
}

.pub-log.dashboard-publish-log {
  margin-bottom: 16px;
  max-height: 74px;
}
/* When scrolled away from the top, fade the TOP edge: the older content above
   dissolves into the dark background and the text resolves as it moves down
   (顶部纯黑 → 越往下逐渐显现文字). A mask on the scroll port itself is more
   reliable than a sticky pseudo-element with negative margins. */
.pub-log.scrolled {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}

.pub-log div {
  color: var(--fg-secondary);
}

.pub-log div.ok::before {
  content: "✓ ";
  color: var(--success);
  font-weight: 700;
}

.pub-log div.res {
  color: var(--fg);
  font-weight: 600;
  margin-top: 6px;
}

.pub-log div.res::before {
  content: "● ";
  color: var(--brand-tint);
}

.pub-log div.err {
  color: var(--danger);
}

.publish-error-modal {
  max-width: 680px;
}

.publish-version-modal {
  max-width: 520px;
}

.publish-version-body {
  display: grid;
  gap: 14px;
}

.publish-version-summary {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-s);
  background: var(--bg-inset);
}

.publish-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--fg-secondary);
  font-size: 12.5px;
}

.publish-version-row strong {
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.publish-version-field {
  display: grid;
  gap: 8px;
}

.publish-version-hint,
.publish-version-error {
  margin: -4px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
}

.publish-version-hint {
  color: var(--fg-secondary);
}

.publish-version-hint.is-upgrade {
  color: var(--success);
}

.publish-version-hint.is-replace {
  color: var(--membership-gold);
}

.publish-version-error {
  color: var(--danger);
}

.publish-error-log {
  margin: 0;
  max-height: min(56vh, 520px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--fg-secondary);
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-s);
  padding: 12px 14px;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overscroll-behavior: contain;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  position: relative; /* anchor the close button so it never pushes the header */
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid transparent;
  border-radius: var(--radius-l);
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--card-border-grad) border-box;
  box-shadow: var(--shadow-popover);
}
/* 标题+副标题占满整行、左对齐(关闭按钮绝对定位,不参与布局),
   参考插件二次确认弹窗 .confirm-dialog-header 的整列式标题组。 */
.modal-head {
  display: block;
}
.modal-title {
  margin: 0;
  padding-right: 40px; /* 给绝对定位的关闭按钮留位,标题不会顶到/穿到按钮下面 */
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.modal-desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--fg-secondary);
}
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: var(--icon-btn-size-lg);
  height: var(--icon-btn-size-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--fg-muted);
  transition: background 0.14s var(--ease-out), color 0.14s var(--ease-out);
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--fg);
}
.modal-close svg {
  width: var(--icon-btn-svg-size-lg);
  height: var(--icon-btn-svg-size-lg);
  display: block;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Settings modal ─────────────────────────────────────────────────────── */
.settings-modal {
  max-width: 680px;
}

.settings-picker-modal {
  max-width: 620px;
}

.settings-body {
  display: grid;
  gap: 22px;
}

.settings-block {
  min-width: 0;
}

.settings-block-head,
.settings-date-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

/* 主标题 + 副标题同一行:间距 8px、垂直居中;右侧操作区(添加按钮 / 日期控件)留在这一行。 */
.settings-block-head > div,
.settings-date-field > span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.settings-block h4 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 650;
  color: var(--fg);
}

.settings-block p,
.settings-date-field i {
  display: block;
  margin: 0; /* 与主标题同行,去掉原来用于竖排堆叠的上间距 */
  color: var(--fg-muted);
  font-style: normal;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.45;
}

.settings-table-shell {
  margin-top: 12px;
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-m);
}

.settings-picker-modal .settings-table-shell {
  margin-top: 0;
}

.settings-table-scroll {
  max-height: 228px;
  overflow: auto;
}

/* 空态时取消高度上限:让固定高度(220px)的居中 icon+文案 完整显示、不被滚动裁剪,
   与外部表格空态保持一致。有数据时仍受 max-height 限制并滚动。 */
.settings-table-scroll:has(.empty-row) {
  max-height: none;
}

.settings-picker-modal .settings-table-scroll {
  max-height: min(360px, calc(100vh - 260px));
}

.settings-table-shell .table-scroll table {
  min-width: 520px;
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-ui);
  font-size: 12px;
}

.settings-table th,
.settings-table td {
  height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border-faint);
  text-align: left;
  vertical-align: middle;
}

.settings-table tr:last-child td {
  border-bottom: 0;
}

.settings-table .empty-row td {
  height: auto;
  padding: 0;
}

.settings-table th {
  color: var(--fg-muted);
  font-weight: 500;
}

.settings-table td {
  color: var(--fg-secondary);
}

.settings-table .usedby,
.settings-table .account-id-wrap {
  max-width: 100%;
}

.settings-action-head,
.settings-action-cell {
  width: 44px;
}

.settings-action-cell {
  padding-left: 0;
}

.settings-check-col {
  width: 36px;
}

.settings-check {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.settings-date-field b {
  display: block;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 650;
}

.settings-date-control {
  position: relative;
  flex: 0 0 auto;
}

.settings-date-field .settings-date-input {
  width: 148px;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2'%3e%3c/rect%3e%3cpath d='M16 2v4M8 2v4M3 10h18'%3e%3c/path%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}

.settings-date-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 256px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--tooltip-bg);
  box-shadow: var(--shadow-popover);
}

.settings-date-popover.floating-layer {
  top: auto;
  left: auto;
  right: auto;
}

.settings-date-popover-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.settings-date-popover-head span {
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.settings-date-nav {
  width: 28px;
  height: 28px;
  border-radius: calc(var(--control-radius) - 2px);
}

.settings-date-nav svg {
  width: 15px;
  height: 15px;
}

.settings-date-weekdays,
.settings-date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.settings-date-weekdays {
  margin-bottom: 4px;
}

.settings-date-weekdays span {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
}

.settings-date-day,
.settings-date-blank {
  height: 28px;
  border-radius: calc(var(--control-radius) - 3px);
}

.settings-date-day {
  border: 0;
  background: transparent;
  color: var(--fg-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 550;
  transition: background 0.12s var(--ease-out), color 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out);
}

.settings-date-day:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.settings-date-day.is-today {
  color: var(--brand-tint);
}

.settings-date-day.is-selected {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent);
}

@media (max-width: 560px) {
  .settings-date-field {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-date-control,
  .settings-date-field .settings-date-input {
    width: 100%;
  }

  .settings-date-popover {
    left: 0;
    right: auto;
    width: min(100%, 256px);
  }
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 840px) {

  /* Stack the equation; operators only make sense in the single-row desktop layout */
  .metric-grid {
    flex-direction: column;
    gap: 12px;
  }

  .equation {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .eq-op,
  .metric-sep {
    display: none;
  }

  .eq-total,
  .eq-cell {
    min-height: auto;
  }

  .eq-group {
    flex: 1 1 auto;
  }

  .metric-card.revenue {
    flex: 1 1 auto;
  }

  .usage-trend-card {
    grid-template-columns: 1fr;
    row-gap: 8px;
    padding: 20px 18px 18px;
  }

  .usage-trend-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(158px, 220px);
    grid-template-rows: auto;
    align-items: start;
    gap: 12px 16px;
  }

  .usage-trend-summary {
    grid-column: 1;
    grid-row: 1;
  }

  .usage-trend-legend {
    grid-column: 2;
    grid-row: 1;
    width: min(100%, 160px);
    justify-self: end;
    align-self: start;
  }

  .usage-trend-chart {
    height: 238px;
  }

  .publish-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .pub-actions .btn {
    height: 44px;
  }

  .container {
    padding: 28px 14px 72px;
  }

  .topbar-inner {
    padding: 0 14px;
  }

  .topbar-time {
    display: none;
  }

  /* 最小断点:logo 后保留 ScreenSync 字样,仅隐藏 Dashboard 后缀 */
  .topbar-brand .brand-wordmark-suffix {
    display: none;
  }

  .section-title {
    font-size: 22px;
  }

  /* 发布 dashboard 按钮在最小断点仍与标题同行、靠右、hug 内容(不再全宽、不迁移)。
     标题栏禁止换行 + 标题区可收缩,保证按钮不被挤到下一行。 */
  #publishSection .section-head {
    flex-wrap: nowrap;
  }

  #publishSection .section-head > div {
    min-width: 0;
  }

  .section-action {
    flex: none;
    min-height: 44px;
    margin-left: auto;
  }

  #publishDashboardBtn:not(.is-log-label) .publish-label-viewport {
    flex: 0 1 auto;
    width: auto;
  }

  .login-submit {
    height: 44px;
  }

  .metric-grid {
    gap: 10px;
  }

  .metric-value {
    font-size: 28px;
  }

  .usage-trend-total {
    height: 28px;
    font-size: 28px;
  }

  /* 时限 + 生成数量 (+ 时长 when shown) flow together on one row, left-aligned;
     the CTA stays flush right (wraps below only when there isn't room). */
  .gen-row {
    gap: 14px 20px;
    align-items: center;
  }

  .gen-row .field {
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .gen-row .field-cta {
    margin-left: auto;
  }

  /* 时限:窄屏空间不够横排三段 segmented,换成同风格 dropdown */
  #typeSeg {
    display: none;
  }

  .seg-dropdown {
    display: inline-flex;
  }

  /* Comfortable tap targets on phones — one token bumps every control at once */
  :root {
    --control-height: 32px;
  }

  .filter-pill {
    min-height: 40px;
    padding: 0 18px;
  }

  .btn--sm {
    height: 32px;
  }

  .stepper button {
    width: 44px;
  }

  /* Tables keep their columns and scroll horizontally (base .table-scroll). */
}

/* ── 销售模式（订阅 / 买断）─────────────────────────────────────────────────
   买断模式下隐藏期限维度：用户列表「会员期限」列、激活码列表「时限」列、
   发码区「时限/时长」字段。会员状态 pill 简化为 Free/Premium/Activated。 */
.mode-toggle-btn {
  color: var(--membership-gold);
  border-color: color-mix(in srgb, var(--membership-gold) 42%, var(--border-strong));
  background: color-mix(in srgb, var(--membership-gold) 12%, var(--border-faint));
}

.mode-toggle-btn:hover {
  background: color-mix(in srgb, var(--membership-gold) 18%, var(--border-faint));
  border-color: color-mix(in srgb, var(--membership-gold) 58%, var(--border-strong));
}

body.is-buyout .col-term,
body.is-buyout .col-codeterm,
body.is-buyout #genTypeField,
body.is-buyout #durationField {
  display: none;
}

/* 买断模式列少、空间足:保持 fixed 布局(空态与有数据列宽完全一致、加载时不跳动),
   各列宽用「百分比」(每表合计 100%)+ 整表 width:100% 填满容器 →「所有列」在
   [floor, 容器最大宽] 之间等比例一起放缩(不是只有某一列在变),且任何宽度都填满无右侧空白;
   窄于 floor 才整表横向滚动。floor(= min-width)= 各列「完整内容宽」之和,
   保证收到最窄(=floor)时长内容(账号ID/邮箱/时间)仍完整不省略。 */
body.is-buyout #usersSection .table-scroll table { min-width: 1230px; }
body.is-buyout #licensesSection .table-scroll table { min-width: 1110px; }

/* 用户表买断各列比例(隐藏的「会员期限」第 5 列跳过;可见列合计 100%) */
body.is-buyout #usersSection thead th:nth-child(1) { width: 20.50% !important; } /* 账号(邮箱) */
body.is-buyout #usersSection thead th:nth-child(2) { width: 22.46% !important; } /* 账号 ID */
body.is-buyout #usersSection thead th:nth-child(3) { width: 15.64% !important; } /* 注册时间 */
body.is-buyout #usersSection thead th:nth-child(4) { width: 9.40% !important; }  /* 会员状态 */
body.is-buyout #usersSection thead th:nth-child(6) { width: 5.56% !important; }  /* 设备数 */
body.is-buyout #usersSection thead th:nth-child(7) { width: 10.73% !important; } /* 总使用量 */
body.is-buyout #usersSection thead th:nth-child(8) { width: 15.71% !important; } /* 今日额度 */

/* 激活码表买断各列比例(隐藏的「时限」第 2 列跳过;可见列合计 100%) */
body.is-buyout #licensesSection thead th:nth-child(1) { width: 27.03% !important; } /* 激活码 */
body.is-buyout #licensesSection thead th:nth-child(3) { width: 10.81% !important; } /* 状态 */
body.is-buyout #licensesSection thead th:nth-child(4) { width: 39.82% !important; } /* 使用者(邮箱) */
body.is-buyout #licensesSection thead th:nth-child(5) { width: 15.31% !important; } /* 生成时间 */
body.is-buyout #licensesSection .license-action-col {
  width: var(--code-action-column-width) !important;
  min-width: var(--code-action-column-width);
  max-width: var(--code-action-column-width);
} /* 操作 */

/* 付费配置弹窗 */
.payment-config-modal {
  max-width: 560px;
}

.payment-config-body {
  display: grid;
  gap: 16px;
  margin: 18px 0 20px;
}

.payment-config-row,
.payment-price-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.payment-config-label {
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.payment-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: var(--bg-inset);
  gap: 3px;
}

.payment-mode-tabs button {
  border: 0;
  border-radius: calc(var(--control-radius) - 3px);
  background: transparent;
  color: var(--fg-tertiary);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.16s var(--ease-out), color 0.16s var(--ease-out);
}

.payment-mode-tabs button.active {
  background: var(--fg);
  color: #151518;
}

.payment-price-list {
  display: grid;
  gap: 14px;
}

.payment-price-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.payment-price-pair .payment-price-row {
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 16px;
}

.payment-price-pair .payment-config-label {
  white-space: nowrap;
}

.payment-price-value {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-start;
  color: var(--fg);
}

.payment-price-main {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
}

.payment-price-compare {
  color: var(--fg-faint);
  font-size: 14px;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.payment-edit-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--fg-muted);
  box-shadow: none;
  transition: background 0.16s var(--ease-out), color 0.16s var(--ease-out);
}

.payment-edit-btn:hover,
.payment-edit-btn:focus-visible {
  background: var(--accent-soft);
  color: #8d98ad;
}

.payment-edit-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.payment-edit-btn svg {
  width: var(--icon-btn-svg-size);
  height: var(--icon-btn-svg-size);
  display: block;
}

.payment-input-wrap {
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  padding: 0 8px 0 10px;
  color: var(--fg);
  transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}

.payment-input-wrap:focus-within {
  border-color: var(--control-border-focus);
  box-shadow: var(--ring-focus);
}

.payment-input-prefix {
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
}

.payment-amount-input {
  width: 66px;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 650;
  padding: 0;
  outline: none;
}

.payment-amount-input:focus {
  box-shadow: none;
}

.payment-confirm-modal {
  max-width: 780px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.payment-confirm-head {
  padding-right: 364px;
}

.payment-confirm-head-controls {
  position: absolute;
  top: 20px;
  right: calc(18px + var(--icon-btn-size-lg) + 8px);
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.payment-currency-tabs {
  height: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--control-radius);
  background: var(--bg-inset);
}

.payment-currency-tabs button {
  min-width: 34px;
  height: 100%;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--control-radius) - 3px);
  background: transparent;
  color: var(--fg-tertiary);
  box-shadow: none;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: background 0.16s var(--ease-out), color 0.16s var(--ease-out);
}

.payment-currency-tabs button:hover {
  color: var(--fg);
}

.payment-currency-tabs button.active {
  background: var(--fg);
  color: #151518;
}

.payment-rounding-control {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
}

.payment-rounding-native {
  display: none;
}

.payment-rounding-trigger {
  min-width: 78px;
}

.payment-rounding-menu {
  left: auto;
  right: 0;
}

.payment-confirm-options {
  display: grid;
  gap: 24px;
  margin-bottom: 16px;
}

.payment-mode-card {
  position: relative;
  width: 100%;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--bg-inset);
  color: var(--fg);
  font-family: var(--font-sans);
  text-align: left;
  transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out), background 0.16s var(--ease-out);
}

.payment-mode-card:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--bg-inset) 88%, white);
}

.payment-mode-card.is-selected {
  border-color: var(--membership-gold);
  background: var(--bg-inset);
  box-shadow: 0 0 0 1px var(--membership-gold), 0 0 0 3px rgba(255, 168, 0, 0.1);
}

.payment-mode-card-title {
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.payment-mode-card-check {
  display: none;
}

.payment-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payment-plan-grid.is-buyout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-plan-card {
  min-height: 214px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--bg-card);
  color: var(--fg);
}

.payment-plan-card.is-free,
.payment-plan-card.is-premium {
  background: var(--bg-card);
  border-color: var(--border-strong);
}

.payment-plan-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--fg);
}

.payment-plan-price {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.payment-plan-price small {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
}

.payment-plan-compare {
  width: fit-content;
  color: var(--fg-faint);
  font-size: 12px;
  line-height: 1;
  text-decoration: line-through;
}

.payment-plan-desc {
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.45;
  min-height: 35px;
}

.payment-plan-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  color: var(--fg-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.payment-plan-feature {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 4px;
  align-items: start;
}

.payment-plan-feature::before {
  content: "✓";
  color: var(--fg-tertiary);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
}

.payment-plan-feature.is-premium::before {
  color: var(--membership-gold);
}

.payment-confirm-error {
  margin: -6px 0 16px;
  color: var(--danger);
  font-size: 12.5px;
}

@media (max-width: 760px) {
  .table-pagination {
    justify-content: flex-end;
    padding-left: 48px;
    scroll-padding-left: 48px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .payment-plan-grid,
  .payment-plan-grid.is-buyout {
    grid-template-columns: 1fr;
  }
}
