:root {
  --bg: #0e0e10;
  --bg-surface: #18181b;
  --bg-elevated: #1e1e22;
  --bg-hover: #26262c;
  --border: #2e2e35;
  --border-focus: #5a5a70;
  --text: #e8e8f0;
  --text-muted: #888898;
  --text-dim: #555565;
  --accent: #7c6aff;
  --accent-hover: #9080ff;
  --accent-dim: rgba(124,106,255,0.12);
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.1);
  --yellow: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.logo svg { color: var(--accent); flex-shrink: 0; }

nav { padding: 10px 8px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all .15s;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item svg { flex-shrink: 0; }
.nav-item[data-view="guide"]:not(.nav-guide-priority) { display: none; }
.nav-guide-priority {
  border: 1px solid rgba(124,106,255,.28);
  background: rgba(124,106,255,.09);
  color: #c4b5fd;
  margin-bottom: 10px;
}
.nav-guide-priority::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  margin-left: auto;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.45);
  animation: guideNavPulse 1.9s ease-out infinite;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.provider-badge {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

/* ── MAIN ── */
.main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  height: 100%;
}
.view.active { display: flex; }

/* ── WRITE VIEW ── */
#view-write {
  flex-direction: row;
}

.pane-left {
  width: 340px;
  min-width: 340px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 16px;
  background: var(--bg-surface);
}
.pane-left::-webkit-scrollbar { width: 4px; }
.pane-left::-webkit-scrollbar-track { background: transparent; }
.pane-left::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.pane-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.pane-right {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── FORMS ── */
.form-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }

.form-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}
.form-label.required::after { content: ' *'; color: var(--accent); }

.input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
  appearance: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-dim); }

.textarea { min-height: 68px; resize: vertical; line-height: 1.5; }
.btn-save.mini {
  padding: 5px 9px;
  font-size: 12px;
}
.keypool-textarea.masked-keypool {
  -webkit-text-security: disc;
  letter-spacing: 1px;
}
.keypool-textarea.masked-keypool::placeholder {
  -webkit-text-security: none;
  letter-spacing: 0;
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}
.check-row b { display: block; font-weight: 600; }
.check-row small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}
.image-option-grid { margin-top: 10px; }
.project-section {
  background: rgba(124,106,255,.06);
  border: 1px solid rgba(124,106,255,.18);
  border-radius: 8px;
  padding: 12px;
}
.project-create-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.toggle-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.toggle-btn {
  flex: 1;
  padding: 7px 8px;
  font-size: 12.5px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}
.toggle-btn.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.toggle-btn:hover:not(.active) { background: var(--bg-hover); color: var(--text); }

/* ── GENERATE BUTTON ── */
.btn-generate {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .15s;
  margin-top: 4px;
  letter-spacing: -0.01em;
}
.btn-generate:hover { background: var(--accent-hover); }
.btn-generate:disabled { opacity: .5; cursor: not-allowed; }
.btn-generate #btnIcon { font-size: 16px; }

.error-msg {
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--red);
  line-height: 1.5;
}

/* ── OUTPUT AREA ── */
.error-summary b {
  display: block;
  margin-bottom: 4px;
  color: #fecaca;
  font-size: 13px;
}
.error-summary span {
  display: block;
  margin-bottom: 6px;
  color: #fca5a5;
}
.error-summary ul {
  margin: 6px 0 8px;
  padding-left: 17px;
}
.error-summary details {
  margin-top: 8px;
  border-top: 1px solid rgba(239,68,68,.2);
  padding-top: 7px;
}
.error-summary summary {
  cursor: pointer;
  color: #fecaca;
  font-weight: 700;
}
.error-summary pre {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0,0,0,.22);
  color: #fecaca;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stats-row {
  display: flex;
  gap: 16px;
}
.stat-item { text-align: center; }
.stat-num { font-size: 17px; font-weight: 600; color: var(--text); }
.stat-lbl { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }

.action-btns { display: flex; gap: 8px; }
.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}
.btn-action:hover { border-color: var(--border-focus); color: var(--text); }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  flex-shrink: 0;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: all .15s;
  font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

.tab-panel { display: none; flex: 1; overflow-y: auto; }
.tab-panel.active { display: block; }
.tab-panel::-webkit-scrollbar { width: 4px; }
.tab-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.code-output {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c9d1d9;
}

.preview-box {
  padding: 24px 28px;
  line-height: 1.75;
  font-size: 15px;
  color: var(--text);
  max-width: 740px;
}
.preview-box h1 { font-size: 26px; font-weight: 700; margin-bottom: 16px; color: #f0f0ff; }
.preview-box h2 { font-size: 20px; font-weight: 600; margin: 24px 0 10px; color: #d8d8f0; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.preview-box h3 { font-size: 16px; font-weight: 600; margin: 18px 0 8px; color: #c0c0e0; }
.preview-box p { margin-bottom: 12px; }
.preview-box ul, .preview-box ol { padding-left: 22px; margin-bottom: 12px; }
.preview-box li { margin-bottom: 5px; }
.preview-box strong { color: #e0e0ff; }
.preview-box table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.preview-box th, .preview-box td { border: 1px solid var(--border); padding: 8px 12px; font-size: 14px; }
.preview-box th { background: var(--bg-elevated); font-weight: 600; }

/* META */
.meta-block { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.meta-row {}
.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.char-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}
.char-badge.good { background: var(--green-dim); color: var(--green); }
.char-badge.warn { background: rgba(245,158,11,.12); color: var(--yellow); }
.meta-val {
  font-family: var(--font);
  font-size: 13.5px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}
.btn-copy-small {
  margin-top: 6px;
  padding: 4px 12px;
  font-size: 11.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
}
.btn-copy-small:hover { color: var(--text); border-color: var(--border-focus); }

/* ── EMPTY & LOADING ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
  color: var(--text-dim);
}
.empty-icon {
  font-size: 40px;
  opacity: .25;
  color: var(--accent);
}
.empty-state p { font-size: 14px; text-align: center; line-height: 1.6; }
.empty-state strong { color: var(--text-muted); }

.loading-state {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  overflow: hidden;
  isolation: isolate;
}
.loading-state > *:not(.loading-aurora) {
  position: relative;
  z-index: 1;
}
.loading-aurora {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(56, 189, 248, .14), transparent 24%),
    radial-gradient(circle at 78% 28%, rgba(250, 204, 21, .10), transparent 22%),
    radial-gradient(circle at 48% 78%, rgba(34, 197, 94, .10), transparent 24%);
  opacity: .9;
  animation: auroraDrift 8s ease-in-out infinite alternate;
}
.loading-aurora::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 38%, rgba(255,255,255,.055) 46%, transparent 56% 100%);
  transform: translateX(-70%);
  animation: loadingScan 2.6s ease-in-out infinite;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { font-size: 14px; color: var(--text-muted); }

.progress-mascot {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 18px 28px rgba(124, 58, 237, .22));
  animation: mascotFloat 2.4s ease-in-out infinite;
}
.mascot-body {
  position: relative;
  width: 70px;
  height: 62px;
  border-radius: 24px 24px 28px 28px;
  background:
    radial-gradient(circle at 30% 18%, rgba(255,255,255,.45), transparent 24px),
    linear-gradient(145deg, #a78bfa, #38bdf8);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: inset 0 -8px 18px rgba(15, 23, 42, .16);
}
.mascot-body::before,
.mascot-body::after {
  content: '';
  position: absolute;
  top: 19px;
  width: 14px;
  height: 22px;
  border-radius: 999px;
  background: inherit;
  opacity: .95;
}
.mascot-body::before { left: -8px; transform: rotate(-18deg); }
.mascot-body::after { right: -8px; transform: rotate(18deg); }
.mascot-face {
  position: absolute;
  top: 22px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
}
.mascot-eye {
  width: 7px;
  height: 10px;
  border-radius: 999px;
  background: #101827;
  animation: mascotBlink 3.2s infinite;
}
.mascot-cheeks {
  position: absolute;
  left: 13px;
  right: 13px;
  top: 35px;
  height: 8px;
  background:
    radial-gradient(circle at left center, rgba(244, 114, 182, .68) 0 5px, transparent 6px),
    radial-gradient(circle at right center, rgba(244, 114, 182, .68) 0 5px, transparent 6px);
}
.mascot-mouth {
  position: absolute;
  left: 31px;
  top: 35px;
  width: 10px;
  height: 6px;
  border-bottom: 2px solid rgba(16, 24, 39, .82);
  border-radius: 0 0 999px 999px;
}
.mascot-badge {
  position: absolute;
  right: 1px;
  bottom: 4px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #10131b;
  border: 1px solid rgba(255,255,255,.14);
  font-size: 18px;
  animation: badgePop 1.3s ease-in-out infinite;
}
.mascot-sparkle {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #facc15;
  box-shadow: 0 0 16px rgba(250, 204, 21, .65);
  animation: sparklePulse 1.8s ease-in-out infinite;
}
.sparkle-a { left: 4px; top: 12px; }
.sparkle-b { right: 10px; top: 0; animation-delay: .55s; transform: scale(.72); }
.loading-mood {
  margin-top: -8px;
  font-size: 12.5px;
  color: #a78bfa;
  min-height: 18px;
  text-align: center;
}
.loading-type {
  min-height: 20px;
  padding: 5px 10px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 999px;
  background: rgba(15, 23, 42, .46);
  color: #cbd5e1;
  font-size: 12px;
  overflow: hidden;
}
.loading-type::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 999px;
  background: currentColor;
  animation: typingPulse .9s steps(2, end) infinite;
}
.progress-mascot.stage-serp .mascot-body { background: radial-gradient(circle at 30% 18%, rgba(255,255,255,.45), transparent 24px), linear-gradient(145deg, #38bdf8, #6366f1); }
.progress-mascot.stage-outline .mascot-body { background: radial-gradient(circle at 30% 18%, rgba(255,255,255,.45), transparent 24px), linear-gradient(145deg, #f59e0b, #8b5cf6); }
.progress-mascot.stage-writing .mascot-body { background: radial-gradient(circle at 30% 18%, rgba(255,255,255,.45), transparent 24px), linear-gradient(145deg, #a78bfa, #ec4899); }
.progress-mascot.stage-merge .mascot-body { background: radial-gradient(circle at 30% 18%, rgba(255,255,255,.45), transparent 24px), linear-gradient(145deg, #22c55e, #14b8a6); }
.progress-mascot.stage-image .mascot-body { background: radial-gradient(circle at 30% 18%, rgba(255,255,255,.45), transparent 24px), linear-gradient(145deg, #fb7185, #facc15); }
.loading-scene {
  position: relative;
  width: min(420px, 84%);
  height: 54px;
  margin-top: -6px;
}
.scene-card {
  position: absolute;
  top: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(15, 23, 42, .72);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(2, 6, 23, .18);
  animation: sceneFloat 3s ease-in-out infinite;
}
.scene-serp { left: 4%; animation-delay: 0s; }
.scene-outline { left: 28%; animation-delay: .35s; }
.scene-copy { right: 28%; animation-delay: .7s; }
.scene-image { right: 4%; animation-delay: 1.05s; }
.loading-scene.stage-serp .scene-serp,
.loading-scene.stage-outline .scene-outline,
.loading-scene.stage-writing .scene-copy,
.loading-scene.stage-merge .scene-copy,
.loading-scene.stage-image .scene-image {
  color: #fff;
  border-color: rgba(167, 139, 250, .55);
  background: rgba(124, 58, 237, .24);
  transform: translateY(-8px);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .08), 0 16px 30px rgba(2, 6, 23, .26);
}
.loading-scene.stage-writing .scene-copy::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-left: 5px;
  border-radius: 999px;
  background: currentColor;
  animation: typingPulse .9s steps(2, end) infinite;
}
@keyframes mascotFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-8px) rotate(1deg); }
}
@keyframes mascotBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(.12); }
}
@keyframes badgePop {
  0%, 100% { transform: translateY(0) rotate(-4deg) scale(1); }
  50% { transform: translateY(-4px) rotate(5deg) scale(1.06); }
}
@keyframes sparklePulse {
  0%, 100% { opacity: .35; transform: scale(.65); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes sceneFloat {
  0%, 100% { translate: 0 0; opacity: .72; }
  50% { translate: 0 -7px; opacity: 1; }
}
@keyframes typingPulse {
  0%, 100% { opacity: .25; transform: scaleX(.45); }
  50% { opacity: 1; transform: scaleX(1); }
}
@keyframes auroraDrift {
  0% { transform: scale(1) translate3d(-1%, -1%, 0); filter: hue-rotate(0deg); }
  100% { transform: scale(1.06) translate3d(1.5%, 1%, 0); filter: hue-rotate(14deg); }
}
@keyframes loadingScan {
  0% { transform: translateX(-75%); opacity: 0; }
  28% { opacity: 1; }
  72% { opacity: .7; }
  100% { transform: translateX(75%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-mascot,
  .mascot-eye,
  .mascot-badge,
  .mascot-sparkle,
  .scene-card,
  .loading-aurora,
  .loading-aurora::after,
  .loading-type::after,
  .spinner {
    animation: none !important;
  }
}

.progress-bar-wrap {
  width: 200px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
  width: 0;
}

/* ── SAVED VIEW ── */
#view-saved {
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.view-header h2 { font-size: 18px; font-weight: 600; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .15s;
}
.file-item:hover { border-color: var(--border-focus); }
.file-icon { color: var(--accent); flex-shrink: 0; }
.file-info { flex: 1; }
.file-name { font-size: 13.5px; font-weight: 500; }
.file-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.file-actions { display: flex; gap: 6px; }
.btn-sm {
  padding: 4px 10px;
  font-size: 11.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
}
.btn-sm:hover { color: var(--text); }
.btn-sm.danger:hover { color: var(--red); border-color: rgba(239,68,68,.4); }

/* ── SETTINGS VIEW ── */
#view-settings {
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}
.settings-card { max-width: 560px; display: flex; flex-direction: column; gap: 0; }
#view-projects {
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}
.projects-page {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 16px;
}
.projects-panel {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.projects-panel h3 { color: var(--text); margin: 0 0 14px; }
.projects-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.projects-panel-head p { color: var(--text-muted); margin-top: 4px; font-size: 13px; }
.project-total {
  border: 1px solid rgba(139,92,246,.32);
  background: rgba(139,92,246,.12);
  color: #c4b5fd;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.project-tree { display: grid; gap: 10px; }
.project-node { margin-left: calc(var(--depth) * 20px); animation: toolCardIn .32s ease both; }
.project-node-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #2a2d3a;
  background: #171922;
  border-radius: 8px;
  padding: 12px;
}
.project-node-main b { display: block; color: #fff; margin-bottom: 4px; }
.project-node-main span,
.project-node-main em,
.project-empty { display: block; color: #aab0c4; font-size: 12px; line-height: 1.55; }
.project-node-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.project-children {
  margin-top: 10px;
  border-left: 1px dashed rgba(139,92,246,.3);
  padding-left: 10px;
}
.tool-animated,
.bulk-page,
.guide-page,
.settings-card,
.saved-toolbar,
.pane-left { position: relative; }
.tool-motion-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .45;
  overflow: hidden;
}
.tool-motion-bg i {
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  border: 1px solid rgba(139,92,246,.18);
  animation: toolDrift 9s ease-in-out infinite;
}
.tool-motion-bg i:nth-child(1) { top: -70px; right: -45px; }
.tool-motion-bg i:nth-child(2) { bottom: -80px; left: 18%; animation-delay: 1.6s; }
.tool-motion-bg i:nth-child(3) { width: 90px; height: 90px; top: 46%; right: 18%; animation-delay: 3s; }
.form-section,
.bulk-panel,
.saved-bulk-actions,
.settings-section,
.guide-panel,
.projects-panel { animation: toolCardIn .32s ease both; }
.btn-generate,
.bulk-primary,
.btn-save,
.btn-action { transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease; }
.btn-generate:hover,
.bulk-primary:hover,
.btn-save:hover,
.btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
@keyframes toolDrift {
  0%, 100% { transform: translate3d(0,0,0) scale(1); opacity: .28; }
  50% { transform: translate3d(-12px,10px,0) scale(1.08); opacity: .55; }
}
@keyframes toolCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.settings-section {
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}
.settings-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.settings-hint { font-size: 12.5px; color: var(--text-dim); margin-bottom: 10px; }
.settings-hint a { color: var(--accent); text-decoration: none; }
.btn-save {
  margin-top: 10px;
  padding: 7px 16px;
  background: var(--accent-dim);
  border: 1px solid rgba(124,106,255,.3);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: all .15s;
}
.btn-save:hover { background: rgba(124,106,255,.2); }
.settings-note {
  padding: 14px;
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.settings-note strong { color: var(--yellow); }
.settings-note code {
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s;
  pointer-events: none;
  z-index: 999;
  max-width: 300px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(34,197,94,.35); color: var(--green); }
.toast.error { border-color: rgba(239,68,68,.35); color: var(--red); }
.toast.warning { border-color: rgba(245,158,11,.45); color: #fbbf24; }

select option { background: #1e1e22; }


#openrouterStatus {
  color: #a78bfa;
  line-height: 1.5;
}


.api-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.btn-save.secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  color: #cbd5e1;
}
.api-status {
  margin-top: 8px;
  line-height: 1.5;
}
.api-status.ok {
  color: #22c55e !important;
}
.api-status.bad {
  color: #f87171 !important;
}


/* ─────────────────────────────────────────────────────────────
   SEO Writer Pro v1.1 Commercial UI Fixes
   ───────────────────────────────────────────────────────────── */
html, body, .app { height: 100%; overflow: hidden; }
.main, .view.active, #view-write { height: 100vh; min-height: 0; overflow: hidden; }
.pane-left { height: 100vh; overflow-y: auto; padding-bottom: 72px; }
.pane-right { height: 100vh; min-height: 0; overflow: hidden; }
#outputArea { height: 100%; min-height: 0; overflow: hidden; }
.output-header, .tabs { flex: 0 0 auto; }
.tab-panel { min-height: 0; overflow-y: auto; max-height: calc(100vh - 180px); padding-bottom: 80px; }
.code-output { white-space: pre-wrap; overflow: visible; max-height: none; }

.pro-provider-card { border: 1px solid rgba(139,92,246,.28); background: rgba(139,92,246,.08); }
.model-refresh { margin-top: 8px; width: 100%; justify-content: center; }
.research-inputs textarea { min-height: 96px; }

.preview-box {
  background: linear-gradient(180deg, #fefefe 0%, #f9fafb 100%) !important;
  color: #1f2937 !important;
  border-radius: 16px;
  padding: 44px 48px;
  line-height: 1.82;
  font-size: 16px;
  box-shadow: 0 4px 6px rgba(0,0,0,.04), 0 12px 32px rgba(15,23,42,.1), 0 1px 3px rgba(0,0,0,.06);
  max-width: 920px;
  margin: 0 auto 80px;
  overflow: visible !important;
  position: relative;
}
.preview-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, #8b5cf6, #a78bfa, #c4b5fd);
  border-radius: 16px 16px 0 0;
}
.preview-box article { color: #1f2937 !important; }
.preview-box h1,
.preview-box h2,
.preview-box h3 {
  color: #111827 !important;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.preview-box h1 {
  font-size: 36px;
  margin: 0 0 24px;
  letter-spacing: -0.025em;
}
.preview-box h2 {
  font-size: 24px;
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e5e7eb;
  position: relative;
}
.preview-box h2::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 60px;
  height: 2px;
  background: #8b5cf6;
  border-radius: 2px;
}
.preview-box h3 {
  font-size: 19px;
  margin: 28px 0 12px;
  color: #1e293b !important;
}
.preview-box p { margin: 12px 0 16px; color: #374151 !important; }
.preview-box strong,
.preview-box b {
  color: #0f172a !important;
  font-weight: 800;
  background: linear-gradient(180deg, transparent 58%, rgba(139,92,246,.18) 58%);
  padding: 0 2px;
  border-radius: 2px;
}
.preview-box em { color: #4b5563 !important; }
.preview-box a { color: #6d28d9 !important; text-decoration: none; border-bottom: 1.5px solid rgba(139,92,246,.35); transition: border-color .15s; }
.preview-box a:hover { border-bottom-color: #8b5cf6; }
.preview-box ul,
.preview-box ol {
  margin: 14px 0 20px;
  padding-left: 28px;
  color: #374151 !important;
}
.preview-box li {
  margin: 8px 0;
  padding-left: 4px;
}
.preview-box li::marker { color: #8b5cf6; }
.preview-box table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 22px 0;
  color: #1f2937 !important;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.preview-box th,
.preview-box td { padding: 12px 16px; vertical-align: top; text-align: left; }
.preview-box th {
  background: #fff;
  color: #0f172a !important;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 2px solid #e2e8f0;
}
.preview-box td { border-bottom: 1px solid #f1f5f9; font-size: 15px; }
.preview-box tr:last-child td { border-bottom: none; }
.preview-box tr:hover td { background: #fff; }
.preview-box blockquote {
  border-left: 3px solid #8b5cf6;
  background: #f5f3ff;
  padding: 14px 18px;
  margin: 20px 0;
  color: #4c1d95;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}
.preview-box .seo-ai-image {
  margin: 20px 0 28px;
}
.preview-box .seo-ai-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  background: #f8fafc;
}
.preview-box .seo-ai-image figcaption {
  margin-top: 10px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

#tab-research .meta-val,
#tab-research .code-output { white-space: pre-wrap; line-height: 1.65; }
.api-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.api-status.ok { color: #22c55e; }
.api-status.bad { color: #f87171; }
.btn-save.secondary { opacity: .9; background: transparent; border: 1px solid rgba(255,255,255,.18); }
.provider-card,
.ai-provider-box,
.provider-box {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.provider-toggle,
.provider-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.provider-toggle .toggle-btn,
.provider-tabs .toggle-btn {
  flex: 1;
  height: 38px;
  border-radius: 10px;
}

#openrouterModels,
#openrouterModel,
#aiModel {
  width: 100%;
  height: 36px;
  border-radius: 8px;
}

.model-sync-btn,
#refreshModelsBtn {
  width: 100%;
  height: 38px;
  margin-top: 10px;
  border-radius: 10px;
}

.provider-desc,
.provider-hint,
.ai-provider-hint {
  display: none !important;
}
/* ─── Real section progress UI ─────────────────────────────────────────────── */
.progress-detail {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: min(620px, 90%);
  margin-top: 8px;
  gap: 12px;
}
.progress-detail #loadingDetail {
  flex: 1;
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-detail #loadingPercent {
  flex-shrink: 0;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 700;
}
.progress-line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(620px, 90%);
  margin-top: 14px;
}
.progress-line .progress-bar-wrap {
  flex: 1;
}
.loading-percent {
  min-width: 44px;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 700;
  text-align: right;
}
.progress-steps {
  width: min(620px, 90%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 10px;
  color: #94a3b8;
  font-size: 13px;
  background: rgba(15, 23, 42, .35);
}
.progress-step span {
  color: #64748b;
  font-weight: 800;
}
.progress-step.active {
  color: #fff;
  border-color: rgba(139, 92, 246, .65);
  background: rgba(139, 92, 246, .16);
}
.progress-step.active span {
  color: #a78bfa;
}
.progress-step.done {
  color: #cbd5e1;
  border-color: rgba(34, 197, 94, .35);
  background: rgba(34, 197, 94, .10);
}
.progress-step.done span {
  color: #22c55e;
}

/* Export buttons / saved file actions */
.action-btns { flex-wrap: wrap; gap: 8px; }
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.file-name { font-weight: 700; }
.file-meta { word-break: break-word; }

/* Bulk writer dashboard */
.bulk-page {
  height: 100%;
  overflow-y: auto;
  padding: 18px;
}
.bulk-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, .16);
  background: linear-gradient(135deg, rgba(17,24,39,.95), rgba(24,24,32,.95));
  border-radius: 8px;
  margin-bottom: 14px;
}
.bulk-kicker {
  color: #a78bfa;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.bulk-hero h2 {
  margin: 0;
  font-size: 24px;
  color: #fff;
  letter-spacing: 0;
}
.bulk-hero p,
.bulk-panel-head p {
  margin: 6px 0 0;
  color: #9ca3af;
  font-size: 13px;
  line-height: 1.5;
}
.bulk-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.bulk-primary {
  width: auto;
  min-width: 132px;
  margin: 0;
  height: 38px;
  padding: 0 18px;
}
.bulk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 14px;
  align-items: start;
}
.bulk-panel {
  background: #111217;
  border: 1px solid #272936;
  border-radius: 8px;
  padding: 16px;
}
.bulk-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.bulk-panel-head.compact { margin-bottom: 10px; }
.bulk-panel h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 15px;
  letter-spacing: 0;
}
.bulk-count-pill,
.bulk-status-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(139, 92, 246, .35);
  border-radius: 999px;
  color: #c4b5fd;
  background: rgba(139, 92, 246, .12);
  font-size: 12px;
  font-weight: 700;
}
.bulk-keywords-input {
  min-height: 310px !important;
  font-family: Consolas, "SFMono-Regular", monospace;
  line-height: 1.6;
}
.bulk-keyword-tools,
.bulk-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.bulk-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.bulk-cost-note {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(34, 197, 94, .22);
  background: rgba(34, 197, 94, .08);
  border-radius: 8px;
}
.bulk-cost-note b {
  display: block;
  color: #bbf7d0;
  font-size: 13px;
  margin-bottom: 3px;
}
.bulk-cost-note span {
  display: block;
  color: #a7b0c4;
  font-size: 12px;
  line-height: 1.45;
}
.bulk-estimate-card {
  margin-top: 12px;
  border: 1px solid rgba(56, 189, 248, .26);
  background: rgba(14, 165, 233, .07);
  border-radius: 8px;
  padding: 12px;
}
.bulk-estimate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.bulk-estimate-head b {
  color: #e0f2fe;
  font-size: 13px;
}
.bulk-estimate-head span {
  color: #93c5fd;
  font-size: 12px;
}
.bulk-estimate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.bulk-estimate-grid div {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, .16);
  background: rgba(15, 17, 23, .72);
  border-radius: 8px;
  padding: 9px;
}
.bulk-estimate-grid span {
  display: block;
  color: #94a3b8;
  font-size: 11px;
  margin-bottom: 4px;
}
.bulk-estimate-grid strong {
  display: block;
  color: #fff;
  font-size: 15px;
  line-height: 1.2;
  word-break: break-word;
}
.bulk-estimate-detail {
  margin-top: 9px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.45;
}
.btn-action.danger-soft {
  border-color: rgba(239, 68, 68, .28);
  color: #fca5a5;
}
.bulk-status-panel {
  margin-top: 14px;
}
.bulk-status-panel #bulkMessage {
  max-width: 780px;
}
.bulk-progress-wrap {
  height: 10px;
  background: #202230;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0;
}
.bulk-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #8b5cf6);
  width: 0%;
  transition: width .25s ease;
}
.bulk-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.bulk-stat {
  background: #171922;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  padding: 11px;
}
.bulk-stat b {
  display: block;
  color: #fff;
  font-size: 21px;
  line-height: 1;
}
.bulk-stat span {
  display: block;
  margin-top: 6px;
  color: #8b90a5;
  font-size: 12px;
}
.bulk-current-card {
  background: #10131b;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  position: relative;
  overflow: hidden;
}
.bulk-current-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(139, 92, 246, .10), transparent);
  transform: translateX(-100%);
  animation: bulkCardSweep 2.8s ease-in-out infinite;
  pointer-events: none;
}
.bulk-current-card b {
  display: block;
  color: #fff;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}
.bulk-current-step {
  color: #c4b5fd;
  font-weight: 800;
  position: relative;
  z-index: 1;
}
.bulk-current-meta {
  color: #aab0c4;
  font-size: 12px;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}
.bulk-live-visual {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.bulk-live-orbit {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.12), transparent 45%), #151927;
  border: 1px solid rgba(139, 92, 246, .35);
  box-shadow: 0 0 28px rgba(139, 92, 246, .18);
}
.bulk-live-orbit::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 2px solid rgba(196, 181, 253, .35);
  border-top-color: #c4b5fd;
  animation: bulkSpin 1.1s linear infinite;
}
.bulk-live-orbit span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4b5fd;
  box-shadow: 0 0 14px currentColor;
  animation: bulkPulse 1.35s ease-in-out infinite;
}
.bulk-live-orbit span:nth-child(1) { top: 8px; left: 24px; }
.bulk-live-orbit span:nth-child(2) { right: 8px; top: 25px; animation-delay: .18s; }
.bulk-live-orbit span:nth-child(3) { left: 13px; bottom: 10px; animation-delay: .36s; }
.bulk-live-lines {
  display: grid;
  gap: 8px;
}
.bulk-live-lines i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(139, 92, 246, .22), rgba(196, 181, 253, .9), rgba(139, 92, 246, .22));
  background-size: 220% 100%;
  animation: bulkLineFlow 1.5s ease-in-out infinite;
}
.bulk-live-lines i:nth-child(1) { width: 82%; }
.bulk-live-lines i:nth-child(2) { width: 64%; animation-delay: .14s; }
.bulk-live-lines i:nth-child(3) { width: 74%; animation-delay: .28s; }
.bulk-current-card.stage-serp .bulk-live-orbit,
.bulk-current-card.stage-serp .bulk-live-lines i { color: #38bdf8; border-color: rgba(56, 189, 248, .35); }
.bulk-current-card.stage-serp .bulk-live-orbit span { background: #38bdf8; }
.bulk-current-card.stage-outline .bulk-live-orbit,
.bulk-current-card.stage-outline .bulk-live-lines i { color: #f59e0b; border-color: rgba(245, 158, 11, .35); }
.bulk-current-card.stage-outline .bulk-live-orbit span { background: #f59e0b; }
.bulk-current-card.stage-writing .bulk-live-orbit,
.bulk-current-card.stage-writing .bulk-live-lines i { color: #a78bfa; border-color: rgba(167, 139, 250, .35); }
.bulk-current-card.stage-writing .bulk-live-orbit span { background: #a78bfa; }
.bulk-current-card.stage-image .bulk-live-orbit,
.bulk-current-card.stage-image .bulk-live-lines i { color: #fb7185; border-color: rgba(251, 113, 133, .35); }
.bulk-current-card.stage-image .bulk-live-orbit span { background: #fb7185; }
.bulk-current-card.stage-done .bulk-live-orbit,
.bulk-current-card.stage-done .bulk-live-lines i { color: #22c55e; border-color: rgba(34, 197, 94, .35); }
.bulk-current-card.stage-done .bulk-live-orbit span { background: #22c55e; }
.bulk-current-card.stage-stopped .bulk-live-orbit,
.bulk-current-card.stage-stopped .bulk-live-lines i,
.bulk-status-panel.is-stopped .bulk-live-orbit,
.bulk-status-panel.is-stopped .bulk-live-lines i { color: #f59e0b; border-color: rgba(245, 158, 11, .35); }
.bulk-current-card.stage-stopped .bulk-live-orbit span,
.bulk-status-panel.is-stopped .bulk-live-orbit span { background: #f59e0b; }
.bulk-current-card.stage-error .bulk-live-orbit,
.bulk-current-card.stage-error .bulk-live-lines i,
.bulk-status-panel.is-error .bulk-live-orbit,
.bulk-status-panel.is-error .bulk-live-lines i { color: #ef4444; border-color: rgba(239, 68, 68, .35); }
.bulk-current-card.stage-error .bulk-live-orbit span,
.bulk-status-panel.is-error .bulk-live-orbit span { background: #ef4444; }
.bulk-current-card.stage-paused .bulk-live-orbit,
.bulk-current-card.stage-paused .bulk-live-lines i,
.bulk-status-panel.is-paused .bulk-live-orbit,
.bulk-status-panel.is-paused .bulk-live-lines i { color: #f59e0b; border-color: rgba(245, 158, 11, .35); }
.bulk-status-panel.is-stopped .bulk-current-card::before,
.bulk-status-panel.is-error .bulk-current-card::before,
.bulk-status-panel.is-done .bulk-current-card::before,
.bulk-current-card.is-final::before,
.bulk-current-card.is-final .bulk-live-orbit::before,
.bulk-current-card.is-final .bulk-live-orbit span,
.bulk-current-card.is-final .bulk-live-lines i {
  animation: none !important;
}
.bulk-status-panel.is-stopped .bulk-progress-fill { background: linear-gradient(90deg, #f59e0b, #f97316); }
.bulk-status-panel.is-error .bulk-progress-fill { background: linear-gradient(90deg, #ef4444, #f97316); }
.bulk-status-panel.is-done .bulk-progress-fill { background: linear-gradient(90deg, #22c55e, #14b8a6); }
.bulk-status-panel.is-stopped .bulk-status-badge { border-color: rgba(245, 158, 11, .45); color: #fbbf24; }
.bulk-status-panel.is-error .bulk-status-badge { border-color: rgba(239, 68, 68, .45); color: #fca5a5; }
.bulk-status-panel.is-done .bulk-status-badge { border-color: rgba(34, 197, 94, .45); color: #86efac; }
@keyframes bulkSpin {
  to { transform: rotate(360deg); }
}
@keyframes bulkPulse {
  0%, 100% { transform: scale(.8); opacity: .55; }
  50% { transform: scale(1.25); opacity: 1; }
}
@keyframes bulkLineFlow {
  0% { background-position: 120% 0; opacity: .55; }
  50% { opacity: 1; }
  100% { background-position: -120% 0; opacity: .65; }
}
@keyframes bulkCardSweep {
  0%, 35% { transform: translateX(-100%); }
  70%, 100% { transform: translateX(100%); }
}
.bulk-wait-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 13, .72);
  backdrop-filter: blur(10px);
}
.bulk-wait-card {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid rgba(139, 92, 246, .34);
  background: linear-gradient(180deg, rgba(24, 27, 39, .98), rgba(13, 15, 23, .98));
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .52), 0 0 50px rgba(139, 92, 246, .14);
  padding: 18px;
  overflow: hidden;
  position: relative;
}
.bulk-wait-card::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background:
    radial-gradient(circle at 20% 20%, rgba(34, 197, 94, .16), transparent 25%),
    radial-gradient(circle at 78% 18%, rgba(56, 189, 248, .15), transparent 22%),
    radial-gradient(circle at 50% 88%, rgba(236, 72, 153, .12), transparent 28%);
  animation: bulkWaitGlow 6s ease-in-out infinite alternate;
  pointer-events: none;
}
.bulk-wait-card > * { position: relative; z-index: 1; }
.bulk-wait-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.bulk-wait-kicker {
  display: block;
  color: #aab0c4;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.bulk-wait-top h3 {
  margin: 4px 0 0;
  color: #fff;
  font-size: 20px;
}
.bulk-wait-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #34384a;
  background: #171922;
  color: #d8dcf0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.bulk-wait-stage {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 18px;
  align-items: center;
  margin: 20px 0 16px;
}
.bulk-robot {
  width: 120px;
  height: 120px;
  position: relative;
  display: grid;
  place-items: center;
}
.bulk-robot-ring {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px dashed rgba(196, 181, 253, .42);
  animation: bulkRobotSpin 7s linear infinite;
}
.bulk-robot-head {
  width: 74px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(145deg, #8b5cf6, #38bdf8);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 18px 42px rgba(56, 189, 248, .18);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  justify-items: center;
  padding: 12px 13px 16px;
  animation: bulkRobotFloat 2.2s ease-in-out infinite;
}
.bulk-robot-head i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 0 10px rgba(255,255,255,.8);
  animation: bulkRobotBlink 3s infinite;
}
.bulk-robot-head span {
  grid-column: 1 / 3;
  width: 30px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
}
.bulk-robot-body {
  position: absolute;
  bottom: 14px;
  width: 64px;
  height: 34px;
  border-radius: 12px;
  background: #171922;
  border: 1px solid rgba(196, 181, 253, .28);
  display: flex;
  justify-content: center;
  gap: 6px;
  align-items: center;
}
.bulk-robot-body b {
  width: 7px;
  height: 16px;
  border-radius: 999px;
  background: #22c55e;
  animation: bulkRobotBars 1s ease-in-out infinite;
}
.bulk-robot-body b:nth-child(2) { animation-delay: .15s; background: #facc15; }
.bulk-robot-body b:nth-child(3) { animation-delay: .3s; background: #fb7185; }
.bulk-wait-copy b {
  display: block;
  color: #fff;
  font-size: 17px;
  line-height: 1.35;
}
.bulk-wait-copy span,
.bulk-wait-current {
  display: block;
  color: #aab0c4;
  font-size: 13px;
  margin-top: 7px;
}
.bulk-wait-current {
  color: #c4b5fd;
  font-weight: 800;
}
.bulk-wait-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #aab0c4;
  font-size: 12px;
  margin-bottom: 8px;
}
.bulk-wait-progress-head strong {
  color: #fff;
  font-size: 14px;
}
.bulk-wait-bar {
  height: 12px;
  border-radius: 999px;
  background: #202230;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
}
.bulk-wait-bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #8b5cf6, #38bdf8);
  transition: width .28s ease;
  position: relative;
}
.bulk-wait-bar i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent);
  transform: translateX(-100%);
  animation: bulkWaitSweep 1.4s ease-in-out infinite;
}
.bulk-wait-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}
.bulk-wait-mini span {
  border: 1px solid #2a2d3a;
  background: #151821;
  color: #cdd3e6;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}
.bulk-wait-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.bulk-wait-overlay.is-paused .bulk-wait-bar i,
.bulk-wait-overlay.is-stopped .bulk-wait-bar i { background: linear-gradient(90deg, #f59e0b, #f97316); }
.bulk-wait-overlay.is-error .bulk-wait-bar i { background: linear-gradient(90deg, #ef4444, #f97316); }
.bulk-wait-overlay.is-done .bulk-wait-bar i { background: linear-gradient(90deg, #22c55e, #14b8a6); }
.bulk-wait-overlay.is-paused .bulk-robot-ring,
.bulk-wait-overlay.is-stopped .bulk-robot-ring,
.bulk-wait-overlay.is-error .bulk-robot-ring,
.bulk-wait-overlay.is-done .bulk-robot-ring { animation-play-state: paused; }
.saved-image-wait-overlay .bulk-wait-card {
  border-color: rgba(251, 113, 133, .34);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .52), 0 0 50px rgba(251, 113, 133, .13);
}
.saved-image-wait-overlay .bulk-robot-head {
  background: linear-gradient(145deg, #fb7185, #facc15);
}
.saved-image-wait-overlay .bulk-wait-bar i {
  background: linear-gradient(90deg, #fb7185, #facc15, #22c55e);
}
.wp-publish-wait-overlay .bulk-wait-card {
  border-color: rgba(34, 197, 94, .34);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .52), 0 0 50px rgba(56, 189, 248, .13);
}
.wp-publish-wait-overlay .bulk-robot-head {
  background: linear-gradient(145deg, #22c55e, #38bdf8);
}
.wp-publish-wait-overlay .bulk-wait-bar i {
  background: linear-gradient(90deg, #22c55e, #38bdf8, #8b5cf6);
}
@keyframes bulkRobotSpin { to { transform: rotate(360deg); } }
@keyframes bulkRobotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes bulkRobotBlink {
  0%, 88%, 100% { transform: scaleY(1); }
  92% { transform: scaleY(.12); }
}
@keyframes bulkRobotBars {
  0%, 100% { transform: scaleY(.45); opacity: .65; }
  50% { transform: scaleY(1); opacity: 1; }
}
@keyframes bulkWaitSweep {
  to { transform: translateX(100%); }
}
@keyframes bulkWaitGlow {
  0% { transform: translate3d(-2%, -1%, 0) rotate(0deg); opacity: .85; }
  100% { transform: translate3d(2%, 1%, 0) rotate(4deg); opacity: 1; }
}
.bulk-log {
  background: #0f1117;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.bulk-result-ok { color: #22c55e; }
.bulk-result-bad { color: #ef4444; }

.image-status-box {
  margin: 0 0 12px;
  border-radius: 8px;
  padding: 11px 12px;
  border: 1px solid #2a2d3a;
  background: #111217;
}
.image-status-box b {
  display: block;
  color: #fff;
  font-size: 13px;
  margin-bottom: 4px;
}
.image-status-box span {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.5;
}
.image-status-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.55;
}
.image-status-box.ok {
  border-color: rgba(34, 197, 94, .45);
  background: rgba(34, 197, 94, .08);
}
.image-status-box.info {
  border-color: rgba(59, 130, 246, .38);
  background: rgba(59, 130, 246, .08);
}
.image-status-box.bad {
  border-color: rgba(239, 68, 68, .5);
  background: rgba(239, 68, 68, .08);
}
.image-prompt-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, .18);
}
.image-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.image-prompt-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}
.image-prompt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: start;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  padding: 9px;
  background: rgba(7, 10, 18, .42);
}
.image-prompt-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.image-prompt-meta span {
  display: inline-flex;
  width: auto;
  color: #a78bfa;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.image-prompt-meta strong {
  color: #f8fafc;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-prompt-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.55;
}
.cost-breakdown {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, .18);
}
.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 8px;
  background: rgba(7, 10, 18, .34);
  color: #cbd5e1;
  font-size: 12px;
}
.cost-row strong {
  color: #facc15;
  white-space: nowrap;
}
.image-key-hint {
  display: none;
  border-radius: 8px;
  border: 1px solid #2a2d3a;
  background: #111217;
  padding: 9px 10px;
  margin: 10px 0 12px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.5;
}
.image-key-hint.ok {
  border-color: rgba(34, 197, 94, .45);
  background: rgba(34, 197, 94, .08);
}
.image-key-hint.bad {
  border-color: rgba(239, 68, 68, .5);
  background: rgba(239, 68, 68, .08);
  color: #fecaca;
}

@media (max-width: 980px) {
  .projects-page {
    grid-template-columns: 1fr;
  }
  .project-node {
    margin-left: calc(var(--depth) * 10px);
  }
  .project-node-card {
    grid-template-columns: 1fr;
  }
  .bulk-layout,
  .bulk-control-grid,
  .bulk-status-grid {
    grid-template-columns: 1fr;
  }
  .bulk-hero {
    flex-direction: column;
  }
  .bulk-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }
}


/* Saved articles */
.saved-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 230px) minmax(140px, 170px) auto auto;
  gap: 10px;
  align-items: center;
  background: #111217;
  border: 1px solid #272936;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.saved-search .input {
  height: 40px;
}
.saved-project-filter .input {
  height: 40px;
}
.saved-wp-filter .input {
  height: 40px;
  min-width: 140px;
}
.saved-filter-group,
.saved-bulk-actions,
.saved-counts,
.saved-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.saved-toolbar .saved-filter-group:has(.saved-filter-btn),
.file-actions button[onclick*="'json'"] {
  display: none;
}
.saved-filter-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #2a2d3a;
  background: #171922;
  color: #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.saved-filter-btn.active {
  border-color: #8b5cf6;
  color: #fff;
  background: rgba(139, 92, 246, .22);
}
.saved-counts {
  color: #aab0c4;
  font-size: 12px;
  justify-content: flex-end;
}
.saved-counts span {
  border: 1px solid #2a2d3a;
  border-radius: 999px;
  padding: 6px 9px;
  background: #171922;
}
.saved-bulk-actions {
  background: #0f1117;
  border: 1px solid #272936;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.saved-image-status {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(124,106,255,.22);
  border-radius: 8px;
  background: rgba(124,106,255,.08);
  color: #d8d5ff;
  font-size: 13px;
  line-height: 1.5;
}
.saved-image-status.busy {
  border-color: rgba(245,158,11,.3);
  background: rgba(245,158,11,.1);
  color: #fcd34d;
}
.saved-image-status.ok {
  border-color: rgba(34,197,94,.28);
  background: rgba(34,197,94,.1);
  color: #86efac;
}
.saved-image-status.bad {
  border-color: rgba(239,68,68,.3);
  background: rgba(239,68,68,.1);
  color: #fca5a5;
}
.saved-image-status.warn {
  border-color: rgba(245,158,11,.32);
  background: rgba(245,158,11,.1);
  color: #fbbf24;
}
.saved-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.saved-progress-head b {
  color: inherit;
  font-size: 13px;
}
.saved-progress-head span,
.saved-progress-detail {
  color: inherit;
  opacity: .82;
  font-size: 12px;
}
.saved-progress-bar {
  position: relative;
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  margin-bottom: 8px;
}
.saved-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent);
  animation: savedProgressSweep 1.2s ease-in-out infinite;
}
.saved-progress-bar i {
  position: relative;
  z-index: 1;
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #22c55e);
  transition: width .3s ease;
}
.saved-progress-detail {
  line-height: 1.45;
}
@keyframes savedProgressSweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

/* ─── Image gen overlay ─────────────────────────────────────────────────── */
.image-gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-gen-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 36px;
  text-align: center;
  min-width: 320px;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.48);
}
.image-gen-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
.image-gen-bar-wrap {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 10px;
}
.image-gen-bar {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), transparent);
  animation: imageGenScan 1.5s ease-in-out infinite;
}
@keyframes imageGenScan {
  0% { transform: translateX(-100%); opacity: 1; }
  50% { transform: translateX(150%); opacity: .6; }
  100% { transform: translateX(350%); opacity: 1; }
}
.image-gen-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.saved-image-config {
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid #272936;
  border-radius: 8px;
  background: #11131a;
}
.saved-image-config-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.saved-image-config-head b {
  color: #f8fafc;
  font-size: 13px;
}
.saved-image-config-head span {
  color: #8b90a5;
  font-size: 12px;
}
.saved-image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
}
.saved-image-grid .input {
  height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
}
.saved-bulk-editor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(124,106,255,.18);
  border-radius: 8px;
  background: rgba(124,106,255,.06);
}
.saved-bulk-editor .input {
  width: auto;
  min-width: 150px;
  height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
}
.saved-select-all {
  color: #cbd5e1;
  font-size: 13px;
  margin-right: auto;
}
.saved-file-item {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto;
  gap: 10px;
  align-items: center;
}
.saved-check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.saved-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #202230;
  color: #aab0c4;
  font-size: 11px;
  font-weight: 800;
}
.saved-tag.project {
  background: rgba(124,106,255,.18);
  color: #c4b5fd;
}
.saved-tag.muted {
  background: #171922;
  color: #7d8497;
}
.saved-tag.ok {
  background: rgba(34,197,94,.14);
  color: #86efac;
}
.saved-tag.pending {
  background: rgba(139,92,246,.16);
  color: #c4b5fd;
}
.saved-tag.info {
  background: rgba(59,130,246,.16);
  color: #93c5fd;
}
.saved-tag.warn {
  background: rgba(245,158,11,.14);
  color: #fcd34d;
}
.saved-tag.cost {
  background: rgba(250,204,21,.15);
  color: #fde68a;
}
.saved-tag.bad,
.saved-error {
  background: rgba(239,68,68,.14);
  color: #fca5a5;
}
.saved-error {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
}
.saved-wp-filter-btn {
  border: 1px solid #2a2d3a;
  background: #171922;
  color: #aab0c4;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.saved-wp-filter-btn.active {
  border-color: #8b5cf6;
  color: #fff;
  background: rgba(139,92,246,.22);
}
.saved-date-filters,
.bulk-failed-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.saved-date-filters {
  align-items: center;
  justify-content: flex-end;
}
.saved-date-filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 40px;
  border: 1px solid #2a2d3a;
  background: #171922;
  border-radius: 8px;
}
.saved-date-filters label span {
  color: #aab0c4;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.saved-date-filters .input {
  width: 132px;
  min-width: 132px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  background: transparent;
}
.mode-help {
  margin-top: 6px;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.45;
}
.mode-help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.mode-help-grid span {
  display: block;
  padding: 8px;
  border: 1px solid #272936;
  border-radius: 8px;
  background: #111217;
}
.mode-help b {
  color: #ddd6fe;
}
.brand-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: #94a3b8;
  font-size: 12px;
}
.brand-save-row > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bulk-failed-tools {
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(245,158,11,.35);
  background: rgba(245,158,11,.1);
  border-radius: 8px;
  color: #fcd34d;
}
.bulk-failed-list {
  margin-top: 10px;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(245,158,11,.28);
  background: rgba(245,158,11,.06);
  border-radius: 8px;
}
.bulk-failed-list-head,
.bulk-failed-list-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.bulk-failed-list-head b {
  color: #fef3c7;
  font-size: 13px;
}
.bulk-failed-list-head span {
  color: #fbbf24;
  font-size: 12px;
}
.bulk-failed-list-actions {
  justify-content: flex-start;
}
.bulk-failed-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(15, 17, 23, .78);
  border-radius: 8px;
  color: #e5e7eb;
}
.bulk-failed-item input {
  margin-top: 2px;
}
.bulk-failed-item b {
  display: block;
  color: #fff7ed;
  font-size: 13px;
  line-height: 1.35;
}
.bulk-failed-item small,
.bulk-failed-item em {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  font-style: normal;
}
.bulk-failed-item small {
  color: #fca5a5;
}
.bulk-failed-item em {
  color: #cbd5e1;
}

/* Guide */
.guide-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.guide-panel {
  background: #111217;
  border: 1px solid #272936;
  border-radius: 8px;
  padding: 18px;
}
.guide-intro {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 210px minmax(260px, 420px);
  gap: 18px;
  align-items: center;
}
.guide-kicker {
  color: #8b5cf6;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.guide-panel h3 {
  color: #fff;
  font-size: 18px;
  margin: 0 0 10px;
}
.guide-panel p,
.guide-panel li {
  color: #cbd5e1;
  line-height: 1.65;
  font-size: 14px;
}
.guide-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.guide-orbit {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto;
  border: 1px solid rgba(139,92,246,.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(139,92,246,.12), rgba(34,197,94,.06)),
    #10131b;
  overflow: hidden;
}
.guide-orbit::before,
.guide-orbit::after {
  content: '';
  position: absolute;
  inset: 28px;
  border: 1px dashed rgba(196,181,253,.26);
  border-radius: inherit;
  animation: guideSpin 16s linear infinite;
}
.guide-orbit::after {
  inset: 54px;
  animation-duration: 11s;
  animation-direction: reverse;
  border-color: rgba(34,197,94,.2);
}
.guide-core {
  position: absolute;
  inset: 64px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(139,92,246,.35);
  background: #171922;
  color: #fff;
  font-weight: 900;
  overflow: hidden;
}
.guide-core i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(196,181,253,.24), transparent);
  animation: guideSweep 2.4s ease-in-out infinite;
}
.guide-core b {
  position: relative;
  z-index: 1;
}
.guide-node {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(139,92,246,.35);
  background: #111217;
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0,0,0,.2);
  animation: guideFloat 3.5s ease-in-out infinite;
}
.node-key { top: 14px; left: 22px; }
.node-serp { top: 24px; right: 16px; animation-delay: .4s; }
.node-ai { bottom: 23px; right: 22px; color: #86efac; border-color: rgba(34,197,94,.36); animation-delay: .8s; }
.node-wp { bottom: 17px; left: 20px; color: #fcd34d; border-color: rgba(245,158,11,.36); animation-delay: 1.2s; }
.guide-panel {
  animation: guideCardIn .35s ease both;
}
.guide-grid .guide-panel:nth-child(2) { animation-delay: .04s; }
.guide-grid .guide-panel:nth-child(3) { animation-delay: .08s; }
.guide-grid .guide-panel:nth-child(4) { animation-delay: .12s; }
.guide-grid .guide-panel:nth-child(5) { animation-delay: .16s; }
@keyframes guideNavPulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.45); }
  70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
@keyframes guideSpin {
  to { transform: rotate(360deg); }
}
@keyframes guideSweep {
  0%, 35% { transform: translateX(-100%); }
  75%, 100% { transform: translateX(100%); }
}
@keyframes guideFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes guideCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.guide-status-grid div {
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  padding: 12px;
  background: #171922;
}
.guide-status-grid b {
  display: block;
  color: #22c55e;
  font-size: 22px;
  line-height: 1;
}
.guide-status-grid span {
  display: block;
  color: #aab0c4;
  margin-top: 6px;
  font-size: 12px;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.guide-steps,
.guide-checklist {
  margin: 0;
  padding-left: 20px;
}

@media (max-width: 980px) {
  .saved-toolbar,
  .guide-intro,
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .mode-help-grid {
    grid-template-columns: 1fr;
  }
  .guide-orbit {
    width: 170px;
    height: 170px;
  }
  .saved-counts {
    justify-content: flex-start;
  }
  .saved-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .saved-file-item {
    grid-template-columns: 28px 36px 1fr;
  }
  .saved-file-item .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .saved-image-grid {
    grid-template-columns: 1fr;
  }
  .saved-image-config-head {
    display: block;
  }
  .saved-image-config-head span {
    display: block;
    margin-top: 3px;
  }
}

/* ─── GUIDE ──────────────────────────────────────────────────────────────── */
#view-guide {
  flex-direction: column;
  overflow-y: auto;
}
.guide-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 30px 28px 60px;
}
.guide-hero {
  text-align: center;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.guide-hero-icon {
  font-size: 42px;
  margin-bottom: 12px;
  color: var(--accent);
}
.guide-hero h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}
.guide-hero p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 800px) {
  .guide-grid { grid-template-columns: 1fr; }
  .guide-content { padding: 20px 16px 40px; }
}
.guide-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
}
.guide-card-icon {
  font-size: 28px;
  margin-bottom: 10px;
}
.guide-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}
.guide-card ol, .guide-card ul {
  padding-left: 18px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guide-card li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.guide-card li b { color: var(--text); }
.guide-key-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.guide-key-item:last-child { border-bottom: none; }
.guide-key-item a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  min-width: 80px;
}
.guide-key-item a:hover { text-decoration: underline; }
.guide-key-item span {
  color: var(--text-muted);
  font-size: 12px;
}

/* ─── SETTINGS ACCORDION ────────────────────────────────────────────────── */
.sa-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--bg-surface);
}
.sa-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}
.sa-head:hover { background: var(--bg-hover); }
.sa-arrow { margin-left: auto; font-size: 10px; transition: transform .2s; }
.sa-section.open .sa-arrow { transform: rotate(90deg); }
.sa-body { display: none; padding: 12px 14px; border-top: 1px solid var(--border); }
.sa-section.open .sa-body { display: block; }
.settings-accordion { max-width: 720px; margin: 0 auto; }

.bulk-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) {
  .bulk-two { grid-template-columns: 1fr; }
}
.bulk-hint { font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.pool-status { font-size: 11px; color: var(--text-dim); margin-top: 6px; min-height: 14px; }

/* ─── PROJECT TREE ──────────────────────────────────────────────────────── */
.project-sidebar {
  width: 220px; min-width: 220px;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex; flex-direction: column; overflow-y: auto;
}
.project-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.project-sidebar-head h3 { font-size: 13px; font-weight: 600; margin: 0; color: var(--text); }
.project-tree { padding: 8px 0; flex: 1; overflow-y: auto; }
.project-tree-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: 12.5px; color: var(--text-muted);
  cursor: pointer; transition: all .12s;
  border-left: 2px solid transparent; border-bottom: 1px solid var(--border);
}
.project-tree-item:last-child { border-bottom: none; }
.project-tree-item:hover { background: var(--bg-hover); color: var(--text); }
.project-tree-item .proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-tree-item .proj-count { font-size: 10px; color: var(--text-dim); background: var(--bg-elevated); padding: 2px 7px; border-radius: 99px; }
.project-tree-item .proj-actions { display: none; gap: 4px; }
.project-tree-item:hover .proj-actions { display: flex; }
.project-tree-item .proj-actions button { font-size: 11px; padding: 3px 7px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); border-radius: 5px; cursor: pointer; }
.project-tree-item .proj-actions button:hover { border-color: var(--accent); color: var(--accent); }
.project-tree-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.project-tree-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.project-edit-card { background: var(--bg-surface); border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px; }
.project-edit-card h4 { margin: 0 0 10px; font-size: 13px; color: var(--text); }

/* ─── ARTICLE TABLE ──────────────────────────────────────────────────────── */
.projects-top-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.projects-table-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.projects-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.projects-table thead { position: sticky; top: 0; z-index: 2; }
.projects-table th { background: var(--bg-elevated); border-bottom: 2px solid var(--border); padding: 8px 10px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.projects-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.projects-table tr:hover td { background: rgba(255,255,255,.02); }
.projects-table .td-title { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projects-table .td-actions { display: flex; gap: 4px; }

/* ─── IMAGE GEN OVERLAY ─────────────────────────────────────────────────── */
.image-gen-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.image-gen-card { background: var(--bg-surface); border-radius: 16px; padding: 32px 40px; text-align: center; min-width: 320px; box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.image-gen-spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 16px; }
.image-gen-bar-wrap { height: 4px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.image-gen-bar { height: 100%; width: 30%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: imageGenSweep 1.5s ease-in-out infinite; border-radius: 99px; }
@keyframes imageGenSweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.image-gen-stats { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── IMAGE ERROR POPUP ─────────────────────────────────────────────────── */
.image-error-popup {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998; animation: fadeIn .15s ease;
}
.image-error-popup-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 24px; max-width: 440px; width: 90%;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.image-error-popup-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 14px;
}
.image-error-popup-card p { font-size: 13px; color: var(--text-dim); margin: 0 0 8px; }
.image-error-popup-card ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--text-muted); }
.image-error-popup-card li { margin-bottom: 4px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── BULK SCAN ANIMATION ───────────────────────────────────────────────── */
.bulk-scan-line {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #8b5cf6, #06b6d4, transparent);
  animation: bulkScan 2.5s ease-in-out infinite;
  opacity: 0.6;
}
@keyframes bulkScan {
  0% { top: 0; }
  50% { top: calc(100% - 2px); }
  100% { top: 0; }
}
@keyframes bulkShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Animations & UI Polish ─────────────────────────────────────────────── */
/* Smooth view transitions */
.view { transition: opacity .25s ease, transform .2s ease; }
.view:not(.active) { opacity: 0; transform: translateY(6px); pointer-events: none; }
.view.active { opacity: 1; transform: translateY(0); }

/* Nav item hover */
.nav-item { transition: all .2s ease; position: relative; overflow: hidden; }
.nav-item::after { content: ''; position: absolute; bottom: 0; left: 50%; width: 0; height: 2px; background: var(--accent); transition: all .3s ease; transform: translateX(-50%); border-radius: 2px; }
.nav-item:hover::after, .nav-item.active::after { width: 60%; }

/* Button animations */
.btn-save, .btn-action, .btn-generate, .btn-sm {
  transition: all .2s cubic-bezier(.4,0,.2,1);
  position: relative; overflow: hidden;
}
.btn-save:hover, .btn-action:hover, .btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.btn-save:active, .btn-action:active, .btn-generate:active {
  transform: translateY(0) scale(.98);
}
.btn-generate:hover {
  box-shadow: 0 0 24px rgba(124,106,255,.25);
}

/* Ripple effect on buttons */
.btn-save::after, .btn-action::after, .btn-generate::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,.15) 10%, transparent 10%);
  transform: scale(10);
  opacity: 0;
  transition: transform .5s, opacity .5s;
}
.btn-save:active::after, .btn-action:active::after, .btn-generate:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* Card hover lift */
.form-section, .output-card, .bulk-box {
  transition: transform .2s ease, box-shadow .2s ease;
}
.form-section:hover, .output-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

/* Input/select/textarea focus glow */
.input:focus, textarea.input:focus, select.input:focus {
  box-shadow: 0 0 0 2px rgba(124,106,255,.2);
  transition: box-shadow .25s ease;
}
.input, textarea.input, select.input {
  transition: border-color .2s ease, box-shadow .2s ease;
}

/* Toast animation */
.toast {
  animation: toastIn .35s cubic-bezier(.4,0,.2,1), toastOut .3s ease 3s forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* Table row hover */
.projects-table tbody tr { transition: background .15s ease; }

/* Stats card pulse on update */
.stat-item { transition: transform .2s ease; }
.stat-num { transition: all .3s ease; }

/* Shimmer loading for table */
@keyframes shimmerBg { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

/* Progress bar polish */
.progress-bar-fill { transition: width .4s cubic-bezier(.4,0,.2,1); }

/* Accordion smooth */
.sa-body { transition: max-height .3s ease, opacity .25s ease; }
.sa-section.open .sa-body { animation: accordionIn .3s ease; }
@keyframes accordionIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tab counter badge pulse */
.nav-badge { transition: all .25s ease; }
.nav-badge:not(:empty) { animation: badgePop .3s ease; }
@keyframes badgePop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Selection color */
::selection { background: rgba(124,106,255,.3); color: #fff; }

/* Stat item number count-up feel */
.stat-num { font-variant-numeric: tabular-nums; }

/* Smooth checkbox */
input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; transition: transform .15s ease; }
input[type="checkbox"]:hover { transform: scale(1.1); }

/* Keyframe for logo pulse */
@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(124,106,255,.3)); }
  50% { filter: drop-shadow(0 0 12px rgba(124,106,255,.6)); }
}

/* ─── Mobile Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Nav */
  .nav { flex-wrap: wrap; gap: 4px; padding: 8px; }
  .nav-item { font-size: 11px; padding: 6px 10px; }
  
  /* Layout */
  .write-layout { flex-direction: column; }
  .write-config { max-height: none !important; border-right: none !important; padding: 0 8px !important; }
  .output-area { max-height: none !important; }
  
  /* Top bars */
  .projects-top-bar { flex-wrap: wrap; gap: 6px; padding: 8px; }
  .projects-top-bar > * { flex: 1 1 auto; min-width: 80px; }
  .projects-top-bar select, .projects-top-bar input { width: auto !important; }
  .projects-top-bar button { flex: 0 0 auto; }
  
  /* Table - scrollable */
  .projects-table-wrap { max-height: calc(100vh - 280px); }
  .projects-table { font-size: 11px; }
  .projects-table th, .projects-table td { padding: 6px 4px; }
  .projects-table .td-title { max-width: 140px; }
  .projects-table .td-actions { flex-direction: column; gap: 2px; }
  .btn-sm { font-size: 10px; padding: 3px 6px; }
  
  /* Forms */
  .form-section { margin-bottom: 12px; }
  .input, textarea.input, select.input { font-size: 14px; }
  
  /* Settings */
  .settings-accordion { max-width: 100%; }
  .sa-head { font-size: 12px; padding: 8px 10px; }
  .sa-body { padding: 10px; }
  
  /* Bulk */
  .bulk-status-grid { grid-template-columns: repeat(2, 1fr); }
  .bulk-two { grid-template-columns: 1fr; }
  
  /* Stats */
  .stats-row { flex-wrap: wrap; gap: 8px; }
  .stat-item { flex: 1 1 40%; min-width: 80px; }
  
  /* Toolbar */
  .toolbar-row { gap: 4px; }
  .toolbar-row .btn-action { font-size: 11px; padding: 6px 10px; }
  .toolbar-row select, .toolbar-row input { font-size: 11px; }
  
  /* Overlays */
  #savedImageWaitOverlay > div,
  #loadingState { padding: 20px 16px !important; min-width: auto !important; width: 95% !important; }
  #savedImageSteps { flex-wrap: wrap; gap: 6px; }
  
  /* Buttons */
  .btn-generate { width: 100%; }
  .btn-save, .btn-action { font-size: 12px; padding: 8px 14px; }
  
  /* Header */
  .view-header h2 { font-size: 16px; }
  .view-header { padding: 10px 16px; }
  
  /* Project tree */
  .project-tree-item { font-size: 11px; padding: 5px 10px; }
  
  /* Bulk output */
  #bulkOutputArea { padding: 10px; }
  #bulkLogRight { max-height: 200px; font-size: 11px; }
  #bulkPercentRight { font-size: 24px; }
}

@media (max-width: 480px) {
  .nav-item { font-size: 10px; padding: 5px 8px; }
  .nav-item span[class*="label"] { display: none; }
  
  .projects-top-bar { flex-direction: column; }
  .projects-top-bar > .toolbar-row { flex-direction: column; align-items: stretch; }
  .toolbar-row .btn-action { width: 100%; justify-content: center; }
  
  .stat-item { flex: 1 1 100%; }
  .bulk-status-grid { grid-template-columns: 1fr; }
  
  .img-step { font-size: 10px; padding: 3px 7px; }
}

/* Toolbar rows */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.toolbar-row + .toolbar-row { margin-top: 4px; }
.sa-section.open .sa-body { display: flex !important; gap: 8px; align-items: center; flex-wrap: wrap; }
@keyframes wpBounce { 0%,100%{transform:translateY(0);opacity:.4} 50%{transform:translateY(-8px);opacity:1} }
