/* ===== COTJA App — mobile-first, paleta de COMPRADOR (laranja) ===== */
:root {
  --app-laranja: #f97316;        /* = --cotja-papel (comprador) */
  --app-laranja-escuro: #ea580c; /* = --cotja-papel-dark */
  --app-laranja-soft: rgba(249,115,22,.12);
  --app-fundo: #f4f6fb;
  --app-texto: #1e293b;
}
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body {
  height: 100%;
  overflow-x: hidden;              /* mata qualquer rolagem lateral */
  max-width: 100vw;
}
body {
  background: var(--app-fundo);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}

/* ---------- banner instalar PWA ---------- */
#bannerInstalar {
  position: fixed; left: .6rem; right: .6rem;
  bottom: calc(.6rem + env(safe-area-inset-bottom));
  z-index: 2000;
  background: var(--app-laranja-escuro); color: #fff;
  border-radius: 14px; padding: .55rem .7rem;
  box-shadow: 0 8px 24px rgba(234,88,12,.45);
}
.btn-fechar-banner {
  background: none; border: none; color: rgba(255,255,255,.75);
  font-size: 1.25rem; line-height: 1; padding: .2rem .4rem;
}
#bannerInstalar.dentro-app { bottom: calc(4.9rem + env(safe-area-inset-bottom)); }

/* ---------- login ---------- */
.tela-login { min-height: 100dvh; display: flex; flex-direction: column; }
.login-hero {
  background: linear-gradient(160deg, var(--app-laranja), var(--app-laranja-escuro));
  padding: calc(2.2rem + env(safe-area-inset-top)) 1.5rem 3.5rem;
  color: #fff;
}
.login-logo-img {
  max-width: min(230px, 70%);
  max-height: 92px;
  margin-bottom: .8rem;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
}
.login-logo {
  width: 74px; height: 74px; margin: 0 auto .8rem;
  background: rgba(255,255,255,.16); border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.app-sub-hero { opacity: .92; font-weight: 500; }
.login-card {
  background: #fff; border-radius: 18px;
  margin: -2.4rem 1rem 2rem; padding: 1.4rem 1.2rem;
  box-shadow: 0 10px 30px rgba(234,88,12,.16);
}
.btn-cotja { background: var(--app-laranja); color: #fff; border-radius: 12px; }
.btn-cotja:hover, .btn-cotja:focus { background: var(--app-laranja-escuro); color: #fff; }

/* ---------- shell ---------- */
#appShell { min-height: 100dvh; display: flex; flex-direction: column; }
.app-topo {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(120deg, var(--app-laranja), var(--app-laranja-escuro));
  color: #fff;
  padding: .55rem .8rem; padding-top: calc(.55rem + env(safe-area-inset-top));
}
.topo-logo { height: 32px; max-width: 28vw; object-fit: contain; }
.topo-logo-fallback { height: 32px; width: 38px; align-items: center; justify-content: center; font-size: 1.05rem; }
.app-topo > div { min-width: 0; }
.app-topo .flex-grow-1 { min-width: 0; }
.app-nome { font-weight: 700; line-height: 1.15; max-width: 100%; min-width: 0; }
.app-sub { font-size: .72rem; opacity: .9; max-width: 100%; min-width: 0; }
.btn-topo {
  color: #fff; width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 1rem;
}
.btn-topo:active { background: rgba(255,255,255,.32); }
.btn-topo-sair { background: rgba(120,20,10,.35); }

.app-conteudo {
  flex: 1; width: 100%; max-width: 720px; margin: 0 auto;
  padding: .9rem .8rem calc(5.4rem + env(safe-area-inset-bottom));
  overflow-x: hidden;               /* nada vaza pra fora na horizontal */
  min-width: 0;
}
.app-conteudo > * { min-width: 0; } /* itens flex/grid podem encolher */

/* ---------- tabbar ---------- */
.app-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; border-top: 1px solid #e2e8f0;
  display: flex; justify-content: space-around;
  padding: .35rem .2rem calc(.35rem + env(safe-area-inset-bottom));
}
.tab-item {
  flex: 1; text-align: center; text-decoration: none;
  color: #94a3b8; font-size: .64rem; font-weight: 600; line-height: 1.25;
  padding: .25rem .15rem; border-radius: 10px;
  min-width: 0; word-break: normal; hyphens: none;
}
.tab-item i { display: block; font-size: 1.15rem; margin-bottom: 2px; }
.tab-item.ativo { color: var(--app-laranja); }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 1rem; z-index: 99;
  bottom: calc(5rem + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--app-laranja); color: #fff; border: none;
  font-size: 1.4rem; box-shadow: 0 6px 16px rgba(249,115,22,.5);
}
.fab:active { transform: scale(.95); }

/* ---------- cards / listas ---------- */
.card-app {
  background: #fff; border-radius: 14px; padding: .9rem 1rem;
  box-shadow: 0 2px 8px rgba(30,41,59,.06);
  margin-bottom: .7rem; border: 1px solid #eef2f7;
  max-width: 100%; overflow: hidden;
}
.solic-card { display: block; text-decoration: none; color: inherit; }
.solic-card:active { background: #f8fafc; }
.solic-titulo { font-weight: 700; font-size: .95rem; }
.solic-meta { font-size: .75rem; color: #64748b; }
.badge-rascunho { background: #fef3c7; color: #92400e; font-size: .65rem; font-weight: 700; padding: .2em .55em; border-radius: 999px; white-space: nowrap; }
.badge-compartilhada { background: #dcfce7; color: #166534; font-size: .65rem; font-weight: 700; padding: .2em .55em; border-radius: 999px; white-space: nowrap; }
.badge-liberada { background: var(--app-laranja-soft); color: #c2410c; font-size: .65rem; font-weight: 700; padding: .2em .55em; border-radius: 999px; white-space: nowrap; }
.secao-titulo { font-size: .78rem; font-weight: 800; letter-spacing: .04em; color: #64748b; text-transform: uppercase; margin: 1rem .2rem .5rem; }
.vazio-app { text-align: center; color: #94a3b8; padding: 2.2rem 1rem; }
.vazio-app i { font-size: 2rem; margin-bottom: .5rem; display: block; }

/* ---------- itens ---------- */
.item-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 0; border-bottom: 1px dashed #e2e8f0;
  min-width: 0;
}
.item-row:last-child { border-bottom: none; }
.item-desc { flex: 1; font-size: .88rem; min-width: 0; overflow-wrap: anywhere; }
.item-qtd { font-size: .78rem; color: #64748b; white-space: nowrap; }
.item-row .form-control { width: 100%; min-width: 0; }
.mini-btn {
  width: 32px; height: 32px; border-radius: 9px; border: none; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem;
}
.mini-btn.editar { background: #ffedd5; color: #c2410c; }
.mini-btn.excluir { background: #fef2f2; color: #dc2626; }

/* ---------- perfil ---------- */
.perfil-avatar-grande {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--app-laranja); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; margin: 0 auto .5rem;
}
.matricula-pill {
  display: inline-block; background: var(--app-laranja-soft); color: #c2410c;
  font-weight: 800; letter-spacing: 2px; font-size: .95rem;
  padding: .3rem .9rem; border-radius: 999px;
}
