:root {
  --bg: #fbf6ec;
  --card: #ffffff;
  --ink: #23303d;
  --muted: #6b7684;
  --line: #ece4d4;
  --sun: #f6b93b;
  --sun-deep: #e58e26;
  --open: #2f9e77;
  --open-soft: #e3f5ec;
  --night: #34406b;
  --night-soft: #e8ebf7;
  --danger: #c0392b;
  --radius: 22px;
  --shadow: 0 6px 24px rgba(60, 45, 10, .07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  font-size: 17px; line-height: 1.5;
}
#app { max-width: 520px; margin: 0 auto; padding: 14px 16px calc(40px + env(safe-area-inset-bottom)); }
h1 { font-size: 30px; margin: 6px 0 4px; line-height: 1.2; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 26px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 19px; }
.sun { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fff8e6 0 34%, var(--sun) 36%); box-shadow: 0 0 0 4px rgba(246, 185, 59, .22); }

.card { background: var(--card); border-radius: var(--radius); padding: 20px 20px 22px; margin-bottom: 14px; box-shadow: var(--shadow); }

.hero { text-align: center; padding-top: 26px; transition: background .4s; }
.hero.open { background: linear-gradient(180deg, #fff7df 0%, #ffffff 62%); }
.hero.locked { background: linear-gradient(180deg, #e3e7f6 0%, #ffffff 62%); }
.orb { width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 12px; position: relative; transition: background .4s, box-shadow .4s; }
.orb.open { background: radial-gradient(circle at 50% 50%, #ffe9a8 0 40%, var(--sun) 100%); box-shadow: 0 0 0 12px rgba(246, 185, 59, .18), 0 0 0 26px rgba(246, 185, 59, .08); }
.orb.locked { background: var(--night); box-shadow: 0 0 0 12px rgba(52, 64, 107, .12); }
.orb.locked::after { content: ""; position: absolute; inset: 14px 8px 14px 26px; border-radius: 50%; background: #e3e7f6; }
.sub { font-size: 18px; min-height: 27px; }
.conn { font-size: 14px; color: var(--muted); margin-top: 14px; }
.conn::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c9c2b4; margin-inline-end: 7px; }
.conn.on::before { background: var(--open); }
.conn.off::before { background: var(--danger); }

.btn { font: inherit; font-weight: 700; border: 0; border-radius: 16px; padding: 13px 20px; background: #f1ecdf; color: var(--ink); cursor: pointer; min-height: 50px; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.wide { display: block; width: 100%; margin-top: 16px; }
.btn.big { font-size: 20px; min-height: 60px; }
.btn.do-lock { background: var(--night); color: #fff; }
.btn.do-open { background: var(--open); color: #fff; }
.link { font: inherit; background: none; border: 0; padding: 6px 2px; color: var(--sun-deep); font-weight: 600; text-decoration: underline; cursor: pointer; }
.link.block { display: inline-block; margin-top: 12px; }
:focus-visible { outline: 3px solid var(--sun-deep); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.chip { font: inherit; font-weight: 600; border: 2px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 9px 17px; min-height: 46px; cursor: pointer; }
.chip:active { background: #fff3d2; }
.chip.solid { background: var(--sun); border-color: var(--sun); }
.custom { display: flex; gap: 7px; flex: 1 1 190px; }
.custom input { flex: 1; min-width: 0; }
input[type=number], input[type=password], input[type=text], input[type=time] { font: inherit; border: 2px solid var(--line); border-radius: 14px; padding: 9px 13px; background: #fffdf8; color: var(--ink); min-height: 46px; }
input.pin { display: block; width: 100%; text-align: center; font-size: 30px; letter-spacing: .4em; margin-top: 12px; direction: ltr; }
.msg { color: var(--danger); min-height: 26px; font-weight: 600; }
.play-line { margin-top: 14px; background: var(--open-soft); border-radius: 14px; padding: 10px 14px; font-weight: 600; }

.row-head { display: flex; align-items: center; justify-content: space-between; }
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { width: 52px; height: 31px; border-radius: 999px; background: #d9d2c3; transition: background .2s; position: relative; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 25px; height: 25px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch input:checked + span { background: var(--open); }
.switch input:checked + span::after { transform: translateX(-21px); }
.switch input:focus-visible + span { outline: 3px solid var(--sun-deep); outline-offset: 2px; }

.days { margin-top: 12px; }
.days.off { opacity: .45; }
.day { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.day .name { font-weight: 700; }
.day .times { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; }
.day .times input { flex: 1; min-width: 0; direction: ltr; text-align: center; }
.day.free .times { display: none; }
.day .free-note { display: none; color: var(--muted); font-size: 15px; }
.day.free .free-note { display: inline; }
.day .name-wrap { display: flex; align-items: baseline; gap: 10px; }

details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card > summary::after { content: "＋"; font-size: 22px; color: var(--muted); }
details.card[open] > summary::after { content: "－"; }
.steps { padding-inline-start: 22px; margin: 6px 0; }
.steps li { margin: 5px 0; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }

.toast { position: fixed; inset-inline: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 480px; background: var(--ink); color: #fff; border-radius: 16px; padding: 13px 18px; text-align: center; font-weight: 600; opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: var(--danger); }

/* עמוד הניהול */
.fam { border-top: 1px solid var(--line); padding: 13px 0; }
.fam .name { font-weight: 700; font-size: 18px; }
.fam .meta { color: var(--muted); font-size: 14px; }
.fam .actions { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; }
.box { background: #fff8e6; border: 2px dashed var(--sun); border-radius: 16px; padding: 14px; margin-top: 14px; white-space: pre-wrap; word-break: break-word; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
