:root{--bg:#fbfbfa;--fg:#1f1f1f;--muted:#5a5a5a;--line:#e6e6e3;--accent:#2f5d50;--soft:#f1f4f2;--me:#eef2f0}
body[data-agent]{--bg:#faf6ee;--fg:#1c1c1a;--muted:#4f4f4b;--line:#e3ddd0;--soft:#e6ede4;--me:#edf1ea}
@media (prefers-color-scheme:dark){body[data-agent]{--bg:#151515;--fg:#ececec;--muted:#a3a3a3;--line:#2b2b2b;--soft:#1d2120;--me:#1f2725}}
@media (prefers-color-scheme:dark){:root{--bg:#151515;--fg:#ececec;--muted:#a3a3a3;--line:#2b2b2b;--accent:#8fc4b2;--soft:#1d2120;--me:#1f2725}}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--fg);font-family:Heebo,system-ui,sans-serif;font-weight:300;line-height:1.75;font-size:17px}
.wrap{max-width:720px;margin:0 auto;padding:40px 16px 24px;min-height:100%;display:flex;flex-direction:column}
h1{font-weight:500;font-size:1.7rem;margin:0;line-height:1.3}
.sub{margin:2px 0 10px;font-size:1.15rem;color:var(--muted);font-weight:400}
.band{height:140px;margin:-40px -16px 24px;background:center/cover no-repeat;opacity:.9;-webkit-mask-image:linear-gradient(to bottom,#000 55%,transparent);mask-image:linear-gradient(to bottom,#000 55%,transparent)}
.band[hidden]{display:none}
footer .me{width:56px;height:56px;border-radius:50%;object-fit:cover;display:block;margin:0 0 8px}
.desc{color:var(--muted);margin:0 0 28px}
.card{background:var(--soft);border-radius:10px;padding:20px 22px;margin-bottom:20px}
.note{font-size:.88rem;color:var(--muted)}
label{display:block;font-weight:400;margin-bottom:8px}
input,textarea{font:inherit;color:inherit;background:var(--bg);border:1px solid var(--line);border-radius:8px;padding:10px 12px;width:100%}
textarea{resize:none;min-height:52px;max-height:200px}
button{font:inherit;font-weight:400;border:0;border-radius:8px;padding:10px 18px;background:var(--accent);color:#fff;cursor:pointer}
@media (prefers-color-scheme:dark){button{color:#111}}
button:disabled{opacity:.5;cursor:default}
button.ghost{background:transparent;color:var(--muted);border:1px solid var(--line);padding:6px 12px;font-size:.88rem}
.row{display:flex;gap:10px;margin-top:12px}
.err{color:#b23b3b;font-size:.9rem;margin-top:8px;min-height:1.2em}
.starters{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0 20px}
.starters button{background:transparent;color:var(--fg);border:1px solid var(--line);font-weight:300;text-align:right}
#log{flex:1;display:flex;flex-direction:column;gap:14px;margin-bottom:16px}
.msg{white-space:pre-wrap;padding:12px 16px;border-radius:12px;max-width:92%}
.msg.user{background:var(--me);align-self:flex-start}
.msg.assistant{align-self:flex-end;border:1px solid var(--line)}
.composer{position:sticky;bottom:0;background:var(--bg);padding:12px 0 8px;display:flex;gap:10px;align-items:flex-end}
.top{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
footer{margin-top:20px;font-size:.8rem;color:var(--muted)}
[hidden]{display:none!important}
.logo{width:88px;height:88px;object-fit:contain;margin-bottom:16px;display:block}
.howto{margin:0 0 24px;padding-right:20px;color:var(--muted);font-size:.95rem}
.howto li{margin-bottom:4px}
.kit{border:1px solid var(--line);border-radius:10px;padding:12px 16px;margin-bottom:16px;font-size:.92rem}
.kit-title{font-weight:400;display:block;margin-bottom:6px}
.kit button{background:transparent;color:var(--accent);padding:2px 0;display:block;text-align:right;text-decoration:underline}
footer a{color:inherit}
.logo{mix-blend-mode:multiply}
@media (prefers-color-scheme: dark){.logo{mix-blend-mode:normal;border-radius:12px}}

.eyebrow{margin:0 0 4px;font-size:1rem;font-weight:400;color:var(--accent);letter-spacing:.02em}
.eyebrow+h1{font-size:2.1rem}
.intro{margin:10px 0 24px;font-size:1.08rem}
.intro p{margin:0}
#gate .card{max-width:420px}
#gate .note a,.sig a{color:inherit}
.how{max-width:420px;margin:4px 0 8px;font-size:.92rem;color:var(--muted)}
.how summary{cursor:pointer;color:var(--accent);font-weight:400}
.how .howto{margin:8px 0 0}
.hint{margin:0 0 -4px}
.sig{display:flex;gap:12px;align-items:center;margin-bottom:14px;font-size:.88rem;color:var(--fg)}
.sig .me{margin:0;flex:none}
.quote{margin:0 0 2px;font-style:italic;color:var(--muted)}
.tools{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.top .note{white-space:nowrap}
.head{display:flex;align-items:center;gap:14px;margin-bottom:4px}
.head .logo{width:64px;height:64px;margin:0;flex:none}
.head h1{margin:0}
.wrap{max-width:640px}
body[data-agent=coai] .head .logo{border-radius:50%;object-fit:cover}
.intro p+p{margin-top:10px;color:var(--muted)}
@media (max-width:480px){.eyebrow+h1{font-size:1.75rem}}
/* update 8: visible new-chat button and continue/new-topic choice */
button.ghost.newchat{color:var(--accent);border-color:var(--accent);font-weight:500}
.msg.choice p{margin:0 0 10px}
.choiceBtns{display:flex;gap:8px;flex-wrap:wrap}
.choiceBtns button{padding:8px 16px}
button.mic{background:transparent;color:var(--muted);border:1px solid var(--line);padding:9px 11px;line-height:0}
button.mic.on{background:#b23b3b;border-color:#b23b3b;color:#fff;animation:micpulse 1.2s ease-in-out infinite}
button.mic[hidden]{display:none}
@keyframes micpulse{50%{opacity:.65}}
#micNote:empty{display:none}
.guide{margin:6px 0 10px;font-size:.95rem}
.guide a{color:var(--accent);font-weight:500}
#input{min-height:calc(4.5em + 24px);max-height:50vh;padding:12px 14px;line-height:1.5;overflow-y:hidden}
@media (max-width:768px),(pointer:coarse){input,textarea,#input{font-size:16px}}
.pre{margin:0 0 16px}
.pre h2{font-size:1.15rem;font-weight:500;margin:0 0 6px}
.pre p{margin:0;color:var(--muted);line-height:1.6}
.about{margin:8px 0 12px}
.about textarea{max-height:40vh;min-height:96px}
.about-row{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:6px}
.freeTry{margin:14px 0 0;text-align:center}
button.linkish{background:none;border:0;padding:4px 0;color:var(--accent);text-decoration:underline;text-underline-offset:3px;font-size:.95rem}
#freeNote:empty{display:none}
/* "השיחות שלי" */
.convs{display:none;flex-direction:column;gap:8px;position:fixed;top:0;right:0;bottom:0;width:min(88vw,320px);background:var(--bg);border-left:1px solid var(--line);padding:18px 14px;overflow-y:auto;z-index:30;box-shadow:-8px 0 24px rgba(0,0,0,.12)}
.convs[hidden]{display:none!important}
body.convs-open .convs{display:flex}
.convs-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.convs-head strong{font-weight:500}
.convs-close{padding:4px 10px}
.convs-note{font-size:.78rem;line-height:1.5;color:var(--muted);margin:0}
#convsErr:empty{display:none}
.convs-list{list-style:none;margin:4px 0 0;padding:0;display:flex;flex-direction:column;gap:2px}
.conv{display:flex;align-items:center;gap:2px;border-radius:8px;padding:2px 4px}
.conv.current{background:var(--soft)}
.conv-name{flex:1;min-width:0;text-align:right;background:none;color:var(--fg);padding:7px 6px;font-size:.92rem;font-weight:300;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conv.current .conv-name{font-weight:500}
.conv-act{background:none;color:var(--muted);padding:4px 6px;font-size:.85rem;opacity:.75}
.conv-act:hover,.conv-act:focus-visible{opacity:1}
.conv-input{padding:6px 8px;font-size:.92rem}
.conv-q{flex:1;font-size:.88rem}
.conv-yes{padding:4px 10px;font-size:.85rem;background:#b23b3b}
.conv-no{padding:4px 10px;font-size:.85rem}
.conv-empty{font-size:.88rem;color:var(--muted);padding:6px}
.convs-foot{margin-top:auto;padding-top:12px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.convs-foot[hidden]{display:none}
@media (min-width:1240px){
  body.has-convs .convs{display:flex;width:260px;box-shadow:none}
  #convsBtn,.convs-close{display:none}
}
/* CO-AI: entries, lenses, case files */
.entries{margin:4px 0 14px}
.entries[hidden]{display:none}
.entries-title{font-size:.88rem;color:var(--muted);margin:10px 0 6px}
.entry-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:8px}
button.entry{display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:right;background:var(--soft);color:var(--fg);border:1px solid transparent;padding:10px 12px;font-weight:300}
button.entry b{font-weight:500;font-size:.95rem}
button.entry span{font-size:.84rem;color:var(--muted);line-height:1.45}
button.entry.on{border-color:var(--accent);background:var(--bg)}
.lens-row{display:flex;flex-wrap:wrap;gap:6px}
button.lens{background:transparent;color:var(--fg);border:1px solid var(--line);border-radius:999px;padding:4px 12px;font-size:.85rem}
button.lens.on{background:var(--accent);border-color:var(--accent);color:#fff}
.ctx-line{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:.88rem;color:var(--muted);margin:2px 0 10px}
.ctx-line[hidden]{display:none}
.ctx-btn{padding:4px 12px;font-size:.85rem}
.case-save{margin:-4px 0 12px}
.case-draft{min-height:120px;max-height:50vh;margin-bottom:6px}
.case-save-row{display:flex;gap:8px;flex-wrap:wrap}
.case-save-row button{padding:6px 14px;font-size:.9rem}
.cases{margin-top:18px;padding-top:14px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:8px}
.case-new{display:flex;gap:6px}
.case-new input{padding:6px 8px;font-size:.9rem}
.case-new button{padding:6px 12px;font-size:.88rem;white-space:nowrap}
#casesErr:empty{display:none}
.case-io{display:flex;gap:14px;flex-wrap:wrap}
@media (max-width:480px){.entry-grid{grid-template-columns:1fr}}
/* Update 25: easier reading in the chat (all chat pages) */
:root{--me-bg:#e8f1fb;--me-fg:#1b2a3a;--me-line:#cfe0f3;--ai-bg:#ffffff}
@media (prefers-color-scheme:dark){:root{--me-bg:#1e3247;--me-fg:#e4edf7;--me-line:#2b4560;--ai-bg:#1b1f1e}}
#log{gap:20px}
.msg{font-size:18px;line-height:1.7;padding:14px 18px}
.msg.user{background:var(--me-bg);color:var(--me-fg);border:1px solid var(--me-line)}
.msg.assistant{background:var(--ai-bg)}
@media (max-width:600px){.msg{font-size:17px;padding:12px 14px;max-width:96%}#log{gap:16px}}
/* Update 26: the user's bubble in a stronger light green (variant 2), deep muted green in dark mode */
:root{--me-bg:#c6e2cf;--me-fg:#14271c;--me-line:#9fcbb0}
@media (prefers-color-scheme:dark){:root{--me-bg:#2d4b3e;--me-fg:#e6f1ea;--me-line:#3f6655}}
/* /hagashshit conversation style */
.style-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:2px 0 12px;font-size:.88rem;color:var(--muted)}
.style-row button{background:transparent;color:var(--fg);border:1px solid var(--line);border-radius:999px;padding:4px 12px;font-size:.88rem}
.style-row button.on{border-color:var(--accent);background:var(--soft);font-weight:500}
/* Update 29b: Hagashshit starter buttons - larger on a computer, compact two-per-row on phones */
body[data-agent^="hagashshit"] .starters button{font-size:18.5px;line-height:1.45}
@media (max-width:600px){
  body[data-agent^="hagashshit"] .starters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:6px 0 14px}
  body[data-agent^="hagashshit"] .starters button{font-size:14.5px;line-height:1.35;padding:8px 10px;min-height:40px}
}
/* Update 29b: larger desktop layout on the Hagashshit pages (/hagashshit and /new) */
@media (min-width:768px){
  body[data-agent^="hagashshit"] .wrap{max-width:860px}
  body[data-agent^="hagashshit"]{font-size:18px}
  body[data-agent^="hagashshit"] .starters button{font-size:19px}
  body[data-agent^="hagashshit"] #input{font-size:18px;min-height:calc(6em + 24px)}
  body[data-agent^="hagashshit"] .guide{margin-top:10px}
}
/* keep the wider column clear of the side list of conversations */
@media (min-width:1240px){
  body.has-convs[data-agent^="hagashshit"] .wrap{margin-right:max(280px, calc((100vw - 860px) / 2));margin-left:auto}
}
/* Same structure on computer and phone: starters two per row everywhere on the Hagashshit pages */
body[data-agent^="hagashshit"] .starters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body[data-agent^="hagashshit"] .starters button{min-height:44px}
/* Update 29d: change lenses during a CO-AI conversation */
.lens-row-inline{flex-basis:100%;margin-top:6px}
.ctx-note{flex-basis:100%;font-size:.82rem;color:var(--muted)}
/* Update 29f: "+ שיחה חדשה" and "החלפת עדשה" stand out, in the same soft green as the user's bubble */
button.ghost.newchat,button.ghost.lens-switch{background:var(--me-bg);color:var(--me-fg);border-color:var(--me-line);font-weight:500}
button.ghost.newchat:hover,button.ghost.lens-switch:hover{border-color:var(--accent)}
/* Update 30: bottom tab bar and the "עוד" sheet */
.tabbar{display:flex;gap:2px;padding:6px;background:var(--bg);border:1px solid var(--line);border-radius:22px}
@media (max-width:899px){.tabbar{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(10px + env(safe-area-inset-bottom,0px));z-index:40;width:min(calc(100% - 24px),560px);box-shadow:0 6px 24px rgba(0,0,0,.12);transition:transform .25s ease}
  .tabbar.away{transform:translate(-50%,140%)}}
@media (min-width:900px){.tabbar{position:static;margin:0 0 14px;max-width:560px;padding:4px;border-radius:16px}.tabbar .tab{flex-direction:row;justify-content:center;gap:6px;padding:6px 8px;font-size:.88rem}.tabbar .tab-icon{font-size:1rem}}
.tab{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;background:transparent;color:var(--muted);border:0;border-radius:16px;padding:6px 4px;font-size:.78rem;line-height:1.2}
.tab[hidden]{display:none}
.tab-icon{font-size:1.25rem;line-height:1}
.tab-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.tab.on{background:var(--me-bg);color:var(--me-fg);font-weight:500}
.tab:hover,.tab:focus-visible{color:var(--fg)}
/* Update 33: the bottom space follows the bar's real height (--tabbar-h, measured by app.js), so nothing hides behind it.
   The bar can be folded into a small round bubble at the bottom-left corner; the writing box then sits above the bubble. */
.tab-min,.tabbar-bubble{display:none}
@media (max-width:899px){:root{--tabbar-h:64px}
  body.tabbar-min{--tabbar-h:48px}
  body.has-tabbar .wrap{padding-bottom:calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom,0px))} /* on .wrap: body has height:100%, so padding there did not extend the scroll */
  body.has-tabbar .composer{bottom:calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom,0px))}
  body.has-tabbar .convs{padding-bottom:calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom,0px))}
  .tab-min{display:flex;align-items:center;justify-content:center;flex:none;width:30px;padding:0;margin-inline-start:2px;background:transparent;color:var(--muted);border:0;border-inline-start:1px solid var(--line);border-radius:0;font-size:1.2rem;line-height:1}
  body.tabbar-min .tabbar{display:none}
  .tabbar-bubble{position:fixed;left:12px;bottom:calc(10px + env(safe-area-inset-bottom,0px));z-index:40;width:48px;height:48px;padding:0;border-radius:50%;background:var(--bg);color:var(--fg);border:1px solid var(--line);box-shadow:0 6px 24px rgba(0,0,0,.12);font-size:1.25rem;line-height:1;align-items:center;justify-content:center}
  body.has-tabbar.tabbar-min .tabbar-bubble{display:flex}}
/* Update 31: one-time "add to home screen" banner */
.install-banner{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--me-bg);color:var(--me-fg);border:1px solid var(--me-line);border-radius:14px;padding:8px 12px;margin:0 0 12px}
.install-banner img{border-radius:50%;flex:none}
.install-banner .ib-text{flex:1;min-width:140px;font-weight:500}
.install-banner button{padding:6px 14px;font-size:.9rem}
.sheet{position:fixed;inset:0;z-index:50;background:rgba(0,0,0,.25);display:flex;align-items:flex-end;justify-content:center}
.sheet-box{width:min(100%,560px);background:var(--bg);border-radius:20px 20px 0 0;padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:6px;box-shadow:0 -6px 24px rgba(0,0,0,.15)}
.sheet-item{display:block;text-align:right;background:var(--soft);color:var(--fg);border:0;border-radius:12px;padding:12px 14px;font-size:1rem;font-weight:400;text-decoration:none}
.sheet-note{margin:0;padding:6px 4px;line-height:1.6}
.sheet-close{align-self:center;margin-top:6px;background:transparent;color:var(--muted);border:1px solid var(--line)}

/* update batim: the same header as CO-AI (round illustration) and the same larger layout as the Hagashshit pages (update 29b) */
body[data-agent=batim] .head .logo{border-radius:50%;object-fit:cover}
body[data-agent=batim] .starters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body[data-agent=batim] .starters button{font-size:18.5px;line-height:1.45;min-height:44px}
@media (max-width:600px){
  body[data-agent=batim] .starters{gap:6px;margin:6px 0 14px}
  body[data-agent=batim] .starters button{font-size:14.5px;line-height:1.35;padding:8px 10px;min-height:40px}
}
@media (min-width:768px){
  body[data-agent=batim] .wrap{max-width:860px}
  body[data-agent=batim]{font-size:18px}
  body[data-agent=batim] .starters button{font-size:19px}
  body[data-agent=batim] #input{font-size:18px;min-height:calc(6em + 24px)}
}
@media (min-width:1240px){
  body.has-convs[data-agent=batim] .wrap{margin-right:max(280px, calc((100vw - 860px) / 2));margin-left:auto}
}
/* Update 38: backup file for הגששית, in the conversations panel */
.backup-io{margin-top:18px;padding-top:14px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:8px}
.backup-io[hidden]{display:none}
.backup-confirm:empty{display:none}
.backup-confirm p{margin:0 0 6px}
#memBackupLink{margin-inline-start:16px}
.backup-confirm button{scroll-margin-bottom:calc(var(--tabbar-h,64px) + 40px)} /* the question's buttons stay above the bottom tab bar when focused */
.backup-confirm .sync-field{margin:6px 0}.backup-confirm .bk-plain{align-self:flex-start;margin-top:10px;font-size:.85rem}.backup-confirm{display:flex;flex-direction:column;gap:6px}.backup-warn{margin:0}
.backup-io{margin-bottom:16px}
.bk-save-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(9.5em,1fr));gap:8px}.bk-btn{padding:9px 12px;font-size:.92rem;line-height:1.3;min-height:44px}.bk-restore{margin-top:4px}
.bk-enc-cell{display:flex;flex-wrap:wrap;gap:6px}.bk-enc-cell .bk-btn{flex:1}
.bk-help-btn{flex:none;width:44px;min-height:44px;padding:0;border-radius:50%;font-weight:700;font-size:1rem}
.bk-help-btn[aria-expanded=true]{background:#fbeaea;border-color:#d9a3a3;color:#8a2b2b}
.bk-help{flex:1 1 100%;margin:0;padding:10px 12px;border-radius:10px;background:#fbeaea;border:1px solid #e7c2c2;color:#6e2323;font-size:.88rem;line-height:1.5}.bk-help[hidden]{display:none}

/* Update 39 (CO-AI): attached articles and search sources */
.attach-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:2px 0 4px}
button.ghost.attach-btn{color:var(--accent);border-color:var(--accent);min-height:40px}
button.ghost.attach-btn:disabled{opacity:.5;cursor:default}
.att-chips{display:flex;flex-wrap:wrap;gap:6px}
.att-chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;border:1px solid var(--line);background:var(--soft);border-radius:999px;padding:2px 4px 2px 10px;font-size:.85rem}
.att-icon{font-size:.68rem;font-weight:500;color:var(--accent);border:1px solid var(--accent);border-radius:4px;padding:0 4px;line-height:1.5}
.att-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:14em}
.att-size{color:var(--muted);font-size:.78rem}
button.att-x{background:transparent;color:var(--muted);padding:0;width:40px;height:40px;margin:-4px 0;border-radius:50%;line-height:1}
button.att-x:hover{background:var(--line)}
.att-err:empty{display:none}
.att-err{margin:0 0 6px}
.msg .sources{white-space:normal;margin-top:12px;padding-top:10px;border-top:1px solid var(--line);font-size:.9rem}
.sources-title{margin:0 0 4px;color:var(--muted);font-size:.85rem}
.sources ol{margin:0;padding-right:20px}
.sources li{margin:3px 0;overflow-wrap:anywhere}
.sources a{color:var(--accent)}
.sources-host{color:var(--muted);font-size:.8rem}.att-name{unicode-bidi:plaintext}
.att-err.info{color:var(--muted)}
button.ghost.search-btn{color:var(--accent);border-color:var(--accent);min-height:40px}
button.ghost.search-btn[aria-pressed=true]{background:var(--accent);color:#fff;font-weight:500}
