:root {
  --verde: #98B800;
  --verde-claro: #A0D048;
  --verde-escuro: #5f7d00;
  --verde-header: #3d4d00;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #1f2937; margin: 0;
  min-height: 100vh; min-height: 100dvh;
}

/* ===== Tipografia / controles de formulário (compartilhado) ===== */
h1 { font-size: 20px; margin: 0 0 4px; }
p.sub { margin: 0 0 24px; color: #6b7280; font-size: 14px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
input[type=file], input[type=number], input[type=date], input[type=month],
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: 12px; border: 1px solid #d1d5db;
  border-radius: 10px; background: #fff;
  /* 16px evita o zoom automático do iOS ao focar o campo (webview-friendly) */
  font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--verde); border-color: var(--verde); }
.hint { color: #6b7280; font-size: 12px; margin-top: 4px; }
.mes-ano { display: flex; gap: 8px; }
.mes-ano > select { flex: 1; min-width: 0; }
button {
  margin-top: 24px; width: 100%; min-height: 48px; padding: 12px;
  border: 0; cursor: pointer; border-radius: 10px;
  background: var(--verde-escuro); color: #fff; font-size: 16px; font-weight: 600;
}
button:hover { background: #4c6500; }
.erro {
  background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}
.ok {
  background: #f0fdf4; border: 1px solid #86efac; color: #166534;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}
a.modelo {
  display: block; text-align: center; margin-top: 16px; padding: 6px;
  color: var(--verde-escuro); font-size: 14px; text-decoration: none;
}
a.modelo:hover { text-decoration: underline; }

/* ===== Login (card centralizado) ===== */
.login-body {
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px
           calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(135deg, var(--verde-claro) 0%, var(--verde) 100%);
}
.card {
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 34px rgba(0,0,0,.18); width: 100%; max-width: 440px;
}
.card-header { background: var(--verde-header); padding: 22px; text-align: center; }
.logo { height: 52px; width: auto; }
.card-body { padding: 28px; }

/* =====================================================================
   Área logada (sidebar) — MOBILE FIRST
   Base = celular; o desktop entra via @media (min-width: 1024px).
   ===================================================================== */
.app-body { background: #f3f4f6; }

/* Topbar: visível por padrão (mobile); escondida no desktop. */
.app-topbar {
  display: flex; position: sticky; top: 0; z-index: 30;
  align-items: center; gap: .75rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
  background: var(--verde-header);
}
.app-topbar__toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.6rem; height: 2.6rem; border-radius: .6rem;
  border: 1px solid rgba(255,255,255,.25); background: transparent;
  color: #fff; cursor: pointer;
}
.app-topbar__brand img { display: block; }

.app-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.5); opacity: 0; transition: opacity .2s ease;
}
.app-backdrop:not([hidden]) { opacity: 1; }

/* Sidebar: drawer fora da tela por padrão (mobile). */
.app-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(84vw, 300px);
  background: #fff; border-right: 1px solid #e5e7eb;
  display: flex; flex-direction: column; z-index: 50;
  transform: translateX(-100%);
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
}
.app-sidebar.is-open { transform: translateX(0); }

.app-sidebar__head {
  background: var(--verde-header); text-align: center;
  padding: calc(20px + env(safe-area-inset-top)) 20px 20px;
}
.app-sidebar__logo { height: 44px; width: auto; }

.app-sidebar__nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.app-sidebar__section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  font-weight: 700; color: #9ca3af; padding: 0 10px 8px; margin: 0;
}
.app-sidebar__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.app-sidebar__link {
  display: flex; align-items: center; gap: .8rem; width: 100%;
  padding: 12px; border-radius: 10px; font-size: 15px; font-weight: 500;
  color: #4b5563; text-decoration: none; transition: background .14s, color .14s;
}
.app-sidebar__link:hover { background: #f3f4f6; color: var(--verde-escuro); }
.app-sidebar__link[aria-current="page"] {
  background: color-mix(in srgb, var(--verde) 16%, transparent);
  color: var(--verde-escuro); font-weight: 600;
}
.app-sidebar__link svg { flex-shrink: 0; }

.app-sidebar__foot {
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #e5e7eb;
}
.app-user {
  display: flex; align-items: center; gap: .6rem; padding: 8px;
  border-radius: 10px; background: #f3f4f6; margin-bottom: 10px;
}
.app-user__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9999px; flex-shrink: 0;
  background: var(--verde-header); color: #fff; font-weight: 700; font-size: 15px;
}
.app-user__info { display: flex; flex-direction: column; min-width: 0; }
.app-user__name {
  font-size: 14px; font-weight: 600; color: #1f2937;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-user__email {
  font-size: 12px; color: #6b7280;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.app-foot-actions { display: flex; flex-direction: column; gap: 8px; }
.app-action {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  width: 100%; min-height: 46px; padding: 0 12px; margin: 0;
  border-radius: 10px; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  border: 1px solid #d1d5db; background: #fff; color: #374151;
  transition: background .14s, color .14s, border-color .14s;
}
.app-action:hover { background: #f3f4f6; border-color: #9ca3af; color: #111827; }
.app-action--danger { color: #b91c1c; border-color: #fca5a5; }
.app-action--danger:hover { color: #fff; background: #dc2626; border-color: #dc2626; }

.app-main { min-height: 100vh; min-height: 100dvh; }
.app-content {
  max-width: 560px; margin: 0 auto;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}
.panel {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
  padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* ===== Desktop ===== */
@media (min-width: 1024px) {
  .app-topbar { display: none; }
  .app-sidebar { width: 256px; transform: translateX(0); }
  .app-main { padding-left: 256px; }
  .app-content { padding: 32px 20px 48px; }
  .panel { padding: 28px; }
}
