@font-face{font-family:"Tiempos Text";src:url("./tiempostext.otf") format("opentype");font-weight:400;font-style:normal;font-display:swap}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
:root{--bg:#fafaf7;--text:#1b1b1a;--muted:#8e8e88;--line:#e5e4de;--soft:#f0f0eb;--accent:#d97757;--danger:#d34b45;--code:#f3f3ee}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:var(--bg);color:var(--text)}
body,button,input,textarea,select{font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Helvetica Neue","Segoe UI",sans-serif}
button{color:inherit}.screen{position:fixed;inset:0;background:var(--bg)}[hidden]{display:none!important}.center{display:flex;align-items:center;justify-content:center;padding:24px}
.login-card{width:min(330px,100%);text-align:center}.app-mark{width:64px;height:64px;margin:0 auto 18px;border-radius:19px;background:var(--accent);color:white;font:42px/64px Georgia,serif}.login-card h1{font:32px/1.1 "Tiempos Text",Georgia,serif;margin:0}.login-card p{color:var(--muted);margin:8px 0 26px}.login-card input{width:100%;border:1px solid var(--line);background:white;border-radius:15px;padding:13px 15px;font-size:17px;outline:none}.primary{width:100%;border:0;border-radius:15px;padding:13px;margin-top:10px;background:var(--accent);color:white;font-size:16px}.form-error{min-height:22px;color:var(--danger);font-size:13px;margin-top:8px}
#app{display:flex;flex-direction:column}.header{position:absolute;z-index:20;top:0;left:0;right:0;padding:calc(env(safe-area-inset-top) + 16px) 14px 8px;display:flex;align-items:center;justify-content:space-between;pointer-events:none}.header>*{pointer-events:auto}.glass-zone{isolation:isolate}.glass-button{border:1px solid rgba(255,255,255,.74);background:rgba(255,255,255,.42);backdrop-filter:blur(2px) saturate(140%);-webkit-backdrop-filter:blur(2px) saturate(140%);box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 6px 17px rgba(40,39,34,.09);border-radius:22px}.round{width:44px;height:44px;padding:0;display:grid;place-items:center}.round svg{width:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}.tabs{display:flex;padding:2px}.tab{width:48px;height:38px;border:0;background:transparent;border-radius:20px;color:var(--muted);font-size:15px}.tab.active{background:rgba(255,255,255,.69);color:var(--text);box-shadow:inset 0 1px 0 white,0 2px 8px rgba(30,30,25,.07)}.session-pill{height:44px;min-width:74px;max-width:125px;padding:0 14px;border-radius:22px;display:flex;align-items:center;justify-content:center;gap:7px}.session-pill span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-pill i{width:7px;height:7px;border-radius:50%;background:#bbb;flex:0 0 auto}.session-pill i.on{background:#72a57b}
.view{display:none;position:absolute;inset:0}.view.active{display:flex;flex-direction:column}.messages{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:calc(env(safe-area-inset-top) + 76px) 0 calc(env(safe-area-inset-bottom) + 124px);scroll-behavior:smooth}.msg{padding:5px 16px}.msg.user{display:flex;justify-content:flex-end}.bubble{max-width:86%;padding:10px 15px;border-radius:20px;background:var(--soft);font-size:17px;line-height:1.55;white-space:pre-wrap;word-break:break-word}.image-row{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end;margin-bottom:6px}.chat-image{width:126px;height:126px;object-fit:cover;border-radius:15px}.msg.assistant{padding-top:10px;padding-bottom:10px}.assistant-text{font:17px/1.72 "Tiempos Text",Georgia,serif;word-break:break-word}.assistant-text p{margin:0 0 9px}.assistant-text p:last-child{margin-bottom:0}.assistant-text pre,.sheet-body pre{overflow:auto;background:var(--code);border-radius:12px;padding:12px;white-space:pre-wrap}.assistant-text code,.sheet-body code{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);border-radius:5px;padding:2px 4px}.assistant-text pre code,.sheet-body pre code{padding:0;background:none}.assistant-text blockquote{border-left:3px solid var(--line);padding-left:12px;color:var(--muted);margin-left:0}.thought-row,.tool-row{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:13px;line-height:1.4;padding:7px 0;cursor:pointer}.thought-row span,.tool-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.thought-row svg,.tool-row svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;flex:none}.dots{display:inline-flex;gap:3px}.dots i{width:4px;height:4px;border-radius:50%;background:var(--accent);animation:pulse 1.1s infinite ease-in-out}.dots i:nth-child(2){animation-delay:.15s}.dots i:nth-child(3){animation-delay:.3s}@keyframes pulse{0%,70%,100%{opacity:.2;transform:translateY(0)}35%{opacity:1;transform:translateY(-2px)}}
.typing{position:absolute;left:20px;bottom:calc(env(safe-area-inset-bottom) + 100px);display:flex;align-items:center;gap:7px;color:var(--muted);font-size:13px}.composer-wrap{position:absolute;left:10px;right:10px;bottom:calc(env(safe-area-inset-bottom) + 8px);z-index:18}.glass-composer{display:flex;align-items:flex-end;gap:7px;padding:7px;background:rgba(255,255,255,.57);border:1px solid rgba(255,255,255,.82);border-radius:27px;backdrop-filter:blur(5px) saturate(150%);-webkit-backdrop-filter:blur(5px) saturate(150%);box-shadow:inset 0 1px 0 rgba(255,255,255,.95),0 8px 24px rgba(35,34,30,.10)}.composer textarea{flex:1;border:0;outline:0;background:transparent;resize:none;font-size:17px;line-height:22px;max-height:132px;min-height:36px;padding:7px 2px}.composer-button{width:38px;height:38px;border:0;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;font-size:25px}.composer-button.attach{background:rgba(220,220,215,.53);font-weight:200}.composer-button.send{background:var(--text);color:white}.composer-button.send:disabled{background:#c9c9c4}.composer-button svg{width:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.preview-strip{display:flex;gap:7px;overflow-x:auto;padding:0 8px 7px}.preview{position:relative;flex:none}.preview img{width:62px;height:62px;border-radius:13px;object-fit:cover}.preview button{position:absolute;right:-4px;top:-4px;border:0;width:20px;height:20px;border-radius:50%;background:#333;color:white}.jump-bottom{display:none;position:absolute;right:18px;bottom:calc(env(safe-area-inset-bottom) + 108px);z-index:19;width:38px;height:38px;border-radius:50%;font-size:18px}.jump-bottom.show{display:block}
.attach-menu{position:fixed;z-index:105;left:10px;right:10px;bottom:calc(env(safe-area-inset-bottom) + 10px);padding:8px;border-radius:22px;background:rgba(250,250,247,.96);box-shadow:0 12px 40px rgba(0,0,0,.18);backdrop-filter:blur(18px)}.attach-menu button{display:block;width:100%;border:0;border-bottom:1px solid var(--line);background:transparent;padding:13px;font-size:16px}.attach-menu button:last-child{border-bottom:0}.attach-menu .muted{color:var(--muted)}
.terminal-view{background:#171717;color:#e8e8e8;padding:calc(env(safe-area-inset-top) + 78px) 13px calc(env(safe-area-inset-bottom) + 62px)}.terminal-view pre{flex:1;margin:0;overflow:auto;white-space:pre-wrap;font:12px/1.48 ui-monospace,SFMono-Regular,Menlo,monospace}.terminal-keys{position:absolute;left:8px;right:8px;bottom:calc(env(safe-area-inset-bottom) + 5px);display:flex;gap:5px;padding:5px;overflow-x:auto}.terminal-keys button{height:38px;min-width:42px;border:1px solid rgba(255,255,255,.12);border-radius:11px;background:#303030;color:white}.terminal-keys .key-wide{min-width:70px}
.mask,.sheet-mask{position:fixed;inset:0;background:rgba(0,0,0,.28);opacity:0;pointer-events:none;transition:opacity .25s}.mask{z-index:80}.sheet-mask{z-index:100}.mask.show,.sheet-mask.show{opacity:1;pointer-events:auto}.drawer{position:fixed;z-index:81;inset:0 auto 0 0;width:min(82vw,330px);display:flex;flex-direction:column;background:var(--bg);padding:calc(env(safe-area-inset-top) + 16px) 8px calc(env(safe-area-inset-bottom) + 10px);transform:translateX(-103%);transition:transform .28s cubic-bezier(.2,0,0,1)}.drawer.show{transform:none;box-shadow:3px 0 24px rgba(0,0,0,.12)}.drawer-title{font:23px/1.2 "Tiempos Text",Georgia,serif;padding:9px 13px 18px}.drawer-label{color:var(--muted);font-size:12px;padding:8px 13px}.drawer-item,.drawer-session{width:100%;border:0;background:transparent;border-radius:12px;padding:12px;display:flex;align-items:center;justify-content:space-between;text-align:left;font-size:15px}.drawer-session.active,.drawer-item:active,.drawer-session:active{background:var(--soft)}.drawer-session i{width:8px;height:8px;border-radius:50%;background:#c9c9c3}.drawer-session i.on{background:#72a57b}.drawer-spacer{flex:1}.drawer-item.muted{color:var(--muted)}
.page{position:fixed;z-index:90;inset:0;background:var(--bg);overflow:hidden}.page-head{height:calc(env(safe-area-inset-top) + 62px);padding:env(safe-area-inset-top) 14px 0;display:grid;grid-template-columns:60px 1fr 60px;align-items:center;border-bottom:1px solid var(--line);background:rgba(250,250,247,.9);backdrop-filter:blur(12px)}.page-head h2{text-align:center;font-size:17px;margin:0}.page-head button{border:0;background:none;font-size:32px;text-align:left}.page-head .text-button{font-size:14px;color:var(--accent);text-align:right}.photo-grid{height:calc(100% - env(safe-area-inset-top) - 62px);overflow-y:auto;padding:4px;display:grid;grid-template-columns:repeat(3,1fr);align-content:start;gap:3px}.photo-cell{position:relative;aspect-ratio:1;background:var(--soft);overflow:hidden}.photo-cell img{width:100%;height:100%;object-fit:cover}.photo-cell.selected:after{content:"✓";position:absolute;right:7px;top:7px;width:24px;height:24px;border-radius:50%;background:var(--accent);color:white;text-align:center;line-height:24px}.session-cards{height:calc(100% - env(safe-area-inset-top) - 62px);overflow-y:auto;padding:15px}.session-card{border:1px solid var(--line);border-radius:18px;padding:15px;margin-bottom:12px;background:rgba(255,255,255,.35)}.session-card h3{margin:0 0 4px;font-size:17px}.session-meta{font-size:12px;color:var(--muted);line-height:1.7}.session-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:12px}.session-actions button{border:1px solid var(--line);background:var(--bg);border-radius:10px;padding:8px 11px}.session-form label{display:block;color:var(--muted);font-size:12px;margin:11px 0 4px}.session-form input,.session-form select{width:100%;border:1px solid var(--line);background:white;border-radius:11px;padding:10px;font-size:15px}
.detail-sheet{position:fixed;z-index:101;left:6px;right:6px;bottom:6px;height:50vh;border-radius:28px;background:white;display:flex;flex-direction:column;transform:translateY(120%);transition:transform .3s cubic-bezier(.2,0,0,1),height .3s,border-radius .3s,left .3s,right .3s,bottom .3s;overflow:hidden}.detail-sheet.show{transform:none;box-shadow:0 -3px 24px rgba(0,0,0,.13)}.detail-sheet.full{left:0;right:0;bottom:0;height:92vh;border-radius:58px 58px 0 0}.sheet-handle{width:38px;height:5px;background:#deded9;border-radius:5px;margin:9px auto 3px;flex:none}.detail-sheet h2{font-size:16px;text-align:center;margin:9px 16px}.sheet-body{flex:1;overflow-y:auto;padding:12px 20px calc(env(safe-area-inset-bottom) + 22px);font:17px/1.55 "Tiempos Text",Georgia,serif;word-break:break-word}.tool-label{font:12px/1.4 system-ui;color:var(--muted);margin:16px 0 5px}.tool-pre{font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);border-radius:12px;padding:12px;white-space:pre-wrap;word-break:break-word}
.photo-viewer{position:fixed;z-index:120;inset:0;background:rgba(0,0,0,.93);display:flex;flex-direction:column;align-items:center;justify-content:center;color:white;padding:50px 14px}.photo-viewer img{max-width:100%;max-height:74vh;object-fit:contain}.photo-viewer>button{position:absolute;border:0;background:rgba(255,255,255,.15);color:white}.photo-viewer #closeViewer{right:15px;top:calc(env(safe-area-inset-top) + 12px);width:40px;height:40px;border-radius:50%;font-size:24px}.photo-viewer #deletePhoto{right:18px;bottom:calc(env(safe-area-inset-bottom) + 18px);padding:10px 14px;border-radius:10px;background:var(--danger)}#viewerInfo{margin-top:12px;font-size:12px;color:#bbb}.toast{position:fixed;z-index:200;left:50%;bottom:calc(env(safe-area-inset-bottom) + 86px);transform:translate(-50%,20px);opacity:0;background:#2c2c2a;color:white;padding:9px 14px;border-radius:20px;font-size:13px;transition:.2s;pointer-events:none}.toast.show{opacity:1;transform:translate(-50%,0)}
@media(min-width:700px){.messages{padding-left:max(0px,calc((100vw - 720px)/2));padding-right:max(0px,calc((100vw - 720px)/2))}.composer-wrap{left:max(10px,calc((100vw - 700px)/2));right:max(10px,calc((100vw - 700px)/2))}}
