:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --text: #373a46;
  --muted: #8c93a1;
  --line: #eceff3;
  --soft: #f7f8fa;
  --paper: rgba(255, 255, 255, 0.72);
  --paper-solid: #ffffff;
  --dark: #1a1a1a;
  --green: #52c41a;
  --blue: #1677ff;
  --red: #ff4d4f;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 6px 24px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 32px 96px rgba(15, 23, 42, 0.18);
  --gap-xs: 6px;
  --gap-sm: 10px;
  --gap-md: 16px;
  --gap-lg: 22px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --chat-rail-width: 260px;
  --chat-main-width: 820px;
  --chat-gap: 22px;
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

img {
  display: block;
  max-width: 100%;
}

[data-image-fallback] {
  position: relative;
}

[data-image-fallback].image-unavailable img {
  display: none !important;
}

[data-image-fallback].image-unavailable::after {
  content: attr(data-image-fallback);
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  color: #64748b;
  background:
    linear-gradient(135deg, rgba(248, 250, 252, 0.94), rgba(226, 232, 240, 0.88));
  font-size: clamp(10px, 2.8vw, 13px);
  font-weight: 800;
  line-height: 1.35;
  word-break: keep-all;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 16%, rgba(96, 165, 250, 0.16), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(244, 114, 182, 0.13), transparent 30%),
    radial-gradient(circle at 50% 92%, rgba(251, 191, 36, 0.12), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.app.editor-mode {
  background: linear-gradient(135deg, #eef4f8 0%, #f8fafc 46%, #f1eadf 100%);
}

.app.editor-mode .ambient {
  display: none;
}

.app.editor-mode .topbar {
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.app.editor-mode .brand-btn,
.app.editor-mode .nav-pill,
.app.editor-mode .icon-pill {
  color: #334155;
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(148, 163, 184, 0.28);
}

.app.editor-mode .brand-btn {
  color: #0f172a;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 36px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
}

.brand-btn,
.nav-pill,
.dark-pill,
.icon-pill,
.tool-button,
.send-button,
.composer-options-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.brand-btn {
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  font-size: 15px;
}

.brand-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--dark);
  color: #fff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-pill,
.icon-pill {
  background: rgba(255, 255, 255, 0.62);
  color: #515866;
  border: 1px solid rgba(226, 232, 240, 0.8);
  padding: 0 14px;
  font-size: 13px;
}

.icon-pill {
  width: 46px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
}

.sparkle-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  line-height: 1;
  font-size: 15px;
}

.notification-pill {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.dark-pill {
  background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 100%);
  color: #fff;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.nav-pill:hover,
.icon-pill:hover,
.brand-btn:hover {
  transform: translateY(-1px);
  background: #fff;
  color: var(--ink);
}

.dark-pill:hover,
.send-button:hover {
  transform: translateY(-1px) scale(1.02);
}

.home-view,
.chat-view,
.library-view,
.canvas-view {
  position: relative;
  z-index: 10;
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  min-height: min(760px, calc(100vh - 82px));
  padding: clamp(150px, 18vh, 230px) clamp(16px, 4vw, 32px) 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
  position: relative;
}

.hero > *:not(.hero-video-layer) {
  position: relative;
  z-index: 1;
}

.hero-canvas-button {
  height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.canvas-view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 120px 24px 48px;
}

.canvas-list-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.canvas-list-head button,
.canvas-sidebar button {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.canvas-empty-workspace {
  min-height: 360px;
  display: grid;
  place-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 32px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.canvas-list-head span,
.canvas-empty-workspace i {
  color: #2563eb;
}

.canvas-list-head span {
  font-weight: 800;
}

.canvas-list-head h2 {
  margin: 10px 0;
  max-width: 760px;
  font-size: 42px;
  line-height: 1.08;
}

.canvas-list-head p,
.canvas-empty-workspace span,
.canvas-inspector p {
  max-width: 620px;
  color: #64748b;
  line-height: 1.7;
}

.canvas-empty-workspace i {
  font-size: 42px;
}

.canvas-workspace-view {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.canvas-sidebar,
.canvas-inspector {
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.canvas-node-palette {
  display: grid;
  gap: 8px;
}

.canvas-node-palette button {
  justify-content: flex-start;
  width: 100%;
  background: #fff;
  color: #0f172a;
}

.canvas-board-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
}

.canvas-toolbar {
  min-height: 64px;
  padding: 12px 16px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.canvas-toolbar > div:first-child {
  display: grid;
  gap: 2px;
}

.canvas-save-status {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.canvas-save-status[data-status="saving"],
.canvas-save-status[data-status="dirty"] {
  color: #b45309;
}

.canvas-save-status[data-status="failed"] {
  color: #b91c1c;
}

.canvas-toolbar button {
  width: 36px;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.canvas-toolbar-actions,
.canvas-bg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.canvas-bg-toggle {
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.canvas-bg-toggle button {
  min-width: 30px;
  width: auto;
  height: 30px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 12px;
}

.canvas-bg-toggle button.active {
  background: #0f172a;
  color: #fff;
}

.canvas-board {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background-color: #f8fafc;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.canvas-board:active {
  cursor: grabbing;
}

.canvas-board[data-background="dots"] {
  background-image: radial-gradient(circle, rgba(71, 85, 105, 0.28) 1px, transparent 1px);
  background-size: 22px 22px;
}

.canvas-board[data-background="grid"] {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.24) 1px, transparent 1px);
  background-size: 32px 32px;
}

.canvas-board[data-background="blank"] {
  background-image: none;
}

.canvas-viewport {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
  will-change: transform;
}

.canvas-edges {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}

.canvas-edge {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 3;
}

.canvas-edge.active {
  stroke: #0f766e;
  stroke-width: 4;
}

.canvas-demo-node {
  position: absolute;
  width: 220px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
  color: #0f172a;
  text-align: left;
  cursor: grab;
  display: grid;
  gap: 6px;
}

.canvas-demo-node.locked {
  cursor: default;
  opacity: 0.72;
}

.canvas-demo-node.pending-link {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 16px 36px rgba(15, 23, 42, 0.14);
}

.canvas-node-image span {
  background: #eff6ff;
  color: #1d4ed8;
}

.canvas-node-text span {
  background: #fef3c7;
  color: #92400e;
}

.canvas-node-config span {
  background: #f3e8ff;
  color: #7e22ce;
}

.canvas-node-output span {
  background: #ecfdf5;
  color: #047857;
}

.canvas-demo-node small {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 800;
}

.canvas-demo-node small[data-status="loading"] {
  background: #dbeafe;
  color: #1d4ed8;
}

.canvas-demo-node small[data-status="success"] {
  background: #dcfce7;
  color: #166534;
}

.canvas-demo-node small[data-status="error"] {
  background: #fee2e2;
  color: #b91c1c;
}

.canvas-demo-node.selected {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15), 0 16px 36px rgba(15, 23, 42, 0.14);
}

.canvas-demo-node.primary-selected {
  border-color: #0f766e;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.2), 0 18px 40px rgba(15, 23, 42, 0.16);
}

.canvas-demo-node.canvas-node-group {
  border: 1px dashed #0f766e;
  background: linear-gradient(135deg, rgba(240, 253, 250, 0.72), rgba(255, 255, 255, 0.88));
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08), 0 12px 30px rgba(15, 23, 42, 0.08);
  cursor: grab;
}

.canvas-node-group span {
  background: #ccfbf1;
  color: #0f766e;
}

.canvas-selection-box {
  position: absolute;
  z-index: 12;
  border: 1px solid #0f766e;
  border-radius: 10px;
  background: rgba(20, 184, 166, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72) inset;
  pointer-events: none;
}

.canvas-demo-node span {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.canvas-demo-node strong {
  font-size: 16px;
}

.canvas-demo-node em {
  color: #64748b;
  font-style: normal;
  line-height: 1.4;
}

.canvas-minimap {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 8;
  width: 204px;
  padding: 9px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  cursor: crosshair;
  backdrop-filter: blur(14px);
}

.canvas-minimap > span {
  display: block;
  margin-bottom: 6px;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.canvas-minimap-stage {
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  background:
    linear-gradient(rgba(15, 23, 42, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.08) 1px, transparent 1px),
    #f8fafc;
  background-size: 18px 18px;
}

.canvas-minimap-edges {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.canvas-minimap-edge {
  stroke: rgba(100, 116, 139, 0.5);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.canvas-minimap-edge.active {
  stroke: rgba(15, 118, 110, 0.85);
  stroke-width: 2;
}

.canvas-minimap-node,
.canvas-minimap-view {
  position: absolute;
  border-radius: 3px;
}

.canvas-minimap-node {
  background: rgba(15, 118, 110, 0.42);
}

.canvas-minimap-node.active {
  background: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.22);
}

.canvas-minimap-view {
  border: 2px solid #2563eb;
  background: rgba(37, 99, 235, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

#canvasInspectorBody {
  display: grid;
  gap: 12px;
}

.canvas-assistant {
  min-width: 0;
}

#canvasAssistantBody {
  display: grid;
  gap: 10px;
}

.canvas-assistant-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
}

.canvas-assistant-head,
.canvas-assistant-context,
.canvas-assistant-suggestion button {
  display: flex;
  align-items: center;
}

.canvas-assistant-head {
  justify-content: space-between;
  gap: 8px;
}

.canvas-assistant-head span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #0f172a;
  font-weight: 900;
}

.canvas-assistant-head button,
.canvas-assistant-suggestion button {
  height: 32px;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font-weight: 800;
}

.canvas-assistant-head button {
  flex: 0 0 auto;
  padding: 0 10px;
}

.canvas-assistant-head button:disabled {
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #64748b;
}

.canvas-assistant-context {
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 12px;
}

.canvas-assistant-context strong,
.canvas-assistant-context span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.canvas-assistant-message,
.canvas-assistant-empty {
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.5;
}

.canvas-assistant-message {
  background: #ecfeff;
  color: #155e75;
}

.canvas-assistant-empty {
  background: #f1f5f9;
  color: #64748b;
}

.canvas-assistant-suggestions {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.canvas-assistant-suggestion {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.canvas-assistant-suggestion strong,
.canvas-assistant-suggestion p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.canvas-assistant-suggestion p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.canvas-assistant-suggestion button {
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 0 10px;
}

.canvas-selection-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  background: #f0fdfa;
  color: #0f766e;
}

.canvas-selection-summary span {
  color: #0f766e;
  font-size: 12px;
  line-height: 1.5;
}

.canvas-inspector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.canvas-inspector-actions button,
.canvas-edge-list button {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.canvas-edge-list {
  display: grid;
  gap: 8px;
}

.canvas-edge-list button {
  justify-content: flex-start;
  width: 100%;
}

.canvas-upstream,
.canvas-linking,
.canvas-input-warning {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  padding: 10px;
}

.canvas-upstream {
  background: #f0fdfa;
  color: #0f766e;
}

.canvas-upstream span,
.canvas-linking,
.canvas-input-warning {
  font-size: 12px;
}

.canvas-linking {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}

.canvas-input-warning {
  background: #fff7ed;
  color: #c2410c;
  font-weight: 800;
}

.canvas-field {
  display: grid;
  gap: 6px;
}

.canvas-field span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.canvas-field input,
.canvas-field textarea,
.canvas-field select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: #0f172a;
}

.canvas-field textarea {
  min-height: 88px;
  resize: vertical;
}

.canvas-target-actions {
  display: grid;
  gap: 10px;
}

.canvas-target-actions button {
  width: 100%;
  justify-content: center;
}

@media (max-width: 860px) {
  .canvas-list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .canvas-workspace-view {
    grid-template-columns: 1fr;
  }

  .canvas-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .canvas-toolbar-actions {
    flex-wrap: wrap;
  }

  .canvas-board {
    min-height: 460px;
  }

  .canvas-minimap {
    right: 10px;
    bottom: 10px;
    width: 154px;
    padding: 7px;
  }

  .canvas-list-head h2 {
    font-size: 30px;
  }
}

.hero-video-layer {
  position: absolute;
  top: -82px;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.hero-video-layer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleY(-1);
  opacity: 0.88;
  display: block;
  background: #eef2ff;
}

.hero-video-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 26.416%,
    #fff 66.943%
  );
}

.config-chip,
.library-badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #a78bfa, #f472b6, #fbbf24, #60a5fa) border-box;
  border: 1.5px solid transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.daily-metric {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #8c93a1;
  font-size: 16px;
  line-height: 1.4;
  white-space: nowrap;
}

.metric-stars {
  color: #f6b300;
  letter-spacing: 2px;
  font-size: 15px;
}

.metric-dots {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.metric-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
}

.metric-dots i:nth-child(2) { background: #ef4444; }
.metric-dots i:nth-child(3) { background: #f59e0b; }
.metric-dots i:nth-child(4) { background: #22c55e; }
.metric-dots i:nth-child(5) { background: #8b5cf6; }

.hero h1,
.library-hero h1 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.04em;
  font-size: clamp(38px, 6vw, 80px);
  line-height: 1.05;
  font-weight: 500;
}

.hero h1 em {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(46px, 7.5vw, 100px);
}

.hero-desc,
.library-hero p {
  margin: 0;
  max-width: 554px;
  color: var(--text);
  opacity: 0.8;
  font-size: 18px;
  line-height: 1.65;
}

.hero .config-chip,
.hero .daily-metric,
.hero h1,
.hero .hero-desc,
.hero .composer-mount {
  animation: fadeSlideUp 0.72s ease both;
}

.hero .daily-metric { animation-delay: 0.08s; }
.hero h1 { animation-delay: 0.16s; }
.hero .hero-desc { animation-delay: 0.24s; }
.hero .composer-mount { animation-delay: 0.32s; }

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.composer-mount,
.sticky-composer {
  width: min(960px, calc(100vw - 32px));
}

.sticky-composer {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 40;
  transform: translateX(-50%);
}

.chat-view .sticky-composer {
  left: calc(50% + ((var(--chat-rail-width) + var(--chat-gap)) / 2));
  width: min(var(--chat-main-width), calc(100vw - var(--chat-rail-width) - var(--chat-gap) - 50px));
}

.app.chat-panel-collapsed .chat-view .sticky-composer {
  left: 50%;
  width: min(var(--chat-main-width), calc(100vw - 32px));
}

.composer {
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 24px;
  box-shadow: 0 10px 40px 5px rgba(194, 194, 194, 0.22);
  padding: 12px;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer:focus-within {
  border-color: rgba(167, 139, 250, 0.34);
  box-shadow: 0 24px 80px rgba(99, 102, 241, 0.14);
}

.composer-settings-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 0 2px 10px;
  flex-wrap: wrap;
}

.model-chip {
  border: 0;
  min-height: 44px;
  border-radius: 14px;
  padding: 0 16px;
  background: #050505;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow:
    inset -4px -6px 25px 0 rgba(201, 201, 201, 0.08),
    inset 4px 4px 10px 0 rgba(29, 29, 29, 0.24);
}

.composer-options-button {
  min-height: 44px;
  min-width: 174px;
  border: 1px solid #edf0f3;
  border-radius: 14px;
  background: #f8fafc;
  color: #475467;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
  flex: 0 1 auto;
}

.composer-options-button.active,
.composer-options-button:hover {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.square-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #b6bbc4;
  font-size: 14px;
  white-space: nowrap;
}

.composer-public-toggle {
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
}

.square-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d9dadd;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease;
}

.square-toggle input:checked + .toggle-track {
  background: #050505;
}

.square-toggle input:checked + .toggle-track::after {
  transform: translateX(14px);
}

.prompt-box {
  width: 100%;
  min-height: 46px;
  max-height: 160px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #20242d;
  padding: 9px 6px;
  font-size: 16px;
  line-height: 1.5;
  min-width: 360px;
}

.prompt-box::placeholder {
  color: #a5adba;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 8px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid #edf0f3;
}

.composer-spacer {
  flex: 1;
}

.tool-button,
.add-reference-button {
  background: #f4f6f8;
  color: #667085;
  padding: 0 12px;
  font-size: 13px;
  border: 1px solid #edf0f3;
  min-height: 36px;
}

.add-reference-button {
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  border: 1px dashed #d5d8de;
  background: #fff;
  color: #a0a7b3;
  font-size: 22px;
}

.tool-button input,
.add-reference-button input {
  display: none;
}

.tool-button:hover,
.tool-button.active,
.add-reference-button:hover {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.send-button {
  background: linear-gradient(180deg, #3a3a3a 0%, #050505 100%);
  color: #fff;
  padding: 0 22px;
  min-height: 48px;
  min-width: 120px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow:
    inset -4px -6px 25px 0 rgba(201, 201, 201, 0.08),
    inset 4px 4px 10px 0 rgba(29, 29, 29, 0.24);
}

.send-button span {
  white-space: nowrap;
}

.send-button:disabled {
  background: #a7a9ad;
  color: #fff;
  opacity: 1;
  box-shadow: none;
}

.composer-feedback {
  padding: 8px 10px 0 66px;
  color: #b42318;
  font-size: 12px;
  line-height: 1.4;
}

.advanced-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 10px;
  padding: 12px 4px 2px;
}

.custom-size-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  grid-column: span 2;
}

.advanced-options label {
  display: grid;
  gap: 6px;
  color: #778091;
  font-size: 12px;
}

.advanced-options select,
.advanced-options input,
.modal input,
.modal select,
.modal textarea,
.admin-card input,
.admin-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  outline: none;
  padding: 11px 12px;
  color: var(--ink);
}

.advanced-options select:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus,
.admin-card input:focus,
.admin-card select:focus {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.reference-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 16px;
  background: #f4f6f8;
  border: 1px solid #edf0f3;
  overflow: hidden;
}

.reference-thumbs {
  display: flex;
  gap: 8px;
  margin-left: auto;
  overflow-x: auto;
  min-width: 0;
}

.reference-thumb {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--soft);
}

.reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}

.reference-note {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  color: #64748b;
  font-size: 12px;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-badge {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.reviews {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #a0a7b3;
  font-size: 13px;
}

.recent-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px) 68px;
  content-visibility: auto;
  contain-intrinsic-size: 900px;
}

.recent-header {
  text-align: center;
  margin-bottom: 32px;
}

.recent-header h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.2;
  font-weight: 520;
  letter-spacing: 0;
  color: var(--ink);
}

.recent-header p {
  margin: 7px 0 0;
  color: #999;
  font-size: 14px;
}

.recent-masonry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.recent-tile {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  contain: layout paint;
}

.recent-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.11);
}

.recent-visual {
  height: 220px;
  background: #f1f5f9;
  position: relative;
}

.recent-tile.short .recent-visual {
  height: 170px;
}

.recent-tile.medium .recent-visual {
  height: 230px;
}

.recent-tile.tall .recent-visual {
  height: 300px;
}

.recent-visual img,
.recent-gradient {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-visual img {
  transform: translateZ(0);
}

.recent-visual em {
  position: absolute;
  z-index: 2;
  right: 10px;
  top: 10px;
  max-width: calc(100% - 20px);
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
  padding: 0 10px;
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
  backdrop-filter: blur(12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-gradient {
  display: grid;
  place-items: center;
  background: var(--art-bg);
  color: rgba(255, 255, 255, 0.94);
  font-size: 44px;
}

.recent-caption {
  display: grid;
  gap: 5px;
  padding: 12px 13px 14px;
}

.recent-caption strong {
  color: #1e293b;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.recent-caption span {
  color: #778091;
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inspiration-band {
  padding: 10px clamp(16px, 4vw, 32px) 84px;
  max-width: 1180px;
  margin: 0 auto;
  content-visibility: auto;
  contain-intrinsic-size: 760px;
}

.inspiration-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.inspiration-head button {
  border: 0;
  background: transparent;
  color: #475569;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.example-grid,
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 18px;
}

.example-card,
.prompt-card {
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.055);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  contain: layout paint;
}

.example-card:hover,
.prompt-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.09);
  border-color: rgba(167, 139, 250, 0.28);
}

.card-art {
  height: 154px;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--art-bg);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.94);
  font-size: 42px;
}

.prompt-card .card-art {
  aspect-ratio: 1;
  height: auto;
  position: relative;
}

.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-art.image-error img {
  display: none;
}

.card-art.image-error::before {
  content: "\ef5b";
  font-family: remixicon;
  color: rgba(255, 255, 255, 0.92);
  font-size: 42px;
}

.card-art em {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  max-width: calc(100% - 16px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  color: #64748b;
  font-size: 11px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-art em.square-badge {
  background: rgba(17, 24, 39, 0.84);
  color: #fff;
}

.card-art b {
  position: absolute;
  top: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #1e293b;
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-art b.canvas-route-badge {
  top: auto;
  bottom: 8px;
  background: rgba(15, 118, 110, 0.88);
  color: #fff;
  gap: 4px;
}

.card-art-clickable {
  cursor: zoom-in;
}

.example-card h3,
.prompt-card h3 {
  margin: 0 4px 6px;
  font-size: 15px;
  color: #1e293b;
  font-weight: 600;
}

.prompt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 4px 8px;
}

.prompt-tags span {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.25;
}

.example-card p,
.prompt-card p {
  margin: 0 4px 14px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  border-top: 1px solid rgba(226, 232, 240, 0.66);
  padding: 10px 4px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-actions button,
.tiny-button {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-actions .use-button {
  background: #1e293b;
  color: #fff;
  padding: 7px 13px;
  border-radius: 999px;
}

.chat-view {
  min-height: calc(100vh - 82px);
  padding: 18px clamp(16px, 4vw, 32px) 0;
  display: grid;
  grid-template-columns: var(--chat-rail-width) minmax(0, var(--chat-main-width));
  justify-content: center;
  align-items: start;
  gap: var(--chat-gap);
  overflow-anchor: none;
  scroll-margin-top: 96px;
}

.app.chat-panel-collapsed .chat-view {
  grid-template-columns: minmax(0, var(--chat-main-width));
}

.app.chat-panel-collapsed .chat-workspace {
  grid-column: 1;
}

.chat-session-panel {
  position: fixed;
  top: 92px;
  left: max(16px, calc(50vw - ((var(--chat-rail-width) + var(--chat-main-width) + var(--chat-gap)) / 2)));
  z-index: 42;
  width: var(--chat-rail-width);
  height: calc(100vh - 116px);
  min-height: 360px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.88);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 52px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.app.chat-panel-visible .chat-session-panel,
.app.session-panel-open .chat-session-panel {
  display: flex;
}

.app.chat-panel-collapsed .chat-session-panel {
  display: none;
}

.session-drawer-toggle {
  position: fixed;
  left: max(16px, calc(50vw - 560px));
  bottom: 24px;
  z-index: 44;
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  background: #111827;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.18);
}

.session-drawer-toggle i {
  font-size: 19px;
}

.session-drawer-toggle span {
  font-size: 13px;
  font-weight: 700;
}

.chat-session-head {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.74);
}

.chat-session-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.chat-session-head span {
  color: #94a3b8;
  font-size: 12px;
}

.chat-session-head strong {
  color: #1e293b;
  font-size: 15px;
}

.chat-session-head button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: 0 0 auto;
}

.chat-session-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.chat-session-card {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  padding: 7px;
  display: flex;
  gap: 10px;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.chat-session-card:hover,
.chat-session-card.active {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.chat-session-card.active {
  border-color: rgba(99, 102, 241, 0.34);
}

.session-thumb {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: #eef2f7;
  color: #94a3b8;
  font-size: 22px;
}

.session-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.session-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  align-content: center;
}

.session-copy strong,
.session-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-copy strong {
  color: #1e293b;
  font-size: 13px;
}

.session-copy em {
  color: #64748b;
  font-size: 11px;
  font-style: normal;
}

.session-copy small {
  color: #a0a7b3;
  font-size: 11px;
}

.chat-workspace {
  min-width: 0;
  grid-column: 2;
}

.generation-status {
  max-width: none;
  margin: 0 0 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #475467;
  font-size: 14px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
}

.elapsed-pill {
  margin-left: auto;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  padding: 5px 10px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
}

.paint-drip {
  height: 32px;
  display: flex;
  align-items: end;
  gap: 6px;
}

.paint-drip span {
  width: 4px;
  border-radius: 999px;
  animation: drip 1.4s ease-in-out infinite;
}

.paint-drip span:nth-child(1),
.paint-drip span:nth-child(5) {
  background: #1a1a1a;
}

.paint-drip span:nth-child(2),
.paint-drip span:nth-child(4) {
  background: #666;
  animation-delay: 0.12s;
}

.paint-drip span:nth-child(3) {
  background: #999;
  animation-delay: 0.24s;
}

@keyframes drip {
  0% {
    opacity: 0;
    height: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    height: 28px;
  }
}

.history-list {
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: 18px;
  overflow-anchor: none;
}

.chat-empty-state,
.session-empty {
  border: 1px dashed #dbe3ec;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  color: #8a93a4;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
}

.chat-empty-state {
  min-height: 280px;
  padding: 36px 18px;
}

.chat-empty-state i {
  font-size: 30px;
  color: #64748b;
}

.chat-empty-state strong {
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.session-empty {
  padding: 24px 12px;
  font-size: 13px;
}

.date-separator {
  color: #b7bec9;
  font-size: 13px;
  margin-top: 4px;
}

.message-card {
  width: min(100%, var(--chat-main-width));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.88);
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.07);
  overflow: hidden;
  scroll-margin-top: 104px;
}

.message-card-top {
  padding: 15px 16px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.message-prompt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: #273140;
}

.message-prompt > div {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-meta span {
  width: max-content;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  padding: 4px 9px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.message-prompt i {
  color: #94a3b8;
  margin-top: 3px;
}

.round-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.message-image {
  padding: 0 14px 12px;
}

.image-shell {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(248, 250, 252, 0.94), rgba(241, 245, 249, 0.92));
  min-height: 220px;
  padding: 14px;
  display: grid;
  place-items: center;
}

.image-shell img {
  width: auto;
  max-width: 100%;
  max-height: min(58vh, 620px);
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.12);
}

.image-tools {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  pointer-events: none;
  opacity: 0.96;
}

.image-tools button,
.image-tools a {
  min-height: 32px;
  border: 0;
  border-radius: 11px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.image-tools button:disabled {
  opacity: 1;
  background: rgba(255, 255, 255, 0.9);
  color: #16a34a;
}

.route-strip {
  margin: 0 16px 12px;
  padding: 9px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.route-strip span {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: #e2e8f0;
  color: #64748b;
}

.route-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.route-strip em {
  position: absolute;
  z-index: 2;
  right: 4px;
  bottom: 4px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.86);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.candidate-strip {
  display: flex;
  gap: 8px;
  margin: 0 16px 12px;
  overflow-x: auto;
}

.candidate-strip button {
  position: relative;
  width: 72px;
  height: 72px;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #eef2f7;
  cursor: pointer;
  flex: 0 0 auto;
}

.candidate-strip button.active {
  border-color: #111827;
}

.candidate-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.candidate-strip span {
  position: absolute;
  z-index: 2;
  left: 5px;
  top: 4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
}

.queue-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  margin-right: 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
}

.public-tag-row {
  margin: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.public-tag-row span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.preview-route {
  margin: 12px 0 0;
  padding-left: 20px;
  color: #64748b;
  font-size: 13px;
  display: grid;
  gap: 6px;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 16px;
}

.message-actions a,
.message-actions button {
  border: 0;
  background: #f6f7f9;
  color: #344054;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  text-decoration: none;
}

.message-actions a:hover,
.message-actions button:hover {
  background: #fff;
  color: var(--ink);
}

.generating-actions {
  align-items: center;
}

.generating-actions > span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
}

.generating-actions > span > i {
  color: #475569;
  animation: spin 0.9s linear infinite;
}

.error-box {
  margin: 0 18px 16px;
  color: #b42318;
  background: #fff1f0;
  border: 1px solid #ffd5d1;
  border-radius: 16px;
  padding: 12px;
  font-size: 13px;
}

.bottom-spacer {
  height: 180px;
}

.library-view {
  padding-bottom: 96px;
}

.library-hero {
  position: relative;
  text-align: center;
  padding: 54px 16px 40px;
  display: grid;
  justify-items: center;
  gap: 18px;
}

.library-hero h1 {
  font-size: clamp(30px, 5vw, 52px);
}

.library-search {
  width: min(640px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.library-search span {
  flex-shrink: 0;
  background: #1e293b;
  color: #fff;
  border-radius: 13px;
  padding: 7px 12px;
  font-size: 12px;
}

.library-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 8px;
}

.library-search button {
  border: 0;
  background: #e2e8f0;
  color: #475569;
  border-radius: 13px;
  padding: 9px 18px;
  font-size: 13px;
}

.library-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.library-sort button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  padding: 8px 11px;
  font-size: 13px;
  white-space: nowrap;
}

.library-sort button.active {
  background: #0f172a;
  color: #fff;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 880px;
}

.tag-filters button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  padding: 7px 18px;
  font-size: 13px;
}

.tag-filters button.empty {
  color: #98a2b3;
  border-color: rgba(226, 232, 240, 0.72);
  background: rgba(248, 250, 252, 0.58);
}

.tag-filters button em {
  margin-right: 5px;
  color: #94a3b8;
  font-style: normal;
  font-size: 11px;
}

.tag-filters button.active {
  background: rgba(255, 255, 255, 0.78);
  color: #1e293b;
  border-color: #e2e8f0;
  box-shadow: 0 3px 14px rgba(15, 23, 42, 0.06);
}

.tag-filters button span {
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.56;
}

.library-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 5vw, 48px);
  margin: 4px 0 20px;
}

.library-stats div:not(.stat-divider) {
  display: grid;
  gap: 3px;
  text-align: center;
}

.library-stats strong {
  color: #1e293b;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
}

.library-stats span {
  color: #94a3b8;
  font-size: 12px;
}

.stat-divider {
  width: 1px;
  align-self: stretch;
  background: #e2e8f0;
}

.prompt-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

.load-more-wrap,
.empty-message {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 28px 0;
  color: #94a3b8;
}

.empty-tag-state {
  align-items: center;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.empty-tag-state strong {
  color: #1e293b;
  font-size: 20px;
}

.empty-tag-state span {
  color: #64748b;
}

.empty-tag-actions,
.empty-tag-related {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.empty-tag-actions button,
.empty-tag-related button {
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.empty-tag-related em {
  color: #94a3b8;
  font-style: normal;
  align-self: center;
}

.load-more-wrap button {
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  color: #64748b;
  padding: 12px 28px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.load-more-wrap button:hover {
  background: #fff;
  color: #1e293b;
}

.load-more-wrap span {
  opacity: 0.58;
  margin-left: 4px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(14px);
}

.modal {
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-modal);
  padding: 24px;
  position: relative;
  animation: modalIn 0.18s ease-out both;
}

.preview-modal {
  width: min(860px, 100%);
  padding: 14px;
}

.square-preview-modal {
  width: min(1480px, calc(100vw - 36px));
  height: min(900px, calc(100vh - 36px));
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  border-radius: 16px;
  background: #050814;
  color: #e5edf8;
}

.square-preview-close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 4;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.square-preview-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 15%, rgba(37, 99, 235, 0.16), transparent 38%),
    #020617;
}

.square-preview-main {
  max-width: 100%;
  max-height: calc(100vh - 92px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.34);
}

.prompt-no-cover-detail {
  width: min(520px, 100%);
  min-height: 360px;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 36px;
  color: #e5e7eb;
  text-align: center;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.88));
}

.prompt-no-cover-detail i {
  font-size: 42px;
  color: #93c5fd;
}

.prompt-no-cover-detail span {
  max-width: 32ch;
  font-size: 20px;
  font-weight: 700;
}

.square-preview-side {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  background: #fff;
  color: #1f2937;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.square-preview-head {
  display: grid;
  gap: 4px;
  padding-right: 44px;
}

.square-preview-head span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.square-preview-head strong {
  color: #0f172a;
  font-size: 22px;
  line-height: 1.2;
}

.square-preview-section h3,
.square-preview-route,
.square-preview-meta span {
  color: #8b97aa;
}

.square-preview-section h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

.square-preview-section p {
  margin: 0;
  color: #334155;
  font-size: 15px;
  line-height: 1.75;
}

.square-preview-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.square-preview-meta div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.square-preview-meta span {
  font-size: 12px;
  font-weight: 800;
}

.square-preview-meta strong {
  min-width: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.square-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.square-preview-tags button {
  min-height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 750;
}

.square-source-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.square-source-pair figure {
  margin: 0;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
  min-height: 150px;
}

.square-source-pair figure.image-unavailable figcaption,
.works-detail-source.image-unavailable h4 {
  position: relative;
  z-index: 2;
}

.square-source-pair img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.source-private-placeholder {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
  color: #64748b;
  background:
    linear-gradient(135deg, rgba(241, 245, 249, 0.96), rgba(226, 232, 240, 0.9));
  font-size: 13px;
  font-weight: 800;
}

.source-private-placeholder i {
  font-size: 26px;
}

.square-source-pair figcaption {
  padding: 8px 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.square-preview-route {
  margin: 0;
  padding: 14px 0 14px 22px;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  display: grid;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.square-preview-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.square-preview-actions a,
.square-preview-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.square-preview-actions a:first-child,
.square-preview-actions button:first-child {
  background: #0f172a;
  color: #fff;
}

.compliance-modal {
  width: min(780px, calc(100vw - 32px));
  padding: 46px 56px 26px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 8%, rgba(124, 58, 237, 0.08), transparent 34%),
    #fff;
}

.compliance-close {
  color: #8a8f98;
  background: transparent;
}

.compliance-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-size: 28px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 14px 34px rgba(124, 58, 237, 0.34);
}

.compliance-title {
  text-align: center;
  margin-bottom: 22px;
}

.compliance-title h2 {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.compliance-title h2 i {
  color: #ec4899;
}

.compliance-title p {
  margin: 0;
  color: #667085;
  font-weight: 650;
  font-size: 14px;
}

.notice-card {
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 12px;
  background: #fff;
  padding: 20px 22px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.1);
  margin-bottom: 16px;
}

.notice-card h3 {
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
}

.notice-card.danger {
  border-left: 4px solid #ff344f;
}

.notice-card.danger h3 span {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f43f5e, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}

.notice-card.privacy {
  border-left: 4px solid #f59e0b;
}

.notice-card.privacy h3 i {
  color: #3b82f6;
}

.notice-card.together {
  border-left: 4px solid #22c55e;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.08), rgba(255, 255, 255, 0.92));
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.notice-card ul {
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 14px;
  list-style: none;
}

.notice-card li {
  position: relative;
  padding-left: 22px;
  color: #475467;
  line-height: 1.7;
  font-size: 14px;
}

.notice-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #ef4444;
}

.notice-card em {
  color: #f97316;
  font-style: normal;
  font-weight: 800;
}

.notice-card p {
  margin: 0;
  color: #475467;
  line-height: 1.7;
  font-size: 14px;
}

.compliance-actions {
  border-top: 1px solid rgba(226, 232, 240, 0.92);
  margin-top: 20px;
  padding-top: 18px;
  display: flex;
  justify-content: center;
}

.compliance-actions .modal-primary {
  width: auto;
  min-width: 120px;
  padding: 0 30px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 12px 28px rgba(124, 58, 237, 0.28);
}

.publish-modal {
  width: min(520px, calc(100vw - 32px));
}

.publish-modal-head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 10px 42px 18px 0;
}

.publish-modal-head img {
  width: 96px;
  height: 96px;
  border-radius: 18px;
  object-fit: cover;
  background: #eef2f7;
}

.publish-modal-head h2 {
  margin: 0 0 7px;
  color: #101828;
  font-size: 22px;
  letter-spacing: 0;
}

.publish-modal-head p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.55;
}

.publish-form {
  display: grid;
  gap: 13px;
}

.publish-form label {
  display: grid;
  gap: 7px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.publish-form input[type="text"],
.publish-form input:not([type]) {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #101828;
  outline: none;
  padding: 0 12px;
}

.publish-form input:focus {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.publish-required-tag,
.publish-tag-picker {
  display: grid;
  gap: 8px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.publish-required-tag strong {
  width: fit-content;
}

.publish-tag-picker small {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.publish-tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.publish-tag-options button {
  min-height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.publish-tag-options button.active {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.publish-tag-empty {
  margin: 0;
  width: 100%;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
  padding: 12px;
  font-size: 12px;
  line-height: 1.55;
}

.publish-original-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 9px !important;
  color: #475569 !important;
}

.publish-original-check input {
  width: 18px;
  height: 18px;
  accent-color: #111827;
}

.bind-source-modal {
  width: min(780px, calc(100vw - 32px));
}

.bind-current-prompt {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.bind-current-prompt strong {
  display: block;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.bind-current-prompt p {
  margin: 0;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.55;
}

.bind-source-grid {
  max-height: min(46vh, 420px);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 2px;
}

.bind-source-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  color: #334155;
  display: grid;
  gap: 9px;
  padding: 9px;
  text-align: left;
  cursor: pointer;
}

.bind-source-card.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.bind-source-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: #eef2f7;
}

.bind-source-card span {
  min-height: 38px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.bind-source-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.works-modal {
  width: min(980px, calc(100vw - 32px));
  padding: 24px;
}

.works-workspace {
  width: min(1480px, calc(100vw - 24px));
  height: min(920px, calc(100vh - 24px));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.works-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin: 8px 44px 20px 0;
}

.works-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.works-head p {
  margin: 0;
  color: #667085;
  font-size: 13px;
}

.works-refresh {
  width: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.work-card {
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  cursor: zoom-in;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.work-card:hover,
.work-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(15, 23, 42, 0.18);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
  outline: none;
}

.work-card.archived {
  opacity: 0.72;
}

.work-visual {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, rgba(226, 232, 240, 0.62) 25%, transparent 25% 75%, rgba(226, 232, 240, 0.62) 75%),
    linear-gradient(45deg, rgba(226, 232, 240, 0.62) 25%, transparent 25% 75%, rgba(226, 232, 240, 0.62) 75%),
    linear-gradient(135deg, #f8fafc, #eef2f7);
  background-position: 0 0, 12px 12px, 0 0;
  background-size: 24px 24px, 24px 24px, auto;
}

.work-select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  cursor: default;
}

.work-select input {
  width: 16px;
  height: 16px;
}

.work-visual img {
  width: 100%;
  height: 260px;
  display: block;
  object-fit: contain;
  background: transparent;
}

.work-image-tools {
  position: absolute;
  z-index: 3;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.work-image-tools button {
  min-height: 30px;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  backdrop-filter: blur(12px);
}

.work-image-tools button:disabled {
  background: rgba(255, 255, 255, 0.92);
  color: #16a34a;
}

.works-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.works-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.works-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.works-search input {
  width: 100%;
  border: 0;
  outline: none;
  font: inherit;
}

.works-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.works-bulk-actions span,
.works-bulk-actions button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #fff;
  color: #334155;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 700;
}

.works-filter-btn {
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  min-height: 32px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.works-filter-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: #312e81;
}

.works-filter-btn.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.work-type-badge,
.work-visibility-badge {
  position: absolute;
  top: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.work-type-badge {
  left: 10px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
}

.work-type-badge.image {
  background: rgba(124, 58, 237, 0.92);
}

.work-visibility-badge.published {
  right: 10px;
  background: rgba(22, 163, 74, 0.92);
  color: #fff;
}

.work-visibility-badge.archived {
  right: 10px;
  top: 42px;
  background: rgba(71, 85, 105, 0.92);
  color: #fff;
}

.prompt-card.prompt-hidden {
  opacity: 0.55;
  filter: grayscale(0.2);
}

.prompt-engagement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.prompt-engagement button,
.prompt-engagement span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  background: #fff;
  color: inherit;
  padding: 0 9px;
  font: inherit;
}

.prompt-engagement button.liked {
  color: #e11d48;
  border-color: rgba(225, 29, 72, 0.3);
  background: #fff1f2;
}

.gallery-leaderboard {
  grid-column: 1 / -1;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.92), rgba(240, 249, 255, 0.92));
  padding: 18px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.gallery-leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.gallery-leaderboard-head strong {
  display: block;
  color: #0f172a;
  font-size: 18px;
}

.gallery-leaderboard-head span {
  color: #64748b;
  font-size: 13px;
}

.gallery-leaderboard-head i {
  color: #f59e0b;
  font-size: 30px;
}

.gallery-rank-tabs {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.gallery-rank-tabs div {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
}

.gallery-rank-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.gallery-rank-tabs button.active {
  background: #0f172a;
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.gallery-leaderboard-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.gallery-rank-card {
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  overflow: hidden;
}

.gallery-rank-card.top-1 {
  grid-column: span 2;
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 18px 36px rgba(245, 158, 11, 0.14);
}

.gallery-rank-card.top-2,
.gallery-rank-card.top-3 {
  border-color: rgba(99, 102, 241, 0.3);
}

.gallery-rank-card.top-1 .gallery-rank-visual {
  aspect-ratio: 2 / 1;
}

.gallery-rank-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  background: #e2e8f0;
  cursor: zoom-in;
}

.gallery-rank-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-rank-visual em {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.gallery-rank-card div {
  padding: 10px;
}

.gallery-rank-card p {
  margin: 0 0 8px;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
}

.gallery-rank-card button[data-like-gallery] {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.gallery-rank-card button[data-like-gallery].liked,
.square-preview-actions button.liked {
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.3);
  background: #fff1f2;
}

.gallery-rank-empty {
  grid-column: 1 / -1;
  min-height: 130px;
  border: 1px dashed rgba(148, 163, 184, 0.58);
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.7);
}

.prompt-status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(120, 120, 120, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.prompt-card .card-actions .prompt-admin-edit,
.prompt-card .card-actions .prompt-admin-delete {
  background: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #1e293b;
}

.prompt-card .card-actions .prompt-admin-delete {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.4);
}

.library-admin-create {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-start;
}

.library-admin-create:hover {
  background: rgba(99, 102, 241, 0.2);
}

.prompt-editor-modal {
  width: min(720px, calc(100vw - 32px));
}

.prompt-editor-thumb {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 32px;
}

.prompt-editor-form textarea {
  width: 100%;
  min-height: 140px;
  font: inherit;
  border: 1px solid rgba(148, 163, 184, 0.6);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
}

.prompt-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.prompt-editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.work-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.work-body p {
  min-height: 40px;
  margin: 0;
  color: #101828;
  font-size: 13px;
  line-height: 1.55;
}

.work-body span {
  color: #98a2b3;
  font-size: 12px;
}

.work-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.work-actions a,
.work-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.works-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 86;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(8px);
}

.works-detail-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 87;
  width: min(920px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.88);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 34px 96px rgba(15, 23, 42, 0.28);
}

.works-detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
}

.works-detail-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.12), transparent 34%),
    radial-gradient(circle at 84% 72%, rgba(245, 158, 11, 0.14), transparent 30%),
    #f8fafc;
}

.works-detail-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}

.works-detail-body {
  min-height: 0;
  overflow-y: auto;
  padding: 58px 22px 24px;
  display: grid;
  align-content: start;
  gap: 18px;
  border-left: 1px solid rgba(226, 232, 240, 0.86);
}

.works-detail-title {
  display: grid;
  gap: 10px;
}

.works-detail-title .work-type-badge {
  position: static;
  width: fit-content;
}

.works-detail-title h3,
.works-detail-route h4,
.works-detail-source h4 {
  margin: 0;
  color: #0f172a;
}

.works-detail-title p {
  margin: 0;
  color: #334155;
  line-height: 1.7;
}

.works-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.works-detail-actions a,
.works-detail-actions button {
  min-height: 38px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.works-detail-meta {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  font-size: 12px;
}

.works-detail-meta dt {
  color: #64748b;
}

.works-detail-meta dd {
  margin: 0;
  min-width: 0;
  color: #0f172a;
  word-break: break-word;
}

.works-detail-source,
.works-detail-route {
  display: grid;
  gap: 10px;
}

.works-detail-source.image-unavailable {
  min-height: 260px;
}

.works-detail-source img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 16px;
  background: #f1f5f9;
}

.works-detail-route article {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  background: #fff;
}

.works-detail-route strong {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: #111827;
  color: #fff;
  font-size: 12px;
}

.works-detail-route p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.preview-image,
.preview-gradient {
  width: 100%;
  max-height: min(68vh, 720px);
  border-radius: 22px;
  object-fit: contain;
  background: #f1f5f9;
}

.preview-gradient {
  min-height: 420px;
  display: grid;
  place-items: center;
  background: var(--art-bg);
  color: #fff;
  font-size: 72px;
}

.preview-body {
  padding: 16px 8px 4px;
}

.preview-body h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 650;
}

.preview-body p {
  margin: 0 0 14px;
  color: #64748b;
  line-height: 1.65;
}

.preview-actions {
  padding: 0;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.close-modal {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f5f6f7;
  color: #6b7280;
}

.modal-title {
  text-align: center;
  margin-bottom: 18px;
}

.modal-title i {
  font-size: 32px;
  color: var(--ink);
}

.modal-title h2 {
  margin: 8px 0 5px;
  font-size: 22px;
  font-weight: 650;
}

.modal-title p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.55;
}

.contact-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: #fff;
  margin-bottom: 14px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 8px;
  text-align: center;
}

.contact-card span {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.contact-email {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 16px;
  background: #eef6ff;
  color: #0b62c4;
  font-size: 18px;
  font-weight: 750;
  text-decoration: none;
  word-break: break-all;
}

.contact-copy {
  min-height: 40px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #fff;
  color: #0b62c4;
  font-size: 13px;
  font-weight: 750;
}

.announcements-modal {
  width: min(760px, calc(100vw - 32px));
}

.announcements-list {
  display: grid;
  gap: 12px;
  max-height: min(60vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.announcement-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.announcement-filters button {
  min-height: 34px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 800;
}

.announcement-filters button.active {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}

.announcement-card {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  display: grid;
  gap: 10px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
}

.announcement-card.unread {
  border-color: #fb923c;
  background: linear-gradient(135deg, #fff7ed 0%, #fff 62%);
}

.announcement-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #f97316;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.announcement-card h3,
.announcement-card p {
  margin: 0;
}

.announcement-card h3 {
  color: #111827;
  font-size: 18px;
}

.announcement-card p {
  color: #475569;
  line-height: 1.65;
  white-space: pre-wrap;
}

.announcement-card small,
.announcement-empty {
  color: #94a3b8;
  font-size: 12px;
}

.announcement-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-form,
.admin-form {
  display: grid;
  gap: 12px;
}

.modal-form label,
.admin-form label {
  display: grid;
  gap: 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.modal-primary,
.modal-secondary,
.ghost-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 16px;
  font-weight: 600;
}

.modal-primary {
  background: var(--dark);
  color: #fff;
}

.modal-secondary {
  background: #f5f5f5;
  color: #333;
}

.link-button {
  border: 0;
  background: transparent;
  color: #9aa2af;
  font-size: 13px;
  padding: 8px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  background: #f3f4f6;
  border-radius: 18px;
  padding: 5px;
}

.auth-tabs button {
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #8b94a1;
  min-height: 38px;
  font-weight: 600;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.credits-packages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.checkin-card {
  display: grid;
  justify-items: center;
  gap: 7px;
  border: 1px solid #eceff3;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  padding: 22px 16px;
  margin: 18px 0;
}

.checkin-card i {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 22px;
}

.checkin-card strong {
  color: #111;
  font-size: 34px;
  line-height: 1;
}

.checkin-card span {
  color: #667085;
  font-size: 13px;
}

.package-card {
  border: 1px solid #eee;
  background: #f9f9f9;
  border-radius: 18px;
  padding: 16px 8px;
  position: relative;
}

.package-card.hot {
  background: var(--dark);
  color: #fff;
  border-color: var(--dark);
}

.package-card strong {
  display: block;
  font-size: 22px;
}

.package-card span {
  display: block;
  opacity: 0.68;
  font-size: 12px;
  margin-top: 4px;
}

.hot-badge {
  position: absolute;
  top: -9px;
  right: -5px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
}

.admin-modal {
  width: min(1120px, 100%);
}

.editor-view {
  min-height: calc(100vh - 82px);
  background:
    radial-gradient(circle at 18% 14%, rgba(59, 130, 246, 0.14), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(251, 146, 60, 0.16), transparent 26%),
    radial-gradient(circle at 50% 105%, rgba(14, 165, 233, 0.12), transparent 34%),
    linear-gradient(135deg, #eef4f8 0%, #f8fafc 48%, #f3eadf 100%);
  color: #172033;
  padding: 22px clamp(14px, 3vw, 32px) 32px;
}

.editor-stage {
  max-width: 1540px;
  margin: 0 auto;
}

.editor-header {
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.editor-brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: #172033;
  font-size: 24px;
  font-weight: 750;
}

.editor-tabs {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.editor-tabs button,
.editor-toolbar button,
.editor-zoom button,
.editor-prompt-bar button,
.editor-attach {
  border: 0;
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.editor-tabs button {
  gap: 8px;
  min-height: 44px;
  padding: 0 26px;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-size: 16px;
  font-weight: 700;
}

.editor-tabs button.active {
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
  box-shadow: inset -4px -6px 25px rgba(201, 201, 201, 0.08), inset 4px 4px 10px rgba(29, 29, 29, 0.24);
}

.editor-workspace {
  position: relative;
  min-height: calc(100vh - 160px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(0deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px) 0 0 / 42px 42px,
    radial-gradient(circle at 78% 18%, rgba(14, 165, 233, 0.13), transparent 34%),
    radial-gradient(circle at 22% 92%, rgba(251, 146, 60, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(241, 245, 249, 0.86));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.74),
    0 30px 90px rgba(15, 23, 42, 0.12);
}

.editor-toolbar {
  position: absolute;
  left: 50%;
  top: 28px;
  z-index: 5;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(18px);
}

.editor-toolbar button {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: transparent;
  color: #475569;
  font-size: 25px;
}

.editor-toolbar button.active {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
}

.editor-toolbar input[type="color"] {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.editor-canvas-area {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
  padding: 118px 48px 150px;
}

.editor-upload-card {
  width: min(520px, calc(100vw - 48px));
  min-height: 280px;
  border-radius: 28px;
  border: 1px dashed rgba(100, 116, 139, 0.36);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #64748b;
  text-align: center;
  cursor: pointer;
}

.editor-upload-card i {
  font-size: 44px;
  color: #c4b5fd;
}

.editor-upload-card strong {
  font-size: 20px;
  color: #172033;
}

.editor-upload-card span {
  font-size: 13px;
}

.editor-upload-card input,
.editor-attach input {
  display: none;
}

.editor-image-frame {
  max-width: min(76vw, 980px);
  max-height: calc(100vh - 280px);
  display: grid;
  place-items: center;
}

.editor-image-scaler {
  position: relative;
  transform-origin: center center;
  transition: transform 0.16s ease;
}

.editor-image-scaler img {
  display: block;
  max-width: min(76vw, 980px);
  max-height: calc(100vh - 280px);
  width: auto;
  height: auto;
  user-select: none;
  border-radius: 2px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.editor-image-scaler canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.editor-zoom {
  position: absolute;
  left: 34px;
  bottom: 34px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(8, 8, 14, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.editor-zoom button {
  width: 36px;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  font-size: 22px;
}

.editor-zoom span {
  min-width: 54px;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.editor-keyboard {
  position: absolute;
  right: 34px;
  bottom: 34px;
  z-index: 5;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 14, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  font-size: 22px;
}

.editor-publish-panel {
  position: absolute;
  right: 28px;
  top: 28px;
  z-index: 6;
  width: min(290px, calc(100% - 56px));
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.26);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(18px);
}

.editor-publish-panel strong {
  display: block;
  color: #0f172a;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.editor-publish-panel div > span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.editor-publish-panel .square-toggle {
  min-height: 42px;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px 9px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.92);
  color: #334155;
}

.editor-prompt-bar {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 6;
  transform: translateX(-50%);
  width: min(880px, calc(100vw - 320px));
  min-height: 72px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(18px);
}

.editor-attach {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 23px;
}

.editor-prompt-icon {
  color: #2563eb;
  font-size: 24px;
}

.editor-prompt-bar > input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 18px;
  outline: none;
}

.editor-prompt-bar input::placeholder {
  color: #94a3b8;
}

.editor-public-toggle,
.editor-source-toggle {
  flex: 0 0 auto;
  color: #334155;
}

.editor-prompt-bar button[type="submit"] {
  min-width: 132px;
  height: 54px;
  gap: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  font-size: 18px;
  font-weight: 800;
  box-shadow: inset -4px -6px 25px rgba(201, 201, 201, 0.08), inset 4px 4px 10px rgba(29, 29, 29, 0.24);
}

.editor-prompt-bar button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: wait;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 390px) 1fr;
  gap: 18px;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 18px;
}

.admin-card h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.admin-switch {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 9px !important;
  color: #273140 !important;
}

.admin-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--dark);
}

.users-table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  color: #8b94a1;
  font-size: 12px;
  text-transform: uppercase;
}

.users-table input,
.users-table select {
  min-width: 86px;
  padding: 8px;
  border-radius: 12px;
}

.user-cell strong {
  display: block;
}

.user-cell span {
  color: #8b94a1;
  font-size: 12px;
}

.toast-layer {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 100;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 230px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: #273140;
  box-shadow: 0 14px 44px rgba(15, 23, 42, 0.15);
  padding: 12px 14px;
  animation: toastIn 0.22s ease-out both;
  font-size: 13px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.fade-up {
  animation: fadeUp 0.65s ease-out both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-pill span {
    display: none;
  }

  .nav-pill .sparkle-icon {
    display: inline-grid;
  }

  .hero {
    padding-top: 160px;
  }

  .daily-metric {
    flex-wrap: wrap;
    gap: 8px 12px;
    white-space: normal;
  }

  .advanced-options,
  .custom-size-row,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .recent-masonry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .works-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .square-preview-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 48vh) minmax(0, 1fr);
  }

  .square-preview-stage {
    padding: 16px;
  }

  .square-preview-main {
    max-height: 44vh;
  }

  .square-preview-side {
    padding: 18px;
  }

  .chat-view {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-top: 16px;
  }

  .chat-workspace {
    grid-column: 1;
  }

  .chat-session-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 74px;
    width: auto;
    max-height: 48vh;
    height: auto;
    min-height: 0;
    z-index: 52;
    border-radius: 20px;
  }

  .app.chat-panel-visible:not(.session-panel-open) .chat-session-panel {
    display: none;
  }

  .session-drawer-toggle {
    left: 12px;
    bottom: 74px;
  }

  .chat-session-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
  }

  .chat-session-card {
    width: 250px;
    flex: 0 0 250px;
  }

  .chat-view .sticky-composer {
    left: 50%;
    width: min(960px, calc(100vw - 32px));
  }

  .sticky-composer {
    bottom: 10px;
  }

  .editor-header {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .editor-brand {
    justify-self: center;
  }

  .editor-canvas-area {
    padding: 104px 18px 158px;
  }

  .editor-prompt-bar {
    width: calc(100vw - 32px);
    bottom: 84px;
    border-radius: 28px;
    flex-wrap: wrap;
  }

.editor-public-toggle {
  order: 5;
}

.editor-source-toggle {
  order: 6;
}

  .editor-zoom {
    left: 16px;
    bottom: 22px;
  }

  .editor-keyboard {
    right: 16px;
    bottom: 22px;
  }
}

@media (max-width: 560px) {
  .gallery-rank-tabs {
    justify-content: flex-start;
    margin-inline: -2px;
  }

  .gallery-leaderboard-list {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  }

  .gallery-rank-card.top-1 {
    grid-column: span 1;
  }

  .gallery-rank-card.top-1 .gallery-rank-visual {
    aspect-ratio: 1;
  }

  .top-actions {
    gap: 6px;
  }

  .nav-pill,
  .dark-pill,
  .icon-pill {
    min-height: 36px;
    padding: 0 11px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero h1 em {
    font-size: 48px;
  }

  .composer {
    border-radius: 28px;
    padding: 18px;
  }

  .chat-session-head {
    padding: 12px;
  }

  .chat-session-card {
    width: 220px;
    flex-basis: 220px;
  }

  .composer-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .composer-bar {
    align-items: stretch;
  }

  .composer-spacer {
    display: none;
  }

  .send-button,
  .tool-button {
    min-width: 72px;
  }

  .prompt-box {
    min-width: 0;
    font-size: 15px;
  }

  .library-search {
    flex-wrap: wrap;
  }

  .library-search input {
    flex-basis: 100%;
    order: 5;
  }

  .credits-packages {
    grid-template-columns: 1fr;
  }

  .works-modal {
    padding: 20px 14px;
  }

  .works-head {
    margin-right: 40px;
  }

  .works-grid {
    grid-template-columns: 1fr;
  }

  .work-actions {
    grid-template-columns: 1fr;
  }

  .compliance-modal {
    padding: 38px 18px 20px;
    border-radius: 18px;
  }

  .compliance-title h2 {
    font-size: 18px;
  }

  .notice-card {
    padding: 16px;
  }

  .recent-masonry {
    gap: 10px;
  }

  .recent-visual,
  .recent-tile.medium .recent-visual {
    height: 180px;
  }

  .recent-tile.tall .recent-visual {
    height: 240px;
  }

  .editor-view {
    padding: 12px 10px 24px;
  }

  .editor-tabs button {
    min-height: 40px;
    padding: 0 16px;
  }

  .editor-toolbar {
    top: 18px;
    gap: 4px;
    padding: 7px;
  }

  .editor-toolbar button {
    width: 39px;
    height: 39px;
    font-size: 22px;
  }

  .editor-image-scaler img,
  .editor-image-frame {
    max-width: calc(100vw - 42px);
  }

  .editor-prompt-bar > input {
    flex-basis: calc(100% - 76px);
    font-size: 15px;
  }

  .editor-prompt-bar button[type="submit"] {
    min-width: 108px;
    height: 48px;
    font-size: 16px;
  }
}


/* ==========================================================================
   exec4 P0 — 解释型公开弹窗
   ========================================================================== */

.publish-notice-modal {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  display: grid;
  gap: var(--gap-md);
}

.publish-notice-head {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.publish-notice-head h2 {
  font-size: 18px;
  margin: 0;
  letter-spacing: -0.015em;
}

.publish-notice-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.publish-notice-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #334155;
}

.publish-notice-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
}

.publish-notice-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

/* ==========================================================================
   exec4 P0 — 编辑器状态条（计时 / 失败再试 / 取消）
   ========================================================================== */

.editor-status-bar {
  margin: 0 24px 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 8px;
}

.editor-status-bar.hidden {
  display: none;
}

.editor-status-row {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

.editor-status-row[hidden] {
  display: none;
}

.editor-status-row i {
  color: #4338ca;
  font-size: 18px;
}

.editor-status-row .spinning {
  animation: spin 1.1s linear infinite;
}

.editor-status-label {
  flex: 0 1 auto;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.editor-status-elapsed {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #4338ca;
  background: rgba(67, 56, 202, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.editor-status-cancel,
.editor-status-retry,
.editor-status-dismiss {
  margin-left: auto;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.editor-status-cancel:hover,
.editor-status-retry:hover {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.editor-status-dismiss {
  margin-left: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
}

.editor-status-failure {
  align-items: flex-start;
}

.editor-status-failure i {
  color: var(--red);
  margin-top: 2px;
}

.editor-status-failure-body {
  display: grid;
  gap: 4px;
  flex: 1 1 220px;
  font-size: 13px;
  line-height: 1.45;
  color: #1e293b;
}

.editor-status-failure-body strong {
  color: var(--red);
  font-size: 13px;
}

.editor-status-failure-body span {
  word-break: break-word;
}

.editor-status-failure-body em {
  color: #64748b;
  font-style: normal;
  font-size: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   exec4 P0 — 广场详情路线展示
   ========================================================================== */

.square-route {
  background: #f8fafc;
  border-radius: var(--radius-lg);
  padding: var(--gap-md);
  display: grid;
  gap: 12px;
}

.square-route-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
}

.square-route-head h3 {
  font-size: 14px;
  margin: 0;
  letter-spacing: 0.02em;
  color: #1e293b;
  text-transform: uppercase;
}

.square-route-head h3 em {
  font-style: normal;
  margin-left: 6px;
  color: #6366f1;
  font-weight: 700;
}

.square-route-toggle {
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.square-route-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.square-route-step {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.square-route-step:hover,
.square-route-step:focus-visible {
  border-color: rgba(99, 102, 241, 0.5);
  background: #f1f5ff;
  outline: none;
}

.square-route-step.active {
  border-color: #4338ca;
  background: rgba(67, 56, 202, 0.08);
}

.square-route-step.hidden {
  display: none;
}

.square-route-thumb {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.square-route-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.square-route-thumb em {
  position: absolute;
  left: 6px;
  top: 6px;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.square-route-body {
  display: grid;
  align-content: start;
  gap: 4px;
}

.square-route-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.square-route-body span {
  font-size: 11px;
  color: #94a3b8;
}

@media (max-width: 768px) {
  .square-route {
    padding: 12px;
  }
  .square-route-step {
    grid-template-columns: 64px 1fr;
  }
  .square-route-thumb {
    width: 64px;
    height: 64px;
  }
  .editor-status-bar {
    margin: 0 12px 10px;
    padding: 10px;
  }
  .publish-notice-modal {
    padding: 18px;
  }
}


/* ==========================================================================
   exec4 P1 — 续图上下文条
   ========================================================================== */

.continuation-toggle {
  margin: 0 0 10px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f4f6f8;
  color: #1e293b;
  border: 1px solid #edf0f3;
  border-radius: 16px;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.continuation-toggle:hover {
  border-color: #dbe2ea;
}

.continuation-toggle.active {
  background: #f8fafc;
  border-color: #dbe2ea;
}

.continuation-toggle.disabled {
  color: #64748b;
}

.composer-context-chip {
  flex: 1 1 270px;
  min-width: 220px;
  min-height: 44px;
  margin: 0;
  padding: 5px 8px;
  border-radius: 14px;
}

.composer-context-chip .context-badge {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 11px;
  color: #475569;
  background: #fff;
}

.composer-context-chip .continuation-toggle-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.composer-context-chip .continuation-toggle-thumb {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.composer-context-chip .continuation-toggle-close {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.continuation-toggle-main,
.continuation-toggle-close {
  border: 0;
  background: transparent;
  color: inherit;
}

.continuation-toggle-main {
  min-width: 0;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  text-align: left;
}

.continuation-toggle-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475467;
  font-size: 16px;
  border: 1px solid #e5e7eb;
  flex: 0 0 auto;
}

.continuation-toggle-text {
  display: grid;
  gap: 2px;
  line-height: 1.2;
  min-width: 0;
}

.continuation-toggle-text strong {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continuation-toggle-text em {
  font-style: normal;
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continuation-toggle.active .continuation-toggle-text em {
  color: #475467;
}

.continuation-toggle-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35);
  flex: 0 0 auto;
}

.continuation-toggle-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.continuation-toggle-thumb[hidden] {
  display: none !important;
}

.continuation-toggle-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: #64748b;
}

.continuation-toggle-close:hover {
  background: #fff;
  color: #111827;
}

.composer-settings-row .continuation-toggle {
  margin: 0;
  min-height: 44px;
  height: 44px;
  padding: 5px 8px;
  gap: 7px;
  border-radius: 14px;
  flex: 0 1 260px;
  min-width: 190px;
}

.composer-settings-row .continuation-toggle .context-badge,
.composer-settings-row .continuation-toggle-text em {
  display: none;
}

.composer-settings-row .continuation-toggle-main {
  gap: 7px;
}

.composer-settings-row .continuation-toggle-icon,
.composer-settings-row .continuation-toggle-close {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 10px;
}

.composer-settings-row .continuation-toggle-thumb {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

@media (max-width: 768px) {
  .composer-settings-row .continuation-toggle {
    flex-basis: 220px;
  }
  .continuation-toggle-text em {
    display: none;
  }
}


/* ==========================================================================
   exec4 P2 — 标签胶囊 + admin 标签库面板
   ========================================================================== */

.tag-chip {
  --tag-hue: 220;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid hsl(var(--tag-hue), 60%, 85%);
  background: hsl(var(--tag-hue), 78%, 95%);
  color: hsl(var(--tag-hue), 42%, 28%);
  line-height: 1.4;
  cursor: inherit;
}

button.tag-chip {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button.tag-chip:hover {
  background: hsl(var(--tag-hue), 78%, 88%);
  border-color: hsl(var(--tag-hue), 60%, 70%);
}

button.tag-chip.active {
  background: hsl(var(--tag-hue), 65%, 32%);
  color: #fff;
  border-color: hsl(var(--tag-hue), 65%, 32%);
}

.tags-admin-modal {
  padding: 24px;
}

.tags-admin-add {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(160px, 2fr) auto;
  gap: 8px;
  margin: 12px 0 16px;
}

.tags-admin-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}

.tags-admin-add input {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font: inherit;
}

.tags-admin-table-wrap {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.tags-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tags-admin-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #475569;
  text-transform: uppercase;
  font-size: 11px;
}

.tags-admin-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.tags-admin-table input,
.tags-admin-table select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  background: #fff;
}

.tags-admin-table button {
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 4px;
}

.tags-admin-table button:hover {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.tags-admin-empty {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
}

@media (max-width: 768px) {
  .tags-admin-add {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Admin shell
   ========================================================================== */

.admin-shell-body {
  margin: 0;
  background: #f6f7f9;
  color: #182230;
  font-family: "Geist", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #111827;
  color: #e5e7eb;
  padding: 18px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  padding: 8px 10px 18px;
}

.admin-brand span {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #2563eb;
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 0 10px;
  font: inherit;
  cursor: pointer;
}

.admin-nav button:hover,
.admin-nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.admin-nav i {
  font-size: 18px;
}

.admin-main {
  min-width: 0;
  padding: 22px 28px 40px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.admin-kicker {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.admin-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #475569;
  font-size: 13px;
}

.admin-status-pill[data-tone="ok"] {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}

.admin-status-pill[data-tone="danger"] {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
}

.admin-icon-button,
.admin-panel-head button,
.admin-table button,
.admin-pagination button,
.admin-form-actions button,
.admin-form-grid button,
.admin-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #182230;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.admin-icon-button {
  width: 36px;
  padding: 0;
}

.admin-content {
  display: grid;
  gap: 18px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-stats-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-stat,
.admin-panel,
.admin-work-card,
.admin-auth-required {
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.admin-stat {
  min-height: 126px;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 16px;
}

.admin-stat i {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 18px;
}

.admin-stat span,
.admin-stat small,
.admin-table small {
  color: #667085;
  font-size: 12px;
}

.admin-stat strong {
  font-size: 26px;
  line-height: 1.1;
}

.admin-panel {
  min-width: 0;
  padding: 16px;
}

.admin-panel h2 {
  margin: 0;
  font-size: 18px;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: 10px;
}

.admin-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d0d5dd;
  background: #fff;
  border-radius: 8px;
  padding: 0 10px;
}

.admin-toolbar input,
.admin-toolbar select,
.admin-bulk-bar input,
.admin-bulk-bar select,
.admin-form-grid input,
.admin-form-grid select,
.admin-form-grid textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: #182230;
  font: inherit;
}

.admin-bulk-bar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) 160px 110px 120px minmax(140px, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #f9fafb;
}

.admin-bulk-bar span {
  color: #667085;
  font-size: 12px;
}

.admin-bulk-bar button {
  min-height: 38px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.admin-toolbar input {
  border: 0;
  padding-left: 0;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eaecf0;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.admin-table th {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  background: #f9fafb;
}

.admin-table td strong,
.admin-table td small {
  display: block;
}

.admin-truncate {
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.admin-badge[data-status="succeeded"],
.admin-badge[data-status="active"],
.admin-badge[data-status="visible"],
.admin-badge[data-status="restored"] {
  background: #ecfdf3;
  color: #027a48;
}

.admin-badge[data-status="failed"],
.admin-badge[data-status="disabled"],
.admin-badge[data-status="hidden"] {
  background: #fef3f2;
  color: #b42318;
}

.admin-badge[data-status="reported"],
.admin-badge[data-status="reviewing"],
.admin-badge[data-status="requested"] {
  background: #fff8db;
  color: #9a6700;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
}

.admin-grid-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-work-card {
  overflow: hidden;
}

.admin-work-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e5e7eb;
}

.admin-work-card div {
  padding: 12px;
}

.admin-work-card p {
  min-height: 40px;
  margin: 6px 0;
  color: #475467;
  font-size: 13px;
  line-height: 1.5;
}

.admin-work-card button {
  margin: 0 12px 12px;
}

.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.admin-work-card .admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}

.admin-work-card .admin-card-actions button {
  margin: 0;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-form-grid.single {
  grid-template-columns: 1fr;
}

.admin-form-grid label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.admin-form-grid textarea {
  resize: vertical;
}

.admin-check {
  display: flex !important;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 8px !important;
}

.admin-check input {
  width: 16px;
  min-height: 16px;
}

.admin-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-form-grid .danger {
  border-color: rgba(180, 35, 24, 0.45);
  color: #b42318;
}

.admin-placeholder {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.admin-placeholder > i,
.admin-auth-required > i {
  font-size: 34px;
  color: #2563eb;
}

.admin-placeholder p,
.admin-auth-required p {
  margin: 0;
  color: #667085;
  line-height: 1.6;
}

.admin-login-card {
  max-width: 440px;
  width: min(100%, 440px);
  justify-self: center;
}

.admin-login-form {
  width: 100%;
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.admin-login-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.admin-login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  color: #101828;
  background: #fff;
}

.admin-login-form button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #101828;
  color: #fff;
  font-weight: 700;
}

.admin-login-form button:disabled {
  opacity: 0.6;
}

.admin-login-error {
  min-height: 18px;
  color: #b42318;
  font-size: 13px;
}

.admin-placeholder ul {
  margin: 0;
  padding-left: 18px;
  color: #475467;
}

.admin-empty-state,
.admin-auth-required {
  min-height: 140px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: #667085;
  text-align: center;
  padding: 24px;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e4e7ec;
  box-shadow: -16px 0 40px rgba(16, 24, 40, 0.16);
  z-index: 80;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-drawer.hidden {
  display: none;
}

.admin-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid #eaecf0;
}

.admin-drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.admin-drawer-head button {
  width: 34px;
  height: 34px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
}

.admin-drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.admin-detail-list {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.admin-detail-list dt {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.admin-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-drawer-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 14px;
  background: #e5e7eb;
}

.admin-ledger-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #eaecf0;
}

.admin-ledger-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.admin-mini-table {
  display: grid;
  gap: 8px;
}

.admin-mini-table div {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 4px 10px;
  padding: 10px;
  border: 1px solid #eaecf0;
  border-radius: 8px;
}

.admin-mini-table small {
  grid-column: 2;
  color: #667085;
}

.admin-mini-table p {
  margin: 0;
  color: #667085;
}

@media (max-width: 1080px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: relative;
    height: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-stats-grid,
  .admin-grid-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-bulk-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .admin-main {
    padding: 16px;
  }

  .admin-topbar,
  .admin-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .admin-stats-grid,
  .admin-stats-grid.compact,
  .admin-grid-list,
  .admin-form-grid,
  .admin-bulk-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .works-workspace {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    padding: 18px 12px;
  }

  .works-toolbar {
    grid-template-columns: 1fr;
  }

  .works-bulk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .works-bulk-actions span {
    grid-column: 1 / -1;
  }

  .works-detail-drawer {
    inset: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 48vh) minmax(0, 1fr);
  }

  .works-detail-stage {
    padding: 14px;
  }

  .works-detail-body {
    border-left: 0;
    border-top: 1px solid rgba(226, 232, 240, 0.86);
    padding: 56px 16px 22px;
  }

  .works-detail-actions {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   exec4 P3 — 编辑器顶部「上次输出」缩略图条
   ========================================================================== */

.editor-recent-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 6px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.editor-recent-strip.hidden {
  display: none;
}

.editor-recent-title {
  flex: 0 0 auto;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.62);
  text-transform: uppercase;
  font-size: 11px;
}

.editor-recent-thumbs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-recent-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 8, 14, 0.62);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.editor-recent-thumb:hover {
  transform: translateY(-1px);
  border-color: rgba(168, 85, 247, 0.85);
}

.editor-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.editor-recent-thumb em {
  position: absolute;
  left: 4px;
  top: 4px;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 23, 42, 0.7);
  padding: 1px 6px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   exec4 P3 — 编辑器桌面工作站布局（≥ 1100px）
   ========================================================================== */

@media (min-width: 1100px) {
  /* 工具栏从顶部居中横排 → 左侧竖排 */
  .editor-toolbar {
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    padding: 10px 8px;
    gap: 8px;
    border-radius: 22px;
  }

  .editor-publish-panel {
    right: 22px;
    top: 22px;
  }

  .editor-prompt-bar {
    width: min(820px, calc(100vw - 360px));
  }

  .editor-canvas-area {
    padding-left: clamp(110px, 12vw, 160px);
    padding-top: 128px;
  }

  .editor-recent-strip {
    margin-top: 18px;
  }
}

@media (max-width: 1099px) {
  .editor-publish-panel {
    left: 18px;
    right: 18px;
    top: 88px;
    width: auto;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .editor-publish-panel div > span {
    max-width: 320px;
  }

  .editor-recent-strip {
    margin: 10px 0 0;
  }
  .editor-recent-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
  }
}

@media (max-width: 768px) {
  .editor-publish-panel {
    top: 76px;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
    border-radius: 18px;
  }

  .editor-publish-panel .square-toggle {
    min-height: 38px;
  }

  .editor-recent-strip {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* ==========================================================================
   T028 — 浅色图生图工作台与独立发布设置
   ========================================================================== */

.editor-view {
  background:
    radial-gradient(circle at 20% 12%, rgba(59, 130, 246, 0.12), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(245, 158, 11, 0.11), transparent 24%),
    linear-gradient(135deg, #f5f7fb 0%, #edf3f8 52%, #f8fafc 100%);
  color: #0f172a;
}

.editor-brand {
  color: #0f172a;
}

.editor-tabs {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(203, 213, 225, 0.95);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.editor-tabs button {
  color: #64748b;
}

.editor-tabs button.active {
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #fff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

.editor-workspace {
  border: 1px solid rgba(203, 213, 225, 0.95);
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(0deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px) 0 0 / 36px 36px,
    #eef2f7;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.9), 0 24px 60px rgba(15, 23, 42, 0.10);
}

.editor-toolbar,
.editor-zoom,
.editor-keyboard,
.editor-prompt-bar,
.editor-publish-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.92);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
}

.editor-toolbar button,
.editor-zoom button,
.editor-attach {
  color: #475569;
}

.editor-toolbar button.active {
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #fff;
}

.editor-upload-card {
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(255, 255, 255, 0.74);
  color: #64748b;
}

.editor-upload-card i {
  color: #2563eb;
}

.editor-upload-card strong {
  color: #0f172a;
}

.editor-image-scaler img {
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.20);
}

.editor-zoom span,
.editor-keyboard {
  color: #475569;
}

.editor-prompt-bar {
  background: rgba(255, 255, 255, 0.96);
}

.editor-prompt-bar > input {
  color: #0f172a;
}

.editor-prompt-bar input::placeholder {
  color: #94a3b8;
}

.editor-prompt-bar button[type="submit"] {
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #fff;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.22);
}

.editor-publish-panel {
  position: absolute;
  right: 24px;
  top: 24px;
  z-index: 7;
  width: min(300px, calc(100vw - 48px));
  border-radius: 22px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.editor-publish-panel > div {
  display: grid;
  gap: 4px;
}

.editor-publish-panel strong {
  color: #0f172a;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.editor-publish-panel > div span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.editor-public-toggle,
.editor-source-toggle {
  color: #334155;
  justify-content: space-between;
  gap: 14px;
}

@media (min-width: 1100px) {
  .editor-prompt-bar {
    width: min(780px, calc(100vw - 520px));
  }

  .editor-canvas-area {
    padding-right: clamp(330px, 26vw, 420px);
    padding-left: clamp(110px, 12vw, 160px);
    padding-top: 44px;
  }
}

@media (max-width: 1099px) {
  .editor-publish-panel {
    right: 16px;
    top: 92px;
    width: min(280px, calc(100vw - 32px));
  }

  .editor-canvas-area {
    padding-top: 128px;
  }
}

@media (max-width: 768px) {
  .editor-publish-panel {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 154px;
    width: auto;
    grid-template-columns: 1fr;
    border-radius: 20px;
    padding: 12px;
  }

  .editor-publish-panel > div {
    display: none;
  }

  .editor-canvas-area {
    padding: 104px 14px 248px;
  }

  .editor-prompt-bar {
    bottom: 70px;
  }
}

/* ==========================================================================
   Admin shell
   ========================================================================== */

.admin-body {
  min-height: 100vh;
  background: #f4f6f8;
  color: #172033;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  transition: grid-template-columns 160ms ease;
}

.admin-body.admin-sidebar-collapsed .admin-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  background: #101623;
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  color: #fff;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.admin-brand span {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #101623;
}

.admin-sidebar-toggle {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.admin-body.admin-sidebar-collapsed .admin-brand strong,
.admin-body.admin-sidebar-collapsed .admin-nav span {
  display: none;
}

.admin-body.admin-sidebar-collapsed .admin-sidebar {
  padding-inline: 12px;
  align-items: center;
}

.admin-body.admin-sidebar-collapsed .admin-sidebar-head {
  display: grid;
  justify-items: center;
}

.admin-body.admin-sidebar-collapsed .admin-brand {
  padding-inline: 0;
  justify-content: center;
}

.admin-body.admin-sidebar-collapsed .admin-nav button {
  width: 44px;
  justify-content: center;
  padding: 0;
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.admin-nav button:hover,
.admin-nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.admin-nav i {
  font-size: 17px;
}

.admin-main {
  min-width: 0;
  padding: 20px clamp(16px, 3vw, 32px) 42px;
}

.admin-topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-topbar p,
.admin-topbar h1 {
  margin: 0;
}

.admin-topbar p {
  color: #64748b;
  font-size: 13px;
}

.admin-topbar h1 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.admin-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#adminPageDescription {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

.admin-status span,
.admin-status a {
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.admin-status .ok {
  color: #047857;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.admin-status .warn {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.admin-content {
  display: grid;
  gap: 16px;
}

.admin-notice {
  margin-bottom: 14px;
  border-radius: 8px;
  padding: 12px 14px;
  color: #1e293b;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
}

.admin-notice.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.admin-code-block {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
}

.admin-temp-password {
  display: grid;
  gap: 12px;
}

.admin-temp-password p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.admin-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.admin-copy-row code {
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.admin-copy-row button {
  min-height: 38px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
  font-weight: 700;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-metrics article,
.admin-panel,
.admin-empty {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}

.admin-metrics article {
  min-height: 116px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.admin-metrics i {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: #2563eb;
  font-size: 18px;
}

.admin-metrics span {
  color: #64748b;
  font-size: 13px;
}

.admin-metrics strong {
  font-size: 24px;
  line-height: 1;
}

.admin-panel {
  min-width: 0;
  padding: 16px;
}

.admin-panel h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-panel-head button {
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  min-height: 34px;
  padding: 0 12px;
  font-weight: 650;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-search {
  flex: 1 1 320px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid #dbe3ee;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #64748b;
}

.admin-search input,
.admin-toolbar select,
.admin-table input,
.admin-table select,
.admin-inline-form input,
.admin-form-panel input,
.admin-form-panel select,
.admin-form-panel textarea {
  width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  outline: 0;
  padding: 9px 10px;
}

.admin-search input {
  border: 0;
  padding: 0;
}

.admin-toolbar select {
  width: 180px;
  min-height: 42px;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  color: #64748b;
  background: #f8fafc;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-table th,
.admin-table td {
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  padding: 10px;
  vertical-align: middle;
}

.admin-table td strong,
.admin-table td span {
  display: block;
}

.admin-table td span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.admin-cell-wide {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-badge {
  display: inline-flex !important;
  width: fit-content;
  margin: 0 !important;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px !important;
  font-weight: 750;
  color: #475569 !important;
  background: #f1f5f9;
}

.admin-badge.success {
  color: #047857 !important;
  background: #ecfdf5;
}

.admin-badge.failed {
  color: #b91c1c !important;
  background: #fef2f2;
}

.admin-badge.pending {
  color: #b45309 !important;
  background: #fffbeb;
}

.admin-badge.cancelled {
  color: #475569 !important;
  background: #f8fafc;
}

.admin-tag {
  display: inline-flex !important;
  width: fit-content;
  margin: 2px 4px 2px 0 !important;
  padding: 3px 7px;
  border-radius: 6px;
  background: #eef2ff;
  color: #4338ca !important;
  font-size: 11px !important;
}

.admin-icon-btn,
.admin-primary,
.admin-secondary,
.admin-danger {
  border: 0;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}

.admin-icon-btn {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.admin-primary {
  background: #101623;
  color: #fff;
}

.admin-secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #dbe3ee;
}

.admin-danger {
  background: #fee2e2;
  color: #991b1b;
}

.admin-primary.small,
.admin-secondary.small,
.admin-danger.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.admin-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  color: #64748b;
  font-size: 12px;
}

.admin-pager button {
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #334155;
  padding: 0 10px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 16px;
}

.admin-form-panel {
  display: grid;
  gap: 12px;
}

.admin-form-panel label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 650;
}

.admin-check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}

.admin-check input {
  width: auto;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-version-panel dl,
.admin-drawer dl {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 14px 0 0;
  font-size: 13px;
}

.admin-version-panel dt,
.admin-drawer dt {
  color: #64748b;
}

.admin-version-panel dd,
.admin-drawer dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
  color: #172033;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  width: min(480px, 100vw);
  height: 100vh;
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -20px 0 48px rgba(15, 23, 42, 0.14);
  padding: 22px;
}

.admin-drawer h2 {
  margin: 0 42px 16px 0;
  font-size: 18px;
}

.admin-drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
}

.drawer-form textarea {
  resize: vertical;
}

.admin-empty {
  min-height: 230px;
  padding: 32px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.admin-empty i {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: #2563eb;
  font-size: 22px;
}

.admin-empty h2,
.admin-empty p {
  margin: 0;
}

.admin-empty p {
  max-width: 560px;
  color: #64748b;
  line-height: 1.6;
}

.admin-empty a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  background: #101623;
  color: #fff;
  text-decoration: none;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-form-grid,
  .admin-inline-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-main {
    padding: 14px 12px 28px;
  }

  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-nav,
  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .admin-toolbar select {
    width: 100%;
  }
}

/* T016 admin shell refinements */
.admin-sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-sidebar-toggle {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.admin-body.admin-sidebar-collapsed .admin-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

.admin-body.admin-sidebar-collapsed .admin-sidebar {
  padding-inline: 12px;
  align-items: center;
}

.admin-body.admin-sidebar-collapsed .admin-sidebar-head {
  display: grid;
  justify-items: center;
}

.admin-body.admin-sidebar-collapsed .admin-brand {
  justify-content: center;
  padding-inline: 0;
}

.admin-body.admin-sidebar-collapsed .admin-brand strong,
.admin-body.admin-sidebar-collapsed .admin-nav span {
  display: none;
}

.admin-body.admin-sidebar-collapsed .admin-nav button {
  width: 44px;
  justify-content: center;
  padding: 0;
}

#adminPageDescription {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

.admin-code-block {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
}

.admin-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}

.admin-drawer.hidden {
  display: none;
}

.admin-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.36);
}

.admin-drawer-backdrop.hidden {
  display: none;
}

.admin-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.admin-drawer-head h2 {
  margin: 0;
}

.admin-drawer-head button {
  width: 34px;
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.admin-drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.admin-confirm-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.admin-confirm-layer.hidden {
  display: none;
}

.admin-confirm-card {
  width: min(420px, 100%);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  padding: 18px;
}

.admin-confirm-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 20px;
}

.admin-confirm-icon[data-danger="true"] {
  background: #fef2f2;
  color: #b42318;
}

.admin-confirm-card h2 {
  margin: 14px 0 8px;
  font-size: 18px;
}

.admin-confirm-card p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.admin-confirm-actions button {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  background: #fff;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

.admin-confirm-actions button.danger {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}

@media (max-width: 980px) {
  .admin-body.admin-sidebar-collapsed .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-body.admin-sidebar-collapsed .admin-sidebar {
    align-items: stretch;
  }

  .admin-body.admin-sidebar-collapsed .admin-brand {
    justify-content: flex-start;
    padding: 0 10px;
  }

  .admin-body.admin-sidebar-collapsed .admin-brand strong,
  .admin-body.admin-sidebar-collapsed .admin-nav span {
    display: inline;
  }

  .admin-body.admin-sidebar-collapsed .admin-nav button {
    width: 100%;
    justify-content: flex-start;
    padding: 0 12px;
  }
}
