/* VestIA — estilos (mobile-first, cálido minimalista) */
:root {
  --bg: #f6f2ec;
  --card: #fffdf9;
  --ink: #23201b;
  --muted: #8b8274;
  --line: #e8e0d2;
  --accent: #b4593a;
  --accent-soft: #f3e2da;
  --ok: #3d7a4f;
  --danger: #b03a3a;
  --radius: 18px;
  --nav-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
body.no-scroll { overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; }
img { max-width: 100%; }
.hidden { display: none !important; }

#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* ---------- Topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  background: linear-gradient(var(--bg) 75%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 12px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-weight: 700; font-size: 19px;
}
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: .2px; }
.sync-ind { font-size: 18px; line-height: 1; transition: opacity .3s; }

/* ---------- Vista ---------- */
#view { padding: 4px 16px calc(var(--nav-h) + 30px); }
.fadein { animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.greet h1 { margin: 6px 0 2px; font-size: 26px; }
.greet p { margin: 0 0 14px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin: 10px 0 6px; }
.page-head h1 { margin: 0; font-size: 24px; }

.section-title { font-weight: 700; margin: 20px 2px 8px; font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 10px; }
.loading { text-align: center; color: var(--muted); padding: 26px 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 10px 0;
  box-shadow: 0 1px 2px rgba(60, 50, 30, .04);
}
.empty { text-align: center; padding: 30px 18px; }
.empty-ic { font-size: 44px; }

/* ---------- Clima ---------- */
.weather { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.w-main { display: flex; align-items: center; gap: 12px; }
.w-icon { font-size: 38px; }
.w-temp { font-size: 26px; font-weight: 700; }
.w-extra { display: flex; gap: 10px; color: var(--muted); font-size: 13px; }
.w-empty { display: flex; flex-direction: column; gap: 10px; }
.w-mini { font-size: 15px; white-space: nowrap; }

/* ---------- Acciones rápidas ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; color: var(--ink);
}
.quick span { font-size: 22px; }

/* ---------- Eventos ---------- */
.event-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.event-add {
  width: 100%; text-align: left; color: var(--muted);
  background: transparent; border: 1.5px dashed var(--line);
}

/* ---------- Looks ---------- */
.outfit-card { padding: 10px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs.sm .thumb { width: 52px; height: 52px; }
.thumb {
  width: 74px; height: 74px; border-radius: 12px; overflow: hidden;
  background: #f1ece3; display: grid; place-items: center; font-size: 26px;
  border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.owhy { margin-top: 8px; }

/* ---------- Clóset ---------- */
.search { margin: 8px 0; }
.chips { display: flex; gap: 8px; margin: 6px 0; }
.chips.wrap { flex-wrap: wrap; }
.chips.scroll-x { overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 7px 13px; font-size: 13.5px; white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.pal-c { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.chip-sep { width: 1px; background: var(--line); margin: 4px 2px; }

.grid-items {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px;
  padding-bottom: 20px;
}
.item-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item-img {
  height: 150px; background: #f1ece3; display: grid; place-items: center;
}
.item-img img { width: 100%; height: 100%; object-fit: contain; }
.item-meta { padding: 8px 10px 10px; }
.item-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fab {
  position: fixed; right: max(18px, calc(50% - 300px + 18px));
  bottom: calc(var(--nav-h) + 18px);
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 28px; box-shadow: 0 6px 18px rgba(180, 89, 58, .4);
  z-index: 20;
}

/* ---------- Inputs ---------- */
.input {
  width: 100%; padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  margin: 4px 0 10px;
}
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 2px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.switch-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14.5px; }
.linklike { color: var(--accent); }

/* ---------- Botones ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 14px; padding: 12px 16px; font-size: 15px; font-weight: 600;
}
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.danger { background: #f7e7e7; color: var(--danger); border-color: #ecc7c7; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { display: block; width: 100%; margin: 10px 0; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.btn-row .btn { flex: 1; }
.btn-col { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ---------- Sheet / modal / toast ---------- */
#sheet-root, #modal-root { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.sheet-backdrop, .modal-backdrop {
  position: absolute; inset: 0; background: rgba(30, 25, 15, .45);
  opacity: 0; transition: opacity .3s;
}
.sheet, .modal {
  position: absolute; background: var(--bg);
  border-radius: 24px 24px 0 0;
  left: 50%; transform: translate(-50%, 100%);
  width: 100%; max-width: 640px;
  max-height: 88dvh; overflow-y: auto;
  padding: 10px 18px 40px;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.modal {
  border-radius: 24px;
  bottom: auto; top: 50%; transform: translate(-50%, -40%);
  width: calc(100% - 36px); max-width: 420px;
  opacity: 0; transition: all .25s;
  padding: 22px;
}
#sheet-root.open, #modal-root.open { pointer-events: auto; }
#sheet-root.open .sheet { transform: translate(-50%, 0); }
#sheet-root.open .sheet-backdrop, #modal-root.open .modal-backdrop { opacity: 1; }
#modal-root.open .modal { transform: translate(-50%, -50%); opacity: 1; }
.sheet-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { margin: 6px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px);
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 14px; font-size: 14px;
  opacity: 0; transition: all .3s; z-index: 90; max-width: 86%;
  text-align: center; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Detalle prenda / look ---------- */
.photo-box {
  background: #f1ece3; border-radius: 16px; height: 240px;
  display: grid; place-items: center; overflow: hidden; cursor: pointer; margin: 8px 0;
}
.photo-box img { width: 100%; height: 100%; object-fit: contain; }
.photo-empty { text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.photo-empty span { font-size: 40px; }
.detail-img {
  background: #f1ece3; border-radius: 16px; height: 260px;
  display: grid; place-items: center; overflow: hidden; margin-bottom: 10px;
}
.detail-img img { width: 100%; height: 100%; object-fit: contain; }
.detail-items { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.mini-item {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px 6px 6px;
}
.mini-item img, .mini-item span:first-child {
  width: 40px; height: 40px; border-radius: 8px; background: #f1ece3;
  object-fit: contain; display: grid; place-items: center;
}
.mini-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.meta-row { display: flex; align-items: center; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.meta-row.wrap { row-gap: 4px; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); vertical-align: middle; }
.swatch.big { width: 30px; height: 30px; }
.color-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.stat-row { display: flex; gap: 8px; margin: 12px 0; }
.stat-row.big .stat b { font-size: 22px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; text-align: center; display: flex; flex-direction: column; font-size: 13px;
}
.stat b { font-size: 16px; }
.stat span { color: var(--muted); font-size: 12px; }
.rate-row { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.rate-row .btn { font-size: 20px; padding: 8px 14px; }
.tryon-box { display: flex; justify-content: center; }
.tryon-box svg { max-width: 300px; width: 100%; height: auto; border-radius: 18px; }

/* ---------- Calendario ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); }
.cal-cell {
  position: relative; border: none; background: transparent; border-radius: 10px;
  padding: 8px 0; font-size: 13.5px;
}
.cal-cell.today { background: var(--accent-soft); font-weight: 700; }
.cal-cell.pad { visibility: hidden; }
.dot { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; }
.dot.ev { background: var(--accent); }
.dot.worn { background: var(--ok); }
.ev-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-row .grow { flex: 1; min-width: 120px; }

/* ---------- Viajes ---------- */
.trip-card .trip-head { display: flex; flex-direction: column; gap: 2px; }
.progress { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 4px; transition: width .3s; }
.trip-day { padding: 12px; }
.td-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pack-group { margin: 10px 0; }
.pack-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.pack-row .done { text-decoration: line-through; color: var(--muted); }
.dest-row { display: flex; gap: 8px; align-items: center; }
.dest-row .input { margin: 4px 0; }

/* ---------- Paleta / pickers ---------- */
.pal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 12px 0; }
.pal { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; max-height: 50dvh; overflow-y: auto; }
.pick-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
}
.pick-item img, .pick-item > span:first-child {
  width: 64px; height: 64px; border-radius: 10px; background: #f1ece3; object-fit: contain;
  display: grid; place-items: center; font-size: 24px;
}

/* ---------- Stats / gaps / wishlist ---------- */
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar-row > span:first-child { width: 64px; color: var(--muted); }
.bar-row > span:last-child { width: 30px; text-align: right; }
.bar { flex: 1; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.gap-row { display: flex; gap: 10px; align-items: flex-start; }
.gap-row .grow { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.wish-row { display: flex; align-items: center; gap: 10px; }
.wish-row .grow { flex: 1; }
.tabs { margin-bottom: 4px; }

/* ---------- Nav ---------- */
#bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: rgba(255, 253, 249, .95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.navbtn {
  flex: 1; border: none; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; padding-top: 8px;
}
.navbtn .ic { font-size: 20px; filter: grayscale(1) opacity(.7); }
.navbtn.active { color: var(--ink); font-weight: 700; }
.navbtn.active .ic { filter: none; }

@media (min-width: 500px) {
  .grid-items { grid-template-columns: repeat(3, 1fr); }
}
