:root {
  --bg: #FEFAF0;
  --surface: #FFFFFF;
  --surface2: #F6EFE3;
  --line: #EADFCC;
  --ink: #1F366A;
  --ink2: #142E3F;
  --muted: #5E6B7A;
  --accent: #F69922;
  --google: #1A9E9E; --google-bg: #DDF3F2;
  --work: #D97A06; --work-bg: #FEEBD3;
  --mine: #8A5BBF; --mine-bg: #EFE4F7;
  --holy: #C9463F; --holy-bg: #FDE5E6;
  --gold: #A9781C; --gold-bg: #F8E9D2;
  --shadow: 0 18px 45px -22px rgb(0 50 90 / .40);
  --shadow-lg: 0 30px 60px -24px rgb(0 40 80 / .50);
  --r: 22px;
  --hour: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink2);
  font: 16px/1.5 Heebo, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
h1, h2, h3, b.h { font-family: Rubik, Heebo, sans-serif; color: var(--ink); margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: var(--ink2); }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

.app { display: grid; grid-template-columns: 1fr; height: 100dvh; }
.side { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* כפתורים */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 600; transition: transform .12s, background .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: #fff; box-shadow: 0 12px 24px -14px rgb(31 54 106 / .9); }
.btn.accent { background: var(--accent); color: var(--ink2); }
.btn.soft { background: var(--surface2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: var(--holy-bg); color: var(--holy); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn.wide { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.icon-btn:hover { background: var(--surface2); }

/* כותרת עליונה */
.top { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; flex-wrap: wrap; }
.title { flex: 1; min-width: 0; }
.title h1 { font-size: 24px; font-weight: 800; letter-spacing: -.3px; line-height: 1.15; }
.title p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.nav { display: flex; align-items: center; gap: 2px; }
.seg { display: flex; background: var(--surface2); border-radius: 999px; padding: 4px; width: 100%; }
.seg button { flex: 1; min-height: 38px; border-radius: 999px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 4px 12px -6px rgb(0 40 80 / .35); }

.demo-bar { margin: 0 16px 8px; padding: 10px 14px; border-radius: 16px; background: var(--gold-bg); color: #6B4C10; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.demo-bar span { flex: 1; }

.view { flex: 1; min-height: 0; overflow: auto; padding: 0 16px calc(110px + var(--safe-b)); }

/* פס ימים (טלפון) */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; position: sticky; top: 0; background: var(--bg); padding: 4px 0 8px; z-index: 3; }
.strip button { display: flex; flex-direction: column; align-items: center; padding: 8px 0 7px; border-radius: 18px; gap: 1px; position: relative; }
.strip .dn { font-size: 13px; color: var(--muted); font-weight: 500; }
.strip .dd { font-family: Rubik; font-weight: 700; font-size: 19px; color: var(--ink); line-height: 1.2; }
.strip .hd { font-size: 12px; color: var(--muted); }
.strip button.today .dd { color: var(--accent); }
.strip button.sel { background: var(--ink); }
.strip button.sel .dn, .strip button.sel .dd, .strip button.sel .hd { color: #fff; }
.strip .dots { display: flex; gap: 3px; height: 6px; margin-top: 3px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.google { background: var(--google); } .dot.work { background: var(--work); } .dot.mine { background: var(--mine); } .dot.holy { background: var(--holy); }

/* כרטיסי יום */
.day-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 2px 10px; flex-wrap: wrap; }
.day-head h2 { font-size: 20px; font-weight: 700; }
.day-head span { color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.tag svg { width: 16px; height: 16px; }
.tag.major, .tag.holiday { background: var(--holy-bg); color: var(--holy); }
.tag.candles, .tag.havdalah, .tag.parasha { background: var(--gold-bg); color: var(--gold); }
.tag.fast { background: #E8ECF3; color: #3E4C66; }
.tag.modern { background: #E3EEF9; color: #2D5C8A; }

.ev { display: flex; gap: 12px; width: 100%; text-align: right; background: var(--surface); border-radius: 20px; padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow); align-items: stretch; position: relative; }
.ev .bar { width: 5px; border-radius: 4px; flex: none; }
.ev .tm { width: 54px; flex: none; font-family: Rubik; font-weight: 700; color: var(--ink); font-size: 16px; line-height: 1.3; }
.ev .tm small { display: block; font-family: Heebo; font-weight: 400; color: var(--muted); font-size: 13px; }
.ev .bd { flex: 1; min-width: 0; }
.ev .bd b { display: block; font-weight: 600; font-size: 16px; color: var(--ink2); }
.ev .meta { color: var(--muted); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.ev .meta svg { width: 15px; height: 15px; vertical-align: -2px; }
.src { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.src.google { background: var(--google-bg); color: var(--google); }
.src.work { background: var(--work-bg); color: var(--work); }
.src.mine { background: var(--mine-bg); color: var(--mine); }
.bar.google { background: var(--google); } .bar.work { background: var(--work); } .bar.mine { background: var(--mine); }
.ev.done { opacity: .5; }
.ev.done b { text-decoration: line-through; }

.empty { text-align: center; padding: 34px 20px; color: var(--muted); background: var(--surface); border-radius: var(--r); border: 1.5px dashed var(--line); }
.empty b { display: block; color: var(--ink); font-family: Rubik; font-size: 18px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.free { display: flex; align-items: center; gap: 10px; color: var(--google); font-size: 14px; font-weight: 500; margin: -2px 6px 10px; }
.free::before, .free::after { content: ''; flex: 1; border-top: 1.5px dashed #BFE3E1; }

/* רשת שבוע ויום */
.grid { display: grid; position: relative; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: clip; }
.grid .ghw { position: sticky; top: 0; z-index: 4; background: var(--surface); box-shadow: 0 6px 12px -10px rgb(0 40 80 / .3); }
.grid .gh { display: grid; border-bottom: 1px solid var(--line); }
.gh .c { padding: 10px 4px 8px; text-align: center; border-inline-start: 1px solid var(--line); cursor: pointer; }
.gh .c:first-child { border: 0; }
.gh .dn { font-size: 13px; color: var(--muted); }
.gh .dd { font-family: Rubik; font-weight: 700; font-size: 22px; color: var(--ink); line-height: 1.15; display: inline-grid; place-items: center; min-width: 38px; height: 38px; border-radius: 50%; }
.gh .today .dd { background: var(--accent); color: var(--ink2); }
.gh .hd { font-size: 13px; color: var(--muted); }
.allday { display: grid; border-bottom: 1px solid var(--line); background: #FFFCF6; }
.allday .c { padding: 4px; border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-height: 30px; }
.allday .c:first-child { border: 0; font-size: 12px; color: var(--muted); align-items: center; justify-content: center; }
.chip { font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.chip.major, .chip.holiday { background: var(--holy-bg); color: var(--holy); }
.chip.candles, .chip.havdalah, .chip.parasha { background: var(--gold-bg); color: var(--gold); }
.chip.fast { background: #E8ECF3; color: #3E4C66; } .chip.modern { background: #E3EEF9; color: #2D5C8A; }
.chip.google { background: var(--google-bg); color: var(--google); } .chip.work { background: var(--work-bg); color: var(--work); } .chip.mine { background: var(--mine-bg); color: var(--mine); }
.gb { display: grid; position: relative; }
.gb .hours { position: relative; }
.gb .hr { height: var(--hour); font-size: 12px; color: var(--muted); text-align: center; transform: translateY(-8px); }
.gb .col { position: relative; border-inline-start: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), #F1E9DA calc(var(--hour) - 1px), #F1E9DA var(--hour)); cursor: copy; }
.gb .col.today { background-color: #FFFBF2; }
.blk { position: absolute; border-radius: 10px; padding: 4px 7px; font-size: 13px; line-height: 1.3; overflow: hidden; text-align: right; border-inline-start: 4px solid; cursor: pointer; }
.blk b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk span { opacity: .85; }
.blk.google { background: var(--google-bg); border-color: var(--google); color: #0E5E5E; }
.blk.work { background: var(--work-bg); border-color: var(--work); color: #7A4300; }
.blk.mine { background: var(--mine-bg); border-color: var(--mine); color: #4E2E78; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--holy); z-index: 2; pointer-events: none; }
.now::after { content: ''; position: absolute; right: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--holy); }

/* חודש */
.month { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.month .wd, .month .wk { display: grid; grid-template-columns: repeat(7, 1fr); }
.month .wd div { text-align: center; font-size: 13px; color: var(--muted); padding: 10px 0 6px; font-weight: 500; }
.month .cell { min-height: 74px; border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); padding: 5px 4px; text-align: right; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.month .cell:nth-child(7n+1) { border-inline-start: 0; }
.month .cell.out { background: #FBF7EE; }
.month .cell.out .n { opacity: .4; }
.month .cell .top-n { display: flex; justify-content: space-between; align-items: baseline; gap: 2px; }
.month .n { font-family: Rubik; font-weight: 700; font-size: 16px; color: var(--ink); display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; }
.month .cell.today .n { background: var(--accent); color: var(--ink2); }
.month .cell.sel { background: #FFF6E6; }
.month .h { font-size: 11.5px; color: var(--muted); }
.month .hol { font-size: 11px; color: var(--holy); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month .cell .dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: auto; }
.month .cell .chip { display: none; }
.month-list { margin-top: 18px; }

/* תפריט תחתון */
.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: end; padding: 8px 8px calc(8px + var(--safe-b)); background: rgb(254 250 240 / .92); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.bottom button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 500; color: var(--muted); min-height: 52px; justify-content: center; }
.bottom button.on { color: var(--ink); font-weight: 700; }
.bottom .fab { width: 62px; height: 62px; border-radius: 50%; background: var(--ink); color: #fff; justify-self: center; margin-top: -26px; box-shadow: var(--shadow-lg); }
.bottom .fab svg { width: 28px; height: 28px; }

/* חלון תחתון */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgb(20 30 50 / .35); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 28px 28px 0 0; padding: 10px 20px calc(20px + var(--safe-b)); animation: up .25s cubic-bezier(.2,.8,.3,1); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { font-size: 22px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.sheet h2 .icon-btn { margin-inline-start: auto; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.fld { margin-bottom: 14px; }
.fld > label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.inp { width: 100%; min-height: 50px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); padding: 10px 14px; font-size: 16px; }
.inp:focus { outline: none; border-color: var(--ink); }
textarea.inp { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.with-mic { position: relative; }
.with-mic .inp { padding-left: 54px; }
.with-mic .icon-btn { position: absolute; left: 4px; top: 3px; color: var(--ink); }
.with-mic .icon-btn.rec { background: var(--holy); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgb(201 70 63 / .2); } }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 7px; }
.pill.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.pill.on.google { background: var(--google); border-color: var(--google); }
.pill.on.work { background: var(--work); border-color: var(--work); }
.pill.on.mine { background: var(--mine); border-color: var(--mine); }
.pill .dot { width: 10px; height: 10px; }
.pill.on .dot { background: #fff; }
.sheet .actions { display: flex; gap: 10px; position: sticky; bottom: calc(-20px - var(--safe-b)); background: var(--bg); padding: 12px 0 calc(4px + var(--safe-b)); margin-top: 6px; }
.sheet .actions .btn { flex: 1; }
.toggle { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.switch { width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: right .2s; box-shadow: 0 2px 4px rgb(0 0 0 / .15); }
.switch.on { background: var(--ink); }
.switch.on::after { right: 23px; }

/* מקליט */
.recorder { background: var(--surface); border-radius: var(--r); padding: 18px; text-align: center; box-shadow: var(--shadow); margin-bottom: 14px; }
.rec-btn { width: 84px; height: 84px; border-radius: 50%; background: var(--holy); color: #fff; display: inline-grid; place-items: center; box-shadow: 0 16px 30px -14px rgb(201 70 63 / .9); }
.rec-btn svg { width: 36px; height: 36px; }
.rec-btn.on { animation: pulse 1.2s infinite; }
.recorder p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.wave { display: flex; gap: 3px; justify-content: center; align-items: center; height: 34px; margin-top: 8px; }
.wave i { width: 4px; border-radius: 2px; background: var(--holy); height: 6px; transition: height .08s; }
.voice-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--mine-bg); color: var(--mine); border-radius: 999px; padding: 4px 6px 4px 14px; font-weight: 600; font-size: 14px; }
.voice-chip button { width: 34px; height: 34px; border-radius: 50%; background: var(--mine); color: #fff; display: grid; place-items: center; }
.voice-chip svg { width: 16px; height: 16px; }

/* פרטי פגישה */
.det-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink2); }
.det-row svg { color: var(--muted); margin-top: 2px; }
.det-row:last-of-type { border: 0; }

/* הגדרות */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h3 { font-size: 18px; margin-bottom: 4px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.conn { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.conn .logo { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-family: Rubik; font-weight: 800; font-size: 20px; flex: none; }
.conn .logo.google { background: var(--google-bg); color: var(--google); }
.conn .logo.work { background: var(--work-bg); color: var(--work); }
.conn .info { flex: 1; min-width: 0; }
.conn .info b { display: block; }
.conn .info small { color: var(--muted); font-size: 14px; }
.ok { color: #2E8B57; font-weight: 600; }
.legal { font-size: 13px; color: var(--muted); text-align: center; margin: 24px 8px 0; line-height: 1.6; }

/* תזכורות */
.rem-group { font-family: Rubik; font-weight: 700; color: var(--muted); font-size: 15px; margin: 18px 4px 8px; }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--mine); display: grid; place-items: center; color: #fff; flex: none; align-self: center; }
.check.on { background: var(--mine); }
.check svg { width: 16px; height: 16px; }

.toast { position: fixed; bottom: calc(96px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 60; background: var(--ink2); color: #fff; padding: 12px 18px; border-radius: 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); font-size: 15px; animation: up .25s; }
.toast button { color: var(--accent); font-weight: 700; }

/* תפריט צד במחשב */
.mini { background: var(--surface); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.mini .mh { display: flex; justify-content: space-between; align-items: center; font-family: Rubik; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.mini .mh .icon-btn { width: 32px; height: 32px; }
.mini .mh .icon-btn svg { width: 18px; height: 18px; }
.mini .g { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 13px; }
.mini .g span { color: var(--muted); font-size: 12px; padding: 2px 0; }
.mini .g button { height: 32px; border-radius: 50%; font-size: 13.5px; position: relative; }
.mini .g button.out { opacity: .35; }
.mini .g button.today { color: var(--accent); font-weight: 800; }
.mini .g button.sel { background: var(--ink); color: #fff; }
.mini .g button.hol::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--holy); }
.cals { background: var(--surface); border-radius: var(--r); padding: 6px 14px; box-shadow: var(--shadow); }
.cals .toggle { min-height: 44px; font-weight: 500; }
.cals .toggle span { display: flex; align-items: center; gap: 10px; }
.cals .dot { width: 12px; height: 12px; }
.shabbat { background: var(--gold-bg); border-radius: var(--r); padding: 14px 16px; color: #6B4C10; font-size: 15px; }
.shabbat b { font-family: Rubik; display: block; color: #5A3F0C; margin-bottom: 4px; }

@media (min-width: 900px) {
  .app { grid-template-columns: 300px 1fr; }
  .side { display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 18px 0; padding-inline-start: 18px; overflow: auto; border-inline-end: 1px solid var(--line); background: #FBF5E8; }
  .brand { display: flex; align-items: center; gap: 12px; padding: 4px 4px 6px; }
  .brand img { width: 44px; height: 44px; }
  .brand b { font-family: Rubik; font-size: 20px; color: var(--ink); display: block; line-height: 1.1; }
  .brand small { color: var(--muted); font-size: 13.5px; }
  .bottom { display: none; }
  .top { padding: 18px 24px 12px; flex-wrap: nowrap; }
  .title h1 { font-size: 28px; }
  .seg { width: auto; }
  .seg button { padding: 0 18px; }
  .view { padding: 0 24px 24px; }
  .demo-bar { margin: 0 24px 10px; }
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 28px; max-height: 88dvh; }
  .sheet .grab { display: none; }
  .toast { bottom: 28px; }
  .month .cell { min-height: 112px; }
  .month .cell .chip { display: block; }
  .month .cell .dots { display: none; }
  .month .h { font-size: 12.5px; }
  .month .hol { font-size: 12px; }
}
