/*
 * Technema Hub — thème aligné sur le design system Malta (@malta/design-system).
 * Tokens OKLCH repris tels quels depuis packages/design-system/src/styles/
 * (globals.css + themes.css). Mode sombre par défaut (façon Homarr).
 *
 * Structure des thèmes (identique à Malta) :
 *   - palette   = classe data-theme sur <html> : malta (défaut) | teal | forest
 *   - mode      = classe .dark sur <html>
 */

/* ---------- MALTA (palette par défaut) ---------- */
:root {
    --radius: 0.625rem;

    --background: oklch(0.95 0.002 40);
    --foreground: oklch(0.18 0.005 40);
    --card: oklch(0.97 0.001 40);
    --card-foreground: oklch(0.18 0.005 40);
    --primary: oklch(0.648 0.239 33);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.91 0.002 40);
    --secondary-foreground: oklch(0.25 0.005 40);
    --muted: oklch(0.9 0.002 40);
    --muted-foreground: oklch(0.45 0.005 40);
    --accent: oklch(0.9 0.002 40);
    --accent-foreground: oklch(0.25 0.005 40);
    --border: oklch(0.87 0.003 40);
    --ring: oklch(0.48 0.2 33);
}

.dark {
    --background: oklch(0.22 0.002 40);
    --foreground: oklch(0.98 0 0);
    --card: oklch(0.26 0.002 40);
    --card-foreground: oklch(0.98 0 0);
    --primary: oklch(0.648 0.239 33);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.32 0.003 40);
    --secondary-foreground: oklch(0.98 0 0);
    --muted: oklch(0.32 0.003 40);
    --muted-foreground: oklch(0.8 0 0);
    --accent: oklch(0.42 0.004 40);
    --accent-foreground: oklch(0.98 0 0);
    --border: oklch(1 0 0 / 15%);
    --ring: oklch(0.78 0.22 33);
}

/* ---------- TEAL ---------- */
[data-theme='teal'] {
    --background: oklch(0.96 0.003 200);
    --foreground: oklch(0.2 0.01 200);
    --card: oklch(0.98 0.002 200);
    --card-foreground: oklch(0.2 0.01 200);
    --primary: oklch(0.52 0.11 200);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.92 0.003 200);
    --secondary-foreground: oklch(0.28 0.01 200);
    --muted: oklch(0.91 0.003 200);
    --muted-foreground: oklch(0.48 0.01 200);
    --accent: oklch(0.91 0.003 200);
    --accent-foreground: oklch(0.28 0.01 200);
    --border: oklch(0.88 0.005 200);
    --ring: oklch(0.35 0.13 200);
}

.dark[data-theme='teal'] {
    --background: oklch(0.2 0.005 200);
    --foreground: oklch(0.96 0 0);
    --card: oklch(0.24 0.005 200);
    --card-foreground: oklch(0.96 0 0);
    --primary: oklch(0.65 0.12 200);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.3 0.008 200);
    --secondary-foreground: oklch(0.96 0 0);
    --muted: oklch(0.3 0.008 200);
    --muted-foreground: oklch(0.72 0.003 200);
    --accent: oklch(0.4 0.01 200);
    --accent-foreground: oklch(0.96 0 0);
    --border: oklch(1 0 0 / 15%);
    --ring: oklch(0.8 0.14 200);
}

/* ---------- FOREST ---------- */
[data-theme='forest'] {
    --background: oklch(0.96 0.003 140);
    --foreground: oklch(0.2 0.008 140);
    --card: oklch(0.98 0.002 140);
    --card-foreground: oklch(0.2 0.008 140);
    --primary: oklch(0.52 0.14 150);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.92 0.003 140);
    --secondary-foreground: oklch(0.28 0.008 140);
    --muted: oklch(0.91 0.003 140);
    --muted-foreground: oklch(0.48 0.008 140);
    --accent: oklch(0.91 0.003 140);
    --accent-foreground: oklch(0.28 0.008 140);
    --border: oklch(0.88 0.005 140);
    --ring: oklch(0.35 0.16 150);
}

.dark[data-theme='forest'] {
    --background: oklch(0.2 0.005 140);
    --foreground: oklch(0.96 0 0);
    --card: oklch(0.24 0.005 140);
    --card-foreground: oklch(0.96 0 0);
    --primary: oklch(0.65 0.15 150);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.3 0.008 140);
    --secondary-foreground: oklch(0.96 0 0);
    --muted: oklch(0.3 0.008 140);
    --muted-foreground: oklch(0.72 0.003 140);
    --accent: oklch(0.4 0.01 140);
    --accent-foreground: oklch(0.96 0 0);
    --border: oklch(1 0 0 / 15%);
    --ring: oklch(0.8 0.16 150);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    color-scheme: dark light;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: clamp(1rem, 3vw, 2.5rem);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, 'Helvetica Neue', Arial, sans-serif;
    background:
        radial-gradient(1100px 620px at 12% -8%, color-mix(in oklab, var(--primary) 13%, transparent), transparent 60%),
        radial-gradient(900px 520px at 100% -2%, color-mix(in oklab, var(--ring) 10%, transparent), transparent 55%),
        var(--background);
    background-attachment: fixed;
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Scrollbar fine, façon Malta */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: 5px;
}

/* ---------- Header ---------- */
.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.header__logo {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius);
    background: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 20%, transparent);
    position: relative;
    flex-shrink: 0;
}
.header__logo::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 42%;
    height: 42%;
    border-radius: 3px;
    background: var(--primary-foreground);
    transform: rotate(45deg);
}

.header__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.header__subtitle {
    margin: 0.1rem 0 0;
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

.header__tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* ---------- Recherche ---------- */
.search {
    position: relative;
    display: flex;
    align-items: center;
}
.search__icon {
    position: absolute;
    left: 0.7rem;
    width: 1rem;
    height: 1rem;
    stroke: var(--muted-foreground);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}
.search__input {
    width: min(20rem, 62vw);
    padding: 0.55rem 0.8rem 0.55rem 2.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search__input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 30%, transparent);
}

/* ---------- Palette + toggle ---------- */
.palette {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
}
.palette__btn {
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border: none;
    border-radius: calc(var(--radius) - 3px);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
}
.palette__btn:hover {
    background: var(--accent);
}
.palette__btn[aria-pressed='true'] {
    background: var(--accent);
    box-shadow: inset 0 0 0 1.5px var(--ring);
}
.swatch {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px oklch(0 0 0 / 20%);
    /* couleur définie inline depuis Hub.config.THEMES */
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.15s ease;
}
.icon-btn:hover {
    background: var(--accent);
}
.icon-btn svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon-btn .icon-moon {
    display: none;
}
.dark .icon-btn .icon-sun {
    display: none;
}
.dark .icon-btn .icon-moon {
    display: block;
}

/* ---------- Board / layout ---------- */
.board {
    max-width: 1200px;
    margin: 0 auto;
}

.project__accent {
    width: 0.5rem;
    height: 1.6rem;
    border-radius: 999px;
    background: var(--primary);
    flex-shrink: 0;
}
.project__accent--lg {
    height: 2.4rem;
    width: 0.55rem;
}
.project__name {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 620;
}
.project__desc {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: var(--muted-foreground);
}
.project__count {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    background: var(--secondary);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

/* ---------- Accueil : cartes projet ---------- */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}

.project-card {
    display: flex;
    gap: 0.85rem;
    padding: 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--card-foreground);
    transition: transform 0.14s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.18s ease;
}
.project-card:hover {
    transform: translateY(-3px);
    border-color: var(--ring);
    background: var(--accent);
    box-shadow: 0 16px 38px -20px color-mix(in oklab, var(--primary) 65%, transparent);
}
.project-card:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}
.project-card__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.project-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.9rem;
}
.project-card__cta {
    font-size: 0.8rem;
    font-weight: 550;
    color: var(--primary);
}

/* ---------- Fil d'Ariane ---------- */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto 1rem;
}
.breadcrumb__back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted-foreground);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    transition: background 0.15s ease, color 0.15s ease;
}
.breadcrumb__back:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* ---------- Page projet ---------- */
.project-view__head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}
.project-view__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 660;
    letter-spacing: -0.01em;
}

/* ---------- Catégories encadrées & pliables ---------- */
.group {
    margin-bottom: 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}

.group__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background 0.15s ease;
}
.group__head::-webkit-details-marker {
    display: none;
}
.group__head:hover {
    background: var(--accent);
}
.group[open] .group__head {
    border-bottom: 1px solid var(--border);
}
.group__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 640;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
}
.group__count {
    font-size: 0.72rem;
    color: var(--muted-foreground);
    background: var(--secondary);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}
.group__chev {
    margin-left: auto;
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: var(--muted-foreground);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.18s ease;
    transform: rotate(-90deg);
}
.group[open] .group__chev {
    transform: rotate(0);
}

/* Pli/dépli fluide via grid-template-rows (animation CSS, sans reflow forcé) */
.group__body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.group[open] .group__body {
    grid-template-rows: 1fr;
}
/* Garder le contenu rendu (et non display:none natif) pour permettre la transition */
.group:not([open]) > .group__body {
    display: grid;
}

.links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.7rem;
    padding: 1rem 1.1rem 1.15rem;
    min-height: 0;
    overflow: hidden;
}

/* Recherche : force l'ouverture visuelle même si la catégorie est repliée */
.board.is-searching .group__body {
    grid-template-rows: 1fr;
}
.board.is-searching .group__chev {
    transform: rotate(0);
}

/* Bouton "Tout réduire / déplier" dans le fil d'Ariane */
.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.breadcrumb__toggle {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.breadcrumb__toggle:hover {
    background: var(--accent);
    color: var(--foreground);
}

.tile {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.8rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--border);
    background: var(--secondary);
    transition: transform 0.14s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover {
    transform: translateY(-2px);
    border-color: color-mix(in oklab, var(--primary) 55%, var(--border));
    background: var(--accent);
    box-shadow: 0 10px 26px -14px color-mix(in oklab, var(--primary) 60%, transparent);
}
.tile:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.tile__icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    background: var(--card);
    overflow: hidden;
    flex-shrink: 0;
}

/* Logos de marque (Simple Icons / favicons) : pastille blanche pour un rendu net sur fond sombre */
.tile__icon--brand {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    padding: 5px;
}
.tile__icon--brand img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Glyphes internes : chip teinté aux couleurs du thème */
.tile__icon--glyph {
    background: color-mix(in oklab, var(--primary) 16%, var(--card));
}
.tile__icon--glyph svg {
    width: 58%;
    height: 58%;
    fill: none;
    stroke: var(--primary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tile__icon--letter {
    background: color-mix(in oklab, var(--primary) 22%, var(--card));
    color: var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
}

.tile__title {
    font-size: 0.85rem;
    font-weight: 550;
    line-height: 1.25;
}
.tile__sub {
    font-size: 0.72rem;
    color: var(--muted-foreground);
    line-height: 1.2;
}

.empty {
    max-width: 1200px;
    margin: 2rem auto;
    text-align: center;
    color: var(--muted-foreground);
}

/* ---------- Footer ---------- */
.footer {
    max-width: 1200px;
    margin: 2.5rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--muted-foreground);
}
.footer code {
    background: var(--secondary);
    padding: 0.1rem 0.35rem;
    border-radius: 5px;
    font-size: 0.72rem;
}

/* ========================================================================
 * Mode édition
 * ==================================================================== */
.btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2.4rem;
    padding: 0 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.85rem;
    font-weight: 550;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-edit svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.btn-edit:hover {
    background: var(--accent);
}
.btn-edit.is-on {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* Pastille de statut d'enregistrement */
.save-status {
    display: inline-flex;
    align-items: center;
    height: 2.4rem;
    padding: 0 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 550;
    white-space: nowrap;
    color: var(--muted-foreground);
    background: var(--card);
}
.save-status--saving {
    color: var(--muted-foreground);
}
.save-status--saved {
    color: var(--success);
    border-color: color-mix(in oklab, var(--success) 40%, var(--border));
}
.save-status--error {
    color: var(--destructive);
    border-color: color-mix(in oklab, var(--destructive) 45%, var(--border));
}
.save-status--offline {
    color: var(--warning);
    border-color: color-mix(in oklab, var(--warning) 45%, var(--border));
}

/* Toasts */
.toasts {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 60;
}
.toast {
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.85rem;
    box-shadow: 0 10px 30px oklch(0 0 0 / 30%);
    animation: toast-in 0.2s ease;
}
.toast--out {
    opacity: 0;
    transition: opacity 0.25s ease;
}
.toast--error {
    border-color: color-mix(in oklab, var(--destructive) 45%, var(--border));
}
.toast--warn {
    border-color: color-mix(in oklab, var(--warning) 45%, var(--border));
}
@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

/* Actions au survol (tuiles, cartes, catégories) */
.tile {
    position: relative;
}
.tile__meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.act {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: var(--card);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.act svg {
    width: 0.85rem;
    height: 0.85rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.act:hover {
    background: var(--accent);
    color: var(--foreground);
}
.act--del:hover {
    background: color-mix(in oklab, var(--destructive) 22%, var(--card));
    color: var(--destructive);
}
.tile__actions {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    display: flex;
    gap: 0.2rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.tile:hover .tile__actions {
    opacity: 1;
}
.card__actions {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.project-card {
    position: relative;
}
.project-card:hover .card__actions {
    opacity: 1;
}
.group__grip {
    width: 1.05rem;
    height: 1.05rem;
    fill: var(--muted-foreground);
    stroke: none;
    cursor: grab;
    flex-shrink: 0;
}
.group__actions {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}
.group__actions + .group__chev {
    margin-left: 0.6rem;
}

/* Tuiles / cartes d'ajout */
.tile--add,
.project-card--add,
.add-group {
    border: 1.5px dashed var(--border);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
    font: inherit;
}
.tile--add:hover,
.project-card--add:hover,
.add-group:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: color-mix(in oklab, var(--primary) 6%, transparent);
}
.tile__icon--add {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--border);
    font-size: 1.2rem;
    font-weight: 400;
}
.project-card--add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 110px;
    font-size: 0.9rem;
    font-weight: 550;
}
.add-plus {
    font-size: 1.15rem;
    line-height: 1;
}
.add-group {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 550;
}

/* Drag & drop (SortableJS) */
.sortable-ghost {
    opacity: 0.4;
}
html.edit-mode .tile:not(.tile--add) {
    cursor: grab;
}
html.edit-mode .tile:active {
    cursor: grabbing;
}

/* ========================================================================
 * Modale + formulaires
 * ==================================================================== */
.modal[hidden] {
    display: none;
}
.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 50;
    padding: 1rem;
}
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: oklch(0 0 0 / 55%);
    backdrop-filter: blur(2px);
}
.modal__panel {
    position: relative;
    width: min(560px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: 0 20px 60px oklch(0 0 0 / 40%);
}
.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 640;
}
.modal__close {
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
}
.modal__close:hover {
    background: var(--accent);
    color: var(--foreground);
}
.modal__body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted-foreground);
}
.form-input {
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 30%, transparent);
}
.form-hint {
    font-size: 0.72rem;
    color: var(--muted-foreground);
    line-height: 1.4;
}
.form-hint code {
    background: var(--secondary);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    font-size: 0.68rem;
}
.form-iconrow {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.form-iconrow .form-field {
    flex: 1;
}
.form-preview {
    margin-top: 1.55rem;
}
.form-preview .tile__icon {
    width: 2.6rem;
    height: 2.6rem;
}
.form-error {
    margin: 0;
    color: var(--destructive);
    font-size: 0.82rem;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.25rem;
}
.btn {
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.88rem;
    font-weight: 550;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn:hover {
    background: var(--accent);
}
.btn--primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}
.btn--primary:hover {
    filter: brightness(1.05);
    background: var(--primary);
}
/* ========================================================================
 * Polish Homarr : profondeur, dialogues, transitions
 * ==================================================================== */
.breadcrumb__spacer {
    flex: 1;
}

/* Dialogues (confirm / prompt) */
.dialog-text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--foreground);
}
.btn--danger {
    background: var(--destructive);
    color: var(--destructive-foreground);
    border-color: var(--destructive);
}
.btn--danger:hover {
    filter: brightness(1.05);
    background: var(--destructive);
}

/* View Transitions : fondu doux entre accueil et page projet */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.22s;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none !important;
    }
}
