* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy: #123a63;
  --navy-dark: #0b2948;
  --blue-light: #eaf2f8;
  --border: #d8e2ea;
  --text: #17324d;
  --muted: #6d7f8e;
  --white: #ffffff;
  --green: #1c7c3e;
  --red: #c62828;
}

html,
body {
  min-height: 100%;
}

body {
  font-family:
    Arial,
    Helvetica,
    sans-serif;

  background:
    linear-gradient(
      135deg,
      #eef4f8 0%,
      #dce8f1 100%
    );

  color: var(--text);
}

button,
input {
  font: inherit;
}

.login-page {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 430px;

  background: var(--white);

  border: 1px solid var(--border);
  border-radius: 14px;

  overflow: hidden;

  box-shadow:
    0 16px 40px rgba(18, 58, 99, 0.14);
}

.login-header {
  background:
    linear-gradient(
      135deg,
      var(--navy-dark),
      var(--navy)
    );

  color: var(--white);

  text-align: center;

  padding: 34px 28px 30px;
}

.login-icon {
  width: 64px;
  height: 64px;

  margin: 0 auto 14px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.14);

  font-size: 31px;
}

.login-header h1 {
  font-size: 25px;
  line-height: 1.2;

  margin-bottom: 8px;
}

.login-header p {
  color: #dce9f4;

  font-size: 14px;
  line-height: 1.5;
}

#login-form {
  padding: 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;

  margin-bottom: 7px;

  font-size: 14px;
  font-weight: 700;

  color: var(--text);
}

.form-group input {
  width: 100%;

  padding: 13px 14px;

  border: 1px solid #c8d4de;
  border-radius: 8px;

  background: #fbfdff;

  color: var(--text);

  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.form-group input:focus {
  border-color: var(--navy);

  box-shadow:
    0 0 0 3px rgba(18, 58, 99, 0.12);
}

#login-button {
  width: 100%;

  border: 0;
  border-radius: 8px;

  padding: 13px 18px;

  background: var(--navy);

  color: var(--white);

  font-weight: 700;

  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.1s ease;
}

#login-button:hover {
  background: var(--navy-dark);
}

#login-button:active {
  transform: translateY(1px);
}

#login-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.login-message {
  min-height: 20px;

  margin-top: 16px;

  text-align: center;

  font-size: 14px;
  font-weight: 700;
}

.login-message.error {
  color: var(--red);
}

.login-message.success {
  color: var(--green);
}

.login-footer {
  padding: 15px;

  border-top: 1px solid var(--border);

  background: var(--blue-light);

  color: var(--muted);

  text-align: center;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

@media (max-width: 520px) {
  .login-page {
    padding: 16px;
  }

  .login-header {
    padding: 28px 20px 24px;
  }

  .login-header h1 {
    font-size: 22px;
  }

  #login-form {
    padding: 24px 20px;
  }
}

/* =========================================================
   PAINEL GERENCIAL
   ========================================================= */

.app-shell {
  min-height: 100vh;
  background: #f4f7fa;
}

.app-header {
  background: #123a63;
  color: #ffffff;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  padding: 18px 28px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-logo {
  width: 46px;
  height: 46px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.14);

  font-size: 24px;
}

.app-brand h1 {
  font-size: 22px;
  line-height: 1.15;
}

.app-brand p {
  margin-top: 3px;

  color: #d8e6f2;

  font-size: 13px;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-info strong {
  font-size: 14px;
}

.user-info span {
  margin-top: 2px;

  color: #d8e6f2;

  font-size: 12px;
}

.logout-button {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;

  padding: 9px 14px;

  background: rgba(255, 255, 255, 0.08);

  color: #ffffff;

  font-weight: 700;

  cursor: pointer;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.15);
}


/* Navegação */

.app-nav {
  background: #ffffff;

  border-bottom: 1px solid #dce5ec;

  display: flex;
  align-items: center;

  gap: 6px;

  padding: 10px 22px;

  overflow-x: auto;
}

.nav-button {
  border: 0;
  border-radius: 7px;

  padding: 10px 14px;

  background: transparent;

  color: #38516a;

  font-weight: 700;

  white-space: nowrap;

  cursor: pointer;
}

.nav-button:hover {
  background: #edf3f8;
}

.nav-button.nav-active {
  background: #123a63;
  color: #ffffff;
}


/* Conteúdo */

.dashboard {
  width: min(1480px, calc(100% - 32px));

  margin: 0 auto;

  padding: 26px 0 40px;
}

.dashboard-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: 24px;

  margin-bottom: 24px;
}

.dashboard-top h2 {
  color: #17324d;

  font-size: 25px;
}

.dashboard-top p {
  margin-top: 6px;

  color: #6b7c8b;

  font-size: 14px;
}

.month-box {
  min-width: 190px;
}

.month-box label {
  display: block;

  margin-bottom: 6px;

  color: #526778;

  font-size: 12px;
  font-weight: 700;
}

.month-box input {
  width: 100%;

  border: 1px solid #cbd8e2;
  border-radius: 8px;

  background: #ffffff;

  padding: 10px 12px;

  color: #17324d;

  outline: none;
}


/* KPIs */

.kpi-grid {
  display: grid;

  grid-template-columns:
    repeat(5, minmax(0, 1fr));

  gap: 14px;

  margin-bottom: 20px;
}

.kpi-card {
  min-height: 112px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;

  border-radius: 10px;

  border: 1px solid #d9e3eb;

  background: #ffffff;

  padding: 18px;

  box-shadow:
    0 4px 14px rgba(19, 52, 82, 0.05);
}

.kpi-title {
  margin-bottom: 10px;

  color: #526778;

  font-size: 13px;
  font-weight: 700;
}

.kpi-value {
  color: #17324d;

  font-size: 24px;
  line-height: 1;
}

.kpi-blue {
  border-top: 5px solid #2f80c9;
}

.kpi-green {
  border-top: 5px solid #3b8f2f;
}

.kpi-red {
  border-top: 5px solid #d71920;
}

.kpi-yellow {
  border-top: 5px solid #f0b90b;
}

.kpi-result {
  border-top: 5px solid #118b55;
}


/* Cards principais */

.dashboard-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 2fr)
    minmax(280px, 1fr);

  gap: 18px;
}

.dashboard-card {
  background: #ffffff;

  border: 1px solid #dbe4eb;
  border-radius: 10px;

  overflow: hidden;

  box-shadow:
    0 4px 16px rgba(19, 52, 82, 0.05);
}

.card-header {
  background: #eaf1f7;

  border-bottom: 1px solid #d5e0e8;

  padding: 14px 18px;
}

.card-header h3 {
  color: #17324d;

  font-size: 15px;
}

.chart-placeholder {
  min-height: 250px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  color: #8a9aaa;

  font-size: 14px;

  background:
    linear-gradient(
      180deg,
      #ffffff,
      #fbfcfd
    );
}

.chart-large .chart-placeholder {
  min-height: 330px;
}


/* Resumo */

.summary-list {
  padding: 4px 0;
}

.summary-item {
  min-height: 66px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  padding: 14px 18px;

  border-bottom: 1px solid #e4ebf0;
}

.summary-item:last-child {
  border-bottom: 0;
}

.summary-item span {
  color: #526778;

  font-size: 14px;
}

.summary-item strong {
  min-width: 34px;

  color: #123a63;

  font-size: 22px;

  text-align: right;
}


/* Estado vazio */

.empty-state {
  min-height: 250px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  color: #8595a4;

  text-align: center;
}


/* Responsividade */

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 850px) {
  .app-header {
    align-items: flex-start;
  }

  .dashboard-top {
    align-items: stretch;
    flex-direction: column;
  }

  .month-box {
    width: 100%;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 16px;
  }

  .app-brand h1 {
    font-size: 18px;
  }

  .app-user {
    gap: 8px;
  }

  .user-info {
    display: none;
  }

  .dashboard {
    width: min(100% - 20px, 1480px);

    padding-top: 18px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 96px;
  }

  .kpi-value {
    font-size: 22px;
  }
}
/* =========================================================
   CONTRATOS — RENOVAÇÃO E ENCERRAMENTO
   ========================================================= */

.form-group select,
.form-group textarea {
  width: 100%;

  padding: 13px 14px;

  border: 1px solid #c8d4de;
  border-radius: 8px;

  background: #fbfdff;

  color: var(--text);

  font: inherit;
  outline: none;
}

.form-group textarea {
  resize: vertical;
}

.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--navy);

  box-shadow:
    0 0 0 3px rgba(18, 58, 99, 0.12);
}

.contract-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.contract-action-renew {
  border: 1px solid #2f80c9;
  background: #f3f8fc;
  color: #1f639f;
}

.contract-action-danger {
  border: 1px solid #b42318;
  background: #fff7f6;
  color: #b42318;
}

.contract-action-danger:hover {
  background: #fde9e7;
}

.contract-action-panel {
  margin-bottom: 18px;
}

.contract-action-content {
  padding: 22px;
}

.contract-form-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.contract-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.info-note,
.danger-note {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  line-height: 1.5;
  font-size: 14px;
}

.info-note {
  border: 1px solid #c9ddeb;
  background: #f3f8fc;
  color: #355b78;
}

.danger-note {
  border: 1px solid #f0c7c3;
  background: #fff7f6;
  color: #7c312b;
}

.contract-compare-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.contract-compare-card {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 16px;

  border: 1px solid #d8e2ea;
  border-radius: 9px;

  background: #f8fafc;

  color: #526778;
}

.contract-compare-card strong {
  color: #17324d;
  font-size: 17px;
}

.contract-compare-new {
  border-color: #bcd5e7;
  background: #f4f9fc;
}

.contract-compare-title {
  color: #6d7f8e;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.closing-preview,
.contract-history-box {
  display: flex;
  flex-direction: column;
  gap: 8px;

  margin-top: 18px;
  padding: 16px;

  border: 1px solid #d8e2ea;
  border-radius: 8px;

  background: #f4f7fa;

  color: #526778;
}

.closing-preview strong,
.contract-history-box > strong {
  color: #17324d;
}

.closing-preview small {
  min-height: 17px;
  color: #6d7f8e;
  line-height: 1.4;
}

.contract-history-grid {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.contract-history-box p {
  margin-top: 4px;
  line-height: 1.5;
}

.contract-status {
  display: inline-flex;
  align-items: center;

  min-width: 0 !important;

  padding: 6px 9px;

  border-radius: 999px;

  font-size: 12px !important;
  line-height: 1 !important;
  text-align: center !important;
}

.contract-status[data-status="Ativo"] {
  background: #e9f6ed;
  color: #1c7c3e;
}

.contract-status[data-status="Agendado"] {
  background: #eef5fb;
  color: #22679d;
}

.contract-status[data-status="Renovado"] {
  background: #f4f0fa;
  color: #6d4aa1;
}

.contract-status[data-status="Encerrado"] {
  background: #f7eeee;
  color: #9b3f3f;
}

.contract-status[data-status="Cancelado"] {
  background: #f2f2f2;
  color: #666666;
}

.contract-status[data-status="Prazo original concluído"] {
  background: #fff4d9;
  color: #855d00;
}

.contract-status[data-status="Em encerramento"] {
  background: #fff0e6;
  color: #9a4f16;
}

.contract-status[data-status="Rascunho"] {
  background: #f1f0ed;
  color: #6b625b;
}

.contract-status[data-status="Situação não reconhecida"] {
  background: #fff0f0;
  color: #9b3f3f;
}

.contract-lifecycle-summary {
  display: grid;
  justify-items: end;
  gap: 5px;
  max-width: 330px;
}

.contract-lifecycle-list-note,
.contract-lifecycle-note {
  display: block;
  color: #765f4d;
  font-size: 11px;
  line-height: 1.4;
}

.contract-lifecycle-list-note {
  text-align: right;
}

.contract-lifecycle-note {
  margin-top: 6px;
}

.nav-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .contract-compare-grid {
    grid-template-columns: 1fr;
  }

  .contract-action-row,
  .contract-form-actions {
    width: 100%;
  }

  .contract-action-row .nav-button,
  .contract-form-actions .nav-button {
    flex: 1 1 auto;
  }
}

.contract-kpi-grid {
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .contract-kpi-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .contract-kpi-grid {
    grid-template-columns: 1fr;
  }
}


.contract-action-warning {
  color: #9a5a00;
  border-color: #d89a32;
  background: #fff8e8;
}

.contract-action-warning:hover:not(:disabled) {
  background: #fff1cf;
}

.warning-note {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #e7c27c;
  border-radius: 8px;
  background: #fff9ec;
  color: #76531d;
  line-height: 1.5;
}

.contract-history-cancelled {
  border-color: #e0d8c8;
  background: #faf8f4;
}

/* Garante que caixas de histórico sem dados permaneçam realmente ocultas. */
.contract-history-box[hidden] {
  display: none !important;
}


/* =========================================================
   NOVA ARQUITETURA — IMÓVEL / ALOCAÇÕES / DEMONSTRAÇÃO
   ========================================================= */

.demo-data-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #d7c98d;
  border-radius: 9px;
  background: #fffaf0;
  color: #66541f;
}

.demo-data-note[hidden] {
  display: none !important;
}

.demo-data-note > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.demo-data-note span {
  max-width: 860px;
  color: #7a6a39;
  font-size: 13px;
  line-height: 1.45;
}

.demo-data-note > strong {
  flex: 0 0 auto;
  color: #6d5718;
  font-size: 13px;
  text-align: right;
}

.property-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.property-summary-item,
.contract-list-item {
  align-items: flex-start;
}

.property-summary-main,
.contract-list-main {
  min-width: 0;
  flex: 1 1 auto;
}

.property-summary-title,
.contract-list-title {
  color: #17324d;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.property-summary-empty,
.contract-list-subtitle {
  display: block;
  margin-top: 7px;
  color: #6b7c8b !important;
  font-size: 13px !important;
  line-height: 1.45;
}

.allocation-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.summary-item .allocation-chip {
  display: inline-flex;
  align-items: center;
  width: auto;
  padding: 5px 8px;
  border: 1px solid #d8e2ea;
  border-radius: 999px;
  background: #f7fafc;
  color: #526778;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.summary-item .allocation-chip.is-occupied {
  border-color: #c8dfcf;
  background: #edf8f0;
  color: #2d7144;
}

.summary-item .allocation-chip.is-available {
  border-color: #c9ddeb;
  background: #f2f8fc;
  color: #2b658f;
}

.property-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.summary-item .property-occupancy {
  min-width: 0;
  color: #123a63;
  font-size: 13px;
  text-align: right;
}

.source-data-badge {
  display: inline-flex !important;
  align-items: center;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 7px;
  border: 1px solid #d7c98d;
  border-radius: 999px;
  background: #fffaf0;
  color: #745f22 !important;
  font-size: 11px !important;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .property-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .demo-data-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-data-note > strong {
    text-align: left;
  }

  .property-summary-item,
  .contract-list-item {
    flex-direction: column;
  }

  .property-summary-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 600px) {
  .property-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   ETAPA 2 — PAGAMENTOS
   ========================================================= */

.payment-top-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.payment-top-actions .month-box {
  min-width: 210px;
}

.payment-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-demo-note {
  margin-top: 0;
}

.payment-form-card {
  margin-bottom: 18px;
}

.payment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.payment-default-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #c8dfcf;
  border-radius: 999px;
  background: #edf8f0;
  color: #2d7144;
  font-size: 11px;
  font-weight: 700;
}

.payment-card-content {
  padding: 22px;
}

.payment-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.payment-form-wide {
  grid-column: span 2;
}

.payment-context-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 2px 0 18px;
  padding: 14px 16px;
  border: 1px solid #d8e2ea;
  border-radius: 8px;
  background: #f4f7fa;
}

.payment-context-box[hidden] {
  display: none !important;
}

.payment-context-box > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.payment-context-box span {
  color: #6d7f8e;
  font-size: 12px;
}

.payment-context-box strong {
  color: #17324d;
  font-size: 14px;
}

.payment-context-box-financial {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.payment-preview-box {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(280px, 1.3fr);
  gap: 12px;
  margin: -6px 0 18px;
  padding: 14px 16px;
  border: 1px solid #cfdce7;
  border-radius: 8px;
  background: #ffffff;
}

.payment-preview-box[hidden] {
  display: none !important;
}

.payment-preview-box > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.payment-preview-box span {
  color: #6d7f8e;
  font-size: 12px;
}

.payment-preview-box strong {
  color: #17324d;
  font-size: 14px;
}

.payment-preview-box strong.is-warning {
  color: #9a6700;
}

.payment-preview-box strong.is-credit,
.payment-preview-box strong.is-success {
  color: #2d7144;
}

.payment-preview-box strong.is-neutral {
  color: #526778;
}

.payment-credit-note {
  margin-top: -2px;
  padding: 12px 14px;
  border: 1px solid #d8e2ea;
  border-radius: 8px;
  background: #f8fafc;
  color: #526778;
  font-size: 13px;
  line-height: 1.45;
}

.payment-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.payment-history-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.payment-history-header span {
  color: #6d7f8e;
  font-size: 12px;
}

.payment-history-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.payment-history-filters select {
  min-width: 190px;
  padding: 9px 11px;
  border: 1px solid #c8d4de;
  border-radius: 7px;
  background: #ffffff;
  color: #17324d;
  font: inherit;
}

.payment-list {
  display: flex;
  flex-direction: column;
}

.payment-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-top: 1px solid #e3eaf0;
  background: #ffffff;
}

.payment-list-item:first-child {
  border-top: 0;
}

.payment-list-main {
  min-width: 0;
  flex: 1 1 auto;
}

.payment-list-title {
  color: #17324d;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
}

.payment-list-meta {
  margin-top: 5px;
  color: #6d7f8e;
  font-size: 12px;
  line-height: 1.45;
}

.payment-list-observation {
  margin-top: 8px;
  padding-left: 10px;
  border-left: 3px solid #d8e2ea;
  color: #526778;
  font-size: 12px;
  line-height: 1.45;
}

.payment-list-side {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 7px;
  flex: 0 0 auto;
}

.payment-kind-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.payment-kind-badge.is-real {
  border: 1px solid #c8dfcf;
  background: #edf8f0;
  color: #2d7144;
}

.payment-kind-badge.is-demo {
  border: 1px solid #d7c98d;
  background: #fffaf0;
  color: #745f22;
}

.payment-list-value {
  color: #17324d;
  font-size: 16px;
}

.payment-receipt-button {
  padding: 7px 10px;
  border: 1px solid #9eb6c9;
  border-radius: 7px;
  background: #f7fafc;
  color: #17456f;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.payment-receipt-button:hover {
  border-color: #17456f;
  background: #edf4f9;
}

 .payment-kind-badge.is-reversed {
  border: 1px solid #e3b8b8;
  background: #fff1f1;
  color: #9b2f2f;
}

.payment-list-reversal {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid #c84a4a;
  background: #fff7f7;
  color: #8a3232;
  font-size: 12px;
  line-height: 1.45;
}

.payment-list-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.payment-correction-button,
.payment-reversal-button {
  padding: 7px 10px;
  border-radius: 7px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.payment-correction-button {
  border: 1px solid #d4bb75;
  background: #fff9e9;
  color: #6f5717;
}

.payment-reversal-button {
  border: 1px solid #dfaaaa;
  background: #fff5f5;
  color: #9b2f2f;
}

.payment-correction-button:hover {
  border-color: #a98424;
}

.payment-reversal-button:hover {
  border-color: #a93232;
}


@media (max-width: 1100px) {
  .payment-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-form-wide {
    grid-column: span 2;
  }

  .payment-context-box-financial {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .payment-top-actions,
  .payment-history-header,
  .payment-list-item {
    align-items: stretch;
    flex-direction: column;
  }

  .payment-top-actions .month-box,
  .payment-history-filters select {
    width: 100%;
    min-width: 0;
  }

  .payment-history-filters {
    width: 100%;
    flex-direction: column;
  }

  .payment-context-box,
  .payment-context-box-financial,
  .payment-preview-box,
  .payment-form-grid {
    grid-template-columns: 1fr;
  }

  .payment-form-wide {
    grid-column: auto;
  }

  .payment-list-side {
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .payment-kpi-grid {
    grid-template-columns: 1fr;
  }
}


/* =====================================================
   DESPESAS — ETAPA 3.1
   Reutiliza a estrutura visual de Pagamentos.
   ===================================================== */

#secao-despesas .payment-form-grid input,
#secao-despesas .payment-form-grid select,
#secao-despesas textarea {
  width: 100%;
}

#secao-despesas .payment-list-meta {
  overflow-wrap: anywhere;
}


/* =====================================================
   CENTRAL DO INQUILINO — ETAPA 4.1
   ===================================================== */

.central-top-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.central-top-actions .month-box {
  min-width: 190px;
}

.central-top-actions .central-tenant-box {
  min-width: 360px;
}

.central-top-actions select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c8d4de;
  border-radius: 7px;
  background: #ffffff;
  color: #17324d;
  font: inherit;
}

.central-empty-card {
  margin-top: 6px;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.central-empty-card[hidden],
#central-conteudo[hidden],
#central-aviso-dados[hidden] {
  display: none !important;
}

.central-state-loading {
  color: #526778;
}

.central-state-error {
  color: #9b2f2f;
}

.central-data-note {
  margin-bottom: 14px;
}

.central-quick-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #d7e2eb;
  border-radius: 9px;
  background: #ffffff;
}

.central-quick-actions-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.central-quick-actions-copy strong {
  color: #17324d;
  font-size: 14px;
}

.central-quick-actions-copy span {
  color: #6d7f8e;
  font-size: 12px;
  line-height: 1.4;
}

.central-quick-actions-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.central-action-button {
  border: 1px solid #c9d6e0;
  border-radius: 7px;
  padding: 9px 12px;
  background: #f7fafc;
  color: #17324d;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.central-action-button:hover {
  background: #edf3f8;
}

.central-action-button.central-action-primary {
  border-color: #123a63;
  background: #123a63;
  color: #ffffff;
}

.central-action-button.central-action-primary:hover {
  background: #0e3154;
}

.central-action-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.central-kpi-grid {
  margin-bottom: 14px;
}

.central-kpi-status {
  font-size: 22px;
}

.central-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.central-info-card,
.central-section-card {
  overflow: hidden;
}

.central-info-card .card-header,
.central-section-card .card-header {
  border-bottom: 1px solid #e3eaf0;
}

.central-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 4px 18px 18px;
}

.central-info-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 12px;
  border-bottom: 1px solid #edf1f4;
  min-width: 0;
}

.central-info-item span {
  color: #6d7f8e;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .025em;
}

.central-info-item strong {
  color: #17324d;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.central-source-badge,
.central-status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #cfd9e1;
  background: #f7f9fb;
  color: #526778;
  font-size: 11px;
  font-weight: 800;
}

.central-source-badge.is-confirmed,
.central-status-badge.is-success {
  border-color: #c8dfcf;
  background: #edf8f0;
  color: #2d7144;
}

.central-source-badge.is-pending,
.central-status-badge.is-warning {
  border-color: #ead99c;
  background: #fff9e8;
  color: #7b6417;
}

.central-status-badge.is-danger {
  border-color: #e8c5c5;
  background: #fff0f0;
  color: #9b2f2f;
}

.central-status-badge.is-info {
  border-color: #bfd7ea;
  background: #eef7fd;
  color: #2d638c;
}

.central-status-badge.is-muted {
  border-color: #d8e2ea;
  background: #f5f7f9;
  color: #6d7f8e;
}

.central-inner-empty {
  grid-column: 1 / -1;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.central-section-card {
  margin-bottom: 14px;
}

.central-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.central-section-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.central-section-header span {
  color: #6d7f8e;
  font-size: 12px;
}

.central-section-header > strong {
  color: #17324d;
  font-size: 13px;
}

.central-list {
  display: flex;
  flex-direction: column;
}

.central-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  border-top: 1px solid #e3eaf0;
  background: #ffffff;
}

.central-list-item:first-child {
  border-top: 0;
}

.central-list-main {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
}

.central-list-main strong {
  color: #17324d;
  font-size: 14px;
}

.central-list-main span,
.central-list-main small {
  color: #6d7f8e;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.central-list-main small {
  margin-top: 3px;
  padding-left: 9px;
  border-left: 3px solid #d8e2ea;
  color: #526778;
}

.central-list-side {
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 7px;
}

.central-list-side > strong {
  color: #17324d;
  font-size: 15px;
}

.central-history-grid > .dashboard-card {
  margin-bottom: 0;
}

@media (max-width: 1000px) {
  .central-summary-grid {
    grid-template-columns: 1fr;
  }

  .central-top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .central-top-actions .month-box,
  .central-top-actions .central-tenant-box {
    flex: 1 1 260px;
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .central-top-actions,
  .central-list-item,
  .central-quick-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .central-info-grid {
    grid-template-columns: 1fr;
  }

  .central-quick-actions-buttons {
    width: 100%;
    justify-content: stretch;
  }

  .central-action-button {
    flex: 1 1 100%;
  }

  .central-list-side {
    align-items: flex-start;
  }
}


/* =====================================================
   VENCIMENTOS — ETAPA 5.1
   ===================================================== */

.due-top-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.due-top-actions .month-box {
  min-width: 175px;
}

.due-period-box select,
.due-filters select {
  width: 100%;
  border: 1px solid #cbd8e2;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  color: #17324d;
  font: inherit;
  outline: none;
}

.due-period-box {
  min-width: 145px !important;
}

.due-kpi-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.due-period-summary {
  margin: -4px 0 18px;
  padding: 10px 13px;
  border: 1px solid #d8e2ea;
  border-radius: 8px;
  background: #f8fafc;
  color: #526778;
  font-size: 12px;
}

.due-period-summary strong {
  color: #17324d;
}

.due-filter-card {
  margin-bottom: 18px;
  padding: 16px 18px;
}

.due-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.due-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #6d7f8e;
  font-size: 12px;
}

.due-filter-field input,
.due-filter-field select {
  width: 100%;
  min-height: 43px;
  border: 1px solid #cbd8e2;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  color: #17324d;
  font: inherit;
  outline: none;
}

.due-filter-field input:focus,
.due-filter-field select:focus {
  border-color: #8f6a4c;
  box-shadow: 0 0 0 2px rgba(143, 106, 76, 0.12);
}

.due-filter-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.due-filter-footer span {
  color: #6d7f8e;
  font-size: 12px;
}

.due-section-card {
  margin-bottom: 18px;
}

.due-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.due-card-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.due-card-header span {
  color: #6d7f8e;
  font-size: 12px;
}

.due-filters {
  min-width: 190px;
}

.due-list {
  display: flex;
  flex-direction: column;
}

.due-list-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) minmax(135px, auto);
  align-items: center;
  gap: 18px;
  padding: 15px 18px;
  border-top: 1px solid #e3eaf0;
  background: #ffffff;
}

.due-list-item:first-child {
  border-top: 0;
}

.due-list-item.is-overdue {
  border-left: 4px solid #d71920;
}

.due-list-date {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.due-list-date strong {
  color: #17324d;
  font-size: 14px;
}

.due-list-date span {
  color: #6d7f8e;
  font-size: 12px;
}

.due-list-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.due-list-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.due-list-main strong {
  color: #17324d;
  font-size: 14px;
  line-height: 1.35;
}

.due-list-main > span,
.due-list-main > small {
  color: #6d7f8e;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.due-list-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
}

.due-list-side strong {
  color: #17324d;
  font-size: 15px;
}

.due-list-side small {
  color: #6d7f8e;
  font-size: 11px;
}

.due-type-badge,
.due-source-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.due-type-badge {
  border: 1px solid #cdd9e3;
  background: #f5f8fa;
  color: #526778;
}

.due-type-badge.is-rent {
  border-color: #b9d4eb;
  background: #edf6fd;
  color: #246b9f;
}

.due-type-badge.is-adjustment {
  border-color: #ead48c;
  background: #fff8e2;
  color: #7d6417;
}

.due-type-badge.is-contract-end {
  border-color: #d6c8e6;
  background: #f6f0fb;
  color: #69488b;
}

.due-type-badge.is-overdue {
  border-color: #e4b3b5;
  background: #fff0f0;
  color: #a32328;
}

.due-source-badge {
  border: 1px solid #d7c98d;
  background: #fffaf0;
  color: #745f22;
}

.due-empty-good {
  color: #2d7144;
}

@media (max-width: 1100px) {
  .due-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .due-filter-search {
    grid-column: 1 / -1;
  }

  .due-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .due-list-item {
    grid-template-columns: 115px minmax(0, 1fr) minmax(120px, auto);
  }
}

@media (max-width: 760px) {
  .due-top-actions,
  .due-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .due-top-actions .month-box,
  .due-period-box,
  .due-filters {
    width: 100%;
    min-width: 0 !important;
  }

  .due-filter-grid {
    grid-template-columns: 1fr;
  }

  .due-filter-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .due-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .due-list-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .due-list-side {
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .due-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   ETAPA 5.3.1 — AÇÕES OPERACIONAIS EM VENCIMENTOS
   ========================================================= */

.due-list-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.due-action-button {
  appearance: none;
  border: 1px solid #cbd8e3;
  border-radius: 6px;
  background: #ffffff;
  color: #24455f;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  padding: 5px 8px;
}

.due-action-button:hover,
.due-action-button:focus-visible {
  border-color: #8fb1ca;
  background: #f4f8fb;
  outline: none;
}

.due-action-button.is-primary {
  border-color: #174a73;
  background: #174a73;
  color: #ffffff;
}

.due-action-button.is-primary:hover,
.due-action-button.is-primary:focus-visible {
  border-color: #113b5e;
  background: #113b5e;
}

@media (max-width: 760px) {
  .due-list-actions {
    width: 100%;
  }
}

/* =====================================================
   BUSCAS RÁPIDAS — ETAPA 5.4.3
   ===================================================== */

.list-search-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.list-search-box {
  min-width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.list-search-box label,
.central-select-label {
  color: #607486;
  font-size: 11px;
  font-weight: 700;
}

.list-search-box input,
.payment-history-search,
.central-top-actions input[type="search"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #c8d4de;
  border-radius: 7px;
  background: #ffffff;
  color: #17324d;
  font: inherit;
  outline: none;
}

.list-search-box input:focus,
.payment-history-search:focus,
.central-top-actions input[type="search"]:focus {
  border-color: #17456f;
  box-shadow: 0 0 0 2px rgba(23, 69, 111, 0.10);
}

.payment-history-search {
  min-width: 260px;
}

.central-tenant-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-empty-state {
  margin: 10px 0 0;
}

@media (max-width: 700px) {
  .list-search-header,
  .list-search-box,
  .payment-history-search {
    width: 100%;
    min-width: 0;
  }
}

.financial-scope-note { margin: 0 0 18px; color: #52677a; font-size: 13px; line-height: 1.6; }


/* Busca imediata: display:flex não pode reexibir itens filtrados. */
.summary-item[hidden],
.search-empty-state[hidden],
.tenant-search-results[hidden] {
  display: none !important;
}

.tenant-search-results {
  width: 100%;
  min-width: 0;
  border: 1px solid #c8d4de;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.tenant-search-count {
  margin: 0;
  padding: 10px 12px;
  color: #526778;
  font-size: 12px;
  line-height: 1.4;
}
.tenant-search-list {
  max-height: 280px;
  overflow-y: auto;
}
.tenant-search-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-top: 1px solid #e4ebf0;
  background: #fff;
  color: #17324d;
  text-align: left;
  font: inherit;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.tenant-search-result strong { font-size: 14px; }
.tenant-search-result span { color: #526778; font-size: 12px; }
.tenant-search-result:hover,
.tenant-search-result[aria-pressed="true"] { background: #edf4f9; }
.tenant-search-result:focus-visible { outline: 2px solid #17456f; outline-offset: -3px; }


/* 5.5.39.37 — Contratos separados por situação */
.contract-list-header {
  align-items: flex-end;
  gap: 18px;
}

.contract-list-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.contract-list-heading h3 {
  margin-bottom: 4px;
}

.contract-list-heading p {
  margin: 0;
  color: #6b7c8b;
  font-size: 13px;
  line-height: 1.45;
}

.contract-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 16px;
  border-bottom: 1px solid rgba(90, 61, 43, 0.12);
}

.contract-status-tabs button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(90, 61, 43, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #5a3d2b;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.contract-status-tabs button:hover {
  border-color: rgba(90, 61, 43, 0.4);
  background: #fbf6f1;
}

.contract-status-tabs button.is-active {
  border-color: #5a3d2b;
  background: #5a3d2b;
  color: #fff;
  box-shadow: 0 5px 14px rgba(90, 61, 43, 0.16);
}

.contract-status-tabs button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(90, 61, 43, 0.09);
  color: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.contract-status-tabs button.is-active span {
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 720px) {
  .contract-list-header {
    align-items: stretch;
  }

  .contract-status-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 14px 14px;
    scrollbar-width: thin;
  }

  .contract-status-tabs button {
    flex: 0 0 auto;
  }
}

@media (max-width: 760px) {
  .contract-lifecycle-summary { justify-items: start; max-width: none; width: 100%; }
  .contract-lifecycle-list-note { text-align: left; }
}

.contract-lifecycle-note[hidden],
.contract-lifecycle-list-note[hidden] {
  display: none !important;
}
