/* Tema escuro suave: fundo cinza-azulado (não preto puro), cartões um pouco mais claros, dourado discreto. */
:root {
  --bg: #13161d;
  --surface: #1c2129;
  --surface-2: #242a35;
  --text: #e6e9f0;
  --muted: #9aa3b5;
  --border: #2d3444;
  --primary: #d5dbe8;
  --primary-ink: #161a23;
  --accent: #d6a656;
  --accent-text: #e0b56a;
  --accent-soft: #332a1a;
  --danger: #f0968c;
  --danger-soft: #3a2421;
  --ok: #86d1a4;
  --ok-soft: #1c3329;
  --warn: #e9c374;
  --warn-soft: #3a3118;
  --radius: 12px;
  --stat-line: #d6a656;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2);
  color-scheme: dark;
}

/* Tema claro (escolhido pela pessoa em Perfil ou no menu) */
:root[data-theme="light"] {
  --bg: #eeebe4;
  --surface: #ffffff;
  --surface-2: #f7f5f0;
  --text: #1c2233;
  --muted: #5b6475;
  --border: #e4e0d6;
  --primary: #1e2a4a;
  --primary-ink: #ffffff;
  --accent: #b8862e;
  --accent-text: #8a6420;
  --accent-soft: #f6eddc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1d7a4a;
  --ok-soft: #e6f4ec;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --radius: 12px;
  --stat-line: #1e2a4a;
  color-scheme: light;
}
  background: linear-gradient(135deg, #1e2a4a 0%, #33457a 100%); border-color: transparent; color: #fff;
}
:root[data-theme="light"] .social-link { background: #fff; }

* { box-sizing: border-box; }
.theme-toggle {
  margin-top: auto; margin-bottom: 1rem; width: 100%; justify-content: center; background: transparent;
  color: var(--text); border: 1px solid var(--border); font-size: .9rem; min-height: 40px;
}
.theme-card { margin-bottom: 1rem; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--accent-text); text-decoration: none; }
@media (hover: hover) {
  a:hover { text-decoration: underline; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }

button, .btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .6rem 1rem;
  min-height: 44px;
  background: var(--primary);
  color: var(--primary-ink);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 150ms ease-out;
}
@media (hover: hover) {
  button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
}
button:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-accent { background: var(--primary); color: var(--primary-ink); }
.btn-sm { padding: .35rem .7rem; font-size: .88rem; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }

input, select, textarea {
  font: inherit;
  font-size: 16px; /* 16px ou mais evita o zoom automático no iOS */
  min-height: 44px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .75rem;
  width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
input[type="file"] { padding: .45rem; color: var(--muted); font-size: .9rem; }
/* Botão "Escolher arquivo" no mesmo estilo dos botões secundários */
input[type="file"]::file-selector-button {
  font: inherit; font-size: .9rem; font-weight: 500; min-height: 36px;
  padding: .4rem .9rem; margin-right: .75rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
@media (hover: hover) {
  input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
}

label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
label .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.req::after { content: " *"; color: var(--accent-text); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .75rem; }

.badge {
  display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.alert {
  border-radius: 10px; padding: .7rem .9rem; margin: .5rem 0;
  background: var(--danger-soft); color: var(--danger); font-size: .92rem;
}
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  background: var(--primary); color: var(--primary-ink); padding: .75rem 1.1rem;
  border-radius: 12px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 2rem);
  animation: toast-in .25s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center;
  font-weight: 700; border: 2px solid var(--border);
}
.avatar.lg { width: 96px; height: 96px; font-size: 1.8rem; }
.avatar.xl { width: 120px; height: 120px; font-size: 2.2rem; }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background: var(--bg);
}
.auth-card { width: min(520px, 100%); }
/* Tipografia da tela de login: EB Garamond nos títulos, Inter no restante */
.auth-wrap { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.auth-wrap h1, .auth-wrap .brand {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}
.auth-wrap h1 { font-size: 1.6rem; }
.auth-wrap .brand { font-size: 1.05rem; color: var(--primary); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.1rem; color: var(--primary); }
.auth-switch { text-align: center; margin-top: 1rem; font-size: .92rem; }
.photo-picker { display: flex; gap: 1rem; align-items: center; }
.social-block { border-top: 1px solid var(--border); padding-top: 1rem; }
.section-label { margin: 0 0 .75rem; font-weight: 700; font-size: .95rem; }
.social-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
@media (max-width: 767px) { .social-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- tela de login (cartão dividido, tema escuro) ---------- */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr);
  place-items: center; padding: 1.5rem 1rem;
  background: #13161d;
}
.login-card {
  width: min(920px, 100%); min-height: 540px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: #1c2129; border: 1px solid #2d3444; border-radius: 12px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  animation: login-in 300ms ease-out both;
}
@keyframes login-in { from { opacity: 0; transform: translateY(8px); } }
.login-form-side {
  padding: 3rem clamp(1.5rem, 4vw, 3.5rem); display: flex; flex-direction: column;
  justify-content: center; gap: .6rem; color: #eef0f5;
}
.login-form-side .brand { color: #c9cdd9; font-size: .95rem; margin-bottom: 1.5rem; font-family: "Inter", system-ui, sans-serif; font-weight: 600; }
.login-title {
  font-family: "EB Garamond", Garamond, Georgia, serif; font-weight: 600;
  font-size: 2.6rem; color: #f2f3f7; margin: 0; letter-spacing: .01em;
}
.login-dot { color: #e0b25c; }
.login-sub { color: #9aa3b5; margin: 0 0 1.5rem; font-size: .95rem; }
.login-form { display: grid; gap: 1rem; }
.google-slot { display: flex; justify-content: center; min-height: 44px; margin-bottom: 1rem; }
.login-sep {
  display: flex; align-items: center; gap: .75rem; margin: 0 0 1rem;
  color: #6f7689; font-size: .8rem;
}
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: #262b3a; }
.login-form label { display: grid; gap: .4rem; color: #9aa3b5; font-weight: 500; font-size: .85rem; }
.login-form input {
  background: #242a35; border: 1px solid #2d3444; color: #eef0f5;
  min-height: 48px; border-radius: 12px; padding: .7rem .9rem;
}
.login-form input:focus {
  outline: none; border-color: transparent;
  box-shadow: 0 0 0 1px #e0b25c, 0 0 18px rgba(224, 178, 92, .35);
}
.pass-wrap { position: relative; display: block; }
.pass-wrap input { padding-right: 5.5rem; width: 100%; }
.pass-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; color: #9aa3b5; min-height: 36px; padding: .3rem .6rem;
  font-size: .8rem; border-radius: 8px; border: 0;
}
.pass-toggle:focus-visible { outline: 2px solid #e0b25c; outline-offset: 2px; }
.forgot { display: flex; justify-content: flex-end; margin-top: -.25rem; }
.link-btn {
  background: transparent; color: #9aa3b5; border: 0; padding: .25rem 0; min-height: 36px;
  font-size: .85rem; text-decoration: underline; text-underline-offset: 3px;
}
.login-btn {
  width: 100%; min-height: 50px; border: 0; border-radius: 12px; margin-top: .4rem;
  background: #d6a656; color: #12151f;
  font-weight: 600; font-size: 1rem; cursor: pointer;
  box-shadow: none;
}
.login-btn:disabled { opacity: .6; cursor: default; }
@media (hover: hover) {
  .login-btn:hover { filter: brightness(1.05); }
  .link-btn:hover, .login-alt a:hover { color: #eef0f5; text-decoration: none; }
}
.login-alt { text-align: center; margin: .75rem 0 0; font-size: .9rem; }
.login-alt a { color: #9aa3b5; text-decoration: underline; text-underline-offset: 3px; }
.login-art {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; padding: 3rem clamp(1.5rem, 3vw, 2.5rem) 14rem;
  background: #12151f;
}
/* Foto animada: só transform (composição na GPU). A camada fica um pouco maior para não mostrar bordas. */
.login-art::before {
  content: ""; position: absolute; inset: -4%; z-index: -2;
  background: url("/img/login-bg.avif") center / cover no-repeat;
  will-change: transform;
  animation: bible-drift 16s ease-in-out infinite alternate;
}
.login-art::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, #1c2129 0%, rgba(28, 33, 41, .55) 35%, rgba(28, 33, 41, 0) 65%);
}
.login-art .login-quote { position: relative; z-index: 1; }
/* Poeira de luz subindo, como partículas no feixe de luz. Só transform e opacity. */
.login-mote {
  position: absolute; bottom: -12px; left: var(--x); z-index: 0;
  width: var(--size); height: var(--size); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 228, 170, .95), rgba(255, 228, 170, 0) 70%);
  opacity: 0; will-change: transform, opacity;
  animation: mote-rise var(--dur) linear var(--delay) infinite;
}
@keyframes mote-rise {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  15%  { opacity: .85; }
  100% { transform: translate3d(24px, -115vh, 0); opacity: 0; }
}
@keyframes bible-drift {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to   { transform: scale(1.07) translate3d(-1.2%, -1%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .login-art::before, .login-mote { animation: none; }
  .login-mote { display: none; }
}
.login-quote {
  margin: 0; white-space: nowrap; position: relative; padding-left: 1.1rem;
  border-left: 2px solid #e0b25c;
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-style: italic; font-size: 1.4rem; font-weight: 500; line-height: 1.25; color: #f2f3f7;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .6);
  quotes: "\201C" "\201D";
}
.login-quote p { margin: 0; }
.login-quote p::before {
  content: open-quote; color: #e0b25c; font-style: normal; font-size: 2.6rem;
  line-height: 0; vertical-align: -.35em; margin-right: .08em;
}
.login-quote p::after {
  content: close-quote; color: #e0b25c; font-style: normal; font-size: 2.6rem;
  line-height: 0; vertical-align: -.35em; margin-left: .04em;
}
@media (max-width: 760px) {
  .login-card { grid-template-columns: minmax(0, 1fr); min-height: auto; border-radius: 20px; }
  .login-art { order: -1; height: 220px; align-items: flex-end; padding: 1.25rem 1.5rem; }
  .login-art::after {
    background: linear-gradient(180deg, rgba(28, 33, 41, 0) 30%, #1c2129 100%);
  }
  .login-quote { font-size: 1rem; }
  .login-form-side { padding: 1.75rem 1.5rem 2.25rem; }
  .login-title { font-size: 2.1rem; }
}

/* ---------- app shell ---------- */
.shell { font-family: "Inter", system-ui, sans-serif; display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.5rem;
  position: sticky; top: 0; height: 100vh;
}
.nav { display: grid; gap: .25rem; }
.nav a {
  color: var(--text); padding: .55rem .8rem; border-radius: 10px; font-weight: 500;
  min-height: 44px; display: flex; align-items: center; gap: .6rem;
}
@media (hover: hover) {
  .nav a:hover { background: var(--surface-2); text-decoration: none; }
}
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.sidebar-user { margin-top: 0; display: flex; gap: .6rem; align-items: center; }
.sidebar-user .name { font-weight: 700; line-height: 1.2; }
.main { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 5rem; max-width: 1200px; width: 100%; }
.page-head { margin-bottom: 1.25rem; }

.bottom-nav { display: none; }

/* ---------- dashboard ---------- */
/* Início: mesmo tom escuro e dourado da tela de login */
.dash h1, .dash h2 { font-family: "Inter", system-ui, sans-serif; font-weight: 600; }
.dash h2 { font-size: 1.2rem; margin: 0 0 .25rem; }
.hero {
  display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: none;
}
.hero .avatar { border-color: var(--accent); background: var(--surface-2); color: var(--accent-text); }
.hero .muted { color: var(--muted); }
.hero-kicker { margin: 0; color: var(--muted); font-size: .9rem; }
.hero-text { min-width: 0; }
.hero-text h1 { margin: 0; color: var(--text); font-size: 1.6rem; }
.hero-actions { margin-left: auto; display: flex; gap: .6rem; flex-wrap: wrap; }
.social-links { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.social-link {
  width: 44px; height: 44px; border-radius: 999px; display: inline-grid; place-items: center;
  color: var(--accent-text); border: 1px solid var(--border); background: var(--surface-2);
  text-decoration: none;
}
.social-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.social-link:focus-visible { outline: 2px solid #e0b25c; outline-offset: 2px; }
@media (hover: hover) {
  .social-link:hover { background: rgba(224, 178, 92, .14); text-decoration: none; }
}
.btn-ghost-light { background: transparent; color: var(--text); border: 1px solid var(--border); }
.dash-clock {
  display: block; color: var(--muted); font-size: .92rem; font-weight: 500;
  margin: -.25rem 0 .9rem; font-variant-numeric: tabular-nums;
}
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat .sub { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.dash-side { display: grid; gap: 1rem; }
.dash-list { display: grid; gap: .6rem; margin-top: .75rem; }
.dash-item {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: .9rem; align-items: center;
  padding: .6rem; border-radius: 12px; color: inherit; border: 1px solid var(--border);
}
.dash-item:hover { text-decoration: none; background: var(--surface-2); }
.dash-item-body { display: grid; gap: .25rem; min-width: 0; }
.dash-sermon {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.dash-sermon:last-child { border-bottom: 0; }
.dash-amount { font-family: "Inter", system-ui, sans-serif; font-size: 2rem; font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.1; margin: .25rem 0; }
.hero-role { font-size: .9rem; color: var(--accent-text); font-weight: 600; }
.stat { display: flex; flex-direction: column; gap: .25rem; color: var(--text); transition: transform 150ms ease-out; }
@media (hover: hover) {
  .stat:hover { text-decoration: none; transform: translateY(-1px); }
}
.stat .num { font-size: 2.2rem; font-weight: 800; color: var(--primary); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-weight: 600; }
/* ---------- lists ---------- */
.list { display: grid; gap: .75rem; }
.item { display: grid; grid-template-columns: 96px 1fr auto; gap: 1rem; align-items: center; }
.date-box {
  background: var(--accent-soft); color: var(--accent-text); border-radius: 12px; padding: .5rem;
  text-align: center; font-weight: 700; line-height: 1.2;
}
.date-box .d { font-size: 1.5rem; display: block; font-variant-numeric: tabular-nums; }
.date-box .t { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.item-title { font-weight: 700; }
.meta { color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.item-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }

.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters label { min-width: 160px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: .5rem 1rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

.section-title { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0 .75rem; }

/* ---------- responsive ---------- */
@media (max-width: 767px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 1.25rem 1rem 6.5rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .dash-stats, .dash-cols { grid-template-columns: minmax(0, 1fr); }
  .hero-actions { margin-left: 0; width: 100%; }
  .hero-actions .btn { flex: 1; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: .4rem .25rem calc(.4rem + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; text-align: center; font-size: .75rem; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .1rem; min-height: 52px; padding: .25rem 0;
  }
  .bottom-nav a.active { color: var(--accent-text); font-weight: 700; }
  .item { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-start; }
  .kv { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; }
  .photo-picker { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- agenda: atalhos, grupos por mês, busca ---------- */
[hidden] { display: none !important; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: .4rem .9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; font-size: .9rem;
}
.chip:hover { text-decoration: none; background: var(--surface-2); }
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: transparent; font-weight: 600; }
.month-group { margin-bottom: 1.5rem; }
.month-title {
  font-family: "Inter", system-ui, sans-serif; font-weight: 600; font-size: 1.3rem;
  margin: 0 0 .6rem; color: var(--text);
}
.empty-msg { text-align: center; color: var(--muted); padding: 1.5rem 1rem; }

/* ---------- janela de confirmação ---------- */
.confirm-dialog {
  border: 0; border-radius: 16px; padding: 1.5rem; width: min(420px, 92vw);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.confirm-dialog::backdrop { background: rgba(10, 13, 22, .55); }
.confirm-dialog h2 { font-size: 1.35rem; font-family: "Inter", system-ui, sans-serif; }

/* Tablet (768 a 1023 px): menu lateral, cartões do início em uma coluna */
@media (min-width: 768px) and (max-width: 1023px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { width: 220px; }
  .dash-cols { grid-template-columns: minmax(0, 1fr); }
}

/* Tablet: itens da agenda ganham mais espaço para o texto; os botões vão para a linha de baixo */
@media (min-width: 768px) and (max-width: 1023px) {
  .item { grid-template-columns: 84px minmax(0, 1fr); }
  .item-actions { grid-column: 2; justify-content: flex-start; }
}

/* Passagem aérea (eventos fora do estado) */
.checkbox-row { display: flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; }
.checkbox-row input { width: auto; min-height: auto; margin: 0; }
.flight-section { border: 0; border-top: 1px solid var(--border); padding: 1rem 0 0; margin: .25rem 0 0; min-width: 0; }
.flight-section legend { font-weight: 700; padding: 0; margin-bottom: .75rem; }
.ticket-current { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .9rem; }
.flight-section legend .hint { margin-left: .5rem; font-weight: 400; }

/* ---------- agenda em tabela ---------- */
.agenda-table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.agenda-table th {
  background: var(--surface-2); text-align: left; font-size: .78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; padding: .7rem .8rem; border-bottom: 1px solid var(--border);
}
.agenda-table td { padding: .75rem .8rem; border-top: 1px solid var(--border); vertical-align: top; font-size: .92rem; }
.agenda-table thead th:first-child, .agenda-table tbody tr:first-child td { border-top: 0; }
.agenda-table tbody tr:hover { background: var(--surface-2); }
.agenda-table .row-actions { text-align: right; white-space: nowrap; width: 1%; }
.agenda-table .row-actions .btn { margin-left: .25rem; }
.agenda-table a { color: var(--text); }
.agenda-table a:hover { color: var(--accent-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.month-group { margin-bottom: 1.75rem; }

/* Tablet: colunas secundárias ficam ocultas para caber a tabela */
@media (min-width: 768px) and (max-width: 1199px) {
  .agenda-table .col-opt { display: none; }
}

/* Celular: cada registro vira um bloco, com o nome do campo ao lado do valor */
@media (max-width: 767px) {
  .agenda-table thead { display: none; }
  .agenda-table, .agenda-table tbody, .agenda-table tr, .agenda-table td { display: block; width: 100%; }
  .agenda-table { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .agenda-table tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .5rem .8rem; margin-bottom: .75rem; box-shadow: var(--shadow);
  }
  .agenda-table tbody tr:first-child td { border-top: 0; }
  .agenda-table td { border: 0; padding: .3rem 0; display: flex; gap: .6rem; align-items: baseline; }
  .agenda-table td::before {
    content: attr(data-label); color: var(--muted); font-size: .78rem; min-width: 6.25rem; flex: none;
  }
  .agenda-table td.row-actions { display: flex; justify-content: flex-end; padding-top: .5rem; }
  .agenda-table td.row-actions::before { content: none; }
  .agenda-table .col-opt { display: flex; }
}
.agenda-table td[data-label="Igreja"] { min-width: 200px; }
.agenda-table td[data-label="Data"], .agenda-table td[data-label="Oferta"], .agenda-table td[data-label="Decisões"] { white-space: nowrap; }
/* Entre tablet e desktop estreito, a coluna Evento sai para caber a tabela */
@media (min-width: 768px) and (max-width: 1399px) {
  .agenda-table .col-evento { display: none; }
}
@media (max-width: 767px) {
  .agenda-table td.row-actions { width: 100%; }
}
/* Celular: textos longos (ex.: Instagram) quebram dentro da célula em vez de estourar a tela */
@media (max-width: 767px) {
  .agenda-table td { min-width: 0; overflow-wrap: anywhere; }
}
/* Celular: o pastor aparece abaixo do nome da igreja, alinhado à coluna de valores */
@media (max-width: 767px) {
  .agenda-table td[data-label="Igreja"] { flex-wrap: wrap; }
  .agenda-table td[data-label="Igreja"] > .muted { flex-basis: 100%; margin-left: calc(6.25rem + .6rem); }
}

/* Eventos fora do estado: linha em amarelo (com rótulo, para não depender só da cor) */
.agenda-table tr.row-outside { background: var(--warn-soft); }
.legend { display: flex; align-items: center; gap: .5rem; margin: 0 0 .75rem; }
.legend-swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn);
}

/* Próximos compromissos fora do estado: destaque amarelo */
.dash-item.row-outside { background: var(--warn-soft); border-color: var(--warn); }

/* Visitas fora do estado no detalhe da igreja */
.visit-row.row-outside { background: var(--warn-soft); border-radius: 8px; padding: .5rem .6rem; border-bottom-color: transparent !important; }

/* Cartões de números: filete de acento no topo */
.stat { position: relative; overflow: hidden; }
.stat::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--stat-line);
}

/* Cabeçalho da tela inicial: foto da Bíblia à direita, esmaecida para o fundo do cartão */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero > :not(.hero-art) { position: relative; z-index: 1; }
.hero-art {
  position: absolute; top: 0; right: 0; bottom: 0; width: 60%; z-index: 0;
  background: url("/img/login-bg.avif") center / cover no-repeat;
}
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 65%, transparent) 40%, transparent 100%);
}
.hero .btn-ghost-light { background: var(--surface); }
@media (max-width: 767px) { .hero-art { width: 100%; opacity: .3; } }
/* Tema claro: foto mais discreta, com névoa clara por cima */
:root[data-theme="light"] .hero-art { opacity: .45; }
:root[data-theme="light"] .hero-art::after {
  background: linear-gradient(90deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 75%, transparent) 40%, color-mix(in srgb, var(--surface) 40%, transparent) 100%);
}

/* Login: filete de acento no topo do cartão */
.login-card { position: relative; }
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: #d6a656; z-index: 3;
}

/* Cadastro: acabamento alinhado ao restante do sistema */
.auth-card { position: relative; padding: 2rem 2rem 1.75rem; }
.auth-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--stat-line); border-radius: 12px 12px 0 0;
}
.auth-switch a { color: var(--accent-text); font-weight: 600; }

/* Acessibilidade e teclado */
.skip-link {
  position: absolute; left: .75rem; top: -48px; z-index: 100; background: var(--primary); color: var(--primary-ink);
  padding: .5rem .9rem; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: .75rem; text-decoration: none; }
#main:focus { outline: none; }
.agenda-table tbody tr:focus-within { background: var(--surface-2); }

/* Ícone das telas vazias */
.empty svg {
  display: block; width: 40px; height: 40px; margin: 0 auto .6rem; fill: none;
  stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

/* Janela de confirmação no celular: botões em largura total */
@media (max-width: 767px) {
  .confirm-dialog .row { flex-direction: column-reverse; align-items: stretch; }
  .confirm-dialog .btn { width: 100%; justify-content: center; }
}

/* Conta, barra de ferramentas e impressão */
.account-card { margin-top: 1rem; }
.account-card h2 { margin-bottom: .75rem; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; margin-bottom: .75rem; }
.privacy { max-width: 720px; width: 100%; line-height: 1.6; }
.privacy h2 { font-size: 1.05rem; margin: 1.1rem 0 .3rem; }
.privacy p { margin: 0; }
.checkbox-row a { color: var(--accent-text); }
@media print {
  .sidebar, .bottom-nav, .theme-toggle, .chips, .toolbar, #filters, .row-actions, .skip-link, .page-head .btn { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .agenda-table { box-shadow: none; border: 0; }
  .agenda-table td, .agenda-table th { color: #000; }
  .agenda-table tr { break-inside: avoid; }
  .month-group { break-inside: avoid-page; }
}
