/* Conversor de PDF · Mundo Valor — app (PWA)
   Mobile-first, sem framework. Cores do logo (30/10/2026): vermelho #D92B26 / #B71F1B, coral #EB625D, rosado #FDECEB,
   texto #1C1C1E, fundos neutros. Como o vermelho é a cor principal, erro é sempre ícone/texto + cor, nunca só cor. */

/* ---------- Fonte: Plus Jakarta Sans (variável 200-800, OFL, fontsource 5.2.8), dentro do app ---------- */
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-weight:200 800;font-display:swap;src:url(./fonts/jakarta-latin-ext.woff2?v=9e50335690) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-weight:200 800;font-display:swap;src:url(./fonts/jakarta-latin.woff2?v=9e50335690) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* ---------- Tokens (nomes do CONTRATO.md; as ferramentas usam só estes) ---------- */
:root{
  --brand:#D92B26; --brand-2:#B71F1B; --brand-soft:#FDECEB; --brand-ink:#fff;
  --gold:#EB625D; --gold-soft:#FBE3E2;
  --bg:#FFFFFF; --bg-outer:#F2F2F6; --card:#FFFFFF; --card-2:#F2F2F6;
  --ink:#1C1C1E; --muted:#6B6B74; --line:#E6E6EB; --line-2:#D0D0D8;
  --ok:#1E9E5A; --ok-soft:#E3F6EB; --ok-ink:#157546;
  --err:#B3261E; --err-soft:#FDE7E7; --err-ink:#8E1C16;
  --warn:#7A5A00;
  --shadow:0 2px 10px rgba(28,28,30,.06),0 1px 2px rgba(28,28,30,.05);
  --shadow-2:0 12px 32px rgba(28,28,30,.18);
  --r:16px; --r-sm:12px;
  --ease:cubic-bezier(.2,.8,.2,1); --dur:240ms;
  --tab-h:62px; --tab-m:12px;
  --sat:env(safe-area-inset-top,0px); --sab:env(safe-area-inset-bottom,0px);
  --fh:'Plus Jakarta Sans',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --ft:'Plus Jakarta Sans',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --tint-a:.14;
  color-scheme:light;
}
html[data-theme="dark"]{
  --brand:#FF6B63; --brand-2:#FF8A84; --brand-soft:#4A1F1D; --brand-ink:#1C1C1E;
  --gold:#F6B8B5; --gold-soft:#4A2A28;
  --bg:#141416; --bg-outer:#0C0C0E; --card:#1E1E21; --card-2:#28282C;
  --ink:#F5F3F2; --muted:#A9A6AD; --line:#333338; --line-2:#45454B;
  --ok:#4FD28E; --ok-soft:#173A2A; --ok-ink:#8FE7BA;
  --err:#FF8A80; --err-soft:#4A2320; --err-ink:#FFB4AD;
  --warn:#F0C45A;
  --shadow:0 2px 10px rgba(0,0,0,.35),0 1px 2px rgba(0,0,0,.3);
  --shadow-2:0 12px 32px rgba(0,0,0,.6);
  --tint-a:.24;
  color-scheme:dark;
}

/* ---------- Base ---------- */
*,*::before,*::after{box-sizing:border-box}
html{height:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{
  margin:0;height:100%;background:var(--bg-outer);color:var(--ink);
  font-family:var(--ft);font-size:16px;line-height:1.45;font-weight:500;
  overscroll-behavior:none;overflow:hidden;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
  -webkit-font-smoothing:antialiased;
}
button{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
a{color:var(--brand);text-decoration:none}
h1,h2,h3{font-family:var(--fh);margin:0;line-height:1.2;letter-spacing:-.02em;font-weight:800}
b,strong{font-weight:700}
p{margin:0}
svg{display:block}
img,canvas{max-width:100%}
:focus{outline:none}
:focus-visible{outline:3px solid var(--brand);outline-offset:2px;border-radius:8px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.noscript{padding:24px;text-align:center}
#app{user-select:none;-webkit-user-select:none}
.selectable,.tela textarea,.tela input,.tela [contenteditable],.res-texto,.info b{user-select:text;-webkit-user-select:text}

/* ---------- Casca do app ---------- */
#app{
  position:relative;height:100vh;height:100dvh;height:var(--app-h,100dvh);max-width:560px;margin:0 auto;
  display:flex;flex-direction:column;background:var(--bg);overflow:hidden;
}
@media (min-width:600px){
  body{background:radial-gradient(1200px 600px at 50% -10%,#FBE3E2 0,var(--bg-outer) 60%)}
  html[data-theme="dark"] body{background:radial-gradient(1200px 600px at 50% -10%,#3A1F1E 0,var(--bg-outer) 60%)}
  #app{box-shadow:0 0 0 1px var(--line),0 20px 60px rgba(28,28,30,.18)}
}
#view{position:relative;flex:1;min-height:0;contain:layout}
.screen{position:absolute;inset:0;display:flex;flex-direction:column;min-height:0}
.scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;scrollbar-width:thin}
.pad{padding:12px 16px 24px}
.screen-tab .pad{padding-top:calc(var(--sat) + 14px);padding-bottom:calc(var(--tab-h) + var(--tab-m) + var(--sab) + 28px)}

/* Barra de abas flutuante e arredondada */
#tabbar{
  position:absolute;left:var(--tab-m);right:var(--tab-m);bottom:calc(var(--sab) + var(--tab-m));
  display:flex;background:var(--card);border:1px solid var(--line);border-radius:22px;height:var(--tab-h);
  box-shadow:var(--shadow-2);z-index:5;padding:4px;
}
#tabbar[hidden]{display:none}
.tab{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border-radius:18px;
  color:var(--muted);font-size:11px;font-weight:600;position:relative;min-width:0;padding:4px 2px;transition:background .2s,color .2s;
}
.tab svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;transition:transform .25s var(--ease)}
.tab span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.tab[aria-current="page"]{color:var(--brand);background:var(--brand-soft);font-weight:700}
.tab:active{background:var(--card-2)}
.tab:active svg{transform:scale(.9)}

/* ---------- Esqueleto ---------- */
.sk{background:var(--card-2);border-radius:var(--r);position:relative;overflow:hidden}
.sk::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.4),transparent);animation:sk 1.3s infinite}
html[data-theme="dark"] .sk::after{background:linear-gradient(90deg,transparent,rgba(255,255,255,.06),transparent)}
@keyframes sk{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
.sk-top{height:20px;width:40%;margin:8px 0 10px}
.sk-title{height:36px;width:55%;margin-bottom:18px}
.sk-card{height:120px;margin-bottom:18px}
.sk-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.sk-tile{height:108px}

/* ---------- Componentes do contrato ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:52px;padding:0 18px;border-radius:16px;
  font-weight:700;font-size:16px;font-family:var(--ft);transition:transform .12s var(--ease),background .15s,opacity .15s;
  width:100%;background:var(--brand);color:var(--brand-ink);
}
.btn:active{transform:scale(.97)}
.btn:not([disabled]):not(.sec):active{background:var(--brand-2)}
.btn[disabled]{opacity:.45;cursor:default;transform:none}
.btn.sec{background:transparent;border:1.5px solid var(--line-2);color:var(--ink)}
.btn.sec:active{background:var(--card-2)}
.btn.suave{background:var(--brand-soft);color:var(--brand)}
.btn.perigo{background:var(--err-soft);color:var(--err-ink)}
.btn.peq{width:auto;min-height:40px;font-size:14px;padding:0 14px;border-radius:12px}
.btn svg{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.btn-ico{width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;color:var(--ink);transition:background .15s,transform .12s;flex:none}
.btn-ico:active{background:var(--brand-soft);transform:scale(.92)}
.btn-ico[aria-pressed="true"]{background:var(--brand-soft);color:var(--brand)}
.btn-ico[disabled]{opacity:.4}
.btn-ico svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

.cartao{background:var(--card);border-radius:20px;box-shadow:var(--shadow);padding:16px;margin-bottom:12px;border:1px solid var(--line)}
.cartao h2{font-size:17px;margin-bottom:8px}
.rotulo{font-family:var(--fh);font-size:17px;font-weight:800;letter-spacing:-.02em;margin:22px 0 10px;display:flex;align-items:center;justify-content:space-between;gap:8px}
.rotulo:first-child{margin-top:4px}
.rotulo button,.rotulo a{font-family:var(--ft);font-size:13px;color:var(--brand);font-weight:700;text-decoration:none;min-height:44px;display:inline-flex;align-items:center;padding:0 8px;margin:-11px -8px}
.ajuda{font-size:13px;color:var(--muted);line-height:1.45}
.ajuda.err{color:var(--err-ink)}
.aviso{display:flex;gap:10px;align-items:flex-start;background:var(--gold-soft);color:var(--warn);border-radius:var(--r-sm);padding:12px 14px;font-size:14px;line-height:1.45;margin:10px 0}
.aviso::before{content:"";flex:none;width:20px;height:20px;margin-top:1px;background:currentColor;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 20h19z'/%3E%3Cpath d='M12 10v4M12 17.5v.5'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 20h19z'/%3E%3Cpath d='M12 10v4M12 17.5v.5'/%3E%3C/svg%3E") center/contain no-repeat}
.vazio{text-align:center;padding:32px 16px;color:var(--muted);font-size:15px}
.vazio .big{width:72px;height:72px;margin:0 auto 14px;border-radius:22px;background:var(--brand-soft);color:var(--brand);display:flex;align-items:center;justify-content:center}
.vazio .big svg{width:36px;height:36px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.vazio h2{color:var(--ink);font-size:18px;margin-bottom:6px}

.opcoes{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:8px 0 12px}
.opc{
  display:flex;flex-direction:column;gap:4px;text-align:left;background:var(--card);border:2px solid var(--line);border-radius:14px;padding:12px;
  min-height:72px;transition:border-color .15s,background .15s,transform .12s var(--ease);box-shadow:var(--shadow);min-width:0;
}
.opc:active{transform:scale(.97)}
.opc b{font-size:15px;line-height:1.25}
.opc small{font-size:12.5px;color:var(--muted);line-height:1.35}
.opc[aria-pressed="true"]{border-color:var(--brand);background:var(--brand-soft)}
.opc[aria-pressed="true"] b{color:var(--brand)}
.opc svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;color:var(--brand)}

.seg{display:flex;background:var(--card-2);border-radius:12px;padding:3px;gap:2px}
.seg button{flex:1;min-height:44px;padding:0 10px;border-radius:10px;font-size:14px;font-weight:600;color:var(--muted);transition:background .15s,color .15s;white-space:nowrap}
.seg button[aria-pressed="true"]{background:var(--card);color:var(--brand);box-shadow:var(--shadow)}

.campo{display:flex;flex-direction:column;gap:6px;margin:0 0 14px}
.campo label{font-size:13px;font-weight:700;color:var(--muted)}
.campo input,.campo select,.campo textarea{
  width:100%;min-height:48px;padding:10px 14px;border-radius:12px;border:1.5px solid var(--line-2);background:var(--card);color:var(--ink);
  font:inherit;font-size:16px;appearance:none;-webkit-appearance:none;
}
.campo textarea{min-height:140px;line-height:1.5;resize:vertical}
.campo input:focus,.campo select:focus,.campo textarea:focus{border-color:var(--brand);outline:none;box-shadow:0 0 0 3px var(--brand-soft)}
.campo input[type="range"]{min-height:32px;padding:0;border:0;background:transparent;box-shadow:none;accent-color:var(--brand)}
.campo input[type="color"]{padding:4px;width:56px;min-height:44px}
.campo input[type="checkbox"]{width:22px;height:22px;min-height:0;padding:0;accent-color:var(--brand)}
.campo.linha{flex-direction:row;align-items:center;justify-content:space-between;gap:12px}
.campo.linha label{color:var(--ink);font-size:15px;font-weight:600}

.lista-arq{display:flex;flex-direction:column;gap:8px}
.item-arq{
  display:flex;align-items:center;gap:12px;width:100%;text-align:left;background:var(--card);border:1px solid var(--line);
  border-radius:var(--r);padding:10px 12px;min-height:72px;box-shadow:var(--shadow);transition:transform .12s var(--ease),background .15s;min-width:0;
}
button.item-arq:active{transform:scale(.985);background:var(--card-2)}
.item-arq .mini{width:48px;height:64px;flex:none;border-radius:8px;background:var(--card-2);overflow:hidden;display:flex;align-items:center;justify-content:center;border:1px solid var(--line);position:relative}
.item-arq .mini img,.item-arq .mini canvas{width:100%;height:100%;object-fit:cover;display:block}
.item-arq .mini svg{width:24px;height:24px;color:var(--muted);fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.item-arq .mini .ext{position:absolute;left:0;right:0;bottom:0;font-size:9px;font-weight:800;letter-spacing:.5px;text-align:center;padding:1px 0;background:var(--brand);color:var(--brand-ink)}
.item-arq .info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.item-arq .info b{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}
.item-arq .info small{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item-arq .acoes{flex:none;display:flex;align-items:center;gap:2px}
.item-arq .acoes .btn-ico{width:40px;height:40px}

.grade-pag{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:8px 0}
@media (min-width:480px){.grade-pag{grid-template-columns:repeat(4,1fr)}}
.pag{
  position:relative;background:var(--card);border:2px solid var(--line);border-radius:12px;padding:6px;min-height:120px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  transition:border-color .15s,transform .12s var(--ease);box-shadow:var(--shadow);min-width:0;
}
.pag:active{transform:scale(.97)}
.pag canvas,.pag img{max-width:100%;height:auto;border-radius:4px;box-shadow:0 1px 3px rgba(0,0,0,.15);display:block}
.pag .num{font-size:12px;font-weight:700;color:var(--muted);line-height:1}
.pag.sel{border-color:var(--brand);background:var(--brand-soft)}
.pag.sel::after{content:"";position:absolute;top:6px;right:6px;width:22px;height:22px;border-radius:50%;background:var(--brand);box-shadow:0 1px 4px rgba(0,0,0,.25);
  -webkit-mask:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");background-size:14px;background-repeat:no-repeat;background-position:center}
html[data-theme="dark"] .pag.sel::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231C1C1E' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")}
.pag.arrastando{opacity:.5}

.barra-ferr{display:flex;gap:6px;overflow-x:auto;padding:6px 16px 10px;margin:0 -16px;scrollbar-width:none;-webkit-overflow-scrolling:touch;align-items:stretch}
.barra-ferr::-webkit-scrollbar{display:none}
.barra-ferr > button{flex:none;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:56px;min-height:52px;padding:4px 8px;border-radius:12px;font-size:11px;font-weight:600;color:var(--muted);transition:background .15s,color .15s}
.barra-ferr > button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.barra-ferr > button[aria-pressed="true"]{background:var(--brand-soft);color:var(--brand)}
.barra-ferr > .btn-ico{border-radius:12px;min-width:44px}

/* Estado vazio padrão (MVPDF.areaEscolha) */
.area-escolha{
  display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;padding:28px 18px;margin:8px 0 14px;
  border:2px dashed var(--line-2);border-radius:20px;background:var(--card);transition:border-color .15s,background .15s;
}
.area-escolha.sobre{border-color:var(--brand);background:var(--brand-soft)}
.area-escolha .big{width:72px;height:72px;border-radius:22px;background:var(--brand-soft);color:var(--brand);display:flex;align-items:center;justify-content:center;margin-bottom:4px}
.area-escolha .big svg{width:36px;height:36px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.area-escolha h2{font-size:18px}
.area-escolha p{color:var(--muted);font-size:14px;max-width:300px}
.area-escolha .btn{margin-top:8px;max-width:280px}

/* ---------- Cabeçalhos ---------- */
.tabhead{margin:4px 0 18px}
.tabhead .marca{display:flex;align-items:center;gap:7px;font-family:var(--fh);font-weight:700;font-size:13px;color:var(--muted);margin-bottom:8px}
.tabhead .marca svg{width:22px;height:25px}
.tabhead h1{font-size:34px;font-weight:800;letter-spacing:-.03em}
.tabhead p{color:var(--muted);font-size:14px;margin-top:4px}

/* Topo de tela interna (ferramenta, resultado) */
.top{
  flex:none;display:flex;align-items:center;gap:4px;padding:calc(var(--sat) + 6px) 8px 6px;
  background:var(--bg);border-bottom:1px solid var(--line);min-height:calc(var(--sat) + 56px);
}
.top .ttl{flex:1;min-width:0;font-family:var(--fh);font-size:17px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:8px}
.top .btn-ico + .ttl{padding-left:2px}

/* Barra inferior de ação (botão principal na altura do polegar) */
.acao{flex:none;display:flex;flex-direction:column;gap:8px;padding:10px 16px calc(var(--sab) + 12px);background:var(--bg);border-top:1px solid var(--line)}
.acao:empty{display:none}
.acao .btn{min-height:54px;font-size:16px;border-radius:16px;box-shadow:0 8px 20px rgba(217,43,38,.22)}
.acao .btn.sec{box-shadow:none}
html[data-theme="dark"] .acao .btn{box-shadow:0 8px 20px rgba(0,0,0,.4)}

/* ---------- Início ---------- */
.abrir{
  position:relative;overflow:hidden;display:flex;align-items:center;gap:14px;width:100%;text-align:left;
  background:linear-gradient(135deg,var(--brand) 0%,var(--brand-2) 100%);color:#fff;border-radius:20px;padding:18px;
  box-shadow:0 10px 24px rgba(217,43,38,.26);transition:transform .12s var(--ease);margin-bottom:6px;
}
html[data-theme="dark"] .abrir{background:linear-gradient(135deg,#E0433E 0%,#B71F1B 100%);box-shadow:0 10px 24px rgba(0,0,0,.4)}
.abrir:active{transform:scale(.98)}
.abrir::after{content:"";position:absolute;right:-50px;top:-60px;width:180px;height:180px;border-radius:50%;background:rgba(255,255,255,.09)}
.abrir .big{flex:none;width:54px;height:54px;border-radius:16px;background:rgba(255,255,255,.18);display:flex;align-items:center;justify-content:center}
.abrir .big svg{width:28px;height:28px;fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.abrir .tx{flex:1;min-width:0;position:relative}
.abrir .tx b{display:block;font-family:var(--fh);font-size:18px;margin-bottom:2px}
.abrir .tx span{font-size:13.5px;opacity:.9;display:block;line-height:1.35}
.abrir .seta{flex:none;width:22px;height:22px;fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;opacity:.85;position:relative}
/* Leitor em destaque no Início: mesmo cartão, versão clara (rosado) para não brigar com o "Abrir arquivo" */
.privado{display:flex;align-items:center;justify-content:center;gap:6px;font-size:12.5px;color:var(--muted);margin:14px 0 2px;text-align:center}
.privado svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* Grade de ferramentas (3 colunas, cartões cinza-claro, ícone colorido, rótulo de 2 linhas) */
.grade-ferr{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.ferr{
  display:flex;flex-direction:column;align-items:center;text-align:center;gap:9px;background:var(--card-2);border-radius:18px;padding:14px 6px 12px;
  min-height:112px;transition:transform .12s var(--ease),background .15s;min-width:0;
}
.ferr:active{transform:scale(.94);background:var(--line)}
.ferr .ico{width:48px;height:48px;border-radius:15px;display:flex;align-items:center;justify-content:center;color:var(--c,var(--brand));background:var(--cs,var(--brand-soft));flex:none}
.ferr .ico svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.ferr b{font-size:12.5px;line-height:1.25;font-weight:700;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.5em}
/* Botão flutuante "+" (abrir arquivo) no Início, acima da barra de abas */
.fab{
  position:absolute;right:18px;bottom:calc(var(--tab-h) + var(--tab-m) + var(--sab) + 16px);width:58px;height:58px;border-radius:20px;z-index:6;
  background:var(--brand);color:var(--brand-ink);display:flex;align-items:center;justify-content:center;box-shadow:0 10px 24px rgba(217,43,38,.35);
  transition:transform .15s var(--ease),background .15s;
}
.fab:active{transform:scale(.92);background:var(--brand-2)}
.fab svg{width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
html[data-theme="dark"] .fab{box-shadow:0 10px 24px rgba(0,0,0,.5)}
.ferr.off{opacity:.55}

/* Recentes (fileira rolável) */
.recentes{display:flex;gap:10px;overflow-x:auto;padding:2px 16px 8px;margin:0 -16px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.recentes::-webkit-scrollbar{display:none}
.rec{flex:none;width:96px;display:flex;flex-direction:column;gap:6px;text-align:left;min-width:0}
.rec:active .mini{transform:scale(.96)}
.rec .mini{width:96px;height:120px;border-radius:12px;background:var(--card-2);border:1px solid var(--line);overflow:hidden;display:flex;align-items:center;justify-content:center;position:relative;transition:transform .12s var(--ease)}
.rec .mini img,.rec .mini canvas{width:100%;height:100%;object-fit:cover;display:block}
.rec .mini svg{width:28px;height:28px;color:var(--muted);fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.rec .mini .ext{position:absolute;left:0;right:0;bottom:0;font-size:9px;font-weight:800;letter-spacing:.5px;text-align:center;padding:2px 0;background:var(--brand);color:var(--brand-ink)}
.rec b{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rec small{font-size:11px;color:var(--muted);margin-top:-4px}

/* ---------- Arquivos ---------- */
.espaco{font-size:12.5px;color:var(--muted);margin:-8px 0 12px}
.vazio-ilu{width:120px;height:100px;margin:0 auto 14px}

/* ---------- Mais / ajustes ---------- */
.set{display:flex;align-items:center;gap:12px;min-height:56px;padding:8px 0;border-top:1px solid var(--line)}
.set:first-child{border-top:0}
.set .s-b{flex:1;min-width:0}
.set .s-b strong{display:block;font-size:15px}
.set .s-b span{display:block;font-size:13px;color:var(--muted)}
.link{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:52px;padding:8px 0;border-top:1px solid var(--line);color:var(--ink);text-decoration:none;font-size:15px;width:100%;text-align:left}
.link:first-child{border-top:0}
.link.perigo{color:var(--err-ink)}
.link svg{width:20px;height:20px;fill:none;stroke:var(--muted);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.sobre{display:flex;align-items:center;gap:12px}
.sobre svg{width:48px;height:48px;flex:none}
.sobre b{display:block;font-family:var(--fh);font-size:16px}
.sobre span{font-size:13px;color:var(--muted)}
.versao{text-align:center;font-size:12px;color:var(--muted);margin:14px 0 4px}

/* ---------- Resultado ---------- */
.res-ok{display:flex;align-items:center;gap:10px;justify-content:center;color:var(--ok-ink);font-weight:700;font-size:14px;margin:6px 0 14px}
.res-ok svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.res-previa{display:flex;flex-direction:column;align-items:center;gap:12px;padding:18px 16px}
.res-previa .quadro{max-width:200px;max-height:260px;border-radius:8px;overflow:hidden;box-shadow:0 6px 18px rgba(28,28,30,.18);background:#fff;display:flex;align-items:center;justify-content:center;min-width:120px;min-height:120px}
.res-previa .quadro img,.res-previa .quadro canvas{max-width:200px;max-height:260px;width:auto;height:auto;display:block}
.res-previa .quadro.txt{padding:12px;max-width:100%;width:100%;align-items:flex-start;justify-content:flex-start;background:var(--card-2);box-shadow:none;color:var(--ink)}
.res-texto{font-size:12.5px;line-height:1.45;white-space:pre-wrap;word-break:break-word;max-height:220px;overflow:hidden;margin:0;font-family:var(--ft);color:var(--ink)}
.res-previa .nome{font-size:16px;font-weight:700;text-align:center;word-break:break-word}
.res-previa .det{font-size:13px;color:var(--muted);text-align:center}
.res-previa .resumo{font-size:14px;text-align:center;color:var(--ink);background:var(--brand-soft);padding:8px 12px;border-radius:10px}
.res-acoes{display:flex;flex-direction:column;gap:8px;margin:4px 0 14px}
.res-acoes .btn{text-decoration:none}
.res-lista .item-arq a.btn-ico{text-decoration:none;color:var(--brand)}

/* ---------- Progresso (cobre a tela) ---------- */
#progresso{position:absolute;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(255,255,255,.82);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}
html[data-theme="dark"] #progresso{background:rgba(20,20,22,.82)}
#progresso[hidden]{display:none}
.prog{width:100%;max-width:300px;background:var(--card);border:1px solid var(--line);border-radius:20px;padding:22px 20px;box-shadow:var(--shadow-2);text-align:center}
.prog .spin{width:44px;height:44px;margin:0 auto 14px;border-radius:50%;border:4px solid var(--brand-soft);border-top-color:var(--brand);animation:spin .9s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.prog p{font-size:15px;font-weight:600;margin-bottom:12px;word-break:break-word}
.prog .barra{height:8px;border-radius:4px;background:var(--card-2);overflow:hidden}
.prog .barra i{display:block;height:100%;border-radius:4px;background:var(--brand);width:0;transition:width .25s var(--ease)}
.prog .barra.ind i{width:40%;animation:ind 1.2s var(--ease) infinite}
@keyframes ind{from{transform:translateX(-100%)}to{transform:translateX(250%)}}
.prog .pct{font-size:12px;color:var(--muted);margin-top:8px;font-variant-numeric:tabular-nums}

/* ---------- Folha (bottom sheet) ---------- */
#folha-root{position:absolute;inset:0;z-index:20;pointer-events:none}
.folha-bg{position:absolute;inset:0;background:rgba(20,20,22,.5);opacity:0;transition:opacity .22s;pointer-events:auto}
.folha{
  position:absolute;left:0;right:0;bottom:0;background:var(--card);border-radius:22px 22px 0 0;padding:8px 16px calc(var(--sab) + 16px);
  max-height:86%;display:flex;flex-direction:column;box-shadow:var(--shadow-2);transform:translateY(100%);transition:transform .28s var(--ease);pointer-events:auto;
}
#folha-root.on .folha-bg{opacity:1}
#folha-root.on .folha{transform:none}
.folha .alca{width:40px;height:4px;border-radius:2px;background:var(--line-2);margin:4px auto 12px;flex:none}
.folha h2{font-size:18px;margin-bottom:8px;flex:none}
.folha p{color:var(--muted);font-size:15px}
.folha .f-body{overflow-y:auto;min-height:0;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.folha .f-acoes{display:flex;flex-direction:column;gap:8px;margin-top:16px;flex:none}
.f-lista{display:flex;flex-direction:column}
.f-item{display:flex;align-items:center;gap:12px;min-height:54px;padding:8px 2px;border-top:1px solid var(--line);width:100%;text-align:left;font-size:15px;font-weight:600;color:var(--ink);text-decoration:none}
.f-item:first-child{border-top:0}
.f-item:active{background:var(--card-2)}
.f-item .ico{width:40px;height:40px;border-radius:12px;display:flex;align-items:center;justify-content:center;color:var(--c,var(--brand));background:var(--cs,var(--brand-soft));flex:none}
.f-item .ico svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.f-item > svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;color:var(--muted);flex:none}
.f-item .tx{flex:1;min-width:0}
.f-item .tx small{display:block;font-size:12.5px;color:var(--muted);font-weight:400}
.f-item.perigo{color:var(--err-ink)}
.f-item.perigo > svg{color:var(--err-ink)}

/* ---------- Toast ---------- */
#toast{position:absolute;left:16px;right:16px;bottom:calc(var(--tab-h) + var(--tab-m) + var(--sab) + 14px);z-index:30;pointer-events:none;display:flex;justify-content:center}
#toast .t{
  pointer-events:auto;display:inline-flex;align-items:center;gap:12px;background:var(--ink);color:var(--bg);padding:12px 16px;border-radius:14px;
  font-size:14px;font-weight:600;box-shadow:var(--shadow-2);transform:translateY(20px);opacity:0;transition:transform .25s var(--ease),opacity .25s;max-width:100%;
}
html[data-theme="dark"] #toast .t{background:#F5F3F2;color:#1C1C1E}
/* Erro: cor + ícone de alerta (o vermelho também é a cor da marca, então nunca só a cor) */
#toast .t.err{background:var(--err);color:#fff}
#toast .t.err > span::before{content:"";display:inline-block;width:18px;height:18px;vertical-align:-4px;margin-right:8px;background:currentColor;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 20h19z'/%3E%3Cpath d='M12 10v4M12 17.5v.5'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 20h19z'/%3E%3Cpath d='M12 10v4M12 17.5v.5'/%3E%3C/svg%3E") center/contain no-repeat}
html[data-theme="dark"] #toast .t.err{background:#FF8A80;color:#1C1C1E}
#toast .t.on{transform:none;opacity:1}
/* Botões do toast com 44 px de toque, sem engordar a caixa (margens negativas) */
#toast .t button{color:var(--gold);font-weight:700;white-space:nowrap;padding:4px 8px;min-height:44px;margin:-10px -4px}
html[data-theme="dark"] #toast .t button{color:#B71F1B}
#toast .t .t-x{width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;color:inherit;opacity:.7;margin:-10px -12px -10px -6px;padding:0}
#toast .t .t-x svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}

/* ---------- Transições de tela ---------- */
@keyframes vt-in-r{from{opacity:0;transform:translateX(28px)}to{opacity:1;transform:none}}
@keyframes vt-in-l{from{opacity:0;transform:translateX(-28px)}to{opacity:1;transform:none}}
@keyframes vt-fade{from{opacity:0}to{opacity:1}}
.screen.vt-forward{animation:vt-in-r 280ms var(--ease) both}
.screen.vt-back{animation:vt-in-l 280ms var(--ease) both}
.screen.vt-fade{animation:vt-fade 180ms var(--ease) both}
/* Feedback de toque nos itens de lista e links */
.link:active,.f-item:active,.set:active{background:var(--card-2)}
.link{border-radius:10px;margin:0 -6px;padding-left:6px;padding-right:6px;width:calc(100% + 12px)}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}
  .prog .spin{animation:none;border-top-color:var(--brand-soft)}
  .prog .barra.ind i{animation:none;width:100%;opacity:.5}
}

/* Telas bem estreitas */
@media (max-width:340px){
  .tab{font-size:10px}
  .tabhead h1{font-size:26px}
  .ferr b{font-size:11.5px}
}

/* ---------- Entrada (abertura do app): as 3 folhas do logo entram uma a uma ----------
   Só transform/opacity (GPU). Linha do tempo: rosa 0,05-0,50 s, coral 0,25-0,70 s, vermelha 0,45-0,90 s, pausa,
   fade de saída 0,32 s disparado pelo app.js (~1,15 s) → ~1,5 s no total. Fundo branco (ou --bg se a pessoa escolheu
   o escuro em "Mais"), igual ao background_color do manifest, para a splash do Android emendar sem corte.
   `ent-fallback`: se o JS não rodar, a tela some sozinha aos 2,5 s. */
#entrada{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;
  background:#fff;transition:opacity .32s var(--ease),transform .32s var(--ease);
  animation:ent-fallback .3s 2.5s var(--ease) forwards}
html[data-theme="dark"] #entrada{background:var(--bg)}
#entrada.sai{opacity:0;transform:scale(1.04);pointer-events:none;animation:none}
.ent-ico{width:132px;height:151px;overflow:visible}
.ent-f{transform-box:fill-box;transform-origin:50% 50%;will-change:transform,opacity;opacity:0;
  animation:ent-folha .46s cubic-bezier(.34,1.45,.64,1) both}
.ent-f1{animation-delay:.05s}
.ent-f2{animation-delay:.25s}
.ent-f3{animation-delay:.45s}
@keyframes ent-folha{
  from{opacity:0;transform:translate(0,-34px) scale(.86)}
  60%{opacity:1}
  to{opacity:1;transform:none}
}
@keyframes ent-fallback{to{opacity:0;visibility:hidden;pointer-events:none}}
@media (prefers-reduced-motion:reduce){
  /* Logo parado e saída rápida (≤ 300 ms); o app.js encurta a espera */
  .ent-f{animation:none;opacity:1}
  #entrada{transition-duration:.2s;animation:ent-fallback .01s 2.5s forwards}
  #entrada.sai{transform:none;animation:none}
}
