/* Wardrobe — editorial, quiet, one accent. 8 px grid. */

:root {
  --paper: #f5f2eb;
  --paper-2: #ece7dc;
  --paper-3: #e2dccf;
  --ink: #16150f;
  --ink-2: #4a4740;
  --ink-3: #8b867a;
  --line: #d9d3c6;
  --accent: #8d4a28;      /* primary actions only */
  --accent-ink: #ffffff;
  --good: #4b6a3c;        /* done / in season */
  --bad: #a3382a;         /* errors / delete */
  --tile: radial-gradient(120% 90% at 50% 20%, #fbf9f4 0%, #efeae0 70%, #e6e0d3 100%);
  --shadow: 0 18px 30px -22px rgba(22, 21, 15, .55);
  --r: 4px;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121110; --paper-2: #1b1a17; --paper-3: #26241f;
    --ink: #f1ede3; --ink-2: #c9c3b5; --ink-3: #8f897c; --line: #2e2c26;
    --accent: #c9825c; --accent-ink: #16150f;
    --good: #8fb07a; --bad: #e07a68;
    --tile: radial-gradient(120% 90% at 50% 20%, #2a2823 0%, #1f1d19 70%, #191815 100%);
    --shadow: 0 18px 30px -20px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
  --paper: #121110; --paper-2: #1b1a17; --paper-3: #26241f;
  --ink: #f1ede3; --ink-2: #c9c3b5; --ink-3: #8f897c; --line: #2e2c26;
  --accent: #c9825c; --accent-ink: #16150f;
  --good: #8fb07a; --bad: #e07a68;
  --tile: radial-gradient(120% 90% at 50% 20%, #2a2823 0%, #1f1d19 70%, #191815 100%);
  --shadow: 0 18px 30px -20px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--sans); letter-spacing: .005em;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: -.01em; line-height: 1.1; }
h1 { font-size: 40px; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.caps { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.hide { display: none !important; }
.sr { position: absolute; left: -9999px; }

/* ───────── shell ───────── */
.top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top .in { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { font-family: var(--serif); font-size: 24px; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav button {
  background: none; border: 0; padding: 8px 12px; border-radius: var(--r); color: var(--ink-2);
  font-size: 14px; letter-spacing: .02em;
}
.nav button[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 12px; }
main { max-width: 1240px; margin: 0 auto; padding: 24px 16px 96px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--ink-3); }

@media (max-width: 720px) {
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; background: var(--paper); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .nav button { flex: 1; font-size: 12px; padding: 8px 4px; }
  .nav button[aria-current="page"] { box-shadow: none; color: var(--accent); }
  h1 { font-size: 32px; }
  .top .who .name { display: none; }
}

/* ───────── controls ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--ink); border-radius: var(--r); background: none; color: var(--ink); letter-spacing: .02em;
}
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: var(--line); color: var(--ink-2); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
}
.input:focus { outline: none; border-color: var(--ink); }
textarea.input { min-height: 88px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: none; border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--ink-2);
}
.chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }
.chip.sm { padding: 3px 9px; font-size: 12px; }
.range { width: 100%; accent-color: var(--ink); }
.note { font-size: 13px; color: var(--ink-3); }
.alert { padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--bad); border-radius: var(--r); margin-bottom: 16px; }
.alert.ok { border-left-color: var(--good); }
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--r); font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── sign-in ───────── */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate .card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.gate h1 { font-size: 48px; }
.gate .tabs { display: flex; gap: 16px; border-bottom: 1px solid var(--line); }
.gate .tabs button { background: none; border: 0; padding: 8px 0; color: var(--ink-3); }
.gate .tabs button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

/* ───────── closet grid ───────── */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 180px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.tile { background: none; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 8px; color: inherit; }
.tile .ph {
  aspect-ratio: 1; border-radius: var(--r); background: var(--tile); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; position: relative;
}
.tile .ph img.c, .tile .ph img.r { width: 82%; height: 82%; object-fit: contain; filter: drop-shadow(0 14px 14px rgba(22, 21, 15, .22)); }
.tile .ph img.o { width: 100%; height: 100%; object-fit: cover; }
.tile .ph .st { position: absolute; left: 8px; top: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--paper); padding: 2px 6px; border-radius: 2px; }
.tile .ph .fav { position: absolute; right: 8px; top: 8px; color: var(--accent); width: 14px; height: 14px; }
.tile .ph .busy { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--paper) 55%, transparent); }
.tile .t { font-size: 14px; line-height: 1.3; }
.tile .m { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.sw { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); display: inline-block; flex: none; }
.empty { padding: 64px 16px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: var(--r); }
.empty h3 { color: var(--ink); margin-bottom: 8px; }

/* ───────── add / processing ───────── */
.drop {
  border: 1px dashed var(--ink-3); border-radius: var(--r); padding: 48px 24px; text-align: center; background: var(--paper-2);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.drop.over { border-color: var(--accent); background: var(--paper-3); }
.drop h3 { font-size: 26px; }
.queue { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.qrow { display: grid; grid-template-columns: 72px 1fr auto; gap: 16px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); }
.qrow .ph { width: 72px; height: 72px; border-radius: var(--r); background: var(--tile); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.qrow .ph img { width: 100%; height: 100%; object-fit: contain; }
.qrow .steps { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.qrow .steps span.on { color: var(--ink); }
.qrow .steps span.ok { color: var(--good); }
.qrow .steps span.err { color: var(--bad); }

/* ───────── today / outfits ───────── */
.today { display: grid; grid-template-columns: 300px 1fr; gap: 32px; align-items: start; }
@media (max-width: 900px) { .today { grid-template-columns: 1fr; } }
.wx { border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.wx .big { font-family: var(--serif); font-size: 56px; line-height: 1; display: flex; align-items: center; gap: 12px; }
.wx .big svg { width: 36px; height: 36px; }
.wx .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.wx .loc { display: flex; gap: 8px; align-items: center; }
.outfits { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.ofit { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.ofit .board { background: var(--tile); padding: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-height: 220px; }
.ofit .board .p { aspect-ratio: 1; display: grid; place-items: center; position: relative; }
.ofit .board .p img { max-width: 92%; max-height: 92%; object-fit: contain; filter: drop-shadow(0 12px 12px rgba(22, 21, 15, .2)); }
.ofit .board .p img.o { width: 92%; height: 92%; object-fit: cover; border-radius: 2px; }
.ofit .board .p.big { grid-column: span 2; grid-row: span 2; }
.ofit .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ofit .body h3 { font-size: 24px; }
.ofit .list { font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.ofit .acts { display: flex; gap: 8px; margin-top: 8px; }
.ofit .miss { font-size: 12px; color: var(--accent); }

/* ───────── detail drawer ───────── */
.scrim { position: fixed; inset: 0; background: rgba(22, 21, 15, .35); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--paper); z-index: 31; overflow: auto;
  border-left: 1px solid var(--line); padding: 24px 24px 120px; display: flex; flex-direction: column; gap: 20px;
}
.drawer .hero { aspect-ratio: 1; border-radius: var(--r); background: var(--tile); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.drawer .hero img.c, .drawer .hero img.r { width: 84%; height: 84%; object-fit: contain; filter: drop-shadow(0 18px 18px rgba(22, 21, 15, .22)); }
.drawer .hero img.o { width: 100%; height: 100%; object-fit: contain; }
.drawer .seg { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; width: max-content; }
.drawer .seg button { border: 0; background: none; padding: 6px 14px; font-size: 13px; color: var(--ink-3); }
.drawer .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.drawer .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.drawer .kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.drawer .kv dt { color: var(--ink-3); }
.drawer .kv dd { margin: 0; }
.drawer .x { position: absolute; top: 12px; right: 12px; }
.conf { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.conf i { display: block; height: 100%; background: var(--good); }

/* ───────── profile ───────── */
.prof { max-width: 560px; display: flex; flex-direction: column; gap: 20px; }
.history { display: flex; flex-direction: column; gap: 8px; }
.history .d { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stat { display: flex; gap: 24px; }
.stat b { font-family: var(--serif); font-size: 30px; font-weight: 500; display: block; line-height: 1; }
.stat span { font-size: 12px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
