/* ============ REDE EXTREME — nuvem da família ============ */

:root {
  --papel: #f5efe3;
  --papel-2: #efe6d3;
  --cartao: #fffdf6;
  --tinta: #26221a;
  --tinta-suave: #6f6754;
  --linha: #e0d5bd;
  --acento: #d95d39;      /* terracota */
  --acento-escuro: #b34324;
  --verde: #2f6f5e;
  --amarelo: #e8a83d;
  --sombra: 0 2px 4px rgba(60, 48, 24, .08), 0 12px 28px -12px rgba(60, 48, 24, .22);
  --raio: 14px;
  --fonte-titulo: 'Fraunces', Georgia, serif;
  --fonte-corpo: 'Instrument Sans', 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--fonte-corpo);
  background: var(--papel);
  background-image:
    radial-gradient(ellipse 80% 50% at 70% -10%, rgba(217, 93, 57, .10), transparent),
    radial-gradient(ellipse 60% 40% at 10% 110%, rgba(47, 111, 94, .08), transparent);
  color: var(--tinta);
  min-height: 100vh;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 999; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- topo ---------- */

.topo {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 18px clamp(16px, 4vw, 44px);
  border-bottom: 2px solid var(--tinta);
  background: color-mix(in srgb, var(--papel) 82%, white);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(6px);
}

.marca { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.marca-selo {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--acento); color: var(--cartao);
  font-family: var(--fonte-titulo); font-weight: 900; font-size: 13px;
  display: grid; place-items: center;
  transform: rotate(-4deg);
  box-shadow: 3px 3px 0 var(--tinta);
  transition: transform .25s;
}
.marca:hover .marca-selo { transform: rotate(3deg) scale(1.06); }
.marca-texto h1 {
  font-family: var(--fonte-titulo); font-weight: 700; font-size: 1.35rem; line-height: 1;
  letter-spacing: -.01em;
}
.marca-texto h1 em { color: var(--acento); font-style: italic; font-weight: 900; }
.marca-sub {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .22em;
  color: var(--tinta-suave);
}

.busca {
  flex: 1 1 220px; max-width: 460px;
  display: flex; align-items: center; gap: 8px;
  background: var(--cartao); border: 1.5px solid var(--linha);
  border-radius: 999px; padding: 9px 16px;
  color: var(--tinta-suave);
  transition: border-color .2s, box-shadow .2s;
}
.busca:focus-within { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(217, 93, 57, .15); }
.busca input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--tinta); min-width: 0;
}

.acoes-topo { display: flex; gap: 8px; margin-left: auto; }

/* ---------- botões ---------- */

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 999px; padding: 9px 16px;
  border: 1.5px solid var(--tinta);
  background: var(--cartao); color: var(--tinta);
  transition: transform .12s, box-shadow .12s, background .12s;
  white-space: nowrap;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 2px 3px 0 var(--tinta); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-cheio { background: var(--acento); border-color: var(--acento-escuro); color: #fff; }
.btn-cheio:hover { box-shadow: 2px 3px 0 var(--acento-escuro); }
.btn-fantasma { background: transparent; border-color: var(--linha); }
.btn-mini { padding: 5px 12px; font-size: .82rem; }
.btn-perigo { color: var(--acento-escuro); border-color: var(--acento-escuro); }

/* ---------- palco ---------- */

.palco { padding: 22px clamp(16px, 4vw, 44px) 40px; max-width: 1400px; margin: 0 auto; }

.linha-caminho {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}

.migalhas { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: .95rem; }
.migalha {
  border: 0; background: transparent; font: inherit; cursor: pointer;
  padding: 4px 8px; border-radius: 8px; color: var(--tinta-suave); font-weight: 500;
}
.migalha:hover { background: var(--papel-2); color: var(--tinta); }
.migalha.atual { color: var(--tinta); font-weight: 700; font-family: var(--fonte-titulo); font-size: 1.05rem; }
.migalha-seta { color: var(--linha); }
.migalha.solta-aqui { outline: 2px dashed var(--acento); background: rgba(217,93,57,.08); }

/* ---------- progresso ---------- */

.barra-progresso {
  background: var(--cartao); border: 1.5px solid var(--linha); border-radius: var(--raio);
  padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--sombra);
}
.barra-progresso-info { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 8px; color: var(--tinta-suave); }
.barra-trilho { height: 8px; background: var(--papel-2); border-radius: 99px; overflow: hidden; }
.barra-fio { height: 100%; width: 0%; background: linear-gradient(90deg, var(--acento), var(--amarelo)); border-radius: 99px; transition: width .15s; }

/* ---------- grade de itens ---------- */

.grade {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.item {
  background: var(--cartao);
  border: 1.5px solid var(--linha);
  border-radius: var(--raio);
  padding: 12px;
  cursor: pointer; position: relative;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  animation: surgir .35s backwards;
}
.item:hover { transform: translateY(-3px); border-color: var(--tinta); box-shadow: var(--sombra); }
.item.solta-aqui { outline: 2.5px dashed var(--acento); outline-offset: 2px; transform: scale(1.03); }
.item.arrastando { opacity: .4; }

@keyframes surgir { from { opacity: 0; transform: translateY(10px); } }

.item-visu {
  height: 92px; border-radius: 10px; margin-bottom: 10px;
  display: grid; place-items: center; font-size: 42px;
  background: var(--papel-2); overflow: hidden; position: relative;
}
.item-visu img, .item-visu video, .item-visu canvas {
  width: 100%; height: 100%; object-fit: cover; pointer-events: none;
}
.item-visu canvas { object-position: top; background: #fff; }
.item.e-pasta .item-visu { background: linear-gradient(135deg, #f3e3c2, #ecd9ae); }

.item-nome {
  font-weight: 600; font-size: .88rem; line-height: 1.25;
  word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; min-height: 2.2em;
}
.item-meta { font-size: .74rem; color: var(--tinta-suave); margin-top: 4px; }

.item-acoes {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 4px;
  opacity: 0; transition: opacity .15s;
}
.item:hover .item-acoes, .item:focus-within .item-acoes { opacity: 1; }
@media (hover: none) { .item-acoes { opacity: 1; } }

.acao {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--linha);
  background: rgba(255, 253, 246, .92); cursor: pointer; font-size: 14px;
  display: grid; place-items: center; transition: background .12s, transform .12s;
}
.acao:hover { background: var(--acento); border-color: var(--acento-escuro); transform: scale(1.1); }

.etiqueta-ext {
  position: absolute; left: 8px; bottom: 8px;
  font-size: .62rem; font-weight: 700; letter-spacing: .08em;
  background: var(--tinta); color: var(--papel);
  padding: 2px 7px; border-radius: 6px; text-transform: uppercase;
}

/* ---------- seleção múltipla ---------- */

.grade { user-select: none; }

.item.selecionado {
  border-color: var(--acento);
  box-shadow: 0 0 0 3px rgba(217, 93, 57, .22);
  background: #fff4ea;
}
.item.selecionado::after {
  content: '✓';
  position: absolute; top: -8px; left: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--acento); color: #fff;
  font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 1px 4px rgba(60,48,24,.3);
}

.retangulo-selecao {
  position: fixed; z-index: 90; pointer-events: none;
  border: 1.5px dashed var(--acento);
  background: rgba(217, 93, 57, .08);
  border-radius: 4px;
}

.barra-selecao {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 160; display: flex; align-items: center; gap: 10px;
  background: var(--tinta); color: var(--papel);
  padding: 10px 16px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(38, 34, 26, .4);
  animation: toastIn .2s;
}
.barra-selecao strong { font-size: .88rem; white-space: nowrap; }
.barra-selecao button {
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35);
  background: transparent; color: var(--papel); padding: 6px 14px;
  transition: background .12s;
}
.barra-selecao button:hover { background: rgba(255, 255, 255, .15); }
.barra-selecao #selExcluir:hover { background: var(--acento); border-color: var(--acento); }

.btn-ativo { background: var(--tinta) !important; color: var(--papel) !important; border-color: var(--tinta) !important; }

/* ---------- vazio ---------- */

.vazio { text-align: center; padding: 70px 20px; }
.vazio-arte { font-size: 56px; margin-bottom: 14px; animation: flutuar 3s ease-in-out infinite; }
@keyframes flutuar { 50% { transform: translateY(-8px) rotate(4deg); } }
.vazio-titulo { font-family: var(--fonte-titulo); font-size: 1.5rem; font-weight: 700; }
.vazio-dica { color: var(--tinta-suave); margin-top: 6px; }

/* ---------- rodapé ---------- */

.rodape {
  padding: 18px clamp(16px, 4vw, 44px) 28px;
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  color: var(--tinta-suave); font-size: .8rem;
  border-top: 1px dashed var(--linha); max-width: 1400px; margin: 0 auto;
}
.disco-trilho { width: 130px; height: 7px; border-radius: 99px; background: var(--papel-2); overflow: hidden; display: inline-block; vertical-align: middle; }
.disco-fio { height: 100%; background: var(--verde); border-radius: 99px; }

/* ---------- véu de soltar ---------- */

.veu-soltar {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(38, 34, 26, .55); backdrop-filter: blur(3px);
  display: grid; place-items: center;
}
.veu-cartao {
  background: var(--cartao); border: 3px dashed var(--acento);
  border-radius: 22px; padding: 44px 60px; text-align: center;
  font-family: var(--fonte-titulo); font-size: 1.4rem; font-weight: 700;
  animation: pulsar 1.2s ease-in-out infinite;
}
.veu-icone { font-size: 54px; margin-bottom: 10px; }
@keyframes pulsar { 50% { transform: scale(1.04); } }

/* ---------- modais ---------- */

.modal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 18px; }
.modal-fundo { position: absolute; inset: 0; background: rgba(38, 34, 26, .6); backdrop-filter: blur(4px); }
.modal-caixa {
  position: relative; background: var(--cartao); border-radius: 18px;
  border: 2px solid var(--tinta); box-shadow: 6px 6px 0 rgba(38,34,26,.85);
  width: min(720px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  animation: surgir .25s;
}
.preview-caixa { width: min(1000px, 100%); }
.modal-cabeca {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1.5px solid var(--linha);
  font-family: var(--fonte-titulo);
}
.modal-cabeca strong { word-break: break-word; }
.modal-cabeca > div { display: flex; gap: 6px; flex-shrink: 0; }

.preview-corpo {
  overflow: auto; display: grid; place-items: center; padding: 14px; min-height: 200px;
  background: repeating-conic-gradient(var(--papel-2) 0% 25%, var(--cartao) 0% 50%) 50%/24px 24px;
  border-radius: 0 0 16px 16px;
}
.preview-corpo img, .preview-corpo video { max-width: 100%; max-height: 72vh; border-radius: 8px; }
.preview-corpo iframe { width: 100%; height: 72vh; border: 0; background: #fff; }
.preview-corpo pre {
  justify-self: stretch; text-align: left; white-space: pre-wrap; word-break: break-word;
  background: var(--cartao); padding: 18px; font-size: .85rem; max-height: 70vh; overflow: auto;
}
.preview-corpo .sem-preview { padding: 40px; text-align: center; color: var(--tinta-suave); }

/* documentos renderizados localmente (Word / Excel / PowerPoint) */
.doc-render {
  justify-self: stretch; align-self: start; background: #fff; color: #202020;
  border-radius: 8px; padding: 28px; max-height: 72vh; overflow: auto; text-align: left;
}
.slides-render { display: grid; justify-items: center; background: #3a362e; padding: 16px; }
.slides-render > div { max-width: 100%; }
.planilha-render table { border-collapse: collapse; font-size: .85rem; margin-bottom: 20px; }
.planilha-render td, .planilha-render th { border: 1px solid #d8d2c2; padding: 5px 10px; min-width: 60px; }
.planilha-render tr:first-child td { background: #f3eee2; font-weight: 600; }
.aba-planilha {
  font-family: var(--fonte-titulo); font-size: 1rem; margin: 4px 0 10px;
  color: var(--acento-escuro);
}

/* ---------- tela de senha ---------- */

.senha-caixa { width: min(380px, 100%); }
.senha-corpo { padding: 34px 30px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.senha-selo {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 4px;
  background: var(--acento); color: var(--cartao);
  font-family: var(--fonte-titulo); font-weight: 900; font-size: 16px;
  display: grid; place-items: center; transform: rotate(-4deg);
  box-shadow: 3px 3px 0 var(--tinta);
}
.senha-corpo h2 { font-family: var(--fonte-titulo); font-size: 1.25rem; }
.senha-corpo h2 em { color: var(--acento); }
.senha-corpo p { color: var(--tinta-suave); font-size: .9rem; }
.senha-campo { position: relative; }
.senha-corpo input {
  width: 100%; font: inherit; padding: 11px 46px 11px 46px; border-radius: 999px;
  text-align: center; border: 1.5px solid var(--linha); outline: 0; background: var(--papel);
}
.senha-corpo input:focus { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(217,93,57,.15); }
#btnOlho {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer; font-size: 17px;
  padding: 6px 8px; border-radius: 50%; line-height: 1; opacity: .55;
  transition: opacity .15s, transform .15s;
}
#btnOlho:hover { opacity: 1; transform: translateY(-50%) scale(1.15); }

.lixeira-corpo { overflow: auto; padding: 10px 18px 18px; }
.lixeira-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px dashed var(--linha); font-size: .9rem;
}
.lixeira-item .cresce { flex: 1; min-width: 0; }
.lixeira-item .nome { font-weight: 600; word-break: break-word; }
.lixeira-item .meta { font-size: .75rem; color: var(--tinta-suave); }

/* ---------- toasts ---------- */

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--tinta); color: var(--papel); padding: 11px 20px;
  border-radius: 999px; font-size: .88rem; font-weight: 500;
  box-shadow: var(--sombra); animation: toastIn .25s;
  max-width: 90vw;
}
.toast.erro { background: var(--acento-escuro); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- celular ---------- */

@media (max-width: 640px) {
  .topo { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .marca-sub { display: none; }
  .rotulo-btn { display: none; }
  .busca { order: 3; flex-basis: 100%; max-width: none; }
  .grade { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .item-visu { height: 76px; font-size: 34px; }
}
