* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #faf9f7;
  --card: #ffffff;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --accent: #b45309;
  --accent-soft: #fef3e2;
  --danger: #b91c1c;
  --radius: 14px;
}
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }

/* ---- auth ---- */
.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; width: 100%; max-width: 380px; text-align: center; }
.auth-card h1 { font-size: 28px; margin-bottom: 4px; }
.auth-card p { margin-bottom: 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
input, textarea, select {
  font: inherit; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn {
  font: inherit; font-weight: 600; padding: 11px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink);
}
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.link { border: none; background: none; color: var(--accent); margin-top: 14px; font-weight: 500; }
.btn.danger { color: var(--danger); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }

.error { background: #fee2e2; color: var(--danger); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }

/* ---- layout ---- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 10px; max-width: 640px; margin: 0 auto;
}
header h1 { font-size: 22px; }
.badge { font-size: 11px; font-weight: 600; background: #fef9c3; color: #854d0e; padding: 4px 8px; border-radius: 99px; }
main { max-width: 640px; margin: 0 auto; padding: 8px 18px 90px; }
nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  flex: 1; font: inherit; font-size: 11px; font-weight: 600; color: var(--muted);
  background: none; border: none; padding: 8px 0 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
nav button span { font-size: 20px; }
nav button.active { color: var(--accent); }

/* ---- wardrobe grid ---- */
.toolbar { display: flex; gap: 8px; margin: 8px 0 14px; flex-wrap: wrap; align-items: center; }
.chip {
  font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink);
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; position: relative;
}
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #f5f5f4; }
.card .info { padding: 8px 10px; }
.card .info b { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .info small { color: var(--muted); font-size: 11px; }
.card .laundry-flag {
  position: absolute; top: 8px; right: 8px; background: rgba(28,25,23,.75); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 99px;
}
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 10px; }

.fab {
  position: fixed; right: 18px; bottom: 76px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 28px; border: none; cursor: pointer;
  box-shadow: 0 4px 14px rgba(180,83,9,.4); z-index: 5;
}

/* ---- modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: var(--card); border-radius: 20px 20px 0 0; width: 100%; max-width: 640px;
  max-height: 88vh; overflow-y: auto; padding: 18px;
}
.modal-card img.hero { width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; background: #f5f5f4; }
.modal-card h2 { font-size: 18px; margin: 12px 0 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tags .tag { font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 4px 10px; border-radius: 99px; font-weight: 600; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }

/* ---- outfits ---- */
.suggest-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.occasion-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.outfit {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px;
}
.outfit h3 { font-size: 16px; margin-bottom: 8px; }
.outfit .pieces { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.outfit .pieces img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex-shrink: 0; }
.outfit p { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.tipbox { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.wxline { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ---- family / profile ---- */
.list-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.member { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: none; }
.invite-code { font-size: 26px; letter-spacing: 4px; font-weight: 700; text-align: center; padding: 8px 0; }
.section-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 18px 0 8px; }
.profile-body-img { width: 120px; border-radius: 12px; display: block; margin-bottom: 8px; }

.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px;
  font-size: 14px; z-index: 20; white-space: nowrap;
}
.spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 8px;
}
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
