/* Wardrobe: mobile-first, calm, photo-led. Big targets, zero clutter. */

:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --ink: #1f1d1a;
  --muted: #817b73;
  --line: #e7e2da;
  --line-strong: #d2cabf;
  --accent: #2f4a3e;        /* deep green */
  --accent-soft: #e2eae5;
  --tile: #efece6;          /* behind cutouts */
  --amber-soft: #f6ecd6;
  --amber-ink: #7d5a12;
  --danger: #b0412e;
  --danger-soft: #f6e1dc;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 3px rgba(31, 29, 26, 0.06), 0 4px 16px rgba(31, 29, 26, 0.05);
  --nav-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }

h1 { font-size: 27px; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em; }
h3 { font-size: 13px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 650; }
h3.inline { display: inline; margin: 0; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* ---------- layout ---------- */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 2px 16px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.note-card { background: transparent; box-shadow: none; border: 1.5px dashed var(--line-strong); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.row-center { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 18px; }
.empty { text-align: center; padding: 34px 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.splash { text-align: center; padding-top: 30vh; }
.sync-chip { color: var(--accent); font-size: 20px; line-height: 1; padding-top: 8px; }

/* ---------- buttons ---------- */

button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 18px;
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 650; cursor: pointer; text-decoration: none;
  transition: transform 0.06s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-block { width: 100%; }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: 14.5px; border-radius: 11px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-outline { background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-text {
  background: none; border: none; color: var(--muted);
  font-size: 14px; font-weight: 600; padding: 10px 6px; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.btn-danger-text { color: var(--danger); }
.btn-back { background: none; border: none; font-size: 17px; font-weight: 600; padding: 6px 10px 6px 0; cursor: pointer; color: var(--muted); display: block; }

/* ---------- chips + segmented ---------- */

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.chip-scroll {
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
}
.chip-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 7px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.chip-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-warn { background: var(--amber-soft); border-color: var(--amber-soft); color: var(--amber-ink); }
.chip-info { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.seg { display: flex; background: var(--line); border-radius: 13px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg-tight { margin: 10px 0 0; }
.seg-opt { flex: 1; border: none; background: transparent; border-radius: 10px; padding: 9px 6px; font-size: 14px; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg-opt small { font-size: 12px; opacity: 0.8; }
.seg-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.banner {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-sm);
  padding: 13px 16px; margin-bottom: 14px; font-weight: 650; text-decoration: none;
}
.banner span { font-size: 22px; line-height: 1; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 999px; background: var(--line); color: var(--ink); margin: 0 0 8px;
}
.badge-worn, .badge-ratified { background: var(--accent-soft); color: var(--accent); }
.badge-swapped, .badge-pending_review, .badge-proposed { background: var(--amber-soft); color: var(--amber-ink); }
.badge-skipped, .badge-archived, .badge-rejected { background: var(--line); color: var(--muted); }
.badge-pending_photo { background: var(--amber-soft); color: var(--amber-ink); }

/* ---------- tiles ---------- */

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.grid-sheet { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { cursor: pointer; min-width: 0; }
.tile-pic {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  background: var(--tile); display: flex; align-items: center; justify-content: center;
}
.tile-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-cutout .tile-pic img { object-fit: contain; padding: 8%; }
.tile-ph { font-size: 12px; font-weight: 650; color: var(--muted); text-align: center; padding: 6px; }
.tile-name { font-size: 12.5px; font-weight: 600; margin-top: 5px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-dot { position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--amber-ink); opacity: 0.55; box-shadow: 0 0 0 2px #fff; }
.tile-dot-all { opacity: 1; background: var(--danger); }
.tile-qty { position: absolute; bottom: 6px; right: 6px; font-size: 11px; font-weight: 750; background: rgba(255, 255, 255, 0.92); border-radius: 8px; padding: 1px 6px; }
.tile-selected .tile-pic { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile-check { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.tile-compact .tile-pic { border-radius: 11px; }

.outfit-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; margin: 8px 0 10px; }
.outfit-row { margin-bottom: 10px; }
.outfit-row > span { font-weight: 650; font-size: 14.5px; }

/* ---------- item + review ---------- */

.hero { background: var(--tile); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; height: min(44vh, 420px); display: flex; align-items: center; justify-content: center; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-cutout img { object-fit: contain; padding: 6%; }
.hero-ph { color: var(--muted); font-weight: 600; }
.item-title { margin: 0 2px 2px; }
.item-sub { margin: 0 2px 12px; text-transform: capitalize; }
.attrs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14.5px; }
.attrs dt { color: var(--muted); text-transform: capitalize; }
.attrs dd { margin: 0; overflow-wrap: anywhere; }

.stat-row { display: flex; gap: 10px; margin-bottom: 14px; }
.stat { flex: 1; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 21px; font-weight: 750; letter-spacing: -0.02em; }
.stat-label { font-size: 11.5px; color: var(--muted); line-height: 1.25; }

.ai-line { font-size: 14px; font-weight: 600; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); }
.ai-pending { background: var(--amber-soft); color: var(--amber-ink); }
.ai-failed { background: var(--danger-soft); color: var(--danger); }
.conf { font-size: 11px; font-weight: 750; border-radius: 6px; padding: 1px 5px; margin-left: 4px; vertical-align: 1px; }
.conf-hi { background: var(--accent-soft); color: var(--accent); }
.conf-mid { background: var(--amber-soft); color: var(--amber-ink); }
.conf-lo { background: var(--danger-soft); color: var(--danger); }

/* ---------- forms ---------- */

.item-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 13px; font-weight: 650; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted); }
input[type='text'], input[type='number'], input[type='date'], select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 12px; font: inherit; font-size: 16px; background: var(--surface); color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
details.more summary { cursor: pointer; font-weight: 650; color: var(--accent); padding: 4px 0; }
details.more .item-form { margin: 12px 0 0; }
.scale { display: flex; gap: 6px; }
.scale-opt { flex: 1; }
.scale-opt input { position: absolute; opacity: 0; pointer-events: none; }
.scale-opt span { display: block; text-align: center; padding: 9px 0; border-radius: 10px; border: 1.5px solid var(--line); font-weight: 650; font-size: 15px; cursor: pointer; background: var(--surface); }
.scale-opt input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.scale-wide span { font-size: 14px; }

/* ---------- add ---------- */

.capture {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border-radius: 22px; padding: 30px 16px 26px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(47, 74, 62, 0.28);
}
.capture:active { transform: scale(0.99); }
.capture-label { font-size: 20px; font-weight: 700; }
.capture-sub { font-size: 13.5px; opacity: 0.8; text-align: center; }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.upload { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.upload img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 11px; opacity: 0.7; }
.upload-failed span { color: var(--danger); }
.tips { margin: 0; padding-left: 20px; font-size: 14.5px; }
.tips li { margin-bottom: 5px; }

/* ---------- today ---------- */

.context-card { background: var(--surface); }
.weather { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.weather-temp { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.weather-sum { color: var(--muted); font-size: 14.5px; }
.events { margin: 6px 0 0; padding-left: 0; list-style: none; font-size: 14.5px; }
.events li { padding: 3px 0; }
.proposal h2 { font-size: 18px; }
.rank { font-weight: 750; color: var(--muted); }
.verdicts { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin-top: 6px; }
.proposal-skipped { opacity: 0.75; }
.proposal-worn { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }

/* ---------- me ---------- */

.rules { margin: 0; padding-left: 18px; font-size: 14.5px; }
.rules li { margin-bottom: 7px; }
.prose { white-space: pre-wrap; font-size: 14.5px; margin-top: 10px; }
details.card summary { cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
.app-foot { text-align: center; margin: 28px 0 10px; font-size: 13px; }
.app-foot .btn-text { display: inline; padding: 0; font-size: 13px; }

/* ---------- login ---------- */

.login { display: flex; flex-direction: column; align-items: center; padding-top: 6vh; gap: 4px; }
.login-brand { text-align: center; margin-bottom: 14px; }
.login-logo { width: 72px; height: 72px; border-radius: 22px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.user-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 10px; }
.user-id { max-width: 260px; text-align: center; margin-bottom: 8px; }
.pin-dots { display: flex; gap: 12px; margin: 6px 0; min-height: 16px; }
.pin-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-strong); }
.pin-dot.filled { background: var(--ink); border-color: var(--ink); }
.pin-error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 12px; }
.key { height: 62px; border-radius: 50%; border: none; background: var(--surface); box-shadow: var(--shadow); font-size: 24px; font-weight: 600; cursor: pointer; }
.key:active { background: var(--line); }
.key-ghost { background: transparent; box-shadow: none; font-size: 20px; }
.key-go { background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; }

/* ---------- laundry action bar ---------- */

.actionbar {
  position: fixed; left: 12px; right: 12px; max-width: 536px; margin: 0 auto;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; z-index: 20;
  box-shadow: 0 8px 28px rgba(31, 29, 26, 0.35); font-weight: 650; font-size: 14px;
}
.actionbar-btns { display: flex; gap: 6px; }
.actionbar .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.4); }

/* ---------- sheet ---------- */

#sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(31, 29, 26, 0.38); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 86vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
}
.sheet-msg { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; position: sticky; bottom: 0; }
.picker-cat { font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- bottom nav ---------- */

#bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); display: flex; z-index: 15;
}
#bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 650; color: var(--muted); text-decoration: none;
}
#bottomnav a.active { color: var(--accent); }
.nav-icon { position: relative; display: inline-flex; }
.nav-badge { position: absolute; top: -5px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 750; display: flex; align-items: center; justify-content: center; }
body[data-route='login'] #bottomnav { display: none; }

/* ---------- toast ---------- */

#toast {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 18px;
  font-size: 14.5px; font-weight: 600; opacity: 0; transition: all 0.25s ease; z-index: 50; pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

body[data-route='login'] #app { padding-bottom: 24px; }
