/* Mural da Escola — mobile-first. */
:root {
  --bg: #f1f4f8;
  --card: #ffffff;
  --ink: #1b2733;
  --muted: #6b7a8d;
  --primary: #1565c0;
  --aviso: #1565c0;
  --registro: #b26a00;
  --tarefa: #2e7d32;
  --shadow: 0 1px 3px rgba(16, 32, 56, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

[hidden] { display: none !important; }

/* --- Tela de acesso (código da família) --- */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 16px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-title { margin: 0 0 6px; font-size: 1.35rem; color: var(--primary); }
.gate-subtitle { margin: 0 0 20px; color: var(--muted); font-size: .95rem; }
.gate-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cdd6e0;
  border-radius: 10px;
  font-size: 1.05rem;
  text-align: center;
  letter-spacing: .04em;
}
.gate-input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.gate-error { margin: 12px 0 0; color: #c62828; font-size: .9rem; }
.gate-button {
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.gate-button:disabled { opacity: .6; cursor: default; }

.linkbtn {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

.topbar {
  background: var(--primary);
  color: #fff;
  padding: env(safe-area-inset-top) 16px 12px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.topbar h1 { margin: 8px 0 10px; font-size: 1.2rem; }

.filters select {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.tab {
  flex: 1 0 auto;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
.tab.is-active { background: var(--primary); color: #fff; }

/* --- Barra de status (Não sinalizados / Todos / Sinalizados) --- */
.statusbar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border-top: 1px solid #eef1f5;
}
.status-btn {
  flex: 1;
  padding: 7px 6px;
  border: 1px solid #d7dee7;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.status-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.list {
  padding: 14px 12px 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.status { text-align: center; color: var(--muted); padding: 32px 0; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--muted);
}
.card.aviso { border-left-color: var(--aviso); }
.card.registro { border-left-color: var(--registro); }
.card.tarefa { border-left-color: var(--tarefa); }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.badge {
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.badge.type { background: #e8eef7; color: var(--primary); }
.badge.entrega { background: #fdecea; color: #c62828; }
.date { margin-left: auto; font-size: .78rem; color: var(--muted); }

.card-title { margin: 4px 0 6px; font-size: 1.02rem; }
.card-body { margin: 0; color: #33414f; font-size: .95rem; line-height: 1.45; white-space: pre-wrap; }

.card-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.done-btn {
  padding: 6px 14px;
  border: 1px solid var(--tarefa);
  border-radius: 999px;
  background: #fff;
  color: var(--tarefa);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}
.done-btn.is-done { background: var(--tarefa); color: #fff; }

/* Item concluído: esmaecido, mas ainda legível. */
.card.is-done { opacity: .62; }
.card.is-done .card-title { text-decoration: line-through; }

/* --- Deslizar para sinalizar (swipe-to-reveal) --- */
.swipe-row {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}
/* Botão revelado atrás do card, à direita. */
.swipe-action {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 108px;
  border: 0;
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--muted);
}
.swipe-action.aviso { background: var(--aviso); }
.swipe-action.registro { background: var(--registro); }
.swipe-action.tarefa { background: var(--tarefa); }
.swipe-action.undo { background: var(--muted); }
.swipe-action .swipe-icon { font-size: 1.1rem; line-height: 1; }
/* O card fica por cima e desliza para revelar a ação. */
.swipe-content {
  position: relative;
  transition: transform .18s ease;
  will-change: transform;
  touch-action: pan-y;
}
.swipe-content.is-dragging { transition: none; }

/* --- Paginação --- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px 2px;
}
.pager-btn {
  padding: 8px 14px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-info { font-size: .82rem; color: var(--muted); font-weight: 600; }

.footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 -1px 4px rgba(16, 32, 56, .1);
}
.refresh {
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.updated { font-size: .78rem; color: var(--muted); }
