/* =========================================================================
   AI Creative Studio — Gemini visual port
   ========================================================================= */
:root {
  --bg-base: #dce2eb;
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);

  --panel-bg: rgba(255, 255, 255, 0.55);
  --panel-bg-solid: #f8f9fa;

  --text-main: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --accent-green: #10b981;
  --accent-green-light: #d1fae5;
  --accent-purple: #8b5cf6;
  --accent-black: #1a1a1a;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --border-color: rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --ui-scale: 1.3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(circle at 15% 50%, rgba(255, 255, 255, 0.6) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(255, 255, 255, 0.5) 0%, transparent 50%);
  background-attachment: fixed;
  /* IMPORTANT: do NOT use min-height: 100vh + zoom together. `vh` is viewport-
     visual, unaffected by zoom; body min-height: 100vh forces body LOGICAL height
     to viewport visual, then zoom 1.3 makes body VISUAL = 1.3 × viewport →
     vertical scroll. Use height: calc(100vh / 1.3) so body visual matches
     viewport exactly. */
  height: calc(100vh / 1.3);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* Scale the entire UI ~30% larger while keeping every aspect ratio identical.
     `zoom` is a layout-affecting scale supported by Chromium/WebKit (the
     browsers this app targets). Fallback for Firefox via -moz-transform below. */
  zoom: 1.3;
}
@-moz-document url-prefix() {
  body {
    zoom: 1;
    transform: scale(1.3);
    transform-origin: top center;
    width: calc(100% / 1.3);
  }
}
button, input, textarea, select { font: inherit; color: inherit; }
input:focus, textarea:focus, select:focus, button:focus { outline: none; }
.visually-hidden {
  position: absolute !important;
  clip: rect(0 0 0 0);
  width: 1px; height: 1px; margin: -1px; border: 0; padding: 0; overflow: hidden;
}
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Glass base */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* =========================================================================
   APP SHELL
   ========================================================================= */
.app-shell {
  /* Preserve the original Gemini 1360:880 ≈ 1.545:1 aspect ratio.
     Drive everything from a derived shell-h: the smallest of
       (a) hard cap 1100px (sanity ceiling for very tall displays; on
           1080p/1440p monitors the viewport binds first),
       (b) available vertical room ((100vh - 10px) / 1.3) — buffer matches
           body padding (4px × 2) + 2px safety,
       (c) horizontal room ÷ ratio — so width never overflows.
     Then width = shell-h × ratio. Shell stays the same shape on any viewport. */
  --gemini-ratio: 1.5455;
  --vh-avail: calc((100vh - 10px) / 1.3);
  --vw-avail: calc((100vw - 10px) / 1.3);
  --shell-h: min(1100px, var(--vh-avail), calc(var(--vw-avail) / 1.5455));
  height: var(--shell-h);
  width: calc(var(--shell-h) * 1.5455);
  max-width: var(--vw-avail);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.8),
    0 20px 40px rgba(0, 0, 0, 0.08);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

/* =========================================================================
   TOPBAR
   ========================================================================= */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  flex: 0 0 auto;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.brand-mark {
  width: 36px;
  height: 36px;
  background: #111;
  color: #fff;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  flex: 0 0 36px;
}
.brand-text {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-text h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.brand-chip {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  color: var(--text-main);
  transition: background 140ms ease, transform 80ms ease;
}
.topbar-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.85); }
.topbar-btn:active:not(:disabled) { transform: translateY(1px); }
.topbar-btn-icon { display: inline-flex; font-size: 14px; }
.topbar-locale {
  width: 44px;
  padding: 0;
  justify-content: center;
  font-weight: 700;
}

/* =========================================================================
   WORKSPACE — 3 columns, center transparent
   ========================================================================= */
.workspace {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  /* Lock the row to workspace height so tall portrait images inside the
     canvas can't stretch the column (which would push the describe-card
     below the fold). minmax(0, 1fr) allows children to shrink below their
     intrinsic content height. */
  grid-template-rows: minmax(0, 1fr);
  gap: 24px;
  flex: 1 1 auto;
  min-height: 0;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.panel::-webkit-scrollbar { width: 0; }

/* Step header */
.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}
.step-num {
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-green);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  flex: 0 0 24px;
}

/* Sub label */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-title .see-all,
.section-title-link {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 12px;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.section-title-link:hover { color: var(--text-main); }

.sub-label,
.section-title.no-margin { margin-bottom: 0; }

/* =========================================================================
   LEFT: SETUP
   ========================================================================= */
.setup-section { display: flex; flex-direction: column; gap: 12px; }
.setup-section:first-of-type { gap: 8px; }

.upload-zone {
  border: 1.5px dashed rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 160ms ease, background 160ms ease;
}
.upload-zone:hover { border-color: rgba(139, 92, 246, 0.4); background: rgba(255, 255, 255, 0.5); }
.upload-zone input { display: none; }
.upload-icon {
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  color: #6b7280;
  margin-bottom: 4px;
}
.upload-title { font-size: 13px; font-weight: 500; }
.upload-hint { font-size: 11px; color: var(--text-muted); }

/* File item — compact strip so 5+ uploads don't push the rest of the panel down */
.source-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 2px;
}
.source-gallery::-webkit-scrollbar { width: 4px; }
.source-gallery::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 4px; }
.source-gallery.empty,
.source-gallery:empty { display: none; }

.source-thumb {
  position: relative;
  display: block;
  padding: 0;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.source-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: inherit;
  object-fit: cover;
  object-position: center center;
  display: block;
  background: linear-gradient(135deg, #f0f3f5, #d2d6db);
}
/* Hide the per-thumb filename/size metadata to keep the strip compact;
   the upload list is itself the source of truth. */
.source-thumb > div { display: none; }
.source-thumb-meta { display: none; }
.source-thumb .remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  border-radius: 5px;
  font-size: 0;
  opacity: 0;
  transition: opacity 140ms ease;
  backdrop-filter: blur(6px);
}
.source-thumb .remove-image::before {
  content: "×";
  font-size: 14px;
  line-height: 1;
}
.source-thumb:hover .remove-image { opacity: 1; }
.source-thumb .remove-image:hover { background: var(--accent-rose); }

/* Creative Style list */
.mode-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mode-card {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  cursor: pointer;
  user-select: none;
  transition: border-color 140ms ease, background 140ms ease;
}
.mode-card:hover { background: rgba(255, 255, 255, 0.65); }
.mode-card * { user-select: none; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card[hidden] { display: none !important; }
.mode-thumb {
  width: 64px;
  height: 48px;
  border-radius: 8px;
  background: #ccc;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  object-fit: cover;
  object-position: center center;
  -webkit-user-drag: none;
}
.mode-card > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mode-card strong {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}
.mode-card small {
  font-size: 11px;
  color: var(--text-muted);
}
/* Custom radio */
.mode-card::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  background: transparent;
  justify-self: end;
  display: block;
  position: relative;
}
.mode-card.is-selected,
.mode-card:has(input:checked) {
  background: rgba(240, 253, 244, 0.55);
  border-color: var(--accent-green);
}
.mode-card.is-selected::after,
.mode-card:has(input:checked)::after {
  border-color: var(--accent-purple);
  background:
    radial-gradient(circle, var(--accent-purple) 0 4px, transparent 4.5px);
}

/* =========================================================================
   CENTER — transparent, inline cards
   ========================================================================= */
.canvas-col {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  /* Cap the column at the grid row height so a portrait image inside the
     stage can't force the column to grow. */
  min-height: 0;
  overflow: hidden;
}

.status-bar {
  /* Overlay chip pinned to the top-left of the canvas-stage. Removes the
     dedicated row above the stage so the canvas fills its full column. */
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.status-bar-label {
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}
.status-bar-value { color: var(--accent-green); }
.status-bar[data-status="generating"] .status-bar-value { color: var(--accent-amber); }
.status-bar[data-status="error"]      .status-bar-value { color: var(--accent-rose); }
.status-bar[data-status="done"]       .status-bar-value { color: var(--accent-green); }

/* Canvas */
.canvas-stage {
  flex: 1 1 auto;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
  min-height: 200px;
  /* No max-height: the stage fills whatever space the canvas-col has left
     after status-bar + describe-card. The describe-card therefore sits at
     the bottom of the column. Tall result images scroll inside the gallery
     (effect-gallery has its own min-height: 0; overflow: auto). */
  display: flex;
  flex-direction: column;
}

.effect-gallery {
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px;
  overflow: auto;
  color: var(--text-main);
}
.effect-gallery.empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 32px;
}
/* effect-board no longer needs to share vertical space with the strip:
   the strip is absolutely-positioned at the bottom of the canvas-stage. */
.effect-board { display: flex; flex-direction: column; gap: 12px; height: 100%; min-height: 0; }
.effect-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  /* Reserve space so effect-main-meta and the overlaid strip don't collide:
     compact strip (~80px card + 16px padding) + 12px bottom offset + small
     buffer = ~120px. */
  padding-bottom: 120px;
}
.effect-main-media {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 220px;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
}
.effect-main-blur-bg {
  /* Same image, blurred + slightly dimmed, fills the entire stage area
     (Instagram Reels / YouTube Shorts / Douyin web pattern). Behind the
     sharp main image. Transform scale(1.15) prevents the blur fringe from
     showing at the container's edges. */
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.85) saturate(1.2);
  transform: scale(1.15);
  pointer-events: none;
}
/* The image lives inside .effect-main-frame, which is aspect-ratio-locked to
   the user's requested aspect (1:1 / 9:16 / 3:4 / 16:9 / 4:3). The frame
   chooses height:100% or width:100% per aspect so it fills the appropriate
   axis of the wide stage; the orthogonal axis is computed from aspect-ratio,
   leaving the blur backdrop visible on the empty side (portrait → left/right
   blur; landscape → top/bottom blur). object-fit: cover on the img is "show
   the platform preview crop": always fills the requested aspect, regardless
   of whether upstream returned the exact size. */
.effect-main-frame {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.25);
}
/* Portrait + square: fill the stage height; width is computed from aspect. */
.effect-main-frame[data-aspect="1:1"]  { aspect-ratio: 1 / 1;  height: 100%; }
.effect-main-frame[data-aspect="9:16"] { aspect-ratio: 9 / 16; height: 100%; }
.effect-main-frame[data-aspect="3:4"]  { aspect-ratio: 3 / 4;  height: 100%; }
/* Landscape: fill the stage width; height is computed from aspect. */
.effect-main-frame[data-aspect="16:9"] { aspect-ratio: 16 / 9; width: 100%; }
.effect-main-frame[data-aspect="4:3"]  { aspect-ratio: 4 / 3;  width: 100%; }
/* Fallback: an unknown / empty aspect defaults to 1:1 height-limited. */
.effect-main-frame:not([data-aspect="1:1"]):not([data-aspect="9:16"]):not([data-aspect="3:4"]):not([data-aspect="16:9"]):not([data-aspect="4:3"]) {
  aspect-ratio: 1 / 1; height: 100%;
}
.effect-main-frame > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  cursor: zoom-in;
}
.effect-main > .effect-card-placeholder {
  aspect-ratio: auto;
  min-height: 220px;
  height: 100%;
  width: 100%;
  border-radius: 12px;
}
.effect-main-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
  color: var(--text-main);
}
.effect-main-meta h4 { margin: 0; font-size: 13px; font-weight: 600; }
.effect-main-meta p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-secondary); }

.effect-strip {
  /* Float over the main image at the bottom of the canvas-stage so the
     image gets the full stage area. */
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.effect-strip::-webkit-scrollbar { height: 4px; }
.effect-strip::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 4px; }
.effect-card,
.effect-strip-card {
  display: grid;
  gap: 4px;
  flex: 0 0 96px;
  min-width: 96px;
  padding: 6px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
  color: var(--text-main);
  cursor: pointer;
}
.effect-card:hover:not(:disabled),
.effect-strip-card:hover:not(:disabled) { border-color: rgba(0, 0, 0, 0.2); }
.effect-card.active,
.effect-strip-card.active {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.12);
}
.effect-card.error,
.effect-strip-card.error { border-color: rgba(244, 63, 94, 0.6); background: rgba(244, 63, 94, 0.08); }
.effect-card.pending,
.effect-strip-card.pending { opacity: 0.65; cursor: progress; }
.effect-card img,
.effect-strip-card img {
  display: block; width: 100%;
  aspect-ratio: 1 / 1; object-fit: cover; object-position: center center;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
}
.effect-card-placeholder {
  display: grid; place-items: center;
  width: 100%; aspect-ratio: 1 / 1;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 10.5px;
}
.effect-card h4,
.effect-strip-card h4 {
  margin: 2px 0 0; font-size: 11px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.effect-card p,
.effect-strip-card p {
  margin: 0; font-size: 10px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Inside the floating overlay strip, keep cards image-only (titles/tags
   already appear in effect-main-meta). Error rows still show their reason. */
.effect-strip .effect-strip-card { flex: 0 0 72px; min-width: 72px; padding: 4px; }
.effect-strip .effect-strip-card h4,
.effect-strip .effect-strip-card p:not(.error-text) { display: none; }
.effect-strip .effect-strip-card .error-text {
  font-size: 9.5px; line-height: 1.2; padding: 2px 4px;
}
.effect-card .error-text,
.effect-strip-card .error-text { color: #fda4af; white-space: normal; }

/* Image actions on hover */
.canvas-image-actions {
  position: absolute;
  top: 12px; right: 12px;
  display: flex; gap: 6px; z-index: 6;
  opacity: 0;
  transition: opacity 160ms ease;
}
.effect-main-media:hover .canvas-image-actions,
.canvas-image-actions.on-image { opacity: 1; }
.canvas-image-actions:not(.on-image) { display: none; }
.image-action-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  padding: 0; border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.image-action-btn:hover:not(:disabled) { background: rgba(0, 0, 0, 0.72); }
.image-action-btn.hidden { display: none !important; }
.image-action-btn .label-text { display: none; }

/* =========================================================================
   PROMPT AREA (below canvas)
   ========================================================================= */
.describe-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.describe-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.describe-head-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.describe-head-text h3 { font-size: 14px; font-weight: 600; }
.describe-head-text p { font-size: 11px; color: var(--text-muted); }
.describe-enhance-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  cursor: pointer;
  flex: 0 0 auto;
  color: var(--text-main);
}
.describe-enhance-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.95); }
.describe-enhance-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.describe-enhance-btn .ico { font-size: 11px; color: var(--accent-purple); }

.describe-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 12px;
  min-height: 60px;
  max-height: 180px;
  font-size: 13px;
  color: var(--text-main);
  resize: none;
}
.describe-textarea::placeholder { color: var(--text-muted); }

.describe-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.describe-actions .spacer { flex: 1 1 auto; }

.add-ref-btn,
.dock-select,
.save-btn,
.dock-select-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  height: 36px;
}
.add-ref-btn:hover, .dock-select:hover, .save-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
}
.add-ref-btn input { display: none; }
.save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.dock-select-wrap { position: relative; display: inline-block; }
.dock-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 30px;
  padding-left: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'><polyline points='6 9 12 15 18 9' stroke='%234b5563' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.dock-select-wrap[data-icon="aspect"]::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px; height: 12px;
  border: 1.5px solid var(--text-secondary);
  border-radius: 2px;
  pointer-events: none;
}
.dock-select-wrap[data-icon="auto"]::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 12px; height: 12px;
  transform: translateY(-50%);
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
  color: var(--text-secondary);
  pointer-events: none;
}

.generate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #111;
  color: #fff;
  padding: 8px 16px;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 140ms ease, transform 80ms ease;
}
.generate-btn:hover:not(:disabled) { background: #1f1f23; }
.generate-btn:active:not(:disabled) { transform: translateY(1px); }
.generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.generate-btn .ico { font-size: 12px; }

/* Progress — lives inline in .describe-head, no longer adds vertical
   space at the bottom of the describe-card. */
.describe-head-progress {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 16px;
  justify-content: center;
  align-self: stretch;
}
.progress-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.progress-panel.hidden { display: none !important; }
.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-head span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-head span:last-child { color: var(--accent-green); font-weight: 600; flex: 0 0 auto; }
.progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), #059669);
  transition: width 220ms ease;
}
.status {
  /* Empty: collapses to nothing inside the head wrapper.
     With content: single-line, truncated to fit the head's horizontal space. */
  min-height: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status.error { color: var(--accent-rose); }
.status.ok { color: var(--accent-green); }

/* =========================================================================
   RIGHT PANEL — single panel, multiple step sections inside
   ========================================================================= */
.right-panel {
  /* uses .panel + .glass already */
}

.copy-tabs {
  display: flex;
  gap: 4px;
  margin-top: -4px;
}
.copy-tabs[hidden] { display: none !important; }
.copy-tab {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.copy-tab:hover { color: var(--text-secondary); }
.copy-tab.active {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-main);
}
.copy-tab .platform-mark {
  width: 14px; height: 14px; flex: 0 0 14px;
  border-radius: 4px;
  font-size: 8px;
  display: inline-grid; place-items: center;
  color: #fff;
}

.copy-grid {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 240px;
  /* Grow to absorb the slack in the right panel so step 3 (同步) and
     step 4 (发布) sit at the bottom and the copy area gets the room. */
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.copy-grid.empty {
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  border-style: dashed;
}
.copy-box { display: none; }
.copy-box.is-active { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; }
.copy-box h4 { display: none; }
.copy-box textarea {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-main);
  min-height: 208px;
  /* Grow with the now-expanded copy-grid; scroll inside if content overflows. */
  flex: 1 1 auto;
  overflow-y: auto;
}
.copy-box textarea::placeholder { color: var(--text-muted); }

.copy-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.copy-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}
.copy-action:hover:not(:disabled) { background: rgba(255, 255, 255, 0.85); }
.copy-action:disabled { opacity: 0.45; cursor: not-allowed; }
.copy-action .ico { font-size: 12px; }

/* Sync mini icons — replaces the old platform-item rows.
   Account + Post Type now live in Settings overlay. */
.sync-mini-icons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sync-mini-icon {
  position: relative;
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
  transition: border-color 140ms ease, transform 80ms ease, opacity 140ms ease;
}
.sync-mini-icon .brand-bubble {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  transition: filter 140ms ease;
}
.sync-mini-icon .brand-bubble.instagram   { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.sync-mini-icon .brand-bubble.facebook    { background: #1877F2; }
.sync-mini-icon .brand-bubble.tiktok      { background: #000; }
.sync-mini-icon .brand-bubble.x           { background: #000; }
/* Domestic platforms — 中文 logo 字 + 品牌色 */
.sync-mini-icon .brand-bubble.xiaohongshu { background: #FE2C55; font-size: 9px; letter-spacing: -0.5px; }
.sync-mini-icon .brand-bubble.weibo       { background: #E6162D; font-size: 10px; }
.sync-mini-icon .brand-bubble.douyin      { background: #000;    font-size: 10px; }
.sync-mini-icon .brand-bubble.wechat      { background: #07C160; font-size: 9px; letter-spacing: -0.5px; }
.sync-mini-icon[aria-pressed="false"] .brand-bubble { filter: grayscale(0.85) brightness(1.05); opacity: 0.55; }
.sync-mini-icon[aria-pressed="true"] {
  border-color: var(--accent-green);
  background: var(--accent-green-light);
}
.sync-mini-icon:hover:not([aria-pressed="true"]) {
  border-color: rgba(0, 0, 0, 0.1);
}
.sync-mini-icon:active { transform: scale(0.96); }
.sync-mini-icon::after {
  /* small green dot when active */
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  opacity: 0;
  transition: opacity 140ms ease;
}
.sync-mini-icon[aria-pressed="true"]::after { opacity: 1; }

/* Settings overlay: per-platform defaults */
.platform-defaults { display: grid; gap: 10px; }
.platform-default-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  background: #fff;
}
.platform-default-row .brand-bubble {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.platform-default-row .brand-bubble.instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.platform-default-row .brand-bubble.facebook  { background: #1877F2; }
.platform-default-row .brand-bubble.tiktok    { background: #000; }
.platform-default-row .brand-bubble.x         { background: #000; }
.platform-default-row .platform-name { font-size: 13px; font-weight: 600; }
.platform-default-row select {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'><polyline points='6 9 12 15 18 9' stroke='%234b5563' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Hide legacy platform-item / sync-toggle if any remain in DOM */
.platform-list, .platform-item { display: none !important; }

/* Publish CTA */
.publish-cta {
  width: 100%;
  background: #111;
  color: #fff;
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 140ms ease, transform 80ms ease;
}
.publish-cta:hover:not(:disabled) { background: #1f1f23; }
.publish-cta:active:not(:disabled) { transform: translateY(1px); }
.publish-cta:disabled { opacity: 0.45; cursor: not-allowed; }
.publish-cta .ico { font-size: 14px; }

/* ---------- Jobs overlay (queue-backed) ---------- */
.jobs-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.jobs-tabs { display: flex; gap: 4px; }
.jobs-tab {
  padding: 6px 12px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text-secondary);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.jobs-tab.active {
  background: rgba(255,255,255,0.8); color: var(--text-main);
  border-color: rgba(0,0,0,0.06);
}
.jobs-tab:hover:not(.active) { color: var(--text-main); }

.queue-job-list { display: flex; flex-direction: column; gap: 8px; }
.queue-job-list.empty {
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 12px; font-style: italic;
  padding: 32px; border: 1px dashed rgba(0,0,0,0.1); border-radius: var(--radius-md);
}
.queue-job-row {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 10px; padding: 10px 12px;
  background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.85);
  border-radius: 10px; align-items: center;
}
.queue-job-row .qj-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(0,0,0,0.05); color: var(--text-secondary);
}
.queue-job-row[data-status="queued"]    .qj-badge { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.queue-job-row[data-status="running"]   .qj-badge { background: rgba(245,158,11,0.15); color: #b45309; }
.queue-job-row[data-status="done"]      .qj-badge { background: rgba(16,185,129,0.15); color: #047857; }
.queue-job-row[data-status="failed"]    .qj-badge { background: rgba(244,63,94,0.15);  color: #b91c1c; }
.queue-job-row[data-status="cancelled"] .qj-badge { background: rgba(107,114,128,0.15); color: #4b5563; }
.queue-job-row .qj-meta { font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; }
.queue-job-row .qj-title { font-size: 13px; font-weight: 600; color: var(--text-main); }
.queue-job-row .qj-actions { display: flex; gap: 6px; }
.queue-job-row .qj-btn {
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.08); background: #fff;
  color: var(--text-secondary);
}
.queue-job-row .qj-btn:hover:not(:disabled) { color: var(--text-main); background: rgba(255,255,255,0.95); }
.queue-job-row .qj-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.queue-job-row .qj-btn.danger { color: var(--accent-rose); }

.legacy-jobs-details { margin-top: 16px; }
.legacy-jobs-details summary {
  cursor: pointer; padding: 8px 0; font-size: 12px; color: var(--text-muted);
}
.legacy-jobs-details[open] summary { color: var(--text-secondary); }

/* ---------- Schedule panel (定时发布) ---------- */
.schedule-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  margin-top: 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
}
.schedule-datetime {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  font-size: 13px;
}
.schedule-actions { display: flex; gap: 8px; justify-content: flex-end; }
.schedule-secondary,
.schedule-primary {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.schedule-secondary { background: #fff; color: var(--text-secondary); }
.schedule-primary {
  background: var(--accent-black);
  color: #fff;
  border-color: transparent;
}
.schedule-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.schedule-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.schedule-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  background: none;
  border: 0;
  width: 100%;
}
.schedule-link:hover { color: var(--text-main); }
.schedule-left { display: flex; align-items: center; gap: 6px; }
.schedule-link .ico { font-size: 13px; }

.publish-notes summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
}
.publish-notes summary::before {
  content: "▾";
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 140ms ease;
}
.publish-notes[open] summary::before { transform: rotate(-180deg); }
.publish-notes textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  resize: vertical;
  min-height: 60px;
}

/* Hidden compat */
.publish-targets,
#publishDraftSelect { display: none !important; }
.draft-select-trigger,
.draft-select-menu { display: none !important; }
.publish-now { display: none !important; }

/* Platform mark (used in copy tabs) */
.platform-mark {
  display: inline-grid; place-items: center;
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
}
.platform-mark.instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.platform-mark.facebook  { background: #1877F2; }
.platform-mark.tiktok    { background: #000; }
.platform-mark.x         { background: #000; }

/* =========================================================================
   OVERLAYS
   ========================================================================= */
.app-overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 17, 25, 0.45);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: calc(40px / var(--ui-scale));
}
.app-overlay-backdrop[hidden] { display: none; }
.app-overlay {
  background: #fff;
  border-radius: 24px;
  width: min(900px, calc((100vw - 48px) / var(--ui-scale)));
  max-height: calc((100dvh - 48px) / var(--ui-scale));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
.app-overlay[hidden] { display: none; }
.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.overlay-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.overlay-head-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.overlay-head-title .panel-step {
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.overlay-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.oauth-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.platform-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 72px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.platform-tile-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.platform-tile-tiktok    { background: #111; }
.platform-tile-facebook  { background: #1877F2; }
.platform-tile-x         { background: #000; }
.platform-tile:disabled, .platform-tile[data-locked="true"] { opacity: 0.4; cursor: not-allowed; }
.platform-tile .platform-mark { background: rgba(255, 255, 255, 0.2); width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; font-size: 11px; }

.account-add {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  background: #fafafb;
  padding: 14px;
}
.account-add summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}
.manual-account {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  margin-top: 12px;
}
.manual-account input, .manual-account select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}
.manual-account button {
  grid-column: 1 / -1;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.muted { font-size: 12px; color: var(--text-muted); }
.muted-tip {
  margin: -4px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.account-list, .draft-list, .publish-job-list {
  display: grid;
  gap: 10px;
}
.account-list.empty, .draft-list.empty, .publish-job-list.empty {
  display: grid;
  place-items: center;
  min-height: 80px;
  border: 1px dashed rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
  background: #fafafb;
  color: var(--text-muted);
  font-size: 13px;
}
.account-card, .publish-job, .draft {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.account-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.account-meta h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.account-meta p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-muted); }
.account-actions { display: flex; gap: 6px; }
.account-actions button, .account-actions a.button-link {
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-green-light);
  color: #047857;
  font-size: 11px;
  font-weight: 700;
}

.publish-job h4 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 4px;
  font-size: 13.5px; font-weight: 600;
}
.publish-job p { margin: 4px 0; font-size: 12px; color: var(--text-muted); }
.publish-job textarea {
  width: 100%; margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  resize: vertical;
  min-height: 60px;
}
.job-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.job-actions button, .job-actions a.button-link {
  height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
}
.warning { color: var(--accent-amber) !important; }

.drafts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.drafts-grid .draft-list { display: contents; }
.draft { display: flex; flex-direction: column; gap: 6px; }
.draft img {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
  object-position: center center;
  border-radius: 10px;
  background: #f0f3f5;
}
.draft h3 { margin: 4px 0 0; font-size: 13.5px; font-weight: 600; }
.draft p { margin: 0; font-size: 11.5px; color: var(--text-muted); }
.draft a { color: var(--accent-purple); font-size: 12px; }
.draft-actions { display: flex; gap: 6px; margin-top: 6px; }
.draft-action {
  flex: 1;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.draft-action-use { background: #111; color: #fff; border-color: #111; }
.draft-action-delete { color: var(--accent-rose); border-color: #fecaca; }
.draft-action-delete:hover { background: #fef2f2; }

#draftCount {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-green-light);
  color: #047857;
  font-size: 11px;
  font-weight: 700;
}

/* =========================================================================
   LIGHTBOX
   ========================================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: calc(40px / var(--ui-scale));
  background: rgba(15, 17, 25, 0.78);
  backdrop-filter: blur(6px);
}
.lightbox.hidden { display: none; }
.lightbox img {
  display: block;
  max-width: min(1180px, calc(92vw / var(--ui-scale)));
  max-height: calc((100dvh - 112px) / var(--ui-scale));
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
.lightbox p { margin: 12px 0 0; color: #fff; font-size: 13px; }
.lightbox-close {
  position: fixed;
  top: 20px; right: 20px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.image-clickable { cursor: zoom-in; }
.hidden { display: none !important; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1400px) {
  .app-shell { height: calc(100vh - 40px); }
  .workspace { grid-template-columns: 300px 1fr 300px; gap: 16px; }
}
@media (max-width: 1100px) {
  .app-shell { height: auto; min-height: calc(100vh - 40px); }
  .workspace { grid-template-columns: 1fr; }
  .canvas-stage { min-height: 360px; }
}
@media (max-width: 720px) {
  body { padding: 8px; }
  .app-shell { padding: 16px; gap: 14px; border-radius: 20px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .workspace { gap: 12px; }
}

/* =========================================================================
   USER CHIP (topbar right) — email + today's quota + logout
   ========================================================================= */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}
.user-quota {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border-radius: 10px;
}
.user-quota.warn  { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }
.user-quota.over  { background: rgba(244, 63, 94, 0.12);  color: var(--accent-rose); }
.user-email {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-logout {
  padding: 6px 12px;
  font-size: 12px;
}
