/* Paróquia Santa Clara de Assis — tons franciscanos (burel, pergaminho, ouro) */
:root {
  --bg: #f7f3ec;
  --surface: #ffffff;
  --surface-2: #fbf8f2;
  --ink: #2b2219;
  --ink-2: #6d6155;
  --line: #e6ddd0;
  --brand: #6b4423;
  --brand-2: #8a5a30;
  --brand-ink: #fdf8ee;
  --gold: #b88a2e;
  --gold-soft: #f4e7c5;
  --ok: #2f7a4b; --ok-bg: #e4f2e8;
  --warn: #9a6400; --warn-bg: #fbefd5;
  --danger: #a3322a; --danger-bg: #f8e1de;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 2px 8px rgba(60, 40, 20, .05);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
h1 { font: 700 30px/1.15 var(--serif); color: var(--brand); }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-top: 1em; }
.section > h3:first-child, .section-head h3 { margin-top: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.boot { padding: 40px; text-align: center; color: var(--ink-2); }
.print-only { display: none; }

/* ---------- layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: var(--brand); color: var(--brand-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px; }
.brand b { display: block; font: 700 18px/1.15 var(--serif); }
.brand span { font-size: 12px; opacity: .75; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--gold-soft); color: var(--brand); display: grid; place-items: center; font-size: 22px; flex: none; }
.logo.big { width: 56px; height: 56px; font-size: 30px; }
.sidebar nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.sidebar nav a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--brand-ink); opacity: .85; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; opacity: 1; }
.sidebar nav a.active { background: var(--gold-soft); color: var(--brand); opacity: 1; }
.sidebar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.me { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .12); display: grid; gap: 8px; font-size: 13px; }
.me b { display: block; }
.me span { opacity: .75; font-size: 12px; }
.me .btn { color: var(--brand-ink); border-color: rgba(255, 255, 255, .3); justify-self: start; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .menu { display: none; }
.search { flex: 1; max-width: 420px; }
.search input { width: 100%; }
.view { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 18px 20px; margin-bottom: 16px; }
.pad { padding: 8px 14px; margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 2px 0; }
.back { font-size: 13px; display: inline-block; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 10px; flex-wrap: wrap; }
.section-head + .section-head { margin-top: 18px; }
.group-title { font: 700 21px var(--serif); color: var(--brand); margin: 22px 0 10px; }
.tema { font-family: var(--serif); font-size: 18px; font-style: italic; margin: 4px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 14px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: #e7c2bd; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px 7px; border-radius: 6px; color: var(--ink-2); font-size: 15px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
textarea { resize: vertical; }

.filters { display: flex; gap: 10px; padding: 12px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1 1 260px; }
.filters select { flex: 0 1 200px; }
.filters .inline { display: flex; gap: 6px; align-items: center; }
.filters .inline span { font-size: 12.5px; color: var(--ink-2); }
.spacer { flex: 1; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--surface-2); }
.table tr.inactive td, .tile.inactive { opacity: .55; }
.table tr.pending td { background: var(--warn-bg); }
.row-actions { text-align: right; white-space: nowrap; width: 1%; }

.chip { display: inline-block; padding: 2px 8px; margin: 1px 3px 1px 0; border-radius: 999px; background: var(--gold-soft); color: #5a3d16; font-size: 12px; white-space: nowrap; }
.chip.muted { background: var(--surface-2); color: var(--ink-2); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 500; vertical-align: middle; font-family: var(--sans); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11.5px; text-align: center; color: var(--ink-2); font-weight: 600; }
.sigla { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--brand); color: var(--brand-ink); font: 600 12px var(--sans); margin-right: 6px; }
.sigla.big { font-size: 16px; padding: 2px 10px; vertical-align: middle; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--gold); }

.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; margin: 0 0 8px; }
.dl dt { font-size: 12px; color: var(--ink-2); }
.dl dd { margin: 0; font-weight: 500; }

.empty { padding: 22px; text-align: center; color: var(--ink-2); }
.empty p { margin: 0 0 8px; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.two .section { margin: 0; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tile { padding: 14px 16px; color: var(--ink); display: grid; gap: 4px; }
.tile:hover { border-color: var(--gold); text-decoration: none; }
.tile-top { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; color: var(--ink); box-shadow: var(--shadow); }
.stat:hover { text-decoration: none; border-color: var(--gold); }
.stat b { display: block; font: 700 32px/1.1 var(--serif); color: var(--brand); }
.stat span { color: var(--ink-2); font-size: 13px; }
.small-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 520px; }
.small-stats .stat b { font-size: 24px; }

.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.people li:last-child { border-bottom: 0; }
.people li.today { background: var(--ok-bg); margin: 0 -8px; padding: 7px 8px; border-radius: 6px; }
.people.cols { columns: 3 220px; column-gap: 24px; }
.people.cols li { break-inside: avoid; }
.day { display: inline-block; width: 26px; color: var(--gold); }
.team { padding: 14px 16px; }
.team h3 { margin: 0 0 6px; display: flex; justify-content: space-between; }
.quick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; }

.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 110px 1fr 32px; gap: 10px; align-items: center; color: var(--ink); }
.bar:hover { text-decoration: none; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar-track span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.bar b { text-align: right; }
.checks { list-style: none; padding: 0; margin: 0 0 8px; }
.checks li { padding: 6px 0 6px 24px; position: relative; }
.checks li::before { position: absolute; left: 0; content: '✓'; color: var(--ok); font-weight: 700; }
.checks li.warn::before { content: '!'; color: var(--warn); left: 6px; }
.kin { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.kin-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kin-card ul, .plain { margin: 6px 0 0; padding-left: 18px; }
.plain li { margin: 4px 0; }

/* ---------- modal e formulários ---------- */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(40, 25, 10, .3); display: flex; flex-direction: column; color: var(--ink); background: var(--surface); }
.modal:not([open]) { display: none; }
.modal.wide { width: min(880px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(43, 34, 25, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font: 700 22px var(--serif); color: var(--brand); }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 18px; flex-wrap: wrap; }
.field.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.field.check span { color: var(--ink); font-size: 14px; }
.hint { color: var(--ink-2); font-size: 11.5px; }
.req { color: var(--danger); }
.form-section { font: 700 17px var(--serif); color: var(--brand); margin: 8px 0 -4px; padding-top: 8px; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-note { margin: 0; padding: 10px 12px; background: var(--gold-soft); border-radius: 8px; font-size: 13px; }
.form-error { color: var(--danger); background: var(--danger-bg); padding: 8px 12px; border-radius: 8px; margin: 12px 0 0; }
.picker select { min-height: 140px; }
.picker select option { padding: 4px 6px; }
.picker select option:checked { background: var(--gold-soft); }
.notice { background: var(--gold-soft); padding: 10px 12px; border-radius: 8px; }
.col-1 { grid-column: span 1; } .col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.col-12 { grid-column: 1 / -1; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }

#toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 1000; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; animation: up .2s ease-out; }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warn); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login { min-height: 100vh; width: 100%; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #8a5a30, #4a2e16); }
.login-card { width: min(420px, 100%); padding: 28px; }
.brand.center { flex-direction: column; text-align: center; padding: 0 0 18px; color: var(--brand); }
.brand.center span { color: var(--ink-2); opacity: 1; }
.login-card .btn { padding: 11px; }
.login-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; }

/* ---------- responsivo ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 4px 0 24px rgba(0, 0, 0, .2); }
  .topbar { padding: 10px 16px; }
  .topbar .menu { display: block; font-size: 20px; }
  .view { padding: 16px 16px 48px; }
  h1 { font-size: 25px; }
  .form-grid > * { grid-column: 1 / -1 !important; }
  .field.check { padding-top: 0; }
  .filters select, .filters .inline { flex: 1 1 100%; }
  .filters .inline select { flex: 1; }
  .bar { grid-template-columns: 90px 1fr 28px; }
  .small-stats { max-width: none; }
}

/* ---------- impressão ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .row-actions, .quick, #toasts { display: none !important; }
  .print-only { display: block; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .grid.cards { grid-template-columns: repeat(3, 1fr); }
  a { color: inherit; }
  .table th { background: #f2f2f2; }
}
