/* =========================================================================
   components.css - Composants de l'interface
   ========================================================================= */

/* -------------------------------------------------------------------------
   Marque
   ------------------------------------------------------------------------- */
.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.brand__mark {
    width: 34px;
    height: 34px;
    flex: none;
}
/* Logo bicolore : fond et creux (soleil, montagne) en accent, cases de la mosaïque en on-accent. */
.brand__tile { fill: var(--accent); }
.brand__photo { fill: var(--on-accent); }

.brand__text {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    white-space: nowrap;
}

.brand__name {
    font: 600 15.5px/1 var(--font-display);
    letter-spacing: -.01em;
}

.brand__tag {
    font-size: 12.5px;
    color: var(--text-3);
}

/* -------------------------------------------------------------------------
   Boutons
   ------------------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease),
                border-color var(--t-fast) var(--ease),
                box-shadow var(--t-fast) var(--ease),
                transform var(--t-fast) var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; }

.btn--primary {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgb(255 255 255 / .12);
}
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn--secondary {
    background: var(--raised);
    color: var(--text);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-sm);
}
.btn--secondary:hover:not(:disabled) { background: var(--hover); }

.btn--ghost { color: var(--text-2); }
.btn--ghost:hover:not(:disabled) {
    background: var(--hover);
    color: var(--text);
}

/* Bouton occupé : l'icône devient une roue */
.btn.is-busy { pointer-events: none; }
.btn.is-busy:disabled { opacity: 1; }
.btn.is-busy .icon { visibility: hidden; }
.btn.is-busy::before {
    content: "";
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover:not(:disabled) {
    background: var(--hover);
    color: var(--text);
}
.icon-btn:disabled { opacity: .35; }
.icon-btn--sm { width: 28px; height: 28px; }
.icon-btn--sm .icon { width: 16px; height: 16px; }

/* Bouton de thème : une icône par mode */
.theme-btn .icon { display: none; }
.theme-btn[data-mode="auto"]  .theme-btn__auto,
.theme-btn[data-mode="light"] .theme-btn__light,
.theme-btn[data-mode="dark"]  .theme-btn__dark { display: block; }

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

/* -------------------------------------------------------------------------
   Panneau des photos
   ------------------------------------------------------------------------- */
.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 12px 4px 16px;
}

.panel__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--field);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.panel__hint {
    padding: 0 16px 8px;
    font-size: 12px;
    color: var(--text-3);
}

.panel__foot {
    padding: 8px 12px 12px;
    border-top: 1px solid var(--line);
}

.add-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 38px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    transition: border-color var(--t-fast), color var(--t-fast), background-color var(--t-fast);
}
.add-tile:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.add-tile .icon { width: 16px; height: 16px; }

.photos-empty {
    flex: 1;
    padding: 24px 20px;
    text-align: center;
    color: var(--text-2);
    font-size: 13px;
}
.photos-empty__sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-3);
}

/* -------------------------------------------------------------------------
   Liste des photos (triable)
   ------------------------------------------------------------------------- */
.photo-list {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 8px 12px;
}
.photo-list:empty { display: none; }

.photo {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 6px 2px;
    border-radius: var(--radius-sm);
    background: var(--panel);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
}
.photo + .photo,
.photo + .photo-placeholder,
.photo-placeholder + .photo { margin-top: 2px; }

.photo:hover { background: var(--hover); }
.photo:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent);
}
.photo.is-linked { background: var(--accent-soft); }

.photo.is-new { animation: photo-in var(--t) var(--ease); }
@keyframes photo-in {
    from { opacity: 0; transform: translateY(4px); }
}

.photo.is-flash { animation: photo-flash .9s var(--ease); }
@keyframes photo-flash {
    0%, 40% { background: var(--accent-soft); }
}

/* Élément en cours de déplacement : sort du flux et suit le pointeur */
.photo.is-dragging {
    position: fixed;
    z-index: 1000;
    margin: 0;
    background: var(--raised);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
    pointer-events: none;
    cursor: grabbing;
}

.photo-placeholder {
    border: 1.5px dashed var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
}

.photo__grip {
    display: grid;
    place-items: center;
    width: 18px;
    align-self: stretch;
    color: var(--text-3);
    opacity: .55;
    touch-action: none;
    transition: opacity var(--t-fast);
}
.photo__grip .icon { width: 16px; height: 16px; }
.photo:hover .photo__grip,
.photo:focus-visible .photo__grip { opacity: 1; }

.photo__thumb {
    position: relative;
    width: 44px;
    height: 44px;
    flex: none;
    overflow: hidden;
    border-radius: var(--radius-xs);
    box-shadow: inset 0 0 0 1px var(--line);
    background-size: 10px 10px;
}
.photo__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.photo__index {
    position: absolute;
    left: 3px;
    top: 3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border-radius: 4px;
    background: rgb(15 14 12 / .62);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(4px);
}

.photo__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.photo__name {
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.photo__dims {
    font-size: 11.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo__remove {
    opacity: 0;
    transition: opacity var(--t-fast), background-color var(--t-fast), color var(--t-fast);
}
.photo:hover .photo__remove,
.photo:focus-within .photo__remove { opacity: 1; }
.photo__remove:hover:not(:disabled) { color: var(--danger); }

@media (hover: none) {
    .photo__remove { opacity: 1; }
    .photo__grip { opacity: 1; }
}

/* -------------------------------------------------------------------------
   État vide : zone de dépôt
   ------------------------------------------------------------------------- */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(500px, 100%);
    padding: 40px 32px 32px;
    border: 1.5px dashed var(--line-strong);
    border-radius: 20px;
    background: color-mix(in srgb, var(--panel) 72%, transparent);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.dropzone:hover {
    border-color: var(--accent);
    background: var(--panel);
}
.dropzone:focus-visible { outline-offset: 4px; }

.dropzone__art {
    width: 168px;
    height: auto;
    margin-bottom: 18px;
    overflow: visible;
}
.art-card rect {
    fill: var(--raised);
    stroke: var(--line-strong);
    stroke-width: 1.5;
}
.art-card path,
.art-card circle {
    fill: var(--line-strong);
    stroke: none;
}
.art-card--left  { transform: rotate(-7deg); transform-origin: 40px 86px; }
.art-card--right { transform: rotate(7deg);  transform-origin: 120px 86px; }
.art-card--center rect { stroke: var(--accent); }
.art-card--center path { fill: var(--accent); opacity: .85; }
.art-card--center circle { fill: var(--accent); opacity: .55; }

.art-card { transition: transform var(--t) var(--ease); }
.dropzone:hover .art-card--left  { transform: rotate(-11deg) translateX(-4px); }
.dropzone:hover .art-card--right { transform: rotate(11deg) translateX(4px); }

.dropzone__title {
    font: 600 22px/1.2 var(--font-display);
    letter-spacing: -.015em;
}

.dropzone__text {
    max-width: 340px;
    margin-top: 8px;
    color: var(--text-2);
    line-height: 1.6;
}

.dropzone__btn {
    margin-top: 20px;
    pointer-events: none;
}

.dropzone__formats {
    margin-top: 14px;
    font-size: 11.5px;
    color: var(--text-3);
    letter-spacing: .02em;
}

.dropzone__privacy {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-2);
}
.dropzone__privacy .icon {
    width: 14px;
    height: 14px;
    color: var(--accent);
}

/* Message affiché seulement si JavaScript est désactivé */
.noscript {
    position: fixed;
    inset: auto 16px 16px;
    z-index: 2000;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

/* -------------------------------------------------------------------------
   Aperçu
   ------------------------------------------------------------------------- */
.stage__frame {
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: frame-in var(--t) var(--ease);
}
@keyframes frame-in {
    from { opacity: 0; transform: scale(.985); }
}

.stage__canvas {
    cursor: default;
    touch-action: none;
}
.stage__canvas.is-over-cell { cursor: grab; }

/* Écran tactile étroit : un glissement vertical fait défiler la page */
@media (max-width: 920px) {
    .stage__canvas { touch-action: pan-y; }
}

.stage__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cell {
    position: absolute;
    border-radius: 1px;
}

.cell--hover { box-shadow: inset 0 0 0 2px var(--accent); }

.cell--source {
    background: rgb(10 10 9 / .5);
    box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .5);
}

.cell--target {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    box-shadow: inset 0 0 0 3px var(--accent);
}

.cell__badge {
    position: absolute;
    left: 6px;
    top: 6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    box-shadow: var(--shadow-md);
}

.stage__bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px;
    pointer-events: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(8px);
}
.chip .icon { width: 14px; height: 14px; }
.chip--muted { color: var(--text-3); }

@media (max-width: 1180px) {
    .stage__tip { display: none; }
}

/* -------------------------------------------------------------------------
   Réglages
   ------------------------------------------------------------------------- */
.settings {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 16px 8px;
}

.section {
    padding: 16px 0 18px;
}
.section + .section { border-top: 1px solid var(--line); }

.section__title {
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.field {
    display: grid;
    gap: 7px;
    margin-top: 14px;
}
.field--inline {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
.field__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.field__label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
}
.field__hint {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-3);
}
.field .field__hint { margin-top: 0; }
.field__hint:empty { display: none; }
.field__hint.is-warning { color: var(--accent); }

/* Tuiles de disposition */
.tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 2px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--t-fast), background-color var(--t-fast), color var(--t-fast);
}
.tile:hover { border-color: var(--line-strong); color: var(--text); }
.tile__icon {
    width: 30px;
    height: 22px;
    fill: currentColor;
    opacity: .55;
    transition: opacity var(--t-fast);
}
.tile:has(:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
}
.tile:has(:checked) .tile__icon {
    fill: var(--accent);
    opacity: 1;
}
.tile:has(:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Contrôle segmenté */
.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--field);
}
.segmented--full { display: flex; }
.segmented label {
    position: relative;
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.segmented label:hover { color: var(--text); }
.segmented label:has(:checked) {
    background: var(--raised);
    color: var(--text);
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}
.segmented label:has(:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.segmented label:has(:disabled) {
    opacity: .4;
    cursor: not-allowed;
}

.segmented--icons label { padding: 0 7px; }
.segmented--icons .icon {
    width: 17px;
    height: 17px;
    transition: transform var(--t) var(--ease);
}
/* Axe horizontal : on tourne les icônes "haut / centre / bas" en "gauche / centre / droite" */
.segmented--icons[data-axis="x"] .icon { transform: rotate(-90deg); }

/* Champs de saisie */
.input {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--field);
    font-size: 13px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--line-strong); }
.input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--panel);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.input.is-invalid { border-color: var(--danger); }

.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    min-width: 0;
}
.input-group__suffix {
    display: grid;
    place-items: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    background: var(--hover);
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 500;
}

/* Petit champ numérique avec unité */
.num {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 8px 0 2px;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    transition: border-color var(--t-fast), background-color var(--t-fast);
}
.num:hover { border-color: var(--line); }
.num:focus-within {
    border-color: var(--accent);
    background: var(--field);
}
.num--wide {
    height: 32px;
    border-color: var(--line);
    background: var(--field);
}
.num__input {
    width: 44px;
    padding: 0 2px;
    border: 0;
    background: none;
    font-size: 12.5px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}
.num--wide .num__input { width: 64px; }
.num__input:focus { outline: none; }
.num__input::-webkit-inner-spin-button,
.num__input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.num__unit {
    margin-left: 3px;
    font-size: 12px;
    color: var(--text-3);
}

/* Pas à pas (- 3 +) */
.stepper {
    display: inline-flex;
    align-items: center;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--field);
}
.stepper__btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 100%;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    transition: color var(--t-fast), background-color var(--t-fast);
}
.stepper__btn:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.stepper__btn:disabled { opacity: .35; }
.stepper__btn .icon { width: 14px; height: 14px; }
.stepper__input {
    width: 34px;
    height: 100%;
    border: 0;
    background: none;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}
.stepper__input:focus { outline: none; }
.stepper:focus-within { border-color: var(--accent); }
.stepper__input::-webkit-inner-spin-button,
.stepper__input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Curseur : la piste se remplit grâce à --fill (mis à jour en JS) */
.range {
    --fill: 0%;
    width: 100%;
    height: 18px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.range:focus { outline: none; }
.range::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--accent) var(--fill), var(--line-strong) var(--fill));
}
.range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    background: var(--raised);
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.range:hover::-webkit-slider-thumb { transform: scale(1.1); }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-ring); }
.range::-moz-range-track {
    height: 4px;
    border-radius: 4px;
    background: var(--line-strong);
}
.range::-moz-range-progress {
    height: 4px;
    border-radius: 4px;
    background: var(--accent);
}
.range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    background: var(--raised);
    box-shadow: var(--shadow-sm);
}
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-ring); }

/* Liste déroulante */
.select { position: relative; }
.select select {
    width: 100%;
    height: 34px;
    padding: 0 32px 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--field);
    font-size: 13px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.select select:hover { border-color: var(--line-strong); }
.select select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.select::after {
    content: "";
    position: absolute;
    right: 13px;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -5px;
    border-right: 1.6px solid var(--text-3);
    border-bottom: 1.6px solid var(--text-3);
    transform: rotate(45deg);
    pointer-events: none;
}

/* Modèles de mosaïque */
.presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 6px;
}
.presets__empty {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-3);
}
.preset {
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 7px 4px 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--text-3);
    transition: border-color var(--t-fast), background-color var(--t-fast), color var(--t-fast);
}
.preset svg {
    width: 36px;
    height: 27px;
    fill: currentColor;
    opacity: .7;
}
.preset__label {
    font-size: 10.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-3);
}
.preset:hover { border-color: var(--line-strong); color: var(--text-2); }
.preset.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}
.preset.is-active svg { opacity: 1; }
.preset.is-active .preset__label { color: var(--accent); }

/* Pastilles de couleur de fond */
.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}
.swatch {
    --c: transparent;
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: inset 0 0 0 1px var(--swatch-ring);
    cursor: pointer;
    transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.swatch:hover { transform: scale(1.08); }
.swatch:has(:checked),
.swatch.is-active {
    box-shadow: inset 0 0 0 1px var(--swatch-ring), 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}
.swatch:has(:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}
.swatch--transparent {
    background-color: #fff;
    background-image: conic-gradient(#d4d0c8 25%, transparent 0 50%, #d4d0c8 0 75%, transparent 0);
    background-size: 10px 10px;
}
.swatch--white    { --c: #ffffff; }
.swatch--cream    { --c: #f3eee4; }
.swatch--grey     { --c: #8c8c8c; }
.swatch--charcoal { --c: #1e1e1e; }
.swatch--black    { --c: #000000; }
.swatch--custom {
    background: conic-gradient(from 90deg, #e8534a, #f0b04f, #7bc96f, #4fa3d9, #8f6ad8, #e8534a);
}
.swatch--custom.is-active { background: var(--c); }
.swatch--custom input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: 0;
    padding: 0;
}

/* -------------------------------------------------------------------------
   Barre d'export
   ------------------------------------------------------------------------- */
.export-bar {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.export-bar__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.export-bar__warn {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    color: var(--accent);
    line-height: 1.4;
}
.export-bar__warn .icon {
    width: 14px;
    height: 14px;
    margin-top: 1px;
}

.export-bar__buttons {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

@media (max-width: 920px) {
    .export-bar {
        position: sticky;
        bottom: 0;
        z-index: 4;
        box-shadow: 0 -8px 24px var(--shadow-color);
    }
    .photo-list { max-height: 340px; }
    .toasts { bottom: 132px; }  /* au-dessus de la barre d'export collée en bas */
}

/* -------------------------------------------------------------------------
   Voile de dépôt (fichiers glissés depuis l'explorateur)
   ------------------------------------------------------------------------- */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: grid;
    place-items: center;
    padding: 14px;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity var(--t) var(--ease);
    pointer-events: none;
}
.drop-overlay.is-visible { opacity: 1; }
.drop-overlay::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 2px dashed var(--accent);
    border-radius: 20px;
}
.drop-overlay__box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    font: 600 16px/1.3 var(--font-display);
    transform: translateY(6px);
    transition: transform var(--t) var(--ease);
}
.drop-overlay.is-visible .drop-overlay__box { transform: none; }
.drop-overlay__box .icon {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

/* -------------------------------------------------------------------------
   Vignette d'échange (aperçu)
   ------------------------------------------------------------------------- */
.drag-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 2px solid var(--raised);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    will-change: transform;
}
.drag-ghost img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* -------------------------------------------------------------------------
   Notifications
   ------------------------------------------------------------------------- */
.toasts {
    position: fixed;
    left: 50%;
    bottom: 64px;   /* au-dessus des pastilles d'information de l'aperçu */
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 32px);
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-height: 42px;
    padding: 8px 8px 8px 14px;
    border-radius: var(--radius-md);
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(8px) scale(.98);
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast.is-leaving { opacity: 0; transform: translateY(4px) scale(.98); }

.toast > .icon { width: 17px; height: 17px; }
.toast--success > .icon { color: var(--success); }
.toast--error > .icon { color: var(--danger); }
.toast--info > .icon { color: var(--on-ink-2); }

.toast__text {
    flex: 1;
    padding-right: 4px;
    line-height: 1.4;
}

.toast__action {
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    color: var(--accent);
    font-weight: 600;
    transition: background-color var(--t-fast);
    filter: brightness(1.15);
}
.toast__action:hover { background: rgb(127 127 127 / .18); }

.toast__close {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    color: var(--on-ink-2);
}
.toast__close:hover { color: var(--on-ink); background: rgb(127 127 127 / .18); }
.toast__close .icon { width: 14px; height: 14px; }

.spinner {
    width: 16px;
    height: 16px;
    flex: none;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: .8;
    animation: spin .7s linear infinite;
}

/* -------------------------------------------------------------------------
   Fenêtre d'aide (popover natif)
   ------------------------------------------------------------------------- */
.popover {
    /* Le reset "* { margin: 0 }" annule le centrage natif des popovers */
    margin: auto;
    width: min(400px, calc(100vw - 32px));
    padding: 18px 20px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}
.popover::backdrop {
    background: rgb(10 10 9 / .28);
    backdrop-filter: blur(2px);
}

.popover__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.popover__title { font: 600 16px/1.2 var(--font-display); }

.shortcuts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 16px;
    align-items: center;
    font-size: 13px;
}
.shortcuts dt {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}
.shortcuts dd {
    margin: 0;
    color: var(--text-2);
}

.popover__note {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-3);
}
