/* ═══════════════════════════════════════
   AI创作平台 — 现代精致设计系统 v4
   Design System: Modern Elegant + Subtle Motion
   ═══════════════════════════════════════ */

/* Fonts use local platform stacks to avoid blocking page paint on remote font CDNs. */

/* ── 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-collapse-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out-expo),
              background var(--duration-fast) var(--ease-out-expo),
              border-color var(--duration-fast) var(--ease-out-expo),
              transform var(--duration-fast) var(--ease-out-expo);
}

.sidebar-collapse-btn:hover {
  color: var(--sidebar-text-hover);
  border-color: rgba(96, 165, 250, 0.34);
  background: var(--sidebar-accent-glow);
}

.sidebar-collapse-btn:active {
  transform: scale(0.96);
}

.sidebar-collapse-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.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.is-agent-hub {
  margin-top: 4px;
  color: #fde68a;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(236, 72, 153, 0.12));
  border: 1px solid rgba(251, 191, 36, 0.18);
}

.sidebar-nav-item.is-agent-hub:hover {
  color: #fef3c7;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(236, 72, 153, 0.16));
}

.sidebar-nav-item.is-agent-hub.active {
  color: #fff7ed;
  box-shadow: inset 3px 0 0 #f59e0b;
}

.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);
}

body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

body.sidebar-collapsed .main-area {
  margin-left: 0;
}

body.sidebar-collapsed .sidebar-toggle {
  display: grid;
}

body.sidebar-collapsed:not(.sidebar-open) .sidebar-toggle {
  left: 12px;
}

.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);
}

.canvas-project-titlebar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.canvas-project-titlebox {
  display: grid;
  gap: 6px;
  min-width: min(480px, 72vw);
}

.canvas-project-titlebox span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.canvas-project-titlebox input {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in oklch, var(--main-surface) 95%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 42px;
  padding: 0 14px;
}

.canvas-project-titlebox input:focus {
  border-color: color-mix(in oklch, var(--primary) 58%, var(--line));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  outline: none;
}

.canvas-project-save-state {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 38px;
}

.canvas-project-save-state.is-pending,
.canvas-project-save-state.is-saving {
  color: var(--primary);
}

.canvas-project-save-state.is-saved {
  color: #0f9f6e;
}

.canvas-project-save-state.is-error {
  color: #dc2626;
}

.canvas-fullscreen-btn {
  align-items: center;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(59, 130, 246, 0.18));
  border: 1px solid color-mix(in oklch, #14b8a6 52%, var(--line));
  border-radius: 999px;
  color: #dffcf4;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
}

.canvas-fullscreen-btn svg {
  height: 18px;
  width: 18px;
}

.canvas-fullscreen-btn.is-active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(16, 185, 129, 0.24));
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.18);
}

/* ═══════════════════════════════════════
   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);
}

.video-reference-panel {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.video-reference-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface-soft);
}

.video-reference-modes label {
  position: relative;
  min-height: 54px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.video-reference-modes input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-reference-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--primary-dark);
  box-shadow: var(--shadow-xs);
  font-size: 13px;
  line-height: 1;
}

.video-reference-modes label:hover {
  background: #fff;
  color: var(--primary-dark);
}

.video-reference-modes label:has(input:checked) {
  border-color: rgba(59, 130, 246, 0.36);
  background: #fff;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════
   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-action-menu {
  position: relative;
  margin-right: auto;
}

.record-action-trigger {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--main-surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}

.record-action-dropdown {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  min-width: 132px;
  display: none;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--main-surface);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}

.record-action-menu.is-open .record-action-dropdown {
  display: grid;
  gap: 4px;
}

.record-action-dropdown button,
.record-action-dropdown a {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}

.record-action-dropdown button:hover,
.record-action-dropdown a:hover {
  background: var(--main-surface-soft);
}

/* ── 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;
}

.image-model-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(10px, 1.2vw, 16px);
}

/* ── .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;
}

.media-card-error {
  font-size: clamp(10px, 1.2vw, 12px);
  color: var(--danger);
  font-weight: 700;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* ── .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);
}

/* ── Canvas node inline controls ── */
.canvas-stage-shell {
  height: min(82dvh, 980px);
  min-height: 720px;
  overflow: hidden;
  position: relative;
}

.canvas-stage {
  background:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    var(--main-bg);
  background-size: 28px 28px;
  cursor: grab;
  height: 100%;
  min-height: 720px;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
}

.canvas-stage:active {
  cursor: grabbing;
}

.canvas-grid,
.canvas-edges,
.canvas-node-layer,
.canvas-items,
.canvas-selection {
  height: 500%;
  inset: 0;
  min-height: 3600px;
  position: absolute;
  transform: translate(var(--canvas-x, 0), var(--canvas-y, 0)) scale(var(--canvas-scale, 1));
  transform-origin: 0 0;
  width: 500%;
}

.canvas-stage-wrap.is-immersive,
.canvas-stage-wrap:fullscreen {
  background: var(--main-bg);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  inset: 0;
  padding: 14px;
  position: fixed;
  z-index: 100000;
}

.canvas-stage-wrap.is-immersive .canvas-stage-shell,
.canvas-stage-wrap:fullscreen .canvas-stage-shell {
  height: calc(100dvh - 84px);
  min-height: 0;
}

.canvas-grid {
  pointer-events: none;
  z-index: 1;
}

.canvas-edges {
  overflow: visible;
  pointer-events: auto;
  z-index: 2;
}

.canvas-edge-path {
  pointer-events: none;
}

.canvas-edge-hit {
  cursor: pointer;
  pointer-events: stroke;
}

.canvas-items {
  pointer-events: none;
  z-index: 3;
}

.canvas-node-layer {
  pointer-events: none;
  z-index: 4;
}

.canvas-selection {
  border: 1px solid color-mix(in oklch, var(--primary) 72%, white);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.16) inset;
  height: auto;
  min-height: 0;
  pointer-events: none;
  transform: translate(var(--canvas-x, 0), var(--canvas-y, 0)) scale(var(--canvas-scale, 1));
  transform-origin: 0 0;
  width: auto;
  z-index: 5;
}

.canvas-item {
  position: absolute;
}

.canvas-item img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.canvas-node-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in oklch, var(--main-surface) 92%, transparent);
  box-shadow: var(--shadow-card);
  color: var(--text);
  cursor: grab;
  display: grid;
  gap: 8px;
  min-height: 120px;
  padding: 12px;
  position: absolute;
  pointer-events: auto;
  text-align: left;
  touch-action: none;
  user-select: none;
}

.canvas-node-card.dragging {
  cursor: grabbing;
}

.canvas-node-card.active {
  border-color: color-mix(in oklch, var(--primary) 62%, var(--line));
  box-shadow: 0 16px 34px color-mix(in oklch, var(--primary) 16%, transparent);
}

.canvas-node-head {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.canvas-node-title-input {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  min-width: 0;
  padding: 4px 6px;
}

.canvas-node-title-input:focus {
  background: var(--main-surface);
  border-color: color-mix(in oklch, var(--primary) 58%, var(--line));
  outline: none;
}

.canvas-node-delete-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--main-surface);
  color: var(--danger);
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
  padding: 4px 7px;
}

.canvas-node-delete-btn:hover {
  background: var(--danger-soft);
}

.canvas-stage.is-panning,
.canvas-stage.is-panning .canvas-node-card {
  cursor: grabbing;
}

.canvas-edge-path.is-draft {
  pointer-events: none;
}

.canvas-edge-path.is-running {
  animation: canvasEdgeFlow 0.9s linear infinite;
  stroke: color-mix(in oklch, var(--primary) 72%, #14b8a6);
  stroke-dasharray: 10 8;
  stroke-width: 4;
}

@keyframes canvasEdgeFlow {
  to { stroke-dashoffset: -36; }
}

.canvas-port {
  align-items: center;
  color: var(--text-muted);
  cursor: crosshair;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  transition: transform .14s ease, color .14s ease;
}

.canvas-port:hover,
.canvas-port:focus-within {
  color: var(--primary);
  transform: scale(1.04);
}

.canvas-port-dot {
  background: color-mix(in oklch, var(--primary) 74%, white);
  border: 2px solid color-mix(in oklch, var(--main-surface) 45%, var(--primary));
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.28);
  flex: 0 0 12px;
  height: 12px;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
  width: 12px;
}

.canvas-port:hover .canvas-port-dot,
.canvas-port:focus-within .canvas-port-dot {
  background: color-mix(in oklch, var(--primary) 88%, white);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.18);
  transform: scale(1.18);
}

.canvas-port.input {
  justify-content: flex-start;
}

.canvas-port.output {
  justify-content: flex-end;
}

.canvas-port.output .canvas-port-dot {
  order: 2;
}

.canvas-node-inline-text,
.canvas-node-provider select,
.canvas-node-provider input,
.canvas-node-provider textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--main-surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 8px 10px;
  resize: vertical;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
  user-select: text;
}

.canvas-node-inline-text {
  cursor: text;
}

.canvas-node-inline-text:hover,
.canvas-node-inline-text:focus,
.canvas-node-provider select:hover,
.canvas-node-provider select:focus,
.canvas-node-provider input:hover,
.canvas-node-provider input:focus,
.canvas-node-provider textarea:hover,
.canvas-node-provider textarea:focus {
  background: color-mix(in oklch, var(--main-surface) 92%, var(--primary-soft));
  border-color: color-mix(in oklch, var(--primary) 58%, var(--line));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  outline: none;
}

.canvas-node-inline-text,
.canvas-node-provider,
.canvas-node-upload,
.canvas-node-media-preview,
.canvas-node-result {
  cursor: auto;
  touch-action: auto;
}

.canvas-node-provider {
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 750;
  color: var(--text-muted);
}

.canvas-reference-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.canvas-mentioned-reference-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.canvas-mentioned-reference-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 1px solid color-mix(in oklch, var(--primary) 26%, var(--line));
  border-radius: 10px;
  background: color-mix(in oklch, var(--primary-soft) 48%, var(--main-surface));
}

.canvas-mentioned-reference-card img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.canvas-reference-mention {
  align-items: center;
  background: color-mix(in oklch, var(--primary-soft) 72%, var(--main-surface));
  border: 1px solid color-mix(in oklch, var(--primary) 42%, var(--line));
  border-radius: 999px;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 9px;
}

.canvas-reference-mention span {
  font-size: 12px;
  font-weight: 900;
  white-space: normal;
}

.canvas-reference-mention small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-reference-mention:hover {
  background: color-mix(in oklch, var(--primary-soft) 90%, var(--main-surface));
  border-color: color-mix(in oklch, var(--primary) 68%, var(--line));
}

.canvas-node-model-settings {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.canvas-node-model-settings summary {
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}

.canvas-node-model-settings[open] summary {
  color: var(--primary);
}

.canvas-node-run-row {
  display: flex;
}

.canvas-node-run-btn {
  border: 1px solid color-mix(in oklch, var(--primary) 58%, var(--line));
  border-radius: 8px;
  background: color-mix(in oklch, var(--primary-soft) 64%, var(--main-surface));
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  min-height: 34px;
  width: 100%;
}

.canvas-node-run-btn:hover {
  background: color-mix(in oklch, var(--primary-soft) 78%, var(--main-surface));
}

.canvas-node-run-btn.is-download {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(34, 197, 94, 0.18));
  border-color: rgba(16, 185, 129, 0.38);
  color: #d7ffe8;
  text-align: center;
}

.canvas-node-media-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.canvas-node-upload {
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  padding: 6px 9px;
  position: relative;
  transition: border-color .14s ease, background .14s ease, color .14s ease, transform .14s ease;
}

.canvas-node-upload:hover {
  background: color-mix(in oklch, var(--primary-soft) 54%, var(--main-surface));
  border-color: color-mix(in oklch, var(--primary) 58%, var(--line));
  color: var(--primary);
  transform: translateY(-1px);
}

.canvas-node-upload input {
  cursor: pointer;
  inset: 0;
  opacity: 0;
  position: absolute;
}

.canvas-node-media-preview,
.canvas-node-result {
  display: grid;
  gap: 6px;
}

.canvas-node-preview-frame {
  align-items: center;
  background: color-mix(in oklch, var(--main-surface) 84%, #000);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  min-height: 180px;
  overflow: hidden;
  padding: 8px;
}

.canvas-node-preview-frame.is-video {
  aspect-ratio: 16 / 9;
  min-height: 0;
  padding: 0;
}

.canvas-node-preview-frame.is-empty {
  background:
    linear-gradient(145deg, rgba(59, 130, 246, 0.08), rgba(15, 23, 42, 0.2)),
    color-mix(in oklch, var(--main-surface) 88%, #000);
  place-items: center;
}

.canvas-node-preview-empty {
  color: var(--text-muted);
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 12px;
  text-align: center;
}

.canvas-node-preview-empty strong {
  color: var(--text);
  font-size: 13px;
}

.canvas-node-preview-empty small {
  font-size: 11px;
  line-height: 1.5;
  max-width: 220px;
}

.canvas-node-result.is-error .canvas-node-preview-frame {
  border-color: rgba(248,113,113,.38);
  background: rgba(127,29,29,.16);
}

.canvas-node-result.is-error .canvas-node-preview-empty strong,
.canvas-node-result.is-error > span {
  color: #fecaca;
}

.canvas-node-result.is-error .canvas-node-preview-empty small {
  color: #fca5a5;
}

.canvas-node-media-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 6px;
  overflow: hidden;
  padding: 6px;
}

.canvas-node-media-thumb {
  background: color-mix(in oklch, var(--main-surface) 86%, #000);
  border-radius: 8px;
  display: grid;
  min-height: 74px;
  overflow: hidden;
  place-items: center;
}

.canvas-node-video-placeholder {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 850;
}

.canvas-node-media-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.canvas-node-media-tools span {
  color: var(--text-muted);
  flex: 1;
  font-size: 11px;
  font-weight: 850;
}

.canvas-node-media-tools button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--main-surface);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 7px;
}

.canvas-node-media-tools button:hover {
  border-color: color-mix(in oklch, var(--primary) 56%, var(--line));
  color: var(--primary);
}

.canvas-node-media-preview img,
.canvas-node-media-preview video,
.canvas-node-preview-frame img,
.canvas-node-preview-frame video,
.canvas-node-result video {
  border-radius: 10px;
  max-height: 240px;
  object-fit: cover;
  width: 100%;
}

.canvas-media-lightbox {
  align-items: center;
  background: rgba(15, 23, 42, 0.78);
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 28px;
  position: fixed;
  z-index: 100001;
}

.canvas-media-lightbox-shell {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.44);
  display: grid;
  gap: 14px;
  max-height: 88dvh;
  max-width: min(92vw, 1240px);
  overflow: hidden;
  padding: 18px;
  width: 100%;
}

.canvas-media-lightbox-toolbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.canvas-media-lightbox-toolbar strong {
  color: #f8fafc;
  font-size: 15px;
}

.canvas-media-lightbox-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.canvas-media-lightbox-body {
  max-height: calc(88dvh - 72px);
  max-width: 100%;
  overflow: auto;
}

.canvas-media-lightbox-body img,
.canvas-media-lightbox-body video {
  border-radius: 12px;
  display: block;
  max-height: calc(88dvh - 92px);
  max-width: 100%;
}

.canvas-media-lightbox-body audio {
  width: min(86vw, 720px);
}

.canvas-media-lightbox-close {
  width: auto;
}

.canvas-stage-wrap:fullscreen .canvas-context-menu,
.canvas-stage-wrap.is-immersive .canvas-context-menu {
  z-index: 100002;
}

.canvas-minimap-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.canvas-minimap-help {
  align-items: center;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 999px;
  color: #dbeafe;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.canvas-help-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.72);
  display: grid;
  inset: 0;
  padding: 24px;
  position: fixed;
  z-index: 100003;
}

.canvas-help-panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.96));
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.46);
  color: #e5eefc;
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 760px;
  padding: 22px;
  width: 100%;
}

.canvas-help-head {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.canvas-help-head span {
  color: #93c5fd;
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.canvas-help-head h2 {
  color: #f8fafc;
  font-size: 24px;
  margin: 0;
}

.canvas-help-close {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  color: #e2e8f0;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  min-height: 38px;
  padding: 0 14px;
}

.canvas-help-body {
  display: grid;
  gap: 12px;
}

.canvas-help-section {
  background: rgba(15, 23, 42, 0.36);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
}

.canvas-help-section strong {
  color: #f8fafc;
  font-size: 14px;
}

.canvas-help-section p {
  color: #cbd5e1;
  line-height: 1.7;
  margin: 0;
}

.canvas-context-menu {
  background: var(--main-surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-xl);
  display: grid;
  gap: 6px;
  max-height: min(72dvh, 520px);
  min-width: 220px;
  overflow-y: auto;
  padding: 8px;
  position: fixed;
  z-index: 10000;
}

.canvas-context-menu.hidden {
  display: none;
}

.canvas-context-menu button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  text-align: left;
}

.canvas-context-menu button:hover {
  background: var(--main-surface-soft);
}

.canvas-node-search {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.canvas-node-media-preview audio,
.canvas-node-result audio {
  width: 100%;
}

.canvas-node-result > span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.canvas-node-result-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.canvas-node-result-image {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.canvas-node-result-grid img {
  aspect-ratio: 1;
  border-radius: 10px;
  display: block;
  object-fit: cover;
  width: 100%;
}

.canvas-node-result-image.is-active img {
  outline: 2px solid color-mix(in oklch, var(--primary) 70%, #fff);
  outline-offset: -2px;
}

.canvas-node-media-preview-panel {
  margin-top: -8px;
}

/* ══════════════════════════════════════�?   END OF FIX PATCH
   ══════════════════════════════════════�?*/

/* ═══════════════════════════════════════
   TECH CINEMA THEME — 2026 redesign
   Inspired by cinematic AI tools, not a product clone.
   ═══════════════════════════════════════ */

:root {
  --sidebar-width: 280px;
  --sidebar-bg: #06080d;
  --sidebar-surface: rgba(255, 255, 255, 0.06);
  --sidebar-text: #87909e;
  --sidebar-text-hover: #f7fbff;
  --sidebar-text-active: #dbfbff;
  --sidebar-accent: #00e0ff;
  --sidebar-accent-glow: rgba(0, 224, 255, 0.13);
  --sidebar-border: rgba(255, 255, 255, 0.10);
  --main-bg: #070a11;
  --main-surface: rgba(16, 20, 31, 0.84);
  --main-surface-soft: rgba(255, 255, 255, 0.055);
  --text: #f2f7fb;
  --text-soft: #bac3cf;
  --text-muted: #7f8b9c;
  --primary: #00e0ff;
  --primary-dark: #00a6c8;
  --primary-light: #86f7ff;
  --primary-soft: rgba(0, 224, 255, 0.12);
  --primary-glow: rgba(0, 224, 255, 0.26);
  --success: #55f0b2;
  --success-soft: rgba(85, 240, 178, 0.13);
  --warning: #ffd166;
  --warning-soft: rgba(255, 209, 102, 0.14);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.14);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.20);
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.22);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.42);
  --shadow-xl: 0 34px 110px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.22);
  --shadow-elevated: 0 0 0 1px rgba(0, 224, 255, 0.22), 0 24px 74px rgba(0, 224, 255, 0.13);
  --radius-xs: 7px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

html {
  background: #070a11;
}

body {
  background: #070a11;
  color: var(--text);
  font-family: "DIN Alternate", "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: -0.01em;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 224, 255, 0.22), transparent 26%),
    radial-gradient(circle at 84% 18%, rgba(255, 189, 89, 0.13), transparent 22%),
    radial-gradient(circle at 72% 82%, rgba(65, 108, 255, 0.18), transparent 28%),
    linear-gradient(145deg, #06080d 0%, #09111b 52%, #05070c 100%);
}

body::after {
  z-index: -1;
  opacity: 0.34;
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), rgba(0,0,0,.22));
}

::selection {
  background: rgba(0, 224, 255, 0.28);
  color: #fff;
}

.app-layout {
  background: transparent;
}

.sidebar {
  background:
    radial-gradient(circle at 80% 0%, rgba(0, 224, 255, 0.15), transparent 30%),
    linear-gradient(180deg, rgba(16, 20, 31, 0.96), rgba(5, 7, 12, 0.96));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 18px 0 60px rgba(0, 0, 0, 0.34);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 180px;
  background: linear-gradient(135deg, rgba(0, 224, 255, 0.18), transparent 72%);
  pointer-events: none;
}

.sidebar-header,
.sidebar-footer {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.025);
}

.sidebar-logo,
.sidebar-user-avatar,
.chat-sidebar-avatar {
  background:
    radial-gradient(circle at 30% 25%, #ffffff 0 5%, transparent 18%),
    linear-gradient(135deg, #00e0ff, #2f6dff 55%, #ffb55c);
  color: #031019;
  box-shadow: 0 0 34px rgba(0, 224, 255, 0.28);
}

.sidebar-logo svg rect {
  fill: transparent;
}

.sidebar-logo svg path,
.sidebar-logo svg circle {
  stroke: currentColor;
  fill: currentColor;
}

.sidebar-brand-text h1,
.page-hd h1,
.main-area-header h2,
.card-v3-head h3,
.canvas-panel-head h3,
.package-head h3,
.empty-state h3 {
  letter-spacing: -0.045em;
}

.sidebar-brand-text small,
.sidebar-nav-section,
.page-hd p,
.main-area-header .eyebrow,
.card-v3-head .eyebrow,
.card-v3-head .sub,
.field-v3 > label,
.field-v3 > span,
.record-full-prompt > span {
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav-item {
  border: 1px solid transparent;
  isolation: isolate;
}

.sidebar-nav-item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  opacity: 0;
  background: linear-gradient(90deg, rgba(0,224,255,.18), rgba(255,255,255,.045));
  transition: opacity var(--duration-fast) var(--ease-out-expo);
}

.sidebar-nav-item:hover::before,
.sidebar-nav-item.active::before {
  opacity: 1;
}

.sidebar-nav-item.active {
  border-color: rgba(0, 224, 255, 0.24);
  box-shadow: inset 3px 0 0 var(--sidebar-accent), 0 0 22px rgba(0, 224, 255, 0.10);
}

.sidebar-user,
.sidebar-balance,
.sidebar-action-btn {
  border: 1px solid transparent;
}

.sidebar-user:hover,
.sidebar-action-btn:hover {
  border-color: rgba(255,255,255,.08);
}

.main-area {
  background:
    linear-gradient(135deg, rgba(255,255,255,.035), transparent 24%),
    radial-gradient(circle at 70px 70px, rgba(0, 224, 255, 0.09), transparent 28%),
    transparent;
  padding: clamp(18px, 2.5vw, 34px);
}

.page-hd {
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(120deg, rgba(255,255,255,.095), rgba(255,255,255,.035)),
    radial-gradient(circle at 92% 20%, rgba(0, 224, 255, 0.16), transparent 24%);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.page-hd h1 {
  font-size: clamp(26px, 3.3vw, 44px);
  color: #fff;
}

.page-hd p,
.main-area-header .eyebrow,
.card-v3-head .eyebrow,
.card-v3-head .sub {
  color: var(--primary-light);
}

.card-v3,
.canvas-panel,
.price-card,
.record-card,
.media-card,
.stat-card,
.admin-nav-bar,
.table-wrap,
.chat-main,
.preview-loading,
.empty-state {
  border-color: var(--line);
  background:
    linear-gradient(145deg, rgba(255,255,255,.082), rgba(255,255,255,.032)),
    rgba(9, 12, 20, 0.76);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.card-v3:hover,
.canvas-panel:hover,
.price-card:hover,
.media-card:hover {
  border-color: rgba(0, 224, 255, 0.28);
  box-shadow: var(--shadow-elevated);
}

.card-v3-head,
.canvas-panel-head,
.redeem-head,
.record-dialog-head,
.error-dialog-head {
  background: linear-gradient(90deg, rgba(255,255,255,.052), transparent);
  border-bottom-color: var(--line);
}

.btn,
.button,
.page-btn,
.sidebar-toggle,
.dialog-close,
.record-dialog-close {
  border-radius: 999px;
}

.btn.primary,
.btn-primary,
.button.primary,
.package-badge {
  background: linear-gradient(135deg, #effdff 0%, #00e0ff 32%, #2f6dff 100%);
  color: #020812;
  box-shadow: 0 0 0 1px rgba(255,255,255,.22) inset, 0 16px 34px rgba(0, 224, 255, 0.22);
}

.btn.primary:hover,
.btn-primary:hover,
.button.primary:hover {
  background: linear-gradient(135deg, #fff 0%, #73f4ff 34%, #00b8e5 100%);
  color: #020812;
  box-shadow: 0 0 0 1px rgba(255,255,255,.34) inset, 0 22px 44px rgba(0, 224, 255, 0.30);
}

.btn.secondary,
.btn-secondary,
.button.secondary,
.btn.ghost,
.btn-ghost,
.page-btn {
  border-color: var(--line);
  background: rgba(255,255,255,.045);
  color: var(--text-soft);
}

.btn.secondary:hover,
.btn-secondary:hover,
.button.secondary:hover,
.btn.ghost:hover,
.btn-ghost:hover,
.page-btn:hover {
  border-color: rgba(0, 224, 255, 0.38);
  background: rgba(0, 224, 255, 0.11);
  color: #eaffff;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input,
select,
textarea {
  border-color: var(--line-strong);
  background: rgba(2, 6, 14, 0.62);
  color: var(--text);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(0, 224, 255, 0.38);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 224, 255, 0.78);
  background: rgba(2, 6, 14, 0.78);
  box-shadow: 0 0 0 4px rgba(0, 224, 255, 0.12);
}

select {
  background-color: rgba(2, 6, 14, 0.62);
}

.badge-balance,
.package-credits,
.cost-hint,
.content-slot,
.buy-summary-row.total {
  border: 1px solid rgba(0, 224, 255, 0.22);
  background: linear-gradient(135deg, rgba(0,224,255,.16), rgba(255,255,255,.045));
  color: var(--text);
  box-shadow: 0 0 28px rgba(0, 224, 255, 0.08);
}

.badge-balance .num,
.package-credits strong,
.cost-hint strong,
.record-meta span:first-child,
.canvas-step-preview {
  color: var(--primary-light);
}

.status-badge,
.badge {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.09);
  color: var(--text-soft);
}

.status-badge.running,
.status-badge.queued,
.badge.warning {
  background: rgba(0, 224, 255, 0.12);
  border-color: rgba(0, 224, 255, 0.22);
  color: var(--primary-light);
}

.status-badge.succeeded,
.badge.success {
  background: rgba(85, 240, 178, 0.12);
  border-color: rgba(85, 240, 178, 0.24);
  color: #b9ffdf;
}

.status-badge.failed,
.badge.error {
  background: rgba(255, 107, 122, 0.14);
  border-color: rgba(255, 107, 122, 0.25);
  color: #ffc3ca;
}

.table-v3,
.admin-table {
  background: rgba(9, 12, 20, 0.78);
}

.table-v3 th,
.admin-table th {
  background: rgba(255,255,255,.055);
  color: var(--primary-light);
}

.table-v3 td,
.admin-table td {
  border-bottom-color: var(--line);
}

.preview-stage,
.record-image,
.history-empty-inline,
.edit-upload-box,
.edit-preview-item,
.record-dialog-image,
.record-detail-grid > div,
.buy-summary-row {
  background:
    linear-gradient(135deg, rgba(0,224,255,.08), rgba(255,255,255,.035)),
    rgba(2, 6, 14, 0.52);
  border-color: var(--line);
}

.redeem-dialog,
.record-dialog,
.generation-overlay {
  background: rgba(2, 6, 14, 0.76);
}

.redeem-panel,
.record-dialog-panel,
.error-dialog-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.035)),
    rgba(8, 12, 20, 0.94);
}

.chat-sidebar {
  background: linear-gradient(180deg, rgba(16, 20, 31, 0.96), rgba(5, 7, 12, 0.96));
}

.chat-conv-item.active,
.chat-conv-item:hover,
.chat-new-btn {
  background: rgba(0, 224, 255, 0.12);
}

.chat-new-btn {
  color: var(--primary-light);
}

.canvas-layout {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.canvas-stage-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 224, 255, 0.13), transparent 30%),
    rgba(5, 8, 14, 0.82);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.canvas-toolbar {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255,255,255,.075), rgba(255,255,255,.026));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.canvas-stage-shell {
  background: #05070c;
}

.canvas-stage {
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 224, 255, 0.10), transparent 34%),
    #05070c;
}

.canvas-grid {
  opacity: 0.78;
  background-image:
    linear-gradient(rgba(0, 224, 255, 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 224, 255, 0.065) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
}

.canvas-node,
.canvas-item {
  border-color: rgba(255,255,255,.14);
  background:
    linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.045)),
    rgba(11, 15, 24, 0.94);
  box-shadow: 0 18px 44px rgba(0,0,0,.36);
}

.canvas-node.selected,
.canvas-item.selected {
  border-color: rgba(0, 224, 255, 0.76);
  box-shadow: 0 0 0 1px rgba(0,224,255,.34), 0 0 42px rgba(0,224,255,.18);
}

.canvas-port i {
  background: #061018;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 224, 255, 0.13);
}

.canvas-port:hover i,
.canvas-port.active i {
  background: var(--primary-light);
  border-color: #fff;
  box-shadow: 0 0 0 6px rgba(0, 224, 255, 0.20);
}

.canvas-context-menu {
  border-color: var(--line);
  background:
    linear-gradient(145deg, rgba(255,255,255,.10), rgba(255,255,255,.035)),
    rgba(7, 10, 17, 0.98);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.canvas-context-menu button:hover {
  background: rgba(0, 224, 255, 0.13);
  color: #ecfeff;
}

@media (max-width: 1024px) {
  .canvas-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    box-shadow: 24px 0 70px rgba(0, 0, 0, 0.45);
  }

  .sidebar-toggle {
    background: rgba(10, 14, 22, 0.82);
    color: var(--text);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .main-area {
    padding-top: 64px;
  }
}

/* Designer canvas */
.page-designer-canvas .main-area {
  padding: 0;
  overflow: hidden;
  background: #05070c;
}

.designer-canvas-page {
  min-height: 100vh;
  min-height: 100dvh;
  color: #e5edf7;
  background: #05070c;
}

.designer-shell,
.designer-workbench {
  min-height: 100vh;
  min-height: 100dvh;
}

.designer-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(8, 10, 16, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.designer-project-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.designer-back {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 28px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
}

.designer-project-title span {
  color: #8b98aa;
  font-size: 13px;
  white-space: nowrap;
}

.designer-project-title input {
  width: clamp(180px, 24vw, 420px);
  min-width: 0;
  border: 0;
  outline: 0;
  color: #f8fafc;
  font-size: 17px;
  font-weight: 700;
  background: transparent;
}

.designer-workspace-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 310px;
  min-width: 310px;
  padding: 3px 4px 3px 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.designer-workspace-switcher span {
  color: #94a3b8;
  font-size: 12px;
  white-space: nowrap;
}

.designer-workspace-switcher select {
  max-width: 150px;
  min-height: 28px;
  border: 0;
  outline: 0;
  color: #f8fafc;
  background: transparent;
}

.designer-workspace-switcher button {
  min-width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  color: #dbeafe;
  background: rgba(77, 163, 255, 0.18);
  padding: 0 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.designer-workspace-switcher button[data-canvas-workspace-members] {
  min-width: 48px;
}

.designer-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}

body.page-designer-canvas .designer-canvas-page.is-topbar-collapsed .designer-top-actions {
  gap: 0;
}

body.page-designer-canvas .designer-canvas-page.is-topbar-collapsed .designer-top-actions > :not(.designer-topbar-toggle) {
  display: none;
}

.designer-top-btn,
.designer-credit-pill {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
}

.designer-icon-btn {
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.designer-icon-btn svg,
.designer-quick-search button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.designer-icon-btn:hover,
.designer-quick-search button:hover,
.designer-workspace-switcher button:hover {
  border-color: rgba(125, 211, 252, 0.34);
  color: #e0f2fe;
  background: rgba(77, 163, 255, 0.14);
}

.designer-icon-btn::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 40;
  transform: translate(-50%, -4px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(8, 12, 20, 0.96);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.designer-icon-btn:hover::after,
.designer-icon-btn:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.designer-top-btn.is-blue {
  color: #06111f;
  border-color: rgba(96, 165, 250, 0.5);
  background: #4da3ff;
}

.designer-topbar-toggle {
  width: 38px;
  min-width: 38px;
  padding: 0 !important;
}

body.page-designer-canvas .designer-canvas-page.is-topbar-collapsed .designer-topbar-toggle {
  color: #dbeafe;
  border-color: rgba(125, 211, 252, 0.34);
  background: rgba(77, 163, 255, 0.14);
}

body.page-designer-canvas .designer-canvas-page.is-topbar-collapsed .designer-topbar-toggle svg {
  transform: rotate(180deg);
}

.designer-notification-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.designer-notification-btn span {
  position: absolute;
  right: -5px;
  top: -5px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #07111f;
  background: #facc15;
  font-size: 11px;
  line-height: 1;
}

.designer-notification-btn span.is-empty {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.18);
}

.designer-save-state {
  min-width: 52px;
  color: #94a3b8;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.designer-save-state.is-saved {
  color: #86efac;
}

.designer-save-state.is-saving,
.designer-save-state.is-pending {
  color: #fde68a;
}

.designer-credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 116px;
  height: 38px;
  min-height: 38px;
  justify-content: center;
  padding: 0 12px;
  background: linear-gradient(135deg, #ffd76a, #ffb340);
  color: #1f1500;
}

.designer-credit-pill small {
  color: rgba(31, 21, 0, 0.72);
}

.designer-quick-search {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 210px;
  min-width: 148px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  padding: 0 4px 0 10px;
}

.designer-quick-search input {
  width: 100%;
  min-width: 84px;
  border: 0;
  outline: 0;
  color: #dbeafe;
  background: transparent;
}

.designer-quick-search button {
  min-width: 34px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(77, 163, 255, 0.18);
  cursor: pointer;
}

.designer-workbench {
  position: relative;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  overflow: hidden;
}

.designer-stage-wrap,
.designer-stage {
  position: absolute;
  inset: 0;
}

.designer-stage {
  overflow: hidden;
  cursor: default;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.085) 0 1px, transparent 1.35px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(0, 0, 0, 0.04)),
    #111316;
  background-size: 24px 24px, 100% 100%, auto;
  background-position: 0 0, 0 0, 0 0;
}

.designer-stage.is-panning {
  cursor: grabbing;
}

.designer-stage.is-space-panning {
  cursor: grab;
}

.designer-stage.is-space-panning.is-panning {
  cursor: grabbing;
}

.designer-empty {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 10px;
  place-items: center;
  color: rgba(226, 232, 240, 0.52);
  pointer-events: none;
}

.designer-empty.hidden {
  display: none;
}

.designer-empty span {
  width: 54px;
  height: 1px;
  display: grid;
  place-items: center;
  color: rgba(226, 232, 240, 0.5);
}

.designer-rail {
  position: absolute;
  left: 18px;
  top: 50%;
  z-index: 12;
  transform: translateY(-50%);
  display: grid;
  gap: 10px;
  width: 58px;
  padding: 12px 9px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(19, 22, 31, 0.86);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.designer-rail-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 13px;
  color: #cbd5e1;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

.designer-rail-btn:hover,
.designer-rail-btn.is-active {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

.designer-shortcut-rail-btn {
  display: grid;
  place-items: center;
}

.designer-shortcut-rail-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.designer-flyout {
  position: absolute;
  left: 88px;
  top: 50%;
  z-index: 13;
  transform: translateY(-50%) translateX(-8px);
  width: clamp(214px, 20vw, 320px);
  max-height: min(76vh, 680px);
  max-height: min(76dvh, 680px);
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 23, 31, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.designer-flyout.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.designer-flyout p,
.designer-panel-head span {
  margin: 0 0 10px;
  color: #8b98aa;
  font-size: 12px;
}

.designer-flyout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.designer-flyout-head button {
  width: 28px;
  min-height: 28px;
  justify-content: center;
  padding: 0;
}

.designer-tool-flyout {
  width: clamp(260px, 24vw, 340px);
}

.designer-assets-flyout {
  width: clamp(280px, 25vw, 360px);
}

.designer-notification-flyout {
  width: clamp(300px, 26vw, 380px);
}

.designer-inspiration-flyout {
  width: clamp(260px, 24vw, 340px);
}

.designer-flyout button,
.designer-project-new,
.designer-project-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  color: #e2e8f0;
  background: transparent;
  padding: 0 10px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.designer-tool-mini {
  display: grid !important;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 10px !important;
  min-height: 48px !important;
  align-items: center !important;
  position: relative;
  padding-right: 34px !important;
}

.designer-tool-mini::before {
  content: "◇";
  grid-row: span 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.08);
}

.designer-tool-mini span,
.designer-tool-mini small {
  display: block;
}

.designer-tool-mini small {
  color: #7f8b9e;
  font-size: 12px;
}

.designer-flyout button:hover,
.designer-project-new:hover,
.designer-project-link:hover,
.designer-project-link.is-active {
  background: rgba(255, 255, 255, 0.09);
}

.designer-project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
}

.designer-project-row.is-active {
  background: rgba(255, 255, 255, 0.06);
}

.designer-project-link {
  display: grid;
  gap: 2px;
  align-items: center;
  min-height: 52px;
}

.designer-flyout .designer-project-delete {
  width: 32px;
  min-height: 32px;
  justify-content: center;
  padding: 0;
  border-radius: 9px;
  color: #fecaca;
  font-size: 18px;
  line-height: 1;
}

.designer-flyout .designer-project-delete:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.24);
}

.designer-project-link small,
.designer-history-list small,
.designer-muted {
  color: #7f8b9e;
  font-size: 12px;
}

.designer-history-list {
  display: grid;
  gap: 8px;
}

.designer-notification-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.designer-notification-list {
  display: grid;
  gap: 8px;
  max-height: min(58vh, 460px);
  overflow: auto;
}

.designer-notification-item button {
  min-height: 76px;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
}

.designer-notification-item.is-unread button {
  background: rgba(77, 163, 255, 0.12);
}

.designer-notification-item strong,
.designer-notification-item span,
.designer-notification-item small {
  display: block;
}

.designer-notification-item span {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.45;
}

.designer-notification-item small {
  color: #7f8b9e;
  font-size: 11px;
}

.designer-history-card {
  width: 100%;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  border: 0;
  border-radius: 12px;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.designer-history-card:hover {
  background: rgba(77, 163, 255, 0.13);
}

.designer-history-card.is-empty {
  grid-template-columns: 1fr;
  opacity: 0.62;
  cursor: not-allowed;
}

.designer-history-card strong,
.designer-history-card small,
.designer-history-card em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-history-card strong {
  font-size: 13px;
}

.designer-history-card em {
  margin-top: 3px;
  color: #91c7ff;
  font-size: 11px;
  font-style: normal;
}

.designer-history-thumb {
  width: 54px;
  height: 54px;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.designer-history-thumb img,
.designer-history-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.designer-asset-list {
  display: grid;
  gap: 10px;
  max-height: min(560px, 72vh);
  overflow: auto;
  padding-right: 2px;
}

.designer-asset-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.designer-asset-thumb {
  width: 72px;
  height: 72px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  padding: 0;
  cursor: pointer;
}

.designer-asset-thumb img,
.designer-asset-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.designer-asset-card strong,
.designer-asset-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-asset-card strong {
  color: #e5edf7;
  font-size: 13px;
}

.designer-asset-card small {
  color: #7f8b9e;
  font-size: 12px;
}

.designer-asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.designer-asset-actions button {
  min-height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
}

.designer-outline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.designer-outline-filters button {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: #9fb0c8;
  background: rgba(255, 255, 255, 0.055);
  padding: 0 9px;
  font-size: 12px;
  cursor: pointer;
}

.designer-outline-filters button.is-active {
  color: #dbeafe;
  border-color: rgba(77, 163, 255, 0.4);
  background: rgba(77, 163, 255, 0.16);
}

.designer-outline-list {
  display: grid;
  gap: 8px;
  max-height: min(590px, 72vh);
  overflow: auto;
  padding-right: 2px;
}

.designer-outline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.designer-outline-main {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 0;
  color: #e5edf7;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.designer-outline-color {
  width: 8px;
  height: 34px;
  border-radius: 999px;
}

.designer-outline-main strong,
.designer-outline-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-outline-main strong {
  font-size: 13px;
}

.designer-outline-main small {
  color: #7f8b9e;
  font-size: 12px;
}

.designer-outline-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-left: 16px;
}

.designer-outline-row > div button {
  min-height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
}

.designer-manager-search {
  display: block;
  margin-bottom: 10px;
}

.designer-manager-search input {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.055);
  padding: 0 10px;
  outline: 0;
}

.designer-manager-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.designer-manager-tabs button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  color: #9fb0c8;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.designer-manager-tabs button.is-active {
  color: #dbeafe;
  border-color: rgba(77, 163, 255, 0.4);
  background: rgba(77, 163, 255, 0.16);
}

.designer-manager-list {
  display: grid;
  gap: 8px;
  max-height: min(590px, 72vh);
  overflow: auto;
}

.designer-manager-row {
  display: grid;
  gap: 7px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.designer-manager-row > button {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 0;
  color: #e5edf7;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.designer-manager-row.is-media > button {
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
}

.designer-manager-row > button span {
  grid-row: span 2;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
}

.designer-manager-row > button img,
.designer-manager-row > button video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.designer-manager-row strong,
.designer-manager-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-manager-row strong {
  font-size: 13px;
}

.designer-manager-row small {
  color: #7f8b9e;
  font-size: 12px;
}

.designer-manager-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.designer-manager-row > div button {
  min-height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
}

.designer-manager-row.is-qa {
  border: 1px solid rgba(148, 163, 184, 0.08);
}

.designer-manager-score {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(77, 163, 255, 0.24);
  border-radius: 8px;
  color: #bfdbfe;
  background: rgba(77, 163, 255, 0.1);
  padding: 3px 7px;
  font-size: 12px;
}

.designer-manager-score.is-pending {
  border-color: rgba(245, 158, 11, 0.26);
  color: #fde68a;
  background: rgba(245, 158, 11, 0.1);
}

.designer-manager-row.is-qa ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.45;
}

.designer-inspiration-list {
  display: grid;
  gap: 8px;
}

.designer-template-list {
  display: grid;
  gap: 8px;
}

.designer-template-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.designer-inspiration-card,
.designer-template-card {
  position: relative;
  display: grid !important;
  gap: 4px !important;
  min-height: 48px !important;
  align-items: center !important;
  padding: 9px 34px 9px 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.055) !important;
}

.designer-inspiration-card:hover,
.designer-template-card:hover {
  border-color: rgba(77, 163, 255, 0.38) !important;
  background: rgba(77, 163, 255, 0.13) !important;
}

.designer-template-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: none;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.designer-template-card.is-detail-open .designer-template-cover {
  display: block;
}

.designer-template-cover img,
.designer-template-cover video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.designer-template-badge {
  justify-self: start;
  border-radius: 999px;
  color: #fef3c7;
  background: rgba(245, 158, 11, 0.18);
  padding: 3px 8px;
  font-size: 11px;
  font-style: normal;
}

.designer-template-badge.is-spec {
  color: #bfdbfe;
  background: rgba(77, 163, 255, 0.16);
}

.designer-template-badge.is-group {
  color: #ddd6fe;
  background: rgba(167, 139, 250, 0.14);
}

.designer-template-badge.is-tags {
  max-width: 100%;
  overflow: hidden;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.14);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-template-group-card {
  border-color: rgba(167, 139, 250, 0.2) !important;
  background: rgba(167, 139, 250, 0.09) !important;
}

.designer-template-group-card:hover {
  border-color: rgba(167, 139, 250, 0.42) !important;
  background: rgba(167, 139, 250, 0.15) !important;
}

.designer-template-topic-card {
  border-color: rgba(77, 163, 255, 0.22) !important;
  background: rgba(77, 163, 255, 0.09) !important;
}

.designer-template-topic-card:hover {
  border-color: rgba(77, 163, 255, 0.44) !important;
  background: rgba(77, 163, 255, 0.15) !important;
}

.designer-template-note {
  display: none;
  overflow: hidden;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.designer-remix-card {
  border-color: rgba(34, 197, 94, 0.2) !important;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.11), rgba(255, 255, 255, 0.05)) !important;
}

.designer-remix-card:hover {
  border-color: rgba(34, 197, 94, 0.42) !important;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.17), rgba(255, 255, 255, 0.07)) !important;
}

.designer-saved-template-card {
  border-color: rgba(168, 85, 247, 0.24) !important;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(255, 255, 255, 0.05)) !important;
}

.designer-saved-template-card:hover {
  border-color: rgba(168, 85, 247, 0.46) !important;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(255, 255, 255, 0.07)) !important;
}

.designer-public-template-card {
  border-color: rgba(14, 165, 233, 0.24) !important;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(255, 255, 255, 0.05)) !important;
}

.designer-public-template-card:hover {
  border-color: rgba(14, 165, 233, 0.46) !important;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(255, 255, 255, 0.07)) !important;
}

.designer-inspiration-card strong,
.designer-inspiration-card small,
.designer-template-card strong,
.designer-template-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-inspiration-card strong,
.designer-template-card strong {
  color: #e8f2ff;
  font-size: 13px;
}

.designer-inspiration-card small,
.designer-template-card small {
  display: none;
  color: #7f8b9e;
  font-size: 12px;
}

.designer-tool-mini small {
  display: none;
  white-space: normal;
}

.designer-tool-mini.is-detail-open small,
.designer-inspiration-card.is-detail-open small,
.designer-template-card.is-detail-open small,
.designer-template-card.is-detail-open .designer-template-note {
  display: block;
  white-space: normal;
}

.designer-card-fold {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #aebed4;
  background: rgba(148, 163, 184, 0.12);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
}

.designer-card-fold:hover {
  color: #f8fafc;
  background: rgba(77, 163, 255, 0.2);
}

.designer-node-layer {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

.designer-node-card {
  position: absolute;
  pointer-events: auto;
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #e5edf7;
  background: linear-gradient(180deg, rgba(39, 43, 52, 0.98), rgba(28, 31, 38, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

.designer-node-card.is-active {
  border-color: rgba(57, 145, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(57, 145, 255, 0.28), 0 24px 70px rgba(0, 0, 0, 0.44);
}

.designer-node-card.is-multi-selected {
  outline: 2px solid rgba(77, 163, 255, 0.42);
  outline-offset: 3px;
}

.designer-node-card.is-group-frame {
  z-index: -1;
  align-content: start;
  border: 1px dashed rgba(77, 163, 255, 0.42);
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.08), rgba(255, 255, 255, 0.025));
  box-shadow: none;
}

.designer-node-card.is-group-frame.is-active {
  border-color: rgba(77, 163, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(77, 163, 255, 0.18);
}

.designer-node-attrs-toggle,
.designer-node-tools-toggle {
  min-height: 26px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 8px;
  color: #bae6fd;
  background: rgba(14, 116, 144, 0.12);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.designer-node-attrs-toggle.is-open,
.designer-node-tools-toggle.is-open {
  color: #06111f;
  border-color: rgba(125, 211, 252, 0.72);
  background: #7dd3fc;
}

.designer-node-attrs-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: rgba(7, 10, 16, 0.44);
  padding: 10px;
}

.designer-group-frame-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.designer-group-frame-head::before {
  content: "";
  width: 5px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--node-accent, rgba(77, 163, 255, 0.65));
}

.designer-group-frame-head strong {
  color: #e8f2ff;
  font-size: 14px;
}

.designer-group-frame-head span {
  margin-right: auto;
  color: #8fa4bd;
  font-size: 12px;
}

.designer-group-frame-head button {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  cursor: pointer;
}

.designer-node-note {
  border-left: 3px solid var(--node-accent, rgba(77, 163, 255, 0.42));
  border-radius: 8px;
  color: #aab8cc;
  background: rgba(255, 255, 255, 0.045);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.designer-node-note pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
}

.designer-collapsed-preview,
.designer-collapsed-empty {
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.designer-collapsed-preview img,
.designer-collapsed-preview video {
  width: 100%;
  max-height: 92px;
  display: block;
  object-fit: cover;
}

.designer-collapsed-empty {
  display: grid;
  place-items: center;
  min-height: 54px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-context-menu {
  position: fixed;
  z-index: 2400;
  width: 188px;
  display: none;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(14, 18, 28, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  padding: 6px;
}

.designer-selection-box {
  position: fixed;
  z-index: 2300;
  display: none;
  border: 1px solid rgba(77, 163, 255, 0.9);
  background: rgba(77, 163, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(77, 163, 255, 0.14);
  pointer-events: none;
}

.designer-selection-box.is-open {
  display: block;
}

.designer-selection-toolbar {
  position: absolute;
  left: 50%;
  top: 18px;
  z-index: 20;
  display: none;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(16, 20, 30, 0.94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.designer-selection-toolbar.is-open {
  display: flex;
}

.designer-selection-toolbar span {
  color: #94a3b8;
  font-size: 12px;
}

.designer-selection-toolbar strong {
  color: #e2e8f0;
}

.designer-selection-toolbar button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 9px;
  cursor: pointer;
}

.designer-context-menu.is-open {
  display: grid;
}

.designer-context-menu.is-connection-create hr,
.designer-context-menu.is-connection-create [data-context-selection],
.designer-context-menu.is-connection-create [data-context-color],
.designer-context-menu.is-connection-create [data-context-action="upload"],
.designer-context-menu.is-connection-create [data-context-action="auto_layout"] {
  display: none;
}

.designer-context-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #dbeafe;
  background: transparent;
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
}

.designer-context-menu button:hover {
  background: rgba(77, 163, 255, 0.14);
}

.designer-context-menu button:disabled {
  color: #64748b;
  cursor: not-allowed;
}

.designer-context-menu hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  margin: 5px 0;
}

.designer-minimap {
  position: absolute;
  right: 18px;
  bottom: 88px;
  z-index: 12;
  width: 210px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(16, 20, 30, 0.88);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  padding: 10px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.designer-minimap.is-empty {
  display: none;
}

.designer-minimap-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-minimap-nodes {
  position: relative;
  width: 178px;
  height: 118px;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1.5px),
    rgba(0, 0, 0, 0.18);
  background-size: 14px 14px, auto;
}

.designer-minimap-nodes button {
  position: absolute;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.28);
  padding: 0;
  cursor: pointer;
}

.designer-minimap-nodes button.is-active {
  border-color: rgba(77, 163, 255, 0.88);
  background: rgba(77, 163, 255, 0.45);
}

.designer-edge {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(77, 163, 255, 0.1), rgba(77, 163, 255, 0.72));
  transform-origin: 0 50%;
  pointer-events: none;
}

.designer-edge::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid rgba(77, 163, 255, 0.72);
  transform: translateY(-50%);
}

.designer-node-port {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(20, 26, 38, 0.94);
  transform: translateY(-50%);
  cursor: pointer;
}

.designer-node-port.is-left {
  left: -14px;
}

.designer-node-port.is-right {
  right: -14px;
}

.designer-node-port:hover {
  border-color: rgba(77, 163, 255, 0.75);
  background: #1f6feb;
}

.designer-node-head,
.designer-node-footer,
.designer-node-actions,
.designer-node-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.designer-node-tools,
.designer-image-toolbar {
  flex-wrap: wrap;
}

.designer-node-tools.is-floating {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -2px -2px 0;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 12px;
  background: rgba(10, 16, 27, 0.92);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(77, 163, 255, 0.08);
  padding: 8px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.designer-node-tools.is-floating button {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
}

.designer-model-hint {
  margin-top: -4px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #9fb0c8;
  background: rgba(77, 163, 255, 0.08);
  font-size: 12px;
  line-height: 1.45;
}

.designer-input-shelf {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(77, 163, 255, 0.08);
  padding: 6px 8px;
}

.designer-input-shelf.has-items {
  overflow-x: auto;
}

.designer-input-thumb {
  position: relative;
  width: 32px;
  height: 24px;
  flex: 0 0 auto;
  overflow: visible;
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 6px;
  background: rgba(8, 16, 28, 0.72);
  padding: 0;
  cursor: pointer;
}

.designer-input-thumb img,
.designer-input-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.designer-input-index,
.designer-input-remove {
  position: absolute;
  width: 13px;
  height: 13px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #06111f;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.designer-input-index {
  left: -5px;
  top: -5px;
  background: #7dd3fc;
}

.designer-input-remove {
  right: -5px;
  top: -5px;
  color: #fff;
  background: #ef4444;
}

.designer-node-head {
  justify-content: space-between;
}

.designer-node-head::before {
  content: "";
  width: 5px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--node-accent, transparent);
}

.designer-node-head strong {
  font-size: 14px;
}

.designer-node-collapse {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0 !important;
}

.designer-node-head button,
.designer-node-actions button,
.designer-node-tools button,
.designer-image-toolbar button,
.designer-node-footer button,
.designer-zoom-bar button,
.designer-prompt-actions button,
.designer-prompt-head button {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  padding: 8px 10px;
  cursor: pointer;
}

.designer-image-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.designer-image-toolbar button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.designer-node-status {
  margin-left: auto;
  border-radius: 999px;
  padding: 3px 8px;
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.16);
  font-size: 12px;
}

.designer-node-status.error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
}

.designer-node-status.failed {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
}

.designer-node-status.done,
.designer-node-status.succeeded {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

.designer-node-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.designer-node-progress span {
  width: 42%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #4da3ff, #9dd2ff);
  animation: designer-progress 1.1s ease-in-out infinite;
}

@keyframes designer-progress {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

.designer-node-card textarea {
  min-height: 92px;
  resize: vertical;
  border: 0;
  outline: 0;
  border-radius: 10px;
  color: #dbe4f0;
  background: rgba(0, 0, 0, 0.08);
  padding: 12px;
  line-height: 1.6;
}

.designer-textarea-wrap {
  position: relative;
}

.designer-textarea-wrap textarea {
  padding-top: 40px;
}

.designer-text-expand-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-height: 24px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(8, 12, 20, 0.76);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.designer-text-expand-btn:hover {
  color: #06111f;
  background: #7dd3fc;
}

.designer-polish-wrap {
  position: relative;
}

.designer-polish-wrap textarea {
  padding-right: 92px;
  padding-bottom: 44px;
  padding-top: 44px;
}

.designer-polish-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  min-height: 28px;
  display: inline-grid;
  gap: 1px;
  align-content: center;
  justify-items: center;
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 9px;
  background: rgba(8, 16, 28, 0.92);
  color: #dbeafe;
  padding: 4px 8px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.designer-polish-btn span {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.designer-polish-btn small {
  color: #93c5fd;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

.designer-polish-btn:hover {
  color: #06111f;
  background: #7dd3fc;
}

.designer-node-prompt-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 6px;
  margin-top: -2px;
  padding: 7px;
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: 10px;
  background: rgba(7, 12, 20, 0.34);
}

.designer-node-prompt-presets button {
  min-height: 28px;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  color: #cfe8ff;
  background: rgba(255, 255, 255, 0.055);
  padding: 5px 6px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.designer-node-prompt-presets button:hover {
  border-color: rgba(125, 211, 252, 0.66);
  color: #06111f;
  background: #7dd3fc;
}

.designer-node-footer {
  margin-top: auto;
}

.designer-node-cost {
  flex: 0 0 auto;
  border-radius: 999px;
  color: #a9b7cc;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.designer-node-footer select {
  min-width: 0;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  color: #dbe4f0;
  background: rgba(10, 13, 20, 0.8);
  padding: 0 10px;
}

.designer-run-btn {
  margin-left: auto;
  min-width: 76px;
  color: #07111f !important;
  background: #4da3ff !important;
}

.designer-node-error,
.designer-inspector-error {
  border: 1px solid rgba(248, 113, 113, 0.22);
  border-radius: 10px;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.18);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.designer-inspector-error {
  display: grid;
  gap: 4px;
}

.designer-inspector-error strong {
  color: #fee2e2;
}

.designer-node-media,
.designer-node-result,
.designer-image-drop {
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}

.designer-media-thumb {
  position: relative;
  min-height: 132px;
  max-height: 180px;
  display: grid;
  place-items: center;
}

.designer-result-current {
  position: relative;
  min-height: 172px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-radius: 12px;
  color: #dbeafe;
  background:
    linear-gradient(135deg, rgba(8, 13, 24, 0.94), rgba(17, 24, 39, 0.94)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(125, 211, 252, 0.08) 18px 20px);
}

.designer-result-current::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.06), rgba(125, 211, 252, 0.8), rgba(56, 189, 248, 0.06), transparent);
  background-size: 220% 100%;
  animation: designer-result-current 1.2s linear infinite;
}

.designer-result-current span {
  position: relative;
  width: min(72%, 220px);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.designer-result-current span::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #e0f2fe, #22d3ee);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.72);
  animation: designer-progress 0.95s ease-in-out infinite;
}

.designer-result-current strong,
.designer-result-current small {
  position: relative;
}

.designer-result-current strong {
  font-size: 14px;
}

.designer-result-current small {
  color: #93a9c3;
  font-size: 12px;
}

.designer-node-generation-hint {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px dashed rgba(125, 211, 252, 0.22);
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(8, 15, 26, 0.42);
}

.designer-node-generation-hint span {
  font-size: 12px;
  font-weight: 800;
}

.designer-node-generation-hint small {
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.5;
}

@keyframes designer-result-current {
  to { background-position: -220% 0; }
}

.designer-media-thumb img,
.designer-media-thumb video {
  width: 100%;
  height: 100%;
  max-height: 180px;
  display: block;
  object-fit: cover;
}

.designer-media-audio-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 120px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.74);
  font-weight: 800;
}

.designer-media-view-btn {
  min-height: 28px;
  border: 1px solid rgba(226, 232, 240, 0.26);
  border-radius: 8px;
  color: #e0f2fe;
  background: rgba(8, 12, 20, 0.78);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.designer-media-thumb-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 16px);
}

.designer-media-view-btn:hover {
  color: #06111f;
  background: #7dd3fc;
}

.designer-media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.78);
  padding: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.designer-media-lightbox-panel {
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(9, 12, 18, 0.97);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.54);
}

.designer-media-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 12px 14px;
}

.designer-media-lightbox-head strong {
  min-width: 0;
  overflow: hidden;
  color: #e5edf7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-media-lightbox-head button {
  min-height: 32px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 12px;
}

.designer-media-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.designer-media-lightbox-body {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #020617;
}

.designer-media-lightbox-viewport {
  position: relative;
  width: 100%;
  height: calc(100vh - 148px);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;
}

.designer-media-lightbox-viewport.is-draggable {
  cursor: grab;
}

.designer-media-lightbox-viewport.is-dragging {
  cursor: grabbing;
}

.designer-media-lightbox-viewport img {
  max-width: min(100%, 1600px);
  max-height: calc(100vh - 156px);
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.designer-media-lightbox-body img,
.designer-media-lightbox-body video {
  max-width: 100%;
  max-height: calc(100vh - 128px);
  display: block;
  object-fit: contain;
}

.designer-media-lightbox-body audio {
  width: min(720px, calc(100vw - 96px));
}

.designer-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.designer-compare-grid figure,
.designer-compare-strip figure {
  position: relative;
  margin: 0;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.designer-compare-grid img {
  width: 100%;
  max-height: 168px;
  display: block;
  object-fit: contain;
}

.designer-compare-grid figcaption,
.designer-compare-empty {
  color: #94a3b8;
  font-size: 12px;
}

.designer-compare-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.designer-compare-strip figure {
  flex: 0 0 84px;
  padding: 6px;
}

.designer-compare-strip img {
  width: 100%;
  height: 52px;
  display: block;
  border-radius: 8px;
  object-fit: cover;
}

.designer-compare-strip figcaption {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 11px;
  white-space: nowrap;
}

.designer-compare-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 113, 113, 0.36);
  border-radius: 999px;
  color: #fee2e2;
  background: rgba(127, 29, 29, 0.78);
  padding: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.designer-compare-remove:hover {
  color: #fff;
  background: #ef4444;
}

.designer-compare-switch {
  display: flex;
  gap: 6px;
  align-items: center;
}

.designer-compare-switch button {
  flex: 1 1 0;
  min-height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.64);
  color: #cbd5e1;
  font-size: 12px;
}

.designer-compare-switch button.is-active {
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(14, 165, 233, 0.18);
  color: #e0f2fe;
}

.designer-compare-slider-wrap {
  position: relative;
  display: grid;
  gap: 8px;
}

.designer-compare-grid-wrap {
  position: relative;
}

.designer-compare-fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(224, 242, 254, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.designer-compare-fullscreen-btn:hover {
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(14, 165, 233, 0.24);
}

.designer-compare-slider {
  --compare-pos: 50%;
  position: relative;
  min-height: 180px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  cursor: ew-resize;
  touch-action: none;
}

.designer-compare-slider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--compare-pos);
  z-index: 2;
  width: 2px;
  background: rgba(224, 242, 254, 0.92);
  transform: translateX(-1px);
  pointer-events: none;
}

.designer-compare-slider img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.designer-compare-slider .is-before {
  position: absolute;
  inset: 0;
}

.designer-compare-slider .is-after {
  position: absolute;
  inset: 0;
  width: 100%;
  overflow: hidden;
  clip-path: inset(0 calc(100% - var(--compare-pos)) 0 0);
}

.designer-compare-slider .is-after img {
  width: 100%;
  max-width: none;
}

.designer-compare-handle {
  position: absolute;
  top: 50%;
  left: var(--compare-pos);
  width: 22px;
  height: 22px;
  border: 2px solid rgba(224, 242, 254, 0.95);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, -50%);
  pointer-events: none;
  cursor: ew-resize;
}

.designer-compare-label {
  position: absolute;
  top: 8px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  font-size: 11px;
  line-height: 1.4;
}

.designer-compare-label.is-left {
  left: 8px;
}

.designer-compare-label.is-right {
  right: 8px;
}

.designer-compare-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
}

.designer-compare-slider-wrap.is-compact .designer-compare-slider {
  min-height: 128px;
}

body.designer-compare-fullscreen-open {
  overflow: hidden;
}

.designer-compare-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(3, 7, 18, 0.96);
  color: #e2e8f0;
}

.designer-compare-fullscreen-head,
.designer-compare-fullscreen-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.76);
}

.designer-compare-fullscreen-foot {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  border-bottom: 0;
}

.designer-compare-fullscreen-head span {
  display: block;
  margin-bottom: 3px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-compare-fullscreen-head strong {
  font-size: 15px;
}

.designer-compare-fullscreen-head button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(224, 242, 254, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  cursor: pointer;
}

.designer-compare-fullscreen-body {
  min-width: 0;
  min-height: 0;
  display: grid;
  padding: 18px;
}

.designer-compare-slider.is-fullscreen {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0;
  background: #020617;
}

.designer-compare-slider.is-fullscreen .designer-compare-handle {
  width: 34px;
  height: 34px;
}

.designer-compare-fullscreen-foot input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
}

.designer-compare-empty {
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

.designer-node-media:not(.designer-media-thumb) img,
.designer-node-result:not(.designer-media-thumb) img,
.designer-node-result:not(.designer-media-thumb) video {
  width: 100%;
  max-height: 220px;
  display: block;
  object-fit: contain;
}

.designer-version-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0;
}

.designer-version-strip button,
.designer-inspector-versions figure > button {
  position: relative;
  width: 54px;
  height: 42px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0;
  cursor: pointer;
}

.designer-version-strip button.is-active,
.designer-inspector-versions figure > button.is-active {
  border-color: rgba(77, 163, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(77, 163, 255, 0.25);
}

.designer-version-strip button.is-deliverable,
.designer-inspector-versions figure > button.is-deliverable {
  border-color: rgba(34, 197, 94, 0.78);
}

.designer-version-strip button em,
.designer-inspector-versions figure > button em {
  position: absolute;
  right: 3px;
  bottom: 3px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.92);
  padding: 1px 4px;
  color: #052e16;
  font-size: 10px;
  font-style: normal;
  line-height: 1.2;
}

.designer-version-strip img,
.designer-version-strip video,
.designer-inspector-versions img,
.designer-inspector-versions video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.designer-mention-menu {
  position: fixed;
  z-index: 2400;
  width: 320px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: rgba(10, 16, 28, 0.98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  padding: 8px;
  backdrop-filter: blur(16px);
}

.designer-mention-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 10px;
}

.designer-mention-menu button:hover {
  background: rgba(77, 163, 255, 0.14);
}

.designer-mention-menu img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  flex: 0 0 auto;
}

.designer-mention-menu span {
  display: block;
  min-width: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #e5eefc;
}

.designer-image-drop {
  min-height: 170px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: #94a3b8;
}

.designer-zoom-bar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 14;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #cbd5e1;
  background: rgba(24, 27, 36, 0.86);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.designer-side-panel {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 15;
  width: min(380px, 34vw);
  height: 100%;
  padding: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 15, 23, 0.96);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.designer-inspector-panel {
  position: absolute;
  z-index: 16;
  top: 16px;
  left: 16px;
  width: clamp(340px, 34vw, 460px);
  max-height: calc(100% - 32px);
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(12, 16, 24, 0.96);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.designer-side-panel.is-open {
  transform: translateX(0);
}

.designer-inspector-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.designer-inspector-panel::before {
  content: "";
  position: absolute;
  top: 32px;
  width: 12px;
  height: 12px;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(12, 16, 24, 0.96);
  transform: rotate(45deg);
}

.designer-inspector-panel[data-anchor-side="right"]::before {
  left: -7px;
}

.designer-inspector-panel[data-anchor-side="left"]::before {
  right: -7px;
  transform: rotate(225deg);
}

.designer-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.designer-panel-head strong {
  display: block;
  color: #f8fafc;
}

.designer-tool-list {
  display: grid;
  gap: 12px;
}

.designer-task-activity {
  display: grid;
  gap: 10px;
}

.designer-activity-summary,
.designer-activity-row {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.designer-activity-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
}

.designer-activity-summary strong,
.designer-activity-summary small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-activity-summary strong {
  color: #eef6ff;
}

.designer-activity-summary small {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-activity-summary span {
  flex: 0 0 auto;
  border-radius: 999px;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.16);
  padding: 4px 8px;
  font-size: 12px;
}

.designer-activity-summary span.succeeded {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

.designer-activity-summary span.failed {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
}

.designer-activity-diagnostic {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(77, 163, 255, 0.18);
  border-radius: 12px;
  background: rgba(77, 163, 255, 0.08);
  padding: 11px 12px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.5;
}

.designer-activity-diagnostic.is-error {
  border-color: rgba(239, 68, 68, 0.22);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.08);
}

.designer-activity-diagnostic strong {
  color: #e0f2fe;
  font-size: 13px;
}

.designer-activity-diagnostic small {
  color: #94a3b8;
  font-size: 12px;
}

.designer-activity-diagnostic code {
  overflow: auto;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  padding: 7px 8px;
  color: #dbeafe;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

.designer-activity-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px;
}

.designer-activity-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: #64748b;
}

.designer-activity-dot.running,
.designer-activity-dot.queued {
  background: #4da3ff;
  box-shadow: 0 0 0 4px rgba(77, 163, 255, 0.12);
}

.designer-activity-dot.done,
.designer-activity-dot.succeeded {
  background: #22c55e;
}

.designer-activity-dot.error,
.designer-activity-dot.failed {
  background: #ef4444;
}

.designer-activity-row strong,
.designer-activity-row small,
.designer-activity-row em {
  display: block;
  min-width: 0;
}

.designer-activity-row strong {
  color: #edf6ff;
  font-size: 13px;
}

.designer-activity-row small {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-activity-row em {
  margin-top: 6px;
  color: #fecaca;
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.designer-activity-row button {
  min-height: 30px;
  border: 1px solid rgba(77, 163, 255, 0.32);
  border-radius: 9px;
  color: #dbeafe;
  background: rgba(77, 163, 255, 0.14);
  padding: 5px 9px;
  cursor: pointer;
}

.designer-panel-section-title {
  display: block;
  margin: 4px 0 8px;
  color: #7f8b9e;
  font-size: 12px;
}

.designer-tool-panel-desc {
  margin: -8px 0 16px;
  color: #94a3b8;
  line-height: 1.6;
}

.designer-tool-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.designer-tool-search input {
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #e5edf8;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 12px;
  outline: none;
}

.designer-tool-search input:focus {
  border-color: rgba(77, 163, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.13);
}

.designer-tool-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.designer-tool-filters button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: #b9c6d8;
  background: rgba(255, 255, 255, 0.055);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.designer-tool-filters button.is-active {
  border-color: rgba(77, 163, 255, 0.48);
  color: #dbeafe;
  background: rgba(77, 163, 255, 0.16);
}

.designer-tool-runner {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.designer-workflow-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.designer-workflow-card {
  display: grid;
  gap: 5px;
  min-height: 68px;
  border: 1px solid rgba(77, 163, 255, 0.18);
  border-radius: 12px;
  color: #e8f2ff;
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.13), rgba(255, 255, 255, 0.045));
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.designer-workflow-card:hover {
  border-color: rgba(77, 163, 255, 0.45);
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.2), rgba(255, 255, 255, 0.065));
}

.designer-workflow-card small {
  color: #91a2b8;
}

.designer-runner-drop {
  min-height: 118px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.designer-runner-drop small {
  color: #7f8b9e;
}

.designer-tool-runner button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.designer-tool-runner .designer-runner-primary {
  color: #06111f;
  background: #4da3ff;
}

.designer-agent-selection {
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(77, 163, 255, 0.18);
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(77, 163, 255, 0.08);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.designer-agent-field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.designer-agent-field span {
  color: #94a3b8;
  font-size: 12px;
}

.designer-agent-field textarea,
.designer-agent-field select {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #e5edf8;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  outline: none;
}

.designer-agent-field textarea:focus,
.designer-agent-field select:focus {
  border-color: rgba(77, 163, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.13);
}

.designer-agent-actions {
  display: grid;
  gap: 10px;
}

.designer-agent-actions button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.designer-agent-actions .is-primary {
  color: #06111f;
  background: #4da3ff;
}

.designer-agent-panel {
  width: min(420px, 36vw);
  padding: 16px;
  border-left-color: rgba(148, 163, 184, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(15, 20, 30, 0.92);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.designer-agent-panel .designer-panel-head {
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 10px 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
}

.designer-agent-panel .designer-panel-head span {
  color: #94a3b8;
  font-size: 11px;
}

.designer-agent-panel .designer-panel-head strong {
  margin-top: 2px;
  color: #eef6ff;
  font-size: 15px;
}

.designer-agent-panel .designer-panel-head button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.72);
  cursor: pointer;
}

.designer-agent-panel .designer-tool-panel-desc {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  color: #9fb0c7;
  background: rgba(255, 255, 255, 0.032);
  font-size: 12px;
  line-height: 1.55;
}

.designer-agent-panel .designer-agent-selection {
  min-height: 38px;
  margin-bottom: 12px;
  border-color: rgba(77, 163, 255, 0.22);
  border-radius: 12px;
  color: #dbeafe;
  background: rgba(77, 163, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.designer-agent-panel .designer-agent-field {
  gap: 6px;
  margin-bottom: 10px;
}

.designer-agent-panel .designer-agent-field span {
  color: #9aa8bc;
  font-size: 11px;
  line-height: 1.2;
}

.designer-agent-panel .designer-agent-field textarea,
.designer-agent-panel .designer-agent-field select {
  min-height: 38px;
  border-color: rgba(148, 163, 184, 0.16);
  border-radius: 11px;
  color: #e5edf7;
  background: rgba(8, 13, 22, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.designer-agent-panel .designer-agent-field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.designer-agent-panel .designer-agent-field textarea:focus,
.designer-agent-panel .designer-agent-field select:focus {
  border-color: rgba(77, 163, 255, 0.54);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.designer-agent-panel .designer-agent-actions {
  position: sticky;
  bottom: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px -2px 0;
  padding: 10px 2px 0;
  background: linear-gradient(180deg, transparent, rgba(15, 20, 30, 0.98) 28%);
}

.designer-agent-panel .designer-agent-actions button {
  min-height: 34px;
  border-color: rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.065);
  font-size: 12px;
}

.designer-agent-panel .designer-agent-actions .is-primary {
  grid-column: 1 / -1;
  min-height: 40px;
  color: #06111f;
  background: linear-gradient(135deg, #7dd3fc, #4da3ff);
  box-shadow: 0 12px 28px rgba(77, 163, 255, 0.25);
}

.designer-tool-card {
  display: grid;
  gap: 6px;
  min-height: 84px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.06);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.designer-tool-card[hidden] {
  display: none;
}

.designer-tool-card:hover {
  background: rgba(77, 163, 255, 0.13);
  border-color: rgba(77, 163, 255, 0.35);
}

.designer-tool-card.is-favorite {
  border-color: rgba(245, 158, 11, 0.38);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(255, 255, 255, 0.055));
}

.designer-tool-card span {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow-wrap: anywhere;
}

.designer-tool-card em {
  flex: 0 0 auto;
  min-width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  font-style: normal;
  line-height: 1;
}

.designer-tool-card small {
  color: #94a3b8;
}

.designer-inspector-body {
  display: grid;
  gap: 12px;
}

.designer-inspector-field {
  display: grid;
  gap: 6px;
}

.designer-inspector-field span {
  color: #94a3b8;
  font-size: 12px;
}

.designer-inspector-field input,
.designer-inspector-field select,
.designer-inspector-field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #dbe4f0;
  background: rgba(0, 0, 0, 0.18);
  padding: 10px;
}

.designer-inspector-field textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.55;
}

.designer-inspector-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.designer-inspector-meta span {
  border-radius: 999px;
  color: #a9b7cc;
  background: rgba(255, 255, 255, 0.06);
  padding: 5px 8px;
  font-size: 12px;
}

.designer-inspector-preview,
.designer-inspector-compare {
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}

.designer-inspector-preview img,
.designer-inspector-preview video {
  width: 100%;
  max-height: 240px;
  display: block;
  object-fit: contain;
}

.designer-inspector-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.designer-inspector-compare img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.designer-inspector-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.designer-inspector-actions button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.designer-inspector-actions button.is-primary {
  color: #06111f;
  background: #4da3ff;
}

.designer-inspector-versions {
  display: grid;
  gap: 8px;
}

.designer-inspector-versions > span {
  color: #94a3b8;
  font-size: 12px;
}

.designer-inspector-versions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.designer-inspector-versions figure {
  display: grid;
  gap: 5px;
  width: 118px;
  margin: 0;
}

.designer-inspector-versions figcaption {
  overflow: hidden;
  color: #cbd5e1;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-inspector-versions figure > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.designer-inspector-versions figure > div button {
  min-height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 5px;
  font-size: 11px;
  cursor: pointer;
}

.designer-version-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid rgba(77, 163, 255, 0.22);
  border-radius: 8px;
  background: rgba(77, 163, 255, 0.08);
  padding: 4px 6px;
  font-size: 11px;
}

.designer-version-score strong {
  color: #bfdbfe;
  font-size: 13px;
}

.designer-version-score span {
  overflow: hidden;
  color: #cbd5e1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-inspector-versions figure ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 15px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.35;
}

.designer-prompt-modal,
.designer-preset-modal,
.designer-preset-save-modal,
.designer-grid-modal,
.designer-edit-modal,
.designer-spec-modal,
.designer-text-preview-modal,
.designer-template-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.designer-prompt-modal.hidden,
.designer-preset-modal.hidden,
.designer-preset-save-modal.hidden,
.designer-grid-modal.hidden,
.designer-edit-modal.hidden,
.designer-spec-modal.hidden,
.designer-text-preview-modal.hidden,
.designer-template-preview-modal.hidden {
  display: none;
}

.designer-prompt-panel,
.designer-preset-panel,
.designer-preset-save-panel,
.designer-grid-panel,
.designer-edit-panel,
.designer-spec-panel,
.designer-text-preview-panel,
.designer-template-preview-panel {
  width: min(1040px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  overflow: auto;
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #e5edf7;
  background: #11141d;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.designer-grid-panel {
  width: min(560px, calc(100vw - 40px));
}

.designer-preset-panel {
  width: min(720px, calc(100vw - 36px));
}

.designer-preset-body {
  display: grid;
  gap: 10px;
}

.designer-preset-section {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.designer-preset-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.designer-preset-section summary::-webkit-details-marker {
  display: none;
}

.designer-preset-section summary span {
  margin: 0;
  color: #cfe8ff;
  font-size: 14px;
  font-weight: 700;
}

.designer-preset-section summary em {
  color: #94a3b8;
  font-size: 12px;
  font-style: normal;
}

.designer-preset-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.designer-preset-item {
  min-height: 58px;
  display: grid;
  gap: 5px;
  align-content: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  color: #e5edf7;
  text-align: left;
  background: rgba(15, 23, 42, 0.35);
  cursor: pointer;
}

.designer-preset-item:hover {
  border-color: rgba(125, 211, 252, 0.62);
  background: rgba(125, 211, 252, 0.12);
}

.designer-preset-item strong,
.designer-preset-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.designer-preset-item strong {
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
}

.designer-preset-item span {
  color: #9fb0c7;
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.designer-preset-empty {
  padding: 24px;
  border: 1px dashed rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  color: #94a3b8;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
}

.designer-preset-save-form {
  display: grid;
  gap: 12px;
}

.designer-preset-save-form label {
  display: grid;
  gap: 6px;
  color: #9fb0c7;
  font-size: 12px;
}

.designer-preset-save-form input[type="text"],
.designer-preset-save-form select {
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 0 12px;
  color: #e5edf7;
  background: rgba(255, 255, 255, 0.06);
}

.designer-preset-save-check {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px !important;
}

.designer-preset-save-form small {
  color: #94a3b8;
  line-height: 1.45;
}

.designer-node-preset-badge,
.designer-preset-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 10px;
  color: #cfe8ff;
  background: rgba(125, 211, 252, 0.08);
}

.designer-node-preset-badge span,
.designer-preset-chip span {
  flex: 0 0 auto;
  color: #93c5fd;
  font-size: 11px;
}

.designer-node-preset-badge strong,
.designer-preset-chip strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-node-preset-badge button,
.designer-preset-chip button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(147, 197, 253, 0.24);
  border-radius: 999px;
  color: #bfdbfe;
  line-height: 1;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.designer-node-preset-badge button:hover,
.designer-preset-chip button:hover {
  border-color: rgba(248, 113, 113, 0.56);
  color: #fff;
  background: rgba(248, 113, 113, 0.2);
}

.designer-edit-panel {
  width: min(1180px, calc(100vw - 36px));
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.designer-template-preview-panel {
  width: min(960px, calc(100vw - 36px));
}

.designer-text-preview-panel {
  width: min(980px, calc(100vw - 36px));
  grid-template-rows: auto minmax(0, 1fr);
}

.designer-text-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.designer-text-preview-head strong {
  min-width: 0;
  overflow: hidden;
  color: #e5edf7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-text-preview-actions {
  display: flex;
  gap: 8px;
}

.designer-text-preview-body {
  min-height: 0;
}

.designer-text-preview-body textarea {
  width: 100%;
  min-height: 360px;
  height: min(68vh, 760px);
  resize: vertical;
}

.designer-template-preview-body {
  display: grid;
  gap: 14px;
}

.designer-template-preview-hero {
  display: grid;
  grid-template-columns: minmax(220px, 38%) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.designer-template-topic-hero {
  grid-template-columns: minmax(240px, 42%) minmax(0, 1fr);
}

.designer-template-preview-cover {
  min-height: 190px;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.designer-template-preview-cover img,
.designer-template-preview-cover video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.designer-template-preview-stats,
.designer-template-preview-list,
.designer-template-preview-spec {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.designer-template-preview-stats {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.designer-template-preview-stats span {
  display: grid;
  gap: 2px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-template-preview-stats strong {
  color: #e5edf7;
  font-size: 18px;
}

.designer-template-preview-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.designer-template-preview-list li,
.designer-template-preview-spec p {
  margin: 0;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.55;
}

.designer-topic-deliverables ul {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.designer-topic-deliverables li {
  padding: 9px 10px;
  border-radius: 10px;
  color: #dbeafe;
  background: rgba(77, 163, 255, 0.1);
}

.designer-spec-panel {
  width: min(860px, calc(100vw - 36px));
}

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

.designer-spec-grid label {
  display: grid;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
}

.designer-spec-grid label.is-wide {
  grid-column: 1 / -1;
}

.designer-spec-grid textarea {
  width: 100%;
  resize: vertical;
  min-height: 108px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.82);
  color: #e5edf7;
  padding: 11px 12px;
}

@media (max-width: 760px) {
  .designer-spec-grid {
    grid-template-columns: 1fr;
  }
}

.designer-prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.designer-prompt-head span {
  color: #94a3b8;
  font-size: 12px;
}

.designer-prompt-head h2 {
  margin: 4px 0 0;
}

.designer-prompt-head .designer-modal-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0 !important;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
}

.designer-prompt-head .designer-modal-close:hover {
  border-color: rgba(248, 113, 113, 0.48);
  color: #fff;
  background: rgba(248, 113, 113, 0.18);
}

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

.designer-prompt-grid button {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #dbe4f0;
  background: rgba(255, 255, 255, 0.06);
}

.designer-prompt-grid button.is-active {
  border-color: rgba(77, 163, 255, 0.46);
  background: rgba(77, 163, 255, 0.18);
}

.designer-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
  align-items: stretch;
  min-height: 0;
  height: min(680px, calc(100vh - 190px));
}

.designer-edit-preview {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    #0c1018;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.designer-edit-preview canvas {
  width: 100%;
  max-height: 560px;
  align-self: center;
  justify-self: center;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  touch-action: none;
  cursor: crosshair;
}

.designer-edit-preview p {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.designer-edit-controls {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.designer-edit-controls::-webkit-scrollbar {
  width: 8px;
}

.designer-edit-controls::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.32);
}

.designer-edit-controls::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.28);
}

.designer-edit-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.designer-edit-tabs button {
  min-height: 42px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.designer-edit-tabs button.is-active {
  color: #eaf4ff;
  border-color: rgba(77, 163, 255, 0.5);
  background: rgba(77, 163, 255, 0.18);
}

.designer-edit-section {
  display: none;
  gap: 12px;
}

.designer-edit-section.is-active {
  display: grid;
}

.designer-edit-section label,
.designer-edit-sliders label,
.designer-edit-crop label {
  display: grid;
  gap: 6px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-edit-range-value {
  justify-self: end;
  min-width: 42px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #dbeafe;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.designer-edit-section select,
.designer-edit-section textarea,
.designer-edit-section input[type="number"],
.designer-edit-section input[type="file"] {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #dbe4f0;
  background: rgba(0, 0, 0, 0.18);
  padding: 10px;
}

.designer-edit-section input[type="range"] {
  width: 100%;
  accent-color: #4da3ff;
}

.designer-mask-shape-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.designer-mask-shape-grid button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.designer-mask-shape-grid button.is-active {
  color: #eaf4ff;
  border-color: rgba(77, 163, 255, 0.54);
  background: rgba(77, 163, 255, 0.18);
}

.designer-prompt-actions button.is-active {
  color: #eaf4ff;
  border-color: rgba(77, 163, 255, 0.54);
  background: rgba(77, 163, 255, 0.18);
}

.designer-edit-section textarea {
  resize: vertical;
  line-height: 1.5;
}

.designer-edit-sliders {
  display: grid;
  gap: 10px;
}

.designer-tone-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
}

.designer-tone-presets button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.designer-tone-presets button.is-active,
.designer-tone-presets button:hover {
  color: #eaf4ff;
  border-color: rgba(77, 163, 255, 0.54);
  background: rgba(77, 163, 255, 0.18);
}

.designer-edit-sliders input[type="range"] {
  width: 100%;
}

.designer-edit-crop {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

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

.designer-grid-options button {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #dbe4f0;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.designer-grid-options button.is-active {
  border-color: rgba(77, 163, 255, 0.46);
  background: rgba(77, 163, 255, 0.18);
}

.designer-grid-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  min-height: 30px;
  line-height: 1.45;
}

.designer-grid-check + .designer-grid-check {
  margin-top: -4px;
}

.designer-prompt-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.designer-prompt-options label {
  display: grid;
  gap: 6px;
  color: #94a3b8;
  font-size: 12px;
}

.designer-prompt-options select,
.designer-prompt-actions select,
#designerPromptPreview,
#imagePromptPreview {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #dbe4f0;
  background: rgba(0, 0, 0, 0.18);
  padding: 10px;
}

#designerPromptPreview,
#imagePromptPreview {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}

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

.designer-prompt-toggles button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.designer-prompt-toggles button.is-active {
  color: #eaf4ff;
  border-color: rgba(77, 163, 255, 0.5);
  background: rgba(77, 163, 255, 0.18);
}

.designer-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.designer-prompt-actions .is-primary {
  color: #07111f;
  background: #4da3ff;
}

@media (max-width: 960px) {
  .designer-side-panel {
    width: min(440px, calc(100vw - 64px));
  }

  .designer-inspector-panel {
    width: min(440px, calc(100vw - 64px));
  }

  .designer-node-card {
    width: min(600px, 78vw) !important;
  }

  .designer-prompt-grid,
  .designer-prompt-options,
  .designer-prompt-toggles,
  .designer-edit-layout,
  .designer-edit-tabs {
    grid-template-columns: 1fr;
  }

  .designer-edit-layout {
    height: min(720px, calc(100vh - 170px));
    overflow: hidden;
  }

  .designer-edit-preview {
    min-height: 320px;
  }

  .designer-edit-controls {
    max-height: 360px;
  }

  .designer-agent-panel {
    width: min(420px, calc(100vw - 64px));
  }

  .designer-edit-crop {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Designer canvas refinements */
.designer-canvas-page {
  background: #080b11;
}

.designer-topbar {
  height: 60px;
  border-bottom-color: rgba(148, 163, 184, 0.14);
  background: rgba(9, 12, 18, 0.9);
}

.designer-stage {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.08) 0 1px, transparent 1.35px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.016), rgba(0, 0, 0, 0.045)),
    #111316;
  background-size: 24px 24px, 100% 100%, auto;
  background-position: 0 0, 0 0, 0 0;
}

.designer-edge-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  overflow: visible;
}

.designer-node-layer {
  z-index: 2;
  pointer-events: none;
}

.designer-edge-hit,
.designer-edge-path,
.designer-edge-current {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.designer-edge-hit {
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}

.designer-edge-path {
  stroke: rgba(88, 112, 142, 0.42);
  stroke-width: 2.4;
}

.designer-edge-current {
  stroke: url(#designerEdgeGradient);
  stroke-width: 2.8;
  stroke-dasharray: 14 18;
  opacity: 0.26;
}

.designer-edge-current.is-running,
.designer-edge-path.is-running {
  stroke-width: 3.2;
}

.designer-edge-current.is-running {
  opacity: 1;
  filter: drop-shadow(0 0 7px rgba(77, 193, 255, 0.46));
  animation: designer-electric-flow 1.15s linear infinite;
}

.designer-edge-path.is-running {
  stroke: rgba(56, 189, 248, 0.42);
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.28));
}

.designer-edge-current.is-related {
  opacity: 1;
  stroke: #5b7cff;
  stroke-dasharray: 10 12;
  filter: drop-shadow(0 0 8px rgba(91, 124, 255, 0.62));
  animation: designer-related-flow 0.92s linear infinite;
}

.designer-edge-path.is-related {
  stroke: rgba(91, 124, 255, 0.58);
  filter: drop-shadow(0 0 5px rgba(91, 124, 255, 0.34));
}

.designer-edge-current.is-selected {
  opacity: 1;
  stroke: #f8fafc;
  stroke-dasharray: 8 10;
  filter: drop-shadow(0 0 9px rgba(248, 250, 252, 0.72));
}

.designer-edge-path.is-selected {
  stroke: rgba(248, 250, 252, 0.72);
  stroke-width: 4;
}

.designer-edge-current.is-draft {
  stroke-dasharray: 8 12;
  opacity: 0.86;
}

.designer-edge-current.is-snapped {
  stroke: #7dd3fc;
}

.designer-edge-delete {
  pointer-events: all;
  cursor: pointer;
}

.designer-edge-delete circle {
  fill: #ef4444;
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 6px 12px rgba(239, 68, 68, 0.42));
}

.designer-edge-delete path {
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.designer-shortcuts-fab {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 12;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  color: #dbeafe;
  background: rgba(12, 16, 24, 0.82);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.designer-shortcuts-fab:hover,
.designer-shortcuts-fab.is-active {
  color: #f8fafc;
  border-color: rgba(125, 211, 252, 0.48);
  background: rgba(37, 99, 235, 0.32);
}

.designer-shortcuts-fab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes designer-electric-flow {
  to { stroke-dashoffset: -64; }
}

@keyframes designer-related-flow {
  to { stroke-dashoffset: -44; }
}

.designer-node-card {
  border-color: rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(38, 44, 55, 0.96), rgba(23, 28, 38, 0.96));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

.designer-node-card.is-active {
  border-color: rgba(88, 166, 255, 0.86);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.28), 0 20px 52px rgba(0, 0, 0, 0.4);
}

.designer-node-head strong {
  font-size: 15px;
}

.designer-node-card textarea,
.designer-inspector-field input,
.designer-inspector-field select,
.designer-inspector-field textarea,
.designer-node-footer select {
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(7, 10, 16, 0.48);
}

.designer-node-port {
  width: 24px;
  height: 24px;
  border-color: rgba(125, 211, 252, 0.35);
  color: transparent;
  background: rgba(9, 16, 26, 0.95);
  box-shadow: 0 0 0 4px rgba(77, 163, 255, 0.08);
}

.designer-node-port::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #7dd3fc;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.8);
}

.designer-node-port.is-left {
  left: -12px;
}

.designer-node-port.is-right {
  right: -12px;
}

.designer-node-port:hover,
.designer-node-port.is-dragging,
.designer-node-port.is-snap-target {
  border-color: rgba(125, 211, 252, 0.95);
  background: rgba(14, 116, 144, 0.92);
  transform: translateY(-50%) scale(1.12);
}

.designer-node-port.is-snap-target {
  box-shadow: 0 0 0 8px rgba(34, 211, 238, 0.16), 0 0 24px rgba(34, 211, 238, 0.56);
}

.designer-rail,
.designer-flyout,
.designer-minimap,
.designer-selection-toolbar,
.designer-zoom-bar,
.designer-side-panel,
.designer-inspector-panel {
  border-color: rgba(148, 163, 184, 0.15);
  background: rgba(15, 20, 30, 0.88);
}

.designer-zoom-bar {
  gap: 6px;
  height: 46px;
  border-radius: 14px;
}

.designer-fullscreen-btn {
  width: 36px;
  min-width: 36px;
  padding: 0 !important;
  display: grid;
  place-items: center;
}

.designer-shortcut-panel {
  position: fixed;
  left: calc(max(18px, env(safe-area-inset-left)) + 130px);
  top: 50%;
  z-index: 2600;
  transform: translateY(-50%);
  width: min(520px, calc(100vw - 170px));
  max-height: min(620px, calc(100vh - 120px));
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(12, 16, 24, 0.97);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  padding: 16px;
  color: #dbeafe;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.designer-shortcut-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.designer-shortcut-head span,
.designer-shortcut-panel small {
  display: block;
  color: #94a3b8;
  font-size: 12px;
}

.designer-shortcut-head strong {
  display: block;
  margin-top: 3px;
  color: #f8fafc;
  font-size: 16px;
}

.designer-shortcut-head button {
  min-height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 10px;
}

.designer-shortcut-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.designer-shortcut-list p {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  padding: 7px 9px;
}

.designer-shortcut-list kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 7px;
  color: #bae6fd;
  background: rgba(14, 116, 144, 0.18);
  padding: 0 7px;
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.designer-shortcut-list input {
  width: 100%;
  min-height: 28px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 7px;
  color: #bae6fd;
  background: rgba(14, 116, 144, 0.18);
  padding: 0 8px;
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.designer-shortcut-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 10px;
}

.designer-shortcut-actions button {
  min-height: 32px;
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(14, 116, 144, 0.16);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.designer-shortcut-list span {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.35;
}

.designer-fullscreen-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.designer-fullscreen-btn.is-active {
  color: #06111f !important;
  border-color: rgba(125, 211, 252, 0.72) !important;
  background: #7dd3fc !important;
}

.designer-canvas-page:fullscreen,
.designer-canvas-page.is-canvas-fullscreen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #080b11;
}

.designer-canvas-page:fullscreen .designer-topbar,
.designer-canvas-page.is-canvas-fullscreen .designer-topbar {
  position: relative;
}

.designer-canvas-page:fullscreen .designer-shell,
.designer-canvas-page.is-canvas-fullscreen .designer-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.designer-canvas-page:fullscreen .designer-workbench,
.designer-canvas-page.is-canvas-fullscreen .designer-workbench {
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
}

.designer-canvas-page:fullscreen .designer-stage-wrap,
.designer-canvas-page.is-canvas-fullscreen .designer-stage-wrap {
  background: #080b11;
}

.designer-canvas-page:fullscreen .designer-stage,
.designer-canvas-page.is-canvas-fullscreen .designer-stage {
  inset: 0;
}

.designer-canvas-page:fullscreen .designer-minimap,
.designer-canvas-page.is-canvas-fullscreen .designer-minimap {
  right: 22px;
  bottom: 88px;
}

/* Wide workspace mode */
body.page-canvas .main-area {
  padding: 12px 14px;
}

body.page-canvas .canvas-page {
  gap: 10px;
}

body.page-canvas .canvas-layout {
  gap: 10px;
  min-height: calc(100vh - 132px);
}

body.page-canvas .page-hd {
  margin-bottom: 8px;
}

body.page-canvas .canvas-stage-wrap {
  border-width: 1px;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

body.page-canvas .canvas-toolbar {
  padding: 9px 10px;
}

body.page-canvas .canvas-stage-shell {
  min-height: calc(100vh - 190px);
}

body.page-canvas.sidebar-collapsed .canvas-layout {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

body.page-designer-canvas .main-area {
  margin-left: var(--sidebar-width);
}

body.page-designer-canvas.sidebar-collapsed .main-area {
  margin-left: 0;
}

body.page-designer-canvas .designer-topbar {
  height: 54px;
  padding: 0 12px;
}

body.page-designer-canvas .designer-workbench {
  height: calc(100vh - 54px);
  height: calc(100dvh - 54px);
}

body.page-designer-canvas .designer-stage-wrap {
  border: 0;
  box-shadow: none;
  background: transparent;
  outline: 0;
}

body.page-designer-canvas .designer-stage {
  inset: 0;
}

@media (max-width: 1024px) {
  .sidebar-collapse-btn {
    display: none;
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  body.page-canvas .main-area {
    padding-top: 64px;
  }

  body.page-canvas.sidebar-collapsed .canvas-layout {
    grid-template-columns: 1fr;
  }

  body.page-designer-canvas .main-area {
    margin-left: 0;
  }
}

.designer-canvas-page:fullscreen .designer-inspector-panel,
.designer-canvas-page:fullscreen .designer-template-preview-modal,
.designer-canvas-page:fullscreen .designer-prompt-modal,
.designer-canvas-page:fullscreen .designer-edit-modal,
.designer-canvas-page:fullscreen .designer-grid-modal,
.designer-canvas-page.is-canvas-fullscreen .designer-inspector-panel,
.designer-canvas-page.is-canvas-fullscreen .designer-template-preview-modal,
.designer-canvas-page.is-canvas-fullscreen .designer-prompt-modal,
.designer-canvas-page.is-canvas-fullscreen .designer-edit-modal,
.designer-canvas-page.is-canvas-fullscreen .designer-grid-modal {
  z-index: 2700;
}

@media (max-width: 1280px) {
  .designer-topbar {
    gap: 8px;
    padding-inline: 12px;
  }

  .designer-project-title {
    gap: 8px;
  }

  .designer-project-title input {
    width: clamp(150px, 20vw, 280px);
    font-size: 15px;
  }

  .designer-top-actions {
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .designer-top-actions::-webkit-scrollbar {
    display: none;
  }

  .designer-credit-pill {
    min-width: 104px;
  }
}

@media (max-width: 760px) {
  .designer-topbar {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    align-content: center;
    padding-block: 8px;
  }

  .designer-project-title,
  .designer-top-actions {
    flex: 1 1 100%;
  }

  .designer-workbench {
    height: calc(100vh - 110px);
    height: calc(100dvh - 110px);
  }

  .designer-rail {
    left: 10px;
    width: 48px;
    padding: 9px 6px;
    border-radius: 18px;
  }

  .designer-rail-btn {
    width: 36px;
    height: 36px;
  }

  .designer-flyout {
    left: 64px;
    width: min(300px, calc(100vw - 78px));
    max-height: min(70vh, 560px);
    max-height: min(70dvh, 560px);
  }

  .designer-shortcut-panel {
    left: 64px;
    width: min(360px, calc(100vw - 78px));
    max-height: min(70vh, 560px);
    max-height: min(70dvh, 560px);
  }
}

.designer-run-btn,
.designer-tool-runner .designer-runner-primary,
.designer-inspector-actions button.is-primary,
.designer-prompt-actions .is-primary {
  background: linear-gradient(135deg, #69b7ff, #7dd3fc) !important;
}

/* Creation history workspace */
body.page-creation .main-area {
  padding: 0;
  background: #f6f7f9;
}

.creation-workspace {
  min-height: calc(100vh - 1px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  color: var(--text);
}

.creation-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 12px;
  border-right: 1px solid #e9edf2;
  background: rgba(255,255,255,.82);
  overflow-y: auto;
}

.creation-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 18px;
}

.creation-sidebar-head strong {
  font-size: 18px;
}

.creation-sidebar-head a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
}

.creation-history-group > span {
  display: block;
  padding: 10px 8px 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.creation-history-item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.creation-history-item:hover,
.creation-history-item.active {
  background: #eef0f2;
}

.creation-history-thumb {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7ebf0;
  color: #667085;
  font-weight: 800;
}

.creation-history-thumb img,
.creation-history-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creation-history-item span:last-child {
  min-width: 0;
}

.creation-history-item strong,
.creation-history-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creation-history-item strong {
  font-size: 14px;
}

.creation-history-item small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.creation-empty {
  padding: 20px 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.creation-main {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.creation-topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 4vw, 56px);
}

.creation-topbar h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

.creation-topbar p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.creation-thread {
  min-height: 0;
  overflow-y: auto;
  padding: 18px clamp(18px, 4vw, 56px) 26px;
}

.creation-message {
  display: flex;
  margin: 0 auto 18px;
  width: min(100%, 1180px);
}

.creation-message > div {
  max-width: min(760px, 82%);
  padding: 14px 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  line-height: 1.7;
}

.creation-message.is-user {
  justify-content: flex-end;
}

.creation-message.is-user > div {
  background: #111827;
  color: #fff;
}

.creation-message.is-ai {
  justify-content: flex-start;
}

.creation-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.creation-params {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.creation-result-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 4px;
  min-width: min(740px, 74vw);
  overflow: hidden;
  border-radius: 6px;
  background: #eef1f5;
  cursor: zoom-in;
}

.creation-result-media:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.creation-result-media img,
.creation-result-media video {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #eef1f5;
}

.creation-result-media audio {
  width: 100%;
  margin: 18px;
}

.creation-result-media > span {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-weight: 700;
}

.creation-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.creation-message.is-pending > div {
  color: var(--text-muted);
}

.creation-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.creation-typing::after {
  content: "";
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #98a2b3 20%, transparent 20% 40%, #98a2b3 40% 60%, transparent 60% 80%, #98a2b3 80%);
  animation: creationTyping 1.2s linear infinite;
}

@keyframes creationTyping {
  from { opacity: .35; transform: translateX(-2px); }
  50% { opacity: 1; transform: translateX(2px); }
  to { opacity: .35; transform: translateX(-2px); }
}

.creation-welcome {
  width: min(100%, 680px);
  margin: 14vh auto 0;
  text-align: center;
  color: var(--text-muted);
}

.creation-welcome h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 28px;
  letter-spacing: 0;
}

.creation-composer {
  width: min(100% - 36px, 920px);
  margin: 0 auto 22px;
  padding: 14px;
  border: 1px solid #e5e8ee;
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 44px rgba(16,24,40,.08);
}

.creation-composer .home-create-toolbar {
  align-items: center;
}

.creation-composer .home-mode-tabs {
  margin-left: auto;
}

.creation-composer .home-mode-tabs button {
  padding: 7px 10px;
  border-radius: 8px;
}

body.page-creation .main-area {
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 132, 31, 0.24), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(255, 190, 97, 0.18), transparent 26%),
    linear-gradient(135deg, #120f0a 0%, #1b130b 46%, #0f0d0a 100%);
}

body.page-creation .creation-workspace {
  --room-orange: #ff7a18;
  --room-orange-2: #ffb340;
  --room-ink: #fff7ed;
  --room-muted: rgba(255, 247, 237, 0.66);
  --room-line: rgba(255, 179, 64, 0.18);
  color: var(--room-ink);
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 42px 42px;
}

body.page-creation .creation-sidebar {
  border-right: 1px solid var(--room-line);
  background: rgba(20, 15, 10, 0.78);
  backdrop-filter: blur(18px);
}

body.page-creation .creation-sidebar-head {
  color: #fffaf0;
}

body.page-creation .creation-sidebar-head a {
  border-color: rgba(255, 179, 64, 0.28);
  background: linear-gradient(135deg, rgba(255,122,24,.22), rgba(255,255,255,.06));
  color: #fff3df;
}

body.page-creation .creation-history-group > span,
body.page-creation .creation-history-item small,
body.page-creation .creation-topbar p,
body.page-creation .creation-params {
  color: var(--room-muted);
}

body.page-creation .creation-history-item {
  color: #fff7ed;
  border: 1px solid transparent;
}

body.page-creation .creation-history-item:hover,
body.page-creation .creation-history-item.active {
  border-color: rgba(255, 179, 64, 0.28);
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.18), rgba(255, 255, 255, 0.055));
}

body.page-creation .creation-history-thumb {
  background: linear-gradient(135deg, rgba(255,122,24,.28), rgba(255,179,64,.12));
  color: #ffd7a3;
}

body.page-creation .creation-main {
  background:
    linear-gradient(180deg, rgba(255, 247, 237, 0.03), rgba(255, 247, 237, 0.01));
}

body.page-creation .creation-topbar {
  border-bottom: 1px solid rgba(255, 179, 64, 0.12);
  background: linear-gradient(180deg, rgba(18, 15, 10, 0.82), rgba(18, 15, 10, 0.32));
  backdrop-filter: blur(14px);
}

.creation-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.page-creation .creation-topbar h1 {
  color: #fffaf0;
}

body.page-creation .creation-thread {
  padding-bottom: 34px;
}

body.page-creation .creation-message > div {
  border: 1px solid rgba(255, 179, 64, 0.13);
  background: rgba(28, 22, 17, 0.78);
  color: #fff7ed;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

body.page-creation .creation-message.is-user > div {
  border-color: rgba(255, 122, 24, 0.42);
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.98), rgba(255, 163, 26, 0.9));
  color: #fff;
  box-shadow: 0 18px 42px rgba(255, 122, 24, 0.18);
}

.creation-ai-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #fff0d8;
}

.creation-ai-name span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--room-orange, #ff7a18), var(--room-orange-2, #ffb340));
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.creation-ai-name strong {
  font-size: 13px;
}

.creation-markdown {
  color: rgba(255, 247, 237, 0.9);
}

.creation-request-card {
  padding: 14px;
  border: 1px solid rgba(255, 179, 64, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.11), rgba(255, 255, 255, 0.035));
}

body.page-creation .creation-result-head {
  color: #fff8ed;
}

body.page-creation .creation-result-media {
  border: 1px solid rgba(255, 179, 64, 0.14);
  background: rgba(8, 7, 6, 0.45);
}

body.page-creation .creation-result-media img,
body.page-creation .creation-result-media video {
  background: rgba(8, 7, 6, 0.45);
}

body.page-creation .creation-result-media > span {
  color: rgba(255, 247, 237, 0.72);
}

body.page-creation .creation-welcome {
  padding: 42px 34px;
  border: 1px solid rgba(255, 179, 64, 0.18);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
}

body.page-creation .creation-welcome span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 122, 24, 0.18);
  color: #ffd7a3;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

body.page-creation .creation-welcome h2 {
  color: #fffaf0;
}

body.page-creation .creation-welcome p {
  color: var(--room-muted);
}

body.page-creation .creation-composer {
  position: sticky;
  bottom: 18px;
  border-color: rgba(255, 179, 64, 0.22);
  background: rgba(26, 20, 15, 0.9);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

body.page-creation .creation-composer label,
body.page-creation .creation-composer .cost-hint,
body.page-creation .creation-composer .hint {
  color: rgba(255, 247, 237, 0.72);
}

body.page-creation .creation-composer .home-prompt-shell textarea {
  border-color: rgba(255, 179, 64, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fffaf0;
}

body.page-creation .creation-composer .home-prompt-shell textarea::placeholder {
  color: rgba(255, 247, 237, 0.48);
}

body.page-creation .creation-composer .home-mode-tabs button,
body.page-creation .creation-composer .btn-secondary,
body.page-creation .creation-composer .home-file-tool {
  border-color: rgba(255, 179, 64, 0.18);
  background: rgba(255, 255, 255, 0.055);
  color: #fff0d8;
}

body.page-creation .creation-composer .home-mode-tabs button.active,
body.page-creation .creation-composer #homeGenerateButton {
  border-color: transparent;
  background: linear-gradient(135deg, #ff7a18, #ffb340);
  color: #fff;
  box-shadow: 0 14px 32px rgba(255, 122, 24, 0.28);
}

/* Compact room scale */
body.page-creation .creation-workspace {
  grid-template-columns: 236px minmax(0, 1fr);
}

body.page-creation .creation-sidebar {
  padding: 14px 8px;
}

body.page-creation .creation-sidebar-head {
  padding: 0 4px 12px;
}

body.page-creation .creation-sidebar-head strong {
  font-size: 15px;
}

body.page-creation .creation-sidebar-head a {
  width: 30px;
  height: 30px;
  font-size: 20px;
}

body.page-creation .creation-history-group > span {
  padding: 7px 6px 6px;
  font-size: 11px;
}

body.page-creation .creation-history-item {
  gap: 8px;
  min-height: 42px;
  padding: 6px;
  border-radius: 7px;
}

body.page-creation .creation-history-thumb {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 7px;
  font-size: 12px;
}

body.page-creation .creation-history-item strong {
  font-size: 12px;
}

body.page-creation .creation-history-item small {
  margin-top: 1px;
  font-size: 10px;
}

body.page-creation .creation-topbar {
  min-height: 54px;
  padding: 10px clamp(16px, 3vw, 34px);
}

body.page-creation .creation-topbar h1 {
  font-size: clamp(20px, 2.2vw, 28px);
}

body.page-creation .creation-topbar p {
  margin-top: 2px;
  font-size: 11px;
}

body.page-creation .creation-top-actions {
  gap: 7px;
}

body.page-creation .creation-top-actions .btn {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

body.page-creation .creation-thread {
  padding: 12px clamp(16px, 4vw, 40px) 16px;
  padding-bottom: 86px;
}

body.page-creation .creation-message {
  width: min(100%, 760px);
  margin-bottom: 10px;
}

body.page-creation .creation-message > div {
  max-width: min(500px, 72%);
  padding: 9px 11px;
  border-radius: 7px;
  line-height: 1.52;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

body.page-creation .creation-message.is-user > div {
  max-width: min(320px, 48%);
  box-shadow: 0 10px 24px rgba(255, 122, 24, 0.16);
}

body.page-creation .creation-ai-name {
  gap: 7px;
  margin-bottom: 7px;
}

body.page-creation .creation-ai-name span {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 10px;
}

body.page-creation .creation-ai-name strong,
body.page-creation .creation-result-head strong {
  font-size: 12px;
}

body.page-creation .creation-request-card {
  padding: 9px;
}

body.page-creation .creation-result-head {
  gap: 8px;
  margin-bottom: 5px;
}

body.page-creation .creation-params {
  margin-bottom: 8px;
  font-size: 11px;
}

body.page-creation .creation-result-media {
  min-width: min(340px, 46vw);
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  border-radius: 6px;
}

body.page-creation .creation-result-media img,
body.page-creation .creation-result-media video {
  max-height: 190px;
}

body.page-creation .creation-result-media audio {
  margin: 10px;
}

body.page-creation .creation-result-media > span {
  min-height: 94px;
  font-size: 12px;
}

body.page-creation .creation-welcome {
  width: min(100%, 440px);
  margin-top: 10vh;
  padding: 24px 22px;
  border-radius: 12px;
}

body.page-creation .creation-welcome h2 {
  font-size: 21px;
}

body.page-creation .creation-welcome p {
  font-size: 13px;
}

body.page-creation .creation-composer {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 12px;
  z-index: 320;
  width: min(66vw, 760px);
  max-width: calc(100vw - 280px);
  min-height: 0;
  margin: 0;
  padding: 7px 8px;
  border-radius: 11px;
  transform: translateX(-50%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

body.page-creation .creation-composer .field-v3 {
  gap: 3px;
  margin: 0;
}

body.page-creation .creation-composer label {
  font-size: 8px;
  line-height: 1.2;
}

body.page-creation .creation-composer .home-prompt-shell textarea {
  min-height: 32px;
  max-height: 58px;
  padding: 6px 32px 6px 9px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.35;
}

body.page-creation .creation-composer .home-prompt-expand {
  width: 20px;
  height: 20px;
  right: 6px;
  top: 6px;
  border-radius: 6px;
  font-size: 10px;
}

body.page-creation .creation-composer .home-create-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  align-items: center;
  margin-top: 5px;
}

body.page-creation .creation-composer .home-file-tool {
  order: 1;
}

body.page-creation .creation-composer #homePromptPresetBtn,
body.page-creation .creation-composer #homePolishBtn {
  order: 2;
}

body.page-creation .creation-composer .home-file-tool,
body.page-creation .creation-composer #homePromptPresetBtn,
body.page-creation .creation-composer #homePolishBtn {
  margin-right: 0;
}

body.page-creation .creation-composer .home-mode-tabs {
  order: 3;
  display: flex;
  gap: 5px;
  margin-left: auto;
}

body.page-creation .creation-composer .home-create-actions {
  order: 4;
  margin-left: 0;
}

body.page-creation .creation-composer #homeInlineStatus {
  display: none;
}

body.page-creation .creation-composer .home-mode-tabs button,
body.page-creation .creation-composer .btn,
body.page-creation .creation-composer .home-file-tool {
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 9px;
  line-height: 1.2;
}

body.page-creation .creation-composer .cost-hint {
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 9px;
  line-height: 1.2;
}

body.page-creation .creation-composer #homeGenerateButton {
  min-height: 24px;
  min-width: 48px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 9px;
}

body.page-creation .creation-composer .home-file-tool span {
  width: 17px;
  height: 17px;
  font-size: 11px;
}

body.page-creation .creation-composer .home-file-tool strong,
body.page-creation .creation-composer .home-create-toolbar strong {
  font-size: 9px;
}

body.page-creation .creation-composer .home-create-actions {
  gap: 6px;
  flex: 0 0 auto;
}

@media (max-width: 1100px) {
  body.page-creation .creation-composer .home-create-toolbar {
    flex-wrap: wrap;
    align-items: center;
  }

  body.page-creation .creation-composer .home-create-actions {
    margin-left: auto;
  }
}

body.page-creation .creation-transition-overlay {
  background: rgba(18, 15, 10, 0.72);
}

body.page-creation .creation-transition-overlay span {
  border-color: rgba(255, 179, 64, 0.24);
  background: rgba(26, 20, 15, 0.96);
  color: #fff7ed;
}

/* Creation room: align shell and cards with the balance shop surface system. */
body.page-creation .main-area {
  background:
    linear-gradient(180deg, rgba(7,14,28,.08), rgba(255,255,255,.72) 78%, rgba(255,255,255,.36)),
    var(--home-bg-image, linear-gradient(145deg, #eef4fb, #f7fbff)) center var(--home-ve-bg-y, 2%) / cover fixed no-repeat !important;
  padding: clamp(18px, 2.6vw, 34px) clamp(16px, 2.8vw, 38px) !important;
}

body.page-creation .creation-workspace {
  width: min(100%, 1180px);
  max-width: 1180px;
  height: calc(100vh - clamp(36px, 5vw, 68px));
  min-height: 640px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 24px;
  color: var(--text);
  background: rgba(255, 255, 255, .70);
  box-shadow: 0 28px 86px rgba(15, 23, 42, .18);
  backdrop-filter: blur(var(--home-ve-blur, 18px)) saturate(1.08);
  -webkit-backdrop-filter: blur(var(--home-ve-blur, 18px)) saturate(1.08);
}

body.page-creation .creation-sidebar {
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, .46);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
}

body.page-creation .creation-sidebar-head,
body.page-creation .creation-topbar h1,
body.page-creation .creation-history-item,
body.page-creation .creation-message > div {
  color: var(--text);
}

body.page-creation .creation-sidebar-head a,
body.page-creation .creation-top-actions .btn,
body.page-creation .creation-history-item,
body.page-creation .creation-message > div,
body.page-creation .creation-composer {
  border-color: rgba(255, 255, 255, .46);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 14px 38px rgba(15, 23, 42, .08);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
}

body.page-creation .creation-history-group > span,
body.page-creation .creation-history-item small,
body.page-creation .creation-topbar p,
body.page-creation .creation-params,
body.page-creation .creation-composer label,
body.page-creation .creation-composer .cost-hint,
body.page-creation .creation-composer .hint {
  color: var(--text-muted);
}

body.page-creation .creation-history-item:hover,
body.page-creation .creation-history-item.active {
  border-color: rgba(139, 92, 246, .15);
  background: linear-gradient(135deg, rgba(139,92,246,.08), rgba(59,130,246,.06));
}

body.page-creation .creation-history-thumb,
body.page-creation .creation-ai-name span {
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: #fff;
}

body.page-creation .creation-main {
  position: relative;
  background: transparent;
}

body.page-creation .creation-topbar {
  border-bottom: 1px solid rgba(255, 255, 255, .46);
  background: rgba(255, 255, 255, .42);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
}

body.page-creation .creation-message.is-user > div {
  border-color: rgba(255, 122, 24, .18);
  background: linear-gradient(135deg, #ff7a18, #ffb340);
  color: #fff;
  box-shadow: 0 14px 38px rgba(255, 122, 24, .18);
}

body.page-creation .creation-ai-name {
  color: var(--text);
}

body.page-creation .creation-markdown {
  color: var(--text);
}

body.page-creation .creation-request-card {
  border-color: rgba(139, 92, 246, .15);
  background: linear-gradient(135deg, rgba(139,92,246,.08), rgba(59,130,246,.06));
}

body.page-creation .creation-result-head {
  color: var(--text);
}

body.page-creation .creation-result-media {
  border-color: rgba(15, 23, 42, .08);
  background: rgba(248, 250, 252, .72);
}

body.page-creation .creation-result-media img,
body.page-creation .creation-result-media video {
  background: rgba(248, 250, 252, .72);
}

body.page-creation .creation-composer {
  border-color: rgba(255, 255, 255, .46);
}

body.page-creation .creation-composer .home-prompt-shell textarea {
  border-color: rgba(15, 23, 42, .08);
  background: rgba(255, 255, 255, .72);
  color: var(--text);
}

body.page-creation .creation-composer .home-prompt-shell textarea::placeholder {
  color: var(--text-muted);
}

body.page-creation .creation-composer .home-mode-tabs button,
body.page-creation .creation-composer .btn-secondary,
body.page-creation .creation-composer .home-file-tool,
body.page-creation .creation-composer .cost-hint {
  border-color: rgba(15, 23, 42, .08);
  background: rgba(255, 255, 255, .78);
  color: var(--text);
}

body.page-creation .creation-composer .home-mode-tabs button.active,
body.page-creation .creation-composer #homeGenerateButton {
  background: linear-gradient(135deg, #ff7a18, #ffb340);
  color: #fff;
}

body.page-creation .creation-topbar {
  min-height: 36px;
  margin: 10px 16px 0 10px;
  padding: 6px clamp(14px, 2vw, 24px);
  border: 1px solid rgba(255, 255, 255, .56);
  border-radius: 22px 14px 14px 22px;
}

body.page-creation .creation-topbar h1 {
  font-size: clamp(13px, 1.25vw, 15px);
  line-height: 1.15;
  font-weight: 800;
}

body.page-creation .creation-topbar p {
  margin-top: 1px;
  font-size: 9px;
  line-height: 1.2;
}

body.page-creation .creation-top-actions {
  gap: 6px;
}

body.page-creation .creation-top-actions .btn {
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 9px;
  font-size: 11px;
}

.creation-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  background: rgba(246,247,249,.72);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

.creation-transition-overlay span {
  padding: 12px 18px;
  border: 1px solid #e5e8ee;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 18px 44px rgba(16,24,40,.12);
}

body.is-creation-transitioning .creation-transition-overlay {
  opacity: 1;
}

@media (max-width: 860px) {
  .creation-workspace {
    grid-template-columns: 1fr;
  }

  .creation-sidebar {
    position: relative;
    height: auto;
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid #e9edf2;
  }

  .creation-main {
    min-height: calc(100vh - 210px);
  }

  .creation-topbar {
    padding: 16px;
  }

  .creation-thread {
    padding: 12px 14px 20px;
  }

  .creation-message > div {
    max-width: 92%;
  }

  .creation-result-media {
    min-width: 0;
  }

  .creation-composer {
    width: calc(100% - 20px);
    margin-bottom: 10px;
    border-radius: 14px;
  }

  body.page-creation .creation-thread {
    padding-bottom: 118px;
  }

  body.page-creation .creation-composer {
    left: 50%;
    right: auto;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    margin: 0;
    transform: translateX(-50%);
  }

  body.page-creation .creation-composer .home-mode-tabs {
    margin-left: 0;
  }

  body.page-creation .creation-composer .home-create-actions {
    width: auto;
    margin-left: auto;
  }
}

