/*
  Direction Atelier — galerie éditoriale
  Cette couche remplace les codes « dashboard / IA » par un cadre calme,
  minéral et chaleureux. Les couleurs fortes restent réservées aux œuvres.
*/

:root {
  --background: #f4f0e8;
  --foreground: #28221e;
  --card: #fbf8f2;
  --card-foreground: #28221e;
  --popover: #fbf8f2;
  --popover-foreground: #28221e;
  --primary: #1d6f98;
  --primary-foreground: #fffdf8;
  --secondary: #ece5d9;
  --secondary-foreground: #245b77;
  --muted-ui: #e8e1d6;
  --muted-foreground: #746b62;
  --accent: #e5d9cc;
  --accent-foreground: #28221e;
  --destructive: #d8573f;
  --border: #d9d0c4;
  --input: #bdb1a3;
  --ring: #536a76;
  --sidebar-ui: #f8f4ec;
  --sidebar-foreground-ui: #28221e;
  --sidebar-primary: #536a76;
  --sidebar-primary-foreground: #fffdf8;
  --sidebar-accent: #e9e1d5;
  --sidebar-accent-foreground: #28221e;
  --sidebar-border: #d9d0c4;
  --sidebar-ring: #536a76;
  --radius: .5rem;
  --shadow-sm-ui: 0 2px 8px rgba(53, 43, 34, .045);
  --shadow-md-ui: 0 12px 32px rgba(53, 43, 34, .07);

  --paper: var(--background);
  --ink: var(--foreground);
  --line: var(--border);
  --sidebar: var(--sidebar-ui);
  --lilac: var(--primary);
  --lilac-dark: var(--foreground);
  --lavender: var(--secondary);
  --peach: var(--destructive);
  --mint: var(--accent);
  --shadow: var(--shadow-md-ui);
}

body.dark {
  --background: #1b1714;
  --foreground: #f3ede4;
  --card: #25201c;
  --card-foreground: #f3ede4;
  --popover: #2b2520;
  --popover-foreground: #f3ede4;
  --primary: #68c6e9;
  --primary-foreground: #1b1714;
  --secondary: #332c26;
  --secondary-foreground: #9cd8ef;
  --muted-ui: #332c26;
  --muted-foreground: #b8aea3;
  --accent: #3d342d;
  --accent-foreground: #f3ede4;
  --destructive: #ef8068;
  --border: #443a31;
  --input: #695d52;
  --ring: #a4bec8;
  --sidebar-ui: #201b17;
  --sidebar-foreground-ui: #f3ede4;
  --sidebar-primary: #93aab4;
  --sidebar-primary-foreground: #1b1714;
  --sidebar-accent: #332c26;
  --sidebar-accent-foreground: #f3ede4;
  --sidebar-border: #443a31;
  --sidebar-ring: #a4bec8;
  --shadow-sm-ui: 0 2px 9px rgba(0, 0, 0, .14);
  --shadow-md-ui: 0 14px 36px rgba(0, 0, 0, .18);
}

html, body, main { background: var(--background); }
body {
  position: relative;
  color: var(--foreground);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -.01em;
}
body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.78'/%3E%3C/svg%3E");
}
body.dark::before { opacity: .026; }
.app-shell { position: relative; z-index: 1; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 34%, transparent);
  outline-offset: 2px;
}

h1, h2, h3, .brand, .post-caption strong, .order-info h2, .collection h2, .artist-profile-head h1, .match-card h2, .creator-dash h2, .modal h2, .result-info h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -.035em;
}
.eyebrow, .visual-stamp, .scroll-cue, .pricing-kicker, .summary-kicker, .card-kicker {
  font-family: "DM Sans", ui-sans-serif, sans-serif;
  font-weight: 700;
  letter-spacing: .08em;
}

/* Navigation : une signature dessinée plutôt qu'un monogramme d'application. */
.sidebar { overflow: hidden; background: var(--sidebar-ui); border-right-color: var(--border); transition: width .2s ease, padding .2s ease; }
main { transition: width .2s ease, margin-left .2s ease; }
.sidebar-header { display: flex; align-items: center; gap: 10px; }
.brand { gap: 10px; padding-left: 0; color: var(--sidebar-foreground-ui); font-size: 28px; }
.sidebar-toggle {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--sidebar-foreground-ui);
  background: transparent;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.sidebar-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.7; }
.sidebar-toggle:hover { border-color: var(--primary); color: var(--primary-foreground); background: var(--primary); }
.brand-mark {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 22px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  left: 1px;
  width: 25px;
  height: 3px;
  background: currentColor;
  transform-origin: left center;
}
.brand-mark::before { top: 7px; transform: rotate(-11deg); }
.brand-mark::after { top: 14px; left: 5px; width: 20px; opacity: .62; transform: rotate(8deg); }
.nav-link { border-radius: 5px; color: var(--muted-foreground); }
.nav-link .nav-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  overflow: visible;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}
.nav-link:hover { color: var(--foreground); background: var(--secondary); }
.nav-link.active {
  color: var(--foreground);
  background: var(--accent);
  box-shadow: inset 2px 0 0 var(--primary);
}
.nav-link.active .nav-icon { color: var(--primary); }
.nav-link b { color: #fffdf8; background: var(--destructive); }
.create-button { border-radius: 6px; color: var(--primary-foreground); background: var(--primary); box-shadow: none; }
.create-button:hover { background: var(--foreground); }
.create-icon { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.profile-pill { border: 1px solid var(--border); border-radius: 7px; color: var(--sidebar-foreground-ui); background: transparent; box-shadow: none; }
.profile-pill small, .profile-pill i { color: var(--muted-foreground); }
.mobile-profile-link { display: none; }
.sidebar.is-collapsed { width: 72px; padding: 24px 10px 16px; }
.sidebar.is-collapsed .sidebar-header { justify-content: center; }
.sidebar.is-collapsed .brand { display: none; }
.sidebar.is-collapsed .main-nav { gap: 10px; margin-top: 38px; }
.sidebar.is-collapsed .nav-link { justify-content: center; gap: 0; padding: 0; font-size: 0; }
.sidebar.is-collapsed .nav-link .nav-icon { width: 20px; height: 20px; }
.sidebar.is-collapsed .nav-link b { display: none; }
.sidebar.is-collapsed .sidebar-bottom { gap: 12px; }
.sidebar.is-collapsed .create-button { width: 42px; height: 42px; margin: 0 auto; padding: 0; font-size: 0; }
.sidebar.is-collapsed .create-button .create-icon { width: 18px; height: 18px; }
.sidebar.is-collapsed .profile-pill { justify-content: center; width: 42px; margin: 0 auto; padding: 3px; }
.sidebar.is-collapsed .profile-pill > span:nth-child(2), .sidebar.is-collapsed .profile-pill i { display: none; }
.sidebar.is-collapsed + main { width: calc(100% - 72px); margin-left: 72px; transition: width .2s ease, margin-left .2s ease; }

/* Titres, onglets et actions : la lisibilité avant les effets. */
.eyebrow { color: var(--primary); font-size: 10px; }
h1 { letter-spacing: -.045em; }
.round-button, .secondary-button, .primary-button { border-radius: 6px; }
.round-button { border-color: var(--border); color: var(--foreground); background: transparent; box-shadow: none; }
.round-button:hover { border-color: var(--primary); color: var(--primary-foreground); background: var(--primary); }
.primary-button, .big-search button { color: var(--primary-foreground); background: var(--primary); }
.primary-button:hover, .big-search button:hover { background: var(--foreground); }
.secondary-button { border-color: var(--border); color: var(--foreground); background: transparent; }
.secondary-button:hover { border-color: var(--primary); color: var(--primary-foreground); background: var(--primary); }
.feed-switch, .page-header, .profile-tabs { border-color: var(--border); }
.feed-tab { border-radius: 0; color: var(--muted-foreground); }
.feed-tab.active { color: var(--foreground); border-color: var(--primary); }
.feed-status { color: var(--muted-foreground); }
.feed-status i { background: var(--destructive); }

/* Feed : l'œuvre ressemble à un portfolio, l'interface se retire. */
.feed-layout { gap: 30px; }
.feed-scroller { border: 1px solid var(--border); border-radius: 8px; background: var(--card); box-shadow: var(--shadow-md-ui); outline: 0; }
.feed-post, .feature-post { background: var(--card); }
.post-visual { isolation: isolate; }
.post-visual::after { opacity: .58; }
.content-label {
  border: 1px solid rgba(255,255,255,.44);
  border-radius: 3px;
  color: #fffdf8;
  background: rgba(31, 25, 22, .56);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.visual-stamp {
  color: rgba(255,253,248,.9);
  background: rgba(31, 25, 22, .3);
  border: 1px solid rgba(255,253,248,.34);
  border-radius: 3px;
}
.ghost-icon, .post-actions .post-action, .next-art {
  border-color: rgba(255,255,255,.32);
  border-radius: 5px;
  color: #fffdf8;
  background: rgba(31, 25, 22, .34);
  backdrop-filter: none;
}
.post-action:hover, .post-action.liked, .post-action.saved, .next-art:hover {
  color: var(--primary-foreground);
  background: var(--primary);
}
.save-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.save-icon { flex: 0 0 auto; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.save-button.saved .save-icon { fill: currentColor; }
.post-caption { text-shadow: 0 1px 9px rgba(25, 19, 16, .42); }
.scroll-cue { color: rgba(255,253,248,.83); }

/* Cartes : papier, bordure fine, aucun effet de tableau de bord. */
.mini-card, .artist-result, .order-card, .creator-dash > section, .creator-side-card, .creator-metrics article, .creator-request-list article {
  border-color: var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow-sm-ui);
}
.mini-card:hover, .artist-result:hover, .order-card:hover, .creator-side-card:hover, .creator-metrics article:hover, .creator-request-list article:hover {
  border-color: color-mix(in srgb, var(--primary) 54%, var(--border));
  box-shadow: var(--shadow-md-ui);
  transform: translateY(-1px);
}
.match-card, .safety-card { border-color: var(--border); background: var(--secondary); }
.mini-icon {
  width: auto;
  height: auto;
  color: var(--primary);
  background: transparent;
  font-size: 22px;
  line-height: .7;
}
.safety-card .shield, .human-art-note > span { color: var(--primary-foreground); background: var(--primary); }
.tag-row button, .profile-tags span, .result-tags span { border-radius: 3px; color: var(--secondary-foreground); background: var(--secondary); }
.text-button, .back-link, .artist-social-link { color: var(--primary); }

/* Recherche : un panneau de consultation, pas une barre de produit SaaS. */
.search-hero { padding-bottom: 44px; }
.big-search { border-color: var(--border); border-radius: 7px; background: var(--card); box-shadow: var(--shadow-sm-ui); }
.big-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.big-search button { border-radius: 5px; }
.popular-searches, .range-values, .check, .radio, .results-top p { color: var(--muted-foreground); }
.popular-searches button { color: var(--primary); }
.filters, .results-top { border-color: var(--border); }
.filter-chips button { border-color: var(--border); border-radius: 4px; color: var(--muted-foreground); background: transparent; }
.filter-chips button.selected { border-color: var(--primary); color: var(--primary-foreground); background: var(--primary); }
.check > span, .radio > span { border-color: var(--input); background: transparent; }
.check input:checked + span { border-color: var(--primary); background: var(--primary); }
.artist-result { overflow: hidden; }
.result-art::before {
  content: "portfolio";
  top: 10px;
  left: 10px;
  padding: 3px 5px;
  border: 1px solid rgba(255,253,248,.42);
  border-radius: 3px;
  color: #fffdf8;
  background: rgba(31, 25, 22, .42);
  font-family: "DM Sans", ui-sans-serif, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.result-info { background: var(--card); }
.result-artist b, .result-info h3, .result-price { color: var(--card-foreground); }
.result-artist small, .result-meta { color: var(--muted-foreground); }
.availability { color: var(--primary); }
.empty-results {
  grid-column: 1 / -1;
  padding: 42px 24px;
  border: 1px dashed var(--input);
  border-radius: 8px;
  color: var(--muted-foreground);
  background: var(--secondary);
  text-align: center;
}
.empty-results h2 { margin: 0 0 7px; color: var(--card-foreground); font-size: 26px; }
.empty-results p { margin: 0; font-size: 13px; }

/* Profils, commandes, messages et modales. */
.artist-cover { border-color: var(--border); border-radius: 8px; background: linear-gradient(115deg, #e96f70, #b86caf 47%, #3d73c8); }
.artist-cover::before, .artist-cover::after { display: none; }
.artist-cover span { display: none; }
/* Les chevrons des filtres indiquent toujours l'état réel de la section. */
.filters summary > span {
  display: inline-block;
  line-height: 1;
  transform-origin: center;
  transition: transform .16s ease;
}
.filters details[open] > summary > span { transform: rotate(180deg); }
/* L'avatar peut déborder sur la bannière ; le nom, lui, reste toujours dans
   sa zone de lecture sous la bannière. */
.artist-profile-head {
  position: relative;
  display: grid;
  grid-template-columns: 91px minmax(0, 1fr) auto;
  align-items: start;
  gap: 17px;
  margin: 0 29px 24px;
  padding-top: 18px;
}
.artist-profile-head .profile-avatar {
  position: absolute;
  top: -47px;
  left: 0;
}
.artist-identity { grid-column: 2; min-width: 0; }
.profile-actions { grid-column: 3; margin-left: 0; }
.verified { color: var(--primary-foreground); background: var(--primary); }
.handle, .artist-info, .order-info p, .page-header p:last-child, .artist-panel-intro, .artist-commission p, .artist-review p { color: var(--muted-foreground); }
.info-line { color: var(--card-foreground); }
.profile-tabs button, .order-tabs button { color: var(--muted-foreground); }
.profile-tabs button.active, .order-tabs button.active { color: var(--foreground); border-color: var(--primary); }
.profile-tabs b, .order-tabs b { border-radius: 3px; color: var(--secondary-foreground); background: var(--secondary); }
.portfolio-card, .artist-commission, .artist-review, .commission-option { border-color: var(--border); border-radius: 7px; background: var(--card); }
.commission-option.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  box-shadow: inset 0 0 0 1px var(--primary);
}
.artist-commission > strong, .commission-option strong, .pricing-kicker, .summary-kicker { color: var(--primary); }
.artist-pricing { border-color: var(--border); border-radius: 7px; background: var(--secondary); }
.pricing-row { border-color: color-mix(in srgb, var(--border) 82%, transparent); color: var(--card-foreground); }
.status { border-radius: 3px; }
.status.progress { color: var(--primary-foreground); background: var(--primary); }
.status.pending { color: #fffdf8; background: var(--destructive); }
.progress-track { background: var(--secondary); }
.progress-track span { background: var(--primary); }
.messages-layout { border-color: var(--border); border-radius: 8px; background: var(--card); }
.message-search, .order-context { border-radius: 6px; background: var(--secondary); }
.conversation { border-radius: 5px; color: var(--foreground); }
.conversation:hover { background: var(--secondary); }
.conversation.active { color: var(--foreground); background: var(--accent); border-left-color: var(--primary); }
.conversation.active small, .conversation.active time { color: var(--muted-foreground); }
.chat-panel, .chat-compose { background: var(--card); }
.chat-head .chat-profile-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: 0;
  padding: 5px 7px;
  border-radius: 5px;
  color: var(--foreground);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .16s ease, color .16s ease;
}
.chat-head .chat-profile-link:hover { background: var(--secondary); }
.chat-head .chat-profile-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chat-head .chat-profile-link > span:last-child { min-width: 0; }
.chat-head > [data-action="conversation-options"] { margin-left: auto; }
.chat-back { display: none; }
.chat-head small i { background: var(--primary); }
.bubble { border-radius: 7px 7px 7px 2px; color: var(--card-foreground); background: var(--secondary); }
.bubble.mine { border-radius: 7px 7px 2px 7px; color: var(--primary-foreground); background: var(--primary); }
.chat-compose button, .chat-compose .send-button { border-radius: 5px; color: var(--primary-foreground); background: var(--primary); }
.modal-backdrop { background: rgba(32, 26, 22, .68); backdrop-filter: none; }
.modal { border-color: var(--border); border-radius: 9px; color: var(--popover-foreground); background: var(--popover); box-shadow: 0 24px 70px rgba(25, 19, 15, .24); }
.modal-close {
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--primary-foreground);
  background: var(--primary);
}
.upload-drop { border-color: var(--input); border-radius: 7px; background: var(--secondary); }
.publish-guideline { border-color: var(--border); border-radius: 6px; background: var(--secondary); }
.toast { border-radius: 6px; color: #fffdf8; background: #302820; box-shadow: 0 10px 28px rgba(25, 19, 15, .2); }

/* Espaces créateur : même langage qu'une vitrine, sans dégradé bleu agressif. */
.creator-cover { border-color: var(--border); border-radius: 8px; background: linear-gradient(112deg, #d94f68, #a85fbe 48%, #2772c4); }
.creator-cover::before, .creator-cover::after { display: none; }
.creator-cover span { display: none; }
.card-kicker .mini-icon { border-radius: 0; color: var(--primary); background: transparent; }
.completion-track { border-radius: 2px; background: var(--secondary); }
.completion-track span { border-radius: inherit; background: var(--primary); }
.creator-work { border-color: rgba(255,253,248,.35); border-radius: 7px; }
.creator-work .work-label, .creator-work > button { border-radius: 3px; }
.request-status { border-radius: 3px; color: var(--primary-foreground); background: var(--primary); }

/* Les aperçus de démo deviennent des pigments sourds, pas une palette de néons. */
.art-aurora { background: linear-gradient(180deg, rgba(43, 25, 44, .08), rgba(24, 18, 16, .36)), url("https://images.unsplash.com/photo-1549490349-8643362247b5?auto=format&fit=crop&w=1200&q=88") center / cover no-repeat !important; }
.art-poppy { background: linear-gradient(180deg, rgba(83, 20, 45, .04), rgba(24, 18, 16, .38)), url("https://images.unsplash.com/photo-1547891654-e66ed7ebb968?auto=format&fit=crop&w=1200&q=88") center / cover no-repeat !important; }
.art-bluebell { background: linear-gradient(180deg, rgba(29, 42, 86, .05), rgba(18, 20, 31, .38)), url("https://images.unsplash.com/photo-1541961017774-22349e4a1262?auto=format&fit=crop&w=1200&q=88") center / cover no-repeat !important; }
.art-garden { background: linear-gradient(180deg, rgba(64, 34, 74, .04), rgba(20, 18, 16, .38)), url("https://images.unsplash.com/photo-1579783902614-a3fb3927b6a5?auto=format&fit=crop&w=1200&q=88") center / cover no-repeat !important; }
.art-sunset { background: linear-gradient(180deg, rgba(90, 38, 31, .03), rgba(28, 19, 16, .4)), url("https://images.unsplash.com/photo-1549490349-8643362247b5?auto=format&fit=crop&w=1200&q=88") 75% center / cover no-repeat !important; }
.art-lilac { background: linear-gradient(180deg, rgba(67, 36, 84, .05), rgba(20, 18, 26, .38)), url("https://images.unsplash.com/photo-1545987796-200677ee1011?auto=format&fit=crop&w=1200&q=88") center / cover no-repeat !important; }
.art-aurora::before, .art-poppy::before, .art-bluebell::before, .art-garden::before, .art-sunset::before, .art-lilac::before { display: none !important; }
.art-aurora::after, .art-poppy::after, .art-bluebell::after, .art-garden::after, .art-sunset::after, .art-lilac::after {
  content: "";
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(25, 18, 15, .24));
  box-shadow: none;
  mix-blend-mode: normal;
  pointer-events: none;
  transform: none;
}

body.dark .sidebar { background: var(--sidebar-ui); }
body.dark .nav-link.active { color: var(--foreground); background: var(--accent); }
body.dark .mini-card, body.dark .artist-result, body.dark .order-card, body.dark .creator-dash > section, body.dark .messages-layout, body.dark .modal, body.dark .big-search, body.dark .profile-pill, body.dark .round-button, body.dark .secondary-button, body.dark .commission-option, body.dark .filter-chips button { background: var(--card); }
/* Cette règle de surface est volontairement générale : on redéclare donc les
   survols interactifs juste après, pour qu'ils gardent leur contraste. */
body.dark .secondary-button:hover,
body.dark .round-button:hover {
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: var(--primary);
}
body.dark .primary-button:hover,
body.dark .big-search button:hover,
body.dark .create-button:hover {
  color: var(--primary-foreground);
  background: var(--foreground);
}
body.dark .match-card, body.dark .safety-card, body.dark .message-search, body.dark .order-context, body.dark .artist-pricing, body.dark .publish-guideline { background: var(--secondary); }
body.dark .filter-chips button.selected {
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: var(--primary);
}
body.dark .commission-option.selected {
  border-color: var(--primary);
  color: var(--foreground);
  background: color-mix(in srgb, var(--primary) 13%, var(--card));
}
body.dark .chat-compose, body.dark .chat-compose input { color: var(--foreground); background: var(--card); }
body.dark .bubble.other { color: var(--card-foreground); background: var(--secondary); }
body.dark .upload-drop { background: var(--secondary); }
/* Le sélecteur du thème clair est plus spécifique que .bubble.mine dans la
   palette importée : on redéclare donc explicitement la bulle envoyée. */
body:not(.dark) .bubble.mine {
  color: var(--primary-foreground);
  background: var(--primary);
}
body:not(.dark) .bubble.mine time {
  color: color-mix(in srgb, var(--primary-foreground) 74%, transparent);
}

@media (max-width: 780px) {
  .sidebar, body.dark .sidebar { background: color-mix(in srgb, var(--sidebar-ui) 94%, transparent); border-color: var(--border); backdrop-filter: blur(12px); }
  .sidebar-header, .sidebar-toggle { display: none; }
  .sidebar.is-collapsed { width: 100%; height: 63px; padding: 7px 11px; }
  .sidebar.is-collapsed .main-nav { gap: 0; margin: 0; }
  .sidebar.is-collapsed .nav-link { gap: 0; padding: 2px 0; font-size: 9px; }
  .sidebar.is-collapsed .nav-link .nav-icon { width: 19px; height: 19px; }
  .sidebar.is-collapsed .nav-link b { display: block; }
  .sidebar.is-collapsed + main { width: 100%; margin-left: 0; }
  .nav-link { border-radius: 5px; }
  .nav-link.active { box-shadow: inset 0 -2px 0 var(--primary); }
  .nav-link .nav-icon { width: 19px; height: 19px; }
  .feed-scroller { border-radius: 7px; }
  .modal { border-radius: 8px; }
  .artist-profile-head {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 11px;
    margin: 0 0 24px;
    padding-top: 13px;
  }
  .artist-profile-head .profile-avatar { top: -38px; }
  .artist-identity { grid-column: 2; }
  .profile-actions { grid-column: 1 / -1; width: 100%; margin: 5px 0 0; }
}

/* Mobile : une interface pensée pour le pouce, sans héritage de mise en page
   bureau. Les éléments denses passent en pile ou en défilement horizontal. */
.mobile-filter-toggle { display: none; }

@media (max-width: 780px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  main, .view, .artist-main, .creator-main, .results-panel, .chat-panel { min-width: 0; }
  .view {
    width: 100%;
    max-width: none;
    min-height: 100svh;
    padding: 22px 16px calc(94px + env(safe-area-inset-bottom));
    overflow-x: clip;
  }
  h1 { font-size: clamp(29px, 9vw, 36px); line-height: 1; }
  .eyebrow { margin-bottom: 6px; font-size: 9px; }

  /* Barre de navigation : des icônes seulement, lisibles et sans textes écrasés. */
  .sidebar, .sidebar.is-collapsed {
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom);
    overflow: visible;
  }
  .sidebar .main-nav, .sidebar.is-collapsed .main-nav { height: 52px; gap: 0; margin: 0; }
  .sidebar .nav-link, .sidebar.is-collapsed .nav-link {
    position: relative;
    display: grid;
    place-items: center;
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    padding: 0;
    gap: 0;
    border-radius: 6px;
    font-size: 0;
  }
  .sidebar .nav-link .nav-icon, .sidebar.is-collapsed .nav-link .nav-icon { width: 21px; height: 21px; }
  .sidebar .nav-link b, .sidebar.is-collapsed .nav-link b {
    position: absolute;
    top: 3px;
    right: calc(50% - 19px);
    display: grid;
    min-width: 15px;
    margin: 0;
    padding: 2px 4px;
    place-items: center;
    font-size: 8px;
    line-height: 1;
  }
  .sidebar .nav-link.active { box-shadow: inset 0 -2px 0 var(--primary); }
  .sidebar .mobile-profile-link, .sidebar.is-collapsed .mobile-profile-link { display: grid; }
  .sidebar-bottom, .sidebar.is-collapsed .sidebar-bottom { display: none; }

  /* En-têtes et actions : aucun bouton ne chevauche un titre. */
  .topbar, .page-header, .messages-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
  }
  .topbar > div:first-child, .page-header > div:first-child, .messages-header > div:first-child { min-width: 0; }
  .top-actions { flex: 0 0 auto; margin-left: auto; gap: 7px; }
  .round-button { width: 38px; height: 38px; }
  .page-header { padding-bottom: 20px; }
  .page-header > p:last-child { width: 100%; max-width: none; margin: 0; line-height: 1.45; }

  /* Découverte. */
  .feed-switch {
    height: 46px;
    min-height: 46px;
    margin-top: 17px;
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .feed-switch::-webkit-scrollbar, .conversation-list::-webkit-scrollbar { display: none; }
  .feed-tab { flex: 0 0 auto; height: 46px; padding: 0 0 10px; white-space: nowrap; font-size: 12px; }
  .feed-status { display: none; }
  .feed-layout { display: block; padding-top: 17px; }
  .feed-scroller {
    height: min(590px, calc(100svh - 223px));
    min-height: 470px;
    border-radius: 7px;
  }
  .feed-post { height: min(590px, calc(100svh - 223px)); min-height: 470px; }
  .post-overlay { left: 14px; right: 14px; }
  .post-overlay.top { top: 14px; }
  .post-overlay.bottom { right: 72px; bottom: 16px; gap: 8px; }
  .post-caption strong { font-size: 21px; line-height: 1.04; }
  .post-caption span { font-size: 10px; line-height: 1.35; }
  .artist-chip .avatar { width: 34px; height: 34px; }
  .artist-chip b { font-size: 12px; }
  .artist-chip small { font-size: 10px; }
  .post-actions { right: 14px; bottom: 16px; flex-direction: column; gap: 6px; }
  .post-action { width: 36px; height: 36px; justify-content: center; padding: 0; }
  .post-action > b { display: none; }
  .post-action .save-icon { width: 16px; height: 16px; }
  .next-art { left: 14px; bottom: 16px; transform: none; }
  .scroll-cue { display: none; }
  .feed-aside { grid-template-columns: 1fr; gap: 12px; margin-top: 13px; }
  .mini-card { padding: 16px; }

  /* Recherche et filtres. */
  .search-hero { padding: 0 0 26px; text-align: left; }
  .search-hero h1 { margin-bottom: 20px; }
  .big-search { height: 52px; padding-left: 12px; border-radius: 7px; }
  .big-search > span { font-size: 19px; }
  .big-search input { padding: 0 9px; font-size: 14px; }
  .big-search button { height: 38px; margin-right: 6px; padding: 0 11px; border-radius: 5px; font-size: 11px; }
  .popular-searches { justify-content: flex-start; gap: 6px 10px; font-size: 10px; text-align: left; }
  .search-content { display: block; }
  .filters { display: none; margin: 0 0 15px; padding: 0 13px; border: 1px solid var(--border); border-radius: 7px; background: var(--card); }
  .filters.is-mobile-open { display: block; }
  .filter-heading { margin-top: 14px; }
  .mobile-filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--foreground);
    background: var(--card);
    font: inherit;
    font-size: 11px;
    font-weight: 700;
  }
  .mobile-filter-toggle[aria-expanded="true"] { border-color: var(--primary); color: var(--primary-foreground); background: var(--primary); }
  .results-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 14px; }
  .results-top p { min-width: 0; font-size: 12px; line-height: 1.4; }
  .sort-select { grid-column: 1 / -1; justify-self: start; }
  .artist-grid { grid-template-columns: 1fr; gap: 12px; }
  .result-art { height: 180px; }
  .result-info { padding: 13px; }

  /* Profils artiste et commandes. */
  .back-link { margin-bottom: 14px; }
  .artist-cover { height: 142px; border-radius: 7px; }
  .artist-profile-head { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; margin: 0 0 20px; padding-top: 14px; }
  .artist-profile-head .profile-avatar { top: -37px; width: 72px; height: 72px; font-size: 31px; }
  .artist-profile-head h1 { font-size: 29px; line-height: .98; }
  .artist-identity { min-width: 0; }
  .handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .profile-actions button { min-width: 0; padding: 0 8px; font-size: 11px; white-space: nowrap; }
  .artist-body { display: block; margin: 0; }
  .artist-info { margin-bottom: 20px; }
  .profile-tabs, .order-tabs { gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .profile-tabs button, .order-tabs button { flex: 0 0 auto; white-space: nowrap; }
  .portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
  .portfolio-card { min-height: 150px; }
  .artist-commission { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 9px; padding: 9px; }
  .artist-commission .secondary-button { grid-column: 2 / -1; width: 100%; }

  .order-tabs { height: 54px; margin: 0 -16px; padding: 0 16px; }
  .order-tabs button { font-size: 12px; }
  .order-card, .order-card.compact { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .order-art, .compact .order-art { width: 72px; height: 72px; }
  .order-info { min-width: 0; }
  .order-info h2 { font-size: 20px; line-height: 1; }
  .order-info p { line-height: 1.4; }
  .progress-steps { gap: 12px; font-size: 9px; }
  .order-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; width: 100%; margin: 0; gap: 4px 10px; }
  .order-side .secondary-button { grid-column: 1 / -1; width: 100%; margin: 5px 0 0; }

  /* Messagerie : comme une app mobile, liste puis discussion plein écran. */
  .messages-layout { display: grid; grid-template-columns: 1fr; height: auto; min-height: 0; overflow: visible; }
  .conversation-list {
    display: grid;
    gap: 2px;
    padding: 10px;
    overflow: visible;
    border: 0;
  }
  .message-search { display: flex; }
  .conversation { min-width: 0; padding: 12px 9px; border-left: 2px solid transparent; }
  .conversation small { max-width: none; }
  .conversation time { display: block; }
  .messages-view:not(.mobile-chat-open) .chat-panel { display: none; }
  .messages-view.mobile-chat-open .conversation-list { display: none; }
  .messages-view.mobile-chat-open .messages-layout { display: block; }
  .chat-panel { min-height: 460px; }
  .chat-head { height: 62px; padding: 0 12px; }
  .chat-head .chat-profile-link { max-width: calc(100% - 84px); padding: 5px; }
  .chat-profile-link > span:last-child { overflow: hidden; }
  .chat-profile-link b, .chat-profile-link small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-back { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; margin: 0 !important; padding: 0; border: 1px solid var(--border) !important; border-radius: 5px; color: var(--foreground) !important; background: var(--secondary) !important; }
  .chat-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .order-context { margin: 10px 12px 0; padding: 8px; }
  .order-context > span:nth-child(2) { min-width: 0; }
  .order-context em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .order-context button { flex: 0 0 auto; }
  .chat-log { padding: 18px 12px; }
  .bubble { max-width: 82%; font-size: 11px; }
  .chat-compose { gap: 7px; padding: 10px 12px; }
  .chat-compose input { min-width: 0; }

  /* Inspirations et espace créateur. */
  .collection-row { grid-template-columns: 1fr; gap: 11px; padding-top: 16px; }
  .collection { min-height: 180px; }
  .creator-profile { padding-top: 0; }
  .creator-cover { height: 132px; border-radius: 7px; }
  .creator-profile-head { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; margin: 0 0 20px; padding-top: 14px; }
  .creator-avatar { position: absolute; top: -37px; left: 0; width: 72px; height: 72px; font-size: 31px; }
  .creator-profile-head > div:not(.profile-actions) { grid-column: 2; min-width: 0; }
  .creator-profile-head h1 { font-size: 29px; line-height: .98; }
  .creator-profile-head .profile-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; width: 100%; margin: 5px 0 0; }
  .creator-profile-head .profile-actions button { min-width: 0; padding: 0 8px; font-size: 10px; white-space: nowrap; }
  .creator-workspace { gap: 18px; margin: 0; }
  .creator-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .creator-metrics article { min-width: 0; min-height: 104px; padding: 10px; }
  .creator-metrics span, .creator-metrics small { overflow-wrap: anywhere; font-size: 9px; line-height: 1.25; }
  .creator-metrics b { margin-top: 12px; font-size: 23px; }
  .creator-section-heading { align-items: flex-end; gap: 10px; }
  .creator-section-heading .text-button { flex: 0 0 auto; margin-top: 0; font-size: 11px; }
  .creator-request-list article { grid-template-columns: 34px minmax(0, 1fr) auto; }

  /* Fenêtres : elles restent toujours dans l'écran, même avec le clavier ouvert. */
  .modal-backdrop { align-items: end; padding: 12px; }
  .modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 23px 16px 18px;
    border-radius: 8px 8px 6px 6px;
  }
  .modal h2 { padding-right: 34px; font-size: 28px; line-height: 1; }
  .modal-close { top: 10px; right: 10px; }
  .commission-option { align-items: flex-start; gap: 9px; padding: 9px; }
  .commission-option > span:nth-child(2) { min-width: 0; }
  .commission-option small { line-height: 1.35; }
  .order-price-summary { padding: 11px; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}
