* {
  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;
}

.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;
  }
}
