/* Image Edit — same restrained tokens as the chat page */
.edit-page {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--text-color, #1e293b);
  --edit-radius: 10px;
  --edit-radius-lg: 12px;
  --edit-border: var(--border-color, #e2e8f0);
  --edit-bg: var(--card-bg, #fff);
  --edit-muted: var(--text-muted, #64748b);
  --edit-ink: var(--text-color, #1e293b);
}

.edit-hero {
  background: var(--edit-bg);
  border: 1px solid var(--edit-border);
  border-radius: var(--edit-radius-lg);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}

.edit-hero h2 {
  color: var(--edit-ink);
  border: none;
  margin: 0 0 6px;
  padding: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.edit-hero h2 i { margin-right: 7px; color: var(--link-color, #3b82f6); font-size: 15px; }
.edit-hero p { color: var(--edit-muted); margin: 0; font-size: 13px; line-height: 1.55; max-width: 62ch; }
.edit-hero p code { font-size: 12px; }

.edit-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}

.meta-pill {
  background: var(--code-bg, #f8fafc);
  border: 1px solid var(--edit-border);
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--edit-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.edit-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-grey { background: #94a3b8; }
.dot-green { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.12); }
.dot-red { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.12); }

.ebtn {
  appearance: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.ebtn:focus-visible { outline: 2px solid var(--link-color, #3b82f6); outline-offset: 2px; }
.ebtn:disabled { opacity: 0.5; cursor: not-allowed; }
.ebtn[hidden] { display: none !important; }

.ebtn-primary { background: var(--link-color, #2563eb); color: #fff; border-color: var(--link-color, #2563eb); }
.ebtn-primary:hover { background: var(--link-hover, #1d4ed8); border-color: var(--link-hover, #1d4ed8); }
.ebtn-ghost { background: var(--edit-bg); color: var(--edit-ink); border-color: var(--edit-border); }
.ebtn-ghost:hover { background: var(--code-bg, #f8fafc); border-color: #cbd5e1; }

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.edit-card {
  background: var(--edit-bg);
  border: 1px solid var(--edit-border);
  border-radius: var(--edit-radius-lg);
  padding: 16px;
  min-width: 0;
}

.edit-card h3 {
  margin: 0 0 10px;
  padding: 0;
  border: none;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--edit-muted);
}

.dropzone, .result-box {
  position: relative;
  background: #0f172a;
  border: 1px dashed #475569;
  border-radius: var(--edit-radius);
  overflow: hidden;
  aspect-ratio: 1;
  max-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.result-box { cursor: default; }

.dropzone img, .result-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0f172a;
}

.dropzone img[hidden], .result-box img[hidden] { display: none !important; }

.drop-hint {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 550;
  text-align: center;
  padding: 12px;
}

.drop-hint i { display: block; font-size: 22px; margin-bottom: 8px; color: #64748b; }
.drop-hint[hidden] { display: none !important; }

.dropzone:focus-visible { outline: 2px solid var(--link-color, #3b82f6); outline-offset: 2px; }

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--edit-muted);
  margin: 12px 0 6px;
}

.edit-card textarea, .edit-card select {
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--edit-border);
  border-radius: 8px;
  background: #fff;
  color: var(--edit-ink);
  box-sizing: border-box;
}

.edit-card textarea { width: 100%; resize: vertical; min-height: 64px; line-height: 1.55; }
.edit-card select { height: 36px; }
.edit-card textarea:focus, .edit-card select:focus {
  outline: none;
  border-color: var(--link-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.14);
}

.edit-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 4px; }
.edit-row .field-label { margin: 0 0 6px; }
.edit-row > div { display: flex; flex-direction: column; }
.edit-row-btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.edit-note { margin: 10px 0 0; font-size: 12.5px; color: var(--edit-muted); line-height: 1.55; min-height: 19px; }

.edit-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
  border-radius: 9px;
  font-size: 13px;
  padding: 10px 12px;
  margin-bottom: 12px;
  line-height: 1.55;
}

.edit-error[hidden] { display: none !important; }

.edit-help {
  margin-top: 12px;
  font-size: 13px;
  background: var(--edit-bg);
  border: 1px solid var(--edit-border);
  border-radius: 10px;
  overflow: hidden;
}

.edit-help summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--edit-ink);
  padding: 11px 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-help summary::-webkit-details-marker { display: none; }
.edit-help[open] summary { border-bottom: 1px solid var(--edit-border); background: var(--code-bg, #f8fafc); }
.edit-help summary i { color: var(--edit-muted); font-size: 12px; }
.edit-help > div { padding: 12px 14px; }
.edit-help ul { margin: 8px 0 4px; padding-left: 18px; }
.edit-help li { margin-bottom: 7px; line-height: 1.55; color: var(--edit-ink); }
.edit-help p { color: var(--edit-muted); }

.code-box {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  overflow-x: auto;
  line-height: 1.5;
}

.code-box code { color: #e2e8f0; background: transparent; border: none; padding: 0; }

@media (prefers-color-scheme: dark) {
  .edit-card textarea, .edit-card select { background: rgba(15,23,42,0.6); color: var(--edit-ink); }
  .edit-hero, .edit-card, .edit-help { background: rgba(15,23,42,0.55); }
}

@media (max-width: 720px) {
  .edit-grid { grid-template-columns: 1fr; }
  .edit-row-btns { margin-left: 0; }
  .edit-actions { margin-left: 0; width: 100%; }
}
