/* Período: um mês (‹ Outubro de 2026 ›) ou datas De/Até; filtra indicadores, gráficos e tabela.
   Mesmo aspeto do período do Dashboard (.mgd-presets / .mgd-date). */
.costs-period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}
.costs-period__month {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-full);
  background: var(--mg-fill);
}
.costs-period__month .btn-icon { width: 32px; height: 32px; }
.costs-period__label {
  min-width: 11.5rem;
  text-align: center;
  color: var(--mg-ink);
  font-size: var(--fs-md);
  font-weight: 650;
  white-space: nowrap;
}
.costs-period__date { display: inline-flex; align-items: center; gap: var(--sp-2); }
.costs-period__date-label {
  color: var(--mg-tertiary);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.costs-period__date .date-field { width: 148px; }
/* Ecrã estreito: De e Até ficam um por baixo do outro, com os campos alinhados. */
@media (max-width: 760px) {
  .costs-period__date-label { min-width: 2rem; }
}

.costs-chart-body {
  position: relative;
  height: 260px;
}

@media (min-width: 1440px) {
  .costs-charts-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.cost-areas-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.cost-areas-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-alt);
  font-size: var(--fs-sm);
  color: var(--navy-700);
}

.cost-areas-row__name {
  flex-shrink: 0;
  min-width: 110px;
}

.cost-areas-row__responsible {
  flex: 1;
}

.cost-areas-row__lock {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-muted);
}

.cost-areas-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cost-areas-members {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 var(--sp-3);
}

.cost-areas-members__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.cost-areas-member-pill {
  padding: 2px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  cursor: pointer;
}

.cost-areas-member-pill.is-active {
  background: var(--navy-100);
  border-color: var(--navy-500);
  color: var(--navy-700);
  font-weight: 600;
}

.cost-areas-add {
  display: flex;
  gap: var(--sp-2);
}

.cost-areas-add .input {
  flex: 1;
}

.cost-invoice-dialog {
  max-width: 1100px;
}

.cost-invoice-attachment-field {
  gap: var(--sp-2);
}

.cost-invoice-attachment-field [data-cost-ocr-btn] {
  align-self: flex-start;
}

.cost-invoice-attachment-field [data-cost-ocr-btn]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cost-invoice-header-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

@media (max-width: 760px) {
  .cost-invoice-header-grid {
    grid-template-columns: 1fr;
  }
}

.cost-invoice-lines-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.cost-lines-table {
  table-layout: fixed;
}

.cost-lines-table input,
.cost-lines-table select {
  width: 100%;
}

.cost-lines-table th:nth-child(6),
.cost-lines-table th:nth-child(7),
.cost-lines-table td:nth-child(6),
.cost-lines-table td:nth-child(7) {
  width: 110px;
}

.cost-lines-table th:last-child,
.cost-lines-table td:last-child {
  width: 40px;
}

.cost-invoice-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  align-items: end;
}

.cost-invoice-totals__check {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-alt);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--navy-700);
}

.cost-invoice-totals__badge {
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
}

.cost-invoice-totals__badge--ok {
  background: var(--state-done-bg);
  color: var(--state-done);
}

.cost-invoice-totals__badge--mismatch {
  background: var(--state-late-bg);
  color: var(--state-late);
}

.cost-detail-header {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}

.cost-detail-header div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cost-detail-header span {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.cost-detail-header strong {
  color: var(--navy-800);
}

.cost-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cost-status-badge--pending {
  background: var(--gold-100);
  color: var(--gold-600);
}

.cost-status-badge--approved {
  background: var(--state-progress-bg);
  color: var(--state-progress);
}

.cost-status-badge--paid {
  background: var(--state-done-bg);
  color: var(--state-done);
}

.cost-detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.cost-detail-status__actions {
  display: flex;
  gap: var(--sp-2);
}

.cost-audit-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.cost-audit-section__title {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--navy-700);
}

.cost-audit-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.cost-audit-row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-alt);
  font-size: var(--fs-xs);
  color: var(--navy-600);
}

.cost-areas-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cost-areas-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--navy-100);
  color: var(--navy-700);
  font-size: var(--fs-xs);
  font-weight: 600;
}
