/* Vestiaire — éditorial, chaleureux, léger */
:root {
  --bg: #f5f1ea;
  --surface: #fffdf9;
  --tile: #ece6dc;
  --ink: #1a1714;
  --ink-2: #4a443d;
  --muted: #6e665c;
  --line: #e2dacd;
  --accent: #b5562e;
  --accent-ink: #fff;
  --good: #2f7a4f;
  --warn: #a5541f;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 8px 24px rgba(40, 30, 20, .06);
  --shadow-lg: 0 24px 60px rgba(30, 20, 10, .18);
  --r: 18px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141210; --surface: #1d1a17; --tile: #2a2622; --ink: #f2ede5; --ink-2: #cfc7bb; --muted: #a49b8f;
    --line: #34302b; --accent: #e08458; --accent-ink: #1a1210; --good: #6cc08f; --warn: #e79a5f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --shadow-lg: 0 24px 60px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141210; --surface: #1d1a17; --tile: #2a2622; --ink: #f2ede5; --ink-2: #cfc7bb; --muted: #a49b8f;
  --line: #34302b; --accent: #e08458; --accent-ink: #1a1210; --good: #6cc08f; --warn: #e79a5f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --shadow-lg: 0 24px 60px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Mise en page ---------- */
.shell { max-width: 1120px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 8px; }
.brand { font-family: var(--serif); font-size: 26px; letter-spacing: -.02em; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.brand i { font-style: italic; font-weight: 400; color: var(--accent); }
.brand svg { width: 30px; height: 30px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tab { border: 0; background: none; padding: 8px 16px; border-radius: 999px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; transition: background .2s, color .2s; }
.tab[aria-current="page"] { background: var(--ink); color: var(--bg); }
.tab svg { width: 18px; height: 18px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); transition: transform .15s var(--ease); }
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

@media (max-width: 760px) {
  .top .tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 20; box-shadow: var(--shadow-lg); padding: 6px; }
  .tab { flex-direction: column; gap: 2px; font-size: 11px; padding: 8px 18px; }
  .tab svg { width: 20px; height: 20px; }
  .brand { font-size: 22px; }
}

.hero { padding: 28px 0 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 600; color: var(--muted); }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 5vw, 46px); line-height: 1.05; letter-spacing: -.02em; margin: 6px 0 0; }
h1 em { color: var(--accent); }
h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0; letter-spacing: -.01em; }
.lead { color: var(--ink-2); max-width: 54ch; margin: 10px 0 0; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 11px 18px; border-radius: 999px; font-weight: 500; min-height: 44px; transition: transform .15s var(--ease), background .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: #c0392b; }
.btn.small { min-height: 36px; padding: 7px 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.fab { position: fixed; right: max(16px, calc((100vw - 1120px) / 2 + 16px)); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 21; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-lg); display: grid; place-items: center; transition: transform .2s var(--ease); }
.fab:hover { transform: scale(1.06) rotate(90deg); }
.fab svg { width: 26px; height: 26px; }
@media (max-width: 760px) { .fab { bottom: calc(90px + env(safe-area-inset-bottom)); width: 54px; height: 54px; } }

/* ---------- Puces / filtres ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; color: var(--ink-2); min-height: 38px; display: inline-flex; align-items: center; gap: 6px; transition: all .18s var(--ease); }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { font-size: 12px; opacity: .6; }
.chip small { font-weight: 400; opacity: .7; }

/* ---------- Grille de la garde-robe ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.card { position: relative; background: var(--surface); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); text-align: left; padding: 0; transition: transform .25s var(--ease), box-shadow .25s; animation: rise .4s var(--ease) both; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .ph { aspect-ratio: 4 / 5; background: var(--tint, var(--tile)); display: grid; place-items: center; overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .ph img { transform: scale(1.04); }
.card .meta { padding: 10px 12px 12px; }
.card .name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); flex: none; }
.dots { display: flex; }
.dots .dot + .dot { margin-left: -4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 2px var(--surface); }
.badge { position: absolute; top: 10px; left: 10px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.missing { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); border-radius: var(--r); margin-bottom: 18px; color: var(--ink-2); font-size: 14px; }
.missing strong { color: var(--ink); }

/* ---------- État vide ---------- */
.empty { text-align: center; padding: 56px 20px; border: 1.5px dashed var(--line); border-radius: 24px; background: var(--surface); }
.empty .art { width: 120px; margin: 0 auto 14px; color: var(--accent); }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 40ch; margin: 0 auto 18px; }

/* ---------- Styliste ---------- */
.studio { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 18px; display: grid; gap: 16px; margin-bottom: 22px; }
.studio .row { display: grid; gap: 8px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.anchor { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border-radius: 14px; background: var(--tile); }
.anchor img, .anchor .sw { width: 44px; height: 54px; object-fit: cover; border-radius: 10px; }
.anchor div { flex: 1; font-size: 14px; }
.studio .go { justify-self: start; }

.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
@media (max-width: 420px) { .looks { grid-template-columns: 1fr; } }
.look { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; animation: rise .5s var(--ease) both; }
.look .board { padding: 14px; background: linear-gradient(160deg, var(--tile), color-mix(in srgb, var(--tile) 60%, var(--surface))); display: grid; gap: 8px; }
.look .lrow { display: flex; gap: 8px; justify-content: center; height: 170px; }
.look .lrow.lower { height: 118px; }
.look .piece { flex: 1 1 0; max-width: 50%; min-width: 0; border-radius: 14px; overflow: hidden; background: var(--surface); position: relative; }
.look .piece img { width: 100%; height: 100%; object-fit: cover; }
.look .piece span { position: absolute; left: 6px; bottom: 6px; right: 6px; font-size: 10.5px; font-weight: 600; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px); border-radius: 8px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.look .body { padding: 14px 16px 16px; display: grid; gap: 12px; flex: 1; align-content: start; }
.look .head { display: flex; align-items: center; gap: 12px; }
.ring { --v: 80; width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--ring, var(--good)) calc(var(--v) * 1%), var(--line) 0); }
.ring b { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-family: var(--serif); font-size: 17px; }
.look .verdict { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.look .verdict small { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 2px; }
.palette { display: flex; height: 10px; border-radius: 999px; overflow: hidden; }
.palette i { flex: 1; }
.why { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.why li { display: flex; gap: 8px; align-items: flex-start; }
.why li::before { content: ""; width: 16px; height: 16px; flex: none; margin-top: 2px; border-radius: 50%; background: color-mix(in srgb, var(--good) 18%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='%232f7a4f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.why li.neg::before { background: color-mix(in srgb, var(--warn) 18%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 4.5v4.2M8 11.2v.1' fill='none' stroke='%23a5541f' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.look .actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 16px; }
.look .actions .btn { flex: 1; }
.look .tag { font-size: 12px; color: var(--muted); }

/* ---------- Fiche (dialog) ---------- */
.sheet { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(560px, 100vw); max-height: min(92dvh, 900px); border-radius: 26px; box-shadow: var(--shadow-lg); overflow: hidden; }
.sheet::backdrop { background: rgba(20, 15, 10, .45); backdrop-filter: blur(3px); }
.sheet[open] { animation: pop .3s var(--ease); display: flex; flex-direction: column; }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@media (max-width: 600px) {
  .sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 26px 26px 0 0; max-height: 94dvh; }
  .sheet[open] { animation: up .35s var(--ease); }
  @keyframes up { from { transform: translateY(100%); } }
}
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.sheet .scroll { overflow-y: auto; padding: 4px 18px 18px; display: grid; gap: 18px; }
.sheet footer { display: flex; gap: 8px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.sheet footer .btn.primary { flex: 1; }

.drop { position: relative; border: 1.5px dashed var(--line); border-radius: 20px; background: var(--tile); min-height: 220px; display: grid; place-items: center; text-align: center; color: var(--muted); overflow: hidden; transition: border-color .2s; }
.drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img { width: 100%; max-height: 320px; object-fit: contain; }
.drop .hint svg { width: 40px; height: 40px; margin: 0 auto 8px; color: var(--accent); }
.drop .change { position: absolute; right: 10px; bottom: 10px; pointer-events: none; }

.field { display: grid; gap: 8px; }
.input, select.input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 11px 13px; min-height: 44px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 0; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .15s var(--ease); }
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }
.swatch .rank { position: absolute; top: -4px; right: -4px; background: var(--ink); color: var(--bg); font-size: 10px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; }
.swatch.add { background: var(--tile); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.swatch.add svg { width: 20px; height: 20px; }
.empty .art svg, .missing svg { width: 100%; height: auto; }
.missing svg { width: 22px; flex: none; color: var(--accent); }
.swatch.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cname { font-size: 13px; color: var(--muted); }
.range { width: 100%; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.detail-ph { border-radius: 18px; overflow: hidden; background: var(--tint, var(--tile)); aspect-ratio: 4 / 3; }
.detail-ph img { width: 100%; height: 100%; object-fit: contain; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Connexion ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(60% 50% at 80% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
  radial-gradient(50% 40% at 10% 90%, color-mix(in srgb, var(--accent) 10%, transparent), transparent), var(--bg); }
.login form { width: min(380px, 100%); display: grid; gap: 14px; text-align: center; }
.login .mark { width: 64px; height: 64px; margin: 0 auto; }
.login h1 { font-size: 44px; }
.login .input { text-align: center; font-size: 18px; letter-spacing: .2em; }
.login .err { color: #c0392b; font-size: 14px; min-height: 20px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: 16px; z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast 2.6s var(--ease) both; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

.skeleton { border-radius: 24px; background: linear-gradient(100deg, var(--tile) 30%, color-mix(in srgb, var(--tile) 50%, var(--surface)) 50%, var(--tile) 70%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; min-height: 380px; }
@keyframes shimmer { to { background-position: -200% 0; } }

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