/* SalmodiApp · Ministério
   A página da equipe usa os mesmos cartões, verdes e controles de app.css. */

/* embaixo só a barra de abas */
body.ministry-page { --dock: calc(59px + env(safe-area-inset-bottom, 0px)); padding-bottom: calc(var(--dock) + 32px); }

a.link { display: inline-flex; align-items: center; min-height: 32px; }
.account-box { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.account-box .who { font-weight: 700; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- cabeçalho e blocos ---------- */
.crumbs { margin: 16px 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.crumbs a { color: var(--brand); font-weight: 700; text-underline-offset: 3px; text-decoration-color: var(--brand-line); }
:root[data-theme="dark"] .crumbs a { color: var(--ink); }
.page-head { padding-block: 20px 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.page-head h1 {
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
  text-wrap: balance;
}
.ministry-head { flex-direction: row; align-items: center; gap: 16px; }
.ministry-head > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lede { margin: 0; color: var(--ink-soft); max-width: 60ch; }
.ministry-description { margin: 0; max-width: 60ch; white-space: pre-wrap; }
.page-head .meta { margin-top: 0; color: var(--ink-soft); }
.notes-text { margin: 0; white-space: pre-wrap; max-width: 70ch; background: var(--brand-soft); border-radius: var(--radius); padding: 10px 12px; }

.block { background: var(--paper-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 16px; margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.block-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; justify-content: space-between; }
.soft { color: var(--ink-soft); }
.small { font-size: 0.84rem; }
.mono { font-family: var(--num); font-weight: 600; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
/* o tom combinado é uma plaquinha, como na placa */
.chip { display: inline-grid; place-items: center; min-width: 2.6em; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font: 700 0.85rem/1.2 var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
:root[data-theme="dark"] .chip { color: var(--ink); }
.points { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; max-width: 62ch; }
.points li::marker { color: var(--brand); font-weight: 700; }
.help-page .block .points { gap: 10px; }
.signin-block { max-width: 460px; }
.signin { display: flex; flex-direction: column; gap: 12px; }
.signin .help a { color: var(--brand); font-weight: 700; text-underline-offset: 3px; }
.loading { padding-top: 32px; }

/* ---------- painel do administrador ---------- */
.admin-row { display: flex; flex-direction: column; gap: 8px; }
.admin-head { display: flex; align-items: center; gap: 12px; }
.admin-head .row-main { flex: 1; }
.admin-plan select { flex: 1 1 160px; }
.admin-plan input { flex: 0 0 90px; width: 90px; }
.admin-field { display: flex; align-items: center; gap: 10px; font-weight: 600; flex: 1; }
.admin-field input { width: 100px; }
.chip.full { background: color-mix(in oklab, var(--danger) 14%, #fff); color: var(--danger); }

/* ---------- perfil ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; padding-block: 22px 6px; }
.profile-head h1 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.profile-photo { flex: none; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font: 800 1.5rem/1 var(--body); }
.row-actions { display: flex; gap: 16px; padding: 4px 0 2px 56px; }
.account-box .who { color: var(--ink); text-decoration: none; }
.danger { color: var(--danger); }

/* ---------- avatar do ministério ---------- */
.m-avatar { flex: none; width: 44px; height: 44px; border-radius: 14px; object-fit: cover; display: grid; place-items: center; background: var(--brand); color: #fff; font: 800 1rem/1 var(--num); letter-spacing: -0.01em; }
.m-avatar.lg { width: 72px; height: 72px; border-radius: 22px; font-size: 1.6rem; }

/* ---------- linhas separadas por filete ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--rule); padding-block: 10px; }
.rows > li:last-child { border-bottom: 0; }
.row-link { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-height: 48px; }
.row-link .row-main { flex: 1; }
.row-link:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--brand-line); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main b { overflow-wrap: anywhere; }

/* ---------- equipe ---------- */
.member-line { display: flex; align-items: center; gap: 12px; }
.member { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.role { font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--ink-soft); }
.member-edit { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.member-edit[hidden] { display: none; }

/* botões liga/desliga das funções e das pessoas: o ligado fica na cor do ministério */
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggles button, .segmented button { font-size: 0.94rem; }
.toggles button { border-radius: 999px; }
/* ícone do instrumento antes do nome da função */
.toggles button[data-icon]::before, .fn[data-icon]::before { content: attr(data-icon); margin-right: 6px; font-size: 1.05em; }
.toggles button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); font-weight: 700; }
.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; max-width: 460px; border-radius: 14px; background: var(--paper); padding: 4px; gap: 4px; }
.segmented button { border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft); font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 700; }

.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.inline-form input { flex: 1 1 220px; min-width: 0; }
.invite input { font-size: 0.88rem; }
.invite { display: flex; flex-direction: column; gap: 8px; }
.invite[hidden] { display: none; }

.qr-box { margin: 4px 0 0; display: flex; align-items: center; gap: 16px; }
.qr-box .qr { width: 168px; height: 168px; flex: none; border-radius: 8px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-item { border-top: 1px solid var(--rule); padding-block: 4px; }
.guide-item summary { cursor: pointer; font-weight: 600; padding: 10px 0; min-height: 44px; display: flex; align-items: center; }
.guide-item[open] summary { color: var(--brand); }
.guide-item .points { padding-bottom: 10px; }
.import-manual summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 6px 0; }
.import-manual[open] { display: flex; flex-direction: column; gap: 8px; }
.checks > li { padding-block: 6px; }
.check-row { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 44px; }
.check-row input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.import-done:not([hidden]) { background: var(--paper-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 4px 16px; margin-top: 14px; list-style: none; }
.import-box { min-height: 14em; font: 0.95rem/1.45 var(--body); white-space: pre-wrap; }
.sub { margin: 6px 0 0; font-size: 0.95rem; font-weight: 700; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- foto e cor ---------- */
.brand-photo { display: flex; align-items: center; gap: 16px; }
.brand-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; background: var(--swatch); border: 2px solid var(--paper-raised); box-shadow: 0 0 0 1px var(--rule); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.swatch.custom { position: relative; overflow: hidden; display: grid; place-items: center; cursor: pointer; background: conic-gradient(#c62828, #f9a825, #2e7d32, #1565c0, #6a1b9a, #c62828); }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* recorte da foto: a área quadrada com a moldura arredondada do avatar */
.crop-stage { position: relative; width: min(288px, 100%); aspect-ratio: 1; margin: 0 auto; border-radius: 12px; overflow: hidden; background: var(--paper); touch-action: none; }
.crop-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.crop-canvas:active { cursor: grabbing; }
.crop-mask { position: absolute; inset: 0; pointer-events: none; border-radius: 22%; box-shadow: 0 0 0 999px rgb(0 0 0 / 0.45); outline: 2px solid #fff; outline-offset: -2px; }
.crop-zoom { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.crop-zoom input { flex: 1; }

/* ---------- escala ---------- */
.people > li { display: grid; grid-template-columns: minmax(80px, 9rem) 1fr auto; gap: 12px; align-items: baseline; }
.fn { font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); }
.people .state { font-size: 0.86rem; font-weight: 700; }
.presence-confirmed .state { color: var(--brand); }
:root[data-theme="dark"] .presence-confirmed .state { color: var(--ink); }
.presence-confirmed .state::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.presence-pending .state, .presence-pending .who { color: var(--ink-soft); }
.presence-declined .who { text-decoration: line-through; text-decoration-color: var(--rule-strong); color: var(--ink-soft); }
.presence-declined .state { color: var(--ink-soft); }

/* o repertório é a própria placa: número da música e plaquinha do tom */
.songs > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.songs .row-main { flex: 1 1 180px; }
.pos { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font: 800 0.95rem/1 var(--num); }
.song-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; width: 100%; padding-left: 48px; }
.song-actions button { min-height: 36px; padding: 4px 12px; }
.copy { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.copy-box { min-height: 10em; width: min(100%, 520px); }

/* ---------- editor ---------- */
.fields-2 { display: grid; grid-template-columns: 1fr 240px; gap: 12px; }
.fields-2 .span { grid-column: 1 / -1; }
.full label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
input[type=datetime-local] { font-family: var(--num); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
textarea.notes { min-height: 5.5em; font: inherit; white-space: pre-wrap; }
.fn-group { display: grid; grid-template-columns: minmax(80px, 9rem) 1fr; gap: 12px; align-items: baseline; padding-block: 8px; border-bottom: 1px solid var(--rule); }
.fn-group:last-child { border-bottom: 0; }
.song-edit > li { display: flex; flex-direction: column; gap: 8px; }
.song-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.song-line input { flex: 1 1 180px; min-width: 0; }
.song-line select { min-width: 7.5em; }
.row-tools { display: flex; gap: 4px; }
.row-tools button { min-width: 40px; padding: 5px 8px; }
.links-line { padding-left: calc(36px + 8px); }
.links-line input { font-size: 0.9rem; }
.add-song select { flex: 1 1 220px; min-width: 0; max-width: 420px; justify-content: flex-start; }
.sticky-actions { position: sticky; bottom: var(--dock); background: var(--paper); padding-bottom: 14px; }

@media (max-width: 560px) {
  .page-head h1 { font-size: 1.85rem; }
  .m-avatar.lg { width: 60px; height: 60px; border-radius: 15px; font-size: 1.6rem; }
  .fields-2 { grid-template-columns: 1fr; }
  .people > li, .fn-group { grid-template-columns: 1fr auto; }
  .people .fn, .fn-group .fn { grid-column: 1 / -1; }
  .links-line { padding-left: 0; }
  .song-actions { padding-left: 0; }
  .account-box .who { display: none; }
  .sticky-actions { position: static; }
}
@media (pointer: coarse) {
  .song-actions button { min-height: 44px; }
}
