/* Raizman Family App — light blue, box-based, touch-first.
   Kept to CSS that runs on older LG webOS browsers (no flex gap, no :has). */
:root {
  --bg: #EAF4FB;
  --surface: #FFFFFF;
  --tile: #F5FAFE;
  --soft: #D9ECFA;
  --soft-2: #C4E1F6;
  --line: #CFE3F2;
  --primary: #1F7AC0;
  --primary-strong: #145E96;
  --text: #12324B;
  --muted: #5A7A92;
  --danger: #C0392B;
  --danger-soft: #FCE8E6;
  --holiday: #9A4B07;
  --holiday-bg: #FFF1DC;
  --major: #A3123B;
  --major-bg: #FDE4EA;
  --modern: #1D6B4F;
  --modern-bg: #DDF3EA;
  --shadow: 0 1px 2px rgba(18, 50, 75, .06), 0 4px 14px rgba(31, 122, 192, .08);
  --radius: 18px;
  --tap: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font-family: "Heebo", "Segoe UI", "Arial Hebrew", Arial, sans-serif; font-size: 18px; line-height: 1.45;
  -webkit-text-size-adjust: 100%; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible, .tv :focus { outline: 4px solid #F2B705; outline-offset: 3px; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.page { max-width: 1400px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; min-height: 64px; margin-bottom: 12px; }
.topbar h1 { flex: 1; font-size: 26px; margin: 0 12px; font-weight: 800; }
.topbar .spacer { flex: 1; }
.topbar > * + * { margin-right: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); min-width: var(--tap);
  padding: 0 22px; border-radius: 14px; border: 2px solid transparent; background: var(--soft); color: var(--primary-strong);
  font-weight: 700; font-size: 18px; white-space: nowrap; transition: transform .08s ease, background .15s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-strong); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--primary-strong); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { min-height: 46px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
.btn.icon { padding: 0; width: var(--tap); font-size: 24px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .ico { margin-left: 8px; display: inline-flex; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.muted { color: var(--muted); }
.banner { background: var(--holiday-bg); color: var(--holiday); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; font-weight: 500; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: 100%; max-width: 440px; text-align: center; padding: 32px 24px; }
.login .logo { width: 84px; height: 84px; border-radius: 24px; background: var(--primary); margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center; color: #fff; }
.login h1 { margin: 0 0 4px; font-size: 30px; }
.login p { margin: 0 0 22px; }
.field { display: block; text-align: right; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; font-size: 16px; }
.input { width: 100%; min-height: var(--tap); border-radius: 14px; border: 2px solid var(--line); background: var(--tile);
  padding: 10px 14px; font-size: 19px; }
.input:focus { border-color: var(--primary); background: #fff; }
textarea.input { min-height: 96px; resize: vertical; }
.error { color: var(--danger); font-weight: 500; min-height: 26px; margin: 4px 0 10px; }
.login .btn { width: 100%; font-size: 20px; }

/* ---------- home ---------- */
.home-head { display: flex; align-items: flex-start; margin: 8px 0 22px; }
.home-head .who { flex: 1; }
.welcome { font-size: 34px; font-weight: 800; margin: 6px 0 4px; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.today-line { font-size: 18px; color: var(--muted); }
.today-line b { color: var(--holiday); font-weight: 700; }
.home-head .actions > * { margin-right: 8px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 18px; direction: ltr; }
.tile { direction: rtl; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 210px; border: 0; border-radius: 26px; background: var(--surface); box-shadow: var(--shadow);
  padding: 24px 16px; text-align: center; transition: transform .1s ease, box-shadow .15s ease; }
.tile:active { transform: scale(.98); }
.tile .tile-ico { width: 92px; height: 92px; border-radius: 26px; background: var(--soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.tile .tile-label { font-size: 26px; font-weight: 800; }
.tile .tile-sub { font-size: 16px; color: var(--muted); margin-top: 4px; }
.tile .soon { position: absolute; top: 14px; left: 14px; background: var(--soft); color: var(--primary-strong);
  font-size: 14px; font-weight: 700; border-radius: 999px; padding: 3px 12px; }
.tile.t-home { grid-column: 1; grid-row: 1; }
.tile.t-cal { grid-column: 2; grid-row: 1; }
.tile.t-cam { grid-column: 1; grid-row: 2; }
.tile.t-shop { grid-column: 2; grid-row: 2; }
.tile.t-cal .tile-ico { background: #D3EBFF; }
.tile.t-shop .tile-ico { background: #DDF3EA; color: var(--modern); }
@media (min-width: 900px) { .tile { min-height: 260px; } .tile .tile-label { font-size: 30px; } }
@media (min-width: 1280px) and (min-height: 700px) {
  .tile { min-height: calc((100vh - 230px) / 2); }
  .tiles.with-weather .tile { min-height: calc((100vh - 400px) / 2); }
  .tile .tile-ico { width: 120px; height: 120px; border-radius: 32px; }
  .tile .tile-label { font-size: 38px; }
  .tile .tile-sub { font-size: 20px; }
  .welcome { font-size: 42px; }
}
@media (max-width: 640px) {
  .welcome { font-size: 27px; }
  .today-line { font-size: 16px; }
  .tile { min-height: 180px; padding: 18px 10px; }
  .tile .tile-label { font-size: 22px; }
  .tile .tile-ico { width: 76px; height: 76px; }
  .topbar h1 { font-size: 22px; }
}

/* ---------- weather (TV) ---------- */
.weather { display: flex; align-items: center; margin-bottom: 18px; padding: 16px 24px; min-height: 130px; }
.weather .wnow { display: flex; align-items: center; flex: none; }
.weather .wnow svg { margin-left: 16px; flex: none; }
.weather .wtemp { font-size: 64px; font-weight: 800; line-height: 1; direction: ltr; text-align: right; }
.weather .wtext { font-size: 20px; color: var(--muted); margin-top: 4px; }
.weather .wdetails { flex: 1; margin: 0 36px; font-size: 19px; line-height: 1.6; border-right: 2px solid var(--line); padding-right: 28px; }
.weather .wdays { display: flex; flex: none; }
.weather .wday { width: 128px; text-align: center; background: var(--tile); border-radius: 16px; padding: 10px 6px; margin-right: 10px; }
.weather .wd-name { font-weight: 700; font-size: 17px; }
.weather .wd-t { font-size: 18px; direction: ltr; }
.weather .wd-r { font-size: 15px; color: var(--primary-strong); }
@media (max-width: 900px) {
  .weather { flex-wrap: wrap; }
  .weather .wdetails { margin: 10px 0; border: 0; padding: 0; flex-basis: 100%; }
  .weather .wdays { width: 100%; }
  .weather .wday { flex: 1; width: auto; margin: 0 0 0 8px; }
}

/* ---------- calendar ---------- */
.cal-layout { display: block; }
.cal-head { display: flex; align-items: center; margin-bottom: 12px; }
.cal-head .title { flex: 1; text-align: center; }
.cal-head .title .g { font-size: 26px; font-weight: 800; }
.cal-head .title .h { font-size: 16px; color: var(--muted); }
.cal-head .btn { margin: 0 4px; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-gap: 6px; }
.weekdays div { text-align: center; font-weight: 700; color: var(--muted); font-size: 15px; padding: 4px 0; }
.day { position: relative; min-height: 112px; border: 2px solid transparent; border-radius: 14px; background: var(--surface);
  padding: 6px 7px; text-align: right; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 1px 2px rgba(18,50,75,.05); }
.day.out { opacity: .45; }
.day.shabbat { background: #F3F9FE; }
.day.today { border-color: var(--primary); }
.day.sel { border-color: var(--primary-strong); background: var(--soft); }
.day .dtop { display: flex; align-items: baseline; justify-content: space-between; }
.day .num { font-size: 22px; font-weight: 800; line-height: 1.1; }
.day.today .num { color: var(--primary); }
.day .heb { font-size: 13px; color: var(--muted); white-space: nowrap; }
.day .hol { font-size: 12.5px; font-weight: 700; border-radius: 7px; padding: 1px 6px; margin-top: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; background: var(--holiday-bg); color: var(--holiday); }
.hol.major { background: var(--major-bg); color: var(--major); }
.hol.modern { background: var(--modern-bg); color: var(--modern); }
.day .chip { font-size: 13px; background: var(--primary); color: #fff; border-radius: 7px; padding: 1px 6px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .more { font-size: 12.5px; color: var(--primary-strong); font-weight: 700; margin-top: 2px; }
.day .dots { display: none; margin-top: auto; }
.day .dots i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: 3px; }
.daypanel { margin-top: 16px; }
.daypanel h2 { font-size: 22px; margin: 0 0 2px; }
.daypanel .hebfull { color: var(--muted); margin-bottom: 10px; }
.daypanel .hols > span { display: inline-block; margin: 0 0 6px 6px; font-size: 15px; padding: 3px 10px; border-radius: 9px; }
.ev { border-radius: 14px; background: var(--tile); border: 2px solid var(--line); padding: 12px 14px; margin-bottom: 10px; }
.ev .ev-time { font-weight: 700; color: var(--primary-strong); font-size: 16px; }
.ev .ev-title { font-weight: 800; font-size: 20px; margin: 2px 0; }
.ev .ev-meta { font-size: 15px; color: var(--muted); margin-top: 2px; }
.ev .ev-actions { margin-top: 8px; text-align: left; }
.add-ev { width: 100%; margin-top: 6px; font-size: 20px; }
@media (min-width: 1000px) {
  .cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-gap: 18px; align-items: start; }
  .daypanel { margin-top: 0; position: sticky; top: 16px; }
  .day { min-height: 128px; }
}
@media (max-width: 640px) {
  .weekdays, .grid { grid-gap: 4px; }
  .day { min-height: 66px; padding: 4px; border-radius: 10px; }
  .day .num { font-size: 18px; }
  .day .dtop { display: block; }
  .day .heb { font-size: 10.5px; display: block; }
  .day .hol { font-size: 10px; padding: 0 3px; border-radius: 5px; }
  .day .chip, .day .more { display: none; }
  .day .dots { display: block; }
  .cal-head .title .g { font-size: 21px; }
  .cal-head .btn.nav-text span { display: none; }
}

/* ---------- toggles / segmented ---------- */
.seg { display: flex; background: var(--tile); border: 2px solid var(--line); border-radius: 16px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; min-height: 52px; border: 0; border-radius: 12px; background: transparent; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--primary); color: #fff; }
.row2 { display: flex; margin: 0 -6px; }
.row2 > * { flex: 1; margin: 0 6px; }
.pick { display: flex; align-items: center; width: 100%; min-height: 62px; border: 2px solid var(--line); background: var(--tile);
  border-radius: 14px; padding: 8px 14px; margin-bottom: 8px; text-align: right; }
.pick .box { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--soft-2); background: #fff; margin-left: 12px;
  display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.pick.on { border-color: var(--primary); background: var(--soft); }
.pick.on .box { background: var(--primary); border-color: var(--primary); }
.pick .pn { font-weight: 700; display: block; }
.pick .pe { font-size: 14px; color: var(--muted); direction: ltr; display: block; text-align: right; }
.pick.fixed { opacity: .8; pointer-events: none; }

/* ---------- modal ---------- */
.modal-back { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(18, 50, 75, .35); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 24px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  -webkit-overflow-scrolling: touch; padding: 22px; box-shadow: 0 20px 60px rgba(18, 50, 75, .25); }
.modal h2 { margin: 0 0 16px; font-size: 24px; }
.modal .foot { display: flex; margin-top: 18px; }
.modal .foot .btn { flex: 1; }
.modal .foot .btn + .btn { margin-right: 10px; }
.section-title { font-weight: 800; margin: 18px 0 8px; font-size: 17px; }
@media (max-width: 640px) {
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 24px 24px 0 0; max-height: 96vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

/* ---------- shopping ---------- */
.shop-add { display: flex; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.shop-add .f-text { flex: 1 1 260px; margin: 0 0 10px 10px; }
.shop-add .f-qty { margin: 0 0 10px 10px; }
.shop-add .btn { margin-bottom: 10px; min-width: 120px; }
.stepper { display: flex; align-items: center; }
.stepper .btn { width: var(--tap); padding: 0; font-size: 26px; margin: 0; min-width: 0; }
.stepper .input { width: 92px; text-align: center; margin: 0 6px; direction: ltr; }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 10px 14px; margin-bottom: 10px; min-height: 74px; }
.item .qty { flex: none; min-width: 64px; height: 48px; border-radius: 12px; background: var(--soft); color: var(--primary-strong);
  font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center; margin-left: 14px; direction: ltr; padding: 0 8px; }
.item .txt { flex: 1; min-width: 0; }
.item .txt b { display: block; font-size: 21px; word-wrap: break-word; }
.item .txt small { color: var(--muted); font-size: 14px; }
.item .acts { flex: none; }
.item .acts .btn + .btn { margin-right: 8px; }
.item.editing { flex-wrap: wrap; }
.item.editing .input { margin-left: 8px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
@media (max-width: 520px) {
  .item { flex-wrap: wrap; }
  .item .acts { width: 100%; display: flex; margin-top: 8px; }
  .item .acts .btn { flex: 1; }
  .shop-add .f-text { margin-left: 0; flex-basis: 100%; }
}

/* ---------- admin ---------- */
.admin-grid { display: grid; grid-template-columns: 1fr; grid-gap: 16px; }
@media (min-width: 1000px) { .admin-grid { grid-template-columns: 3fr 2fr; align-items: start; } }
.user-card { border: 2px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; background: var(--tile); }
.user-card .uh { display: flex; align-items: center; flex-wrap: wrap; }
.user-card .uh b { font-size: 21px; margin-left: 10px; }
.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--primary-strong); margin-left: 6px; }
.badge.warn { background: var(--holiday-bg); color: var(--holiday); }
.user-card .ub { margin-top: 10px; }
.user-card .ub .btn { margin: 0 0 8px 8px; }
.dev { display: flex; align-items: center; font-size: 15px; padding: 6px 0; border-top: 1px dashed var(--line); }
.dev span { flex: 1; }
.code { direction: ltr; text-align: left; font-family: Consolas, Menlo, monospace; font-size: 14px; background: var(--tile);
  border: 2px dashed var(--line); border-radius: 12px; padding: 10px; word-break: break-all; }
.check { display: flex; align-items: center; min-height: 48px; }
.check input { width: 26px; height: 26px; margin: 0 0 0 10px; }
.status-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-left: 8px; background: var(--danger); }
.status-dot.ok { background: #1E9E63; }

/* ---------- coming soon ---------- */
.soon-page { text-align: center; padding: 70px 20px; }
.soon-page .tile-ico { width: 120px; height: 120px; border-radius: 34px; background: var(--soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(30px);
  background: var(--text); color: #fff; padding: 14px 22px; border-radius: 14px; font-weight: 500; opacity: 0;
  pointer-events: none; transition: all .2s ease; z-index: 99; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }
