/* עיצוב כללי: "ירוק שוק" בגוון טורקיז ים. מקור: shopping-app/design/DESIGN.md */
:root {
  --bg: #eff5f5; --fg: #14292b; --card: #ffffff; --acc: #0f7c80; --acc-fg: #ffffff;
  --muted: #647a7c; --line: #dde8e8; --soft: #d9eeee; --warn: #b5651d; --warn-bg: #fbeedd;
  --font: "Rubik", "Assistant", system-ui, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1718; --fg: #e2eded; --card: #182325; --acc: #4fc3c4; --acc-fg: #062022;
    --muted: #8aa1a2; --line: #243233; --soft: #163a3b; --warn: #f0a35e; --warn-bg: #3a2a18;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 16px/1.4 var(--font); background: var(--bg); color: var(--fg);
  display: flex; flex-direction: column;
}
button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* כותרת */
.top {
  background: var(--acc); color: var(--acc-fg);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 16px;
  border-radius: 0 0 20px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.top h1 { margin: 0; font-size: 1.3rem; font-weight: 700; }
.top small { display: block; opacity: .85; font-size: .8rem; min-height: 1.1em; }

/* תוכן */
main {
  flex: 1; width: 100%; max-width: 600px; margin: 0 auto;
  padding: 12px 12px 96px; display: flex; flex-direction: column; gap: 12px;
}
.card { background: var(--card); border-radius: 15px; padding: 4px 12px; }
.card ul { list-style: none; margin: 0; padding: 0; }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem; font-weight: 500; color: var(--muted); padding: 6px 0 2px;
}
.link { background: none; border: 0; color: var(--acc); font-size: .8rem; font-weight: 500; padding: 4px 0; }

/* פריט */
.item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.card ul .item:first-child { border-top: 0; }
.check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--acc);
  background: transparent; color: var(--acc-fg); flex: none; padding: 0;
  display: grid; place-items: center; font-size: .8rem; line-height: 1;
}
.item.checked .check { background: var(--acc); }
.info { flex: 1; min-width: 0; }
.name { overflow-wrap: anywhere; }
.meta { font-size: .75rem; color: var(--muted); }
.item.checked .name { color: var(--muted); text-decoration: line-through; }
.qty {
  font-size: .8rem; color: var(--acc); white-space: nowrap; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--acc) 12%, transparent); padding: 1px 9px; border-radius: 999px;
}
.del { background: none; border: 0; color: var(--muted); font-size: 1rem; padding: 4px 6px; opacity: .7; }

#empty { text-align: center; color: var(--muted); margin-top: 32px; }

/* שורת הוספה בתחתית */
.add {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  max-width: 600px; margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.add input {
  flex: 1; min-width: 0; font: inherit; color: var(--fg);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px;
}
.add input:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 1px var(--acc); }
.add input::placeholder { color: var(--muted); }
.add button {
  width: 46px; height: 46px; border-radius: 50%; border: 0; flex: none;
  background: var(--acc); color: var(--acc-fg); font-size: 1.6rem; line-height: 1;
  display: grid; place-items: center;
}

/* משתמשים: צ'יפ בכותרת */
.user-chip {
  display: flex; align-items: center; gap: 6px; flex: none; max-width: 50%;
  background: color-mix(in srgb, var(--acc-fg) 18%, transparent); color: var(--acc-fg);
  border: 0; border-radius: 999px; padding-block: 4px; padding-inline: 4px 12px;
}
.user-chip[hidden] { display: none; }
.top button:focus-visible { outline-color: var(--acc-fg); }
.user-chip .dot {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--acc-fg); color: var(--acc); display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; line-height: 1;
}
.chip-name { font-size: .9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* מסך "מי עושה קניות?" — מחליף את הרשימה כשהוא פתוח */
body.picking .top, body.picking main, body.picking .add { display: none; }
.picker {
  flex: 1; width: 100%; max-width: 600px; margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 32px;
  display: flex; flex-direction: column;
}
.picker[hidden] { display: none; }
.picker .back { align-self: flex-start; font-size: .9rem; }
.picker-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.picker-icon { width: 56px; height: 56px; color: var(--acc); }
.picker h2 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; }
.user-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; max-width: 360px; }
.user-card {
  background: var(--card); color: var(--fg); border: 2px solid transparent; border-radius: 18px;
  padding: 16px 8px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.user-card.current { border-color: var(--acc); }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 1.3rem; font-weight: 700; line-height: 1;
}
.avatar.new { background: transparent; border: 2px dashed var(--muted); color: var(--muted); font-size: 1.6rem; font-weight: 400; }
.uname { font-weight: 500; max-width: 100%; overflow-wrap: anywhere; }

/* גיליון "משתמש חדש" */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .35); }
.sheet {
  position: fixed; inset: auto 0 0 0; z-index: 21; max-width: 600px; margin: 0 auto;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.scrim[hidden], .sheet[hidden] { display: none; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; }
.sheet h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.sheet input {
  font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px;
}
.sheet input:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 1px var(--acc); }
.sheet input::placeholder { color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 14px; padding: 2px 4px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; }
.swatch[aria-checked="true"] { outline: 2px solid var(--fg); outline-offset: 2px; }
.swatch:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }
.sheet-error { margin: 0; color: var(--warn); font-size: .85rem; }
.primary {
  width: 100%; border: 0; border-radius: 999px; padding: 13px;
  background: var(--acc); color: var(--acc-fg); font-size: 1rem; font-weight: 500;
}
