/* ── Shopping module ── */

.sh-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--bg);
}

.sh-topbar {
  background: var(--topbar-bg);
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.sh-back {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sh-back:active { opacity: 0.6; }
.sh-topbar__text { flex: 1; }
.sh-topbar__title { color: #fff; font-size: 17px; font-weight: 500; }
.sh-topbar__sub { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 2px; }

/* Stats */
.sh-stats {
  background: var(--bg2);
  padding: 10px 16px 9px;
  border-bottom: 0.5px solid var(--sep);
  position: sticky;
  top: 80px;
  z-index: 9;
}

.sh-stats__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sh-stats__label { font-size: 12px; color: var(--label3); }
.sh-stats__val   { font-size: 12px; font-weight: 600; }

.sh-progress-bar {
  height: 4px;
  background: var(--sep);
  border-radius: 2px;
  overflow: hidden;
}

.sh-progress-fill {
  height: 100%;
  background: #34c759;
  border-radius: 2px;
  transition: width 0.3s;
}

/* Categories */
.sh-cats {
  padding: 10px 12px 32px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sh-cat {
  background: var(--bg2);
  border-radius: var(--radius-md);
  border: 0.5px solid var(--sep);
  overflow: hidden;
}

.sh-cat__head {
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sh-cat__head:active { opacity: 0.7; }

.sh-cat__icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sh-cat__icon i { font-size: 13px; color: var(--label3); }
.sh-cat__title { flex: 1; font-size: 14px; font-weight: 500; color: var(--label); }
.sh-cat__count { font-size: 12px; color: var(--label3); }
.sh-cat__count.done { color: #34c759; font-weight: 600; }
.sh-cat__chev { color: var(--label3); font-size: 15px; }

.sh-cat__body { border-top: 0.5px solid var(--sep); }

/* Item */
.sh-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 0.5px solid var(--sep);
}

.sh-item:last-of-type { border-bottom: none; }

.sh-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1.5px solid var(--sep);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.sh-checkbox.checked {
  background: #34c759;
  border-color: #34c759;
}

.sh-checkbox.checked i { font-size: 11px; color: #fff; }
.sh-checkbox:active { opacity: 0.7; }

.sh-item__name {
  flex: 1;
  font-size: 14px;
  color: var(--label);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sh-item__name.bought {
  color: var(--label3);
  text-decoration: line-through;
}

/* Qty tag */
.sh-qty-tag {
  font-size: 13px;
  color: var(--label3);
  background: var(--bg3);
  border: 0.5px solid var(--sep);
  border-radius: 7px;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 44px;
  text-align: right;
  outline: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.sh-qty-tag.editing {
  background: rgba(10,132,255,0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.sh-del {
  background: none;
  border: none;
  color: rgba(255,69,58,0.4);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.sh-del:active { color: #ff453a; }

/* Add item */
.sh-add-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  font-size: 13px;
  color: rgba(10,132,255,0.7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sh-add-item i { font-size: 14px; }

/* Add category */
.sh-add-cat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px;
  background: var(--bg2);
  border-radius: var(--radius-md);
  border: 0.5px dashed var(--sep);
  font-size: 13px;
  color: var(--label3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Sheet overlay */
.sh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
}

.sh-sheet {
  background: var(--bg2);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 12px;
}

.sh-sheet__handle {
  width: 32px;
  height: 3px;
  background: var(--sep);
  border-radius: 2px;
  margin: 10px auto 14px;
}

.sh-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 0.5px solid var(--sep);
}

.sh-sheet__title { font-size: 15px; font-weight: 600; color: var(--label); }

.sh-sheet__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--label3);
  font-size: 18px;
  padding: 2px;
}

.sh-sheet__body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sh-sheet__row {
  display: flex;
  gap: 8px;
}

.sh-sheet__input {
  background: var(--bg3);
  border: 0.5px solid var(--sep);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--label);
  outline: none;
  width: 100%;
  -webkit-appearance: none;
}

.sh-sheet__input:focus { border-color: var(--accent); }
.sh-sheet__input::placeholder { color: var(--label3); }
.sh-sheet__num  { width: 80px; flex-shrink: 0; text-align: center; }
.sh-sheet__unit { flex: 1; cursor: pointer; }

.sh-sheet__actions {
  padding: 4px 16px 0;
}

.sh-sheet__btn-save {
  width: 100%;
  height: 46px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sh-sheet__btn-save:active { opacity: 0.8; }
