/* Lucid Studio — thème commun « Higgsfield » : fond quasi noir, accent lime,
   cartes sombres à bords fins, titres en capitales serrées.
   Chargé par toutes les pages (coquille, connexion, stats, Repost, Photos,
   Studio) ; chaque outil n'ajoute ensuite que sa mise en page. */
:root {
  --bg: #0f1113; --panel: #17191c; --panel-2: #1e2125; --panel-3: #262a2e; --border: #262a2e; --border-2: #33383d;
  --text: #f7f7f8; --muted: #a8a8a8; --muted-2: #6f7378;
  --accent: #d1fe17; --accent-ink: #1a1a1a; --accent-dim: #9fc60e; --accent-glow: rgba(209, 254, 23, .18); --accent-soft: rgba(209, 254, 23, .1);
  --accent-2: var(--accent); --pink: #ff2d8a; --ok: #3ecf8e; --err: #ff5c5c; --err-soft: #ff9d9d;
  --radius: 14px; --radius-sm: 10px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, select, textarea, input { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* --- Barre du haut ------------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 3vw, 32px); background: rgba(15, 17, 19, .82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 700; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; text-transform: uppercase; white-space: nowrap; }
.brand-tag { color: var(--muted-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--panel); font-size: 12px; color: var(--muted); }
.pill-cost .cost-label { text-transform: uppercase; letter-spacing: .08em; font-size: 10px; color: var(--muted-2); }
.pill-cost #costTotal { color: var(--text); font-weight: 600; font-size: 13px; }
.pill-cost.flash { border-color: var(--accent); box-shadow: 0 0 18px var(--accent-glow); }
.pill-muted { color: var(--muted-2); }

/* --- Titres --------------------------------------------------------------- */
h1.display { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.05; letter-spacing: -.03em; text-transform: uppercase; margin: 0; }
h1.display span { color: var(--muted); }
h2 { font-family: var(--display); font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--text); margin: 0 0 16px; font-weight: 700; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 600; }

/* --- Cartes --------------------------------------------------------------- */
.col, .panel, .card-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }

/* --- Champs --------------------------------------------------------------- */
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 500; }
.cat-info { margin-top: 6px; font-size: 11px; color: var(--muted-2); line-height: 1.5; }
.cat-info.err { color: #e5827a; }
.cat-info.ok, #tpStatus.ok { color: var(--ok); }
.tp-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.tp-toggle:hover { color: var(--text); }
.row-between { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; }

input[type="text"], input[type="password"], input:not([type]), select, textarea, .sel {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 10px 12px; border-radius: 12px; font-size: 14px; transition: border-color .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: #4a5058; background: var(--panel-3); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23a8a8a8' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; }
select option { background: var(--panel-2); color: var(--text); }
input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
textarea { resize: vertical; line-height: 1.45; }

/* --- Boutons -------------------------------------------------------------- */
button { cursor: pointer; }
button.primary {
  width: 100%; height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 3px 0 var(--accent-dim), 0 0 24px var(--accent-glow); transition: transform .08s, box-shadow .08s, filter .15s; margin: 4px 0 8px;
}
button.primary:hover { filter: brightness(1.05); }
button.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dim); }
button.primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; filter: none; }
button.ghost { background: var(--panel); color: var(--muted); border: 1px solid var(--border-2); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 500; transition: border-color .15s, color .15s, background .15s; white-space: nowrap; }
button.ghost:hover { border-color: var(--accent); color: var(--text); }
button.ghost:disabled { opacity: .5; cursor: not-allowed; }
button.ghost.mini { padding: 3px 9px; font-size: 11px; }
button.danger { background: transparent; color: #ff8a8a; border: 1px solid #4a2a2a; border-radius: 999px; padding: 6px 12px; font-size: 12px; }
button.danger:hover { border-color: var(--err); }
.icon-btn { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); font-size: 20px; line-height: 1; transition: border-color .15s, background .15s; }
.icon-btn:hover { border-color: var(--accent); background: var(--panel-3); }

.segmented { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--muted); height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; transition: background .15s, color .15s; white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--accent); color: var(--accent-ink); }

/* --- Zones de dépôt ------------------------------------------------------- */
.dropzone, .tpl-slot { border: 1.5px dashed var(--border-2); border-radius: 14px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; }
.dropzone:hover, .tpl-slot:hover { border-color: var(--muted-2); }
.dropzone.drag, .tpl-slot.drag { border-color: var(--accent); background: var(--accent-soft); }
.tpl-slot.set { border-style: solid; border-color: var(--ok); }
.tpl-empty, .dropzone .hint { color: var(--muted-2); text-align: center; font-size: 13px; line-height: 1.6; padding: 12px; }

/* --- Retour, toasts, lightbox, fenêtres ----------------------------------- */
.msg { color: var(--ok); font-size: 13px; margin-top: 12px; min-height: 18px; }
.msg.err { color: var(--err-soft); }
.status { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--panel); border: 1px solid var(--border-2); color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.status.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.status.err { border-color: var(--err); color: var(--err-soft); }

.lightbox { position: fixed; inset: 0; background: rgba(8, 9, 10, .92); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 50; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 95vw; max-height: 95vh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }

.modal { position: fixed; inset: 0; background: rgba(8, 9, 10, .74); backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal-card { width: min(760px, 100%); background: var(--panel); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); overflow: hidden; animation: modal-in .18s ease-out; }
@keyframes modal-in { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 0; }
.modal-head h3 { margin: 0 0 4px; font-family: var(--display); font-size: 14px; text-transform: uppercase; letter-spacing: .1em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal-actions .primary { width: auto; height: 40px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* Les sous-outils : un contenu centré, sur la même largeur que le Studio. */
.page-main, .page-section { padding: 0 clamp(16px, 3vw, 32px); max-width: 1400px; margin: 0 auto; }
