/* Administração — desktop */
.a-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; background: #fff; }

.a-side {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--navy); color: #fff;
  padding: 28px 16px 20px;
}
.a-side__logo { padding: 0 12px 32px; }
.a-side__logo img { width: 150px; height: auto; }
.a-nav { display: grid; gap: 4px; }
.a-nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 12px; border-radius: 10px;
  color: rgba(255, 255, 255, 0.7); font-size: 14px; font-weight: 500;
  transition: color var(--t), background var(--t);
}
.a-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.a-nav a.is-active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.a-nav a.is-active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 2px 2px 0; background: var(--orange); }
.a-nav__short { display: none; }
.a-nav .badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--orange); color: #fff; font-size: 13px; font-weight: 600; line-height: 20px; text-align: center;
}
.a-side__foot { margin-top: auto; display: grid; gap: 14px; }
.a-side__ghost {
  display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18); color: rgba(255, 255, 255, 0.85); font-size: 13px; font-weight: 500;
  transition: border-color var(--t), background var(--t);
}
.a-side__ghost span { flex: 1; text-align: left; }
.a-side__ghost:hover { border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.04); }
.a-side__ver { padding: 0 4px; font-size: 13px; color: rgba(255, 255, 255, 0.5); }

.a-main { min-width: 0; }
.a-bar {
  position: sticky; top: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 68px; padding: 0 40px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.a-search { position: relative; width: 100%; max-width: 380px; }
.a-search .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.a-search input {
  width: 100%; height: 42px; padding: 0 14px 0 42px; border-radius: 21px;
  border: 1px solid transparent; background: #F4F4F6; font-size: 14px; outline: none;
  transition: border-color var(--t), background var(--t);
}
.a-search input:focus { background: #fff; border-color: var(--navy); }
.a-bar__end { display: flex; align-items: center; gap: 12px; }
.a-bar__sep { width: 1px; height: 28px; background: var(--line); }
.a-icon {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink); transition: border-color var(--t), background var(--t);
}
.a-icon:hover { border-color: var(--line-strong); background: #FAFAFB; }
.a-icon .count { top: -4px; right: -4px; box-shadow: 0 0 0 2px #fff; }
.a-me { display: flex; align-items: center; gap: 10px; }
.a-me p { font-size: 14px; font-weight: 600; line-height: 1.25; }
.a-me .a-me__role { font-size: 13px; font-weight: 400; color: var(--ink-2); }

.a-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 32px 40px 24px; }
.a-top__eyebrow { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.a-top h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.a-top__actions { display: flex; gap: 8px; }
.a-top__actions .btn { border-radius: 10px; }
.a-content { padding: 0 40px 64px; }
.a-content .card { border-radius: 14px; border-color: #EAEAEF; }

/* Separadores sublinhados */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 44px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: color var(--t);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--navy); font-weight: 600; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--navy); border-radius: 2px 2px 0 0; }
.tab__n { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: #F1F1F4; color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 20px; text-align: center; }
.tab[aria-selected="true"] .tab__n { background: var(--tint); color: var(--navy); }

/* Painel */
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; }
.dash__wide { grid-column: 1 / -1; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.card-head--table { padding: 20px 24px 4px; margin-bottom: 0; }

.obra-card { padding: 28px 28px 24px; }
.obra-card__amount { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.obra-card__amount .display-num { font-size: 40px; line-height: 1; font-weight: 700; color: var(--navy); }
.obra-card__amount .unit { font-family: var(--font-display); font-size: 18px; color: var(--ink-2); }
.obra-card__of { margin-top: 10px; font-size: 14px; }
.obra-card .progress { margin-top: 22px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 28px; border-top: 1px solid var(--line); }
.stats > div { padding: 18px 16px 0 0; }
.stats > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.stats dt { font-size: 13px; color: var(--ink-2); }
.stats dd { margin-top: 4px; font-family: var(--font-display); font-size: 16px; font-variant-numeric: tabular-nums; }

.pend-card { padding: 28px; display: flex; flex-direction: column; }
.pend-card .display-num { font-size: 40px; line-height: 1; font-weight: 700; margin-top: 18px; }
.pend-card > p.muted { margin-top: 10px; font-size: 14px; }
.pend-card .btn { margin-top: auto; }
.pend-card__spacer { flex: 1; min-height: 24px; }

.methods { display: grid; gap: 18px; }
.method__top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.method__bar { margin-top: 8px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.method__bar > div { height: 100%; background: var(--navy); border-radius: 2px; transform-origin: left; animation: grow 800ms var(--ease) both; }

/* Confirmações */
.review { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }
.queue { overflow: hidden; }
.queue__item {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  transition: background var(--t);
}
.queue__item:last-child { border-bottom: 0; }
.queue__item:hover { background: #FAFAF9; }
.queue__item[aria-current="true"] { background: var(--tint); box-shadow: inset 2px 0 0 var(--navy); }
.queue__main { flex: 1; min-width: 0; }
.queue__name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue__meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.queue__val { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: 16px; white-space: nowrap; }
.review__detail { position: sticky; top: 24px; }
.review__actions { display: flex; gap: 8px; padding: 20px 24px; border-top: 1px solid var(--line); }
.review__actions .btn-primary { flex: 1; }
.review__reject { padding: 20px 24px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.review__reject-actions { display: flex; gap: 8px; justify-content: flex-end; }
.reason-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.reason-chips button {
  font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  color: var(--ink-2); transition: border-color var(--t), color var(--t); text-align: left;
}
.reason-chips button:hover { border-color: var(--line-strong); color: var(--ink); }

/* Barra de ferramentas e tabelas */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .select { width: auto; min-width: 150px; height: 40px; font-size: 14px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.search .input { height: 40px; padding-left: 38px; font-size: 14px; }
.table-card { overflow-x: auto; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }

/* Obra */
.obra-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.obra-form form { display: grid; gap: 20px; }
.obra-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview { padding: 28px; background: var(--bg); border-radius: var(--r-lg); border: 1px dashed var(--line-strong); }
.preview .obra { margin-top: 12px; }
/* Como o membro vê a obra: o mesmo cartão, em ponto pequeno */
.obra__amount { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 32px; line-height: 1.1; font-weight: 700; color: var(--navy); }
.obra__unit { font-family: var(--font-display); font-size: 16px; font-weight: 500; color: var(--ink-2); }
.obra__of { margin-top: 8px; font-size: 14px; }
.obra .progress { margin-top: 16px; }
.obra__foot { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.obra__foot strong { color: var(--ink); font-weight: 600; }

@media (max-width: 1100px) {
  /* minmax(0, …): sem isto as colunas crescem até ao conteúdo e a página transborda */
  .dash, .review, .obra-form { grid-template-columns: minmax(0, 1fr); }
  .review__detail { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3) { border-left: 0; padding-left: 0; }
}
/* Mensagens */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100dvh - 68px - 120px); min-height: 480px; overflow: hidden; }
.inbox__list { border-right: 1px solid var(--line); overflow-y: auto; }
.inbox__item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 18px; text-align: left; border-bottom: 1px solid #F0F0F3; transition: background var(--t); }
.inbox__item:hover { background: #FAFAFB; }
.inbox__item[aria-current="true"] { background: var(--tint); box-shadow: inset 3px 0 0 var(--navy); }
.inbox__main { flex: 1; min-width: 0; }
.inbox__name { font-size: 14px; font-weight: 600; }
.inbox__snip { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.inbox__end { display: grid; justify-items: end; gap: 6px; flex: none; }
.inbox__end time { font-size: 13px; color: var(--ink-2); }
.badge-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 13px; font-weight: 600; line-height: 20px; text-align: center; }
.inbox__thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.inbox__head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.inbox__body { flex: 1; overflow-y: auto; padding: 8px 24px 20px; }
.inbox__composer { padding: 14px 24px; border-top: 1px solid var(--line); }

/* Membros */
.row-actions { display: inline-flex; gap: 8px; justify-content: flex-end; }
.row-actions .btn, .table .btn-sm { border-radius: 8px; }
.table tr.is-muted td { color: var(--ink-2); }
.table tr.is-muted .avatar { opacity: 0.55; }
.tab__n.is-alert { background: var(--orange); color: #fff; }
.tab[aria-selected="true"] .tab__n.is-alert { background: var(--orange); color: #fff; }
.table-card .table td { white-space: nowrap; }

@media (max-width: 760px) {
  .a-shell { grid-template-columns: 1fr; }
  .a-side { position: static; height: auto; min-width: 0; padding: 12px 0; }
  .a-nav__short { display: block; }
  .a-bar { height: 60px; padding: 0 16px; gap: 12px; }
  .a-me div, .a-bar__sep { display: none; }
  .a-side__logo { padding: 0 16px; }
  .a-side__logo img { width: 104px; }
  /* A navegação passa a barra fixa em baixo, como na app do membro */
  .a-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
    grid-template-columns: repeat(var(--nav-n, 6), 1fr); gap: 0;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid #EDEDF1;
  }
  .a-nav a {
    flex-direction: column; justify-content: center; gap: 4px;
    height: auto; min-width: 0; padding: 6px 2px; border-radius: 0;
    font-size: 12px; color: #8E8F9C;
  }
  .a-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .a-nav a:hover { background: none; color: var(--ink); }
  .a-nav a.is-active { color: var(--navy); font-weight: 600; background: none; }
  .a-nav a.is-active .i { stroke-width: 2; }
  .a-nav a.is-active::before { content: none; }
  .a-nav .badge {
    position: absolute; top: 1px; left: 50%; margin: 0; transform: translateX(5px);
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    font-size: 12px; line-height: 16px; box-shadow: 0 0 0 2px #fff;
  }
  .a-content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .a-side__foot, .a-nav__full { display: none; }
  .a-top { padding: 20px 16px 16px; flex-direction: column; align-items: stretch; gap: 14px; }
  .a-top h1 { font-size: 24px; }
  .a-top__actions .btn { flex: 1; }
  .a-content { padding: 0 16px 48px; }
  .obra-form__row { grid-template-columns: 1fr; }

  /* Cartões e números: o valor da obra não pode empurrar a largura */
  .obra-card { padding: 20px; }
  /* Indicadores: os valores encostam ao fundo da célula, por isso alinham
     mesmo quando o rótulo ao lado ocupa duas linhas. */
  .stats { margin-top: 22px; column-gap: 16px; row-gap: 2px; }
  .stats > div, .stats > div + div { display: flex; flex-direction: column; padding: 14px 0 0; border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 2px; }
  .stats dt { min-height: 0; line-height: 1.35; }
  .stats dd { margin-top: auto; padding-top: 6px; }
  .obra-card__amount .display-num, .pend-card .display-num { font-size: 32px; }
  .obra-card__amount .unit { font-size: 16px; }
  .pend-card { padding: 20px; }
  .pend-card__spacer { min-height: 12px; }
  .card-head { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 16px; }
  /* Com dez meses num ecrã estreito as colunas ficam com ~27px: os valores
     por cima das barras sobrepõem-se, e o total do mês já está no cabeçalho. */
  .chart__val { display: none; }
  .chart { gap: 4px; }
  .card-head--table { padding: 16px 16px 4px; }

  /* Separadores e barra de ferramentas deslizam em vez de encolher */
  .tabs { gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; white-space: nowrap; }
  .toolbar { gap: 8px; }
  .toolbar .select, .search { min-width: 0; max-width: none; flex: 1 1 140px; }

  /* Confirmações: a fila e o recibo ficam um sobre o outro */
  .queue__item { padding: 14px 16px; }
  .review__actions, .review__reject { padding: 16px; }
  .review__actions { flex-wrap: wrap; }
  .review__actions .btn { flex: 1 1 100%; }

  /* Mensagens: lista por cima, conversa por baixo */
  .inbox { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .inbox__list { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--line); }
  .inbox__head, .inbox__composer { padding: 12px 16px; }
  .inbox__body { padding: 8px 16px 16px; max-height: 50dvh; }
}

/* ===== Gestão por papéis: administração e gestores ===== */

.a-bar__cta { height: 38px; border-radius: 10px; }

/* Saldo do gestor na barra lateral */
.side-saldo { padding: 14px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); }
.side-saldo p:first-child { font-size: 13px; color: rgba(255, 255, 255, 0.65); }
.side-saldo__v { margin-top: 2px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }

/* Diálogos largos e corpo com scroll */
dialog.sheet.sheet--wide { max-width: 620px; }
.sheet__scroll { overflow-y: auto; max-height: calc(100dvh - 190px); }
dialog.sheet { display: none; flex-direction: column; }
dialog.sheet[open] { display: flex; }

/* Formulário de registo */
.rec-form { display: grid; gap: 18px; overflow-y: auto; }
.rec-form__label { display: flex; justify-content: space-between; align-items: baseline; }
.rec-form__label label { font-size: 13px; font-weight: 500; }
.rec-form__label .link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.rec-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rec-form__foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.rec-amount { display: flex; align-items: baseline; gap: 8px; padding: 2px 0 8px; border-bottom: 1.5px solid var(--line-strong); transition: border-color var(--t); }
.rec-amount:focus-within { border-color: var(--navy); }
.rec-amount input { flex: 1; min-width: 0; border: 0; outline: none; background: none; padding: 0; font-size: 32px; font-weight: 700; color: var(--navy); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rec-amount input::placeholder { color: var(--line-strong); }
.rec-amount span { font-size: 16px; color: var(--ink-2); font-weight: 500; }
.rec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rec-chips button { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-variant-numeric: tabular-nums; transition: border-color var(--t); }
.rec-chips button:hover { border-color: var(--navy); }

/* Escolha segmentada (forma de pagamento, tipo de relatório) */
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; border-radius: 12px; background: #F2F2F5; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; height: 36px; padding: 0 10px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: background var(--t), color var(--t), box-shadow var(--t); }
.seg input:checked + span { background: #fff; color: var(--navy); font-weight: 600; box-shadow: 0 1px 3px rgba(20, 21, 43, 0.12); }
.seg input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 1px; }
.seg--inline { grid-template-columns: repeat(3, auto); }

/* Painel: saldo de cada gestor */
.split { display: grid; gap: 18px; }
.split__row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.split__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.split__name { font-size: 14px; font-weight: 600; }
.split__val { text-align: right; }
.split__val p:first-child { font-size: 16px; font-weight: 700; }
.split__bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.split__bar div { height: 100%; background: var(--navy); border-radius: 2px; transform-origin: left; animation: grow 800ms var(--ease) both; }
.split__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.split__total strong { font-size: 20px; color: var(--navy); }

/* Início do gestor: saldo acumulado em destaque */
.g-home { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; }
.g-home__wide { grid-column: 1 / -1; }
.saldo { position: relative; overflow: hidden; padding: 28px; background: var(--navy); border-color: var(--navy); color: #fff; }
.saldo::after { content: ""; position: absolute; right: -70px; top: -90px; width: 240px; height: 240px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.08); pointer-events: none; }
.saldo .saldo__eyebrow { color: rgba(255, 255, 255, 0.7); }
.saldo__value { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.saldo__value .display-num { font-size: 40px; line-height: 1; font-weight: 700; }
.saldo__value .unit { font-size: 18px; color: rgba(255, 255, 255, 0.7); }
.saldo__sub { margin-top: 10px; font-size: 14px; color: rgba(255, 255, 255, 0.72); }
.saldo__periods { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 24px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.saldo__periods > div { padding: 14px 12px 0 0; }
.saldo__periods > div + div { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, 0.14); }
.saldo__periods dt { font-size: 13px; color: rgba(255, 255, 255, 0.65); }
.saldo__periods dd:nth-of-type(1) { margin-top: 4px; font-size: 18px; font-weight: 700; }
.saldo__periods .muted { color: rgba(255, 255, 255, 0.55); }
.saldo__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.btn-light { background: #fff; color: var(--navy); border-radius: 10px; }
.btn-light:hover { background: var(--tint); }
.btn-ghost-light { color: #fff; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 10px; }
.btn-ghost-light:hover { border-color: #fff; }

/* Gestores (administração) */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 24px; }
.strip > div { padding: 18px 20px; }
.strip > div + div { border-left: 1px solid var(--line); }
.strip dt { font-size: 13px; color: var(--ink-2); }
.strip dd { margin-top: 4px; font-size: 20px; font-weight: 700; }
.strip > div:first-child dd { color: var(--navy); }
.gestor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.gestor { padding: 22px; display: flex; flex-direction: column; }
.gestor.is-suspended { opacity: 0.65; }
.gestor__head { display: flex; align-items: center; gap: 12px; }
.gestor__id { flex: 1; min-width: 0; }
.gestor__name { font-size: 16px; font-weight: 700; }
.gestor__saldo { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 4px; }
.gestor__saldo .display-num { font-size: 32px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.gestor__saldo .unit { font-size: 16px; color: var(--ink-2); }
.gestor__periods { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; border-top: 1px solid var(--line); }
.gestor__periods > div { padding: 12px 8px 0 0; }
.gestor__periods > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.gestor__periods dt { font-size: 13px; color: var(--ink-2); }
.gestor__periods dd { margin-top: 2px; font-size: 14px; font-weight: 600; }
.gestor__foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 20px; }
.gestor__foot .btn-ghost { margin-left: auto; }

/* Relatórios */
.report-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.period-nav { display: flex; align-items: center; gap: 6px; }
.period-nav__date { width: auto; height: 40px; }
.period-nav .a-icon[disabled] { opacity: 0.35; pointer-events: none; }
.report-controls .select { width: auto; min-width: 180px; height: 40px; }
.report { padding: 36px 40px; max-width: 920px; }
.report__head { display: flex; align-items: center; gap: 24px; padding-bottom: 22px; border-bottom: 2px solid var(--navy); }
.report__head img { width: 120px; height: auto; flex: none; }
.report__meta h2 { font-size: 24px; font-weight: 700; margin-top: 4px; }
.report__period { margin-top: 2px; font-size: 16px; color: var(--ink-2); }
.report__info { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.report__info dt, .report__kpis dt { font-size: 13px; color: var(--ink-2); }
.report__info dd { margin-top: 2px; font-size: 14px; font-weight: 600; }
.report__kpis { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.report__kpis > div { padding: 16px 18px; }
.report__kpis > div + div { border-left: 1px solid var(--line); }
.report__kpis dd { margin-top: 4px; font-size: 18px; font-weight: 700; }
.report__kpis .is-main { background: var(--tint); }
.report__kpis .is-main dd { color: var(--navy); font-size: 24px; }
.report__sec { margin-top: 28px; }
.report__sec h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.report .table th, .report .table td { padding-left: 0; padding-right: 12px; }
.report .table tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700; padding-top: 12px; }
.report__sign { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 56px; }
.report__sign span { display: block; height: 1px; background: var(--ink); }
.report__sign p { margin-top: 6px; font-size: 13px; color: var(--ink-2); text-align: center; }

@media (max-width: 1100px) {
  .g-home { grid-template-columns: 1fr; }
  .strip { grid-template-columns: repeat(2, 1fr); }
  .strip > div:nth-child(3) { border-left: 0; }
  .strip > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .report__info { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .a-bar__cta { padding: 0 10px; font-size: 13px; }
  .saldo { padding: 22px 20px; }
  .saldo__value .display-num { font-size: 38px; }
  .saldo__periods dd:nth-of-type(1) { font-size: 16px; }
  .rec-form__row { grid-template-columns: 1fr; }
  .seg { grid-template-columns: repeat(2, 1fr); }
  .seg--inline { grid-template-columns: repeat(3, 1fr); width: 100%; }
  .report { padding: 22px 18px; }
  .report__head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .report__kpis { grid-template-columns: 1fr 1fr; }
  .report__kpis > div:nth-child(3) { border-left: 0; }
  .report__kpis > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .report__sign { gap: 24px; }
  .report .table { font-size: 13px; }
}

/* Impressão: relatório (página) e recibo (diálogo) sem a aplicação à volta */
@media print {
  @page { margin: 14mm; }
  .a-side, .a-bar, .a-top, .report-controls, #toast { display: none !important; }
  .a-shell { display: block; }
  .a-content { padding: 0 !important; }
  .report { max-width: none; padding: 0; border: 0; box-shadow: none; }
  .report__kpis .is-main { background: #EEF0F7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table tr { break-inside: avoid; }
  body.print-dialog .a-shell { display: none !important; }
  body.print-dialog dialog.sheet { position: static; display: block; width: 100%; max-width: none; max-height: none; box-shadow: none; border: 0; }
  body.print-dialog dialog.sheet::backdrop { display: none; }
  body.print-dialog .sheet__head, body.print-dialog .sheet__foot { display: none; }
  body.print-dialog .sheet__scroll { max-height: none; overflow: visible; }
}
@media (max-width: 760px) {
  .saldo__periods { grid-template-columns: 1fr; }
  .saldo__periods > div, .saldo__periods > div + div {
    display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: baseline;
    padding: 12px 0; border-left: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }
  .saldo__periods dd:nth-of-type(1) { grid-column: 2; grid-row: 1; margin: 0; text-align: right; }
  .saldo__periods dd:nth-of-type(2) { grid-column: 1; grid-row: 2; margin: 0; }
  .saldo__actions .btn { flex: 1; }
  .gestor-grid { grid-template-columns: 1fr; }
}

/* Terminar sessão */
.a-out {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 600;
  transition: border-color var(--t), background var(--t), color var(--t);
}
.a-out:hover { border-color: #E5C3C3; background: #FDF6F6; color: #A12C2C; }
@media (max-width: 760px) { .a-out { width: 40px; padding: 0; justify-content: center; } .a-out span { display: none; } }

/* Aviso de sessão a terminar */
.sheet--sm { max-width: 400px; }
.idle-warn { text-align: center; display: grid; justify-items: center; gap: 8px; }
.idle-warn h2 { font-size: 18px; }
.idle-warn__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--tint); color: var(--navy); margin-bottom: 4px; }
.idle-warn__count { font-size: 32px; font-weight: 700; color: var(--navy); letter-spacing: -0.02em; margin-top: 4px; }

/* Enviar comprovativo ao membro */
.deliver { margin: 20px 24px 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #FAFAFB; }
.deliver__head { display: flex; gap: 12px; align-items: flex-start; }
.deliver__icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--tint); color: var(--navy); }
.deliver__title { font-size: 14px; font-weight: 700; }
.deliver__sent { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--navy); }
.deliver__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.deliver__actions .btn { height: 40px; font-size: 13px; }
.deliver__actions .btn[disabled] { opacity: 0.6; pointer-events: none; }
.cell-sent { display: flex; align-items: center; gap: 3px; margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--navy); font-family: var(--font); letter-spacing: 0; }
@media (max-width: 760px) { .deliver { margin: 16px 16px 0; } .deliver__actions .btn { flex: 1 1 100%; } }
@media print { .deliver { display: none !important; } }

/* Página pública do recibo (aberta pelo membro) */
.is-public { background: var(--bg); }
.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub__top { background: var(--navy); padding: 22px 20px 64px; display: flex; justify-content: center; border-bottom: 3px solid var(--orange); }
.pub__wrap { width: 100%; max-width: 480px; margin: -44px auto 0; padding: 0 16px; flex: 1; }
.pub__hello { color: #fff; font-size: 14px; font-weight: 500; text-align: center; margin: -10px 0 14px; }
.pub__card { overflow: hidden; }
.pub__actions { display: grid; gap: 10px; margin-top: 16px; }
.pub__thanks { margin-top: 20px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.pub__bad { padding: 28px 24px; text-align: center; }
.pub__bad h1 { font-size: 18px; margin-bottom: 8px; }
.pub__foot { text-align: center; font-size: 13px; color: var(--ink-2); padding: 28px 16px; }
@media print { .pub__top, .pub__actions, .pub__thanks, .pub__foot, .pub__hello { display: none; } .pub__wrap { margin: 0 auto; } }
@media (max-width: 520px) { .sheet__foot { padding: 14px 16px; } .sheet__foot .btn { flex: 1 1 0; min-width: 0; padding-inline: 10px; } }

/* Acabamento institucional: cantos retos e consistentes (cartões 10px, controlos 8px) */
.a-content .card { border-radius: 10px; border-color: var(--line); box-shadow: none; }
.a-nav a { border-radius: 6px; }
.a-search input { border-radius: 8px; }
.a-top__actions .btn, .a-bar__cta, .btn-light, .btn-ghost-light { border-radius: 8px; }
.a-out { border-radius: 8px; }
.side-saldo { border-radius: 8px; }
.rec-chips button { border-radius: 6px; }
.seg { border-radius: 8px; }
.deliver { border-radius: 10px; }
.report__kpis { border-radius: 8px; }
.a-top h1 { font-weight: 600; letter-spacing: -0.015em; }

/* Painel: o total em destaque, mais sóbrio */
.obra-card__amount .display-num { font-weight: 600; letter-spacing: -0.025em; }
.stats dd { font-weight: 600; }

/* Cartão de saldo do gestor: sem ornamentos */
.saldo { border-radius: 10px; }
.saldo::after { content: none; }
.saldo__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.saldo .saldo__eyebrow { color: rgba(255, 255, 255, 0.78); }
.saldo__acct { font-size: 13px; color: rgba(255, 255, 255, 0.55); text-align: right; }
.saldo__value .display-num { font-weight: 600; letter-spacing: -0.025em; }
.saldo__periods dd:nth-of-type(1) { font-weight: 600; }

/* Tabelas de recebimentos */
.cell-name { font-weight: 500; }
.cell-amount { font-weight: 600; white-space: nowrap; }
.split__val p:first-child { font-weight: 600; }
@media (max-width: 760px) { .saldo__acct { display: none; } }

/* Lista de sugestões de membros (registar contribuição) */
.combo { position: relative; }
.combo__list {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 264px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow-pop);
}
.combo__list li[data-i] {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.combo__list li[data-i] span:last-child { flex: none; font-size: 13px; color: var(--ink-2); }
.combo__list li.is-active, .combo__list li[data-i]:hover { background: var(--tint); }
.combo__list li.is-active span:first-child { color: var(--navy); font-weight: 600; }
.combo__empty { padding: 12px; font-size: 13px; color: var(--ink-2); }

/* ===== Tablet (761–1100px): barra lateral em ícones, painel em duas colunas ===== */
.a-side__mark, .a-bar__brand, .m-only { display: none; }
@media (min-width: 761px) and (max-width: 1100px) {
  .a-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .a-side { padding: 22px 10px 16px; align-items: center; }
  .a-side__logo { padding: 0 0 26px; }
  .a-side__lockup { display: none; }
  .a-side__logo .a-side__mark { display: block; width: 38px; height: auto; }
  .a-nav { width: 100%; }
  .a-nav a { justify-content: center; padding: 0; height: 46px; }
  .a-nav a .a-nav__full, .a-nav a .a-nav__short { display: none; }
  .a-nav a.is-active::before { left: -10px; }
  .side-saldo, .a-side__ver { display: none; }
  .a-side__ghost { justify-content: center; padding: 0; width: 46px; }
  .a-side__ghost span, .a-side__ghost .i:last-child { display: none; }
  .a-bar { padding: 0 24px; gap: 16px; }
  .a-me div { display: none; }
  .a-top { padding: 26px 24px 20px; }
  .a-content { padding: 0 24px 48px; }
  .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
  .dash__obra, .dash__chart { grid-column: 1 / -1; }
  .dash__obra { order: 1; } .dash__split { order: 2; } .dash__methods { order: 3; } .dash__chart { order: 4; } .dash > .dash__wide { order: 5; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stats > div:nth-child(3) { border-left: 1px solid var(--line); padding-left: 16px; }
  .g-home { gap: 20px; }
}

/* ===== Telemóvel (até 760px) ===== */
@media (max-width: 760px) {
  /* Uma só barra no topo: logótipo à esquerda, ações à direita */
  .a-side { padding: 0; background: none; }
  .a-side__logo { display: none; }
  .a-bar { height: 58px; padding: 0 12px 0 16px; gap: 8px; background: #fff; }
  .a-bar__brand { display: block; width: 84px; height: auto; flex: none; }
  .a-search { display: none; }
  .a-bar__end { gap: 8px; }
  .a-bar__cta { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .a-bar__cta-t { display: none; }
  .a-me .avatar { width: 36px !important; height: 36px !important; }
  .a-out { width: 40px; height: 40px; }

  /* Navegação em baixo mais legível com seis entradas */
  .a-nav a { font-size: 12px; gap: 3px; padding: 7px 0; }
  .a-nav a.is-active { position: relative; }
  .a-nav a.is-active::after { content: ""; position: absolute; top: -6px; left: 28%; right: 28%; height: 2px; background: var(--navy); }

  /* Cabeçalho da página: título e ação na mesma linha */
  .a-top { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 16px 14px; }
  .a-top__eyebrow { font-size: 13px; }
  .a-top__actions { flex: none; }
  .a-top__actions .btn { flex: none; height: 38px; padding: 0 12px; font-size: 13px; }
  .card-head { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
  .card-head .muted.small { display: none; }
  .dash, .g-home { gap: 14px; }
  .a-content .card.pad { padding: 18px 16px; }
  .obra-card { padding: 18px 16px; }
  .obra-card__of { font-size: 13px; }

  /* Gráfico: só os últimos seis meses cabem com leitura confortável */
  .chart__col:not(:nth-last-child(-n+6)) { display: none; }
  .chart__axis { min-width: 44px; padding-right: 8px; }

}
@media (max-width: 760px) { .d-only { display: none; } }

/* Tablet e telemóvel: a tabela de recebimentos passa a lista */
@media (max-width: 1100px) {
  .table-card { overflow: visible; }
  .rtable thead { display: none; }
  .rtable, .rtable tbody { display: block; }
  .rtable tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px;
    padding: 13px 16px; border-top: 1px solid var(--line);
  }
  .rtable td { padding: 0; border: 0; white-space: normal !important; }
  .rtable .c-mem { grid-column: 1; grid-row: 1; }
  .rtable .c-mem .cell-sub { display: none !important; }
  .rtable .c-amt { grid-column: 2; grid-row: 1; font-size: 14px; }
  .rtable .c-date { grid-column: 1; grid-row: 2; font-size: 13px; color: var(--ink-2); }
  .rtable .c-ref { grid-column: 2; grid-row: 2; text-align: right; font-size: 13px; }
  .rtable .c-ref .cell-sent { justify-content: flex-end; }
  .rtable .c-rec { grid-column: 1 / -1; grid-row: 3; font-size: 13px; color: var(--ink-2); }
  .rtable .c-met, .rtable .c-pay { display: none; }
  .rtable .m-only { display: inline; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .rtable tr { padding: 14px 24px; }
  .card-head--table { padding-bottom: 12px; }
}

/* ===== Revisão de alinhamentos e espaçamentos =====
   Escala de texto: 12 · 13 · 14 · 16 · 18 · 20 · 24 · 28 · 48 px
   Espaço interior dos cartões: 24 px (20 no tablet, 16 no telemóvel).
   As tabelas começam e acabam à mesma distância (24 px) que o título do cartão. */
.a-content .card.pad, .obra-card, .gestor { padding: 24px; }
.card-head { margin-bottom: 18px; }
.card-head .eyebrow { line-height: 1.3; }
.card-head--table { padding: 20px 24px 14px; margin-bottom: 0; border-bottom: 1px solid var(--line); }

.table th { padding: 11px 16px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: #FAFAF9; }
.table td { padding: 12px 16px; line-height: 1.4; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table .cell-sub { margin-top: 2px; font-size: 13px; }
.table .c-ref { font-size: 13px; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); }

/* Barra de ferramentas alinhada com a tabela por baixo */
.toolbar { gap: 10px; margin-bottom: 16px; }
.toolbar .select, .search .input { height: 40px; border-radius: 8px; }

/* Cabeçalho da página: título e ações na mesma linha de base */
.a-top { align-items: flex-end; padding-top: 28px; padding-bottom: 20px; }
.a-top h1 { font-size: 28px; line-height: 1.15; }
.a-top__eyebrow { line-height: 1.3; }
.a-top__actions .btn { height: 40px; }

@media (min-width: 761px) and (max-width: 1100px) {
  .a-content .card.pad, .obra-card, .gestor { padding: 20px; }
  .card-head--table { padding: 18px 20px 12px; }
  .table th:first-child, .table td:first-child { padding-left: 20px; }
  .table th:last-child, .table td:last-child { padding-right: 20px; }
}
@media (max-width: 760px) {
  .a-content .card.pad, .obra-card, .gestor { padding: 16px; }
  .card-head--table { padding: 16px 16px 12px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .a-top h1 { font-size: 22px; }
}
/* Colunas de texto podem quebrar linha; números e datas não */
.table-card .rtable td.c-mem, .table-card .rtable td.c-met { white-space: normal; }
.table-card .rtable td.c-met { min-width: 170px; max-width: 260px; }

/* =====================================================================
   Revisão final de alinhamento — telemóvel e tablet
   Regras: margem lateral de 16 px no telemóvel; todos os blocos da página
   começam na mesma linha; listas sem tabelas largas; toques com ≥ 40 px.
   ===================================================================== */

/* Cabeçalho da página no telemóvel: título por cima, ações numa linha inteira por baixo */
@media (max-width: 760px) {
  .a-top { flex-direction: column; align-items: stretch; gap: 14px; padding: 20px 16px 16px; }
  .a-top__actions { display: flex; gap: 8px; }
  .a-top__actions .btn, .a-top__actions a.btn { flex: 1 1 0; min-width: 0; height: 42px; padding: 0 12px; justify-content: center; white-space: nowrap; }
  .a-top h1 { font-size: 24px; }

  /* Navegação inferior: 5 entradas no máximo (a Obra abre a partir do Painel) */
  .a-nav { grid-template-columns: repeat(var(--nav-p, 5), 1fr); }
  .a-nav a.no-phone { display: none; }
  .a-nav a { font-size: 12px; }

  /* Ligações dos cartões ("Ver todos", "Editar meta") com área de toque confortável */
  .card-head .link { display: inline-flex; align-items: center; min-height: 36px; margin: -8px 0; }

  /* Barra de filtros: pesquisa numa linha inteira, filtros em duas colunas */
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar .search { grid-column: 1 / -1; max-width: none; }
  .toolbar .select { width: 100%; min-width: 0; }
  .toolbar .select:last-child:nth-child(even) { grid-column: 1 / -1; }
  .toolbar__count { grid-column: 1 / -1; }

  /* Relatórios */
  .report-controls { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .report-controls .seg { width: 100%; }
  .period-nav { display: grid; grid-template-columns: 40px 1fr 40px; gap: 8px; }
  .period-nav__date { width: 100%; }
  .report-controls .select { width: 100%; min-width: 0; }
  .report { padding: 20px 16px; }
  .report__sec { overflow-x: auto; }
  .report .table { min-width: 100%; }
  .report__sign { grid-template-columns: 1fr 1fr; gap: 20px; }
}

/* Títulos das secções do relatório: como os títulos dos cartões */
.report__sec h3 { font-size: 16px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--navy); margin-bottom: 8px; }
.report .table th:first-child, .report .table td:first-child { padding-left: 0; }
.report .table th:last-child, .report .table td:last-child { padding-right: 0; }
.report .table th { background: none; }

/* Listas (recebimentos e membros) em tablet e telemóvel */
@media (max-width: 1100px) {
  .rtable td, .mtable td { padding: 0 !important; border: 0; min-width: 0 !important; max-width: none !important; }
  .rtable tr { padding: 14px 16px; row-gap: 4px; }
  .rtable .c-date, .rtable .c-ref, .rtable .c-rec { font-size: 13px; }
  .rtable .c-rec { margin-top: 2px; }

  .table-card:has(.mtable) { overflow: visible; }
  .mtable thead { display: none; }
  .mtable, .mtable tbody { display: block; }
  .mtable tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; align-items: center;
    padding: 14px 16px; border-top: 1px solid var(--line);
  }
  .mtable tbody tr:first-child { border-top: 0; }
  .mtable .m-name { grid-column: 1; grid-row: 1; }
  .mtable .m-tot { grid-column: 2; grid-row: 1; font-weight: 600; }
  .mtable .m-tel { grid-column: 1; grid-row: 2; font-size: 13px; color: var(--ink-2); }
  .mtable .m-n { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--ink-2); }
  .mtable .m-last { grid-column: 1; grid-row: 3; font-size: 13px; color: var(--ink-2); }
  .mtable .m-act { grid-column: 2; grid-row: 3; justify-self: end; }
  .mtable .m-act .btn { height: 36px; }
  .mtable--req .m-act { grid-column: 1 / -1; grid-row: 4; justify-self: stretch; margin-top: 6px; }
  .mtable--req .row-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .mtable .m-only, .rtable .m-only { display: inline; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .rtable tr, .mtable tr { padding: 14px 20px; }
}
@media (max-width: 1100px) { .mtable .m-act .btn-ghost { padding-right: 0; height: 32px; } }
@media (max-width: 1100px) {
  .rtable tbody tr:first-child { border-top: 0; }
  /* Número do recibo e "Enviado" à direita, ao lado da data e de "Recebido por" */
  .rtable .c-ref { grid-row: 2 / span 2; align-self: start; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .rtable .c-ref .cell-sent { margin-top: 0; }
  .rtable .c-rec { grid-column: 1; }
}
@media (max-width: 760px) { .toolbar .select { padding-left: 12px; padding-right: 30px; font-size: 14px; } }
@media (max-width: 760px) { .report__head img { width: 104px; } .report__meta h2 { font-size: 20px; line-height: 1.25; } .report__period { font-size: 14px; } .report__info { gap: 14px 16px; } .report__info dd { font-size: 14px; } .report__kpis .is-main dd { font-size: 20px; } .report__kpis dd { font-size: 16px; } }
/* Relatório no telemóvel: lista em vez de tabela larga; resumos sem quebras */
@media (max-width: 760px) {
  .report__sec { overflow-x: visible; }
  .report .table th, .report .table td { padding-right: 8px; white-space: nowrap; }
  .report .table td:first-child { white-space: normal; }
  .dtable thead { display: none; }
  .dtable, .dtable tbody, .dtable tfoot { display: block; }
  .dtable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .dtable td { padding: 0 !important; border: 0 !important; white-space: normal !important; }
  .dtable .d-mem { grid-column: 1; grid-row: 1; font-weight: 500; }
  .dtable .d-amt { grid-column: 2; grid-row: 1; font-weight: 600; }
  .dtable .d-date { grid-column: 1; grid-row: 2; font-size: 13px; color: var(--ink-2); }
  .dtable .d-ref { grid-column: 2; grid-row: 2; font-size: 13px; text-align: right; }
  .dtable .d-rec { grid-column: 1 / -1; grid-row: 3; font-size: 13px; color: var(--ink-2); }
  .dtable .d-met { display: none; }
  .dtable .m-only { display: inline; }
  .dtable tfoot tr { border-bottom: 0; border-top: 2px solid var(--ink); padding-top: 12px; }
  .dtable tfoot .d-tl { grid-column: 1; grid-row: 1; font-weight: 700; }
  .dtable tfoot .d-tv { grid-column: 2; grid-row: 1; font-weight: 700; }
}
@media (max-width: 760px) {
  .gtable th:nth-child(3), .gtable td:nth-child(3) { display: none; }
  .gtable .m-only { display: inline; }
  .gtable td:first-child { white-space: nowrap; }
}
@media (max-width: 760px) {
  /* Cartão do gestor: períodos em três colunas iguais, ações a toda a largura */
  .gestor__periods { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .gestor__periods > div { padding-left: 10px !important; padding-right: 0 !important; }
  .gestor__periods > div:first-child { padding-left: 0 !important; }
  .gestor__periods dd { font-size: 14px; white-space: nowrap; }
  .gestor__foot { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .gestor__foot .btn { width: 100%; height: 40px; justify-content: center; margin: 0 !important; }
  .gestor__foot .btn-ghost { grid-column: 1 / -1; }
  .strip > div { padding: 14px 16px; }
  .strip dd { font-size: 18px; }
}
@media (max-width: 400px) { .gestor__periods > div { padding-left: 8px !important; } .gestor__periods dd { font-size: 13px; } }
@media (max-width: 760px) { .obra-form form .btn { width: 100%; } }

/* Formulário de registo: nunca mais largo do que a janela */
.rec-form { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
.rec-form fieldset { min-width: 0; }
.rec-form .input, .rec-form input[type="date"] { min-width: 0; width: 100%; }
@media (max-width: 520px) {
  .rec-form { padding: 18px 16px; gap: 16px; }
  .rec-form__row { grid-template-columns: minmax(0, 1fr) !important; gap: 16px; }
  .rec-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .rec-chips button { padding: 0 4px; }
  .rec-form__foot { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .rec-form__foot .btn { width: 100%; justify-content: center; }
  .rec-form__foot .btn-secondary { order: 2; }
  .sheet__head { padding: 14px 12px 14px 16px; }
  dialog.sheet { width: calc(100% - 24px); max-height: calc(100dvh - 32px); }
}
.split__empty { margin-bottom: 14px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
/* Número oficial da tesouraria no bloco de envio */
.deliver__from { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.deliver__from strong { color: var(--navy); font-weight: 600; }
.phone--light { height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; display: flex; }
.phone--light .phone__prefix { display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); border-right: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.phone--light input { flex: 1; min-width: 0; border: 0; outline: none; padding: 0 12px; font-size: 15px; font-variant-numeric: tabular-nums; background: none; color: var(--ink); }
.phone--light:focus-within { border-color: var(--navy); }
.pub__contact { margin-top: 10px; }

/* Envio automático do comprovativo */
.deliver--auto.is-ok { border-color: #CFE3D6; background: #F4FAF6; }
.deliver--auto.is-ok .deliver__icon { background: #E1F0E6; color: var(--ok); }
.deliver--auto.is-bad { border-color: #EBC9C9; background: #FDF6F6; }
.deliver--auto.is-bad .deliver__icon { background: #F6E1E1; color: var(--bad); }
.deliver--auto.is-busy .deliver__icon { color: var(--navy); }
.deliver__err { margin-top: 10px; font-size: 13px; color: var(--bad); line-height: 1.45; }
.cell-sent.is-bad { color: var(--bad); }
