:root{--bg:#07080c;--panel:#0d0f15;--panel2:#11141c;--line:#202532;--text:#f5f7fb;--muted:#858da0;--accent:#8c7dff;--accent2:#5d8cff;--good:#5ee6a8;--user:#1b2741;--r:18px}
*{box-sizing:border-box}html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font-family:ferfery,system-ui,sans-serif}body{overflow:hidden}button,a{font:inherit}button{cursor:pointer}a{text-decoration:none;color:inherit}
.shell{height:100dvh;display:flex;max-width:1500px;margin:auto}.sidebar{width:280px;background:#090b10;border-left:1px solid var(--line);display:flex;flex-direction:column;padding:18px 14px;gap:15px;flex-shrink:0}.main{flex:1;min-width:0;display:flex;flex-direction:column;background:radial-gradient(circle at 55% -15%,#171a2a 0,#08090d 43%)}
.brand{display:flex;align-items:center;gap:10px;padding:3px 5px}.brand-mark,.welcome-orb,.support-orb{display:grid;place-items:center;background:linear-gradient(135deg,var(--accent),var(--accent2));box-shadow:0 15px 45px #7568ff2b}.brand-mark{width:42px;height:42px;border-radius:14px}.brand strong{display:block}.brand small,.agent-copy small{display:block;color:var(--muted);font-size:10px}.brand .mobile-only{margin-right:auto}
.new-chat{border:1px solid var(--line);background:linear-gradient(135deg,#171a25,#11141b);color:var(--text);padding:12px;border-radius:13px;text-align:right}.new-chat span{font-size:20px;vertical-align:-2px;margin-left:5px}.nav{display:grid;gap:4px}.nav a{padding:11px 12px;border-radius:11px;color:var(--muted);display:flex;gap:10px}.nav a:hover,.nav a.active{background:#141823;color:var(--text)}.nav span{width:18px;text-align:center}.side-section{border-top:1px solid var(--line);padding-top:15px}.side-title{color:var(--muted);font-size:10px;margin:0 5px 8px}.agent-mini{width:100%;display:flex;align-items:center;gap:9px;border:1px solid var(--line);background:var(--panel);color:var(--text);padding:11px;border-radius:14px;text-align:right}.agent-mini>span:nth-child(2){flex:1}.agent-mini small{display:block;color:var(--muted);font-size:10px;margin-top:2px}.agent-orb{width:9px;height:9px;border-radius:50%;background:var(--good);box-shadow:0 0 12px var(--good)}
.memory-card{display:flex;gap:10px;align-items:flex-start;background:#0e1219;border:1px solid var(--line);border-radius:14px;padding:12px;color:#a9b0bf}.memory-card>span{color:#aaa0ff}.memory-card b{display:block;font-size:11px;color:#dfe3eb}.memory-card small{display:block;color:var(--muted);font-size:9px;line-height:1.7;margin-top:3px}.sidebar-bottom{margin-top:auto}.secure-note{font-size:10px;color:#657084;padding:8px 4px}.secure-note:first-letter{color:var(--good)}.version{color:#596274;font-size:9px;padding:0 4px}
.topbar{height:64px;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 22px;gap:12px;background:#0a0c11cc;backdrop-filter:blur(16px);z-index:5}.top-title{flex:1}.top-title b{display:block}.top-title span{font-size:10px;color:var(--muted)}.top-title i{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--good);margin-left:4px}.top-actions{display:flex;gap:8px}.pill,.icon-btn{border:1px solid var(--line);background:#11141c;color:var(--text);border-radius:12px}.pill{padding:8px 13px;font-size:11px}.icon-btn{width:38px;height:38px}.mobile-only{display:none}
.chat{height:calc(100dvh - 64px);display:flex;flex-direction:column;min-height:0}.welcome{width:min(800px,calc(100% - 34px));margin:auto;text-align:center;padding:18px 0}.welcome-orb{width:66px;height:66px;border-radius:21px;margin:0 auto 16px;font-size:27px}.eyebrow{letter-spacing:1.6px;font-size:9px;color:#9b91ff}.welcome h1{font-size:32px;margin:9px 0 6px}.welcome p{color:var(--muted);margin:0 auto 22px;font-size:13px}.quick-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.quick-grid button{background:#0e1118;border:1px solid var(--line);border-radius:15px;color:var(--text);padding:14px;text-align:right;transition:.18s}.quick-grid button:hover{transform:translateY(-2px);border-color:#464c62;background:#121620}.quick-grid b{font-size:18px;color:#aaa1ff}.quick-grid span{display:block;font-size:12px;margin-top:6px}.quick-grid small{color:var(--muted);font-size:9px}.choose-agent{margin-top:11px;width:100%;display:flex;align-items:center;gap:8px;padding:11px 13px;border:1px solid #4a456f;background:#111222;color:#dcd9ff;border-radius:14px;text-align:right}.choose-agent span{color:var(--muted);font-size:10px}.choose-agent b{font-size:11px}.choose-agent i{margin-right:auto;font-style:normal}
.messages{width:min(920px,calc(100% - 34px));margin:0 auto;flex:1;overflow:auto;padding:24px 0 12px;display:flex;flex-direction:column;gap:11px;scroll-behavior:smooth}.msg{max-width:79%;padding:12px 15px;border-radius:17px;line-height:1.85;animation:up .18s ease}.msg.user{align-self:flex-start;background:var(--user);border:1px solid #2c4168}.msg.bot{align-self:stretch;max-width:100%;background:#0e1118;border:1px solid var(--line)}.msg-body{font-size:13px;word-break:break-word}.msg-body pre{direction:ltr;text-align:left;background:#080a0e;border:1px solid #1c222d;padding:12px;border-radius:10px;overflow:auto}.msg-body code{font-family:ui-monospace,SFMono-Regular,monospace;font-size:11px}.msg-body p{margin:0}.msg-body ul{padding-right:20px}.msg-foot{display:flex;align-items:center;gap:10px;color:#626b7c;font-size:8px;margin-top:6px}.msg-foot button{border:0;background:transparent;color:#7f8899;font-size:8px;padding:0}.typing .msg-body{display:flex;gap:4px}.typing .msg-body i{width:6px;height:6px;background:#737b8a;border-radius:50%;animation:b 1s infinite}.typing .msg-body i:nth-child(2){animation-delay:.15s}.typing .msg-body i:nth-child(3){animation-delay:.3s}@keyframes b{50%{transform:translateY(-5px);opacity:.35}}@keyframes up{from{opacity:0;transform:translateY(5px)}}
.composer-wrap{width:min(920px,calc(100% - 34px));margin:0 auto;padding:8px 0 15px}.composer{display:flex;align-items:flex-end;gap:6px;background:#0f1219;border:1px solid #292f3d;border-radius:18px;padding:7px;transition:.2s}.composer:focus-within{border-color:#5d58a0;box-shadow:0 0 0 3px #6d61ff14}.composer textarea{flex:1;resize:none;max-height:180px;min-height:42px;border:0;outline:0;background:transparent;color:var(--text);font:inherit;font-size:13px;line-height:1.65;padding:8px}.send{width:42px;height:42px;border:0;border-radius:13px;background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;font-size:22px}.send:disabled{opacity:.45}.attach{width:38px;height:38px;border:0;background:transparent;color:#6f7889;font-size:18px}.composer-meta{display:flex;justify-content:space-between;color:#5d6677;font-size:8px;padding:5px 7px}
.hidden{display:none!important}
.modal{position:fixed;inset:0;z-index:50;display:grid;place-items:center}.modal-backdrop{position:absolute;inset:0;background:#000c;backdrop-filter:blur(10px)}.modal-card{position:relative;width:min(610px,calc(100% - 26px));max-height:90dvh;overflow:auto;background:#0f1219;border:1px solid #2b3140;border-radius:23px;padding:25px;box-shadow:0 25px 90px #0009}.modal-close{position:absolute;left:16px;top:13px;background:transparent;border:0;color:var(--muted);font-size:24px}.modal-card h2{margin:8px 0 5px;font-size:21px}.modal-card>p{font-size:11px;color:var(--muted);margin-top:0}.agents{display:grid;gap:8px;margin-top:17px}.agent-card{display:flex;align-items:center;gap:12px;background:#0b0e14;border:1px solid var(--line);color:var(--text);border-radius:16px;padding:12px;text-align:right;transition:.15s}.agent-card:hover,.agent-card.selected{border-color:#6861a9;background:#141625}.agent-icon{width:40px;height:40px;flex:none;display:grid;place-items:center;border-radius:12px;background:#181a2a;color:#b6afff;font-size:17px}.agent-copy{flex:1}.agent-copy b{display:block;font-size:12px}.agent-copy small{font-size:9px;margin-top:2px}.agent-copy em{display:block;color:#858d9e;font-style:normal;font-size:9px;margin-top:5px}.agent-copy label{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px}.agent-copy label i{font-style:normal;font-size:8px;color:#aaa3ff;border:1px solid #353157;border-radius:99px;padding:2px 6px}.check{opacity:0;color:var(--good);font-size:16px}.selected .check{opacity:1}.modal-tip{margin-top:12px;padding:10px;border-radius:12px;background:#0b0e14;color:#737c8d;font-size:9px}
.page{width:min(900px,calc(100% - 34px));margin:0 auto;overflow:auto;padding:45px 0 55px}.support-page{max-width:800px}.support-hero{text-align:center;padding:20px 0 25px}.support-orb{width:72px;height:72px;border-radius:23px;margin:0 auto 15px;font-size:28px}.support-hero h1{font-size:31px;margin:8px 0}.support-hero p{color:var(--muted);font-size:12px;max-width:570px;margin:auto;line-height:2}.support-grid{display:grid;grid-template-columns:1.4fr .8fr;gap:12px}.support-card,.support-note{background:#0f1219;border:1px solid var(--line);border-radius:20px;padding:22px}.support-icon{font-size:25px;color:#aaa1ff}.support-card h2{font-size:17px;margin:8px 0}.support-card p,.support-note p{color:var(--muted);font-size:11px;line-height:1.9}.primary{border:0;background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;border-radius:12px;padding:11px 16px}.support-info{white-space:pre-wrap;margin-top:12px;background:#090b10;border:1px solid var(--line);padding:14px;border-radius:12px;font-size:14px;line-height:2;direction:rtl}.support-note span{color:#aaa1ff}.support-note b{display:block;margin-top:7px;font-size:12px}
@media(max-width:760px){body{overflow:hidden}.sidebar{position:fixed;z-index:60;right:0;top:0;bottom:0;transform:translateX(105%);transition:.22s;width:min(300px,88vw);box-shadow:-20px 0 60px #0008}.sidebar.open{transform:none}.mobile-only{display:block}.quick-grid{grid-template-columns:1fr}.welcome{padding-top:10px}.welcome h1{font-size:26px}.messages{padding-top:14px}.msg{max-width:90%}.topbar{padding:0 12px}.support-grid{grid-template-columns:1fr}.page{padding-top:25px}.modal-card{padding:22px 16px}.agent-copy em{display:none}}
/* 2.2 UX refinement */
.welcome-line{display:flex;justify-content:center;align-items:center;gap:9px;flex-wrap:wrap;margin:2px auto 14px;color:#6f7889;font-size:10px}.welcome-line i{font-style:normal;color:#353b48}.welcome p{margin-bottom:12px}.choose-agent{margin-top:8px}
.support-page{max-width:860px}.support-hero{padding:34px 0 30px}.support-hero h1{font-size:34px;letter-spacing:-.5px}.support-hero p{font-size:12px;line-height:2.1}.support-grid{grid-template-columns:1.25fr .75fr;align-items:stretch}.support-card{padding:26px}.support-card p{max-width:500px}.support-info{padding:0;background:transparent;border:0}.bank-card{position:relative;overflow:hidden;margin-top:18px;min-height:205px;border:1px solid #363b4d;border-radius:22px;padding:22px;color:#fff;background:linear-gradient(145deg,#1b1f2d,#0c0f16 58%,#161327);box-shadow:0 20px 55px #0007}.bank-card:before,.bank-card:after{content:"";position:absolute;border-radius:50%;filter:blur(2px);pointer-events:none}.bank-card:before{width:170px;height:170px;right:-75px;top:-70px;background:#8c7dff20}.bank-card:after{width:130px;height:130px;left:-65px;bottom:-80px;background:#5d8cff18}.bank-card-top,.bank-card-bottom{position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between}.bank-card-top{font-size:10px;letter-spacing:2px;color:#b9b4ff}.bank-card-top span:last-child{font-size:18px}.chip{position:relative;z-index:1;width:39px;height:29px;margin:30px 0 14px;border-radius:7px;background:linear-gradient(135deg,#b9b9ad,#6d6d68);box-shadow:inset 0 0 0 1px #ffffff55}.card-number{position:relative;z-index:1;font-family:ui-monospace,SFMono-Regular,monospace;font-size:20px;letter-spacing:2px;white-space:nowrap}.bank-card-bottom{margin-top:18px;color:#8991a3;font-size:9px}.copy-card{border:1px solid #363c4c;background:#171b26;color:#e9ebf1;border-radius:9px;padding:7px 10px;font-size:9px}.copy-card:hover{background:#202535}.support-thanks{margin:10px 2px 0!important;color:#777f91!important;font-size:10px!important}.support-note{display:flex;flex-direction:column;justify-content:center}.support-note b{font-size:13px;line-height:1.8}.support-note p{margin-bottom:0}
@media(max-width:760px){.welcome-line{max-width:330px;line-height:2}.support-hero h1{font-size:27px}.support-card{padding:18px}.card-number{font-size:16px;letter-spacing:1px}.bank-card{min-height:185px}.support-grid{grid-template-columns:1fr}}
/* 2.3 interface */
.quick-prompts{display:flex;gap:7px;overflow-x:auto;scrollbar-width:none;margin:0 0 7px}.quick-prompts::-webkit-scrollbar{display:none}.quick-prompts button{flex:0 0 auto;border:1px solid var(--line);background:#0d1017;color:#8f97a8;border-radius:999px;padding:7px 11px;font-size:9px}.quick-prompts button:hover,.quick-prompts button.active{border-color:#514b85;color:#c3bdff;background:#121323}.quick-prompts .web-chip{color:#aaa1ff}.composer{direction:ltr}.composer textarea{direction:rtl;text-align:right}.agent-trigger{width:42px;height:42px;border:1px solid #2e3342;border-radius:13px;background:#171a25;color:#bdb7ff;font-size:18px;flex:none}.send{order:3}.agent-trigger{order:1}.composer textarea{order:2}.new-chat{direction:rtl}.conversation-head{display:flex;align-items:center;justify-content:space-between;color:#6f7889;font-size:9px;padding:0 4px}.conversation-head button{border:0;background:transparent;color:#747d8e}.conversation-list{display:flex;flex-direction:column;gap:3px;max-height:38dvh;overflow:auto}.conversation{position:relative;display:flex;align-items:center;border-radius:11px}.conversation.active{background:#131722}.conv-main{flex:1;min-width:0;border:0;background:transparent;color:#bfc5d1;padding:9px 7px;display:flex;align-items:center;gap:7px;text-align:right}.conv-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px}.conv-icon{font-size:10px;color:#687183}.conv-more{border:0;background:transparent;color:#687183;width:30px}.conv-menu{position:fixed;z-index:100;background:#11151e;border:1px solid #2a3040;border-radius:12px;padding:5px;box-shadow:0 18px 45px #000b;min-width:130px}.conv-menu button{display:block;width:100%;border:0;background:transparent;color:#c9ced8;text-align:right;padding:8px;border-radius:8px;font-size:10px}.conv-menu button:hover{background:#1b202c}.support-link{display:flex;align-items:center;gap:8px;color:#8e97a8;font-size:11px;padding:11px 5px;border-top:1px solid var(--line);margin-bottom:3px}.support-link span{color:#aaa1ff}.sidebar-bottom{margin-top:auto}.about-page{max-width:800px;display:grid;place-items:center}.about-card{width:100%;background:#0f1219;border:1px solid var(--line);border-radius:24px;padding:42px;text-align:center}.about-card .welcome-orb{margin:0 auto 15px}.about-card h1{font-size:30px;margin:9px 0}.about-card>p{color:var(--muted);font-size:12px;line-height:2.1;max-width:620px;margin:0 auto}.feature-row{display:flex;justify-content:center;gap:7px;flex-wrap:wrap;margin:25px 0}.feature-row span{font-size:9px;border:1px solid #2b3040;border-radius:999px;padding:7px 10px;color:#a3aabc;background:#0b0e14}.about-story{border-top:1px solid var(--line);padding-top:22px;margin-top:20px}.about-story b{font-size:13px}.about-story p{color:var(--muted);font-size:11px;line-height:2;margin-bottom:0}.support-link:hover{color:#d8dce5}.msg.bot a{color:#aaa1ff}.bank-card{direction:ltr}.support-thanks{text-align:right}
@media(max-width:760px){.conversation-list{max-height:45dvh}.about-card{padding:28px 18px}.about-card h1{font-size:25px}.quick-prompts{padding-inline:1px}.composer-wrap{padding-bottom:12px}}

/* 2.4 code experience */
.code-wrap{margin:12px 0;border:1px solid #292f3d;border-radius:14px;overflow:hidden;background:#080a0f;direction:ltr;text-align:left}.code-head{display:flex;align-items:center;justify-content:space-between;padding:7px 9px;background:#10131b;border-bottom:1px solid #252b38;color:#7f899c;font:9px ui-monospace,SFMono-Regular,monospace}.code-head div{display:flex;gap:5px}.code-head button{border:1px solid #303647;background:#171b25;color:#c4cad5;border-radius:7px;padding:5px 8px;font-size:8px;cursor:pointer}.code-head button:hover{background:#202635}.code-wrap pre{margin:0;padding:13px 14px;overflow:auto;max-height:520px;direction:ltr;text-align:left;white-space:pre;tab-size:2}.code-wrap code{font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;color:#dce2ec}.msg.bot>.msg-body>pre:not(.code-wrap pre){direction:ltr;text-align:left;overflow:auto;background:#080a0f;border:1px solid #292f3d;border-radius:12px;padding:12px}.msg.bot>.msg-body>code{direction:ltr}.msg.bot .code-wrap+br{display:none}
.sidebar-backdrop{display:none}.page{position:relative}.page-close{position:absolute;top:18px;right:18px;width:42px;height:42px;border-radius:12px;border:1px solid var(--line,#252831);display:grid;place-items:center;text-decoration:none;font-size:25px;color:inherit;background:rgba(255,255,255,.03);z-index:2}.auth-card,.install-card{max-width:620px;margin:60px auto;padding:38px;border:1px solid var(--line,#252831);border-radius:28px;background:rgba(20,22,29,.78);text-align:center}.auth-tabs{display:flex;gap:8px;margin:25px 0 15px;flex-wrap:wrap}.auth-tabs button{flex:1;padding:12px;border:1px solid var(--line,#252831);background:transparent;color:inherit;border-radius:12px}.auth-tabs button.active{background:rgba(255,255,255,.09)}.auth-form{display:grid;gap:12px}.auth-form input,.install-card input{width:100%;box-sizing:border-box;padding:14px;border-radius:12px;border:1px solid var(--line,#252831);background:#0d0f14;color:inherit}.account-link{display:flex;width:100%;padding:10px 0;background:none;border:0;color:inherit;text-decoration:none;align-items:center;gap:8px;cursor:pointer}.account-link small{opacity:.55;margin-right:auto}.install-page{min-height:100vh;display:grid;place-items:center;padding:20px}.install-msg{margin:15px 0;padding:12px;border-radius:12px;background:#2b1a1a}.install-msg.ok{background:#14251b}.install-link{display:flex;text-decoration:none;justify-content:center;margin-top:15px}.install-help{margin-top:20px;text-align:left;direction:ltr;opacity:.65;font:12px monospace;line-height:1.8}.conv-menu{position:fixed;z-index:10000;min-width:170px;padding:6px;border:1px solid var(--line,#252831);border-radius:14px;background:#151820;box-shadow:0 16px 40px rgba(0,0,0,.35)}.conv-menu button{display:block;width:100%;padding:10px;border:0;background:transparent;color:inherit;text-align:right;border-radius:9px}.conv-menu button:hover{background:rgba(255,255,255,.07)}
@media(max-width:800px){.sidebar-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.52);z-index:40;display:block;opacity:0;pointer-events:none;transition:.2s}.sidebar-backdrop.show{opacity:1;pointer-events:auto}.sidebar{z-index:50}.sidebar.open{transform:translateX(0)!important}.shell{position:relative}.page-close{top:12px;right:12px}.auth-card{margin:30px 12px;padding:25px 18px}}


/* ===== Ferfery Android-style UI refresh ===== */
:root{
  --android-bg:#090a0f;
  --android-surface:#101219;
  --android-surface-2:#171923;
  --android-border:#242733;
  --android-hover:#1b1e29;
  --android-text:#f7f7fb;
  --android-muted:#9297a6;
  --android-accent:#8f82ff;
}
body{background:var(--android-bg)}
.shell{max-width:none}
.sidebar{
  width:300px;
  padding:14px 12px 12px;
  background:#0b0c11;
  border-left:1px solid #1d2029;
  gap:10px;
}
.brand{padding:7px 9px 13px;gap:11px}
.brand-mark{width:40px;height:40px;border-radius:13px}
.brand strong{font-size:15px}
.brand small{font-size:10px}
.new-chat{
  width:100%;
  min-height:46px;
  padding:0 15px;
  border-radius:14px;
  text-align:right;
  background:#171922;
  border:1px solid #292c37;
  font-size:13px;
  transition:.18s ease;
}
.new-chat:hover{background:#1d202b;border-color:#343847;transform:none}
.conversation-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 7px 4px;color:#8f94a2;font-size:11px;
}
.conversation-head button{
  width:30px;height:30px;border:0;border-radius:9px;background:transparent;color:#aeb3c0;
}
.conversation-head button:hover{background:var(--android-hover);color:#fff}
.conversation-list{
  flex:1;min-height:0;overflow:auto;padding:2px 2px 8px;
  scrollbar-width:thin;
}
.conversation{
  display:flex;align-items:center;gap:2px;margin:2px 0;padding:2px;
  border-radius:11px;transition:.16s ease;
}
.conversation:hover,.conversation.active{background:#171a23}
.conv-main{
  flex:1;min-width:0;display:flex;align-items:center;gap:9px;
  padding:10px 9px;border:0;background:transparent;color:#dfe2ea;
  text-align:right;border-radius:9px;
}
.conv-main>span:first-child{width:14px;color:#777d8d;font-size:11px;flex:none}
.conv-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}
.conv-more{
  flex:none;width:32px;height:34px;border:0;background:transparent;
  color:#858b9a;border-radius:9px;opacity:.55;
}
.conversation:hover .conv-more,.conversation.active .conv-more{opacity:1}
.conv-more:hover{background:#242733;color:#fff}
.nav{border-top:1px solid #1d2028;padding-top:8px}
.nav a,.support-link,.account-link{
  min-height:43px;padding:10px 12px;border-radius:11px;
  color:#a5a9b5;transition:.16s ease;
}
.nav a:hover,.nav a.active,.support-link:hover,.account-link:hover{
  background:#171a23;color:#f5f6fa;
}
.sidebar-bottom{padding-top:5px}
.sidebar-bottom .support-link{display:flex;align-items:center;gap:10px}
.account-link{
  width:100%;display:flex;align-items:center;justify-content:center;gap:8px;
  border:1px solid #302f49;
  background:linear-gradient(135deg,#19172a,#151622);
  color:#eeeefe!important;
  font-size:12px;font-weight:700;
  margin-top:6px;
}
.account-link small{font-size:10px;color:#a9a4d7;margin-right:auto}
.secure-note{padding:9px 5px 3px}
.version{padding:0 5px 3px}

/* Chat screen: app-like full canvas, no header */
.main{background:#090a0f}
.chat{
  position:relative;
  height:100dvh;
  min-height:0;
  padding:0;
  display:flex;
  flex-direction:column;
}
.chat .messages{
  flex:1;
  min-height:0;
  width:min(900px,100%);
  margin:0 auto;
  padding:76px 22px 160px;
  overflow-y:auto;
  scrollbar-width:thin;
}
.chat .welcome{
  margin:auto;
  max-width:680px;
  padding:24px 20px 110px;
}
.chat-app-title{
  display:none;
}
.chat-menu-trigger{
  position:fixed;
  top:14px;
  right:14px;
  z-index:20;
  width:43px;height:43px;
  display:grid;place-items:center;
  border:1px solid #292c36;
  border-radius:14px;
  background:rgba(17,18,25,.9);
  color:#e9eaf0;
  backdrop-filter:blur(18px);
  box-shadow:0 8px 28px rgba(0,0,0,.24);
  font-size:19px;
}
.chat-menu-trigger:hover{background:#1c1f29}
.composer-wrap{
  position:fixed;
  left:50%;
  bottom:0;
  transform:translateX(-50%);
  width:min(900px,100%);
  padding:10px 18px calc(12px + env(safe-area-inset-bottom));
  background:linear-gradient(to bottom,transparent,#090a0f 25%);
  z-index:15;
}
.quick-prompts{
  display:flex;gap:7px;overflow-x:auto;white-space:nowrap;
  padding:0 0 9px;scrollbar-width:none;
}
.quick-prompts::-webkit-scrollbar{display:none}
.quick-prompts button{
  flex:none;border:1px solid #272a35;background:#11131a;color:#b9bdc9;
  border-radius:999px;padding:7px 11px;font-size:10px;
}
.quick-prompts button:hover{background:#191c25;color:#fff}
.composer{
  border:1px solid #2a2d38!important;
  background:#11131a!important;
  border-radius:22px!important;
  box-shadow:0 12px 38px rgba(0,0,0,.35);
  padding:8px!important;
}
.composer textarea{
  background:transparent!important;
  font-size:13px!important;
}
.composer-meta{padding:6px 8px 0;font-size:9px;color:#686e7c}
.agent-trigger,.send{width:40px!important;height:40px!important;border-radius:14px!important}
.agent-trigger{background:#191b24!important;border:1px solid #292c37!important}
.send{background:var(--android-accent)!important}
.topbar{height:58px}

/* Independent pages retain a compact app bar and real close affordance */
.page{
  position:relative;
  height:100dvh;
  overflow:auto;
}
.page-close{
  position:fixed!important;
  top:14px;right:14px;
  z-index:30;
  width:42px;height:42px;
  display:grid!important;place-items:center;
  border:1px solid #292c36;
  border-radius:13px;
  background:#11131a;
  color:#eee;
  font-size:25px;
}
.page-close:hover{background:#1c1f29}

/* Mobile drawer */
@media (max-width:760px){
  .sidebar{
    position:fixed;
    top:0;right:0;bottom:0;
    width:min(320px,88vw);
    z-index:100;
    transform:translateX(105%);
    transition:transform .22s cubic-bezier(.2,.8,.2,1);
    box-shadow:-18px 0 55px rgba(0,0,0,.45);
  }
  .sidebar.open{transform:translateX(0)}
  .sidebar .mobile-only#closeSide{display:none}
  .sidebar-backdrop{
    position:fixed;inset:0;z-index:90;
    background:rgba(0,0,0,.52);
    backdrop-filter:blur(2px);
    opacity:0;pointer-events:none;
    transition:opacity .2s ease;
  }
  .sidebar-backdrop.show{opacity:1;pointer-events:auto}
  body.sidebar-open{overflow:hidden}
  .chat .messages{padding:70px 14px 170px}
  .chat .welcome{padding:34px 15px 110px}
  .composer-wrap{padding-left:10px;padding-right:10px}
  .chat-menu-trigger{top:10px;right:10px}
}
@media (min-width:761px){
  .chat-menu-trigger{top:14px;right:18px}
  .sidebar-backdrop{display:none}
}

/* Modern single-flow authentication */
.auth-card{max-width:430px;margin:50px auto;padding:34px 28px;border-radius:30px;text-align:center;background:rgba(18,20,27,.9);border:1px solid var(--line,#292c35);box-shadow:0 24px 70px rgba(0,0,0,.28)}
.auth-card h1{margin:10px 0 8px;font-size:30px;letter-spacing:-.5px}.auth-card>p{margin:0 auto 26px;line-height:1.9;opacity:.62;font-size:14px}.auth-form{display:grid;gap:12px}.auth-label{text-align:right;font-size:13px;opacity:.65;margin:0 3px -4px}.auth-input{width:100%;height:54px;box-sizing:border-box;padding:0 16px;border-radius:16px;border:1px solid var(--line,#292c35);background:#0c0e13;color:inherit;font:inherit;outline:none;transition:.18s}.auth-input:focus{border-color:rgba(255,255,255,.32);box-shadow:0 0 0 3px rgba(255,255,255,.04)}.auth-primary{height:54px;border:0;border-radius:16px;background:#f2f3f5;color:#101116;font:700 15px inherit;cursor:pointer;transition:.18s}.auth-primary:hover{transform:translateY(-1px)}.auth-secondary{height:48px;border:1px solid var(--line,#292c35);border-radius:15px;background:transparent;color:inherit;font:inherit;cursor:pointer}.auth-hint{font-size:12px;opacity:.42;margin-top:2px}.auth-mobile-pill{height:42px;border-radius:13px;background:rgba(255,255,255,.045);border:1px solid var(--line,#292c35);display:grid;place-items:center;font-size:14px;letter-spacing:.5px}.otp-title{font-size:15px;font-weight:700;margin-top:6px}.otp-wrap{display:flex;justify-content:center;align-items:center;gap:10px;direction:ltr;margin:10px auto 4px}.otp-box{width:56px;height:64px;padding:0;text-align:center;border-radius:15px;border:1px solid var(--line,#292c35);background:#0b0d12;color:inherit;font-size:25px;font-weight:700;outline:none;caret-color:transparent}.otp-box:focus{border-color:rgba(255,255,255,.42);box-shadow:0 0 0 4px rgba(255,255,255,.045)}.otp-timer{font-size:12px;opacity:.58;margin:7px 0}.otp-timer b{font-variant-numeric:tabular-nums;opacity:.95}.otp-actions{display:flex;justify-content:center;gap:18px;margin-top:5px}.otp-actions button{border:0;background:none;color:inherit;font:inherit;font-size:13px;cursor:pointer}.otp-actions button:first-child{font-weight:700}.hidden{display:none!important}.auth-error{min-height:20px;color:#ff8f8f;font-size:12px;line-height:1.7;margin-top:2px}.pin-entry{letter-spacing:8px;text-align:center}.pin-caption{text-align:center;font-size:12px;opacity:.52;margin-top:3px}.auth-backup .otp-wrap{margin-top:0}.auth-backup .auth-secondary{margin-top:2px}
@media(max-width:600px){.auth-card{margin:20px 12px;padding:28px 18px;border-radius:26px}.auth-card h1{font-size:27px}.otp-wrap{gap:8px}.otp-box{width:54px;height:60px}}

/* Chat top controls: compact Android-style actions */
.chat-top-actions{
  position:fixed;top:12px;left:14px;z-index:45;
  display:flex;align-items:center;gap:8px;
}
.chat-icon-btn{
  width:40px;height:40px;border:1px solid #292c36;border-radius:13px;
  background:rgba(17,19,26,.92);color:#eceef3;display:grid;place-items:center;
  font:inherit;font-size:23px;line-height:1;cursor:pointer;
  box-shadow:0 8px 25px rgba(0,0,0,.18);backdrop-filter:blur(12px);
}
.chat-icon-btn:hover{background:#1b1e27}
.chat-icon-btn:first-child{font-size:26px;letter-spacing:1px}
.chat .chat-menu-trigger{right:14px;left:auto;opacity:1;pointer-events:auto;width:43px;height:43px;padding:0;overflow:visible}
@media(max-width:760px){.chat-top-actions{top:10px;left:10px}.chat-icon-btn{width:42px;height:42px}.chat .chat-menu-trigger{top:10px;right:10px;width:42px;height:42px}.chat .messages{padding-top:72px}}

/* Backup login uses only mobile + 4-digit PIN */
.auth-backup .auth-mobile-pill{margin-bottom:2px}
.auth-backup .otp-wrap{margin-top:6px}


/* Message footer: timestamp left, copy right */
:root{--msg-scale:1}
.msg-body{font-size:calc(13px * var(--msg-scale))!important;transition:font-size .08s ease}
.msg-body code{font-size:calc(11px * var(--msg-scale))!important}
.msg-foot{width:100%;justify-content:space-between;direction:ltr;margin-top:8px}
.msg-time{direction:rtl;text-align:left;color:#626b7c;font-size:8px}
.msg-copy{direction:rtl;border:0;background:transparent;color:#7f8899;font-size:9px;padding:3px 0;cursor:pointer}
.msg-copy:hover{color:#fff}

/* OTP sequential green confirmation animation */
@keyframes otpSuccess{0%{background:#0b0d12;border-color:#2e3542;box-shadow:none}35%{background:#49c878;border-color:#72e39a;color:#08120c;box-shadow:0 0 0 5px rgba(73,200,120,.12),0 0 24px rgba(73,200,120,.22)}100%{background:#0b0d12;border-color:#2e3542;color:inherit;box-shadow:none}}
.otp-box.otp-success{animation:otpSuccess .18s ease forwards}

/* The browser page itself does not zoom; pinch gesture scales message text only. */
html,body{touch-action:pan-x pan-y}

/* Minimal AI thinking state */
.thinking-indicator{display:flex;align-items:center;gap:8px;min-height:28px;direction:rtl;color:#aab1bf;animation:thinkingIn .22s ease both}
.thinking-orb{width:10px;height:10px;border-radius:50%;border:1px solid rgba(190,198,214,.55);position:relative;animation:thinkingPulse 1.35s ease-in-out infinite}
.thinking-orb:after{content:"";position:absolute;inset:2px;border-radius:50%;background:rgba(210,218,232,.75);animation:thinkingGlow 1.35s ease-in-out infinite}
.thinking-label{font-size:11px;opacity:.58;margin-left:2px}
.thinking-indicator i{display:block;width:4px;height:4px;border-radius:50%;background:#8f98aa;opacity:.35;animation:thinkingDot 1.15s ease-in-out infinite}
.thinking-indicator i:nth-of-type(2){animation-delay:.14s}.thinking-indicator i:nth-of-type(3){animation-delay:.28s}
@keyframes thinkingIn{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
@keyframes thinkingPulse{0%,100%{transform:scale(.82);opacity:.55}50%{transform:scale(1.15);opacity:1}}
@keyframes thinkingGlow{0%,100%{transform:scale(.7);opacity:.35}50%{transform:scale(1);opacity:.9}}
@keyframes thinkingDot{0%,100%{transform:translateY(0);opacity:.25}50%{transform:translateY(-4px);opacity:.9}}

/* Chat message style: user in bubble, AI in open ChatGPT-like layout */
.messages .msg{
  max-width:79%;
  padding:12px 15px;
  border-radius:17px;
  line-height:1.85;
  animation:up .18s ease;
}
.messages .msg.user{
  align-self:flex-start;
  background:var(--user);
  border:1px solid #2c4168;
}
.messages .msg.bot{
  align-self:stretch;
  max-width:100%;
  padding:12px 0 10px;
  background:transparent;
  border:0;
  border-radius:0;
}
.messages .msg.bot .msg-body{
  width:100%;
}
.messages .msg.user .msg-foot{
  display:none;
}
.messages .msg.bot .msg-foot{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:12px;
  direction:ltr;
  width:100%;
  margin-top:8px;
}
.messages .msg.bot .msg-time{
  direction:rtl;
  text-align:left;
  color:#626b7c;
  font-size:8px;
}
.messages .msg.bot .msg-copy{
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  border:0;
  background:transparent;
  color:#7f8899;
  padding:0;
  cursor:pointer;
  border-radius:8px;
}
.messages .msg.bot .msg-copy:hover{
  color:#fff;
  background:rgba(255,255,255,.05);
}
.messages .msg.bot .msg-copy svg{
  width:15px;
  height:15px;
  display:block;
}
.page .page-close{
  position:static!important;
  width:38px;
  height:38px;
  border-radius:12px;
  display:grid;
  place-items:center;
  font-size:25px;
  line-height:1;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
}


/* ===== Ferfery 3.4 final fixes ===== */
.topbar{position:relative;display:flex;align-items:center;min-height:58px;padding:0 18px;z-index:20}
.top-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.page-close{position:static!important;width:40px!important;height:40px!important;display:grid!important;place-items:center!important;border:1px solid var(--line)!important;border-radius:12px!important;background:#11131a!important;color:#eee!important;text-decoration:none!important;font-size:25px!important;line-height:1!important;z-index:auto!important}
.install-app-link{border:0!important;background:transparent!important;color:inherit!important;text-align:right!important;cursor:pointer;font-size:11px}
.install-app-link span{color:var(--accent);font-size:16px;width:18px;text-align:center}
.msg.bot{background:transparent!important;border:0!important;border-radius:0!important;padding:12px 0 10px!important;max-width:100%!important}
.msg.bot .msg-body{width:100%;background:transparent!important}
.msg.user{align-self:flex-start}
.msg-foot{display:flex!important;align-items:center;justify-content:flex-start!important;gap:12px;direction:ltr;width:100%;margin-top:8px!important}
.msg.bot .msg-copy{width:28px;height:28px;display:grid;place-items:center;border:0;background:transparent;color:#7f8899;padding:0;cursor:pointer;border-radius:8px}
.msg.bot .msg-copy svg{width:15px;height:15px;display:block}
.offline-notice{position:fixed;left:50%;bottom:92px;transform:translateX(-50%);z-index:120;display:flex;align-items:center;gap:9px;max-width:calc(100vw - 28px);padding:10px 14px;border:1px solid #3a3042;border-radius:13px;background:rgba(20,17,27,.96);box-shadow:0 15px 40px rgba(0,0,0,.35);font-size:10px;direction:rtl}
.offline-notice b{color:#e5b6ff;white-space:nowrap}.offline-notice span{color:#9da4b2}
.install-help-modal{position:fixed;inset:0;z-index:10000;background:rgba(0,0,0,.65);display:grid;place-items:center;padding:20px;direction:rtl}
.install-help-card{position:relative;width:min(430px,100%);padding:25px;border:1px solid var(--line);border-radius:24px;background:#10131a;box-shadow:0 25px 80px rgba(0,0,0,.5)}
.install-help-card h3{margin:8px 0 16px;font-size:20px}.install-help-card p{font-size:12px;line-height:2;margin:10px 0;color:#b8bfcb}.install-help-card small{display:block;color:#727b8c;line-height:1.9}.install-help-close{position:absolute;left:12px;top:12px;width:34px;height:34px;border:1px solid var(--line);border-radius:10px;background:#171a22;color:#eee;font-size:20px}
@media(max-width:760px){.topbar{padding:0 12px}.offline-notice{bottom:105px}.install-app-link{padding:10px 0}}

/* ===== Sidebar final layout / conversation lazy loading ===== */
.sidebar{
  height:100dvh;
  min-height:0;
  overflow:hidden;
}
.conversation-list{
  flex:1 1 auto;
  min-height:0;
  max-height:none;
  overflow-y:auto;
  overscroll-behavior:contain;
}
.sidebar-bottom{
  flex:0 0 auto;
  margin-top:0;
  padding-top:8px;
  border-top:1px solid var(--line);
  background:#090b10;
}
.sidebar-links{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:5px;
  width:100%;
}
.side-link{
  min-width:0;
  min-height:42px;
  padding:8px 4px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:#a5a9b5;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  cursor:pointer;
  text-decoration:none;
  font-size:10px;
  transition:.16s ease;
}
.side-link:hover{
  background:#171a23;
  color:#f5f6fa;
}
.side-link span{font-size:13px;color:#aaa1ff}
.side-link b{font-size:10px;font-weight:600;white-space:nowrap}
.sidebar-bottom .account-link{
  margin-top:7px;
}
@media(max-width:760px){
  .sidebar{height:100dvh;overflow:hidden}
  .conversation-list{max-height:none}
  .sidebar-bottom{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
}

/* ===== Sidebar interaction hardening v3.4 ===== */
@media(max-width:760px){
  .chat-menu-trigger{
    z-index:1000!important;
    pointer-events:auto!important;
    touch-action:manipulation;
  }
  .sidebar-backdrop{z-index:900!important;}
  .sidebar{z-index:1001!important;}
}

/* ===== Ferfery 3.4 fixes ===== */
.chat-top-actions .chat-icon-btn{
  text-decoration:none;
}
.chat-top-actions .home-btn{
  font-size:21px;
}
.conv-menu{
  position:fixed!important;
  z-index:10000!important;
}
.messages{
  --msg-scale:1;
  touch-action:pan-y;
}
.msg.user .msg-body,.msg.bot .msg-body{
  font-size:calc(13px * var(--msg-scale))!important;
}
.msg.user .msg-body code,.msg.bot .msg-body code{
  font-size:calc(11px * var(--msg-scale))!important;
}
@media(max-width:760px){
  .chat-top-actions{
    display:flex;
    flex-direction:row;
    gap:7px;
  }
}

/* ===== Ferfery 3.4 logo assets ===== */
.brand-mark,
.welcome-orb{
  overflow:hidden;
  background:transparent!important;
  box-shadow:none!important;
}
.brand-mark img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
.welcome-orb img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  border-radius:inherit;
}
.chat-app-title{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
}
.chat-app-title img{
  width:30px;
  height:30px;
  object-fit:contain;
  display:block;
  border-radius:8px;
}

/* ===== Ferfery 3.4 ===== */
@font-face{
  font-family:ferfery;
  src:url('font/ferfery.woff2') format('woff2');
  font-display:swap;
  font-weight:100 900;
  font-style:normal;
}
html,body,button,input,textarea,select{font-family:ferfery,system-ui,sans-serif}

/* Humor selector inside the agent chooser */
.humor-setting{
  margin-top:18px;
  padding-top:16px;
  border-top:1px solid var(--line);
}
.humor-setting-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.humor-setting-head b{font-size:12px}
.humor-setting-head span{font-size:10px;color:#aaa1ff}
.humor-slider{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:5px;
  padding:4px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#090c12;
  touch-action:pan-y;
  user-select:none;
}
.humor-option{
  border:0;
  background:transparent;
  color:#7f8798;
  border-radius:10px;
  padding:10px 7px;
  font-size:10px;
  transition:.16s ease;
}
.humor-option.active{
  background:#1a1d2a;
  color:#eeeef5;
  box-shadow:0 3px 12px rgba(0,0,0,.2);
}
.humor-setting>small{
  display:block;
  margin-top:8px;
  color:#626b7c;
  font-size:8px;
  text-align:center;
}

/* Timed install / registration prompts */
.ferfery-timed-popup{
  position:fixed;
  inset:0;
  z-index:11000;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(0,0,0,.68);
  backdrop-filter:blur(9px);
  direction:rtl;
  animation:ferferyPopupIn .2s ease both;
}
.ferfery-timed-card{
  width:min(430px,100%);
  padding:27px 23px 22px;
  border:1px solid #303545;
  border-radius:25px;
  background:#10131a;
  box-shadow:0 25px 90px rgba(0,0,0,.55);
  text-align:center;
}
.ferfery-popup-icon{
  width:52px;
  height:52px;
  margin:0 auto 13px;
  display:grid;
  place-items:center;
  border-radius:17px;
  background:#19172a;
  color:#aaa1ff;
  font-size:24px;
}
.ferfery-timed-card h3{margin:0 0 9px;font-size:20px}
.ferfery-timed-card p{margin:0;color:#929aaa;font-size:11px;line-height:2}
.ferfery-popup-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  width:100%;
  margin-top:20px;
}
.ferfery-popup-actions button{
  width:100%;
  min-height:46px;
  border-radius:13px;
  font-size:11px;
  cursor:pointer;
}
.ferfery-popup-primary{
  border:0;
  background:var(--android-accent,var(--accent));
  color:#fff;
}
.ferfery-popup-secondary{
  border:1px solid #2b3040;
  background:#151821;
  color:#aeb4c1;
}
.ferfery-popup-actions button:active{transform:scale(.98)}
@keyframes ferferyPopupIn{from{opacity:0}to{opacity:1}}
@media(max-width:480px){
  .ferfery-timed-card{padding:24px 17px 18px;border-radius:22px}
  .ferfery-timed-card h3{font-size:18px}
}


/* ===== Ferfery 3.4 — iPhone-style bottom sheets ===== */
.ferfery-timed-popup{
  position:fixed;
  inset:0;
  z-index:11000;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:0;
  background:rgba(0,0,0,.58);
  backdrop-filter:blur(7px);
  direction:rtl;
  animation:ferferySheetBackdrop .2s ease both;
}
.ferfery-timed-card{
  width:min(760px,100%);
  min-height:33dvh;
  max-height:62dvh;
  overflow:auto;
  padding:12px 22px calc(18px + env(safe-area-inset-bottom));
  border:1px solid #2d3240;
  border-bottom:0;
  border-radius:28px 28px 0 0;
  background:linear-gradient(180deg,#141720 0%,#0e1016 100%);
  box-shadow:0 -20px 70px rgba(0,0,0,.48);
  text-align:center;
  transform:translateY(0);
  animation:ferferySheetUp .28s cubic-bezier(.2,.8,.2,1) both;
}
.ferfery-sheet-handle{
  width:42px;height:4px;border-radius:99px;
  margin:0 auto 15px;
  background:#555b6b;
}
.ferfery-popup-icon{
  width:50px;height:50px;margin:0 auto 11px;
  display:grid;place-items:center;
  border-radius:16px;background:#19172a;color:#aaa1ff;font-size:23px;
}
.ferfery-timed-card h3{margin:0 0 9px;font-size:20px}
.ferfery-timed-card p{max-width:590px;margin:0 auto;color:#929aaa;font-size:11px;line-height:2}
.ferfery-popup-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;width:100%;margin:22px auto 0;max-width:600px}
.ferfery-popup-actions button{width:100%;min-height:48px;border-radius:14px;font-size:11px}
.ferfery-popup-primary{border:0;background:var(--android-accent,var(--accent));color:#fff}
.ferfery-popup-secondary{border:1px solid #2b3040;background:#151821;color:#aeb4c1}
.ferfery-popup-actions button:active{transform:scale(.985)}
@keyframes ferferySheetUp{from{transform:translateY(100%);opacity:.7}to{transform:translateY(0);opacity:1}}
@keyframes ferferySheetBackdrop{from{opacity:0}to{opacity:1}}
@media(max-width:480px){
  .ferfery-timed-card{min-height:33dvh;padding:10px 16px calc(16px + env(safe-area-inset-bottom));border-radius:25px 25px 0 0}
  .ferfery-timed-card h3{font-size:18px}
  .ferfery-timed-card p{font-size:10.5px}
}


/* ===== Ferfery 3.4 ===== */
html,body{width:100%;min-width:0}
.shell{width:100%;max-width:none;display:flex;direction:ltr}
.sidebar{direction:rtl;position:relative;z-index:20;flex:0 0 300px;width:300px;height:100dvh;min-width:300px;overflow:hidden}
.main{direction:rtl;position:relative;z-index:1;flex:1 1 auto;width:calc(100% - 300px);min-width:0;overflow:hidden}
.chat,.chat-top-actions,.chat-menu-trigger,.composer-wrap,.messages{position:relative;z-index:2}
.chat-top-actions{z-index:4}
.chat-menu-trigger{z-index:5}
.response-mode{transition:.18s ease}
.response-mode.active{border-color:#665db0!important;color:#e2deff!important;background:#17162a!important;box-shadow:inset 0 0 0 1px #514b85}
.response-mode.current-mode{color:#bdb5ff}
.ferfery-auth-sheet{position:fixed;inset:0;z-index:12000;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.58);backdrop-filter:blur(8px);direction:rtl;animation:ferferySheetBackdrop .2s ease both}
.ferfery-auth-backdrop{position:absolute;inset:0}
.ferfery-auth-card{position:relative;width:min(560px,100%);max-height:82dvh;overflow:auto;padding:12px 22px calc(22px + env(safe-area-inset-bottom));border:1px solid #2d3240;border-bottom:0;border-radius:28px 28px 0 0;background:linear-gradient(180deg,#141720,#0e1016);box-shadow:0 -20px 70px rgba(0,0,0,.48);text-align:center;animation:ferferySheetUp .28s cubic-bezier(.2,.8,.2,1) both}
.ferfery-auth-card h3{margin:4px 0 6px;font-size:20px}.ferfery-auth-card>p{margin:0 0 14px;color:#929aaa;font-size:11px;line-height:1.9}.ferfery-auth-close{position:absolute;left:15px;top:10px;width:36px;height:36px;border:0;background:transparent;color:#8d95a5;font-size:25px}
.ferfery-auth-card .auth-form{max-width:430px;margin:0 auto}.ferfery-auth-card .auth-input{background:#0b0d12}
body.sheet-open{overflow:hidden}
@media(min-width:761px){.chat{height:100dvh}.chat-top-actions{padding-top:12px}.messages{padding-top:20px}.composer-wrap{padding-bottom:15px}}
@media(max-width:760px){.shell{display:block}.sidebar{position:fixed;right:0;top:0;bottom:0;width:min(300px,88vw);min-width:0;z-index:1001}.main{width:100%;height:100dvh}.ferfery-auth-card{min-height:33dvh;padding:10px 16px calc(16px + env(safe-area-inset-bottom));border-radius:25px 25px 0 0}.response-mode{font-size:9px!important;padding:7px 10px!important}}



/* 3.4 fixes */
@media(min-width:761px){
 .shell{direction:rtl!important}
 .sidebar{order:0!important}
 .main{order:1!important}
}
.msg.user .msg-foot{display:flex;gap:8px;align-items:center;justify-content:flex-start;margin-top:5px}
.msg-edit{border:0;background:transparent;color:#7f8899;cursor:pointer;font-size:15px;padding:3px 5px}
.msg-edit:hover{color:#fff}
@media(max-width:760px){
 html,body{height:100%;overflow:hidden}
 .main,.chat{height:100%;min-height:0}
 .chat{display:flex;flex-direction:column;overflow:hidden}
 .chat-top-actions,.chat-menu-trigger{top:8px!important}
 .messages{flex:1 1 auto;min-height:0;overflow-y:auto;padding-bottom:12px!important}
 .composer-wrap{position:relative!important;bottom:auto!important;flex:0 0 auto;padding:8px 10px calc(10px + env(safe-area-inset-bottom))!important;background:#08090d;z-index:10}
 .quick-prompts{overflow-x:auto;white-space:nowrap;max-width:100%;padding-bottom:5px}
 .composer{min-height:54px;align-items:flex-end}
 #input{max-height:125px;overflow-y:auto;line-height:1.8;padding-top:12px;padding-bottom:12px}
 .composer-meta{font-size:9px}
}
.send.stop-active{font-size:14px;line-height:1;background:#29202a;border-color:#76516b;color:#ffd7e9}
.send.stop-active{font-size:14px;line-height:1;background:#29202a;border-color:#76516b;color:#ffd7e9}

/* Ferfery 3.4 mobile composer and gestures */
@media(max-width:760px){
  .chat{position:relative;display:flex;flex-direction:column;height:100%;min-height:0;}
  .chat-top-actions{position:absolute!important;top:8px!important;left:12px!important;right:auto!important;z-index:30;display:flex;gap:6px;}
  .chat-menu-trigger{position:absolute!important;top:8px!important;right:12px!important;z-index:31;}
  .welcome{padding-top:62px!important;}
  .composer-wrap{margin-top:auto!important;position:relative!important;inset:auto!important;}
  #input{overflow-y:hidden!important;max-height:33vh!important;min-height:42px!important;}
  .composer{align-items:flex-end!important;}
  .composer textarea{overflow:hidden!important;}
  .quick-prompts{touch-action:pan-x!important;overscroll-behavior-x:contain!important;}
}
.msg.user .msg-foot{display:inline-flex!important;align-items:center!important;gap:6px!important;margin:4px 0 0!important;}
.msg.user .msg-foot .msg-time{display:inline!important;}
.edit-cancel{border:0;background:transparent;color:#ff9caa;cursor:pointer;font-size:12px;padding:5px 8px;}

/* ===== Ferfery 3.4 final UI corrections ===== */
.chat{position:relative;isolation:isolate;}
.chat-top-actions{position:absolute!important;top:12px!important;left:14px!important;right:auto!important;z-index:50!important;}
.chat-menu-trigger{position:absolute!important;top:12px!important;right:14px!important;z-index:51!important;}
@media(max-width:760px){
  .chat{height:100dvh!important;min-height:0!important;overflow:hidden!important;}
  .chat-top-actions{top:12px!important;left:12px!important;right:auto!important;}
  .chat-menu-trigger{top:12px!important;right:12px!important;}
  .chat .messages{padding-top:72px!important;padding-bottom:12px!important;}
  .composer-wrap{position:relative!important;left:auto!important;bottom:auto!important;transform:none!important;width:100%!important;box-sizing:border-box!important;margin-top:auto!important;padding:8px 10px calc(10px + env(safe-area-inset-bottom))!important;}
  .quick-prompts{touch-action:pan-x!important;overscroll-behavior-x:contain!important;}
}
.composer{display:flex!important;align-items:flex-end!important;gap:8px!important;}
.composer textarea{min-height:42px!important;height:42px;max-height:33vh!important;overflow:hidden!important;resize:none!important;line-height:1.7!important;padding:9px 8px!important;}
.composer textarea.is-multiline{padding-top:10px!important;padding-bottom:10px!important;}
.message-context-menu{position:fixed;z-index:20000;min-width:190px;max-width:calc(100vw - 16px);padding:6px;border:1px solid #303545;border-radius:15px;background:#171a23;color:#e9ebf2;box-shadow:0 18px 55px #000b;direction:rtl;}
.message-context-menu button{display:block;width:100%;border:0;border-radius:10px;background:transparent;color:inherit;text-align:right;padding:11px 12px;font:inherit;font-size:12px;cursor:pointer;}
.message-context-menu button:hover{background:#242938;}
.message-context-time{padding:8px 12px 9px;color:#8d96a8;font-size:11px;border-bottom:1px solid #2b3040;margin-bottom:4px;}
.msg.user .user-msg-tools,.msg.user .msg-edit,.msg.user .msg-copy{display:none!important;}
@media(max-width:760px){.message-context-menu{min-width:210px;}.composer-meta{padding-bottom:2px!important;}}

/* Requested: chat message text size */
.msg.user .msg-body,
.msg.bot .msg-body{
  font-size:15px!important;
}
.message-context-time{
  direction:rtl!important;
  text-align:justify!important;
}

/* ===== v3.4: cancel message editing ===== */
.edit-cancel-btn{
  display:none;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  min-width:54px;
  height:36px;
  margin-inline-start:6px;
  padding:0 12px;
  border:0;
  border-radius:12px;
  background:var(--surface-2,#eee);
  color:var(--text,#333);
  font:inherit;
  font-size:13px;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.edit-cancel-btn.is-visible{
  display:inline-flex;
}
.is-editing-message .edit-cancel-btn{
  display:inline-flex;
}
@media(max-width:760px){
  .edit-cancel-btn{
    min-width:48px;
    height:34px;
    padding:0 10px;
  }
}

/* ===== v3.4: message-edit cancel X ===== */
.edit-cancel-btn{
  display:none!important;
  align-items:center!important;
  justify-content:center!important;
  flex:0 0 36px!important;
  width:36px!important;
  min-width:36px!important;
  max-width:36px!important;
  height:36px!important;
  min-height:36px!important;
  margin-inline:6px 0!important;
  padding:0!important;
  box-sizing:border-box!important;
  border:1px solid rgba(0,0,0,.12)!important;
  border-radius:10px!important;
  background:#f1f1f1!important;
  color:#222!important;
  font-family:Arial,sans-serif!important;
  font-size:24px!important;
  font-weight:400!important;
  line-height:1!important;
  cursor:pointer!important;
  opacity:1!important;
  visibility:visible!important;
  -webkit-tap-highlight-color:transparent!important;
}
.edit-cancel-btn.is-visible{
  display:inline-flex!important;
}
@media(max-width:760px){
  .edit-cancel-btn{
    flex-basis:36px!important;
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
  }
}

/* ===== v3.4 ===== */
.is-editing-message .edit-cancel-btn{
  display:inline-flex!important;
  order:unset!important;
}

/* ===== v3.4 settings + message tools ===== */
:root{--message-font-size:15px}
.msg .msg-body{font-size:var(--message-font-size)!important}
.brand{position:relative}
.brand-settings{
  position:absolute;left:5px;top:5px;
  width:38px;height:38px;flex:0 0 38px;display:grid;place-items:center;
  border:1px solid var(--line);border-radius:12px;background:var(--panel);
  color:var(--muted);font-size:19px;padding:0;
}
.brand-settings:hover{color:var(--text);border-color:#444b5c}
.msg-regenerate svg{width:16px;height:16px;display:block}
.msg-copy svg{width:16px;height:16px;display:block}
.msg-foot .msg-copy,.msg-foot .msg-regenerate{width:24px;height:24px;display:grid;place-items:center}
.msg-foot .msg-regenerate{border:0;background:transparent;color:#7f8899;padding:3px;cursor:pointer}
.msg-foot .msg-regenerate:hover{color:var(--text)}

.settings-sheet{
  position:fixed;inset:0;z-index:120;display:flex;align-items:flex-end;justify-content:center;
}
.settings-sheet.hidden{display:none!important}
.settings-backdrop{
  position:absolute;inset:0;background:#000b;backdrop-filter:blur(9px);
}
.settings-card{
  position:relative;z-index:1;width:min(620px,100%);max-height:min(82dvh,720px);
  overflow:auto;background:#10131b;border:1px solid #2a3040;
  border-bottom:0;border-radius:26px 26px 0 0;padding:18px 20px 28px;
  box-shadow:0 -20px 70px #0008;transform:translateY(100%);
  transition:transform .28s cubic-bezier(.2,.8,.2,1);
}
.settings-sheet.show .settings-card{transform:translateY(0)}
.settings-grabber{width:42px;height:4px;border-radius:99px;background:#596173;margin:0 auto 14px}
.settings-close{
  position:absolute;left:16px;top:14px;width:34px;height:34px;border:0;
  border-radius:11px;background:transparent;color:var(--muted);font-size:24px;
}
.settings-card h2{margin:8px 0 18px;font-size:22px}
.settings-name{
  width:100%;display:flex;align-items:center;gap:11px;text-align:right;
  border:1px solid var(--line);background:#0c0f15;color:var(--text);
  border-radius:15px;padding:12px;margin-bottom:14px;
}
.settings-name-icon{width:36px;height:36px;border-radius:11px;background:#181c27;display:grid;place-items:center;color:var(--accent)}
.settings-name-copy{flex:1}.settings-name-copy small{display:block;color:var(--muted);font-size:10px;margin-bottom:3px}
.settings-name-copy b{font-size:14px}.settings-chevron{font-size:25px;color:var(--muted)}
.settings-section{border-top:1px solid var(--line);padding-top:16px;margin-top:16px}
.settings-row-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
.settings-row-head b{font-size:12px}.settings-row-head strong{font-size:11px;color:var(--accent)}
.message-font-slider{width:100%;margin:18px 0 5px;accent-color:var(--accent)}
.settings-range-labels{display:flex;justify-content:space-between;color:var(--muted);font-size:9px}
.theme-buttons{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.theme-btn{
  min-height:48px;border:1px solid var(--line);border-radius:13px;background:#0c0f15;
  color:var(--text);font-size:12px;
}
.theme-btn.active{border-color:var(--accent);box-shadow:0 0 0 2px #8c7dff22;background:#171a28}

.light-theme{
  --bg:#f4f6fa;--panel:#ffffff;--panel2:#f0f2f6;--line:#dfe3eb;
  --text:#20242c;--muted:#697282;--user:#e4ecff;--good:#15945a;
}
body.light-theme{background:var(--bg);color:var(--text)}
body.light-theme .main{background:radial-gradient(circle at 55% -15%,#fff 0,#f1f3f7 48%)}
body.light-theme .sidebar{background:#fff}
body.light-theme .composer{background:#fff;border-color:var(--line)}
body.light-theme .composer textarea{color:var(--text)}
body.light-theme .brand-settings,
body.light-theme .settings-name,
body.light-theme .theme-btn{background:#f6f7fa}
body.light-theme .settings-card{background:#fff;border-color:var(--line)}
body.light-theme .msg-regenerate,
body.light-theme .msg-copy{color:#667080}
body.light-theme .msg.user{background:var(--user)}
@media(max-width:760px){
  .settings-card{padding-bottom:calc(22px + env(safe-area-inset-bottom))}
}

/* ===== v3.4: message font + complete light theme ===== */
.msg .msg-body,
.msg .msg-body p,
.msg .msg-body li,
.msg .msg-body blockquote,
.msg .msg-body td,
.msg .msg-body th,
.msg .msg-body strong,
.msg .msg-body em,
.msg .msg-body a,
.msg .msg-body h1,
.msg .msg-body h2,
.msg .msg-body h3,
.msg .msg-body h4,
.msg .msg-body h5,
.msg .msg-body h6{
  font-size:var(--message-font-size,15px)!important;
}
.msg .msg-body pre,
.msg .msg-body pre code{
  font-size:calc(var(--message-font-size,15px) - 2px)!important;
}

/* Light mode: override legacy hard-coded dark surfaces and light-on-dark text. */
html.light-theme, body.light-theme{
  --bg:#f5f6f8;
  --panel:#ffffff;
  --panel2:#eef0f4;
  --line:#d9dde5;
  --text:#20242c;
  --muted:#687181;
  --accent:#6657d9;
  --accent2:#416fd8;
  --good:#16834f;
  --user:#e7edff;
}
body.light-theme{background:var(--bg)!important;color:var(--text)!important}
body.light-theme .sidebar,
body.light-theme .main,
body.light-theme .chat,
body.light-theme .messages,
body.light-theme .composer-wrap{
  color:var(--text)!important;
}
body.light-theme .sidebar{
  background:#fff!important;
  border-color:var(--line)!important;
}
body.light-theme .main{
  background:radial-gradient(circle at 55% -15%,#ffffff 0,#f2f4f8 55%)!important;
}
body.light-theme .topbar{
  background:#ffffffee!important;
  border-color:var(--line)!important;
}
body.light-theme .top-title b,
body.light-theme .brand strong,
body.light-theme .nav a,
body.light-theme .new-chat,
body.light-theme .agent-mini,
body.light-theme .agent-mini b,
body.light-theme .choose-agent,
body.light-theme .quick-grid button,
body.light-theme .pill,
body.light-theme .icon-btn,
body.light-theme .composer textarea,
body.light-theme .settings-card,
body.light-theme .settings-card h2,
body.light-theme .settings-name,
body.light-theme .settings-name b,
body.light-theme .theme-btn{
  color:var(--text)!important;
}
body.light-theme .nav a:hover,
body.light-theme .nav a.active{
  background:#eef1f6!important;
  color:var(--text)!important;
}
body.light-theme .new-chat{
  background:#f7f8fa!important;
  border-color:var(--line)!important;
}
body.light-theme .agent-mini,
body.light-theme .choose-agent,
body.light-theme .quick-grid button,
body.light-theme .pill,
body.light-theme .icon-btn{
  background:#ffffff!important;
  border-color:var(--line)!important;
}
body.light-theme .memory-card{
  background:#f7f8fa!important;
  border-color:var(--line)!important;
  color:#4f5868!important;
}
body.light-theme .memory-card b{
  color:var(--text)!important;
}
body.light-theme .side-title,
body.light-theme .brand small,
body.light-theme .agent-copy small,
body.light-theme .agent-mini small,
body.light-theme .top-title span,
body.light-theme .secure-note,
body.light-theme .version,
body.light-theme .settings-name-copy small,
body.light-theme .settings-range-labels{
  color:var(--muted)!important;
}
body.light-theme .msg.bot{
  background:#ffffff!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
}
body.light-theme .msg.user{
  background:var(--user)!important;
  border-color:#cbd6f3!important;
  color:var(--text)!important;
}
body.light-theme .msg-body,
body.light-theme .msg-body p,
body.light-theme .msg-body li,
body.light-theme .msg-body strong,
body.light-theme .msg-body em,
body.light-theme .msg-body h1,
body.light-theme .msg-body h2,
body.light-theme .msg-body h3,
body.light-theme .msg-body h4{
  color:var(--text)!important;
}
body.light-theme .msg-body pre{
  background:#f1f3f6!important;
  border-color:var(--line)!important;
}
body.light-theme .composer{
  background:#ffffff!important;
  border-color:var(--line)!important;
}
body.light-theme .attach{
  background:#f4f5f7!important;
  color:var(--text)!important;
  border-color:var(--line)!important;
}
body.light-theme .msg-foot,
body.light-theme .msg-foot button,
body.light-theme .msg-copy,
body.light-theme .msg-regenerate{
  color:#667080!important;
}
body.light-theme .settings-backdrop{background:#0007!important}
body.light-theme .settings-card{
  background:#fff!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
}
body.light-theme .settings-name,
body.light-theme .theme-btn{
  background:#f7f8fa!important;
  border-color:var(--line)!important;
}
body.light-theme .settings-name-icon{background:#eceef3!important}
body.light-theme .theme-btn.active{
  background:#eef0ff!important;
}

/* ===== v3.4 final settings architecture ===== */
:root{--message-font-size:15px;--msg-scale:1}
.messages{--msg-scale:1!important}
.msg .msg-body,
.msg .msg-body p,.msg .msg-body li,.msg .msg-body blockquote,
.msg .msg-body td,.msg .msg-body th,.msg .msg-body strong,.msg .msg-body em,
.msg .msg-body a,.msg .msg-body h1,.msg .msg-body h2,.msg .msg-body h3,
.msg .msg-body h4,.msg .msg-body h5,.msg .msg-body h6{
  font-size:calc(var(--message-font-size,15px) * var(--msg-scale,1))!important;
}
.msg .msg-body code,.msg .msg-body pre code{font-size:calc((var(--message-font-size,15px) - 2px) * var(--msg-scale,1))!important}
.settings-save{width:100%;height:50px;margin-top:20px;border:0;border-radius:14px;background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;font-weight:700;font-size:13px;cursor:pointer;box-shadow:0 10px 30px rgba(100,85,220,.2)}
.settings-save:disabled{opacity:.7;cursor:wait}.settings-save.saving{filter:saturate(.7)}

/* Light theme — all primary visible surfaces/text use light tokens. */
html.light-theme,body.light-theme{
 --bg:#f5f6f8!important;--panel:#fff!important;--panel2:#eef1f5!important;
 --line:#d9dee7!important;--text:#20242c!important;--muted:#687181!important;
 --accent:#6657d9!important;--accent2:#4b72d8!important;--good:#16834f!important;--user:#e8efff!important;
 background:var(--bg)!important;color:var(--text)!important;
}
body.light-theme .shell,body.light-theme .main,body.light-theme .chat,body.light-theme .messages{background:transparent!important;color:var(--text)!important}
body.light-theme .sidebar{background:#fff!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .brand strong,body.light-theme .brand small,body.light-theme .side-title,
body.light-theme .nav a,body.light-theme .new-chat,body.light-theme .agent-mini,
body.light-theme .agent-mini b,body.light-theme .agent-mini small,body.light-theme .memory-card,
body.light-theme .memory-card b,body.light-theme .memory-card small,
body.light-theme .account-link,body.light-theme .secure-note,body.light-theme .version{color:var(--text)!important}
body.light-theme .brand small,body.light-theme .side-title,body.light-theme .agent-mini small,
body.light-theme .memory-card small,body.light-theme .secure-note,body.light-theme .version{color:var(--muted)!important}
body.light-theme .nav a,body.light-theme .install-app-link{background:transparent!important;color:var(--text)!important}
body.light-theme .nav a:hover,body.light-theme .nav a.active{background:#eef1f5!important;color:var(--text)!important}
body.light-theme .new-chat,body.light-theme .agent-mini,body.light-theme .memory-card,
body.light-theme .brand-settings{background:#f8f9fb!important;border-color:var(--line)!important}
body.light-theme .topbar{background:#ffffffed!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .top-title b,body.light-theme .top-title span{color:var(--text)!important}
body.light-theme .top-title span{color:var(--muted)!important}
body.light-theme .choose-agent{background:#fff!important;border-color:#cfd5e1!important;color:var(--text)!important}
body.light-theme .quick-grid button{background:#fff!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .quick-grid button:hover{background:#f5f6f9!important}
body.light-theme .msg.user{background:var(--user)!important;border-color:#cbd7f1!important;color:var(--text)!important}
body.light-theme .msg.bot{background:transparent!important;color:var(--text)!important}
body.light-theme .msg-body,body.light-theme .msg-body p,body.light-theme .msg-body li,
body.light-theme .msg-body strong,body.light-theme .msg-body em,body.light-theme .msg-body h1,
body.light-theme .msg-body h2,body.light-theme .msg-body h3,body.light-theme .msg-body h4,
body.light-theme .msg-body a{color:var(--text)!important}
body.light-theme .msg-body pre,body.light-theme .code-wrap{background:#eef1f5!important;border-color:var(--line)!important}
body.light-theme .code-head{background:#e7eaf0!important;border-color:var(--line)!important;color:#596273!important}
body.light-theme .code-head button{background:#fff!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .msg-foot,body.light-theme .msg-time,body.light-theme .msg-copy,body.light-theme .msg-regenerate{color:#667080!important}
body.light-theme .composer-wrap{background:transparent!important}
body.light-theme .composer{background:#fff!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .composer textarea{color:var(--text)!important}
body.light-theme .composer-meta{color:#7b8493!important}
body.light-theme .attach{color:#586272!important}
body.light-theme .chat-icon-btn,body.light-theme .chat-menu-trigger{background:#fff!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .sidebar-bottom{background:#fff!important;color:var(--text)!important}
body.light-theme .sidebar-links{background:transparent!important}
body.light-theme .account-link{background:#f6f7fa!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .settings-card{background:#fff!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .settings-name,body.light-theme .theme-btn{background:#f7f8fa!important;border-color:var(--line)!important;color:var(--text)!important}
body.light-theme .settings-name-copy small,body.light-theme .settings-range-labels{color:var(--muted)!important}
body.light-theme .theme-btn.active{background:#eef0ff!important;border-color:var(--accent)!important;color:var(--text)!important}
body.light-theme .settings-close{color:#596273!important}
body.light-theme .sidebar-backdrop{background:rgba(20,25,35,.28)!important}


/* ===== Ferfery 3.4: pages + message font finalization ===== */
/* Settings controls the actual rendered message size, not a separate scale. */
.messages .msg .msg-body{
  font-size:var(--message-font-size,15px)!important;
}
.messages .msg .msg-body p,
.messages .msg .msg-body li,
.messages .msg .msg-body blockquote,
.messages .msg .msg-body td,
.messages .msg .msg-body th,
.messages .msg .msg-body strong,
.messages .msg .msg-body em,
.messages .msg .msg-body a,
.messages .msg .msg-body h1,
.messages .msg .msg-body h2,
.messages .msg .msg-body h3,
.messages .msg .msg-body h4,
.messages .msg .msg-body h5,
.messages .msg .msg-body h6{
  font-size:inherit!important;
}
.messages .msg .msg-body code{font-size:.9em!important}
.messages .msg .msg-body pre code{font-size:.9em!important}

/* Light mode for the About page and Agent-selection modal. */
body.light-theme .about-page{color:var(--text)!important}
body.light-theme .about-card{
  background:#fff!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
  box-shadow:0 18px 55px rgba(35,42,55,.08)!important;
}
body.light-theme .about-card h1,
body.light-theme .about-card>p,
body.light-theme .about-card .about-story b,
body.light-theme .about-card .about-story p{color:var(--text)!important}
body.light-theme .feature-row span{
  background:#f4f6f9!important;
  border-color:#dce1e8!important;
  color:#4d5665!important;
}
body.light-theme .modal{
  color:var(--text)!important;
}
body.light-theme .modal-backdrop{background:rgba(30,35,45,.28)!important}
body.light-theme .modal-card{
  background:#fff!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
  box-shadow:0 25px 80px rgba(30,35,45,.20)!important;
}
body.light-theme .modal-card h2,
body.light-theme .modal-card>p{color:var(--text)!important}
body.light-theme .modal-card>p{color:var(--muted)!important}
body.light-theme .modal-close{color:#596273!important}
body.light-theme .agent-card{
  background:#f7f8fa!important;
  border-color:#dce1e8!important;
  color:var(--text)!important;
}
body.light-theme .agent-card:hover,
body.light-theme .agent-card.selected{
  background:#eef1ff!important;
  border-color:#8f86e8!important;
}
body.light-theme .agent-icon{
  background:#eceff5!important;
  color:#6257c9!important;
}
body.light-theme .agent-copy b{color:var(--text)!important}
body.light-theme .agent-copy small,
body.light-theme .agent-copy em{color:var(--muted)!important}
body.light-theme .agent-copy label i{
  background:#f0efff!important;
  border-color:#d8d3fa!important;
  color:#655bc4!important;
}
body.light-theme .modal-tip{
  background:#f3f5f8!important;
  color:#697282!important;
  border:1px solid var(--line)!important;
}
body.light-theme .humor-setting{color:var(--text)!important}
body.light-theme .humor-setting-head b{color:var(--text)!important}
body.light-theme .humor-setting-head span{color:var(--muted)!important}
body.light-theme .humor-slider{background:#eef1f5!important;border-color:var(--line)!important}
body.light-theme .humor-option{color:#667080!important}
body.light-theme .humor-option.active{background:#fff!important;color:var(--text)!important;box-shadow:0 3px 12px rgba(40,45,60,.10)!important}
body.light-theme .modal .eyebrow{color:#655bc4!important}

/* About/support/auth page shells inherit the active theme. */
body.light-theme .page{color:var(--text)!important}
body.light-theme .page-close{background:#fff!important;color:var(--text)!important;border-color:var(--line)!important}
body.light-theme .support-card,
body.light-theme .support-note,
body.light-theme .bank-card,
body.light-theme .auth-card{
  background:#fff!important;color:var(--text)!important;border-color:var(--line)!important;
}
body.light-theme .support-card p,
body.light-theme .support-note p,
body.light-theme .support-hero p,
body.light-theme .auth-card>p{color:var(--muted)!important}

/* ===== v3.4: pinch-to-resize message text ===== */
.msg.user .msg-body,.msg.bot .msg-body,
.msg.user .msg-body p,.msg.bot .msg-body p,
.msg.user .msg-body li,.msg.bot .msg-body li,
.msg.user .msg-body blockquote,.msg.bot .msg-body blockquote,
.msg.user .msg-body td,.msg.bot .msg-body td,
.msg.user .msg-body th,.msg.bot .msg-body th,
.msg.user .msg-body strong,.msg.bot .msg-body strong,
.msg.user .msg-body em,.msg.bot .msg-body em,
.msg.user .msg-body a,.msg.bot .msg-body a,
.msg.user .msg-body h1,.msg.bot .msg-body h1,
.msg.user .msg-body h2,.msg.bot .msg-body h2,
.msg.user .msg-body h3,.msg.bot .msg-body h3,
.msg.user .msg-body h4,.msg.bot .msg-body h4,
.msg.user .msg-body h5,.msg.bot .msg-body h5,
.msg.user .msg-body h6,.msg.bot .msg-body h6{
  font-size:var(--message-font-size,15px)!important;
}
.msg.user .msg-body pre,.msg.bot .msg-body pre,
.msg.user .msg-body pre code,.msg.bot .msg-body pre code{
  font-size:max(10px,calc(var(--message-font-size,15px) - 2px))!important;
}

/* ===== v3.4 Picasso image agent ===== */
.agents{grid-template-columns:repeat(2,minmax(0,1fr));}
.agent-card{min-width:0;height:100%;}
.picasso-input{color:var(--text)!important;}
.agent-card{padding:9px;gap:8px}.agent-icon{width:34px;height:34px}.agent-copy em{font-size:8px}.agent-copy label i{font-size:7px;padding:2px 5px}.generated-image{border-radius:14px}}

/* ===== v3.4 Picasso image viewer ===== */
.generated-image-wrap{display:flex;align-items:flex-start;width:min(100%,520px);max-width:520px}
.generated-image-button{display:block;padding:0;margin:0;border:0;background:transparent;cursor:pointer;width:100%;text-align:inherit}
.generated-image{display:block;width:auto;max-width:100%;max-height:420px;height:auto;object-fit:contain;border-radius:16px;border:1px solid var(--line);background:#0d1017;box-shadow:0 8px 30px rgba(0,0,0,.16)}
.image-viewer{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:18px;direction:rtl}
.image-viewer.hidden{display:none}
.image-viewer-backdrop{position:absolute;inset:0;background:rgba(7,10,16,.46);backdrop-filter:blur(18px) saturate(135%);-webkit-backdrop-filter:blur(18px) saturate(135%)}
.image-viewer-card{position:relative;z-index:1;width:min(94vw,900px);max-height:94vh;padding:14px;border:1px solid rgba(255,255,255,.18);border-radius:26px;background:rgba(20,24,33,.68);box-shadow:0 30px 90px rgba(0,0,0,.42);backdrop-filter:blur(26px) saturate(150%);-webkit-backdrop-filter:blur(26px) saturate(150%);display:flex;flex-direction:column;align-items:center;gap:12px}
.image-viewer-stage{width:100%;height:min(78vh,760px);display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:18px;background:rgba(0,0,0,.12)}
.image-viewer-stage img{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;border-radius:16px}
.image-viewer-close{position:absolute;top:20px;right:20px;z-index:2;width:42px;height:42px;border-radius:50%;border:1px solid rgba(255,255,255,.28);background:rgba(20,24,32,.72);color:#fff;font-size:28px;line-height:1;cursor:pointer;backdrop-filter:blur(12px)}
.image-viewer-actions{display:flex;align-items:center;justify-content:center;gap:12px;width:100%}
.image-viewer-action{min-width:110px;padding:9px 18px;border:1px solid rgba(255,255,255,.2);border-radius:15px;background:rgba(255,255,255,.08);color:#fff;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer}
.image-viewer-action span{font-size:22px;line-height:1}
.image-viewer-action b{font-size:13px}
body.image-viewer-open{overflow:hidden}
body.light-theme .image-viewer-backdrop{background:rgba(235,239,247,.48)}
body.light-theme .image-viewer-card{background:rgba(255,255,255,.74);border-color:rgba(40,45,55,.15);box-shadow:0 30px 90px rgba(30,40,60,.22)}
body.light-theme .image-viewer-stage{background:rgba(0,0,0,.04)}
body.light-theme .image-viewer-close,body.light-theme .image-viewer-action{background:rgba(30,35,45,.82);color:#fff}
@media(max-width:520px){.generated-image{max-height:390px;border-radius:14px}.image-viewer{padding:10px}.image-viewer-card{width:96vw;max-height:94vh;padding:10px;border-radius:22px}.image-viewer-stage{height:76vh;border-radius:15px}.image-viewer-close{top:14px;right:14px;width:40px;height:40px}.image-viewer-action{min-width:100px}}

/* v3.4 — generated image retention toast */
.ferfery-toast{position:fixed;top:18px;left:50%;transform:translate(-50%,-18px);z-index:12000;opacity:0;pointer-events:none;max-width:min(92vw,520px);padding:12px 18px;border:1px solid rgba(255,255,255,.16);border-radius:16px;background:rgba(20,24,33,.88);color:#fff;box-shadow:0 14px 40px rgba(0,0,0,.3);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);font-size:13px;text-align:center;transition:opacity .22s ease,transform .22s ease}
.ferfery-toast.show{opacity:1;transform:translate(-50%,0)}
body.light-theme .ferfery-toast{background:rgba(255,255,255,.92);color:#20242c;border-color:rgba(40,45,55,.12);box-shadow:0 14px 40px rgba(30,40,60,.2)}
@media(max-width:520px){.ferfery-toast{top:calc(10px + env(safe-area-inset-top));font-size:12px;padding:11px 15px}}

/* v3.4 — supplied SVG controls for image viewer */
.image-viewer-close{display:flex;align-items:center;justify-content:center;padding:0}
.image-viewer-close img{width:100%;height:100%;display:block;object-fit:contain}
.image-viewer-action{min-width:0;width:54px;height:54px;padding:0;border-radius:16px;display:flex;align-items:center;justify-content:center}
.image-viewer-action img{width:30px;height:30px;display:block;object-fit:contain}
@media(max-width:520px){.image-viewer-close{width:42px;height:42px}.image-viewer-action{width:50px;height:50px}.image-viewer-action img{width:28px;height:28px}}
/* v3.4 — icon-only controls: no extra button chrome */
.image-viewer-close{border:0;background:transparent;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none}
.image-viewer-close img{width:42px;height:42px}
.image-viewer-action{border:0;background:transparent;box-shadow:none;padding:0;width:58px;height:58px;border-radius:0}
.image-viewer-action img{width:42px;height:42px}
.image-viewer-action:hover{background:transparent;transform:scale(1.05)}
body.light-theme .image-viewer-close,body.light-theme .image-viewer-action{background:transparent;color:inherit}
@media(max-width:520px){.image-viewer-close img{width:40px;height:40px}.image-viewer-action{width:54px;height:54px}.image-viewer-action img{width:40px;height:40px}}

/* ===== Ferfery 3.4 — coding agent ===== */
.agents{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px!important}
.agent-card{min-width:0!important;width:auto!important}
.code-wrap{box-shadow:0 10px 28px rgba(0,0,0,.18)}
.code-wrap .code-head{direction:ltr}
.code-wrap .code-head>span{font-weight:700;letter-spacing:.2px}
.code-wrap .code-head button{font-family:inherit;cursor:pointer;transition:.15s}
.code-wrap .code-head button:hover{transform:translateY(-1px)}
.code-wrap pre{direction:ltr!important;text-align:left!important;-webkit-overflow-scrolling:touch}
.code-wrap code{direction:ltr!important;text-align:left!important}
.code-wrap .tok-keyword{color:#c792ea}.code-wrap .tok-string{color:#a8d07b}.code-wrap .tok-number{color:#f5a97f}.code-wrap .tok-comment{color:#7f8797}.code-wrap .tok-function{color:#82aaff}.code-wrap .tok-tag{color:#f07178}.code-wrap .tok-attr{color:#ffcb6b}
body.light-theme .code-wrap{background:#f6f7fa;border-color:#d7dbe3;box-shadow:0 8px 24px rgba(20,30,50,.08)}
body.light-theme .code-head{background:#eceff4;border-color:#d7dbe3;color:#50596a}
body.light-theme .code-head button{background:#fff;border-color:#d3d8e1;color:#303746}
body.light-theme .code-wrap code{color:#252a34}
body.light-theme .code-wrap .tok-keyword{color:#7a3fb0}.light-theme .code-wrap .tok-string{color:#26734d}.light-theme .code-wrap .tok-number{color:#a34b1c}.light-theme .code-wrap .tok-comment{color:#727987}.light-theme .code-wrap .tok-function{color:#245fa8}.light-theme .code-wrap .tok-tag{color:#b33b46}.light-theme .code-wrap .tok-attr{color:#8a6500}
@media(max-width:520px){.agents{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px!important}.agent-card{padding:10px!important}.agent-card .agent-copy em{font-size:8px!important}.agent-card .agent-copy label{gap:3px!important}.agent-card .agent-copy label i{font-size:7px!important}}

/* ===== Ferfery 3.4 — professional coding blocks / bidi hardening ===== */
.code-wrap,
.code-wrap *{
  direction:ltr!important;
  unicode-bidi:isolate;
  writing-mode:horizontal-tb;
}
.code-wrap{
  display:block;
  width:100%;
  max-width:100%;
  margin:14px 0;
  overflow:hidden;
  border-radius:15px;
  background:#090c12;
  border:1px solid #2a3040;
  text-align:left!important;
}
.code-head{
  min-height:38px;
  display:flex!important;
  align-items:center;
  justify-content:flex-start!important;
  gap:10px;
  padding:7px 10px!important;
  direction:ltr!important;
  text-align:left!important;
  unicode-bidi:isolate;
  background:#11151e!important;
}
.code-language{font-weight:800;color:#d8dce6;font-size:10px!important;text-transform:lowercase}
.code-filename{color:#727b8d;font-size:9px!important;flex:1;text-align:left!important}
.code-tools{display:flex!important;gap:6px;direction:ltr!important;margin-left:auto}
.code-head button{
  display:inline-flex!important;
  align-items:center;
  gap:4px;
  direction:ltr!important;
  unicode-bidi:isolate;
  min-height:28px;
  border:1px solid #303747!important;
  background:#191e29!important;
  color:#d4d9e4!important;
  border-radius:8px!important;
  padding:4px 8px!important;
  font:700 9px/1 ui-monospace,SFMono-Regular,Menlo,monospace!important;
}
.code-head button:hover{background:#222937!important;border-color:#4a5368!important}
.code-wrap pre,
.code-wrap pre code{
  display:block;
  margin:0!important;
  padding:14px!important;
  direction:ltr!important;
  text-align:left!important;
  unicode-bidi:plaintext!important;
  writing-mode:horizontal-tb!important;
  white-space:pre!important;
  word-break:normal!important;
  overflow-wrap:normal!important;
  tab-size:2;
  font:13px/1.75 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace!important;
  letter-spacing:0!important;
}
.code-wrap pre{overflow:auto!important;max-height:560px!important;-webkit-overflow-scrolling:touch}
.code-wrap code{color:#dce3ee!important;background:transparent!important;border:0!important}
.code-wrap .tok-keyword{color:#c792ea!important}.code-wrap .tok-string{color:#a8d07b!important}.code-wrap .tok-number{color:#f5a97f!important}.code-wrap .tok-comment{color:#7f899b!important}.code-wrap .tok-function{color:#82aaff!important}.code-wrap .tok-tag{color:#f07178!important}.code-wrap .tok-attr{color:#ffcb6b!important}
body.light-theme .code-wrap{background:#f7f8fa!important;border-color:#d8dde6!important}
body.light-theme .code-head{background:#eceff4!important;border-color:#d8dde6!important}
body.light-theme .code-language{color:#2b313c!important}
body.light-theme .code-filename{color:#707887!important}
body.light-theme .code-head button{background:#fff!important;border-color:#d1d6df!important;color:#303746!important}
body.light-theme .code-wrap code{color:#252a34!important}
body.light-theme .code-wrap .tok-keyword{color:#7a3fb0!important}.light-theme .code-wrap .tok-string{color:#26734d!important}.light-theme .code-wrap .tok-number{color:#a34b1c!important}.light-theme .code-wrap .tok-comment{color:#727987!important}.light-theme .code-wrap .tok-function{color:#245fa8!important}.light-theme .code-wrap .tok-tag{color:#b33b46!important}.light-theme .code-wrap .tok-attr{color:#8a6500!important}
@media(max-width:600px){
  .code-head{min-height:36px;padding:6px 8px!important}
  .code-filename{display:none}
  .code-head button span{display:none}
  .code-head button{width:31px;height:27px;justify-content:center;padding:0!important;font-size:12px!important}
  .code-wrap pre,.code-wrap pre code{font-size:12px!important;line-height:1.7!important;padding:12px!important}
}

/* ===== v3.5 sidebar admin tools ===== */
.brand-tools{display:flex;align-items:center;justify-content:flex-start;gap:8px;flex:0 0 auto;order:0;direction:rtl}
.brand-settings,.brand-report{width:32px;height:32px;display:grid;place-items:center;border:0!important;border-radius:0;background:transparent!important;color:var(--muted);padding:5px;transition:opacity .18s ease,transform .18s ease;box-shadow:none!important;outline:none}
.brand-settings:hover,.brand-report:hover{color:var(--text);background:transparent!important;border:0!important;transform:scale(1.06)}
.brand-settings:focus,.brand-report:focus,.brand-settings:focus-visible,.brand-report:focus-visible{outline:none;box-shadow:none!important}
.brand-settings img,.brand-report img{width:20px;height:20px;display:block;object-fit:contain;filter:none;opacity:.9}
body.light-theme .brand-settings,body.light-theme .brand-report{background:transparent!important;border:0!important;color:var(--text)}
body.light-theme .brand-settings img,body.light-theme .brand-report img{filter:brightness(.45);opacity:.9}
@media(max-width:760px){.brand-tools{gap:7px}.brand-settings,.brand-report{width:30px;height:30px;padding:4px}.brand-settings img,.brand-report img{width:19px;height:19px}}


/* ===== v3.9 sidebar admin tools alignment fix ===== */
.brand{position:relative}
.brand-tools{position:absolute;left:5px;top:5px;display:flex!important;align-items:center;justify-content:flex-start;gap:8px;flex:0 0 auto;direction:ltr;z-index:2}
.brand-settings,.brand-report{position:static!important;width:32px!important;height:32px!important;display:grid!important;place-items:center!important;flex:0 0 32px!important;border:0!important;border-radius:0!important;background:transparent!important;color:var(--muted);padding:5px!important;box-shadow:none!important;outline:none}
.brand-settings:hover,.brand-report:hover{color:var(--text);background:transparent!important;border:0!important;transform:scale(1.06)}
.brand-settings:focus,.brand-report:focus,.brand-settings:focus-visible,.brand-report:focus-visible{outline:none;box-shadow:none!important}
.brand-settings img,.brand-report img{width:20px!important;height:20px!important;display:block;object-fit:contain;filter:none;opacity:.9}
body.light-theme .brand-settings,body.light-theme .brand-report{background:transparent!important;border:0!important;color:var(--text)}
body.light-theme .brand-settings img,body.light-theme .brand-report img{filter:brightness(.45);opacity:.9}
@media(max-width:760px){.brand-tools{left:5px;top:5px;gap:7px}.brand-settings,.brand-report{width:30px!important;height:30px!important;flex-basis:30px!important;padding:4px!important}.brand-settings img,.brand-report img{width:19px!important;height:19px!important}}


/* ===== Ferfery 3.14 — shortcuts + agent manager + continue response ===== */
.chat-top-actions .chat-icon-btn{display:grid;place-items:center}
.chat-top-actions #openCommandPalette{font-size:18px;font-weight:700}
.msg-continue{width:24px;height:24px;padding:3px;border:0;background:transparent;color:#7f8899;display:grid;place-items:center;cursor:pointer}
.msg-continue svg{width:18px;height:18px;display:block}
.msg-continue:hover{color:var(--text);transform:rotate(-8deg)}
.agent-manager-subtitle{margin:4px 0 0!important;color:var(--muted);font-size:10px!important}
.agent-search{width:100%;box-sizing:border-box;margin-top:13px;padding:11px 13px;border:1px solid var(--line);border-radius:12px;background:#0b0e14;color:var(--text);outline:none;font:inherit;font-size:11px}
.agent-search:focus{border-color:#5d58a0;box-shadow:0 0 0 3px #6d61ff14}
.command-palette{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:16px}
.command-palette.hidden{display:none}
.command-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.62);backdrop-filter:blur(12px)}
.command-card{position:relative;width:min(620px,100%);max-height:min(760px,88dvh);overflow:auto;background:#0f1219;border:1px solid #2b3140;border-radius:23px;padding:18px;box-shadow:0 30px 100px #000b}
.command-head{display:flex;align-items:flex-start;justify-content:space-between;gap:15px}.command-head h2{margin:5px 0 0;font-size:21px}.command-close{border:0;background:transparent;color:var(--muted);font-size:24px;padding:2px 7px}
.command-search{width:100%;box-sizing:border-box;margin:15px 0 9px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:#0b0e14;color:var(--text);outline:none;font:inherit;font-size:11px}
.command-list{display:grid;gap:6px}.command-list button{display:flex;align-items:center;gap:12px;width:100%;border:1px solid transparent;background:#0b0e14;color:var(--text);padding:12px;border-radius:13px;text-align:right}.command-list button:hover{background:#151925;border-color:#343a4a}.command-list button>b{width:30px;text-align:center;color:#aaa1ff;font-size:17px}.command-list button span{flex:1;font-size:11px}.command-list button span small{display:block;color:var(--muted);font-size:9px;margin-top:3px}.command-list kbd{font:9px ui-monospace,monospace;color:#7f8899;border:1px solid #303647;border-radius:6px;padding:3px 6px;direction:ltr}
.command-hint{text-align:center;color:var(--muted);font-size:9px;margin-top:13px}.command-hint kbd{font:9px ui-monospace,monospace;border:1px solid #303647;border-radius:6px;padding:2px 5px;color:#aab1bf;direction:ltr}
body.command-open{overflow:hidden}
body.light-theme .command-card{background:rgba(255,255,255,.94);border-color:#d7dbe3;box-shadow:0 30px 90px rgba(30,40,60,.2)}
body.light-theme .command-search,body.light-theme .agent-search{background:#fff;border-color:#d7dbe3;color:#20242c}
body.light-theme .command-list button{background:#f5f6f8}.light-theme .command-list button:hover{background:#eceff4;border-color:#d4d9e2}
body.light-theme .command-list kbd,body.light-theme .command-hint kbd{border-color:#d1d6df;color:#555e6d}
@media(max-width:760px){.command-palette{align-items:end;padding:0}.command-card{width:100%;max-height:86dvh;border-radius:24px 24px 0 0;padding:18px 15px calc(18px + env(safe-area-inset-bottom));animation:commandUp .2s ease}.command-list button{padding:13px}.command-list kbd{display:none}}
@keyframes commandUp{from{transform:translateY(35px);opacity:.3}to{transform:translateY(0);opacity:1}}

/* ===== Ferfery 3.14 — mobile command palette trigger ===== */
.chat-top-actions .shortcut-btn{font-size:18px;font-weight:700;line-height:1;letter-spacing:0;color:#aaa1ff}
.chat-top-actions .shortcut-btn:hover{color:var(--text)}
@media(max-width:760px){.chat-top-actions .shortcut-btn{display:grid!important;place-items:center!important;width:42px!important;height:42px!important}}


/* ===== Ferfery 3.14 — compact adaptive composer ===== */
.composer{position:relative;display:flex!important;align-items:flex-end!important;gap:7px!important;}
.composer-tools{display:flex;align-items:flex-end;gap:5px;flex:0 0 auto;direction:ltr;}
.composer-tools .agent-trigger,.composer-tools .composer-shortcut{flex:0 0 40px;width:40px!important;height:40px!important;}
.composer-shortcut{display:grid;place-items:center;border:1px solid #292c37!important;background:#191b24!important;color:#aaa1ff!important;border-radius:14px!important;font-size:18px!important;font-weight:700!important;line-height:1!important;padding:0!important;}
.composer-shortcut:hover{background:#20232e!important;color:var(--text)!important;}
.composer textarea{min-width:0!important;flex:1 1 auto!important;}
.edit-cancel-btn{flex:0 0 40px;width:40px!important;height:40px!important;}

/* When the message grows, the text gets its own full row and every control moves below it. */
.composer.is-multiline{display:grid!important;grid-template-columns:1fr auto;grid-template-rows:auto auto;align-items:end;column-gap:7px;row-gap:6px;}
.composer.is-multiline textarea{grid-column:1 / -1;grid-row:1;width:100%!important;}
.composer.is-multiline .composer-tools{grid-column:1;grid-row:2;justify-self:start;}
.composer.is-multiline #send{grid-column:2;grid-row:2;justify-self:end;}
.composer.is-multiline textarea{padding-top:10px!important;padding-bottom:2px!important;}

/* Do not show the shortcut in the old top toolbar; it now belongs to the composer. */
.chat-top-actions .shortcut-btn{display:none!important;}
@media(max-width:760px){
  .composer{width:100%;}
  .composer-tools .agent-trigger,.composer-tools .composer-shortcut{width:40px!important;height:40px!important;}
  .composer.is-multiline{row-gap:5px;}
  .composer.is-multiline textarea{padding-top:9px!important;padding-bottom:4px!important;}
}




/* ===== Ferfery 3.14 — 10-line mobile composer ===== */
/*
 * The textarea is allowed to grow to its real rendered height. The previous
 * fixed 42px rule is intentionally removed for expanded mode. At ten lines
 * the textarea keeps a fixed maximum height and scrolls internally, with the
 * scrollbar visually hidden.
 */
@media (max-width:760px){
  .composer-wrap{overflow:visible!important;}

  .composer{
    box-sizing:border-box!important;
    width:100%!important;
    height:auto!important;
    min-height:56px!important;
    max-height:none!important;
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    align-items:flex-end!important;
    gap:7px!important;
    padding:7px!important;
    overflow:visible!important;
  }

  .composer textarea{
    box-sizing:border-box!important;
    width:auto!important;
    min-width:0!important;
    min-height:42px!important;
    height:42px!important;
    max-height:42px!important;
    flex:1 1 auto!important;
    margin:0!important;
    padding:8px 8px 4px!important;
    border:0!important;
    resize:none!important;
    overflow:hidden!important;
    line-height:1.7!important;
    direction:rtl!important;
    text-align:right!important;
    vertical-align:top!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
  }
  .composer textarea::-webkit-scrollbar{width:0!important;height:0!important;display:none!important;}

  .composer .composer-tools{
    display:flex!important;
    flex:0 0 auto!important;
    width:auto!important;
    height:40px!important;
    align-items:center!important;
    gap:5px!important;
    margin:0!important;
    order:1!important;
  }

  .composer textarea{order:2!important;}

  .composer .composer-tools .agent-trigger,
  .composer .composer-tools .composer-shortcut,
  .composer #send{
    box-sizing:border-box!important;
    flex:0 0 40px!important;
    width:40px!important;
    min-width:40px!important;
    height:40px!important;
    min-height:40px!important;
    max-height:40px!important;
    margin:0!important;
  }

  .composer #send{order:3!important;}

  /* Expanded mode: text occupies its own row; controls remain INSIDE the box. */
  .composer.is-multiline{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 40px!important;
    grid-template-rows:auto 40px!important;
    align-items:end!important;
    column-gap:7px!important;
    row-gap:8px!important;
    padding:7px!important;
    overflow:visible!important;
  }

  .composer.is-multiline textarea{
    grid-column:1 / -1!important;
    grid-row:1!important;
    width:100%!important;
    min-height:42px!important;
    height:auto!important;
    max-height:none!important;
    padding:8px 8px 4px!important;
    overflow:hidden!important;
    align-self:start!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
  }
  .composer.is-multiline textarea::-webkit-scrollbar{width:0!important;height:0!important;display:none!important;}

  .composer.is-multiline .composer-tools{
    grid-column:1!important;
    grid-row:2!important;
    justify-self:start!important;
    align-self:end!important;
    order:unset!important;
  }

  .composer.is-multiline #send{
    grid-column:2!important;
    grid-row:2!important;
    justify-self:end!important;
    align-self:end!important;
    order:unset!important;
  }
}


/* ===== Ferfery 3.14 — bottom-anchored mobile composer =====
/*
 * The composer must grow upward, never push its own bottom edge down.
 * On mobile the complete composer stack is anchored to the bottom of the
 * chat viewport. The message list receives dynamic bottom space from JS.
 */
@media (max-width:760px){
  .chat{position:relative!important;overflow:hidden!important;}
  .messages{
    padding-bottom:var(--ferfery-composer-space,190px)!important;
    scroll-padding-bottom:var(--ferfery-composer-space,190px)!important;
  }
  .composer-wrap{
    position:absolute!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    top:auto!important;
    width:100%!important;
    margin:0!important;
    flex:none!important;
    z-index:40!important;
    overflow:visible!important;
  }
  .composer-wrap .quick-prompts{max-width:100%!important;}
  .composer-wrap .composer{width:100%!important;}
}

/* ===== Ferfery 3.14 — expanded shortcuts without search ===== */
.command-list{max-height:min(58dvh,560px);overflow-y:auto;overscroll-behavior:contain;padding-right:2px;scrollbar-width:none;}
.command-list::-webkit-scrollbar{width:0;height:0;display:none}
.command-card{overflow:hidden!important;}
@media(max-width:760px){
  .command-card{max-height:88dvh!important;}
  .command-list{max-height:68dvh;overflow-y:auto;scrollbar-width:none;padding-bottom:2px;}
  .command-list button{min-height:52px;}
}

/* ===== Ferfery 3.14 — shortcut list shows 5 items, then scrolls ===== */
.command-list{
  max-height:320px!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  scrollbar-width:none;
}
.command-list::-webkit-scrollbar{width:0;height:0;display:none}
.command-list button{min-height:58px;}
@media(max-width:760px){
  .command-list{max-height:290px!important;overflow-y:auto!important;scrollbar-width:none;}
  .command-list button{min-height:52px;}
}


/* ===== Ferfery 3.14 — final AI message/footer clearance =====
 * The composer is fixed over the bottom of the chat on mobile. A real spacer
 * after the final message guarantees that the complete answer and its actions
 * remain visible and tappable above the quick-response row.
 */
.chat-bottom-spacer{
  display:block!important;
  width:100%!important;
  height:170px!important;
  min-height:170px!important;
  flex:0 0 170px!important;
  pointer-events:none!important;
}
@media(max-width:760px){
  .messages{
    padding-bottom:calc(var(--ferfery-composer-space,190px) + 30px)!important;
    scroll-padding-bottom:calc(var(--ferfery-composer-space,190px) + 30px)!important;
    overflow-anchor:none!important;
  }
  .quick-prompts{margin-top:14px!important;}
}
