:root {
  color-scheme: light;
  --paper: #fbf8f2;
  --paper-deep: #f3ebdc;
  --cream: #efe2cc;
  --cream-soft: #f7efdf;
  --coffee: #654735;
  --coffee-deep: #50372a;
  --coffee-soft: #846c5a;
  --ink: #302a26;
  --sage: #6f7f69;
  --sage-soft: #dce3d7;
  --rose: #bc7f8b;
  --rose-soft: #f1dfe1;
  --line: #dcc7a7;
  --line-soft: rgba(220, 199, 167, .58);
  --danger: #9b514e;
  --shadow-sm: 0 4px 14px rgba(104, 74, 52, .07);
  --shadow-md: 0 14px 38px rgba(104, 74, 52, .12);
  --shadow-lg: 0 28px 80px rgba(65, 45, 33, .22);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Avenir Next', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --space-2xs: .25rem;
  --space-xs: .5rem;
  --space-sm: .75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --sidebar: 15rem;
  --topbar: 4.5rem;
  --radius-sm: .65rem;
  --radius-md: .9rem;
  --radius-lg: 1.35rem;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --z-nav: 20;
  --z-sticky: 30;
  --z-modal: 40;
  --z-toast: 50;
}

* { box-sizing: border-box; }
html { min-width: 20rem; scroll-behavior: smooth; background: var(--paper); }
body { margin: 0; min-width: 20rem; min-height: 100dvh; overflow-x: hidden; padding-bottom: calc(5rem + env(safe-area-inset-bottom)); background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: .95rem; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-block-start: 0; }
h1, h2, h3 { color: var(--coffee); font-family: var(--serif); font-style: italic; font-weight: 600; letter-spacing: -.03em; line-height: 1.06; text-wrap: balance; }
h1 { font-size: clamp(2.45rem, 13vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 7vw, 2.45rem); }
h3 { font-size: 1.2rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--sage), transparent 25%); outline-offset: 3px; }
.is-hidden { display: none !important; }
.eyebrow { margin-bottom: var(--space-xs); color: var(--sage); font-size: .72rem; font-weight: 700; letter-spacing: .075em; }
.muted { color: var(--coffee-soft); }
.small { font-size: .78rem; }
.skip-link { position: fixed; left: var(--space-md); top: -5rem; z-index: var(--z-toast); border-radius: var(--radius-sm); background: var(--ink); padding: .75rem 1rem; color: var(--paper); }
.skip-link:focus { top: var(--space-md); }

/* accès privé */
.lock-screen { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; min-height: 100dvh; place-items: center; overflow: auto; padding: max(var(--space-md), env(safe-area-inset-top)) var(--space-sm) max(var(--space-md), env(safe-area-inset-bottom)); background: radial-gradient(circle at 82% 12%, rgba(188,127,139,.16), transparent 28rem), radial-gradient(circle at 6% 88%, rgba(111,127,105,.13), transparent 30rem), var(--paper); }
.lock-screen::before { position: fixed; inset: 0; opacity: .14; background-image: radial-gradient(var(--coffee) .55px, transparent .55px); background-size: 5px 5px; content: ''; pointer-events: none; }
.lock-decoration { position: absolute; inset: 0; pointer-events: none; }
.lock-decoration span { position: absolute; display: block; border: 1px dashed var(--line); border-radius: 50%; }
.lock-decoration span:nth-child(1) { width: 14rem; height: 14rem; left: -6rem; top: -5rem; }
.lock-decoration span:nth-child(2) { width: 8rem; height: 8rem; right: 7%; bottom: 5%; }
.lock-decoration span:nth-child(3) { width: 2.2rem; height: 2.2rem; right: 15%; top: 16%; border: 0; background: var(--rose-soft); }
.lock-card { position: relative; z-index: 1; width: min(100%, 30rem); border: 1px solid rgba(220,199,167,.8); border-radius: 1.7rem .85rem 1.7rem 1.7rem; background: rgba(251,248,242,.95); padding: clamp(1.35rem, 7vw, 3rem); text-align: center; box-shadow: var(--shadow-md); }
.lock-card h1 { margin-bottom: var(--space-sm); font-size: clamp(2.15rem, 11vw, 3.25rem); }
.lock-intro { color: var(--coffee-soft); }
.brand-mark { display: block; width: 2.5rem; height: 2.5rem; flex: 0 0 auto; border-radius: .72rem; object-fit: cover; box-shadow: 0 3px 10px rgba(101,71,53,.1); }
.brand-mark--large { width: 5.4rem; height: 5.4rem; margin: 0 auto 1.2rem; border-radius: 1.2rem; }
.pin-inputs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(.25rem, 2vw, .6rem); margin: 1.5rem 0 .65rem; }
.pin-inputs input { width: 100%; min-width: 0; aspect-ratio: .78; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: var(--cream-soft); color: var(--coffee); font-size: clamp(1.2rem, 7vw, 1.75rem); font-weight: 700; text-align: center; caret-color: var(--sage); transition: transform 160ms var(--ease-out), border-color 160ms ease, background 160ms ease; }
.pin-inputs input:focus { border-style: solid; border-color: var(--sage); background: var(--paper); }
.pin-inputs.is-error { animation: shake 260ms var(--ease-out); }
.form-error { min-height: 1.35rem; margin: 0 0 .4rem; color: var(--danger); font-size: .82rem; }
.check-line { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .5rem 0 1.15rem; color: var(--coffee-soft); font-size: .82rem; }
input[type='checkbox'] { display: inline-grid; width: 1.2rem; height: 1.2rem; flex: 0 0 1.2rem; appearance: none; place-content: center; border: 1px solid var(--line); border-radius: .32rem; background: var(--paper); color: var(--paper); accent-color: var(--sage); cursor: pointer; transition: border-color 160ms ease, background-color 160ms ease, transform 150ms var(--ease-out); }
input[type='checkbox']::after { content: '\f00c'; font-family: 'Font Awesome 7 Free'; font-size: .65rem; font-weight: 900; line-height: 1; transform: scale(0); transition: transform 140ms var(--ease-out); }
input[type='checkbox']:checked { border-color: var(--sage); background: var(--sage); }
input[type='checkbox']:checked::after { transform: scale(1); }
input[type='checkbox']:active { transform: scale(.92); }
input[type='checkbox']:disabled { cursor: not-allowed; opacity: .55; }
.lock-note { margin: 1rem 0 0; color: var(--coffee-soft); font-size: .73rem; }

/* boutons et contrôles */
.button { display: inline-flex; min-height: 2.75rem; align-items: center; justify-content: center; gap: .5rem; border: 1px solid transparent; border-radius: .75rem; background: var(--cream-soft); padding: .67rem 1rem; color: var(--coffee); font-size: .83rem; font-weight: 700; line-height: 1.1; transition: transform 150ms var(--ease-out), background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.button:active, .icon-button:active, .favorite-button:active, .select-button:active { transform: scale(.97); }
.button:disabled { cursor: not-allowed; opacity: .48; box-shadow: none; }
.button--primary { background: var(--coffee); color: var(--paper); box-shadow: 0 7px 18px rgba(101,71,53,.16); }
.button--sage { background: var(--sage); color: var(--paper); }
.button--danger { background: #f4e5e1; color: var(--danger); }
.button--quiet { border-color: var(--line); background: transparent; }
.button--wide { width: 100%; }
.button--small { min-height: 2.5rem; padding: .5rem .75rem; font-size: .77rem; }
.icon-button { display: inline-grid; width: 2.75rem; height: 2.75rem; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: .75rem; background: var(--paper); color: var(--coffee); font-size: .95rem; transition: transform 150ms var(--ease-out), background-color 180ms ease, border-color 180ms ease; }
.icon-button--small { width: 2.5rem; height: 2.5rem; }

/* structure de l’application : mobile d’abord */
.app-shell { min-height: 100dvh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; min-height: var(--topbar); align-items: center; justify-content: space-between; gap: var(--space-sm); border-bottom: 1px solid var(--line-soft); background: rgba(251,248,242,.93); padding: max(.5rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) .5rem max(.75rem, env(safe-area-inset-left)); backdrop-filter: blur(16px); }
.profile-switcher { display: flex; min-width: 0; max-width: calc(100vw - 5rem); align-items: center; gap: .6rem; border: 0; border-radius: .8rem; background: transparent; padding: .2rem; text-align: left; }
.profile-switcher > span:nth-child(2) { display: grid; min-width: 0; }
.profile-switcher small { color: var(--coffee-soft); font-size: .65rem; }
.profile-switcher strong { max-width: 10rem; overflow: hidden; color: var(--coffee); font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-chevron { color: var(--coffee-soft); font-size: .65rem; transition: transform 180ms var(--ease-out); }
.profile-switcher[aria-expanded='true'] .profile-chevron { transform: rotate(180deg); }
.profile-avatar { display: inline-grid; width: 2.5rem; height: 2.5rem; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: .8rem .42rem .8rem .8rem; background: var(--sage-soft); color: var(--sage); font-family: var(--serif); font-size: 1.1rem; font-style: italic; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar--icon { font-family: inherit; font-size: .9rem; font-style: normal; }
.profile-menu { position: fixed; top: calc(var(--topbar) + env(safe-area-inset-top)); left: max(.75rem, env(safe-area-inset-left)); z-index: var(--z-sticky); width: min(20rem, calc(100vw - 1.5rem)); max-height: min(70dvh, 32rem); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); padding: .45rem; box-shadow: var(--shadow-md); transform-origin: top left; }
.profile-menu button { display: flex; width: 100%; min-height: 3.25rem; align-items: center; gap: .7rem; border: 0; border-radius: .65rem; background: transparent; padding: .5rem; text-align: left; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.network-state, #install-button { display: none !important; }
main { min-width: 0; padding: var(--space-lg) var(--space-sm) calc(1.5rem + env(safe-area-inset-bottom)); }
#page-content { width: min(100%, 82rem); margin-inline: auto; }
.page-loading { display: none; height: 3rem; align-items: center; justify-content: center; gap: .35rem; }
.page-loading.is-loading { display: flex; }
.page-loading span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--sage); animation: pulse 760ms ease-in-out infinite; }
.page-loading span:nth-child(2) { animation-delay: 100ms; }
.page-loading span:nth-child(3) { animation-delay: 200ms; }

/* rythme de page */
.page-head { display: flex; align-items: stretch; flex-direction: column; gap: var(--space-md); margin: .25rem 0 var(--space-lg); }
.page-head-copy { min-width: 0; }
.page-head h1 { margin-bottom: .4rem; font-size: clamp(2.45rem, 14vw, 3.4rem); }
.page-head-copy > p:last-child { max-width: 42rem; margin: 0; color: var(--coffee-soft); }
.head-actions, .toolbar-actions { display: flex; width: 100%; flex-wrap: wrap; gap: var(--space-xs); }
.head-actions .button { flex: 1 1 0; }
.hero-home { display: grid; gap: var(--space-md); margin-bottom: var(--space-xl); }
.hero-copy { overflow: hidden; border-radius: 1.4rem .7rem 1.4rem 1.4rem; background: var(--cream-soft); padding: clamp(1.4rem, 7vw, 2.5rem); }
.hero-copy h1 { max-width: 13ch; margin-bottom: var(--space-md); }
.hero-copy > p:not(.eyebrow) { max-width: 47ch; color: var(--coffee-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-lg); }
.hero-actions .button { flex: 1 1 12rem; }
.today-card { display: flex; min-height: 13rem; flex-direction: column; justify-content: space-between; gap: var(--space-lg); border: 1px solid var(--sage); border-radius: .75rem 1.35rem 1.35rem 1.35rem; background: var(--paper); padding: var(--space-lg); }
.today-card h2 { margin-bottom: .3rem; font-size: 1.6rem; }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); margin-top: var(--space-lg); }
.stat-strip div { min-width: 0; border-top: 1px dashed var(--line); padding-top: var(--space-sm); }
.stat-strip strong { display: block; color: var(--coffee); font-family: var(--serif); font-size: clamp(1.25rem, 7vw, 1.6rem); font-style: italic; font-variant-numeric: tabular-nums; }
.stat-strip span { font-size: .75rem; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); margin: var(--space-xl) 0 var(--space-md); }
.section-heading h2 { margin: 0; font-size: 1.6rem; }
.text-link { display: inline-flex; min-height: 2.75rem; align-items: center; gap: .4rem; border: 0; background: transparent; color: var(--sage); font-size: .8rem; font-weight: 700; }
.text-link--danger { color: var(--danger); }
.inline-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

/* dressing et cartes */
.clothes-grid, .outfit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: var(--space-sm); }
.clothes-grid.is-list { grid-template-columns: 1fr; }
.clothing-card { position: relative; min-width: 0; }
.clothing-photo { position: relative; display: block; width: 100%; overflow: hidden; aspect-ratio: .83; border: 0; border-radius: .9rem .42rem .9rem .9rem; background: var(--cream-soft); padding: 0; }
.clothing-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 220ms var(--ease-out); }
.clothing-info { min-width: 0; padding: .7rem .15rem .15rem; }
.clothing-info h3 { overflow: hidden; margin-bottom: .12rem; font-family: var(--sans); font-size: .9rem; font-style: normal; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.clothing-info p { overflow: hidden; margin: 0; color: var(--coffee-soft); font-size: .73rem; text-overflow: ellipsis; white-space: nowrap; }
.card-badge { position: absolute; top: .5rem; left: .5rem; display: inline-flex; align-items: center; border-radius: .45rem; background: rgba(251,248,242,.91); padding: .25rem .45rem; color: var(--coffee); font-size: .65rem; font-weight: 700; backdrop-filter: blur(6px); }
.favorite-button, .select-button { position: absolute; z-index: 2; display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 0; border-radius: .68rem; background: rgba(251,248,242,.92); color: var(--coffee); font-size: .85rem; transition: transform 150ms var(--ease-out), color 180ms ease, background-color 180ms ease; }
.favorite-button { top: .5rem; right: .5rem; }
.select-button { top: 3.25rem; left: .5rem; }
.favorite-button.is-active { color: var(--rose); }
.select-button[aria-pressed='true'] { color: var(--sage); }
.clothes-grid.is-list .clothing-card { display: grid; grid-template-columns: 5rem minmax(0, 1fr); align-items: center; border-bottom: 1px dashed var(--line); padding-bottom: var(--space-sm); }
.clothes-grid.is-list .clothing-photo { aspect-ratio: 1; border-radius: .7rem; }
.clothes-grid.is-list .clothing-info { padding: .5rem 5.8rem .5rem .75rem; }
.clothes-grid.is-list .favorite-button { top: 50%; right: .3rem; transform: translateY(-50%); }
.clothes-grid.is-list .select-button { top: 50%; left: auto; right: 3rem; transform: translateY(-50%); }
.outfit-card { display: grid; overflow: hidden; border: 1px solid var(--line-soft); border-radius: .9rem 1.2rem 1.2rem 1.2rem; background: var(--cream-soft); }
.outfit-card-media { display: grid; width: 100%; aspect-ratio: 1.12; place-items: center; overflow: hidden; border: 0; background: var(--cream); padding: 0; }
.outfit-card-media img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
.outfit-card-body { padding: var(--space-md); }
.outfit-card-body h3 { margin-bottom: .3rem; }

/* filtres et formulaires */
.toolbar { margin-bottom: var(--space-lg); border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: rgba(247,239,223,.45); padding: var(--space-sm); }
.filter-row { display: grid; grid-template-columns: 1fr; gap: var(--space-xs); }
.field, .field-row { display: grid; gap: .35rem; }
.field { margin-bottom: .9rem; }
.field-row { grid-template-columns: 1fr; gap: var(--space-sm); }
.field label, .field > span { color: var(--coffee); font-size: .74rem; font-weight: 700; }
.input, .select, .textarea { width: 100%; min-width: 0; min-height: 2.8rem; border: 1px solid var(--line); border-radius: .7rem; background-color: var(--paper); padding: .65rem .78rem; outline: 0; transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1.25 5 5 5-5' fill='none' stroke='%23654735' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; background-size: .68rem auto; padding-inline-end: 2.45rem; }
.textarea { min-height: 6rem; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--sage); background: #fffdf8; box-shadow: 0 0 0 3px rgba(111,127,105,.12); }
.search-field { position: relative; min-width: 0; }
.search-field .input { padding-left: 2.45rem; }
.search-field::before { position: absolute; z-index: 1; left: .9rem; top: 50%; color: var(--coffee-soft); content: '\f002'; font-family: 'Font Awesome 7 Free'; font-size: .78rem; font-weight: 900; transform: translateY(-50%); pointer-events: none; }
.empty-state { display: grid; min-height: clamp(16rem, 48dvh, 22rem); place-items: center; border: 1px dashed var(--line); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(247,239,223,.78), rgba(251,248,242,.62)); padding: clamp(1.5rem, 7vw, 3rem); text-align: center; }
.empty-state > div { max-width: 29rem; }
.empty-state-icon { display: inline-grid; width: 2.75rem; height: 2.75rem; place-items: center; margin-bottom: var(--space-md); border: 1px solid var(--line); border-radius: .8rem; color: var(--sage); }
.empty-state h2 { margin-bottom: .6rem; }
.empty-state p { color: var(--coffee-soft); }
.status-dot { display: inline-block; width: .5rem; height: .5rem; margin-right: .3rem; border-radius: 50%; background: var(--sage); }
.status-dot--laundry { background: var(--rose); }
.status-dot--worn { background: var(--line); }

/* feuilles et composition */
.sheet { width: 100%; max-width: none; max-height: 94dvh; overflow: hidden; border: 0; border-radius: 1.3rem 1.3rem 0 0; background: var(--paper); padding: 0; color: var(--ink); box-shadow: var(--shadow-lg); }
.sheet[open] { margin: auto 0 0; }
.sheet::backdrop { background: rgba(48,42,38,.38); backdrop-filter: blur(3px); }
.sheet-inner { display: flex; max-height: 94dvh; flex-direction: column; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); border-bottom: 1px dashed var(--line); padding: var(--space-lg) var(--space-md) var(--space-md); }
.sheet-header h2 { margin: 0; font-size: 1.65rem; }
.sheet-header p { margin: 0 0 .15rem; }
.sheet-content { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: var(--space-md); overscroll-behavior: contain; scroll-padding-block: 1rem; }
.sheet-content form, .sheet-content section, .sheet-content nav { min-width: 0; }
.sheet-content :is(.field, .field-row, details, .check-line) { scroll-margin-block: 1rem; }
.sheet-footer { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--paper); padding: var(--space-sm) var(--space-md) max(var(--space-sm), env(safe-area-inset-bottom)); box-shadow: 0 -10px 20px rgba(101,71,53,.06); }
.sheet-footer[hidden] { display: none; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-xs); margin: 0; }
.form-actions .button { flex: 1 1 9rem; }
.mobile-menu-primary { margin-bottom: var(--space-md); }
.mobile-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs); }
.mobile-menu-link { display: flex; min-width: 0; min-height: 4.25rem; align-items: center; gap: .65rem; border: 1px solid var(--line-soft); border-radius: .8rem; background: var(--cream-soft); padding: .75rem; color: var(--coffee); text-align: left; }
.mobile-menu-link i { width: 1.15rem; flex: 0 0 auto; text-align: center; }
.mobile-menu-link span { min-width: 0; overflow-wrap: anywhere; }
.mobile-menu-link.is-active { border-color: var(--sage); background: var(--sage-soft); }
.image-picker { display: grid; min-height: 12rem; place-items: center; overflow: hidden; border: 1px dashed var(--line); border-radius: var(--radius-md); background: var(--cream-soft); text-align: center; }
.image-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.image-picker img { width: 100%; max-height: 21rem; object-fit: contain; }
.chip-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { display: inline-flex; min-height: 2.5rem; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: .6rem; background: transparent; padding: .45rem .7rem; font-size: .76rem; }
.chip.is-active { border-color: var(--sage); background: var(--sage-soft); color: #43513f; }
.outfit-builder { display: grid; grid-template-columns: 1fr; gap: var(--space-lg); }
.item-picker-panel { max-height: none; overflow: visible; }
.picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.picker-item { position: relative; overflow: hidden; aspect-ratio: 1; border: 1px solid transparent; border-radius: .65rem; background: var(--cream-soft); padding: 0; }
.picker-item img { width: 100%; height: 100%; object-fit: cover; }
.picker-item.is-selected { border: 3px solid var(--sage); }
.canvas { position: relative; min-height: 22rem; overflow: hidden; border: 1px dashed var(--line); border-radius: var(--radius-md); background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.8), transparent 65%), var(--cream-soft); touch-action: none; }
.canvas-item { position: absolute; left: 50%; top: 50%; width: 8rem; border: 0; background: transparent; padding: 0; transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, 0px))) scale(var(--scale, 1)) rotate(var(--rotation, 0deg)); transform-origin: center; user-select: none; }
.canvas-item img { width: 100%; max-height: 10rem; object-fit: contain; filter: drop-shadow(0 8px 8px rgba(101,71,53,.12)); pointer-events: none; }
.canvas-item.is-active { outline: 2px dashed var(--sage); outline-offset: .3rem; }
.canvas-controls { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .65rem; }

/* planning */
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-md); }
.calendar-head { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; align-items: center; gap: var(--space-xs); margin-bottom: var(--space-md); }
.calendar-head h2 { min-width: 0; margin: 0; font-size: clamp(1.25rem, 6vw, 1.8rem); text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(82vw, 1fr)); gap: var(--space-sm); overflow-x: auto; margin-inline: calc(-1 * var(--space-sm)); padding: .2rem var(--space-sm) var(--space-md); scroll-snap-type: x proximity; scrollbar-width: thin; }
.calendar-grid.month-grid { grid-template-columns: repeat(7, minmax(5.2rem, 1fr)); gap: .4rem; }
.day-card { min-height: 13rem; scroll-snap-align: start; border: 1px solid transparent; border-radius: var(--radius-md); background: var(--cream-soft); padding: .75rem; box-shadow: var(--shadow-sm); }
.day-card.is-today { border-color: var(--sage); }
.day-card header { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: .45rem; color: var(--coffee); }
.day-card header strong { font-family: var(--serif); font-size: 1rem; font-style: italic; }
.schedule-card { display: grid; width: 100%; gap: .35rem; margin-top: .6rem; border: 1px dashed var(--line); border-radius: .6rem; background: rgba(251,248,242,.58); padding: .55rem; text-align: left; font-size: .73rem; }
.schedule-card img { width: 100%; height: 5rem; border-radius: .45rem; object-fit: cover; }
.month-grid .day-card { min-height: 7rem; padding: .5rem; }
.month-grid .schedule-card { padding: .35rem; }
.month-grid .schedule-card span { display: none; }

/* historique, statistiques, réglages */
.timeline { position: relative; display: grid; gap: .5rem; margin-left: .2rem; padding-left: 1.3rem; }
.timeline::before { position: absolute; left: .15rem; top: .5rem; bottom: .5rem; width: 1px; background: var(--line); content: ''; }
.timeline-item { position: relative; display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: var(--space-sm); align-items: center; border-bottom: 1px dashed var(--line); padding: .75rem 0; }
.timeline-item::before { position: absolute; left: -1.45rem; width: .6rem; height: .6rem; border: 2px solid var(--paper); border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 1px var(--sage); content: ''; }
.timeline-thumb { width: 3.75rem; height: 3.75rem; border-radius: .65rem; background: var(--cream); object-fit: cover; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
.stat-card { min-height: 7.5rem; border-top: 1px solid var(--line); padding: var(--space-md) .2rem; }
.stat-card strong { display: block; color: var(--coffee); font-family: var(--serif); font-size: clamp(2rem, 12vw, 3rem); font-style: italic; font-variant-numeric: tabular-nums; }
.bar-list { display: grid; gap: .7rem; }
.bar-row { display: grid; grid-template-columns: minmax(5rem, 7rem) minmax(0, 1fr) 2rem; gap: .55rem; align-items: center; font-size: .76rem; }
.bar-track { overflow: hidden; height: .55rem; border-radius: 1rem; background: var(--cream); }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: var(--sage); }
.settings-layout { display: grid; gap: var(--space-lg); }
.settings-tabs { display: flex; gap: .25rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.settings-tabs button { min-height: 2.75rem; flex: 0 0 auto; border: 0; border-radius: .65rem; background: transparent; padding: .65rem .8rem; text-align: left; white-space: nowrap; }
.settings-tabs button.is-active { background: var(--cream-soft); color: var(--coffee); font-weight: 700; }
.settings-panel { min-width: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); border-bottom: 1px dashed var(--line); padding: var(--space-md) 0; }
.profile-manage-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-sm); align-items: center; border-bottom: 1px dashed var(--line); padding: var(--space-sm) 0; }
.profile-card-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: .4rem; }

/* états flottants */
.bulk-bar { position: fixed; z-index: var(--z-sticky); left: 50%; bottom: calc(5.2rem + env(safe-area-inset-bottom)); display: flex; width: calc(100% - 1.5rem); max-width: 34rem; align-items: center; justify-content: space-between; gap: .5rem; border-radius: var(--radius-md); background: var(--ink); padding: .6rem .65rem .6rem .85rem; color: var(--paper); box-shadow: 0 12px 30px rgba(48,42,38,.25); transform: translateX(-50%); }
.bulk-bar .select { width: auto; min-width: 7rem; min-height: 2.5rem; }
.toast-region { position: fixed; z-index: var(--z-toast); right: max(var(--space-sm), env(safe-area-inset-right)); bottom: calc(5.2rem + env(safe-area-inset-bottom)); display: grid; width: min(22rem, calc(100vw - 1.5rem)); gap: .5rem; pointer-events: none; }
.toast { border: 1px solid var(--line); border-radius: .8rem; background: var(--paper); padding: .8rem 1rem; color: var(--coffee); box-shadow: var(--shadow-md); animation: toast-in 220ms var(--ease-out); }
.toast.is-error { border-color: #d9aaa3; color: var(--danger); }
.update-banner { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(5.2rem + env(safe-area-inset-bottom)); display: flex; width: min(32rem, calc(100% - 1.5rem)); align-items: center; justify-content: space-between; gap: var(--space-md); border-radius: .8rem; background: var(--ink); padding: .65rem .75rem .65rem 1rem; color: var(--paper); box-shadow: var(--shadow-md); transform: translateX(-50%); }
.bottom-nav { position: fixed; z-index: var(--z-nav); inset: auto 0 0; display: grid; height: calc(4.55rem + env(safe-area-inset-bottom)); grid-template-columns: repeat(5, 1fr); align-items: start; border-top: 1px solid var(--line-soft); background: rgba(251,248,242,.96); padding: .35rem max(.2rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(.2rem, env(safe-area-inset-left)); backdrop-filter: blur(16px); }
.bottom-nav a { position: relative; display: grid; min-height: 3.6rem; place-items: center; align-content: center; gap: .12rem; color: var(--coffee-soft); }
.bottom-nav a i { font-size: 1rem; }
.bottom-nav a small { font-size: .61rem; }
.bottom-nav a.is-active { color: var(--coffee); }
.bottom-nav a.is-active::after { position: absolute; bottom: .12rem; width: 1rem; height: 2px; border-radius: 1rem; background: var(--rose); content: ''; }
.bottom-nav button { align-self: start; justify-self: center; width: 3.45rem; height: 3.45rem; transform: translateY(-1rem); border: 4px solid var(--paper); border-radius: 1rem .55rem 1rem 1rem; background: var(--coffee); color: var(--paper); font-size: 1.1rem; box-shadow: var(--shadow-sm); }
.bottom-nav button:active { transform: translateY(-1rem) scale(.97); }

@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes pulse { 50% { transform: translateY(-4px); opacity: .5; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (min-width: 23.75rem) {
  .filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row .select { padding: .65rem 2.25rem .65rem .6rem; font-size: .8rem; }
  .search-field { grid-column: 1 / -1; }
}

@media (min-width: 36rem) {
  main { padding-inline: var(--space-lg); }
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clothes-grid, .outfit-grid { grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: var(--space-md); }
  .profile-manage-card { grid-template-columns: auto minmax(0, 1fr) auto; }
  .profile-card-actions { grid-column: auto; flex-wrap: nowrap; }
}

@media (min-width: 48rem) {
  body { padding-bottom: 0; }
  .app-shell { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); grid-template-rows: var(--topbar) minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: var(--z-nav); display: flex; width: 5.25rem; flex-direction: column; border-right: 1px solid var(--line-soft); background: var(--paper-deep); padding: 1rem .65rem; }
  .brand { display: flex; min-height: 3rem; align-items: center; justify-content: center; padding: 0; }
  .brand > span:last-child, .primary-nav a > span:last-child, .settings-link > span:last-child { display: none; }
  .primary-nav { display: grid; gap: .25rem; margin-top: 1.5rem; }
  .primary-nav a, .settings-link { display: flex; min-height: 3rem; align-items: center; justify-content: center; border-radius: .75rem; padding: .6rem 0; color: var(--coffee-soft); font-size: .83rem; font-weight: 600; transition: transform 150ms var(--ease-out), background-color 180ms ease, color 180ms ease; }
  .primary-nav a.is-active, .settings-link.is-active { background: var(--paper); color: var(--coffee); box-shadow: var(--shadow-sm); }
  .nav-icon { display: inline-grid; width: 1.35rem; place-items: center; color: currentColor; font-size: .95rem; }
  .settings-link { margin-top: auto; }
  .topbar { grid-column: 2; grid-row: 1; padding: .55rem clamp(1.25rem, 3vw, 2rem); }
  .network-state { display: inline !important; color: var(--coffee-soft); font-size: .74rem; }
  #install-button:not(.is-hidden) { display: inline-flex !important; }
  .profile-menu { left: calc(5.25rem + clamp(1.25rem, 3vw, 2rem)); }
  main { grid-column: 2; grid-row: 2; padding: clamp(1.75rem, 4vw, 2.75rem); }
  .bottom-nav { display: none; }
  .page-head { align-items: flex-end; flex-direction: row; justify-content: space-between; gap: var(--space-xl); margin-bottom: var(--space-xl); }
  .page-head h1 { font-size: clamp(3rem, 6vw, 4.3rem); }
  .head-actions { width: auto; flex: 0 0 auto; justify-content: flex-end; }
  .head-actions .button { flex: 0 0 auto; }
  .hero-home { grid-template-columns: minmax(0, 1.15fr) minmax(16rem, .85fr); gap: clamp(1rem, 3vw, 2rem); }
  .toolbar { padding: var(--space-md); }
  .filter-row { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .search-field { grid-column: span 12; }
  .filter-row .select { grid-column: span 3; }
  .filter-row--compact .search-field { grid-column: span 9; }
  .filter-row--compact .select { grid-column: span 3; }
  .sheet { width: min(46rem, calc(100% - 2rem)); max-height: min(90dvh, 58rem); border-radius: 1.2rem .65rem 1.2rem 1.2rem; }
  .sheet[open] { margin: auto; }
  .sheet--wide { width: min(74rem, calc(100% - 2rem)); }
  .sheet-inner { max-height: min(90dvh, 58rem); }
  .sheet-header { padding: 1.25rem 1.35rem 1rem; }
  .sheet-content { padding: 1.2rem 1.35rem; }
  .sheet-footer { padding: .9rem 1.35rem; }
  .form-actions .button { flex: 0 0 auto; }
  .outfit-builder { grid-template-columns: minmax(14rem, .8fr) minmax(17rem, 1.2fr); }
  .item-picker-panel { max-height: 65dvh; overflow-y: auto; border-right: 1px dashed var(--line); padding-right: var(--space-md); }
  .canvas { min-height: 28rem; }
  .calendar-grid { grid-template-columns: repeat(7, minmax(7rem, 1fr)); margin-inline: 0; padding-inline: .2rem; }
  .calendar-grid.month-grid { grid-template-columns: repeat(7, minmax(6.2rem, 1fr)); }
  .month-grid .schedule-card span { display: initial; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .settings-layout { grid-template-columns: minmax(12rem, .32fr) minmax(0, 1fr); gap: var(--space-2xl); }
  .settings-tabs { display: grid; align-content: start; overflow: visible; }
  .settings-tabs button { white-space: normal; }
  .settings-panel { max-width: 48rem; }
  .bulk-bar { left: calc(5.25rem + (100% - 5.25rem) / 2); bottom: 1.25rem; width: auto; max-width: none; }
  .toast-region { bottom: max(var(--space-md), env(safe-area-inset-bottom)); }
  .update-banner { bottom: var(--space-md); }
}

@media (min-width: 68.75rem) {
  .app-shell { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .sidebar { width: var(--sidebar); padding: 1rem .8rem; }
  .brand { justify-content: flex-start; gap: .7rem; padding: 0 .45rem; color: var(--coffee); font-family: var(--serif); font-size: 1.15rem; font-style: italic; font-weight: 700; }
  .brand > span:last-child, .primary-nav a > span:last-child, .settings-link > span:last-child { display: inline; }
  .primary-nav a, .settings-link { justify-content: flex-start; gap: .75rem; padding: .6rem .78rem; }
  .profile-menu { left: calc(var(--sidebar) + clamp(1.25rem, 3vw, 2rem)); }
  .search-field { grid-column: span 4; }
  .filter-row .select { grid-column: span 2; }
  .filter-row--compact .search-field { grid-column: span 9; }
  .filter-row--compact .select { grid-column: span 3; }
  .bulk-bar { left: calc(var(--sidebar) + (100% - var(--sidebar)) / 2); }
}

@media (min-width: 90rem) {
  main { padding-block: var(--space-2xl); }
  .hero-copy { padding: 3.25rem; }
}

@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--cream); }
  .button--primary:hover { background: var(--coffee-deep); box-shadow: 0 9px 22px rgba(101,71,53,.2); }
  .button--sage:hover { background: #5e7059; }
  .button--quiet:hover, .icon-button:hover { border-color: color-mix(in srgb, var(--line), var(--coffee) 22%); background: var(--cream-soft); }
  .primary-nav a:hover, .settings-link:hover { color: var(--coffee); transform: translateX(2px); }
  .profile-menu button:hover { background: var(--cream-soft); }
  .clothing-card:hover .clothing-photo img { transform: scale(1.025); }
  .text-link:hover { color: var(--coffee); }
}

@media (pointer: coarse) {
  .button, .icon-button, .chip, .settings-tabs button { min-height: 2.75rem; }
}

@media (max-width: 22.4rem) {
  .clothes-grid, .outfit-grid { grid-template-columns: 1fr; }
  .lock-card { padding-inline: 1.05rem; }
  .profile-switcher strong { max-width: 7rem; }
  .bulk-bar { align-items: stretch; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  input[type='checkbox'] { appearance: auto; }
  .select { appearance: auto; background-image: none; padding-inline-end: .78rem; }
}
