:root{
  --brand:#0f8f80; --brand-d:#0b5f59; --brand-l:#e3f4f1; --ink:#1f2933; --muted:#6b7280; --bg:#fbfaf7; --card:#ffffff; --line:#e6e2d9;
  --danger:#c93a3a; --sel:#1e90ff; --bar:0px; --sa-b:env(safe-area-inset-bottom,0px); --sa-t:env(safe-area-inset-top,0px);
  --font:"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--ink);font-family:var(--font);font-size:16px;overscroll-behavior:none}
#app{position:fixed;inset:0}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;padding:0}
button:disabled{opacity:.35;cursor:default}
input,textarea,select{font:inherit;color:inherit}
.muted{color:var(--muted);font-size:.9rem}
.ic{display:block;flex:none}
hr{border:0;border-top:1px solid var(--line);margin:8px 0}

/* botões e campos */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:12px;background:#eef0f2;font-weight:600}
.btn.primary{background:var(--brand);color:#fff}
.btn.danger{background:#fde8e8;color:var(--danger)}
.btn.small{min-height:38px;padding:0 14px;font-size:.92rem}
.btn.big{min-height:52px;width:100%;font-size:1.05rem}
input[type=text],input[type=password],input[type=search],textarea,select{width:100%;padding:12px 14px;border:1.5px solid var(--line);border-radius:12px;background:#fff;outline:none}
input:focus,textarea:focus,select:focus{border-color:var(--brand)}
textarea{resize:vertical;min-height:90px}
.seg{display:flex;flex-wrap:wrap;gap:6px}
.seg.tabs button{flex:1}.seg button{flex:1 1 auto;min-height:40px;padding:0 12px;border-radius:10px;background:#eef0f2;font-weight:600;font-size:.9rem;white-space:nowrap}
.seg button.on{background:var(--brand);color:#fff}

/* avisos e janelas */
#toast{position:fixed;left:50%;bottom:calc(86px + var(--sa-b));transform:translate(-50%,20px);background:#1f2933;color:#fff;padding:12px 18px;border-radius:12px;max-width:min(92vw,520px);text-align:center;opacity:0;pointer-events:none;transition:.25s;z-index:100;font-size:.95rem}
#toast.on{opacity:1;transform:translate(-50%,0)}
.modal-back{position:fixed;inset:0;background:rgba(15,23,32,.45);display:flex;align-items:center;justify-content:center;z-index:60;padding:16px}
.modal{background:#fff;border-radius:18px;width:min(92vw,400px);max-height:88vh;display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,.3);padding:18px 18px 14px}
.modal.wide{width:min(94vw,560px)}
.modal h3{margin:0 0 10px;font-size:1.12rem}
.modal-body{overflow:auto;display:flex;flex-direction:column;gap:10px;min-height:0}
.modal-body p{margin:0 0 6px;line-height:1.45}
.modal-btns{display:flex;justify-content:flex-end;gap:8px;margin-top:14px;flex-wrap:wrap}
.menu-list{display:flex;flex-direction:column}
.menu-list button{display:flex;align-items:center;gap:14px;text-align:left;padding:12px 6px;border-radius:10px;min-height:52px}
.menu-list button:active,.menu-list button:hover{background:var(--brand-l)}
.menu-list button span{display:flex;flex-direction:column}
.menu-list small{color:var(--muted);font-size:.82rem;font-weight:400}
.menu-list button.dis{opacity:.45}
.menu-list button.danger{color:var(--danger)}
.shrow{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 0;border-bottom:1px solid var(--line)}
.shrow small{color:var(--muted)}
.modal .row{display:flex;gap:8px}
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:80;display:flex;align-items:center;justify-content:center}
.lightbox img{max-width:96vw;max-height:92vh;border-radius:8px}
.lightbox .ib{position:absolute;top:calc(12px + var(--sa-t));right:12px;color:#fff;background:rgba(255,255,255,.18)}
.ib{width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border-radius:12px;flex:none}
.ib:active{background:rgba(0,0,0,.07)}
.loading{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:var(--muted)}
.spin{width:38px;height:38px;border:4px solid var(--brand-l);border-top-color:var(--brand);border-radius:50%;animation:sp 0.8s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}

/* login */
.auth{height:100%;overflow:auto;display:flex;align-items:center;justify-content:center;padding:20px;background:linear-gradient(160deg,#e3f4f1 0%,#fbfaf7 55%,#fff4d6 100%)}
.acard{width:min(94vw,380px);background:#fff;border-radius:24px;padding:28px 24px;box-shadow:0 18px 50px rgba(11,95,89,.16);text-align:center}
.alogo{width:84px;height:84px;border-radius:22px;box-shadow:0 8px 22px rgba(11,95,89,.35)}
.acard h1{margin:12px 0 2px;font-size:2rem;color:var(--brand-d);letter-spacing:.5px}
.acard form{display:flex;flex-direction:column;gap:10px;margin-top:14px;text-align:left}
.acard .tabs{margin-top:16px}
.aerr{color:var(--danger);min-height:1.2em;font-size:.9rem}

/* tela inicial */
.home{position:absolute;inset:0;display:flex;flex-direction:column}
.hbar{display:flex;align-items:center;gap:6px;padding:calc(6px + var(--sa-t)) 8px 6px;background:#fff;border-bottom:1px solid var(--line);min-height:60px}
.hlogo{display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.hlogo img{width:32px;height:32px;border-radius:9px}
.hlogo b{font-size:1.35rem;color:var(--brand-d);letter-spacing:.4px}
.hsearch{flex:1;min-width:0;padding:9px 12px}
.hsearch[hidden]{display:none}
.hbar:has(.hsearch:not([hidden])) .hlogo{display:none}
.crumbs{display:flex;align-items:center;gap:6px;padding:10px 16px 2px;font-size:.92rem;color:var(--muted);flex-wrap:wrap}
.crumbs b{color:var(--ink)}
.crumbs button{color:var(--brand);font-weight:600;padding:4px 2px}
.offline{margin:6px 14px 0;background:#fff4d6;border-radius:10px;padding:8px 12px;font-size:.88rem}
.grid{flex:1;overflow:auto;padding:12px 14px 110px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:14px;align-content:start}
.tile{position:relative;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;cursor:pointer;padding:6px}
.tile .tname{font-size:.95rem;line-height:1.25;word-break:break-word;max-width:100%}
.tile.folder .ficon{color:#8fd0f5;width:100%;display:flex;justify-content:center;padding:8px 0 2px}
.tile.folder .ficon svg{fill:#aee1fb;stroke:#6dbbe6;width:84px;height:84px}
.tile.folder.shared .ficon svg{fill:var(--brand-l);stroke:var(--brand)}
.tthumb{position:relative;width:100%;aspect-ratio:8/5;background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.05);display:flex;align-items:center;justify-content:center}
.tthumb img{width:100%;height:100%;object-fit:contain}
.nothumb{color:#c0c7cc}
.badge{position:absolute;left:6px;bottom:6px;background:rgba(15,143,128,.92);color:#fff;border-radius:99px;padding:2px 8px 2px 6px;font-size:.72rem;display:flex;align-items:center;gap:4px}
.tmore{position:absolute;top:2px;right:2px;width:34px;height:34px;border-radius:50%;background:rgba(255,255,255,.88);display:flex;align-items:center;justify-content:center;z-index:2;color:#555}
.empty{grid-column:1/-1;text-align:center;color:var(--muted);padding:60px 20px;line-height:1.6}
.plus{position:absolute;right:18px;bottom:calc(20px + var(--sa-b));width:62px;height:62px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;box-shadow:0 8px 22px rgba(11,95,89,.45)}
.plus:active{transform:scale(.95)}
.drawer-back{position:absolute;inset:0;background:rgba(0,0,0,.4);z-index:20}
.drawer{position:absolute;top:0;bottom:0;left:0;width:min(82vw,310px);background:#fff;z-index:21;transform:translateX(-102%);transition:.25s;box-shadow:none;visibility:hidden;display:flex;flex-direction:column;padding:calc(10px + var(--sa-t)) 10px 10px}
.home.drawer-on .drawer{transform:none;visibility:visible;box-shadow:6px 0 30px rgba(0,0,0,.18)}
.dhead{display:flex;align-items:center;gap:12px;padding:10px 8px 16px;border-bottom:1px solid var(--line);margin-bottom:8px}
.dhead img{width:44px;height:44px;border-radius:12px}
.dhead div{display:flex;flex-direction:column}.dhead small{color:var(--muted)}
.drawer>button{display:flex;align-items:center;gap:14px;padding:13px 10px;border-radius:12px;text-align:left;min-height:50px}
.drawer>button:active{background:var(--brand-l)}
.cnt{margin-left:auto;background:var(--brand);color:#fff;border-radius:99px;min-width:22px;padding:1px 7px;font-size:.8rem;text-align:center}
.cnt:empty{display:none}
.dfoot{margin-top:auto;padding:10px;color:var(--muted);font-size:.8rem}
.tpls{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.tpls button{display:flex;flex-direction:column;gap:4px;text-align:left}
.tpls small{color:var(--muted);font-size:.8rem}

/* editor */
.ed{position:absolute;inset:0;overflow:hidden;user-select:none;-webkit-user-select:none;touch-action:none}
.cv{position:absolute;inset:0;width:100%;height:100%;touch-action:none;display:block}
.topbar{position:absolute;top:0;left:0;right:0;z-index:5;display:flex;align-items:center;gap:0;padding:calc(4px + var(--sa-t)) 4px 4px;background:rgba(255,255,255,.93);backdrop-filter:blur(6px);border-bottom:1px solid var(--line);min-height:52px}
.ed.dark .topbar{background:rgba(31,41,55,.94);color:#f3f4f6;border-color:#374151}
.ttl{flex:1;min-width:0;text-align:left;padding:2px 8px;display:flex;flex-direction:column;justify-content:center;line-height:1.15}
.t1{font-weight:700;font-size:1rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.t2{font-size:.72rem;color:var(--muted)}
.t2.pending,.t2.saving{color:#b7791f}.t2.offline,.t2.conflict{color:var(--danger)}
.fab{position:absolute;z-index:4}
.mic{left:14px;bottom:calc(18px + var(--bar) + var(--sa-b));width:56px;height:56px;border-radius:50%;background:#fff;color:var(--brand-d);display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px rgba(0,0,0,.22)}
.ed.ro .mic{display:none}
.fitwrap{right:14px;bottom:calc(18px + var(--bar) + var(--sa-b));display:flex;align-items:flex-end;gap:6px}
.fabbtn{width:50px;height:50px;border-radius:50%;background:#fff;color:#334155;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px rgba(0,0,0,.2)}
.fabbtn.small{width:34px;height:34px;color:#64748b}
.fitchips{position:absolute;right:0;bottom:60px;display:flex;flex-direction:column;gap:6px;align-items:flex-end}
.fitchips[hidden]{display:none}
.fitchips button{background:#fff;border-radius:99px;padding:9px 16px;font-weight:600;font-size:.9rem;box-shadow:0 4px 12px rgba(0,0,0,.2)}
.fitwrap{flex-direction:row}
.botbar{position:absolute;left:0;right:0;bottom:0;z-index:6;display:none;gap:2px;padding:6px 6px calc(6px + var(--sa-b));background:#fff;border-top:1px solid var(--line);overflow-x:auto;overflow-y:hidden;scrollbar-width:none;box-shadow:0 -4px 18px rgba(0,0,0,.08)}
.botbar::-webkit-scrollbar{display:none}
.has-bar .botbar{display:flex}
.has-bar{--bar:68px}
.ed.dark .botbar{background:#1f2937;color:#f3f4f6;border-color:#374151}
.bb{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:64px;height:56px;padding:2px 6px;border-radius:12px;color:#334155;flex:none}
.ed.dark .bb{color:#e5e7eb}
.bb span{font-size:.7rem;white-space:nowrap;font-weight:600}
.bb:active{background:var(--brand-l)}
.bb.danger{color:var(--danger)}
.barmsg{display:flex;align-items:center;gap:12px;padding:0 10px;font-weight:600;height:56px}
.barmsg .bb{min-width:auto;height:40px;background:#eef0f2;padding:0 14px;flex-direction:row}
.sheet{position:absolute;left:0;right:0;bottom:0;z-index:8;background:#fff;border-radius:18px 18px 0 0;box-shadow:0 -8px 30px rgba(0,0,0,.22);max-height:50vh;display:flex;flex-direction:column;padding-bottom:var(--sa-b)}
.sheet-h{display:flex;align-items:center;justify-content:space-between;padding:6px 8px 2px 18px}
.sheet-b{overflow:auto;padding:4px 16px 14px;display:flex;flex-direction:column;gap:12px}
.sheet .row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.sheet .row.col{flex-direction:column;align-items:stretch;gap:6px}
.sheet .row.col>span,.sheet .row>span{font-weight:600;font-size:.9rem;color:#475569}
.sheet .row.tog{display:flex;gap:8px;justify-content:flex-start}
.sheet .row.tog button{width:52px;height:46px;border-radius:12px;background:#eef0f2;font-size:1.1rem}
.sheet .row.tog button.on{background:var(--brand);color:#fff}
.stepper{display:flex;align-items:center;gap:14px}
.stepper button{width:46px;height:42px;border-radius:12px;background:#eef0f2;font-size:1.4rem;font-weight:700}
.stepper b{min-width:30px;text-align:center}
.sw{display:flex;flex-wrap:wrap;gap:10px}
.swb{width:38px;height:38px;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1.5px #cfd4da}
.swb.on{box-shadow:0 0 0 3px var(--sel)}
.swb.auto{width:auto;border-radius:99px;padding:0 14px;background:#eef0f2;font-weight:600;font-size:.85rem}
.sw.big .swb{width:44px;height:44px}
.emojis{display:grid;grid-template-columns:repeat(auto-fill,minmax(46px,1fr));gap:4px}
.emojis button{font-size:1.6rem;height:48px;border-radius:12px}
.emojis button:active{background:var(--brand-l)}
input[type=range]{width:100%;accent-color:var(--brand)}
.inplace{position:fixed;z-index:90;border:3px solid var(--sel);border-radius:14px;padding:6px 14px;background:#fff;color:#111;text-align:center;resize:none;overflow:hidden;outline:none;box-shadow:0 6px 24px rgba(0,0,0,.25);font-family:var(--font);min-height:0}
.voice{position:absolute;inset:0;z-index:30;background:rgba(15,23,32,.55);display:flex;align-items:flex-end;justify-content:center}
.vbox{background:#fff;width:min(100%,560px);border-radius:20px 20px 0 0;padding:20px 20px calc(18px + var(--sa-b));display:flex;flex-direction:column;gap:10px;align-items:center;text-align:center}
.vmic{width:72px;height:72px;border-radius:50%;background:#fde8e8;color:var(--danger);display:flex;align-items:center;justify-content:center;animation:pulse 1.4s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(201,58,58,.45)}100%{box-shadow:0 0 0 24px rgba(201,58,58,0)}}
.vtxt{min-height:48px;max-height:22vh;overflow:auto;font-size:1.05rem;line-height:1.4;width:100%}
.vbox textarea{width:100%}
.vbtns{display:flex;gap:10px;width:100%}.vbtns .btn{flex:1}
.hint{position:absolute;left:0;right:0;top:64px;text-align:center;pointer-events:none;color:var(--muted)}

/* celular deitado: barras mais baixas */
@media (max-height:520px){
  .topbar{min-height:44px;padding-top:calc(2px + var(--sa-t));padding-bottom:2px}.ib{width:40px;height:40px}
  .bb{height:46px;min-width:58px}.bb span{font-size:.65rem}.has-bar{--bar:56px}
  .sheet{max-height:62vh}.mic{width:48px;height:48px}.fabbtn{width:44px;height:44px}
  .grid{grid-template-columns:repeat(auto-fill,minmax(130px,1fr))}
  .modal{max-height:94vh}
  #toast{bottom:calc(70px + var(--sa-b))}
}
@media (min-width:900px){.grid{grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:20px}}
@media print{.topbar,.fab,.botbar{display:none}}

.inplace.live{border:0;border-radius:0;background:transparent;box-shadow:none;margin:0;box-sizing:border-box;min-width:0;min-height:0;overflow:hidden;white-space:pre-wrap;word-break:break-word}
