:root {
  --brand: #0b8a87;
  --bg: #f6f6f7;
  --card: #fff;
  --text: #1c1c1e;
  --muted: #6b6b72;
  --line: #e4e4e8;
  --ok: #1a7f37;
  --warn: #9a6700;
  --off: #6b6b72;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
header.top { background: var(--card); border-bottom: 3px solid var(--brand); padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); padding-top: max(8px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 5; }
header.top img { height: 48px; width: auto; display: block; }
header.top .logo-fallback { font-weight: 800; font-size: 1.4rem; color: var(--brand); }
header.top h1 { font-size: 1.1rem; margin: 0; flex: 1; }
main { max-width: 1100px; margin: 0 auto; padding: 12px 12px max(24px, env(safe-area-inset-bottom)); }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; } main { padding: 16px; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
/* imagem inteira, sem corte: encarte precisa aparecer completo */
.card img.thumb { width: 100%; height: auto; min-height: 160px; display: block; background: #eee; cursor: zoom-in; }
.card .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.card .title:empty { display: none; }
.card .acoes { display: flex; gap: 8px; }
.card .acoes .btn { flex: 1; text-align: center; }
.card .title { font-size: .95rem; font-weight: 600; overflow-wrap: anywhere; }
.btn { appearance: none; border: 0; background: var(--brand); color: #fff; min-height: 44px; padding: 11px 16px; border-radius: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: #b42318; border: 1px solid #f1b8b3; }
.btn:disabled { opacity: .55; cursor: default; }
.empty, .msg { text-align: center; color: var(--muted); padding: 48px 16px; }
.msg:empty { display: none; }
.msg.err { color: #b42318; padding: 8px 0; text-align: left; }
.msg.ok { color: var(--ok); padding: 8px 0; text-align: left; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; z-index: 20; padding: 8px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
/* admin */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.panel h2 { margin: 0 0 12px; font-size: 1.05rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=file] { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; background: #fff; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin: 12px 0; }
.login { max-width: 380px; margin: 40px auto; }
.login .field { margin-bottom: 12px; }
.login .btn, #enviar { width: 100%; }
#enviar { margin-top: 14px; }
@media (min-width: 640px) { .login .btn, #enviar { width: auto; } }
.item { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item img { width: 72px; height: 90px; object-fit: cover; border-radius: 8px; background: #eee; }
.item > * { min-width: 0; }
.item .dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.item .dates input { min-width: 0; }
.item .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 6px; }
.badge.ativa { background: #dafbe1; color: var(--ok); }
.badge.agendada { background: #fff8c5; color: var(--warn); }
.badge.expirada { background: #eee; color: var(--off); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 520px) { .row, .item .dates { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; color: var(--text, inherit); }
.check input { margin-top: 3px; }
.pdf { display: flex; align-items: center; justify-content: center; background: #dff5f4; color: var(--brand); font-weight: 800; text-decoration: none; border-radius: 8px; }
.card .thumb.pdf { height: 120px; font-size: 2rem; border-radius: 0; }
.item .pdf { width: 72px; height: 90px; font-size: 1rem; }
