/* =========================================================
   app-user.css v2 — Commercial-grade refinement
   - Black/white as primary CTA (Apple Music / Things / Linear pattern)
   - Blue as semantic-only (info / links)
   - Two card weights: hairline vs elevated
   - Hand-tuned type ramp, spacing rhythm, focus, press states
   - Light + Dark via [data-theme]
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root,
:root[data-theme="light"] {
  /* Surfaces — Apple-grade light grey base */
  --bg-page:       #f5f5f7;
  --bg-surface:    #ffffff;
  --bg-raised:     #ffffff;
  --bg-sunken:     #ebebed;
  --bg-translucent:rgba(245,245,247,0.82);
  --bg-overlay:    rgba(0,0,0,0.30);

  /* Aliases (preserve v1 compat) */
  --background:           var(--bg-surface);
  --background-page:      var(--bg-page);
  --background-elevated:  var(--bg-surface);
  --background-translucent: var(--bg-translucent);
  --muted:                var(--bg-sunken);
  --muted-2:              #dfdfe2;

  /* Text — warm-neutral, slightly off-pure-black */
  --fg:                   #0a0a0c;
  --fg-secondary:         #3f3f46;
  --fg-muted:             #71717a;
  --fg-faint:             #a1a1aa;
  --foreground:           var(--fg);
  --foreground-secondary: var(--fg-secondary);
  --muted-foreground:     var(--fg-muted);

  /* Borders — composed in oklch-equivalent for cleaner appearance */
  --border:               rgba(0,0,0,0.09);
  --border-strong:        rgba(0,0,0,0.15);
  --border-faint:         rgba(0,0,0,0.05);
  --border-divider:       rgba(0,0,0,0.06);

  /* Accent — used sparingly: links, info badges, focus ring */
  --accent:               #0066cc;
  --accent-hover:         #0058b0;
  --accent-light:         rgba(0,102,204,0.10);
  --primary:              var(--fg);              /* compat — now neutral */
  --primary-hover:        var(--fg-secondary);
  --primary-active:       var(--fg-secondary);
  --primary-light:        var(--bg-sunken);
  --primary-light-hex:    #ebebed;

  /* Semantic */
  --success:              #047857;
  --success-light:        rgba(4,120,87,0.10);
  --warning:              #b45309;
  --warning-light:        rgba(180,83,9,0.10);
  --danger:               #b91c1c;
  --danger-light:         rgba(185,28,28,0.10);
  --info:                 var(--accent);
  --info-light:           var(--accent-light);
  --purple:               #7c3aed;
  --purple-light:         rgba(124,58,237,0.10);

  /* Selection / hover */
  --selection-bg:         rgba(0,0,0,0.10);
  --hover-bg:             rgba(0,0,0,0.045);
  --press-bg:             rgba(0,0,0,0.075);

  /* Layout */
  --sidebar-width: 186px;
  --sidebar-collapsed-width: 72px;
  --header-height: 56px;

  /* Radii */
  --r-1:  4px;
  --r-2:  6px;
  --r-3:  8px;
  --r-4:  10px;
  --r-5:  12px;
  --r-6:  14px;
  --r-7:  18px;
  --r-8:  22px;
  --r-pill: 9999px;
  /* compat */
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  10px;
  --radius-xl:  14px;
  --radius-2xl: 18px;
  --radius-3xl: 22px;
  --radius-full: 9999px;

  /* Layered shadows — ambient + occlusion (real-light feel) */
  --shadow-1: 0 1px 1px rgba(0,0,0,.04);
  --shadow-2: 0 1px 2px rgba(0,0,0,.05), 0 0 0 0.5px rgba(0,0,0,.04);
  --shadow-3: 0 6px 16px -4px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-4: 0 16px 36px -8px rgba(0,0,0,.10), 0 4px 8px -2px rgba(0,0,0,.05);
  --shadow-5: 0 32px 64px -12px rgba(0,0,0,.16), 0 8px 16px -4px rgba(0,0,0,.06);
  --shadow-card: var(--shadow-2);

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", "Consolas", monospace;

  /* Motion — hand-tuned curves */
  --ease-out:    cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 280ms;
  --transition: all var(--t-base) var(--ease-out);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg-page:       #000000;          /* OLED true black */
  --bg-surface:    #1c1c1e;
  --bg-raised:     #2c2c2e;
  --bg-sunken:     #141416;
  --bg-translucent:rgba(28,28,30,0.78);
  --bg-overlay:    rgba(0,0,0,0.55);

  --background:           var(--bg-surface);
  --background-page:      var(--bg-page);
  --background-elevated:  var(--bg-surface);
  --background-translucent: var(--bg-translucent);
  --muted:                var(--bg-raised);
  --muted-2:              #3a3a3c;

  --fg:                   #f5f5f7;
  --fg-secondary:         #d4d4d8;
  --fg-muted:             #98989d;
  --fg-faint:             #6c6c70;
  --foreground:           var(--fg);
  --foreground-secondary: var(--fg-secondary);
  --muted-foreground:     var(--fg-muted);

  --border:               rgba(255,255,255,0.10);
  --border-strong:        rgba(255,255,255,0.18);
  --border-faint:         rgba(255,255,255,0.06);
  --border-divider:       rgba(255,255,255,0.07);

  --accent:               #4d9fff;
  --accent-hover:         #6cb0ff;
  --accent-light:         rgba(77,159,255,0.18);
  --primary:              var(--fg);              /* compat — now neutral */
  --primary-hover:        var(--fg-secondary);
  --primary-active:       var(--fg-secondary);
  --primary-light:        var(--bg-sunken);
  --primary-light-hex:    #141416;

  --success:              #34d399;
  --success-light:        rgba(52,211,153,0.18);
  --warning:              #fbbf24;
  --warning-light:        rgba(251,191,36,0.18);
  --danger:               #f87171;
  --danger-light:         rgba(248,113,113,0.18);
  --info:                 var(--accent);
  --info-light:           var(--accent-light);
  --purple:               #c084fc;
  --purple-light:         rgba(192,132,252,0.18);

  --selection-bg:         rgba(255,255,255,0.15);
  --hover-bg:             rgba(255,255,255,0.06);
  --press-bg:             rgba(255,255,255,0.10);

  --shadow-1: 0 1px 1px rgba(0,0,0,.40);
  --shadow-2: 0 1px 2px rgba(0,0,0,.50), 0 0 0 0.5px rgba(255,255,255,.04);
  --shadow-3: 0 8px 20px -6px rgba(0,0,0,.60), 0 2px 4px rgba(0,0,0,.40);
  --shadow-4: 0 20px 40px -12px rgba(0,0,0,.70), 0 4px 8px rgba(0,0,0,.40);
  --shadow-5: 0 36px 72px -16px rgba(0,0,0,.80), 0 8px 16px -4px rgba(0,0,0,.40);
  --shadow-card: 0 0 0 0.5px rgba(255,255,255,.04);

  color-scheme: dark;
}

/* ---------- Reset & base ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--fg);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "ss01" 1, "ss03" 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.003em;
  transition: background 220ms var(--ease-out), color 220ms var(--ease-out);
}
a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-hover); }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }
::selection { background: var(--selection-bg); color: inherit; }

/* Typography refinements: numerics tabular, headings tight */
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.022em; text-wrap: balance; }
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* Scrollbar — minimal, neutral */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*:hover::-webkit-scrollbar-thumb,
*:hover > ::-webkit-scrollbar-thumb { background: rgba(120,120,128,0.30); background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,120,128,0.50) !important; background-clip: content-box; }

/* =========================================================
   LAYOUT
   ========================================================= */
#app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-page);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden;
  position: relative; z-index: 100;
  transition: background 220ms var(--ease-out), width 200ms ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: var(--header-height);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 26px; height: 26px;
  color: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: none !important;
}
:root[data-theme="dark"] .sidebar-logo .logo-icon { background: transparent; }
.sidebar-logo .logo-icon svg { color: inherit; }
.sidebar-logo .logo-text {
  font-size: 14.5px; font-weight: 600;
  color: var(--fg);
  white-space: nowrap; overflow: hidden;
  letter-spacing: -0.018em;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav-section-title {
  font-size: 11px; font-weight: 500;
  color: var(--fg-faint);
  letter-spacing: 0.01em;
  padding: 16px 22px 8px;
  text-transform: none;
}
.mt-3 { margin-top: 14px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  margin: 2px 8px;
  border-radius: 7px;
  font-size: 13px; font-weight: 450;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
  white-space: nowrap; overflow: hidden;
  letter-spacing: -0.008em;
  position: relative;
}
.nav-item:hover { background: var(--hover-bg); color: var(--fg); }
.nav-item:hover svg { color: var(--fg-secondary); }
.nav-item.active {
  background: rgba(0,0,0,0.07);
  color: var(--fg);
  font-weight: 600;
  box-shadow: none;
}
:root[data-theme="dark"] .nav-item.active { background: var(--bg-raised); box-shadow: none; }
.nav-item.active svg { color: var(--fg); }
.nav-item svg {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--fg-muted);
  transition: color var(--t-fast);
  stroke-width: 1.6;
}

/* Outline / filled icon toggle */
.nav-item .ico-fill { display: none; }
.nav-item .ico-line { display: block; }
.nav-item:hover .ico-line,
.nav-item.active .ico-line { display: none; }
.nav-item:hover .ico-fill,
.nav-item.active .ico-fill { display: block; }

.nav-item span { overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 8px;
  flex-shrink: 0;
}

/* ---------- Sidebar Toggle Button ---------- */
.sidebar-toggle-btn {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  color: var(--fg-muted);
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast), color var(--t-fast);
  margin-left: auto;
  line-height: 1;
}
.sidebar-toggle-btn:hover {
  background: var(--hover-bg);
  border-color: var(--border);
  color: var(--fg-secondary);
}

/* ---------- Sidebar Collapsed State ---------- */
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .sidebar-logo {
  padding: 0 10px;
  justify-content: space-between;
  gap: 0;
}
.sidebar.collapsed .logo-text { display: none; }
.sidebar.collapsed .sidebar-toggle-btn { margin-left: 0; }
.sidebar.collapsed .nav-section-title { display: none; }
.sidebar.collapsed .nav-item {
  padding: 11px 0;
  margin: 2px 8px;
  justify-content: center;
  gap: 0;
}
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-item svg { width: 18px; height: 18px; }
.sidebar.collapsed .sidebar-text { display: none; }
.sidebar.collapsed #user-menu-btn {
  justify-content: center;
  padding: 8px 0;
  gap: 0;
}

/* ---------- Sidebar Nav Tooltip ---------- */
#sidebar-nav-tooltip {
  position: fixed;
  background: var(--fg);
  color: var(--bg-surface);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  display: none;
  transform: translateY(-50%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  letter-spacing: 0.01em;
}
.sidebar-footer > div > div:first-child { border-radius: 8px; transition: background var(--t-fast); }
.sidebar-footer > div > div:first-child:hover { background: var(--hover-bg); }

/* Header — translucent toolbar */
.header {
  height: var(--header-height);
  background: var(--bg-translucent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 22px; gap: 12px;
  flex-shrink: 0;
  position: relative; z-index: 50;
}
.header-title {
  font-size: 14.5px; font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.018em;
}

/* Main */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.main-content {
  flex: 1; overflow-y: auto;
  padding: 28px 32px 48px;
  transition: padding-right 0.3s cubic-bezier(0.4,0,0.2,1);
  /* Organic blob bg: multiple soft white/gray glows on mid-gray base — same language as reference */
  background:
    radial-gradient(circle 52vw at  8% 18%, rgba(255,255,255,0.90) 0%, transparent 100%),
    radial-gradient(circle 38vw at 88% 72%, rgba(255,255,255,0.82) 0%, transparent 100%),
    radial-gradient(circle 32vw at 62% 38%, rgba(205,205,212,0.70) 0%, transparent 100%),
    radial-gradient(circle 44vw at 30% 82%, rgba(238,238,242,0.75) 0%, transparent 100%),
    radial-gradient(circle 28vw at 75% 12%, rgba(220,220,226,0.55) 0%, transparent 100%),
    #dcdcdf;
}
:root[data-theme="dark"] .main-content {
  background:
    radial-gradient(circle 52vw at  8% 18%, rgba(255,255,255,0.045) 0%, transparent 100%),
    radial-gradient(circle 38vw at 88% 72%, rgba(255,255,255,0.030) 0%, transparent 100%),
    radial-gradient(circle 32vw at 62% 38%, rgba(255,255,255,0.018) 0%, transparent 100%),
    #000000;
}

/* Page header */
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 26px; font-weight: 650;
  color: var(--fg);
  line-height: 1.18;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
.page-header p {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 6px;
  font-weight: 400;
  letter-spacing: -0.005em;
  max-width: 70ch;
}
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}

/* =========================================================
   COMPONENTS
   ========================================================= */

/* Card — default = quiet (hairline, no shadow) */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-7);
  padding: 22px;
  box-shadow: none;
  transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
.card.elevated, .card-elevated { box-shadow: var(--shadow-2); }
.card.elevated:hover, .card-elevated:hover {
  box-shadow: var(--shadow-3);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.card-sm { padding: 14px 16px; }
.card-lg { padding: 28px 30px; }
.card-title {
  font-size: 14px; font-weight: 600;
  color: var(--fg);
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
  letter-spacing: -0.012em;
}
.card-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-header-row .card-title { margin-bottom: 0; }

/* Buttons — neutral primary (Apple Music / Things style) */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast),
              border-color var(--t-fast),
              transform 80ms var(--ease-out),
              box-shadow var(--t-fast);
  white-space: nowrap;
  line-height: 1.45;
  letter-spacing: -0.005em;
  user-select: none;
  min-height: 30px;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 1.7; }
.btn-sm { padding: 4px 11px; font-size: 12px; min-height: 26px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-lg { padding: 10px 22px; font-size: 14px; min-height: 38px; }

/* Primary = neutral filled (foreground) — distinctive Apple/Things pattern */
.btn-primary {
  background: var(--fg);
  color: var(--bg-surface);
  border-color: var(--fg);
}
.btn-primary:hover { background: #2a2a2d; border-color: #2a2a2d; }
:root[data-theme="dark"] .btn-primary { background: var(--fg); color: #000; }
:root[data-theme="dark"] .btn-primary:hover { background: #ffffff; }

/* Default = surface with soft border */
.btn-default {
  background: var(--bg-surface);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-default:hover { background: var(--bg-sunken); border-color: var(--fg-muted); }
:root[data-theme="dark"] .btn-default:hover { background: var(--bg-raised); }

.btn-ghost { background: transparent; color: var(--fg); border-color: transparent; }
.btn-ghost:hover { background: var(--hover-bg); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(0.93); }

.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--border-strong); }
.btn-danger-ghost:hover { background: var(--danger-light); border-color: var(--danger); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(0.93); }

.btn-light {
  background: var(--bg-sunken);
  color: var(--fg);
  border-color: transparent;
}
.btn-light:hover { background: var(--muted-2); }
:root[data-theme="dark"] .btn-light { background: var(--bg-raised); }
:root[data-theme="dark"] .btn-light:hover { background: var(--muted-2); }

.btn-block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; pointer-events: none; }

/* Focus rings — accessibility + premium feel */
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.nav-item:focus-visible,
.radio-btn:focus-visible,
.tag-check:focus-visible,
.theme-toggle:focus-visible,
.modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--border-strong);
}

/* Badges — single tone capsule */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
}
.badge-primary { background: var(--bg-sunken); color: var(--fg-secondary); border: 1px solid var(--border-strong); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-muted   { background: var(--bg-sunken);     color: var(--fg-muted); }
:root[data-theme="dark"] .badge-muted { background: var(--bg-raised); }
.badge-purple  { background: var(--purple-light);  color: var(--purple); }
.badge-dot::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

/* Tags — refined */
.tag {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px; font-weight: 500;
  border: 1px solid transparent;
  letter-spacing: -0.003em;
  line-height: 1.6;
}
.tag-blue   { background: rgba(22, 119, 255, .2);               color: rgb(22, 119, 255); }
.tag-green  { background: var(--success-light);  color: var(--success); }
.tag-orange { background: var(--warning-light);  color: var(--warning); }
.tag-red    { background: var(--danger-light);   color: var(--danger);  }
.tag-purple { background: var(--purple-light);   color: var(--purple);  }
.tag-cyan   { background: var(--bg-sunken);      color: var(--fg-secondary); }
.tag-pink   { background: var(--danger-light);   color: var(--danger);  }

/* Form */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--fg); margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 12px; color: var(--fg-muted); margin-top: 5px; }

.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--fg);
  background: var(--bg-surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  outline: none;
  font-family: var(--font-sans);
  letter-spacing: -0.003em;
  min-height: 32px;
}
.input::placeholder { color: var(--fg-faint); }
.input:hover { border-color: var(--fg-muted); }
.input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--border);
}
.input:disabled { background: var(--bg-sunken); color: var(--fg-faint); cursor: not-allowed; }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.6; padding: 10px 12px; }

.select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--fg);
  background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none; outline: none; cursor: pointer;
  transition: var(--transition);
  min-height: 32px;
}
:root[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398989d' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); }
.select:focus { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--border); }

/* Radio group / button group */
.radio-group, .btn-group { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-btn {
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  font-size: 12.5px; font-weight: 500;
  color: var(--fg-secondary);
  background: var(--bg-surface);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  letter-spacing: -0.003em;
}
.radio-btn:hover { background: var(--hover-bg); }
.radio-btn.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg-surface);
  box-shadow: none;
}
:root[data-theme="dark"] .radio-btn.active { color: #000; }
.radio-btn.active-outline {
  background: var(--bg-sunken);
  border-color: var(--fg-muted);
  color: var(--fg);
}

.tag-check {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  color: var(--fg-secondary);
  background: var(--bg-surface);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.tag-check:hover { background: var(--hover-bg); }
.tag-check.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg-surface);
}
:root[data-theme="dark"] .tag-check.active { color: #000; }

/* Switch — Apple style with smoother fall */
.switch {
  position: relative; display: inline-block;
  width: 42px; height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0;
  background: var(--muted-2);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t-base) var(--ease-out);
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-base) var(--ease-out);
  box-shadow: 0 3px 6px rgba(0,0,0,0.18), 0 1px 2px rgba(0,0,0,0.12);
}
.switch input:checked + .switch-slider { background: #34c759; }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }
:root[data-theme="dark"] .switch input:checked + .switch-slider { background: #30d158; }

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-7);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table th {
  padding: 11px 18px;
  text-align: left;
  font-size: 11.5px; font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}
:root[data-theme="dark"] .table th { background: var(--bg-sunken); }
.table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-divider);
  color: var(--fg);
  vertical-align: middle;
  letter-spacing: -0.003em;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--hover-bg); }
.table .text-muted { color: var(--fg-muted); font-size: 12px; }

/* Steps */
.steps { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; flex: 1; position: relative; }
.step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: var(--fg-muted);
  flex-shrink: 0; z-index: 1;
  transition: var(--transition);
  font-variant-numeric: tabular-nums;
}
.step.active .step-dot, .step.done .step-dot {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg-surface);
}
:root[data-theme="dark"] .step.active .step-dot,
:root[data-theme="dark"] .step.done   .step-dot { color: #000; }
.step.done .step-dot { background: var(--success); border-color: var(--success); color: #fff; }
.step-line { flex: 1; height: 1.5px; background: var(--border-strong); margin: 0 4px; }
.step.done .step-line { background: var(--success); }
.step.active .step-line { background: var(--fg); }
.step-label {
  font-size: 12px; font-weight: 500;
  color: var(--fg-muted);
  margin-top: 4px; white-space: nowrap;
}
.step.active .step-label { color: var(--fg); font-weight: 600; }
.step.done .step-label { color: var(--success); }

/* Modal — refined chrome */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.16s var(--ease-out);
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-8);
  box-shadow: var(--shadow-5);
  max-height: 88vh;
  display: flex; flex-direction: column;
  animation: modalIn 0.24s var(--ease-out);
  width: 560px;
  overflow: hidden;
}
.modal-sm { width: 420px; }
.modal-lg { width: 800px; }
.modal-xl { width: 1100px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-divider);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 16px; font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.018em;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-sunken);
  color: var(--fg-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--muted-2); color: var(--fg); }
:root[data-theme="dark"] .modal-close { background: var(--bg-raised); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-divider);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg-page);
}
:root[data-theme="dark"] .modal-footer { background: var(--bg-sunken); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes slideUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-6);
  box-shadow: var(--shadow-4);
  min-width: 164px;
  padding: 6px;
  z-index: 500;
  display: none;
  animation: slideUp 0.14s var(--ease-out);
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  transition: background var(--t-fast);
  letter-spacing: -0.003em;
}
.dropdown-item:hover { background: var(--hover-bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-divider { height: 1px; background: var(--border-divider); margin: 4px 0; }

/* Avatar */
.avatar { border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--bg-sunken); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-32 { width: 32px; height: 32px; }
.avatar-36 { width: 36px; height: 36px; }
.avatar-40 { width: 40px; height: 40px; }
.avatar-48 { width: 48px; height: 48px; }

/* Tabs */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab-item {
  padding: 10px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast);
  white-space: nowrap;
  letter-spacing: -0.005em;
  position: relative;
}
.tab-item:hover { color: var(--fg); }
.tab-item.active {
  color: var(--fg);
  font-weight: 600;
  border-bottom-color: var(--fg);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: tabIn 0.16s var(--ease-out); }
@keyframes tabIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

/* Toast */
#toast-container {
  position: fixed; top: 18px; right: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-translucent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--r-6);
  box-shadow: var(--shadow-4);
  padding: 11px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  min-width: 240px; max-width: 360px;
  pointer-events: all;
  animation: slideInRight 0.26s var(--ease-out);
}
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--accent); }
.toast-msg { flex: 1; font-weight: 500; color: var(--fg); }
@keyframes slideInRight { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
.toast-fadeout { animation: fadeOut 0.28s var(--ease-out) forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translateX(12px); } }

/* Empty state */
.empty-state { text-align: center; padding: 64px 20px; color: var(--fg-muted); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.30; color: var(--fg-muted); stroke-width: 1.4; }
.empty-state p { font-size: 13px; margin-top: 4px; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border-divider); margin: 16px 0; }
.divider-text { text-align: center; position: relative; color: var(--fg-muted); font-size: 12px; margin: 12px 0; }
.divider-text::before, .divider-text::after { content: ''; position: absolute; top: 50%; width: calc(50% - 30px); height: 1px; background: var(--border-divider); }
.divider-text::before { left: 0; }
.divider-text::after  { right: 0; }

/* Loading */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: absolute; inset: 0;
  background: var(--bg-translucent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; border-radius: inherit; z-index: 10;
}
.loading-overlay p { font-size: 13px; color: var(--fg-muted); }

/* 骨架屏 */
.skel {
  display: inline-block; vertical-align: middle;
  color: transparent !important; pointer-events: none;
  border-radius: var(--r-sm, 4px);
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-raised) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.4s ease infinite;
}
@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Progress */
.progress-bar-wrap { width: 100%; height: 4px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden; }
:root[data-theme="dark"] .progress-bar-wrap { background: var(--bg-raised); }
.progress-bar-fill { height: 100%; background: var(--fg); border-radius: 999px; transition: width 0.5s var(--ease-out); }

/* =========================================================
   PAGE: Robot square
   ========================================================= */
.robot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  /* Decorative blobs — give backdrop-filter something to blur */
  background:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(139,92,246,0.07), transparent),
    radial-gradient(ellipse 45% 55% at 82% 70%, rgba(59,130,246,0.07), transparent),
    radial-gradient(ellipse 40% 40% at 55% 48%, rgba(236,72,153,0.04), transparent);
  border-radius: 16px;
}
@media (max-width: 1280px) { .robot-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px)  { .robot-grid { grid-template-columns: 1fr; } }

/* Glass card */
.robot-card {
  background: rgba(255,255,255,0.76);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.88);
  border-radius: var(--r-7);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.08),
    0 6px 20px rgba(0,0,0,0.06),
    0 0 0 0.5px rgba(0,0,0,0.04),
    inset 0 1px 0 rgba(255,255,255,0.95);
  transition: border-color var(--t-base) var(--ease-out),
              transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
}
:root[data-theme="dark"] .robot-card {
  background: rgba(28,28,30,0.78);
  border-color: rgba(255,255,255,0.09);
  box-shadow: 0 1px 3px rgba(0,0,0,0.30), 0 0 0 0.5px rgba(255,255,255,0.04);
}

/* Mouse-tracking spotlight */
.robot-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(380px circle at var(--mx,50%) var(--my,50%),
    rgba(99,102,241,0.18),
    rgba(59,130,246,0.09) 45%,
    transparent 70%);
  opacity: 0;
  transition: opacity 280ms var(--ease-out);
  pointer-events: none;
  z-index: 0;
}
:root[data-theme="dark"] .robot-card::after {
  background: radial-gradient(380px circle at var(--mx,50%) var(--my,50%),
    rgba(139,92,246,0.22),
    rgba(59,130,246,0.12) 45%,
    transparent 70%);
}

.robot-card:hover {
  /* border-color: rgba(148,115,255,0.32); */
  transform: translateY(-3px);
  box-shadow:
    0 0 0 0.5px rgba(99,102,241,0.22),
    0 10px 30px rgba(99,102,241,0.13),
    0 3px 8px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,0.95);
}
:root[data-theme="dark"] .robot-card:hover {
  border-color: rgba(139,92,246,0.35);
  box-shadow: 0 10px 30px rgba(139,92,246,0.18), 0 3px 8px rgba(0,0,0,0.30);
}
.robot-card:hover::after { opacity: 1; }

/* Content layers above gradient */
.robot-card-body { padding: 18px 20px 14px; position: relative; z-index: 1; flex: 1; }
.robot-card-icon {
  width: 38px; height: 38px;
  background: #111;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
:root[data-theme="dark"] .robot-card-icon { background: #1a1a1a; border-color: rgba(255,255,255,0.10); }
.robot-card-icon svg { width: 18px; height: 18px; color: #fff; stroke-width: 1.6; }
.robot-card-name {
  font-size: 14.5px; font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.014em;
}
.robot-card-category {
  font-size: 12px; color: var(--fg-muted);
  margin-top: 2px;
}
.robot-card-footer .btn-use-robot,
.robot-card-footer .btn-primary {
  background: #444; border-color: #444; color: #fff;
}
.robot-card-footer .btn-use-robot:hover,
.robot-card-footer .btn-primary:hover { background: #333; border-color: #333; }
.robot-card-desc {
  font-size: 12.5px; color: var(--fg-muted);
  margin-top: 8px; line-height: 1.55;
}
.robot-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0 4px;
  border-top: 1px solid rgba(0,0,0,0.06);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.robot-card-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  position: relative; z-index: 1;
}
.robot-card-footer .btn-sm {
  min-height: 30px;
  min-width: 80px;
  padding: 3px 12px;
  font-size: 12.5px;
}
.robot-card-footer .btn-fav {
  width: 72px;
  flex-shrink: 0;
  justify-content: center;
}
:root[data-theme="dark"] .robot-card-footer {
  background: rgba(18,18,20,0.60);
  border-top-color: rgba(255,255,255,0.06);
}

/* Featured card — same glassmorphism as robot-card, distinguished by top accent bar */
.robot-card-featured {
  background: rgba(255,255,255,0.76);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.88);
  border-radius: var(--r-7);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.08),
    0 6px 20px rgba(0,0,0,0.06),
    0 0 0 0.5px rgba(0,0,0,0.04),
    inset 0 1px 0 rgba(255,255,255,0.95);
  transition: border-color var(--t-base) var(--ease-out),
              transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
}
:root[data-theme="dark"] .robot-card-featured {
  background: rgba(28,28,30,0.78);
  border-color: rgba(255,255,255,0.09);
  box-shadow: 0 1px 3px rgba(0,0,0,0.30), 0 0 0 0.5px rgba(255,255,255,0.04);
}
/* Same mouse-tracking spotlight as robot-card */
.robot-card-featured::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(380px circle at var(--mx,50%) var(--my,50%),
    rgba(99,102,241,0.18),
    rgba(59,130,246,0.09) 45%,
    transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 280ms var(--ease-out);
  z-index: 0;
}
:root[data-theme="dark"] .robot-card-featured::after {
  background: radial-gradient(380px circle at var(--mx,50%) var(--my,50%),
    rgba(139,92,246,0.22),
    rgba(59,130,246,0.12) 45%,
    transparent 70%);
}
.robot-card-featured:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 0.5px rgba(99,102,241,0.22),
    0 10px 30px rgba(99,102,241,0.13),
    0 3px 8px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,0.95);
}
:root[data-theme="dark"] .robot-card-featured:hover {
  border-color: rgba(139,92,246,0.35);
  box-shadow: 0 10px 30px rgba(139,92,246,0.18), 0 3px 8px rgba(0,0,0,0.30);
}
.robot-card-featured:hover::after { opacity: 1; }

/* Featured card CTA — match robots.html exactly.
   全局 .robot-card-footer .btn-primary 被覆盖成灰色 #444（用于普通机器人，保持「其他机器人不变」），
   这里用 .robot-card-featured 作用域还原成全局主色 var(--fg)，仅影响特色卡片，不波及普通卡片。 */
.robot-card-featured .btn-primary {
  background: var(--fg);
  color: var(--bg-surface);
  border-color: var(--fg);
}
.robot-card-featured .btn-primary:hover { background: #2a2a2d; border-color: #2a2a2d; }
:root[data-theme="dark"] .robot-card-featured .btn-primary { background: var(--fg); color: #000; }
:root[data-theme="dark"] .robot-card-featured .btn-primary:hover { background: #ffffff; }

/* Filter bar */
.filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-7);
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: none;
}
.filter-row { display: flex; align-items: center; gap: 10px; }
.filter-row + .filter-row { margin-top: 10px; }
.filter-label { font-size: 12.5px; color: var(--fg-muted); flex-shrink: 0; }
.cat-expand-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 10px; border-radius: var(--r-pill);
  border: none; background: var(--fg-muted); cursor: pointer;
  font-size: 12px; color: #fff; white-space: nowrap;
  transition: background 0.15s;
}
.cat-expand-btn:hover { background: var(--fg-secondary); }
.cat-expand-btn svg { flex-shrink: 0; stroke: #fff; }

/* =========================================================
   PAGE: Workshop
   ========================================================= */
.workshop-layout { display: flex; gap: 20px; align-items: flex-start; }
.workshop-main { flex: 1; min-width: 0; }
.workshop-side { width: 280px; flex-shrink: 0; }

.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.result-img-card {
  border-radius: var(--r-6);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  background: var(--bg-sunken);
}
.result-img-card img { width: 100%; display: block; object-fit: cover; transition: transform 0.4s var(--ease-out); }
.result-img-card:hover img { transform: scale(1.04); }
.result-img-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  transition: background var(--t-base) var(--ease-out);
}
.result-img-card:hover .result-img-overlay { background: rgba(0,0,0,0.45); }
.result-img-overlay .btn { opacity: 0; transform: translateY(4px); transition: all var(--t-base) var(--ease-out); }
.result-img-card:hover .result-img-overlay .btn { opacity: 1; transform: translateY(0); }

.spec-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.spec-thumb {
  width: 52px; height: 52px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: border-color var(--t-fast);
}
.spec-thumb.active { border-color: var(--fg); box-shadow: 0 0 0 2px var(--border-strong); }
.spec-thumb img { width: 100%; height: 100%; object-fit: cover; }
#ws-product-title:focus { background: var(--bg-sunken); box-shadow: 0 0 0 2px var(--border-strong); }

/* ---------- Workshop / Records 共享：ad/live 模块结果画廊 ---------- */
.ws-module-section-header { display: flex; align-items: center; justify-content: space-between; }
.ws-module-section-title { font-weight: 600; font-size: 16px; color: var(--fg); }
.ws-module-gallery { display: grid; gap: 8px; margin-top: 12px; }
.ws-module-img-card { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--muted); border: 1px solid var(--border); }
.ws-module-img-pad { position: relative; width: 100%; background: var(--bg-sunken); }
.ws-module-img-pad img { display: block; width: 100%; height: auto; }
.ws-module-img-index { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.45); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 4px; pointer-events: none; line-height: 1.4; }
.ws-module-img-actions { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; opacity: 0; transition: all 0.2s ease; background: rgba(0,0,0,0); }
.ws-module-img-card:hover .ws-module-img-actions { opacity: 1; background: rgba(0,0,0,0.4); }
@media (max-width: 768px) {
  .ws-module-gallery { grid-template-columns: 1fr !important; }
}

/* Module checklist */
.module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.module-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.module-item:hover { background: var(--hover-bg); }
.module-item.active {
  border-color: var(--fg);
  background: var(--bg-sunken);
}
:root[data-theme="dark"] .module-item.active { background: var(--bg-raised); }
.module-checkbox {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.module-item.active .module-checkbox { background: var(--fg); border-color: var(--fg); }
.module-item.active .module-checkbox::after { content: '✓'; color: var(--bg-surface); font-size: 10px; font-weight: 700; line-height: 1; }
:root[data-theme="dark"] .module-item.active .module-checkbox::after { color: #000; }
.module-label { font-size: 12.5px; font-weight: 500; color: var(--fg); }
.module-item.active .module-label { color: var(--fg); }
.module-desc { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }

/* Palette selector */
.palette-list { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
}
.palette-item:hover { background: var(--hover-bg); }
.palette-item.active {
  border-color: var(--fg);
  background: var(--bg-sunken);
  color: var(--fg);
}
:root[data-theme="dark"] .palette-item.active { background: var(--bg-raised); }
.palette-swatches { display: flex; gap: 2px; }
.palette-swatch { width: 16px; height: 16px; }
.palette-swatch:first-child { border-radius: 4px 0 0 4px; }
.palette-swatch:last-child { border-radius: 0 4px 4px 0; }

/* Shop auth — left accent stripe pattern */
.shop-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-radius: var(--r-6);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  margin-bottom: 10px;
  transition: var(--transition);
  position: relative;
}
.shop-item.active::before,
.shop-item.expired::before {
  content: '';
  position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 2px;
}
.shop-item.active::before  { background: var(--success); }
.shop-item.expired::before { background: var(--warning); }
.shop-item.deleted { background: var(--bg-sunken); opacity: 0.55; }

/* =================================================================
   Membership — editorial pricing layout
   ================================================================= */

/* Trust strip above plans */
.plan-trust {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-5);
  background: var(--bg-surface);
  font-size: 12.5px;
  color: var(--fg-secondary);
  font-feature-settings: "tnum" 1;
}
.plan-trust-item { display: inline-flex; align-items: center; gap: 7px; line-height: 1.3; }
.plan-trust-item svg { width: 14px; height: 14px; color: var(--fg-muted); flex-shrink: 0; }
.plan-trust-sep { width: 1px; height: 12px; background: var(--border-strong); }
@media (max-width: 750px) { .plan-trust-sep { display: none; } }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
@media (max-width: 960px) { .plan-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 750px) { .plan-grid { grid-template-columns: 1fr; } }

/* Plan card */
.plan-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-7);
  overflow: hidden;
  position: relative;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.plan-card { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.plan-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-3); }

/* Plan header — top accent bar + clean info hierarchy */
.plan-header-blue,
.plan-header-purple {
  padding: 0;
  position: relative;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  flex: 1;          /* 让 header 撑满剩余高度，使各卡片定价区底部对齐 */
}
:root[data-theme="dark"] .plan-header-blue,
:root[data-theme="dark"] .plan-header-purple { background: var(--bg-raised); }

/* Top accent bar — full width, sits at very top of card */
.plan-header-blue::before,
.plan-header-purple::before {
  content: '';
  display: block;
  height: 4px;
  width: 100%;
  position: relative;
}
.plan-header-blue::before  { background: var(--fg); }
.plan-header-purple::before{ background: var(--fg); }

/* Inner content wrapper with padding */
.plan-header-blue > *,
.plan-header-purple > * {
  position: relative;
}
.plan-label-row,
.plan-name,
.plan-tagline,
.plan-features {
  padding-left: 26px;
  padding-right: 26px;
}

/* Label row: eyebrow left, status pill right */
.plan-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 0;
  margin-bottom: 8px;
}

.plan-head-eyebrow {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--fg-muted);
}
#plan-ai .plan-head-eyebrow  { color: var(--fg-muted); }
#plan-pub .plan-head-eyebrow { color: var(--fg-muted); }

.plan-name {
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.026em;
  color: var(--fg);
  margin: 0;
  padding-bottom: 8px;
  line-height: 1.15;
}
.plan-status-pill {
  flex-shrink: 0;
  font-size: 11px; font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--fg-secondary);
  letter-spacing: 0.02em;
  font-feature-settings: "tnum" 1;
}
.plan-status-pill.active {
  background: rgba(31,138,91,0.12);
  border-color: rgba(31,138,91,0.35);
  color: #166c47;
}
:root[data-theme="dark"] .plan-status-pill.active { color: #6fd4a3; }

.plan-tagline {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin: 0;
  padding-top: 6px;
  padding-bottom: 18px;
  text-wrap: pretty;
}

/* Feature list — single column */
.plan-features {
  list-style: none; margin: 0;
  padding-top: 0;
  padding-bottom: 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-height: 170px;
}
.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--fg);
  line-height: 1.4;
  min-width: 0;
}
.plan-features li .feat-text {
  flex: 1;
  min-width: 0;
}
.plan-features li small {
  display: block;
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 2px;
  font-weight: 400;
}
.plan-feature-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px; height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  position: relative;
}
.plan-feature-check::after {
  content: '';
  position: absolute;
  left: 4px; top: 5px;
  width: 7px; height: 3.5px;
  border: 1.6px solid currentColor;
  border-top: 0; border-right: 0;
  transform: rotate(-45deg);
  color: var(--fg);
}
#plan-ai .plan-feature-check  { border-color: var(--border-strong); }
#plan-ai .plan-feature-check::after { color: var(--fg); }
#plan-pub .plan-feature-check { border-color: var(--border-strong); }
#plan-pub .plan-feature-check::after { color: var(--purple); }

/* Plan body */
.plan-body { padding: 20px 26px 22px; }
.plan-tier-label {
  font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 10px;
}

.plan-prices {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px;
  margin-bottom: 18px;
  overflow: visible;
  padding-top: 8px;
}
.plan-price-item {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 20px 12px 14px;
  text-align: left;
  cursor: pointer;
  background: var(--bg-surface);
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
  display: flex; flex-direction: column; gap: 4px;
  overflow: visible;
  min-height: 100px;
  justify-content: flex-end;
}
.plan-tier-period {
  font-size: 11.5px; font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}
.plan-card[data-is-points="1"] .plan-tier-period {
  font-size: 15px; font-weight: 600;
  color: var(--fg);
}
.plan-tier-price {
  font-size: 22px; font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.022em;
  font-feature-settings: "tnum" 1;
  line-height: 1.1;
}
.plan-tier-original {
  font-size: 11px;
  color: var(--fg-muted);
  text-decoration: line-through;
  font-feature-settings: "tnum" 1;
}
.plan-tier-save {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--fg);
  background: red;
  color: var(--bg);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  color: white;
}
.plan-tier-save:empty { display: none; }
.plan-tier-points {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-top: 2px;
}
.plan-price-item.active-blue   .plan-tier-points,
.plan-price-item.active-purple .plan-tier-points { color: var(--fg-secondary); }
.plan-price-item--disabled { opacity: 0.5; cursor: not-allowed; }
.plan-price-item--disabled:hover { border-color: var(--border); transform: none; }
.plan-price-item--legacy {
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: var(--bg-surface);
}
.plan-price-item:hover { border-color: var(--fg-muted); transform: translateY(-1px); }
.plan-price-item.active-blue,
.plan-price-item.active-purple {
  border-color: var(--fg);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--border-strong);
}
.plan-price-hot {
  position: absolute; top: -9px; right: 12px;
  font-size: 10px; font-weight: 600;
  color: #fff;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow-2);
}
.active-blue   .plan-price-hot { background: var(--fg); }
.active-purple .plan-price-hot { background: var(--fg); }

/* CTA row */
.plan-cta {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-5);
  margin-bottom: 12px;
}
:root[data-theme="dark"] .plan-cta { background: var(--bg-raised); }
.plan-cta-pricing { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.plan-cta-label {
  font-size: 11.5px;
  color: var(--fg-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
  font-weight: 500;
  align-self: center;
  margin-right: 4px;
}
.plan-cta-amount {
  font-size: 30px; font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.028em;
  font-feature-settings: "tnum" 1;
  line-height: 1;
}
#plan-ai  .plan-cta-amount { color: var(--accent); }
#plan-pub .plan-cta-amount { color: var(--purple); }
.plan-cta-cycle {
  font-size: 12.5px;
  color: var(--fg-muted);
  font-feature-settings: "tnum" 1;
}
.plan-cta .btn { gap: 8px; padding-left: 22px; padding-right: 22px; flex-shrink: 0; }
.plan-cta .btn svg { width: 14px; height: 14px; }
#plan-pub .btn-primary { background: var(--purple); border-color: var(--purple); color: #fff; }
#plan-pub .btn-primary:hover { background: #5a2bb8; border-color: #5a2bb8; }

.plan-fineprint {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.5;
}

/* FAQ trust footer */
.plan-faq {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 22px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-7);
}
@media (max-width: 750px) { .plan-faq { grid-template-columns: 1fr; } }
.plan-faq-item { padding-right: 12px; }
.plan-faq-q {
  font-size: 13.5px; font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
  margin-bottom: 6px;
}
.plan-faq-q::before {
  content: 'Q';
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  text-align: center; line-height: 16px;
  font-size: 10px; font-weight: 700;
  color: var(--fg-secondary);
  margin-right: 8px;
  vertical-align: -2px;
  font-family: var(--font-mono);
}
.plan-faq-a {
  font-size: 12.5px;
  color: var(--fg-secondary);
  line-height: 1.55;
  text-wrap: pretty;
  padding-left: 26px;
}

/* AI Image gen panel */
.gen-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-7);
  padding: 20px;
  margin-bottom: 16px;
}
.gen-section-title {
  font-size: 11.5px; font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0;
  margin-bottom: 8px;
}

/* Records */
.record-status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }

/* Support */
.support-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.qr-box {
  width: 144px; height: 144px;
  background: var(--bg-sunken);
  border-radius: var(--r-6);
  border: 1px dashed var(--border-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
}
:root[data-theme="dark"] .qr-box { background: var(--bg-raised); }
.qr-box svg { width: 44px; height: 44px; color: var(--fg-faint); }

/* Personal info */
.member-card {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: var(--r-7);
  padding: 18px;
}
.api-key-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-sunken);
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
:root[data-theme="dark"] .api-key-row { background: var(--bg-raised); }

/* Steps bar (workshop) */
.ws-step-circle { transition: all var(--t-base); }

/* =========================================================
   THEME TOGGLE
   ========================================================= */
.theme-toggle {
  /* display: none !important;  */
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--fg-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-sunken); color: var(--fg); }
.theme-toggle svg { width: 15px; height: 15px; stroke-width: 1.8; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* =========================================================
   UTILITIES
   ========================================================= */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.gap-0\.5 { gap: 2px; }
.gap-1\.5 { gap: 6px; }
.flex-1 { flex: 1; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.col-span-3 { grid-column: span 3 / span 3; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-w-0 { min-width: 0; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 12.5px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }
.text-3xl { font-size: 28px; }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 600; }

.text-primary    { color: var(--fg); }
.text-success    { color: var(--success); }
.text-danger     { color: var(--danger); }
.text-warning    { color: var(--warning); }
.text-muted      { color: var(--fg-muted); }
.text-foreground { color: var(--fg); }
.text-white      { color: var(--bg-surface); } /* adaptive: white in light, dark in dark */

.bg-primary { background: var(--accent); }
.bg-muted   { background: var(--bg-sunken); }
.bg-white   { background: var(--bg-surface); }

.rounded-sm   { border-radius: 6px; }
.rounded      { border-radius: 8px; }
.rounded-lg   { border-radius: 10px; }
.rounded-xl   { border-radius: 14px; }
.rounded-full { border-radius: 9999px; }

.border   { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-primary { border-color: var(--accent) !important; }

.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.pl-5 { padding-left: 20px; }
.pt-2 { padding-top: 8px; }
.pt-3 { padding-top: 12px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mr-2 { margin-right: 8px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.mb-0\.5 { margin-bottom: 2px; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.overflow-hidden { overflow: hidden; }

.hidden { display: none !important; }
.block { display: block; }
.inline-flex { display: inline-flex; }

.relative { position: relative; }
.absolute { position: absolute; }

.object-cover { object-fit: cover; }
.aspect-square { aspect-ratio: 1; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.line-through { text-decoration: line-through; }

/* =========================================================
   FINE-TUNING
   ========================================================= */
.section { margin-bottom: 28px; }
.section-title {
  font-size: 11.5px; font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}

.stat-number {
  font-size: 26px; font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.028em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
}
.stat-label { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.stat-change-up   { color: var(--success); font-size: 12px; font-weight: 600; }
.stat-change-down { color: var(--danger);  font-size: 12px; font-weight: 600; }

.info-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-divider);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-row-label { color: var(--fg-muted); width: 120px; flex-shrink: 0; font-weight: 500; }
.info-row-value { color: var(--fg); font-weight: 500; flex: 1; }

.page { animation: pageFadeIn 0.20s var(--ease-out); }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.list-item { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-divider); gap: 12px; }
.list-item:last-child { border-bottom: none; padding-bottom: 0; }

.num-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px; font-weight: 700;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.header-divider { width: 1px; height: 18px; background: var(--border); margin: 0 6px; flex-shrink: 0; }

/* Force all currency / pricing / counter numerics to tabular */
.stat-number, #plan-ai-price, #plan-pub-price, #ws-current-price, #ws-original-price,
.table td:has(svg) ~ td, .badge, .num-badge {
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   LEGACY INLINE-STYLE OVERRIDES
   ========================================================= */

/* Workshop step circles (inline styles → use theme tokens) */
#ws-circle-0, #ws-circle-1, #ws-circle-2 {
  background: var(--bg-surface) !important;
  border-color: var(--border-strong) !important;
  color: var(--fg-muted) !important;
}
#ws-step-label-0, #ws-step-label-1, #ws-step-label-2 { color: var(--fg-muted) !important; }

/* (robot-card-featured inline CTA override removed — now uses btn-primary) */

/* Header gradient avatar → neutralize */
.header [style*="linear-gradient(135deg,#3E97FF,#7239EA)"] {
  background: var(--fg) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .header [style*="linear-gradient(135deg,#3E97FF,#7239EA)"] {
  background: var(--bg-raised) !important;
}
.header [style*="linear-gradient(135deg,#3E97FF,#7239EA)"] svg {
  stroke: var(--bg-surface) !important;
}
:root[data-theme="dark"] .header [style*="linear-gradient(135deg,#3E97FF,#7239EA)"] svg {
  stroke: var(--fg) !important;
}

/* Inline btn purple */
.btn[style*="background:var(--purple)"] {
  background: var(--purple) !important;
  border-color: var(--purple) !important;
  border-radius: var(--r-pill) !important;
}

/* Workshop upload-dragger */
#upload-dragger {
  background: var(--bg-sunken) !important;
  border-color: var(--border-strong) !important;
}
:root[data-theme="dark"] #upload-dragger { background: var(--bg-raised) !important; }

/* Generation tip success */
#ws-parse-done-tip {
  background: var(--success-light) !important;
  border-color: transparent !important;
  color: var(--success) !important;
}

/* Plan headers — dark mode legibility for inline-colored bullets */
:root[data-theme="dark"] .plan-header-blue   { color: var(--fg); }
:root[data-theme="dark"] .plan-header-purple { color: var(--fg); }
:root[data-theme="dark"] .plan-header-blue   *,
:root[data-theme="dark"] .plan-header-purple * { color: var(--fg-secondary); }
:root[data-theme="dark"] .plan-header-blue   strong,
:root[data-theme="dark"] .plan-header-blue   b,
:root[data-theme="dark"] .plan-header-purple strong,
:root[data-theme="dark"] .plan-header-purple b { color: var(--fg) !important; }
:root[data-theme="dark"] .plan-header-blue [style*="#1d4ed8"],
:root[data-theme="dark"] .plan-header-blue [style*="#1D4ED8"] { color: #80b4ff !important; }
:root[data-theme="dark"] .plan-header-purple [style*="#5b21b6"],
:root[data-theme="dark"] .plan-header-purple [style*="#5B21B6"] { color: #d4a8ff !important; }

/* Small inline border-top divider lines — soften */
[style*="border-top:1px solid var(--border)"] { border-color: var(--border-divider) !important; }

/* Header member-badge */
.header .badge-primary { font-weight: 500; }
.header .badge-muted   { font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════
   MEMBERSHIP — Redesigned pricing cards (pcard)
   Black / white / gray palette only. Light + dark via CSS variables.
   ══════════════════════════════════════════════════════════════════ */

.pcard-grid {
  display: grid;
  gap: 20px;
  /* max-width: 960px; */
  margin-bottom: 32px;
}
.pcard-grid--2col {
  /* stretch = equal height in both columns */
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
}
@media (max-width: 700px) { .pcard-grid--2col { grid-template-columns: 1fr; } }

/* ── Base card ── */
.pcard {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-7);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.pcard:hover {
  border-color: var(--fg);
  box-shadow: 0 0 0 1px var(--fg), var(--shadow-3);
}

/* ── Popular card — same default as base, highlight on hover only ── */
.pcard--pop:hover {
  border-color: var(--fg);
  box-shadow: 0 0 0 1px var(--fg), var(--shadow-3);
}

.pcard-pop-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg-surface);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-2);
}

/* ── Card header ── */
.pcard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.pcard-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: var(--fg-muted);
}
.pcard-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.022em;
  line-height: 1.15;
  margin-bottom: 6px;
}
.pcard-tagline {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.55;
  margin: 0;
  text-wrap: pretty;
}

/* ── Price area ── */
.pcard-price-area {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.pcard-price-num {
  font-size: 38px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.034em;
  font-feature-settings: "tnum" 1;
  line-height: 1;
}
.pcard-price-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--fg-muted);
  margin-left: 2px;
}

/* ── Period selector ── */
.pcard-periods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* Override the base plan-price-item style for pcard context */
.pcard-periods > .plan-price-item {
  height: 100px;
  position: relative;
  padding: 12px 10px 10px;
  border-radius: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  transform: none;
}
:root[data-theme="dark"] .pcard-periods > .plan-price-item {
  background: var(--bg-raised);
}
.pcard-periods > .plan-price-item > b {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-secondary);
  letter-spacing: 0.01em;
}
.pcard-periods > .plan-price-item > .pcard-pi-price {
  font-style: normal;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  font-feature-settings: "tnum" 1;
}
.pcard-periods > .plan-price-item > .pcard-pi-save {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--fg-muted);
}

/* "推荐" mini badge — black/white */
.pcard-pi-hot {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 700;
  background: var(--fg);
  color: var(--bg-surface);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pcard-periods > .plan-price-item:hover {
  border-color: var(--fg);
  transform: none;
}
/* Active state — black/white for both plans */
.pcard-periods > .plan-price-item.active-blue,
.pcard-periods > .plan-price-item.active-purple {
  background: var(--bg-surface);
  border-color: var(--fg);
  box-shadow: 0 0 0 3px var(--border-strong);
}
:root[data-theme="dark"] .pcard-periods > .plan-price-item.active-blue,
:root[data-theme="dark"] .pcard-periods > .plan-price-item.active-purple {
  background: var(--bg-raised);
  box-shadow: 0 0 0 2px var(--border-strong);
}
.pcard-periods > .plan-price-item.active-blue > b,
.pcard-periods > .plan-price-item.active-purple > b              { color: var(--fg); }
.pcard-periods > .plan-price-item.active-blue > .pcard-pi-price,
.pcard-periods > .plan-price-item.active-purple > .pcard-pi-price { color: var(--fg); }
.pcard-periods > .plan-price-item.active-blue > .pcard-pi-save,
.pcard-periods > .plan-price-item.active-purple > .pcard-pi-save  { color: var(--fg-secondary); }

.pcard-periods > .plan-price-item.active-warning {
  background: var(--bg-surface);
  border-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(245,158,11,.18);
}
:root[data-theme="dark"] .pcard-periods > .plan-price-item.active-warning {
  background: var(--bg-raised);
  box-shadow: 0 0 0 2px rgba(245,158,11,.3);
}
.pcard-periods > .plan-price-item.active-warning > b             { color: var(--warning); }
.pcard-periods > .plan-price-item.active-warning > .pcard-pi-price { color: var(--warning); }
.pcard-periods > .plan-price-item.active-warning > .pcard-pi-save  { color: var(--fg-muted); }

.plan-status-pill.expired {
  background: rgba(220,38,38,.08);
  border-color: rgba(220,38,38,.28);
  color: var(--danger, #dc2626);
}

/* ── CTA button — uses default btn-primary (black/white) ── */
.pcard-cta {
  width: 100%;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
}

/* ── Separator ── */
.pcard-sep {
  height: 1px;
  background: var(--border-divider);
  margin: 2px 0;
}

/* ── Feature list — flex-grow fills remaining height for equal cards ── */
.pcard-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1; /* pushes fineprint to bottom on taller card */
}
.pcard-feats li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  color: var(--fg);
  line-height: 1.4;
}
.pcard-feats li > span:last-child {
  flex: 1;
  min-width: 0;
}
.pcard-feats li small {
  display: block;
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 2px;
  font-weight: 400;
}

/* ── Check dot — gray only ── */
.pcard-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  position: relative;
}
.pcard-dot::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 5px;
  width: 7.5px;
  height: 3.5px;
  border: 1.7px solid var(--fg-secondary);
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg);
}

/* ── Fine print ── */
.pcard-fineprint {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.5;
}

/* Keep hover-able sidebar footer rounded */
.sidebar-footer .flex.items-center { border-radius: 8px; }

/* Reduce-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =========================================================
   SIDEBAR — Light mode: white surface
   Dark mode: deep dark rail
   ========================================================= */

/* Light mode sidebar — white, clean */
/* ── Sidebar: always dark, independent of page theme ── */
.sidebar {
  background: #0d0d0e;
  border-right-color: rgba(255,255,255,0.05);
}

/* Logo icon: transparent bg so logo.png shows cleanly */
.sidebar .sidebar-logo .logo-icon {
  background: transparent;
  border: none;
  box-shadow: none !important;
}

.sidebar .sidebar-logo .logo-text      { color: rgba(255,255,255,0.90); }
.sidebar .nav-section-title            { color: rgba(255,255,255,0.24); }
.sidebar .nav-item                     { color: rgba(255,255,255,0.54); }
.sidebar .nav-item svg                 { color: rgba(255,255,255,0.34); }
.sidebar .nav-item:hover               { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.86); }
.sidebar .nav-item:hover svg           { color: rgba(255,255,255,0.60); }
.sidebar .nav-item.active              { background: rgba(255,255,255,0.10); color: #fff; box-shadow: none; }
.sidebar .nav-item.active svg          { color: rgba(255,255,255,0.85); }
.sidebar .sidebar-toggle-btn           { color: rgba(255,255,255,0.28); }
.sidebar .sidebar-toggle-btn:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.62);
}
.sidebar .sidebar-footer               { border-top-color: rgba(255,255,255,0.08); }
.sidebar .sidebar-footer > div > div:first-child:hover { background: rgba(255,255,255,0.07); }
.sidebar .sidebar-footer .font-medium  { color: rgba(255,255,255,0.80); }
.sidebar .sidebar-footer .text-muted   { color: rgba(255,255,255,0.38); }
.sidebar .sidebar-footer [style*="color:var(--muted-foreground)"],
.sidebar .sidebar-footer [style*="color: var(--muted-foreground)"] {
  color: rgba(255,255,255,0.28) !important;
}
/* !important needed to override inline style="background:var(--primary-light)" on avatar */
.sidebar .sidebar-footer .avatar {
  background: rgba(255,255,255,0.10) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
}
.sidebar .sidebar-footer .avatar svg   { stroke: rgba(255,255,255,0.62) !important; }
.sidebar .sidebar-nav::-webkit-scrollbar-thumb,
.sidebar .sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.14);
  background-clip: content-box;
}
.sidebar .sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.26) !important;
  background-clip: content-box;
}

/* =========================================================
   AI IMAGE GENERATION PAGE  (ai-image.html)
   ========================================================= */

/* ── Step indicator ── */
.aig-step-nav {
  display: flex;
  align-items: center;
}
.aig-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.aig-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.aig-step-item.active .aig-step-dot,
.aig-step-item.done .aig-step-dot {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg-surface);
}
.aig-step-label {
  font-size: 13px;
  color: var(--fg-muted);
  white-space: nowrap;
  transition: color 0.2s, font-weight 0.2s;
}
.aig-step-item.active .aig-step-label {
  color: var(--fg);
  font-weight: 600;
}
.aig-step-item.done .aig-step-label {
  color: var(--fg-muted);
}
.aig-step-connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 12px;
  transition: background 0.3s;
  min-width: 40px;
}
.aig-step-connector.done {
  background: var(--fg);
}

/* ── Selectable cards (model picker) ── */
.aig-selcard {
  border: 2px solid var(--border);
  border-radius: var(--r-5, 12px);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg-surface);
  user-select: none;
}
.aig-selcard:hover { border-color: var(--fg-muted); }
.aig-selcard.active { border-color: var(--fg); background: var(--bg-sunken); }
.aig-selcard-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.aig-selcard.active .aig-selcard-icon {
  background: var(--fg);
  color: var(--bg-surface);
}

/* ── Aspect ratio buttons ── */
.aig-ratio-btn {
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.aig-ratio-btn:hover { border-color: var(--fg-muted); }
.aig-ratio-btn.active { border-color: var(--fg); background: var(--bg-sunken); }
.aig-ratio-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-muted);
  transition: color 0.15s;
}
.aig-ratio-sub {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
  opacity: 0.7;
}
.aig-ratio-btn.active .aig-ratio-label { color: var(--fg); }

/* ── Color swatches ── */
.aig-color-dot {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.15s, outline 0.1s;
  outline: 2.5px solid transparent;
  outline-offset: 2px;
}
.aig-color-dot:hover { transform: scale(1.15); }
.aig-color-dot.active {
  outline-color: var(--fg);
  transform: scale(1.15);
}
.aig-color-picker-wrap { overflow: hidden; position: relative; }

/* ── Generate count cards ── */
.aig-count-card {
  text-align: center;
  padding: 12px 4px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.aig-count-card:hover { border-color: var(--fg-muted); }
.aig-count-card.active { border-color: var(--fg); background: var(--bg-sunken); }
.aig-count-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-muted);
  transition: color 0.15s;
}
.aig-count-sub {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 3px;
  opacity: 0.7;
}
.aig-count-card.active .aig-count-num { color: var(--fg); }

/* ── Result image hover ── */
.aig-img-wrap:hover .aig-img-overlay { background: rgba(0,0,0,0.22) !important; }
.aig-img-wrap:hover .aig-img-action-btns { opacity: 1 !important; }
.aig-img-action-btns {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 6px;
  opacity: 0; transition: opacity 0.2s;
  z-index: 2;
}
.aig-img-action-btn {
  background: rgba(255,255,255,0.92);
  border: none; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; font-weight: 500;
  cursor: pointer; color: #111;
  display: flex; align-items: center; gap: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: background 0.15s;
  white-space: nowrap;
}
.aig-img-action-btn:hover { background: #fff; }
.aig-img-action-btn.edit { color: #6366f1; }

/* ── AI Edit Panel shared styles ── */
.ai-edit-ws-toggle {
  align-self: center;
  background: var(--bg-surface);
  border: 1px solid var(--border); border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 14px 7px; cursor: pointer;
  box-shadow: -4px 0 16px rgba(0,0,0,0.07);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.ai-edit-panel-inner {
  flex: 1;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0,0,0,0.07);
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}
.ai-edit-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.ai-edit-header-actions { display:flex; align-items:center; gap:6px; }
.ai-edit-icon {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--fg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-edit-icon svg { stroke: var(--bg-surface); }
.ai-edit-title { font-size: 14px; font-weight: 600; color: var(--fg); }
.ai-edit-subtitle { font-size: 11px; color: var(--fg-muted); margin-top: 1px; }
.ai-edit-btn-clear {
  font-size: 12px; color: var(--fg-muted);
  background: none; border: 1px solid var(--border);
  cursor: pointer; padding: 4px 10px; border-radius: 6px;
}
.ai-edit-btn-close {
  background: none; border: none; cursor: pointer;
  padding: 4px; color: var(--fg-muted);
  display: flex; align-items: center;
}
.ai-edit-img-preview { padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ai-edit-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(99,102,241,0.88); color: #fff;
  font-size: 11px; padding: 3px 10px; border-radius: 5px; font-weight: 500;
}
.ai-edit-chat {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.ai-edit-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px; gap: 16px;
}
.ai-edit-empty-icon {
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--bg-sunken);
  display: flex; align-items: center; justify-content: center;
}
.ai-edit-empty-icon svg { stroke: var(--fg-muted); }
.ai-edit-empty-title { font-size: 14px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.ai-edit-empty-desc { font-size: 12px; color: var(--fg-muted); line-height: 1.9; }
.ai-edit-tips {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; width: 100%;
}
.ai-edit-tips-label { font-size: 12px; color: var(--fg-secondary); font-weight: 500; margin-bottom: 6px; }
.ai-edit-tip-item {
  font-size: 12px; color: var(--fg-muted);
  padding: 3px 0; display: flex; align-items: center; gap: 6px;
}
.ai-edit-tip-dot { width: 4px; height: 4px; border-radius: 50%; background: #c4b5fd; flex-shrink: 0; }
.ai-edit-input-area { padding: 10px 14px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.ai-edit-input-wrap {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px;
}
.ai-edit-textarea {
  width: 100%; border: none; outline: none; background: transparent;
  font-size: 13px; resize: none; font-family: var(--font-sans);
  line-height: 1.6; color: var(--fg);
}
.ai-edit-hint { font-size: 11px; color: var(--fg-muted); opacity: 0.6; }
.ai-edit-send-btn {
  background: #6366f1; color: #fff; border: none;
  border-radius: 8px; padding: 6px 18px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ── Toggle Switch ── */
.aig-switch { display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.aig-switch input { display: none; }
.aig-switch-track {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--border); position: relative;
  transition: background 0.2s;
}
.aig-switch input:checked + .aig-switch-track { background: #111; }
.aig-switch-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.aig-switch input:checked + .aig-switch-track .aig-switch-thumb { transform: translateX(18px); }

/* ── Material preview thumbnails ── */
.aig-material-thumb {
  position: relative; width: 72px; height: 72px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.aig-material-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aig-material-thumb-del {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--fg); color: var(--bg-surface);
  border: none; cursor: pointer; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ── AI Edit Panel (ai-image page) ── */
#aig-edit-panel {
  position: fixed; right: 0; top: var(--header-height); height: calc(100vh - var(--header-height)); width: 360px;
  z-index: 49;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}
#aig-edit-panel.open {
  transform: translateX(0);
  pointer-events: all;
}
#aig-edit-panel.collapsed { transform: translateX(100%); }

/* When edit panel is open, shift the whole page content */
.aig-panel-open {
  padding-right: 392px !important;
  transition: padding-right 0.3s cubic-bezier(0.4,0,0.2,1);
}
.aig-panel-open.collapsed-panel {
  padding-right: 72px !important;
}

/* ══════════════════════════════════════════════════════════════════
   CUSTOM COLOR PICKER POPUP  — light + dark via CSS variables
   ══════════════════════════════════════════════════════════════════ */
#cp-popup {
  background: var(--bg-surface);
  box-shadow: var(--shadow-4);
}
#cp-popup .cp-tabs {
  border-bottom: 1px solid var(--border);
}
#cp-popup .cp-tab-item {
  color: var(--fg-muted);
  transition: color 0.15s;
  cursor: pointer;
}
#cp-popup .cp-tab-line {
  background: var(--fg);
}
#cp-popup .cp-label {
  color: var(--fg-secondary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}
#cp-hex-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-sunken);
  border-radius: 12px;
  padding: 8px 12px;
  margin-top: 4px;
}
#cp-hex-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-size: 13px;
  font-family: monospace;
  letter-spacing: 0.5px;
}
#cp-eyedropper-btn {
  background: var(--bg-raised);
  border: none;
  border-radius: 8px;
  padding: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#cp-eyedropper-btn svg { stroke: var(--fg-muted); }
#cp-eyedropper-btn:hover { background: var(--muted-2); }
#cp-grad-name-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--fg);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
#cp-grad-name-input::placeholder { color: var(--fg-faint); }
#cp-grad-name-input:focus { border-color: var(--fg); }
#cp-popup .cp-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
#cp-cancel-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
#cp-cancel-btn:hover { background: var(--hover-bg); }
#cp-confirm-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: var(--fg);
  color: var(--bg-surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
#cp-confirm-btn:hover { background: var(--fg-secondary); }

/* Sub color picker (gradient stop editor) */
#cp-sub-picker {
  background: var(--bg-surface);
  box-shadow: var(--shadow-4);
}
#cps-hex-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-sunken);
  border-radius: 10px;
  padding: 7px 10px;
}
#cps-hex-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-size: 12px;
  font-family: monospace;
  letter-spacing: 0.5px;
}

/* ===================== 支付弹窗 ===================== */
.pay-modal {
  width: 400px !important;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
}
.pay-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.pay-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
}
.pay-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-muted);
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pay-modal-close:hover { background: var(--border); }
.pay-modal-body { padding: 8px 24px 24px; }
.pay-row {
  display: flex;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 12px;
}
.pay-row:last-of-type,
.pay-row.pay-row-top:last-of-type { border-bottom: none; }
.pay-row.pay-row-top { align-items: flex-start; padding-top: 14px; }
.pay-label {
  color: var(--muted-foreground);
  width: 64px;
  flex-shrink: 0;
  font-size: 13px;
}
.pay-val { color: var(--foreground); font-size: 14px; }
.pay-actual-price { color: #f97316 !important; font-weight: 700; font-size: 18px !important; }
.pay-ways-list { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.pay-way-item {
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s;
  line-height: 1;
}
.pay-way-item.active { border-color: #0bc5ea; }
.pay-way-item img {
  width: 22px !important;
  height: 22px !important;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
  display: inline-block !important;
}
.pay-qrcode { padding-top: 4px; }
.pay-qrcode img {
  display: block;
  width: 160px !important;
  height: 160px !important;
  object-fit: contain;
  border-radius: 8px;
}
.pay-success-btn {
  display: block;
  width: 100%;
  margin-top: 22px;
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 0;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
}
.pay-success-btn:hover { opacity: 0.88; }
