/* ═══════════════════════════════════════
   AI创作平台 — 现代精致设计系统 v4
   Design System: Modern Elegant + Subtle Motion
   ═══════════════════════════════════════ */

/* ── Import Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

/* ── Utility: hidden ── */
.hidden { display: none !important; }

/* ── Root Variables (OKLCH-aware) ── */
:root {
  /* Sidebar — Deep Navy */
  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-surface: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-text-active: #60a5fa;
  --sidebar-accent: #3b82f6;
  --sidebar-accent-glow: rgba(59, 130, 246, 0.15);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  /* Main Area — Warm Off-white */
  --main-bg: #f8fafc;
  --main-surface: #ffffff;
  --main-surface-soft: #f1f5f9;

  /* Text */
  --text: #1e293b;
  --text-soft: #475569;
  --text-muted: #94a3b8;

  /* Brand Colors — Refined Blue-Green */
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.5);
  --primary-glow: rgba(59, 130, 246, 0.2);

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.4);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.4);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.3);

  /* UI Colors */
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  /* Shadows — Layered */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.14);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-elevated: 0 8px 24px rgba(59, 130, 246, 0.18);

  /* Radius — Fluid */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions — Exponential Easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
}

/* ── Global box-sizing reset ── */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ═══════════════════════════════════════
   LAYOUT — Sidebar + Main Area
   ══════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 1px 0 12px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

/* ── Sidebar Header ── */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: clamp(14px, 2vw, 20px) clamp(12px, 1.5vw, 18px);
  border-bottom: 1px solid var(--sidebar-border);
  gap: clamp(8px, 1vw, 12px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 12px);
  color: var(--sidebar-text-hover);
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.sidebar-brand:hover {
  color: var(--sidebar-text-hover);
}

.sidebar-logo {
  width: clamp(34px, 4vw, 42px);
  height: clamp(34px, 4vw, 42px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-light), var(--primary), var(--primary-dark));
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

.sidebar-logo:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.sidebar-logo svg {
  width: clamp(18px, 2.2vw, 24px);
  height: clamp(18px, 2.2vw, 24px);
  display: block;
}

.sidebar-brand-text {
  min-width: 0;
}

.sidebar-brand-text h1 {
  margin: 0;
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 800;
  color: var(--sidebar-text-hover);
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand-text small {
  display: block;
  margin-top: 1px;
  color: var(--sidebar-text);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ── Sidebar Navigation ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: clamp(8px, 1vw, 12px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 12px);
  padding: clamp(10px, 1.2vw, 14px) clamp(10px, 1.2vw, 14px);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
  cursor: pointer;
  overflow: hidden;
}

.sidebar-nav-item:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-accent-glow);
}

.sidebar-nav-item:active {
  transform: scale(0.97);
}

.sidebar-nav-item.active {
  color: var(--sidebar-text-active);
  background: var(--sidebar-accent-glow);
  box-shadow: inset 3px 0 0 var(--sidebar-accent);
}

.sidebar-nav-item .nav-icon {
  width: clamp(20px, 2.5vw, 24px);
  height: clamp(20px, 2.5vw, 24px);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  transition: background var(--duration-fast) var(--ease-out-expo);
}

.sidebar-nav-item:hover .nav-icon,
.sidebar-nav-item.active .nav-icon {
  background: var(--sidebar-accent-glow);
}

.sidebar-nav-item .nav-icon svg {
  width: clamp(16px, 2vw, 20px);
  height: clamp(16px, 2vw, 20px);
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav-item .nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav-item .nav-badge {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 0 6px;
  background: var(--sidebar-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

/* Nav section label */
.sidebar-nav-section {
  padding: clamp(12px, 1.5vw, 16px) clamp(10px, 1.2vw, 14px) clamp(4px, 0.5vw, 6px);
  color: rgba(255, 255, 255, 0.22);
  font-size: clamp(9px, 1.1vw, 11px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: clamp(8px, 1vw, 12px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 12px);
  padding: clamp(8px, 1vw, 12px);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.sidebar-user:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-accent-glow);
}

.sidebar-user-avatar {
  width: clamp(28px, 3.5vw, 36px);
  height: clamp(28px, 3.5vw, 36px);
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  font-size: clamp(12px, 1.5vw, 16px);
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-info strong {
  display: block;
  color: var(--sidebar-text-hover);
  font-size: clamp(11px, 1.3vw, 14px);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-info span {
  display: block;
  color: var(--sidebar-text);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 500;
  margin-top: 1px;
}

/* Sidebar balance & actions */
.sidebar-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: clamp(4px, 0.5vw, 8px) clamp(8px, 1vw, 12px);
  color: var(--sidebar-text);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 600;
}

.sidebar-balance strong {
  color: var(--sidebar-accent);
  font-weight: 800;
}

.sidebar-actions {
  display: flex;
  gap: 4px;
  padding: 0 clamp(4px, 0.5vw, 8px) clamp(4px, 0.5vw, 8px);
}

.sidebar-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  padding: 0 clamp(6px, 0.8vw, 10px);
  color: var(--sidebar-text);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.sidebar-action-btn:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-accent-glow);
}

.sidebar-action-btn.primary {
  color: var(--sidebar-accent);
  background: var(--sidebar-accent-glow);
}

.sidebar-action-btn.primary:hover {
  background: rgba(59, 130, 246, 0.25);
}

.sidebar-action-btn .action-icon {
  width: clamp(12px, 1.5vw, 16px);
  height: clamp(12px, 1.5vw, 16px);
  display: grid;
  place-items: center;
}

.sidebar-action-btn .action-icon svg {
  width: clamp(12px, 1.5vw, 16px);
  height: clamp(12px, 1.5vw, 16px);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Sidebar Toggle (mobile) ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--main-surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.sidebar-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out-expo);
  pointer-events: none;
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ══════════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════════ */

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100dvh;
  padding: clamp(16px, 2.5vw, 28px) clamp(16px, 3vw, 32px);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
    var(--main-bg);
  transition: margin-left var(--duration-normal) var(--ease-out-expo);
}

.main-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 1.5vw, 20px);
  margin-bottom: clamp(16px, 2vw, 24px);
  flex-wrap: wrap;
}

.main-area-header h2 {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.main-area-header .eyebrow {
  margin: 0 0 3px;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.main-area-header-actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  flex-wrap: wrap;
}

/* ── Base Reset ── */
body.is-generating {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

a:hover {
  color: var(--primary-dark);
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.hidden {
  display: none !important;
}/* ═══════════════════════════════════════
   PAGE HEADER (page-hd)
   ═══════════════════════════════════════ */

.page-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 1.5vw, 20px);
  margin-bottom: clamp(16px, 2vw, 24px);
  flex-wrap: wrap;
}

.page-hd > div:first-child p {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.page-hd > div:first-child h1 {
  margin: 0;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-hd-actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
}

/* ═══════════════════════════════════════
   BALANCE BADGE
   ═══════════════════════════════════════ */

.badge-balance {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  padding: clamp(6px, 0.8vw, 10px) clamp(10px, 1.2vw, 16px);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-soft), transparent);
  border: 1px solid rgba(59, 130, 246, 0.12);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  transition: all var(--duration-normal) var(--ease-out-expo);
  text-decoration: none;
}

.badge-balance:hover {
  border-color: rgba(59, 130, 246, 0.25);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.10);
  transform: translateY(-1px);
}

.badge-balance .num {
  font-weight: 800;
  font-size: clamp(14px, 1.6vw, 18px);
  color: var(--primary);
}

.badge-balance .label {
  color: var(--text-soft);
  font-weight: 600;
}

.badge-balance .balance-icon {
  width: clamp(16px, 2vw, 20px);
  height: clamp(16px, 2vw, 20px);
  display: grid;
  place-items: center;
}

.badge-balance .balance-icon svg {
  width: clamp(16px, 2vw, 20px);
  height: clamp(16px, 2vw, 20px);
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ═══════════════════════════════════════
   CARD COMPONENTS (card-v3)
   ═══════════════════════════════════════ */

.card-v3 {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-out-expo),
              transform var(--duration-normal) var(--ease-out-expo);
}

.card-v3:hover {
  box-shadow: var(--shadow);
}

.card-v3-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.2vw, 16px);
  padding: clamp(14px, 1.8vw, 20px) clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
}

.card-v3-head > div {
  min-width: 0;
}

.card-v3-head .eyebrow {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-v3-head h3 {
  margin: 0;
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-v3-head-actions {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  flex-wrap: wrap;
}

.card-v3-body {
  padding: clamp(16px, 2vw, 24px);
}

/* ═══════════════════════════════════════
   GRID LAYOUTS
   ═══════════════════════════════════════ */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: clamp(16px, 2vw, 24px);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: clamp(12px, 1.5vw, 18px);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: clamp(12px, 1.5vw, 18px);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: clamp(12px, 1.5vw, 18px);
}

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */

.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  padding: 0 clamp(14px, 1.8vw, 22px);
  font-weight: 700;
  font-size: clamp(12px, 1.4vw, 14px);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out-expo);
  gap: clamp(4px, 0.5vw, 8px);
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--main-surface-soft);
  color: var(--text);
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out-expo);
}

.btn:hover::after {
  opacity: 1;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.22);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}

.btn.primary:active {
  transform: translateY(0);
}

.btn.secondary {
  border-color: var(--line);
  background: var(--main-surface);
  color: var(--text-soft);
}

.btn.secondary:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: var(--primary-soft);
  color: var(--primary);
}

.btn.secondary.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.btn.secondary.disabled {
  pointer-events: none;
  opacity: 0.4;
}

.btn.danger {
  border-color: inherit;
  background: var(--main-surface);
  color: var(--danger);
}

.btn.danger:hover {
  background: var(--danger-soft);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
  padding: 0 clamp(4px, 0.5vw, 8px);
  min-height: auto;
}

.btn.ghost:hover {
  background: var(--main-surface-soft);
  color: var(--text);
}

.btn.sm {
  min-height: 30px;
  padding: 0 clamp(8px, 1vw, 14px);
  font-size: clamp(11px, 1.3vw, 13px);
}

.btn.lg {
  min-height: 44px;
  padding: 0 clamp(18px, 2.2vw, 28px);
  font-size: clamp(14px, 1.6vw, 16px);
}

/* ═══════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════ */

.field-v3 {
  display: grid;
  gap: clamp(4px, 0.5vw, 8px);
  margin-bottom: clamp(12px, 1.5vw, 18px);
}

.field-v3 > label {
  color: var(--text-soft);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 700;
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--main-surface);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-fast) var(--ease-out-expo),
              background var(--duration-fast) var(--ease-out-expo);
  font-family: inherit;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: var(--main-surface);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ── Generic input catch-all (supports bare <input> without type=) ── */
input {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--main-surface);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-fast) var(--ease-out-expo);
  font-family: inherit;
}

input:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Reset special input types to defaults */
input[type="checkbox"],
input[type="radio"],
input[type="submit"],
input[type="button"],
input[type="hidden"] {
  width: auto;
  border: none;
  box-shadow: none;
  height: auto;
  padding: 0;
}

/* Height for non-special inputs */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]) {
  height: clamp(36px, 4.5vw, 44px);
  padding: 0 clamp(10px, 1.2vw, 14px);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select {
  height: clamp(36px, 4.5vw, 44px);
  padding: 0 clamp(10px, 1.2vw, 14px);
  font-size: clamp(13px, 1.5vw, 15px);
}

textarea {
  min-height: 120px;
  padding: clamp(8px, 1vw, 12px) clamp(10px, 1.2vw, 14px);
  resize: vertical;
  line-height: 1.6;
  font-size: clamp(13px, 1.5vw, 15px);
}

input[readonly] {
  background: var(--main-surface-soft);
  color: var(--text-muted);
}

select {
  appearance: none;
  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='%234b5563' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Content Slot ── */
.content-slot {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(12px, 1.5vw, 18px);
  min-height: 60px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.content-slot:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ═══════════════════════════════════════
   CHIP GROUP (芯片选择器)
   ═══════════════════════════════════════ */

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(4px, 0.5vw, 8px);
}

.chip-group label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 clamp(10px, 1.2vw, 16px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 650;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  user-select: none;
}

.chip-group label:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: var(--primary-soft);
  color: var(--primary);
}

.chip-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* ═══════════════════════════════════════
   MODE TOGGLE (卡片式切换)
   ═══════════════════════════════════════ */

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: clamp(6px, 0.8vw, 10px);
}

.mode-toggle label {
  min-height: clamp(40px, 5vw, 48px);
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface);
  color: var(--text-soft);
  font-weight: 750;
  font-size: clamp(13px, 1.5vw, 15px);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  position: relative;
}

.mode-toggle label:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: var(--primary-soft);
  color: var(--primary);
}

.mode-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-toggle label:has(input:checked) {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft), transparent);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

/* ═══════════════════════════════════════
   EDIT UPLOAD BOX
   ═══════════════════════════════════════ */

.edit-upload-box {
  position: relative;
  min-height: clamp(70px, 8vw, 90px);
  display: grid;
  grid-template-columns: clamp(30px, 3.5vw, 40px) minmax(0, 1fr);
  gap: clamp(8px, 1vw, 12px);
  align-items: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(10px, 1.2vw, 16px) clamp(12px, 1.5vw, 18px);
  background: var(--main-surface-soft);
  transition: all var(--duration-fast) var(--ease-out-expo);
}
.edit-upload-box > :not(input) { pointer-events: none; }

.edit-upload-box:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.edit-upload-box input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.edit-upload-icon {
  width: clamp(30px, 3.5vw, 40px);
  height: clamp(30px, 3.5vw, 40px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 700;
  line-height: 1;
}

.edit-upload-box strong {
  display: block;
  color: var(--text);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 750;
}

.edit-upload-box small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 600;
}

.edit-upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: clamp(4px, 0.5vw, 8px);
  margin-top: clamp(8px, 1vw, 12px);
}

.edit-preview-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--main-surface-soft);
}

.edit-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.edit-preview-item button {
  position: absolute;
  right: 3px;
  bottom: 3px;
  border: 0;
  border-radius: 4px;
  padding: 2px 5px;
  background: inherit;
  color: #fff;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

/* ═══════════════════════════════════════
   COST HINT
   ═══════════════════════════════════════ */

.cost-hint {
  margin-top: clamp(10px, 1.2vw, 14px);
  padding: clamp(8px, 1vw, 12px) clamp(10px, 1.2vw, 16px);
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: clamp(12px, 1.4vw, 14px);
  color: var(--text-soft);
  text-align: center;
}

.cost-hint strong {
  color: var(--primary);
  font-weight: 700;
}

/* ═══════════════════════════════════════
   GENERATE ACTIONS
   ═══════════════════════════════════════ */

.generate-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: clamp(6px, 0.8vw, 10px);
  margin-top: clamp(8px, 1vw, 12px);
}

/* ═══════════════════════════════════════
   PREVIEW STAGE
   ═══════════════════════════════════════ */

.preview-card {
  display: grid;
  grid-template-rows: auto 1fr;
}

.preview-stage {
  min-height: clamp(280px, 35vw, 420px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(59, 130, 246, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(59, 130, 246, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(59, 130, 246, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(59, 130, 246, 0.08) 75%),
    transparent;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-stage img {
  width: 100%;
  height: 100%;
  max-height: clamp(400px, 50vw, 600px);
  object-fit: contain;
  background: #fff;
}

.empty-state,
.preview-loading {
  width: min(90%, 400px);
  min-height: clamp(80px, 10vw, 120px);
  display: grid;
  place-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(12px, 1.5vw, 20px);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-muted);
  text-align: center;
  font-weight: 700;
}

.preview-loading span {
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 600;
}

.preview-error {
  width: min(92%, 500px);
  min-height: clamp(90px, 11vw, 130px);
  display: grid;
  place-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  border: 1px solid inherit;
  border-radius: var(--radius);
  padding: clamp(12px, 1.5vw, 20px);
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
  font-weight: 700;
}

.preview-error span {
  color: inherit;
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.preview-spinner {
  width: clamp(24px, 3vw, 32px);
  height: clamp(24px, 3vw, 32px);
  border: 3px solid inherit;
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════
   HISTORY / RECORDS (图库网格)
   ═══════════════════════════════════════ */

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: clamp(10px, 1.2vw, 16px);
}

.history-list .record-card {
  height: auto;
  min-height: clamp(200px, 25vw, 260px);
  display: grid;
  grid-template-rows: clamp(120px, 15vw, 160px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--main-surface);
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.history-list .record-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.history-list .record-card:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.3);
  outline-offset: 2px;
}

.record-image {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-soft), var(--main-surface-soft));
  color: var(--text-muted);
  font-weight: 750;
}

.record-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease-out-expo);
}

.record-card:hover .record-image img {
  transform: scale(1.05);
}

.record-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: clamp(3px, 0.5vw, 6px);
  padding: clamp(8px, 1vw, 12px) clamp(10px, 1.2vw, 14px);
}

.record-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(6px, 0.8vw, 10px);
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 750;
}

.record-meta span:first-child {
  color: var(--primary);
}

.record-body p {
  max-height: clamp(30px, 4vw, 42px);
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(11px, 1.3vw, 13px);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.record-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(6px, 0.8vw, 10px);
  margin-top: auto;
}

.record-body time {
  overflow: hidden;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-delete {
  min-height: 24px;
  border: 1px solid inherit;
  border-radius: 6px;
  padding: 0 clamp(5px, 0.6vw, 8px);
  background: var(--main-surface);
  color: var(--danger);
  font-size: clamp(9px, 1.1vw, 11px);
  font-weight: 800;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.record-delete:hover {
  background: var(--danger-soft);
}

.record-delete-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  min-width: 0;
}

.history-empty-inline {
  grid-column: 1 / -1;
  min-height: clamp(70px, 8vw, 100px);
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--main-surface-soft);
  font-weight: 700;
}

/* ═════════════════════════════════════
   DIALOGS / OVERLAYS
   ═════════════════════════════════════ */

.redeem-dialog,
.record-dialog,
.generation-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: clamp(16px, 2vw, 24px);
  background: inherit;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.redeem-panel,
.record-dialog-panel {
  width: min(92%, 540px);
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--main-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--duration-slow) var(--ease-out-expo) forwards;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.redeem-head,
.record-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.2vw, 16px);
  padding: clamp(14px, 1.8vw, 20px) clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
}

.redeem-head .eyebrow,
.record-dialog-head .eyebrow {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.redeem-head h2,
.record-dialog-head h2 {
  margin: 0;
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.01em;
}

.dialog-close,
.record-dialog-close {
  width: clamp(28px, 3.5vw, 36px);
  height: clamp(28px, 3.5vw, 36px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.dialog-close:hover,
.record-dialog-close:hover {
  background: var(--main-surface-soft);
  color: var(--text);
}

.redeem-form,
.record-dialog-body {
  padding: clamp(16px, 2vw, 24px);
}

.record-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(8px, 1vw, 12px);
  padding: clamp(12px, 1.5vw, 16px) clamp(16px, 2vw, 24px);
  border-top: 1px solid var(--line);
}

/* ── Record Dialog Inner Elements ── */
.record-full-prompt {
  margin-bottom: clamp(12px, 1.5vw, 18px);
}

.record-full-prompt > span {
  display: block;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.record-full-prompt > p {
  margin: 0;
  font-size: clamp(13px, 1.5vw, 15px);
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
}

.record-dialog-image {
  margin-bottom: clamp(12px, 1.5vw, 18px);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--main-surface-soft);
  text-align: center;
}

.record-dialog-image img,
.record-dialog-image video {
  max-width: 100%;
  max-height: clamp(200px, 25vw, 320px);
  object-fit: contain;
  background: var(--main-surface-soft);
  display: block;
  margin: 0 auto;
}

.record-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 1vw, 12px);
}

.record-detail-grid > div {
  display: grid;
  gap: 3px;
  padding: clamp(8px, 1vw, 12px) clamp(10px, 1.2vw, 14px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--main-surface-soft);
}

.record-detail-grid > div > span {
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.record-detail-grid > div > strong {
  font-size: clamp(14px, 1.7vw, 18px);
  font-weight: 800;
  color: var(--text);
}

.record-detail-grid > div > strong.status {
  font-size: clamp(12px, 1.4vw, 14px);
}

.record-error {
  margin-top: clamp(10px, 1.2vw, 14px);
  padding: clamp(10px, 1.2vw, 14px) clamp(12px, 1.5vw, 16px);
  background: var(--danger-soft);
  border: 1px solid inherit;
  border-radius: var(--radius);
  color: var(--danger);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}

/* ── Error Dialog (generation error popup) ── */
.error-dialog-panel {
  width: min(92%, 460px);
  max-height: 80dvh;
  overflow-y: auto;
  background: var(--main-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--duration-slow) var(--ease-out-expo) forwards;
}

.error-dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(16px, 2vw, 24px) clamp(18px, 2.2vw, 28px);
  border-bottom: 1px solid var(--line);
  color: var(--danger);
}

.error-dialog-head svg {
  width: clamp(20px, 2.5vw, 28px);
  height: clamp(20px, 2.5vw, 28px);
  flex-shrink: 0;
}

.error-dialog-head h2 {
  margin: 0;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 800;
  color: var(--text);
}

.error-dialog-body {
  padding: clamp(16px, 2vw, 24px) clamp(18px, 2.2vw, 28px);
  color: var(--text);
  font-size: clamp(13px, 1.5vw, 15px);
  line-height: 1.6;
  word-break: break-word;
}

.error-dialog-foot {
  display: flex;
  justify-content: flex-end;
  padding: clamp(12px, 1.5vw, 16px) clamp(18px, 2.2vw, 28px);
  border-top: 1px solid var(--line);
}

/* ═════════════════════════════════════
   TABLES
   ═════════════════════════════════════ */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-v3 {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--main-surface);
}

/* ═════════════════════════════════════
   PAGINATION
   ═════════════════════════════════════ */

.pagination,
.pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 14px);
  margin-top: clamp(16px, 2vw, 24px);
}

.pagination span,
.pages span {
  color: var(--text-muted);
  font-weight: 650;
  font-size: clamp(12px, 1.4vw, 14px);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 clamp(12px, 1.5vw, 18px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.page-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.page-btn.active {
  pointer-events: none;
  opacity: 0.5;
}

/* ═════════════════════════════════════
   STATUS BADGES
   ═════════════════════════════════════ */

.status-badge,
.badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 0 clamp(8px, 1vw, 12px);
  background: var(--main-surface-soft);
  color: var(--text-soft);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 750;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-badge.succeeded,
.badge.success {
  background: var(--success-soft);
  color: inherit;
  border-color: inherit;
}

.status-badge.failed,
.badge.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: inherit;
}

.status-badge.running,
.status-badge.queued,
.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: inherit;
}

.status-badge.deleted,
.badge.deleted {
  background: var(--main-surface-soft);
  color: var(--text-muted);
  border-color: var(--line-strong);
}

/* ═════════════════════════════════════
   ALERTS & MESSAGES
   ═════════════════════════════════════ */

.alert,
.inline-message {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(10px, 1.2vw, 14px) clamp(12px, 1.5vw, 16px);
  background: var(--main-surface);
  color: var(--text-soft);
  font-weight: 650;
}

.inline-message {
  margin-top: clamp(12px, 1.5vw, 18px);
}

.alert.error,
.inline-message.error {
  border-color: inherit;
  background: var(--danger-soft);
  color: var(--danger);
}

.alert.success,
.inline-message.success {
  border-color: inherit;
  background: var(--success-soft);
  color: inherit;
}

.alert.warning,
.inline-message.warning {
  border-color: inherit;
  background: var(--warning-soft);
  color: var(--warning);
}

.generation-notice {
  margin-bottom: clamp(12px, 1.5vw, 18px);
  border: 1px solid inherit;
  border-radius: var(--radius);
  padding: clamp(10px, 1.2vw, 14px) clamp(12px, 1.5vw, 16px);
  background: var(--warning-soft);
  color: inherit;
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  line-height: 1.6;
}

/* ═════════════════════════════════════
   SHOP GRID (商城一排3个)
   ═════════════════════════════════════ */

.grid-3cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2vw, 24px);
}

@media (max-width: 960px) {
  .grid-3cols { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .grid-3cols { grid-template-columns: 1fr; }
}

/* ═════════════════════════════════════
   PRICE CARD (商城套餐)
   ═════════════════════════════════════ */

.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.price-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.5);
}

.price-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
}

.price-card.featured:hover {
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-elevated);
}

.package-badge {
  position: absolute;
  top: clamp(10px, 1.2vw, 14px);
  right: clamp(10px, 1.2vw, 14px);
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 clamp(8px, 1vw, 12px);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.package-body {
  display: grid;
  gap: clamp(12px, 1.5vw, 18px);
  padding: clamp(18px, 2.2vw, 26px) clamp(18px, 2.2vw, 26px) clamp(16px, 2vw, 24px);
  text-align: center;
}

.package-head h3 {
  margin: 0;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.package-desc {
  margin: clamp(4px, 0.5vw, 8px) 0 0;
  color: var(--text-muted);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  line-height: 1.5;
}

.price-amount {
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.package-credits {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.5vw, 8px);
  padding: clamp(6px, 0.8vw, 10px) clamp(12px, 1.5vw, 18px);
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
}

.package-credits strong {
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 800;
}

.package-buy-btn {
  margin-top: clamp(4px, 0.5vw, 8px);
}

/* ═════════════════════════════════════
   BUY SUMMARY (购买确认)
   ═════════════════════════════════════ */

.buy-summary {
  display: grid;
  gap: clamp(8px, 1vw, 14px);
  margin-bottom: clamp(14px, 1.8vw, 20px);
}

.buy-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(8px, 1vw, 12px) clamp(12px, 1.5vw, 16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface-soft);
}

.buy-summary-row span {
  color: var(--text-muted);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
}

.buy-summary-row strong {
  color: var(--text);
  font-size: clamp(13px, 1.6vw, 17px);
  font-weight: 800;
}

.buy-summary-row.total {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.buy-summary-row.total span {
  color: var(--primary-dark);
}

.buy-summary-row.total strong {
  color: var(--primary-dark);
  font-size: clamp(17px, 2.2vw, 23px);
}

.pay-type-select {
  margin-bottom: clamp(8px, 1vw, 14px);
}

.pay-type-select .field-hint {
  display: block;
  margin-bottom: clamp(6px, 0.8vw, 10px);
  color: var(--text-muted);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 700;
}

.pay-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: clamp(6px, 0.8vw, 10px);
}

.pay-type-item {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(38px, 4.5vw, 46px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.pay-type-item:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: var(--primary-soft);
  color: var(--primary);
}

.pay-type-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pay-type-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* ═════════════════════════════════════
   EMPTY STATE
   ═════════════════════════════════════ */

.empty-state {
  display: grid;
  place-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  padding: clamp(30px, 4vw, 50px) clamp(20px, 2.5vw, 32px);
  text-align: center;
}

.empty-state .icon {
  font-size: clamp(36px, 4.5vw, 52px);
  line-height: 1;
}

.empty-state h3 {
  margin: 0;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  line-height: 1.5;
}

/* ═════════════════════════════════════
   PROMPT OPTIMIZE BAR
   ═════════════════════════════════════ */

.prompt-optimize-bar {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  margin-top: clamp(4px, 0.5vw, 8px);
}

.prompt-optimize-bar .hint {
  color: var(--text-muted);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 600;
}

/* ═════════════════════════════════════
   CHAT LAYOUT (AI对话界面)
   ═════════════════════════════════════ */

.chat-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* ── Chat Sidebar ── */
.chat-sidebar {
  width: clamp(260px, 30vw, 340px);
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow: hidden;
}

.chat-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1vw, 14px);
  padding: clamp(12px, 1.5vw, 18px) clamp(14px, 1.8vw, 22px);
  border-bottom: 1px solid var(--sidebar-border);
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  min-width: 0;
  color: var(--sidebar-text-hover);
}

.chat-sidebar-header svg {
  flex-shrink: 0;
}

.chat-sidebar-title {
  font-size: clamp(13px, 1.6vw, 17px);
  font-weight: 800;
  color: var(--sidebar-text-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-new-btn {
  width: clamp(32px, 4vw, 40px);
  height: clamp(32px, 4vw, 40px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--sidebar-accent-glow);
  color: var(--sidebar-accent);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  flex-shrink: 0;
}

.chat-new-btn:hover {
  background: var(--sidebar-accent);
  color: #fff;
  transform: scale(1.05);
}

.chat-new-btn svg {
  width: clamp(16px, 2vw, 20px);
  height: clamp(16px, 2vw, 20px);
}

.chat-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: clamp(6px, 0.8vw, 10px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-sidebar-list::-webkit-scrollbar {
  width: 4px;
}

.chat-sidebar-list::-webkit-scrollbar-thumb {
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
}

.chat-sidebar-empty {
  display: grid;
  place-items: center;
  padding: clamp(30px, 4vw, 50px) clamp(16px, 2vw, 24px);
  color: var(--sidebar-text);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600);
  text-align: center;
}

.chat-conv-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: clamp(10px, 1.2vw, 14px) clamp(12px, 1.5vw, 18px);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  min-width: 0;
}

.chat-conv-item:hover {
  background: var(--sidebar-accent-glow);
}

.chat-conv-item.active {
  background: var(--sidebar-accent-glow);
  box-shadow: inset 3px 0 0 var(--sidebar-accent);
}

.chat-conv-title {
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  color: var(--sidebar-text-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conv-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(6px, 0.8vw, 10px);
  font-size: clamp(10px, 1.2vw, 12px);
  color: var(--sidebar-text);
  font-weight: 600;
}

.chat-conv-count {
  white-space: nowrap;
}

.chat-sidebar-user {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 12px);
  padding: clamp(10px, 1.2vw, 14px) clamp(14px, 1.8vw, 18px);
  border-top: 1px solid var(--sidebar-border);
  min-width: 0;
}

.chat-sidebar-avatar {
  width: clamp(28px, 3.5vw, 36px);
  height: clamp(28px, 3.5vw, 36px);
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  font-size: clamp(12px, 1.5vw, 16px);
  font-weight: 800;
  flex-shrink: 0;
}

.chat-sidebar-uname {
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  color: var(--sidebar-text-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ── Chat Main ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--main-bg);
  overflow: hidden;
}

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.2vw, 16px);
  padding: clamp(10px, 1.2vw, 14px) clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: var(--main-surface);
  flex-shrink: 0;
}

.chat-topbar-left {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  min-width: 0;
}

.chat-topbar-left svg {
  flex-shrink: 0;
  color: var(--primary);
}

.chat-topbar-title {
  font-size: clamp(14px, 1.7vw, 18px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-topbar-right {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
}

.chat-balance {
  display: inline-flex;
  align-items: center;
  gap: clamp(4px, 0.6vw, 8px);
  padding: clamp(4px, 0.6vw, 8px) clamp(8px, 1vw, 14px);
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-decoration: none;
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.chat-balance:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.chat-balance-num {
  font-weight: 800;
  color: var(--primary);
}

.chat-balance-label {
  color: var(--text-soft);
  font-weight: 600;
}

/* ── Chat Messages ── */
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: clamp(16px, 2vw, 24px) clamp(16px, 2vw, 32px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.5vw, 20px);
}

.chat-msgs::-webkit-scrollbar {
  width: 6px;
}

.chat-msgs::-webkit-scrollbar-thumb {
  border-radius: var(--radius-full);
  background: inherit;
}

.chat-welcome {
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(40px, 5vw, 60px) clamp(20px, 2.5vw, 32px);
  gap: clamp(8px, 1vw, 14px);
}

.chat-welcome-icon {
  width: clamp(60px, 7vw, 80px);
  height: clamp(60px, 7vw, 80px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  color: var(--primary);
}

.chat-welcome-icon svg {
  width: clamp(30px, 3.5vw, 40px);
  height: clamp(30px, 3.5vw, 40px);
}

.chat-welcome-heading {
  margin: 0;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.chat-welcome-text {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(13px, 1.5vw, 15px);
  font-weight: 600;
  line-height: 1.5;
}

.chat-welcome-text strong {
  color: var(--primary);
  font-weight: 800;
}

/* ── Chat Message Bubbles ── */
.chat-msg {
  display: flex;
  gap: clamp(8px, 1vw, 14px);
  max-width: min(92%, 780px);
  animation: msgFadeIn var(--duration-normal) var(--ease-out-expo);
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-ai {
  align-self: flex-start;
}

.chat-msg-err {
  align-self: center;
  max-width: min(92%, 600px);
}

.chat-msg-avatar {
  width: clamp(32px, 4vw, 40px);
  height: clamp(32px, 4vw, 40px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  font-size: clamp(12px, 1.5vw, 16px);
  font-weight: 800;
}

.chat-msg-user .chat-msg-avatar {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
}

.chat-msg-ai .chat-msg-avatar {
  background: var(--primary-soft);
  color: var(--primary);
}

.chat-msg-err .chat-msg-avatar {
  background: var(--danger-soft);
  color: var(--danger);
}

.chat-msg-body {
  padding: clamp(10px, 1.2vw, 14px) clamp(14px, 1.8vw, 20px);
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: clamp(13px, 1.5vw, 15px);
  word-break: break-word;
}

.chat-msg-user .chat-msg-body {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-ai .chat-msg-body {
  background: var(--main-surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.chat-msg-err .chat-msg-body {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid inherit;
}

/* ── Typing Indicator ── */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: clamp(10px, 1.2vw, 14px) clamp(14px, 1.8vw, 20px);
}

.chat-typing .dot {
  width: clamp(6px, 0.8vw, 8px);
  height: clamp(6px, 0.8vw, 8px);
  border-radius: var(--radius-full);
  background: var(--primary);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.chat-typing .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing .dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Chat Footer ── */
.chat-foot {
  padding: clamp(10px, 1.2vw, 16px) clamp(16px, 2vw, 24px);
  background: var(--main-surface);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.chat-foot-inner {
  max-width: 820px;
  margin: 0 auto;
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: clamp(6px, 0.8vw, 10px);
  padding: clamp(6px, 0.8vw, 10px) clamp(12px, 1.5vw, 18px);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  transition: border-color var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-fast) var(--ease-out-expo);
}

.chat-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  min-height: clamp(20px, 2.5vw, 24px);
  max-height: 160px;
  padding: 0;
  font-family: inherit;
  font-size: clamp(13px, 1.5vw, 15px);
  line-height: 1.5;
  color: var(--text);
  background: transparent;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  width: clamp(34px, 4.2vw, 42px);
  height: clamp(34px, 4.2vw, 42px);
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn.sending {
  background: var(--primary-dark);
  pointer-events: none;
}

.chat-send-btn svg {
  width: clamp(16px, 2vw, 20px);
  height: clamp(16px, 2vw, 20px);
}

.chat-foot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1vw, 14px);
  margin-top: clamp(6px, 0.8vw, 10px);
  font-size: clamp(11px, 1.3vw, 13px);
  color: var(--text-muted);
  font-weight: 600;
}

.chat-model-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--main-surface-soft);
  color: var(--text-soft);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 650;
}

.chat-model-tag svg {
  flex-shrink: 0;
}

.chat-model-picker {
  border: none;
  outline: none;
  background: transparent;
  color: var(--primary);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

.chat-cost-tag {
  color: var(--text-muted);
  font-weight: 650;
}
/* ══════════════════════════════════════�?   FIX: Missing Styles �?UI Fix Patch v1
   ══════════════════════════════════════�?*/

/* ── .form (form base) ── */
.form {
  display: grid;
  gap: clamp(12px, 1.5vw, 18px);
}

/* ── .section-card ── */
.card.section-card,
.section-card {
  margin-top: 20px;
}

/* ── .field-grid ── */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 16px);
}

/* ── .model-chip ── */
.model-chip select {
  width: 100%;
  min-width: 0;
}

/* ── .tabs / .tab ── */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--main-surface-soft);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 clamp(10px, 1.2vw, 16px);
  border-radius: 8px;
  color: var(--text-soft);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.tab:hover {
  color: var(--primary);
  background: var(--main-surface);
}

.tab.active {
  color: var(--primary);
  background: var(--main-surface);
  box-shadow: var(--shadow-xs);
}

/* ── .pagination / .pages / .page-btn ── */
.pagination,
.pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 14px);
  padding: clamp(14px, 1.8vw, 20px);
}

.pagination span,
.pages span {
  color: var(--text-muted);
  font-weight: 650;
  font-size: clamp(12px, 1.4vw, 14px);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 clamp(12px, 1.5vw, 18px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.page-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.page-btn.active {
  pointer-events: none;
  opacity: 0.5;
}

/* ── .media-card (图库卡片) ── */
.media-card {
  display: grid;
  grid-template-rows: clamp(130px, 16vw, 180px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface);
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.media-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.media-card > img,
.media-card > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s var(--ease-out-expo);
}

.media-card:hover > img,
.media-card:hover > video {
  transform: scale(1.05);
}

/* ── .media-card-body, .media-card .prompt, .media-card .meta ── */
.media-card-body {
  display: grid;
  gap: clamp(3px, 0.5vw, 6px);
  padding: clamp(8px, 1vw, 12px) clamp(10px, 1.2vw, 14px);
  min-width: 0;
}

.media-card .prompt {
  font-size: clamp(11px, 1.3vw, 13px);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: clamp(30px, 4vw, 42px);
}

.media-card .meta {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.5vw, 8px);
  font-size: clamp(10px, 1.2vw, 12px);
  color: var(--text-muted);
  font-weight: 600;
  flex-wrap: wrap;
}

.media-card .meta .status-badge {
  flex-shrink: 0;
}

/* ── .muted (略淡文本) ── */
.muted {
  color: var(--text-muted);
}

/* ── .price-card (商城) ── */
.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  padding: clamp(20px, 2.5vw, 28px) clamp(22px, 2.8vw, 32px);
  text-align: center;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.price-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.5);
}

.price-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
  position: relative;
}

.price-card.featured::before {
  content: '推荐';
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.price-card .name {
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: clamp(4px, 0.5vw, 8px);
}

.price-card .desc {
  font-size: clamp(12px, 1.4vw, 14px);
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: clamp(12px, 1.5vw, 18px);
  line-height: 1.5;
}

.price-card .price {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: clamp(6px, 0.8vw, 10px);
}

.price-card .credits {
  display: inline-flex;
  align-items: center;
  gap: clamp(4px, 0.5vw, 8px);
  padding: clamp(6px, 0.8vw, 10px) clamp(12px, 1.5vw, 18px);
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
  margin-bottom: clamp(12px, 1.5vw, 18px);
}

.price-card .credits strong {
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 800;
}

.price-card .btn {
  width: 100%;
}

/* ── User Center (uc-*) ── */
.uc-section {
  margin-bottom: clamp(16px, 2vw, 24px);
}

.uc-header {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.5vw, 20px);
  min-width: 0;
}

.uc-avatar {
  width: clamp(56px, 7vw, 80px);
  height: clamp(56px, 7vw, 80px);
  display: grid;
  place-items: center;
  border-radius: clamp(14px, 1.8vw, 22px);
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
  flex-shrink: 0;
}

.uc-header-info {
  min-width: 0;
}

.uc-header-info h2 {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.uc-header-info p {
  margin: clamp(2px, 0.3vw, 4px) 0 0;
  color: var(--text-muted);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
}

.uc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: clamp(10px, 1.2vw, 16px);
}

.uc-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(12px, 1.5vw, 18px) clamp(14px, 1.8vw, 20px);
  background: var(--main-surface);
  text-align: center;
}

.uc-stat .num {
  display: block;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.uc-stat .label {
  display: block;
  margin-top: clamp(2px, 0.3vw, 4px);
  color: var(--text-muted);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 600;
}

.uc-step {
  color: var(--text-muted);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
}

/* ── Upload Card / Grid ── */
.upload-card {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(16px, 2vw, 24px);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.upload-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 100px), 1fr));
  gap: clamp(6px, 0.8vw, 10px);
}

/* ── No Image ── */
.no-img {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--main-surface-soft);
  color: var(--text-muted);
  font-weight: 700;
  font-size: clamp(11px, 1.3vw, 13px);
  border-radius: var(--radius-sm);
}

/* ── Setup / Auth ── */
.setup-card,
.auth-card {
  width: min(92%, 440px);
  margin: clamp(40px, 6vw, 80px) auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.setup-section {
  padding: clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
}

.setup-section:last-child {
  border-bottom: 0;
}

.setup-form {
  display: grid;
  gap: clamp(12px, 1.5vw, 18px);
}

.auth-card-head {
  padding: clamp(20px, 2.5vw, 30px) clamp(22px, 2.8vw, 32px) clamp(12px, 1.5vw, 18px);
  text-align: center;
}

.auth-card-head h1 {
  margin: 0;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.auth-card-head p {
  margin: clamp(4px, 0.5vw, 8px) 0 0;
  color: var(--text-muted);
  font-size: clamp(13px, 1.5vw, 15px);
  font-weight: 600;
}

.auth-switch {
  text-align: center;
  margin-top: clamp(12px, 1.5vw, 18px);
  color: var(--text-muted);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
}


/* ── Server Flash ── */
.server-flash {
  margin-bottom: clamp(12px, 1.5vw, 18px);
  padding: clamp(10px, 1.2vw, 14px) clamp(12px, 1.5vw, 18px);
  border-radius: var(--radius);
  background: var(--success-soft);
  color: inherit;
  border: 1px solid inherit;
  font-weight: 650;
  font-size: clamp(12px, 1.4vw, 14px);
}

.server-flash.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: inherit;
}

/* ── Switch Toggle ── */
.switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--line-strong);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out-expo);
  flex-shrink: 0;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.switch:has(input:checked) { background: var(--primary); }

.switch.active { background: var(--primary); }

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-fast) var(--ease-out-expo);
  z-index: 0;
}

.switch:has(input:checked) .switch-knob { transform: translateX(20px); }
.switch.active .switch-knob { transform: translateX(20px); }

/* ── Small utility ── */
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(11px, 1.3vw, 13px);
  background: var(--main-surface-soft);
  padding: 0 4px;
  border-radius: 4px;
}

pre code {
  background: transparent;
  padding: 0;
}

.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.wide {
  width: 100%;
}

/* ── User Identity ── */
.user-identity {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.user-identity strong {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity > span {
  color: var(--text-muted);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 650;
}

/* ══════════════════════════════════════�?   RESPONSIVE MEDIA QUERIES
   ══════════════════════════════════════�?*/

/* ——— ADMIN NAV BAR ——— */

.admin-nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: clamp(16px, 2vw, 24px);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.admin-nav-bar a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 clamp(10px, 1.2vw, 16px);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-soft);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.admin-nav-bar a:hover {
  border-color: var(--line);
  background: var(--main-surface-soft);
  color: var(--text);
}

.admin-nav-bar a.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

/* Tablet & Small Desktop */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open,
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main-area {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: grid;
  }

  .sidebar-overlay.is-visible {
    display: block;
  }

  .chat-layout {
    height: calc(100vh - 52px);
  }

  .chat-sidebar {
    position: fixed;
    left: 0;
    top: 52px;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--duration-normal) var(--ease-out-expo);
  }

  .chat-sidebar.is-open {
    transform: translateX(0);
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .main-area {
    padding: 16px 14px;
  }

  .page-auth .main-area {
    padding: 16px;
  }

  .page-hd {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-auto {
    grid-template-columns: 1fr;
  }

  .card-v3-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .chat-foot-inner {
    padding: 0;
  }

  .table-wrap {
    font-size: 12px;
  }

  .pagination,
  .pages {
    flex-wrap: wrap;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .record-detail-grid {
    grid-template-columns: 1fr;
  }

  .history-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  select {
    font-size: 16px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
  }

  .center-auth-panel {
    border-radius: 20px;
  }

  .center-auth-body {
    padding: 0 clamp(16px, 4vw, 24px) clamp(20px, 4vw, 28px);
  }
}

/* Tablet admin-nav-bar */
@media (max-width: 1024px) {
  .admin-nav-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 8px;
  }
  .admin-nav-bar::-webkit-scrollbar { display: none; }
  .admin-nav-bar a { flex-shrink: 0; }
}

/* Mobile admin-nav-bar with fade edge */
@media (max-width: 640px) {
  .admin-nav-bar {
    mask-image: linear-gradient(to right, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 92%, transparent);
  }
  .admin-nav-bar a {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
    border: 1px solid var(--line);
  }
  .admin-nav-bar a:hover,
  .admin-nav-bar a.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
  }
}

/* Large Desktop */
@media (min-width: 1440px) {
  .main-area {
    padding: 32px 48px;
  }

  .page-auth .main-area {
    padding: clamp(18px, 3vw, 40px);
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ══════════════════════════════════════�?   ANIMATION PREFERENCE
   ══════════════════════════════════════�?*/

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ══════════════════════════════════════�?   PRINT STYLES
   ══════════════════════════════════════�?*/

@media print {
  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay,
  .chat-sidebar,
  .chat-foot,
  .btn,
  .record-delete-form {
    display: none !important;
  }

  .main-area {
    margin-left: 0;
    padding: 0;
  }

  .card-v3,
  .price-card,
  .history-list .record-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ── Generic UI Components (from admin.css) ── */
/* ── .button (Admin alias for .btn) ── */
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  padding: 0 clamp(14px, 1.8vw, 22px);
  font-weight: 700;
  font-size: clamp(12px, 1.4vw, 14px);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out-expo);
  gap: clamp(4px, 0.5vw, 8px);
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.22);
}

.button.primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}

.button.primary:active {
  transform: translateY(0);
}

.button.secondary {
  border-color: var(--line);
  background: var(--main-surface);
  color: var(--text-soft);
}

.button.secondary:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: var(--primary-soft);
  color: var(--primary);
}

.button.danger {
  border-color: inherit;
  background: var(--main-surface);
  color: var(--danger);
}

.button.danger:hover {
  background: var(--danger-soft);
}

.button.small {
  min-height: 30px;
  padding: 0 clamp(8px, 1vw, 14px);
  font-size: clamp(11px, 1.3vw, 13px);
}

.button.disabled {
  pointer-events: none;
  opacity: 0.4;
}

/* ── .card / .card-head (Admin card) ── */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  box-shadow: var(--shadow-card);
  padding: clamp(18px, 2.2vw, 26px);
  transition: box-shadow var(--duration-normal) var(--ease-out-expo);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.2vw, 16px);
  margin-bottom: clamp(14px, 1.8vw, 22px);
  min-height: 40px;
}

.card-head h3 {
  margin: 0;
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card.section-card,
.section-card {
  margin-top: clamp(16px, 2vw, 24px);
}

.card.code-create-card,
.code-create-card {
  margin-top: clamp(16px, 2vw, 24px);
}

.card.auth-card {
  max-width: 440px;
  margin: 0 auto;
}

.card.auth-card.wide {
  max-width: 600px;
}

/* ── .field (Admin form field) ── */
.field {
  display: grid;
  gap: clamp(4px, 0.5vw, 8px);
  margin-bottom: clamp(12px, 1.5vw, 18px);
}

.field > label,
.field > span,
.field > .field-label {
  color: var(--text-soft);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.field-hint {
  display: block;
  color: var(--text-muted);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 600;
  line-height: 1.5;
}

/* ── .page-admin ── */
.page-admin {
  background: var(--main-bg);
}

/* ── .is-deleted (table row) ── */
.is-deleted td,
tr.is-deleted td {
  background: inherit;
  color: var(--text-muted);
}

.deleted-time {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* ── .orphan-table (uploads orphan cleanup) ── */
.orphan-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: clamp(10px, 1.2vw, 14px);
}

.orphan-table th,
.orphan-table td {
  border-bottom: 1px solid var(--line);
  padding: clamp(6px, 0.8vw, 10px) clamp(8px, 1vw, 12px);
  text-align: left;
  font-size: clamp(11px, 1.3vw, 13px);
}

.orphan-table th {
  background: var(--main-surface-soft);
  color: var(--text-muted);
  font-weight: 800;
  font-size: clamp(10px, 1.2vw, 12px);
}

/* ── .stat (inline stats) ── */
.stat {
  color: var(--text);
  font-weight: 800;
  font-size: clamp(13px, 1.6vw, 17px);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: clamp(12px, 1.5vw, 20px);
  right: clamp(12px, 1.5vw, 20px);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: clamp(10px, 1.2vw, 14px) clamp(14px, 1.8vw, 20px);
  border-radius: var(--radius);
  background: var(--main-surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: clamp(13px, 1.5vw, 15px);
  font-weight: 700;
  color: var(--text);
  pointer-events: auto;
  animation: toastIn var(--duration-normal) var(--ease-out-expo);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success {
  border-color: inherit;
  background: var(--success-soft);
  color: inherit;
}

.toast.error {
  border-color: inherit;
  background: var(--danger-soft);
  color: var(--danger);
}

.toast.warning {
  border-color: inherit;
  background: var(--warning-soft);
  color: var(--warning);
}

.toast-leave {
  animation: toastOut var(--duration-fast) var(--ease-out-expo) forwards;
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ── Center Auth ── */
.page-auth {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 2vw, 24px);
  background:
    radial-gradient(circle at 20% 18%, rgba(59, 130, 246, 0.12) 0%, transparent 42%),
    radial-gradient(circle at 82% 82%, rgba(52, 211, 153, 0.08) 0%, transparent 40%),
    linear-gradient(135deg, #fefcf5, #eef3fe);
}

/* Auth pages: override sidebar layout so the card centers correctly */
.page-auth .app-layout {
  display: flex;
  width: 100%;
  min-height: 100dvh;
}

.page-auth .main-area {
  width: 100%;
  min-height: 100dvh;
  margin-left: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.center-auth-page {
  width: min(92vw, 430px);
  margin: 0 auto;
}

.center-auth-page.center-auth-register {
  width: min(94vw, 470px);
}

.center-auth-panel {
  position: relative;
  border: 1px solid oklch(100% 0% 0% / 0.65);
  border-radius: clamp(22px, 3vw, 30px);
  background: oklch(100% 0% 0% / 0.94);
  box-shadow: 0 24px 70px oklch(18% 8% 264 / 0.16), inset 0 1px 0 oklch(100% 0% 0% / 0.8);
  overflow: hidden;
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.center-auth-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-light), var(--primary), var(--success));
}

.center-auth-top {
  padding: clamp(24px, 3vw, 36px) clamp(24px, 3vw, 36px) clamp(16px, 2vw, 24px);
  text-align: center;
}

.center-auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: clamp(14px, 1.8vw, 22px);
  color: var(--text);
  text-decoration: none;
}

.center-auth-brand:hover {
  color: var(--text);
}

.center-auth-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, oklch(96% 8% 245), oklch(100% 0% 0%));
  box-shadow: 0 12px 30px oklch(55% 38% 245 / 0.18);
}

.center-auth-brand strong {
  display: block;
  font-size: clamp(17px, 2.2vw, 22px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.center-auth-brand small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 600;
}

.center-auth-brand svg {
  width: 40px;
  height: 40px;
}

.center-auth-brand .icon-frame,
.center-auth-brand .icon-line,
.center-auth-brand .icon-dot {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.center-auth-brand .ai-spark {
  fill: oklch(55% 38% 245 / 0.7);
  stroke: var(--primary);
  stroke-width: 0.6;
}

.center-auth-brand .ai-spark.small {
  fill: var(--primary);
  stroke: none;
}

.center-auth-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--main-surface-soft);
  margin-bottom: clamp(16px, 2vw, 24px);
}

.center-auth-tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: clamp(13px, 1.5vw, 15px);
  font-weight: 700;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.center-auth-tabs a:hover {
  color: var(--primary);
}

.center-auth-tabs a.active {
  color: var(--primary);
  background: var(--main-surface);
  box-shadow: var(--shadow-xs);
}

.center-auth-body {
  padding: 0 clamp(24px, 3vw, 36px) clamp(26px, 3.2vw, 38px);
}

.center-auth-form {
  display: grid;
  gap: clamp(13px, 1.5vw, 18px);
}

.center-auth-field {
  display: grid;
  gap: clamp(6px, 0.7vw, 9px);
  text-align: left;
}

.center-auth-field > span {
  color: var(--text-soft);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 750;
}

.center-auth-field input,
.center-auth-field select {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 clamp(12px, 1.4vw, 16px);
  height: clamp(42px, 4.8vw, 48px);
  font-size: clamp(13px, 1.5vw, 15px);
  outline: none;
  background: oklch(100% 0% 0%);
  color: var(--text);
  box-shadow: inset 0 1px 2px oklch(18% 8% 264 / 0.04);
  transition: border-color var(--duration-fast) var(--ease-out-expo), box-shadow var(--duration-fast) var(--ease-out-expo), background var(--duration-fast) var(--ease-out-expo);
}

.center-auth-field input::placeholder {
  color: oklch(66% 8% 264);
}

.center-auth-field input:focus,
.center-auth-field select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px oklch(55% 38% 245 / 0.12), inset 0 1px 2px oklch(18% 8% 264 / 0.03);
}

.center-auth-submit {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  padding: 0 22px;
  font-size: clamp(14px, 1.6vw, 16px);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 10px 24px oklch(55% 38% 245 / 0.26);
  cursor: pointer;
  transition: transform var(--duration-normal) var(--ease-out-expo), box-shadow var(--duration-normal) var(--ease-out-expo), background var(--duration-normal) var(--ease-out-expo);
  margin-top: clamp(4px, 0.5vw, 8px);
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

.center-auth-submit:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 14px 30px oklch(55% 38% 245 / 0.32);
  transform: translateY(-1px);
}

.center-auth-submit:active {
  transform: scale(0.98);
}

.center-auth-submit:focus-visible,
.center-auth-tabs a:focus-visible,
.auth-switch a:focus-visible {
  outline: 3px solid oklch(55% 38% 245 / 0.24);
  outline-offset: 3px;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  line-height: 1.7;
}

.auth-switch a {
  font-weight: 800;
  color: var(--primary);
}

/* ── Page Notice Overlay ── */
.page-notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: clamp(16px, 2vw, 24px);
  background: inherit;
  backdrop-filter: blur(8px);
}

.page-notice-panel {
  width: min(92%, 560px);
  max-height: 80dvh;
  overflow-y: auto;
  background: var(--main-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.page-notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 2vw, 24px) clamp(18px, 2.2vw, 28px);
  border-bottom: 1px solid var(--line);
}

.page-notice-head h2 {
  margin: 0;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 800;
}

.page-notice-body {
  padding: clamp(16px, 2vw, 24px) clamp(18px, 2.2vw, 28px);
  font-size: clamp(13px, 1.5vw, 15px);
  line-height: 1.7;
}

/* ── Auth Wrap (switch toggle for settings) ── */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.2vw, 16px);
  min-height: 100dvh;
  padding: 24px;
}

/* ── Grid (admin generic) ── */
.grid {
  display: grid;
  gap: clamp(16px, 2vw, 24px);
}

/* ══════════════════════════════════════�?   END OF FIX PATCH
   ══════════════════════════════════════�?*/

