/* ═══════════════════════════════════════════════════════════
   Puhu Creative — Image Generator Page
   Dark theme · Deep Teal primary · Amber accent
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:       #0d0f10;
  --bg-panel:      #131618;
  --bg-card:       #1a1d20;
  --bg-hover:      #21252a;
  --bg-input:      #171a1d;

  --border:        #2a2e33;
  --border-hover:  #3d4449;

  --teal-600:      #e5c335;
  --teal-500:      #e5c335;
  --teal-400:      #e5c335;
  --teal-dim:      rgba(229, 195, 53, .15);
  --teal-glow:     rgba(229, 195, 53, .35);

  --amber-500:     #f59e0b;
  --amber-400:     #fbbf24;
  --amber-dim:     rgba(245,158,11,.12);

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --radius-xl:     20px;

  --sidebar-w:     220px;
  --panel-w:       290px;

  --shadow-card:   0 2px 12px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --shadow-glow:   0 0 0 2px var(--teal-600), 0 0 20px var(--teal-glow);

  --transition:    200ms cubic-bezier(.4,0,.2,1);
}

:root[data-theme="light"] {
  --bg-base:       #f6f8fc;
  --bg-panel:      #ffffff;
  --bg-card:       #f2f5f9;
  --bg-hover:      #e8edf5;
  --bg-input:      #ffffff;

  --border:        #d9e1ec;
  --border-hover:  #c3cfde;

  --teal-dim:      rgba(229, 195, 53, .18);
  --teal-glow:     rgba(229, 195, 53, .22);

  --text-primary:  #0f172a;
  --text-secondary:#334155;
  --text-muted:    #64748b;

  --shadow-card:   0 10px 24px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-glow:   0 0 0 2px var(--teal-600), 0 0 12px var(--teal-glow);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: row;
}

svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
select { font: inherit; }
textarea { font: inherit; }
a { text-decoration: none; color: inherit; }

/* ─────────────── LAYOUT ─────────────── */

/* ─────────────── SIDEBAR ─────────────── */

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  z-index: 40;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.logo-image {
  height: 34px;
  width: auto;
  max-width: calc(100% - 72px);
  object-fit: contain;
  display: block;
}


.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal-600), #e5c335);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(229, 195, 53, .3);
}

.logo-mark svg {
  width: 20px;
  height: 20px;
  fill: white;
  stroke: none;
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--teal-400), var(--amber-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex: 1;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--transition);
  position: absolute;
  right: 20px;
  top: 24px;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--teal-dim);
  color: var(--teal-400);
  font-weight: 600;
}

.nav-item.active svg { stroke: var(--teal-400); }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.package-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.package-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.package-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 6px;
  padding: 4px 10px;
  letter-spacing: 0.5px;
}

.package-notice {
  font-size: 12px;
  color: var(--text-muted);
}

.package-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(135deg, var(--teal-600), #e5c335);
  color: white;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: opacity var(--transition), transform var(--transition);
  box-shadow: 0 4px 12px rgba(229, 195, 53, .25);
}

.package-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.logout-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* ─────────────── MAIN CONTENT ─────────────── */

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ─────────────── TOPBAR ─────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 28px;
  height: 58px;
  min-height: 58px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  z-index: 30;
  gap: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
}
.breadcrumb svg { width: 14px; height: 14px; }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

.topbar-actions { display: flex; align-items: center; gap: 20px; }

/* Step Indicator */
.step-indicator {
  display: flex; align-items: center; gap: 0;
  overflow: hidden;
  flex-shrink: 1;
}

.step {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.step span {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}

.step.done { color: var(--teal-500); }
.step.done span { background: var(--teal-dim); border-color: var(--teal-600); color: var(--teal-400); }

.step.active { color: var(--text-primary); font-weight: 600; }
.step.active span { background: var(--teal-600); border-color: var(--teal-600); color: #fff; }

.step-line {
  width: 32px; height: 1px;
  background: var(--border);
  margin: 0 4px;
}
.step-line.done { background: var(--teal-600); }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-600), #e5c335);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

/* ─────────────── WORKSPACE ─────────────── */

.workspace {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  height: 0; /* force grid rows to respect flex parent */
}

/* ─────────────── CONTROLS PANEL ─────────────── */

.controls-panel {
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 40px;
  height: 100%;
}

/* Type Tabs */
.type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.type-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  position: relative;
}

.type-tab svg { width: 18px; height: 18px; }

.type-tab:hover { color: var(--text-secondary); }

.type-tab.active {
  color: var(--teal-400);
  border-bottom-color: var(--teal-600);
}

.type-tab.disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* Section Blocks */
.section-block {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.section-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .7px;
  margin-bottom: 10px;
}
.section-label svg { width: 12px; height: 12px; }


/* Product Chip */
.product-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.product-chip-thumb {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.product-chip-thumb svg { width: 20px; height: 20px; }

.product-chip-info {
  flex: 1;
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
}

.product-chip-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.product-chip-sub {
  font-size: 11px; color: var(--text-muted);
}

.product-chip-change {
  font-size: 11px; font-weight: 500; color: var(--teal-400);
  background: var(--teal-dim);
  border: 1px solid rgba(229, 195, 53, .2);
  border-radius: 6px;
  padding: 4px 8px;
  flex-shrink: 0;
  transition: background var(--transition);
}
.product-chip-change:hover { background: rgba(229, 195, 53, .25); }

/* Select */
.select-wrapper {
  position: relative;
}

.custom-select {
  width: 100%;
  appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 36px 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition);
  outline: none;
}

.custom-select:focus { border-color: var(--teal-600); }

.select-arrow {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.pipeline-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipeline-field-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.pipeline-debug-toggle {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pipeline-debug-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #e5c335;
}

/* ── Advanced Settings collapse ── */
.advanced-settings-block { padding: 0; border-bottom: 1px solid var(--border); }
.advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  transition: color var(--transition);
}
.advanced-toggle:hover { color: var(--text-secondary); }
.advanced-toggle svg:first-child { width: 14px; height: 14px; }
.advanced-arrow { width: 14px; height: 14px; margin-left: auto; transition: transform var(--transition); }
.advanced-toggle.open .advanced-arrow { transform: rotate(180deg); }
.advanced-content { padding: 0 18px 14px; }

/* ── Caption label row + copy button ── */
.caption-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.caption-label-row .approval-reason-label { margin-bottom: 0; }
.copy-caption-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.copy-caption-btn:hover { border-color: var(--teal-500); color: var(--teal-500); }
.copy-caption-btn svg { width: 12px; height: 12px; }

/* Add button */
.add-btn {
  font-size: 11px; font-weight: 500;
  color: var(--teal-400);
  background: var(--teal-dim);
  border: 1px solid rgba(229, 195, 53, .2);
  border-radius: 6px;
  padding: 4px 8px;
  transition: background var(--transition);
}
.add-btn:hover { background: rgba(229, 195, 53, .25); }

/* Reference Buttons */
.ref-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.ref-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 11px; color: var(--text-secondary);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.ref-btn svg { width: 20px; height: 20px; }

.ref-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.reference-summary {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(229, 195, 53, 0.35);
  background: rgba(229, 195, 53, 0.1);
}

.reference-summary-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.reference-summary-text strong {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reference-summary-text span {
  font-size: 11px;
  color: var(--text-muted);
}

.reference-clear-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.reference-clear-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* Prompt */
.prompt-block { gap: 0; }

.prompt-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
  line-height: 1.6;
}

.prompt-textarea::placeholder { color: var(--text-muted); }
.prompt-textarea:focus { border-color: var(--teal-600); }

.prompt-hint {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
  margin-top: 8px;
}
.prompt-hint svg { width: 12px; height: 12px; color: var(--teal-500); stroke: var(--teal-500); }


/* Format & Count */
.format-row {
  display: flex; gap: 16px;
}

.format-group, .count-group {
  flex: 1;
}

.section-label.mini { font-size: 9px; margin-bottom: 8px; }

.aspect-buttons {
  display: flex; gap: 6px;
}

.aspect-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.aspect-btn svg { width: 14px; height: 14px; }

.aspect-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.aspect-btn.active { background: var(--teal-dim); border-color: var(--teal-600); color: var(--teal-400); }

.count-control {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}

.count-btn {
  width: 32px; height: 34px;
  background: none;
  font-size: 16px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.count-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.count-val {
  min-width: 30px;
  text-align: center;
  font-size: 14px; font-weight: 600;
  padding: 0 8px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* Credit Cost */
.credit-cost {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-muted);
  padding: 10px 18px;
  background: var(--amber-dim);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.credit-cost svg { width: 13px; height: 13px; stroke: var(--amber-400); }
.credit-cost strong { color: var(--amber-400); }

/* Generate Button */
.generate-btn {
  margin: 16px 18px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--teal-600), #e5c335);
  color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(229, 195, 53, .3);
}

.generate-btn svg { width: 15px; height: 15px; stroke: #fff; }
.generate-btn:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(229, 195, 53, .4); }
.generate-btn:active { transform: translateY(0); }

.generate-btn.loading {
  pointer-events: none;
  opacity: .7;
}

/* ─────────────── GALLERY PANEL ─────────────── */

.gallery-panel {
  background: var(--bg-base);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  container-type: inline-size;
}

/* Gallery Header */
.gallery-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}

.gallery-title {
  display: flex; align-items: center; gap: 10px;
}

.gallery-title h2 {
  font-size: 17px; font-weight: 600;
}

.badge {
  font-size: 11px; font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--text-secondary);
}

.gallery-actions {
  display: flex; align-items: center; gap: 10px;
}

.ghost-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.ghost-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.view-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.view-btn.active { background: var(--bg-card); color: var(--text-primary); }
.view-btn + .view-btn { border-left: 1px solid var(--border); }

/* Generating Bar */
.generating-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--teal-600);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px; color: var(--text-secondary);
}

.generating-pulse {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--teal-500);
  animation: pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.85); }
}

.progress-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-600), var(--teal-400));
  border-radius: 2px;
  width: 0%;
  transition: width 300ms ease;
}

/* Masonry Grid */
.masonry-grid {
  columns: 2;
  column-gap: 14px;
}

@container (min-width: 700px) { .masonry-grid { columns: 3; } }
@container (min-width: 1000px) { .masonry-grid { columns: 4; } }

.img-card {
  break-inside: avoid;
  margin-bottom: 14px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}

.img-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--border-hover);
}

.img-card.selected {
  border-color: var(--teal-600);
  box-shadow: var(--shadow-glow);
}

.img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Image Overlay */
.img-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 12px;
}

.img-card:hover .img-overlay { opacity: 1; }

.img-actions {
  display: flex; gap: 6px;
}

.img-action-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: background var(--transition);
}
.img-action-btn svg { width: 14px; height: 14px; stroke: #fff; }
.img-action-btn:hover { background: rgba(255,255,255,.22); }
.img-action-btn.highlight { background: var(--teal-600); border-color: var(--teal-500); }
.img-action-btn.highlight:hover { background: var(--teal-500); }

/* Selected Badge */
.selected-badge {
  position: absolute; top: 10px; left: 10px;
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  background: var(--teal-600);
  color: #fff;
  border-radius: 6px;
  padding: 4px 9px;
}
.selected-badge svg { width: 11px; height: 11px; stroke: #fff; }

/* Card Footer */
.img-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
}

.img-card-label {
  font-size: 11.5px; font-weight: 500; color: var(--text-secondary);
}

.img-card-score {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  color: var(--teal-400);
}
.img-card-score svg { width: 11px; height: 11px; stroke: var(--teal-400); }

.img-card-score.mid { color: var(--amber-400); }
.img-card-score.mid svg { stroke: var(--amber-400); }

.img-card-score.low { color: #f87171; }
.img-card-score.low svg { stroke: #f87171; }

/* Skeleton */
.img-card.skeleton { pointer-events: none; }

.skeleton-bg {
  background: var(--bg-card) !important;
  position: relative; overflow: hidden;
}

.skeleton-shimmer {
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,.04) 40%,
    rgba(255,255,255,.08) 50%,
    rgba(255,255,255,.04) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  display: block;
  height: 10px; width: 60%;
  background: var(--bg-hover);
  border-radius: 4px;
}

/* Load More */
.load-more-row {
  display: flex; justify-content: center;
  padding-top: 8px;
}

.ghost-btn.load-more {
  padding: 9px 24px;
  font-size: 13px;
}

.reference-upload-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-reference-btn,
.template-prompt-btn {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.upload-reference-btn {
  background: linear-gradient(135deg, var(--teal-600), #e5c335);
  color: #e6fffb;
  border-color: rgba(229, 195, 53, .35);
}

.upload-reference-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(229, 195, 53, .25);
}

.template-prompt-btn {
  background: rgba(30, 41, 59, .62);
  color: #dbeafe;
  border-color: rgba(148, 163, 184, .22);
}

.template-prompt-btn:hover {
  background: rgba(51, 65, 85, .72);
  border-color: rgba(148, 163, 184, .35);
}

.template-prompt-btn svg,
.upload-reference-btn svg {
  width: 15px;
  height: 15px;
}

.reference-summary {
  margin-top: 0;
}

.reference-summary[hidden] {
  display: none;
}

.template-strip {
  background: rgba(15, 23, 42, .45);
  border: 1px solid rgba(51, 65, 85, .75);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

:root[data-theme="light"] .template-strip {
  background: rgba(255, 255, 255, .92);
  border-color: rgba(195, 207, 222, .9);
}

.template-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-strip-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.template-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-row-header h3 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 650;
}

.template-link-btn {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(30, 41, 59, .6);
  border: 1px solid rgba(71, 85, 105, .65);
  padding: 6px 10px;
  border-radius: 8px;
}

.template-link-btn.compact {
  background: transparent;
  border-color: transparent;
  color: #d6e4f5;
}

:root[data-theme="light"] .template-link-btn.compact {
  color: #334155;
}

.template-link-btn.compact:hover {
  background: rgba(30, 41, 59, .6);
  border-color: rgba(71, 85, 105, .65);
}

.template-strip-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.template-card {
  border-radius: 10px;
  border: 1px solid rgba(71, 85, 105, .6);
  overflow: hidden;
  background: #0b1220;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}

:root[data-theme="light"] .template-card {
  background: #ffffff;
  border-color: rgba(195, 207, 222, .95);
}

.template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(229, 195, 53, .55);
}

.template-card-thumb {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: radial-gradient(circle at 18% 22%, rgba(229, 195, 53, .24), transparent 44%),
    linear-gradient(140deg, #111827, #1f2937 55%, #0f172a);
  background-size: cover;
  background-position: center;
}

.template-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.template-card-title {
  display: block;
  padding: 9px 10px 10px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
  color: #cbd5e1;
}

:root[data-theme="light"] .template-card-title {
  color: #334155;
}

.masonry-grid.generated-grid {
  columns: unset;
  column-gap: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.generated-grid .img-card {
  margin-bottom: 0;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, .6);
  background: linear-gradient(180deg, rgba(15, 23, 42, .92), rgba(15, 23, 42, .78));
}

:root[data-theme="light"] .generated-grid .img-card {
  border-color: rgba(195, 207, 222, .95);
  background: linear-gradient(180deg, #ffffff, #f3f7fd);
}

.generated-grid .img-card:hover {
  transform: translateY(-2px);
  border-color: rgba(229, 195, 53, .4);
}

.generated-grid .img-wrap {
  aspect-ratio: 1 / 1;
  background: linear-gradient(160deg, #111827, #0f172a);
  border-bottom: 1px solid rgba(71, 85, 105, .5);
}

:root[data-theme="light"] .generated-grid .img-wrap {
  background: linear-gradient(160deg, #eef3fb, #dce6f4);
  border-bottom-color: rgba(195, 207, 222, .9);
}

.generated-grid .img-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.generated-grid .selected-badge {
  top: 10px;
  left: 10px;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11px;
}

.generated-grid .img-overlay {
  background: linear-gradient(to top, rgba(2, 6, 23, .75) 0%, transparent 62%);
}

:root[data-theme="light"] .generated-grid .img-overlay {
  background: linear-gradient(to top, rgba(15, 23, 42, .36) 0%, transparent 62%);
}

.generated-grid .img-card-footer {
  min-height: 42px;
}

:root[data-theme="light"] .generated-grid .img-card-footer {
  background: linear-gradient(180deg, rgba(247, 250, 255, .95), rgba(239, 245, 252, .95));
}

:root[data-theme="light"] .generated-grid .img-card-label {
  color: #334155;
}

.generated-grid .img-card-score {
  font-size: 12px;
}

.generated-grid .img-card-score svg {
  width: 12px;
  height: 12px;
}

body.template-modal-open {
  overflow: hidden;
}

.template-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 24px;
}

.template-modal[aria-hidden="true"] {
  display: none;
}

.template-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .84);
  backdrop-filter: blur(2px);
}

:root[data-theme="light"] .template-modal-backdrop {
  background: rgba(148, 163, 184, .38);
}

.template-modal-dialog {
  position: relative;
  width: min(1280px, 96vw);
  min-height: min(760px, 92vh);
  max-height: 92vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 230px 1fr;
  border-radius: 18px;
  border: 1px solid rgba(100, 116, 139, .45);
  background: #0b0f14;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .6);
}

:root[data-theme="light"] .template-modal-dialog {
  border-color: rgba(195, 207, 222, .95);
  background: #f8fbff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .18);
}

.template-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .95);
  border: 1px solid rgba(100, 116, 139, .45);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

:root[data-theme="light"] .template-modal-close {
  background: #ffffff;
  border-color: rgba(195, 207, 222, .95);
  color: #334155;
}

.template-modal-close svg {
  width: 15px;
  height: 15px;
}

.template-modal-sidebar {
  border-right: 1px solid rgba(51, 65, 85, .8);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(2, 6, 23, .6);
}

:root[data-theme="light"] .template-modal-sidebar {
  border-right-color: rgba(195, 207, 222, .95);
  background: #eff5fd;
}

.template-modal-sidebar h3 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}

:root[data-theme="light"] .template-modal-sidebar h3 {
  color: #0f172a;
}

.template-sidebar-link {
  width: 100%;
  text-align: left;
  height: 38px;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
}

:root[data-theme="light"] .template-sidebar-link {
  color: #475569;
}

.template-sidebar-link.active,
.template-sidebar-link:hover {
  color: #f8fafc;
  background: rgba(30, 41, 59, .6);
  border-color: rgba(100, 116, 139, .35);
}

:root[data-theme="light"] .template-sidebar-link.active,
:root[data-theme="light"] .template-sidebar-link:hover {
  color: #0f172a;
  background: rgba(229, 195, 53, .12);
  border-color: rgba(229, 195, 53, .34);
}

.template-modal-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 20px 24px;
  overflow: auto;
}

:root[data-theme="light"] .template-modal-main {
  background: #f8fbff;
}

.template-modal-search-row {
  padding-right: 52px;
}

.template-modal-search {
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, .45);
  background: rgba(30, 41, 59, .5);
  color: #e2e8f0;
  font-size: 15px;
  padding: 0 18px;
}

:root[data-theme="light"] .template-modal-search {
  border-color: rgba(195, 207, 222, .95);
  background: #ffffff;
  color: #0f172a;
}

.template-modal-search:focus {
  outline: none;
  border-color: rgba(229, 195, 53, .6);
  box-shadow: 0 0 0 3px rgba(229, 195, 53, .2);
}

.template-modal-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.template-filter-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, .35);
  background: rgba(15, 23, 42, .65);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
}

:root[data-theme="light"] .template-filter-btn {
  border-color: rgba(195, 207, 222, .95);
  background: #ffffff;
  color: #334155;
}

.template-filter-btn.active {
  background: #f8fafc;
  color: #0f172a;
  border-color: #f8fafc;
}

.template-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.template-modal-item {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(71, 85, 105, .6);
  background: #0f172a;
  transition: border-color var(--transition), transform var(--transition);
}

:root[data-theme="light"] .template-modal-item {
  border-color: rgba(195, 207, 222, .95);
  background: #ffffff;
}

.template-modal-item:hover {
  border-color: rgba(229, 195, 53, .5);
  transform: translateY(-2px);
}

.template-modal-item button {
  width: 100%;
  text-align: left;
}

.template-modal-item-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: radial-gradient(circle at 20% 25%, rgba(229, 195, 53, .24), transparent 42%),
    linear-gradient(140deg, #111827, #1f2937 58%, #0f172a);
  background-size: cover;
  background-position: center;
}

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

.pending-card {
  border-color: rgba(229, 195, 53, .45) !important;
  box-shadow: 0 0 0 1px rgba(229, 195, 53, .3), 0 16px 38px rgba(2, 6, 23, .55);
}

.pending-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(115deg, rgba(15, 23, 42, .96), rgba(6, 78, 59, .5), rgba(15, 23, 42, .96));
  background-size: 220% 100%;
  animation: pendingWave 2.2s linear infinite;
}

@keyframes pendingWave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pending-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #e5c335;
  box-shadow: 0 0 0 0 rgba(229, 195, 53, .5);
  animation: pendingPulse 1.2s ease-in-out infinite;
}

@keyframes pendingPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 195, 53, .55); }
  50% { transform: scale(.78); box-shadow: 0 0 0 8px rgba(229, 195, 53, 0); }
}

.pending-word {
  font-size: 14px;
  letter-spacing: .01em;
  font-weight: 600;
  color: #d7fffb;
  text-shadow: 0 0 18px rgba(229, 195, 53, .35);
  transition: opacity .14s ease;
}

.pending-word.swap {
  opacity: .28;
}

.pending-word.fail {
  color: #fecaca;
  text-shadow: none;
}

.failed-card {
  border-color: rgba(248, 113, 113, .45) !important;
}

.template-modal-item-title {
  display: block;
  font-size: 13px;
  color: #e2e8f0;
  padding: 10px 12px 5px;
}

:root[data-theme="light"] .template-modal-item-title {
  color: #0f172a;
}

.template-modal-item-desc {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  padding: 0 12px 12px;
}

:root[data-theme="light"] .template-modal-item-desc {
  color: #64748b;
}

.selected-badge.waiting { background: rgba(229, 195, 53, .92); }
.selected-badge.approved { background: rgba(21, 128, 61, .92); }
.selected-badge.rejected { background: rgba(185, 28, 28, .92); }
.selected-badge.processing { background: rgba(51, 65, 85, .92); }

body.approval-modal-open {
  overflow: hidden;
}

.approval-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.approval-modal[aria-hidden="true"] {
  display: none;
}

.approval-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 23, .76);
  backdrop-filter: blur(2px);
}

:root[data-theme="light"] .approval-modal-backdrop {
  background: rgba(148, 163, 184, .34);
}

.approval-modal-dialog {
  position: relative;
  --approval-action-height: 52px;
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .22);
  background: linear-gradient(155deg, rgba(3, 7, 18, .98), rgba(15, 23, 42, .96));
  box-shadow: 0 28px 70px rgba(2, 6, 23, .6);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
}

:root[data-theme="light"] .approval-modal-dialog {
  border-color: rgba(195, 207, 222, .95);
  background: linear-gradient(160deg, #ffffff, #f3f8ff);
  box-shadow: 0 24px 64px rgba(15, 23, 42, .2);
}

.approval-modal-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, .84);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

:root[data-theme="light"] .approval-modal-close {
  background: #ffffff;
  color: #334155;
  border-color: rgba(195, 207, 222, .95);
}

.approval-modal-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.approval-modal-media {
  position: relative;
  min-height: 360px;
  background: #020617;
}

:root[data-theme="light"] .approval-modal-media {
  background: #dfe8f5;
}

.approval-modal-media img,
.approval-modal-media video {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  display: block;
}

.approval-modal-content {
  padding: 26px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.approval-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.approval-modal-head h3 {
  margin: 0;
  font-size: 24px;
}

.approval-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.approval-status-chip.waiting {
  color: var(--teal-500);
  background: rgba(229, 195, 53, .22);
  border-color: rgba(229, 195, 53, .35);
}

.approval-status-chip.approved {
  color: #bbf7d0;
  background: rgba(22, 101, 52, .26);
  border-color: rgba(74, 222, 128, .3);
}

.approval-status-chip.rejected {
  color: #fecaca;
  background: rgba(153, 27, 27, .34);
  border-color: rgba(248, 113, 113, .3);
}

.approval-status-chip.processing {
  color: #e2e8f0;
  background: rgba(51, 65, 85, .4);
  border-color: rgba(148, 163, 184, .28);
}

.approval-modal-meta {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.approval-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approval-tag {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(229, 195, 53, .4);
  background: rgba(229, 195, 53, .14);
  color: var(--text-primary);
}

.approval-modal-prompt {
  margin: 0;
  max-height: 116px;
  overflow: auto;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.approval-reason-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

.approval-reason-input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.approval-reason-input:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(229, 195, 53, .2);
}

.approval-revision-input {
  min-height: 96px;
}

.approval-social-caption {
  min-height: 104px;
  background: rgba(2, 6, 23, .5);
}

.approval-social-caption[readonly] {
  cursor: default;
  opacity: .98;
}

.approval-btn-ghost {
  color: #dcfce7;
  background: linear-gradient(120deg, #16a34a, #22c55e);
  border-color: rgba(34, 197, 94, .55);
}

.approval-btn-ghost:hover {
  background: linear-gradient(120deg, #15803d, #16a34a);
}

.approval-modal-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
}

.approval-btn {
  flex: 1;
  height: var(--approval-action-height);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform .16s ease, opacity .16s ease, border-color .16s ease;
}

.approval-btn.approval-btn-ghost {
  flex: 0 0 auto;
  height: var(--approval-action-height);
  min-height: var(--approval-action-height);
  padding-top: 0;
  padding-bottom: 0;
}

.approval-btn:hover {
  transform: translateY(-1px);
}

.approval-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.approval-btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--teal-600), #e5c335);
  border-color: rgba(229, 195, 53, .35);
}

.approval-btn-secondary {
  color: #fecaca;
  background: rgba(127, 29, 29, .26);
  border-color: rgba(248, 113, 113, .35);
}

:root[data-theme="light"] .approval-btn-secondary {
  color: #ffffff;
  background: #dc2626;
  border-color: #b91c1c;
}

:root[data-theme="light"] .approval-btn-secondary:hover {
  background: #b91c1c;
  border-color: #991b1b;
}

:root[data-theme="light"] .approval-btn-secondary:disabled {
  opacity: .72;
  color: #7f1d1d;
  background: #fecaca;
  border-color: #f87171;
}

@media (max-width: 960px) {
  .template-strip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-strip-header h2 { font-size: 17px; }
  .template-row-header h3 { font-size: 17px; }

  .masonry-grid.generated-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-modal {
    padding: 10px;
  }

  .template-modal-dialog {
    grid-template-columns: 1fr;
    min-height: 90vh;
  }

  .template-modal-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(51, 65, 85, .7);
  }

  .approval-modal {
    padding: 12px;
  }

  .approval-modal-dialog {
    grid-template-columns: 1fr;
    max-height: 94vh;
  }

  .approval-modal-close {
    top: 8px;
    right: 8px;
  }

  .approval-modal-media {
    min-height: 260px;
  }

  .approval-modal-media img,
  .approval-modal-media video {
    min-height: 260px;
    max-height: 360px;
  }
}

@media (max-width: 1380px) {
  .template-strip-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .template-strip-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .template-strip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
