/* ==========================================================================
   Portfolio – styles du tableau de bord
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --bg: #f6f5fb; --surface: #fff; --ink: #15132e; --soft: #5d5a7a; --line: #e2e0ee;
  --accent: #5b4bff; --danger: #b3214f; --cat: #5a6078;
}
.cat-app-web { --cat: #4636e0; }
.cat-site-web { --cat: #0a7c73; }
.cat-app-mobile { --cat: #d42a6b; }
.cat-analyse { --cat: #a85f00; }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.5 "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif; }
h1, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 0.18em; }
img { max-width: 100%; }
small { font-weight: 400; color: var(--soft); font-size: 0.875rem; }
code { background: #e6e8ef; padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--soft); }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh; }
.side__name { font-weight: 700; font-size: 1.125rem; padding: 0 0.75rem; }
.side nav { display: grid; gap: 0.25rem; }
.side a, .side .linklike { display: flex; justify-content: space-between; align-items: center; color: #c9cde0; text-decoration: none; padding: 0.55rem 0.75rem; border-radius: 6px; }
.side a:hover, .side .linklike:hover { color: #fff; background: rgb(255 255 255 / 0.08); }
.side a.is-current { color: #fff; background: rgb(255 255 255 / 0.14); font-weight: 600; }
.side__end { margin-top: auto; display: grid; gap: 0.25rem; }
.side__end .linklike { width: 100%; }
.badge { background: #ff4f8b; color: #fff; font-size: 0.8125rem; font-weight: 700; min-width: 1.5rem; padding: 0 0.4rem; border-radius: 1rem; text-align: center; }
.main { padding: 2rem clamp(1.25rem, 4vw, 3rem) 4rem; max-width: 70rem; width: 100%; }
.main > .flash { margin-bottom: 1rem; }

.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.head h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.015em; line-height: 1.15; }

/* ---------- Boutons et messages ---------- */
.btn { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; padding: 0.65rem 1.15rem; border: 0; border-radius: 8px; background: var(--accent); color: #fff; }
.btn:hover { background: #4636e0; }
.btn--small { padding: 0.35rem 0.8rem; font-size: 0.9375rem; }
.linklike { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; }
.side .linklike { text-decoration: none; }
.danger { color: var(--danger); }
.flash { padding: 0.75rem 1rem; border-radius: 8px; font-weight: 600; }
.flash--ok { background: #dff3ea; color: #0e5a3e; }
.flash--error { background: #fde5ec; color: #9a1f48; }

/* ---------- Liste des projets ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
.stats li { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--cat); border-radius: 8px; padding: 0.75rem 1rem; color: var(--soft); }
.stats strong { display: block; font-size: 1.75rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; min-width: 46rem; }
.table th { text-align: left; font-size: 0.875rem; font-weight: 600; color: var(--soft); padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table__main { display: flex; align-items: center; gap: 0.75rem; }
.table__main a { font-weight: 600; color: var(--ink); }
.table__main small { display: block; }
.table__actions { white-space: nowrap; text-align: right; }
.table__actions > a, .table__actions .linklike { margin-left: 0.85rem; font-size: 0.9375rem; }
.table__actions form { display: inline; }
.thumb { width: 3.5rem; height: 2.6rem; object-fit: cover; object-position: top; border-radius: 5px; border: 1px solid var(--line); flex: none; }
.thumb--none { display: block; background: color-mix(in srgb, var(--cat) 25%, #fff); }
.chip { display: inline-block; font-size: 0.875rem; font-weight: 600; color: var(--cat); white-space: nowrap; }
.state { font-size: 0.875rem; color: var(--soft); }
.state--on { color: #0e5a3e; font-weight: 600; }
.blank { background: var(--surface); border: 1px dashed #b9bdcb; border-radius: 10px; padding: 2.5rem; display: grid; gap: 1rem; justify-items: start; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 1rem; }
.form--wide { max-width: 46rem; gap: 1.5rem; margin-bottom: 2.5rem; }
fieldset { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.5rem 1.5rem; display: grid; gap: 1rem; min-width: 0; }
legend { font-weight: 650; font-size: 1.125rem; padding: 0 0.4rem; margin-left: -0.4rem; }
.form label, .label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.9375rem; }
.form input[type="text"], .form input[type="email"], .form input[type="password"], .form input[type="number"], .form textarea {
  font: inherit; font-weight: 400; font-size: 1rem; color: var(--ink); width: 100%;
  padding: 0.6rem 0.75rem; background: #fff; border: 1px solid #b9bdcb; border-radius: 7px;
}
.form input[type="file"] { font: inherit; font-weight: 400; }
.form textarea { resize: vertical; line-height: 1.5; }
.form .check, .check { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-weight: 500; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.check small { flex-basis: 100%; padding-left: 1.6rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; }
.row--role { grid-template-columns: 1fr 1.6fr; align-items: start; }
.actions { display: flex; align-items: center; gap: 1.25rem; }

.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: grid; gap: 0.5rem; height: 100%; padding: 0.75rem; border: 1px solid #b9bdcb; border-radius: 8px; cursor: pointer; line-height: 1.2; }
.choice .ico { color: var(--cat); }
.choice input:checked + span { background: var(--cat); border-color: var(--cat); color: #fff; }
.choice input:checked + span .ico { color: #fff; }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.current { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.current img { width: 10rem; max-height: 8rem; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0.75rem; }
.thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); }
.thumbs .check { font-size: 0.875rem; }

/* ---------- Messages ---------- */
.msgs { display: grid; gap: 0.75rem; max-width: 50rem; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.25rem; display: grid; gap: 0.75rem; }
.msg--new { border-left: 4px solid #ff4f8b; }
.msg header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; }
.msg time { color: var(--soft); font-size: 0.875rem; }
.msg__body { overflow-wrap: anywhere; }
.msg__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; font-size: 0.9375rem; }

/* ---------- Connexion et installation ---------- */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth__box { width: min(26rem, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; display: grid; gap: 1.25rem; }
.auth__box h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.015em; }

@media (max-width: 52rem) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.75rem 1rem; }
  .side nav, .side__end { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; }
  .side__end { margin-left: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row, .choices { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 30rem) { .row { grid-template-columns: 1fr; } }
