:root {
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  color: #17231f;
  background: #f4f7f5;
  font-synthesis: none;
  --green: #176b52;
  --green-dark: #0d4f3b;
  --green-soft: #e4f2ec;
  --line: #dce6e1;
  --muted: #6d7d76;
  --danger: #bd3e3e;
  --shadow: 0 10px 28px rgba(23, 56, 45, .09);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f4f7f5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
input, select { width: 100%; border: 1px solid #cfddd6; border-radius: 14px; background: white; padding: 13px 14px; outline: none; color: #17231f; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 82, .1); }
label { display: grid; gap: 7px; color: #43534c; font-size: 14px; font-weight: 700; }
.app-shell { max-width: 720px; margin: auto; min-height: 100vh; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.topbar { padding: calc(18px + env(safe-area-inset-top)) 18px 14px; display: flex; align-items: center; justify-content: space-between; background: rgba(244,247,245,.94); position: sticky; top: 0; z-index: 15; backdrop-filter: blur(12px); }
.topbar h1 { margin: 2px 0 0; font-size: 24px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 700; }
.avatar, .member-avatar { border: 0; width: 42px; height: 42px; border-radius: 50%; background: var(--green); color: white; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.demo-banner, .error-banner { margin: 0 16px 10px; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.demo-banner { background: #fff1c9; color: #715716; }
.error-banner { background: #ffe2e2; color: #8f2929; display: flex; justify-content: space-between; }
.error-banner button { border: 0; background: transparent; color: inherit; font-size: 20px; }
main { padding: 0 16px; }
.summary-card { background: linear-gradient(135deg, var(--green-dark), var(--green)); color: white; border-radius: 24px; padding: 20px; display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; box-shadow: var(--shadow); }
.summary-card > div:first-child { display: grid; text-align: center; }
.summary-card strong { font-size: 38px; line-height: 1; }
.summary-card span { font-size: 12px; opacity: .9; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; }
.progress { height: 8px; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.22); direction: ltr; }
.progress div { height: 100%; background: white; border-radius: inherit; transition: width .25s; }
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 14px 0; }
.search-box { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 15px; background: white; padding: 0 12px; }
.search-box input { border: 0; padding: 12px 0; box-shadow: none; }
.mode-button { border: 1px solid var(--green); color: var(--green); background: white; border-radius: 15px; padding: 0 14px; font-weight: 800; }
.mode-button.active { background: var(--green); color: white; }
.category-section { margin: 18px 0; }
.category-title { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; }
.category-title h2 { margin: 0; font-size: 16px; flex: 1; }
.category-title b { background: var(--green-soft); color: var(--green); min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; display: grid; place-items: center; font-size: 12px; }
.items-card { background: white; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 4px 16px rgba(30,65,52,.04); }
.item-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 66px; padding: 8px 12px; border-bottom: 1px solid #edf2ef; }
.item-row:last-child { border-bottom: 0; }
.item-row.purchased { opacity: .52; }
.item-row.purchased .item-name { text-decoration: line-through; }
.check-button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #9eb4aa; background: white; color: white; font-weight: 900; }
.purchased .check-button { background: var(--green); border-color: var(--green); }
.item-content { border: 0; background: transparent; text-align: right; display: grid; gap: 4px; padding: 6px 12px; }
.item-name { font-size: 17px; font-weight: 800; }
.item-meta { color: var(--muted); font-size: 12px; }
.item-actions { display: flex; }
.item-actions button { border: 0; background: transparent; font-size: 22px; color: #789087; padding: 8px 5px; }
.finish-button { width: 100%; border: 0; border-radius: 16px; padding: 15px; background: #17231f; color: white; font-weight: 800; margin: 8px 0 14px; }
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(720px, 100%); height: calc(72px + env(safe-area-inset-bottom)); padding: 6px 12px env(safe-area-inset-bottom); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr 68px 1fr 1fr; align-items: center; z-index: 20; backdrop-filter: blur(12px); }
.bottom-nav > button { border: 0; background: transparent; color: #78877f; display: grid; gap: 3px; place-items: center; }
.bottom-nav > button.active { color: var(--green); font-weight: 800; }
.nav-icon { position: relative; font-size: 21px; }
.nav-icon i { position: absolute; top: -7px; left: -12px; min-width: 18px; height: 18px; border-radius: 9px; background: #d84f4f; color: white; font-size: 10px; font-style: normal; display: grid; place-items: center; padding: 0 4px; }
.bottom-nav .add-main { width: 58px; height: 58px; border-radius: 50%; background: var(--green); color: white; font-size: 34px; box-shadow: 0 8px 20px rgba(23,107,82,.3); margin-top: -24px; }
.empty-state { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty-state h2, .empty-state h3 { color: #263b33; margin-bottom: 6px; }
.empty-state p { margin: 0 0 18px; }
.empty-icon { font-size: 52px; }
.primary, .secondary, .danger-outline { border-radius: 14px; padding: 13px 16px; font-weight: 800; }
.primary { border: 0; background: var(--green); color: white; }
.primary:disabled { opacity: .55; }
.secondary { border: 1px solid var(--line); background: white; color: #263b33; }
.danger-outline { border: 1px solid #e0aaaa; color: var(--danger); background: white; width: 100%; margin: 6px 0 28px; }
.compact { padding: 11px 18px; }
.full { width: 100%; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(13,31,24,.48); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-sheet { background: #f9fbfa; width: min(720px, 100%); max-height: 92vh; overflow: auto; border-radius: 26px 26px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -15px 50px rgba(0,0,0,.17); animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.modal-header h2 { margin: 0; font-size: 21px; }
.modal-header button { border: 0; background: #e8efeb; width: 36px; height: 36px; border-radius: 50%; font-size: 24px; }
.item-form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 8px; }
.finish-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.finish-summary div { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; text-align: center; }
.finish-summary strong { font-size: 30px; }
.finish-summary span { color: var(--muted); }
.choice-list { display: grid; gap: 10px; margin: 16px 0; }
.choice-list label { grid-template-columns: auto 1fr; align-items: start; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.choice-list label.selected { border-color: var(--green); background: var(--green-soft); }
.choice-list input { width: auto; margin-top: 3px; }
.choice-list span { display: grid; gap: 4px; }
.choice-list small { color: var(--muted); font-weight: 400; }
.toast { position: fixed; z-index: 80; bottom: calc(88px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #17231f; color: white; border-radius: 25px; padding: 11px 18px; white-space: nowrap; box-shadow: var(--shadow); }
.page { padding-bottom: 10px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; margin: 8px 2px 16px; }
.page-heading h2 { margin: 2px 0 0; font-size: 26px; }
.favorites-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.favorite-card { position: relative; background: white; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.fav-add { border: 0; background: transparent; width: 100%; min-height: 128px; display: grid; place-items: center; gap: 4px; padding: 18px; }
.fav-add span { font-size: 30px; }
.fav-add b { font-size: 16px; }
.fav-add small { color: var(--muted); }
.fav-delete { position: absolute; top: 5px; left: 6px; border: 0; background: transparent; font-size: 20px; color: #9aa9a2; }
.history-list { display: grid; gap: 12px; }
.history-card, .settings-card, .family-code-card { background: white; border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: 0 4px 16px rgba(30,65,52,.04); }
.history-top { display: flex; justify-content: space-between; }
.history-top > div { display: grid; gap: 4px; }
.history-top span, .history-card p { color: var(--muted); font-size: 13px; }
.history-card p { margin: 10px 0; }
.history-count { background: var(--green-soft); color: var(--green) !important; border-radius: 18px; padding: 7px 12px; height: fit-content; font-weight: 800; }
.history-items { display: grid; gap: 6px; margin: 10px 0 14px; color: #4c5d56; }
.family-code-card { text-align: center; display: grid; gap: 9px; background: linear-gradient(145deg, #eff8f4, white); margin-bottom: 12px; }
.family-code-card strong { font-size: 34px; letter-spacing: 6px; direction: ltr; color: var(--green); }
.settings-card { margin-bottom: 12px; display: grid; gap: 12px; }
.settings-card h3 { margin: 0 0 2px; }
.member-row { display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: center; padding: 8px 0; border-bottom: 1px solid #edf2ef; }
.member-row:last-child { border: 0; }
.member-avatar { width: 38px; height: 38px; font-size: 15px; }
.member-row > div:last-child { display: grid; }
.member-row span, .status-row span { color: var(--muted); font-size: 12px; }
.status-row { display: flex; justify-content: space-between; gap: 16px; }
.status-row b { text-align: left; font-size: 13px; }
.onboarding, .splash { min-height: 100vh; padding: max(24px, env(safe-area-inset-top)) 16px; display: grid; place-items: center; background: radial-gradient(circle at top right, #d8eee5, transparent 42%), #f4f7f5; }
.onboarding-card { width: min(440px, 100%); background: white; border-radius: 28px; padding: 24px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.brand h1 { margin: 0; font-size: 25px; }
.brand p { margin: 4px 0 0; color: var(--muted); }
.logo-mark { width: 58px; height: 58px; border-radius: 19px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--green), var(--green-dark)); font-size: 31px; font-weight: 900; box-shadow: 0 10px 22px rgba(23,107,82,.25); }
.notice { background: #fff5d9; color: #6c5519; border-radius: 14px; padding: 11px; font-size: 13px; margin-bottom: 16px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #eef3f0; border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.segmented button { border: 0; background: transparent; border-radius: 11px; padding: 10px; color: #6c7b74; font-weight: 800; }
.segmented button.active { background: white; color: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.onboarding form { display: grid; gap: 14px; }
.code-input { direction: ltr; text-align: center; letter-spacing: 5px; text-transform: uppercase; font-weight: 900; font-size: 20px; }
.form-error { color: var(--danger); background: #fff0f0; padding: 9px 11px; border-radius: 10px; font-size: 13px; }
.onboarding small { display: block; text-align: center; color: #9aa7a1; margin-top: 14px; }
.splash { align-content: center; gap: 12px; }
.splash h1 { margin: 0; }
.spinner { width: 26px; height: 26px; border: 3px solid #c8ddd4; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.shopping-mode .topbar { background: #e5f2ec; }
.shopping-mode .item-row { min-height: 76px; }
.shopping-mode .check-button { width: 34px; height: 34px; }
.shopping-mode .item-name { font-size: 19px; }
@media (min-width: 700px) {
  body { padding: 22px 0; }
  .app-shell { min-height: calc(100vh - 44px); border-radius: 28px; overflow: hidden; background: #f4f7f5; box-shadow: 0 20px 60px rgba(28,62,50,.12); }
  .bottom-nav { bottom: 22px; border-radius: 0 0 28px 28px; }
}

.join-heading { margin: 18px 0 8px; text-align: right; }
.join-heading h2 { margin: 0 0 6px; font-size: 1.15rem; }
.join-heading p { margin: 0; color: #66756f; line-height: 1.55; font-size: 0.92rem; }

/* v0.2.0 — independent households and PIN-protected settings */
.house-code-card { text-align: center; display: grid; gap: 9px; background: linear-gradient(145deg, #eff8f4, white); margin-bottom: 12px; border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: 0 4px 16px rgba(30,65,52,.04); }
.house-code-card strong, .join-code-inline strong { font-size: 34px; letter-spacing: 6px; direction: ltr; color: var(--green); }
.pin-explanation { background: #eef7f3; color: #425b51; border-radius: 13px; padding: 11px 12px; font-size: 13px; line-height: 1.5; }
.pin-input { direction: ltr; text-align: center; letter-spacing: 5px; font-weight: 900; }
.pin-large { font-size: 26px; padding: 16px; }
.modal-note { color: var(--muted); margin: -4px 0 16px; line-height: 1.5; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; }
.card-title-row > span { min-width: 28px; height: 28px; border-radius: 14px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 900; }
.admin-entry { grid-template-columns: 1fr auto; align-items: center; }
.admin-entry p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.settings-page { padding-bottom: 24px; }
.settings-header { display: flex; align-items: center; gap: 12px; margin: 8px 2px 16px; }
.settings-header h2 { margin: 2px 0 0; font-size: 26px; }
.back-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--green); font-size: 24px; font-weight: 900; }
.category-admin-list { display: grid; gap: 8px; }
.category-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid #edf2ef; }
.category-admin-row:last-child { border-bottom: 0; }
.category-admin-name { font-weight: 800; }
.category-admin-row > div { display: flex; gap: 4px; }
.category-admin-row button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: white; color: #43534c; font-weight: 900; }
.category-admin-row button:disabled { opacity: .3; cursor: default; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.member-admin-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf2ef; }
.member-admin-row:last-child { border-bottom: 0; }
.compact-member { border-bottom: 0; flex: 1; }
.mini-danger { color: var(--danger) !important; }
.text-button { border: 1px solid #e7baba; border-radius: 10px; background: white; padding: 8px 10px; font-weight: 800; }
.join-code-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.join-code-inline strong { font-size: 27px; }
.danger-zone { border-color: #efcaca; background: #fffafa; }
.danger-zone h3 { color: #8f2929; }
.danger-outline.inside { margin: 0; }
.danger-solid { width: 100%; border: 0; border-radius: 14px; padding: 13px 16px; color: white; background: #a92f2f; font-weight: 900; }

@media (max-width: 520px) {
  .admin-entry { grid-template-columns: 1fr; }
  .join-code-inline { align-items: stretch; flex-direction: column; text-align: center; }
  .category-admin-row { align-items: flex-start; }
  .category-admin-name { padding-top: 8px; }
  .form-grid { grid-template-columns: 1fr; }
}
.connection-actions { display: grid; gap: 10px; margin-top: 16px; }


/* v0.2.1 — mobile-first joining and invitation links */
.invite-card { margin: 0 0 16px; padding: 16px; border: 1px solid #cfe4da; border-radius: 18px; background: linear-gradient(145deg, #edf8f3, #ffffff); text-align: center; }
.invite-card > span { display: inline-block; margin-bottom: 7px; color: var(--green); font-size: 12px; font-weight: 900; }
.invite-card h2 { margin: 0; font-size: 21px; }
.invite-card p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.mobile-onboarding-heading { margin: 0 0 16px; text-align: right; }
.mobile-onboarding-heading > span { color: var(--green); font-size: 12px; font-weight: 900; }
.mobile-onboarding-heading h2 { margin: 4px 0 5px; font-size: 22px; }
.mobile-onboarding-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.onboarding-switch { width: 100%; margin-top: 14px; padding: 7px; border: 0; background: transparent; color: var(--green); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.invite-code-backup { margin-top: 12px; padding: 9px 10px; border-radius: 12px; background: #f3f6f4; color: var(--muted); text-align: center; font-size: 12px; }
.invite-code-backup b { color: #43534c; direction: ltr; letter-spacing: 2px; }
.house-code-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.house-code-card small { color: var(--muted); line-height: 1.45; }
.house-code-card .masked-code { letter-spacing: 10px; color: #71817a; }
@media (max-width: 600px) {
  .onboarding { place-items: start center; padding-top: max(18px, env(safe-area-inset-top)); }
  .onboarding-card { margin-top: 12px; padding: 22px; }
  .brand { margin-bottom: 17px; }
  .brand h1 { font-size: 24px; }
  .house-code-actions { grid-template-columns: 1fr; }
}
