
@font-face {
  font-family: "Century Gothic";
  src: local("Century Gothic"), local("CenturyGothic");
}

:root {
  --anthracite: #262626;
  --anthracite-2: #353535;
  --light-gray: #ecebe7;
  --cream: #f7f4ee;
  --white: #ffffff;
  --orange: #ffa100;
  --orange-soft: rgba(255, 161, 0, .14);
  --green: #2f6f52;
  --red: #a63f38;
  --muted: #747474;
  --border: #dedbd4;
  --shadow: 0 18px 50px rgba(32, 32, 32, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--anthracite);
  background: var(--cream);
  font-family: "Century Gothic", Avenir, Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }

.topbar {
  height: 76px;
  background: var(--anthracite);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.7px;
}
.brand span { color: var(--orange); }
.demo-badge {
  font-size: 12px;
  font-weight: 700;
  font-style: normal;
  letter-spacing: .3px;
  color: #262626;
  background: var(--orange);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 8px;
}

.nav { display: flex; gap: 8px; }
.nav a {
  color: white;
  text-decoration: none;
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.nav a:hover, .nav a.active { background: var(--anthracite-2); }

.shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 32px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-weight: 800;
}

h1, h2, h3 { margin-top: 0; letter-spacing: -.8px; }
h1 { margin-bottom: 0; font-size: clamp(30px, 4vw, 50px); }
h2 { font-size: 25px; }
h3 { font-size: 19px; }

.mode-pill, .badge, .hint {
  border-radius: 999px;
  background: var(--light-gray);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}
.mode-pill { background: var(--orange); color: var(--anthracite); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  gap: 24px;
}

.card {
  background: white;
  border: 1px solid rgba(0,0,0,.03);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 22px;
}
.card.compact { padding: 18px 22px; }
.sticky { position: sticky; top: 100px; }

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.step-title-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.photo-count-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--light-gray);
}
.photo-count-control.is-busy { opacity: .55; pointer-events: none; }
.photo-count-label {
  font-size: 11px;
  font-weight: 800;
  padding-left: 8px;
  white-space: nowrap;
}
.photo-count-control .count-step {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: white;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.photo-count-control .count-value {
  min-width: 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.photo-choice { position: relative; min-width: 0; }
.photo-choice input { display: none; }
.photo-choice label {
  display: block;
  overflow: hidden;
  border-radius: 18px;
  background: var(--light-gray);
  border: 3px solid transparent;
  cursor: pointer;
  transition: .18s ease;
}
.photo-choice input:checked + label {
  border-color: var(--orange);
  box-shadow: 0 0 0 5px var(--orange-soft);
}
.photo-choice label::after {
  content: "✓";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .85);
  color: transparent;
  font-weight: 800;
  border: 2px solid rgba(0, 0, 0, .15);
  transition: .18s ease;
  pointer-events: none;
}
.photo-choice input:checked + label::after {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.photo-choice img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.photo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
}
.photo-id {
  background: var(--orange-soft);
  color: var(--orange);
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: .06em;
}
.photo-ai-flag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.photo-edit {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--anthracite);
  cursor: pointer;
  transition: .18s ease;
}
.photo-edit:hover { border-color: var(--orange); color: var(--orange); }

.editor-dialog {
  max-width: min(520px, 92vw);
  max-height: none;
}
.editor-dialog input,
.editor-dialog textarea { width: 100%; }
.editor-dialog .primary-action { margin-top: 18px; }

.form-grid, .settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
label {
  display: block;
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 800;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  background: white;
  color: var(--anthracite);
}
textarea { resize: vertical; }

.variant-stage {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 18px;
  align-items: center;
  background: var(--cream);
  border-radius: 20px;
  padding: 15px;
  margin-top: 18px;
}
.variant-stage img {
  width: 190px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 14px;
  background: var(--light-gray);
}
.variant-stage p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.primary-action, .secondary-action, button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-action {
  margin-top: 20px;
  background: var(--orange);
  color: var(--anthracite);
}
.secondary-action, .secondary {
  background: var(--light-gray);
  color: var(--anthracite);
}
.success { background: var(--green); color: white; }
.danger { background: var(--red); color: white; }
button:disabled { opacity: .45; cursor: not-allowed; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.status-grid div {
  background: var(--cream);
  padding: 14px;
  border-radius: 16px;
}
.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 5px;
}

.queue { display: grid; gap: 14px; }
.job-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
}
.job-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.job-head small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}
.job-card img {
  width: 100%;
  border-radius: 16px;
  margin-top: 14px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.actions.two { grid-template-columns: 1fr 1fr; }
.error { color: var(--red); font-size: 13px; }

.regen-details { margin-top: 10px; }
.regen-details > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}
.regen-form { display: grid; gap: 8px; margin-top: 8px; }
.regen-feedback {
  width: 100%;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
}
.regen-form button { width: 100%; }

.empty-state {
  grid-column: 1 / -1;
  background: var(--cream);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
}
.empty-state p { color: var(--muted); margin-bottom: 0; }

.settings-stack { display: grid; gap: 0; }
.lead { color: var(--muted); line-height: 1.6; }

.prerequisite {
  margin: 14px 0;
  background: var(--cream);
  border-left: 4px solid var(--orange);
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.diagnostic-list { display: grid; gap: 10px; }
.diagnostic-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: var(--cream);
  padding: 14px 16px;
  border-radius: 15px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #999;
  display: inline-block;
  margin-right: 8px;
}
.dot.ok { background: var(--green); }
.dot.error { background: var(--red); }

.log {
  max-height: 520px;
  overflow: auto;
  border-radius: 16px;
  background: #1f1f1f;
  color: #e8e8e8;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.log div {
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

@media (max-width: 1050px) {
  .layout, .diagnostic-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 760px) {
  .topbar { height: auto; padding: 16px; align-items: flex-start; gap: 12px; flex-direction: column; }
  .shell { padding: 18px; }
  .nav { width: 100%; overflow-x: auto; }
  .page-head { align-items: flex-start; gap: 15px; flex-direction: column; }
  .photo-grid, .form-grid, .settings-grid, .status-grid { grid-template-columns: 1fr; }
  .variant-stage { grid-template-columns: 1fr; }
  .variant-stage img { width: 100%; }
  .actions { grid-template-columns: 1fr; }
}

/* PATCH v0.3.2 */
.image-wrap { position: relative; }
.image-wrap img { display: block; }
.zoom-button {
  position: absolute;
  top: 24px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  padding: 0;
  background: rgba(38,38,38,.86);
  color: white;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.zoom-button:hover { background: #ffa100; color: #262626; }
.photo-choice .zoom-button { top: 10px; }

.preview-modal { display: none; position: fixed; inset: 0; z-index: 1000; }
.preview-modal.open { display: block; }
.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18,18,18,.82);
  backdrop-filter: blur(10px);
}
.preview-dialog {
  position: relative;
  z-index: 1;
  max-width: min(1100px, 92vw);
  max-height: 92vh;
  margin: 4vh auto;
  background: #f7f4ee;
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 30px 90px rgba(0,0,0,.38);
  overflow: auto;
}
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.preview-toolbar button { width: auto; min-width: 120px; }
.preview-dialog img {
  display: block;
  width: 100%;
  max-height: calc(92vh - 95px);
  object-fit: contain;
  border-radius: 16px;
  background: #1f1f1f;
}
.modal-open { overflow: hidden; }

.folder-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.folder-button { width: auto; min-width: 110px; white-space: nowrap; }
.preview-button { border: 0; }

@media (max-width: 760px) {
  .folder-control { grid-template-columns: 1fr; }
  .folder-button { width: 100%; }
  .preview-dialog { margin: 2vh auto; max-height: 96vh; }
}

/* --- Explorateur de fichiers ------------------------------------------- */
.fs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.fs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 40px;
}
.fs-crumb {
  width: auto;
  background: var(--light-gray);
  color: var(--anthracite);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.fs-crumb:hover { background: var(--orange); }
.fs-crumb-sep { color: var(--muted); font-weight: 800; }
.fs-actions { display: flex; gap: 10px; }
.fs-actions button { width: auto; white-space: nowrap; }

.fs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.fs-tree {
  background: var(--cream);
  border-radius: 18px;
  padding: 10px;
  max-height: 66vh;
  overflow: auto;
}
.fs-tree-node {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: var(--anthracite);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-tree-node:hover { background: var(--light-gray); }
.fs-tree-node.active { background: var(--orange); }

.fs-main { min-width: 0; }

.fs-selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--orange-soft);
  border: 1px solid var(--orange);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-weight: 800;
  font-size: 13px;
}
.fs-selection-bar[hidden] { display: none; }
.fs-move-control { display: flex; gap: 8px; align-items: center; }
.fs-move-control select { width: auto; min-width: 190px; }
.fs-move-control button { width: auto; }

.fs-dropzone {
  border: 2px dashed transparent;
  border-radius: 20px;
  min-height: 220px;
  padding: 4px;
  transition: .15s ease;
}
.fs-drop-hover {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.fs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.fs-item {
  position: relative;
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  transition: .12s ease;
}
.fs-item:hover { border-color: var(--border); }
.fs-file.selected { border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.fs-folder:hover { background: var(--light-gray); }

.fs-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  background: var(--light-gray);
  object-fit: cover;
  overflow: hidden;
  font-size: 32px;
}
.fs-thumb-file { font-size: 15px; font-weight: 800; color: var(--muted); letter-spacing: .5px; }

.fs-name {
  margin-top: 9px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-meta { margin-top: 3px; font-size: 11px; color: var(--muted); }

.fs-zoom {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0;
  background: rgba(38,38,38,.86);
  color: white;
  font-size: 20px;
  line-height: 1;
}
.fs-zoom:hover { background: var(--orange); color: var(--anthracite); }

.fs-hint {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}
.fs-hint p { margin: 6px 0 0; }
.fs-status { margin: 16px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.fs-status.error { color: var(--red); }

@media (max-width: 760px) {
  .fs-layout { grid-template-columns: 1fr; }
  .fs-tree { max-height: 200px; }
  .fs-actions { width: 100%; }
  .fs-actions button { flex: 1; }
}

.scan-form { margin: 0 0 16px; }
.scan-form button { width: 100%; }
.external-task { margin: 12px 0; }
.external-task .hint { margin-bottom: 8px; }
.external-task code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}
.external-task details > summary { cursor: pointer; font-size: 13px; }
.external-task .prompt-box {
  width: 100%;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
}
