:root {
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-hover: #252525;
  --text: #f5f5f5;
  --text-muted: #8a8a8a;
  --accent: #4162f6;
  --accent-hover: #fa8a5c;
  --success: #4ade80;
  --error: #f87171;
  --border: #2a2a2a;
  --radius: 8px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Cormorant Garamond", Georgia, serif;
}

:root.light {
  --bg: #f8f7f5;
  --bg-card: #ffffff;
  --bg-hover: #f0eeeb;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #4162f6;
  --accent-hover: #fa8a5c;
  --success: #16a34a;
  --error: #dc2626;
  --border: #e0ddd8;
}

/* Theme toggle pill switch */
.menu-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  user-select: none;
}

/* Edit form bulk toggle */
.edit-mode-header {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.75rem;
}

.bulk-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.theme-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border: none;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.theme-toggle[aria-checked="true"] {
  background: var(--accent);
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  pointer-events: none;
}

.theme-toggle[aria-checked="true"] .theme-toggle-thumb {
  transform: translateX(16px);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.header {
  padding: 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  margin-right: 0.75rem;
}

.header-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.header-nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.header-nav-link--active {
  color: var(--text);
}

.logo-link {
  display: inline-block;
  text-decoration: none;
}

.logo-img {
  height: 52px;
  width: auto;
  display: block;
}

:root.light .logo-img {
  filter: invert(1) hue-rotate(180deg);
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  overflow-x: hidden;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel.hidden {
  display: none;
}

.panel h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.mode-tab {
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

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

.mode-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.mode-content.hidden {
  display: none;
}

.upload-form .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.params-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.params-left {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  min-width: 200px;
}

.params-extra {
  flex: 1;
  min-width: 200px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field-group input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.field-group input[type="file"]::file-selector-button {
  margin-right: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--border);
  border: none;
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
}

.field-group input[type="number"],
.field-group input[type="text"],
.field-group select,
.field-group textarea {
  width: 100%;
  min-width: 0;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

/* Inside admin-create-form the panel bg is --bg, so inputs need --bg-hover to be visible */
.admin-create-form .field-group input[type="text"],
.admin-create-form .field-group input[type="number"],
.admin-create-form .field-group select,
.admin-create-form .field-group textarea {
  background: var(--bg-hover);
  border-color: var(--border);
}

.field-group textarea {
  resize: vertical;
  min-height: 4rem;
}

.file-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
  min-height: 0;
}

.preview-thumb {
  position: relative;
  width: 48px;
  height: 48px;
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}

.preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.preview-thumb:hover .preview-remove {
  opacity: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #0f0f0f;
  margin-top: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-shopify:hover:not(:disabled) {
  background: #96bf48;
  color: #fff;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.job-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.job-header h2 {
  margin: 0;
}

.job-actions {
  display: flex;
  gap: 0.5rem;
}

.status-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.status-badge.pending {
  background: rgba(250, 204, 21, 0.2);
  color: #facc15;
}

.status-badge.processing {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}

.status-badge.completed {
  background: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

.status-badge.failed {
  background: rgba(248, 113, 113, 0.2);
  color: var(--error);
}

.error-message {
  color: var(--error);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.creatives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.creative-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.creative-card:hover {
  border-color: var(--accent);
}

.creative-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.creative-card.pending img,
.creative-card.failed img {
  aspect-ratio: 1;
  background: var(--bg-hover);
  min-height: 100px;
}

.creative-card.completed img.clickable {
  cursor: pointer;
}

.creative-card .card-footer {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.creative-card .card-footer a {
  color: var(--accent);
  text-decoration: none;
}

.creative-card .card-footer a:hover {
  text-decoration: underline;
}

.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.recent-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.recent-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.recent-tab.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(168, 130, 255, 0.14);
}

.recent-gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

#gallery-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.gallery-item-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.gallery-item-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.gallery-item-body {
  padding: 0.5rem 0.65rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gallery-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.gallery-item-download {
  color: var(--accent);
  text-decoration: none;
}

.gallery-item-download:hover {
  text-decoration: underline;
}

.gallery-sentinel {
  height: 1px;
  width: 100%;
  margin-top: 0.5rem;
}

.job-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s;
}

.job-item:hover {
  background: var(--bg-hover);
}

.job-item.expanded {
  border-color: var(--text-muted);
}

.job-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.job-item-content {
  display: none;
  padding: 1rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.job-item.expanded .job-item-content {
  display: block;
}

.job-item-expand-icon {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.job-item.expanded .job-item-expand-icon {
  transform: rotate(180deg);
}

.job-item .job-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.mode-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mode-badge.edit {
  background: rgba(168, 130, 255, 0.2);
  color: #a882ff;
}

.mode-badge.bulk {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}

.job-item .job-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.job-item .job-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.job-item .job-status-dot.completed {
  background: var(--success);
}

.job-item .job-status-dot.processing,
.job-item .job-status-dot.pending {
  background: #facc15;
  animation: pulse 1.5s infinite;
}

.job-item .job-status-dot.failed {
  background: var(--error);
}

.btn-job-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.btn-job-delete:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.job-item .job-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.75rem;
}

.job-item .job-detail-download {
  margin-left: auto;
}

.job-item .job-detail-creatives {
  margin-top: 0.75rem;
}

.job-item .job-detail-error {
  margin: 0.5rem 0 0;
}

@keyframes pulse {
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 2px;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.toast.hidden {
  display: none;
}

.toast.error {
  border-color: var(--error);
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  padding: 2rem;
}

.image-preview.hidden {
  display: none;
}

.image-preview img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}

.preview-actions {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
}

.preview-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.75rem;
  line-height: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.preview-close:hover {
  background: var(--bg-hover);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 7rem;
  text-align: center;
}

.pagination-btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* App menu */
.app-menu {
  position: relative;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.menu-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 500;
  padding: 0.5rem 0;
}

.menu-dropdown.hidden {
  display: none;
}

.menu-section {
  padding: 0.5rem 0.75rem;
}

.menu-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.menu-email {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-all;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.35rem 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

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

.menu-item-danger:hover {
  color: var(--error);
}

/* Login page */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
}

.login-logo {
  margin: 0 auto 0.75rem;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.75rem;
}

.login-card .field-group {
  margin-bottom: 1rem;
}

.login-card .field-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.login-card .field-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.login-card .field-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.login-error.hidden {
  display: none;
}

.login-btn {
  width: 100%;
  margin-top: 0.25rem;
}

/* Admin page */
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.admin-section-header h2 {
  margin: 0;
}

.admin-create-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.admin-create-form.hidden {
  display: none;
}

.admin-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.admin-form-row .field-group {
  flex: 1;
  min-width: 140px;
}

.admin-form-row .field-group input,
.admin-form-row .field-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.admin-form-row .field-group input:focus,
.admin-form-row .field-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 0.35rem;
}

.admin-error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}

.admin-error.hidden {
  display: none;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.admin-table tbody tr:hover {
  background: var(--bg-hover);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-actions-cell {
  text-align: right;
  white-space: nowrap;
}

.admin-delete-btn:hover {
  color: var(--error) !important;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
}

.role-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-admin {
  background: rgba(249, 114, 56, 0.2);
  color: #f97238;
}

.role-user {
  background: rgba(138, 138, 138, 0.2);
  color: var(--text-muted);
}

/* ── Products tab header ─────────────────────────────── */

.products-tab-header {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Shopify import modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(420px, calc(100vw - 2rem));
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.15rem;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-size: 0.875rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
}

.modal-input::placeholder {
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
}

.modal-footer .btn {
  margin-top: 0;
}

.shopify-import-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.shopify-import-status--loading {
  color: var(--accent);
}

.shopify-import-status--error {
  color: var(--error);
}

/* ── Products ────────────────────────────────────────── */

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.panel-header-row h2 {
  margin: 0;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.products-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.product-card:hover {
  border-color: var(--accent);
}

.product-card-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.product-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 2rem;
}

.product-card-body {
  padding: 0.5rem 0.75rem 0.25rem;
}

.product-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.product-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  border-top: 1px solid var(--border);
}

/* Product create/edit form */
.product-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.product-form-grid .full-width {
  grid-column: 1 / -1;
}

.existing-photos-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.existing-photo-thumb {
  position: relative;
  width: 56px;
  height: 56px;
}

.existing-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.existing-photo-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

/* ── Job creation form redesign ──────────────────────────────────────────── */

.form-images-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.form-inline-params {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.inline-param {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.inline-param.hidden {
  display: none;
}

.inline-param label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin: 0;
}

.inline-param input[type="number"] {
  width: 3.5rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.inline-param input[type="number"]::-webkit-inner-spin-button,
.inline-param input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.inline-param select {
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.btn-advanced {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-advanced:hover,
.btn-advanced.active {
  color: var(--accent);
  border-color: var(--accent);
}

.advanced-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.adv-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.field-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 0.25rem;
}

.field-note--required {
  color: var(--accent);
}

@media (max-width: 600px) {
  .form-images-row {
    grid-template-columns: 1fr;
  }
}

/* Product picker in creative form */
.product-picker-row {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.25rem;
}

.product-picker-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.product-picker-thumbs img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

/* ── Video ───────────────────────────────────────────────── */

.mode-badge.video {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
}

.creative-card video {
  width: 100%;
  display: block;
  background: #000;
  max-height: 320px;
}

.preview-video-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
}

@media (max-width: 480px) {
  .main {
    padding: 1rem 0.75rem;
  }

  .upload-form .form-row {
    grid-template-columns: 1fr;
  }

  .params-left {
    grid-template-columns: 1fr;
  }

  .params-row {
    flex-direction: column;
  }

  .job-item-header {
    font-size: 0.85rem;
    gap: 0.5rem;
  }
}
