.app-page {
  min-height: 100vh;
}

.migration-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 67, 199, 0.16);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 67, 199, 0.06), rgba(9, 226, 253, 0.08));
  color: #1f3f82;
  font-size: 0.95rem;
  line-height: 1.5;
}

.migration-banner::before {
  content: "i";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #0043c7;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.8rem;
}

.compat-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2200;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.96);
  color: #f8fafc;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.compat-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.global-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(1px);
}

.global-busy-overlay.is-visible {
  display: flex;
}

.global-busy-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.95);
  color: #f8fafc;
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.36);
  font-weight: 600;
}

.global-busy-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(248, 250, 252, 0.28);
  border-top-color: #f8fafc;
  animation: globalBusySpin 0.8s linear infinite;
}

@keyframes globalBusySpin {
  to {
    transform: rotate(360deg);
  }
}

.auth-page {
  background: #f3f4f6;
}

.auth-shell {
  min-height: 100vh;
  width: 100%;
  padding: 0;
  position: relative;
}

.auth-shell-single {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  min-width: 104px;
  z-index: 5;
}

.auth-grid {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-image-panel {
  min-height: 100vh;
  background-color: #132aa0;
  background-image: linear-gradient(145deg, rgba(19, 42, 160, 0.8), rgba(41, 71, 217, 0.74));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-card-django {
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  padding: 28px;
  box-sizing: border-box;
}

.login-card-django form {
  margin-top: 10px;
}

.login-card-django h1 {
  margin: 0 0 6px;
  color: #0f2d62;
  font-size: 2rem;
}

.login-card-django p {
  margin: 0 0 18px;
  color: #334155;
}

.auth-login-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: block;
  gap: 6px;
}

.auth-field label,
.login-card-django label {
  display: block;
  font-weight: 600;
  color: #1f2937;
}

.login-card-django input,
.login-card-django .password-input-wrap input,
.login-card-django .password-field > input {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 0 14px;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
  margin-top: 6px;
}

.login-card-django .login-actions {
  margin-top: 8px;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-actions .btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 700;
}

.btn.btn-thinking {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.96;
  pointer-events: none;
}

.btn-think-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: btnThinkSpin 0.8s linear infinite;
  flex: 0 0 auto;
}

@keyframes btnThinkSpin {
  to {
    transform: rotate(360deg);
  }
}

.login-card-django .password-field {
  width: 100%;
  display: block;
}

.login-card-django .password-toggle {
  right: 8px;
  width: 34px;
  height: 34px;
}

.error-visible,
.field-error,
.reset-help {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.error-visible,
.field-error {
  color: #8d0f0f;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.18);
}

.reset-help {
  display: none;
}

.reset-help.is-info {
  color: #5b4a16;
  background: rgba(241, 196, 15, 0.14);
  border: 1px solid rgba(241, 196, 15, 0.3);
}

.reset-help.is-success {
  color: #0f5132;
  background: rgba(25, 135, 84, 0.12);
  border: 1px solid rgba(25, 135, 84, 0.28);
}

.reset-help.is-error {
  color: #842029;
  background: rgba(220, 53, 69, 0.12);
  border: 1px solid rgba(220, 53, 69, 0.28);
}

.reset-help:not([hidden]) {
  display: block;
}

.sidebar-logo {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
}

.settings-visual-card {
  background: #ffffff;
  border: 1px solid #dbe4f3;
  border-radius: 16px;
  padding: 20px;
}

.settings-visual-multi {
  display: grid;
  gap: 16px;
}

.settings-visual-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #1f2937;
}

.first-access-card {
  max-width: 460px;
}

.settings-visual-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  align-items: flex-start;
}

.settings-visual-preview-wrap {
  width: 100%;
}

.settings-visual-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  border: 1px solid #d6dfef;
  background-color: #eff4ff;
  background-image: linear-gradient(145deg, rgba(19, 42, 160, 0.72), rgba(41, 71, 217, 0.7));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.settings-visual-preview-simulator {
  aspect-ratio: 16 / 9;
}

.settings-visual-controls {
  display: grid;
  gap: 12px;
}

.settings-visual-label {
  font-weight: 700;
  color: #1f2937;
}

.settings-visual-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-url-controls {
  display: grid;
  gap: 12px;
}

.settings-url-controls input[type="url"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--ui-border, #d8e0ef);
  border-radius: 8px;
  background: var(--ui-surface, #ffffff);
  color: var(--ui-text, #111827);
  font-size: 1rem;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.settings-url-controls input[type="url"]:focus {
  border-color: var(--ui-accent, #0043c7);
  box-shadow: 0 0 0 3px rgba(0, 67, 199, 0.14);
  outline: none;
}

.settings-url-controls input[type="url"]:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.settings-visual-status {
  min-height: 22px;
  font-size: 0.9rem;
  color: #1f3f82;
}

.settings-rating-card {
  border: 1px solid #dbe4f3;
  border-radius: 18px;
  padding: 18px 20px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.settings-rating-list {
  display: grid;
  gap: 14px;
}

.settings-rating-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.settings-rating-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-rating-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.settings-rating-field-grow {
  flex: 1;
}

.settings-rating-field label {
  font-weight: 700;
  color: #1f2937;
}

.settings-rating-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--ui-border, #d8e0ef);
  border-radius: 8px;
  background: var(--ui-surface, #ffffff);
  color: var(--ui-text, #111827);
  font-size: 1rem;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.settings-rating-input:focus {
  border-color: var(--ui-accent, #0043c7);
  box-shadow: 0 0 0 3px rgba(0, 67, 199, 0.14);
  outline: none;
}

.settings-rating-input:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.settings-rating-inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

@media (max-width: 900px) {
  .settings-rating-card-header {
    grid-template-columns: 1fr;
  }

  .settings-rating-card-actions {
    justify-content: flex-start;
  }
}

.dashboard-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.9fr);
  gap: 18px;
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f3f7ff);
  border: 1px solid #dbe4f3;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(0, 39, 156, 0.08);
}

.dashboard-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 67, 199, 0.08);
  color: #0043c7;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-hero-card h3 {
  margin: 16px 0 10px;
  font-size: 1.75rem;
  line-height: 1.1;
  color: #1f2937;
}

.dashboard-hero-card p {
  margin: 0;
  color: #5f6b7a;
  line-height: 1.6;
}

.dashboard-hero-actions {
  display: grid;
  gap: 10px;
}

.dashboard-hero-actions .btn {
  text-align: center;
}

html[data-theme="dark"] .auth-page {
  background: #0b1220;
}

html[data-theme="dark"] .migration-banner {
  border-color: rgba(96, 165, 250, 0.18);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(14, 165, 233, 0.1));
  color: #dbeafe;
}

html[data-theme="dark"] .auth-image-panel {
  background-image: linear-gradient(145deg, rgba(8, 21, 47, 0.84), rgba(0, 22, 59, 0.74));
}

html[data-theme="dark"] .login-card-django {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] .login-card-django h1,
html[data-theme="dark"] .dashboard-hero-card h3 {
  color: #f8fafc;
}

html[data-theme="dark"] .login-card-django p,
html[data-theme="dark"] .dashboard-hero-card p {
  color: #94a3b8;
}

html[data-theme="dark"] .login-card-django label {
  color: #e2e8f0;
}

html[data-theme="dark"] .login-card-django input {
  background: #0f172a;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .dashboard-hero-card {
  background: linear-gradient(135deg, #0f172a, #13213d);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .dashboard-chip {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
}

html[data-theme="dark"] .settings-visual-card {
  background: #111c32;
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .settings-visual-title,
html[data-theme="dark"] .settings-visual-label {
  color: #f8fafc;
}

html[data-theme="dark"] .settings-url-controls input[type="url"] {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

html[data-theme="dark"] .settings-visual-status {
  color: #93c5fd;
}

@media (max-width: 920px) {
  .auth-shell {
    min-height: 100vh;
  }

  .auth-grid,
  .dashboard-hero-card {
    grid-template-columns: 1fr;
  }

  .auth-image-panel {
    min-height: 36vh;
  }

  .settings-visual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .auth-theme-toggle {
    top: 16px;
    right: 16px;
  }

  .auth-image-panel {
    min-height: 28vh;
  }

  .login-card-django {
    max-width: 100%;
    padding: 20px 18px 26px;
  }

  .auth-actions .btn {
    width: 100%;
  }
}

.dashboard-native-content {
  display: grid;
  gap: 20px;
}

.dashboard-page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.dashboard-header-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  min-width: min(100%, 360px);
}

.dashboard-meta-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #dbe4f3;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dashboard-meta-card strong,
.dashboard-meta-card small,
.dashboard-meta-label {
  display: block;
}

.dashboard-meta-card strong {
  font-size: 1rem;
  color: #13213d;
}

.dashboard-meta-card small,
.dashboard-meta-label {
  color: #5f6b7a;
}

.dashboard-meta-label {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-section {
  display: grid;
  gap: 14px;
}

.dashboard-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
}

.dashboard-section-heading h3 {
  margin: 0 0 4px;
  color: #1f2937;
  font-size: 1.4rem;
}

.dashboard-section-heading p {
  margin: 0;
  color: #5f6b7a;
}

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.dashboard-metric-card,
.dashboard-panel {
  background: #ffffff;
  border: 1px solid #dbe4f3;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 14px 32px rgba(0, 39, 156, 0.06);
}

.dashboard-metric-card {
  position: relative;
  overflow: hidden;
}

.dashboard-metric-card::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: #0043c7;
}

.dashboard-metric-card--success::after {
  background: #15803d;
}

.dashboard-metric-card--warning::after {
  background: #b45309;
}

.dashboard-metric-card--danger::after {
  background: #b91c1c;
}

.dashboard-metric-card--neutral::after {
  background: #334155;
}

.dashboard-metric-label,
.dashboard-metric-detail {
  display: block;
}

.dashboard-metric-label {
  color: #5f6b7a;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dashboard-metric-value {
  display: block;
  color: #13213d;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 8px;
}

.dashboard-metric-detail {
  color: #6b7280;
  font-size: 0.88rem;
}

.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.dashboard-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-entity-card {
  display: grid;
  gap: 14px;
}

.dashboard-entity-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.dashboard-entity-header h4,
.dashboard-panel h4 {
  margin: 0 0 4px;
  color: #13213d;
}

.dashboard-entity-header p,
.dashboard-panel > p {
  margin: 0;
  color: #5f6b7a;
}

.dashboard-entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-entity-meta span,
.dashboard-inline-stat,
.dashboard-compact-item {
  border-radius: 12px;
  border: 1px solid #e5edf8;
  background: #f8fbff;
}

.dashboard-entity-meta span {
  padding: 8px 10px;
  color: #334155;
  font-size: 0.88rem;
}

.dashboard-details {
  border-top: 1px solid #e5edf8;
  padding-top: 12px;
}

.dashboard-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #0043c7;
  margin-bottom: 10px;
}

.dashboard-table-wrap {
  overflow: auto;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.dashboard-table th,
.dashboard-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}

.dashboard-table th {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-table td {
  color: #1f2937;
  font-size: 0.92rem;
}

.dashboard-table--compact {
  min-width: 0;
}

.dashboard-inline-note {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.8rem;
}

.dashboard-inline-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.dashboard-inline-stat,
.dashboard-compact-item {
  padding: 12px 14px;
}

.dashboard-inline-stat strong,
.dashboard-inline-stat span,
.dashboard-inline-stat small,
.dashboard-compact-item strong,
.dashboard-compact-item span,
.dashboard-compact-item small {
  display: block;
}

.dashboard-inline-stat strong,
.dashboard-compact-item strong {
  color: #13213d;
}

.dashboard-inline-stat span,
.dashboard-compact-item span {
  color: #334155;
  margin-top: 4px;
}

.dashboard-inline-stat small,
.dashboard-compact-item small {
  margin-top: 4px;
  color: #64748b;
}

.dashboard-compact-list {
  display: grid;
  gap: 10px;
}

.dashboard-empty-state {
  padding: 22px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e2e8f0;
  color: #334155;
}

.status-badge--ativo,
.status-badge--aprovado {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.status-badge--inativo,
.status-badge--reprovado {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

.status-badge--em_analise {
  background: rgba(180, 83, 9, 0.12);
  color: #b45309;
}

.premissas-resumo {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #d8e3f8;
  border-radius: 10px;
  background: #f8fbff;
}

.premissas-resumo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: #13213d;
}

.premissas-resumo-head span {
  color: #0043c7;
  font-weight: 800;
}

.premissas-resumo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.premissas-resumo-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
}

.premissas-resumo-card.is-selected {
  border-color: #0043c7;
  box-shadow: 0 0 0 2px rgba(0, 67, 199, 0.10);
}

.premissas-resumo-card.is-disabled {
  opacity: 0.58;
}

.premissas-resumo-card span,
.premissas-resumo-card strong,
.premissas-resumo-card small {
  display: block;
}

.premissas-resumo-card span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.premissas-resumo-card strong {
  margin-top: 4px;
  color: #13213d;
}

.premissas-resumo-card small {
  margin-top: 5px;
  color: #475569;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .premissas-resumo-grid {
    grid-template-columns: 1fr;
  }

  .premissas-resumo-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.dashboard-json-cell {
  max-width: 340px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.proposal-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detalhe-item--stack .proposal-history-list {
  width: 100%;
  margin-top: 10px;
}

/* ═══════════════════════════════════════════
   MODAL EMPREENDIMENTO — REDESIGN VISUAL
   (somente layout/cores; toda lógica preservada)
   ═══════════════════════════════════════════ */

/* ── Tab nav ── */
#modalEmpreendimento .emp-tab-nav {
  display: flex;
  gap: 0;
  padding: 0 4px;
  border-bottom: 1.5px solid var(--ui-border);
  margin: 0 0 14px 0;
  flex-shrink: 0;
}
#modalEmpreendimento .emp-tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ui-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
#modalEmpreendimento .emp-tab-btn:hover {
  color: var(--ui-accent, #0043c7);
}
#modalEmpreendimento .emp-tab-btn.emp-tab-btn--active {
  color: var(--ui-accent, #0043c7);
  border-bottom-color: var(--ui-accent, #0043c7);
}
.emp-tab-panel--hidden {
  display: none !important;
}

/* ── Premissa items como cards em grid 2 colunas ── */
#modalEmpreendimento .premissas-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
#modalEmpreendimento .premissa-item {
  background: var(--ui-surface) !important;
  border: 1.5px solid var(--ui-border) !important;
  border-bottom: 1.5px solid var(--ui-border) !important;
  border-radius: 12px !important;
  padding: 14px !important;
  margin: 0 !important;
}
#modalEmpreendimento .premissa-item:last-child {
  border-bottom: 1.5px solid var(--ui-border) !important;
  margin-bottom: 0 !important;
  padding-bottom: 14px !important;
}
/* Itens de seção (cabeçalho de trecho parcial) ocupam largura total */
#modalEmpreendimento .premissa-item--section {
  grid-column: 1 / -1;
}

/* ── Descrição como tooltip (escondida por padrão) ── */
#modalEmpreendimento .premissa-description {
  display: none !important;
}
#modalEmpreendimento .premissa-header {
  position: relative;
}
/* ⓘ gerado via CSS no título */
#modalEmpreendimento .premissa-title::after {
  content: " ⓘ";
  font-size: 11px;
  color: var(--ui-muted);
  font-weight: 400;
}

/* ── Botões de modo como segmented toggle ── */
#modalEmpreendimento .emp-mode-toggle-row {
  display: inline-flex !important;
  background: var(--ui-surface-2) !important;
  border-radius: 10px !important;
  padding: 3px !important;
  gap: 2px !important;
}
#modalEmpreendimento .emp-mode-toggle-row .btn {
  border-radius: 8px !important;
  border: none !important;
  box-shadow: none !important;
  padding: 6px 16px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  transition: background .15s, color .15s, box-shadow .15s !important;
}
#modalEmpreendimento .emp-mode-toggle-row .btn.btn-primary {
  background: #fff !important;
  color: var(--ui-accent, #0043c7) !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.12) !important;
}
#modalEmpreendimento .emp-mode-toggle-row .btn.btn-secondary {
  background: transparent !important;
  color: var(--ui-muted) !important;
}
#modalEmpreendimento .emp-mode-toggle-row .btn:disabled {
  opacity: .4 !important;
}

/* ── Score chips — chip + × integrado no pill ── */
#empreendimentoScoreCards > div {
  gap: 0 !important;
}
#empreendimentoScoreCards .btn {
  font-size: 12.5px !important;
  font-weight: 700 !important;
  border: 1.5px solid transparent !important;
  border-radius: 20px !important;
  padding: 5px 14px !important;
  transition: all .15s !important;
}
/* Primeiro botão (nome do rating) quando há × */
#empreendimentoScoreCards > div .btn:not(:only-child):first-child {
  border-radius: 20px 0 0 20px !important;
  padding-right: 8px !important;
}
/* Botão × (sempre o último quando há 2) */
#empreendimentoScoreCards > div .btn:not(:only-child):last-child {
  border-radius: 0 20px 20px 0 !important;
  padding: 5px 9px !important;
  font-size: 13px !important;
  border-left: none !important;
}
/* Chip ativo */
#empreendimentoScoreCards .btn.btn-primary {
  background: var(--ui-accent, #0043c7) !important;
  border-color: var(--ui-accent, #0043c7) !important;
  color: #fff !important;
}
/* × ao lado de chip ativo — acompanha a cor primária */
#empreendimentoScoreCards .btn-primary + .btn-secondary {
  background: var(--ui-accent, #0043c7) !important;
  border-color: var(--ui-accent, #0043c7) !important;
  color: rgba(255,255,255,.6) !important;
}
#empreendimentoScoreCards .btn-primary + .btn-secondary:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
  color: #fff !important;
}
/* Chip inativo */
#empreendimentoScoreCards .btn.btn-secondary {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text) !important;
}
/* × de chip inativo */
#empreendimentoScoreCards .btn.btn-secondary:last-child:not(:only-child) {
  color: var(--ui-muted) !important;
}
#empreendimentoScoreCards .btn.btn-secondary:last-child:not(:only-child):hover {
  background: #fff0f0 !important;
  border-color: #e53e3e !important;
  color: #e53e3e !important;
}

/* ── Header compacto ── */
#modalEmpreendimento .modal-header {
  padding: 12px 16px !important;
  margin-bottom: 0 !important;
  border-radius: 14px 14px 0 0 !important;
}
#modalEmpreendimento .modal-header h3 {
  font-size: 15px !important;
}

/* ── Separação de "Ratings vinculados" / "Modalidades" ── */
#modalEmpreendimento #empreendimentoScoreControlsHost {
  border: 1.5px solid var(--ui-border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--ui-surface);
}

/* ── Botão "+ Adicionar rating" com estilo tracejado ── */
#empreendimentoScoreControlsHost .settings-rating-inline-form label {
  display: none !important;
}
#empreendimentoScoreControlsHost #empreendimentoAddScore {
  height: 32px !important;
  padding: 0 14px !important;
  border-radius: 20px !important;
  border: 1.5px dashed var(--ui-border) !important;
  background: #fff !important;
  color: var(--ui-muted) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}
#empreendimentoScoreControlsHost #empreendimentoAddScore:not(:disabled):hover {
  border-color: var(--ui-accent, #0043c7) !important;
  color: var(--ui-accent, #0043c7) !important;
  background: #ebf0ff !important;
}

/* ── Nome do empreendimento ocupa a linha toda ── */
#modalEmpreendimento .form-grid .form-group:has(#empreendimentoNome) {
  grid-column: 1 / -1;
}

/* ── Parcelas compact row ── */
#modalEmpreendimento .parcelas-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
#modalEmpreendimento .parcelas-group {
  display: contents; /* filhos fluem diretamente no flex-parent; JS display:none ainda funciona */
}
#modalEmpreendimento .parcelas-item {
  flex: 1;
  min-width: 70px;
}
#modalEmpreendimento .parcelas-item label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ui-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
}
#modalEmpreendimento .parcelas-item .numeric-input {
  width: 100%;
  height: 36px;
  text-align: center;
  font-weight: 700;
}
#modalEmpreendimento .parcelas-item .numeric-input[readonly] {
  background: var(--ui-surface, #f8fafc);
  color: var(--ui-accent, #0043c7);
}
#modalEmpreendimento .parcelas-eq {
  font-size: 18px;
  color: var(--ui-muted);
  padding-bottom: 6px;
  flex-shrink: 0;
}

/* ── "Parâmetros Gerais" — divisor na Regressiva Parcial ── */
.premissa-section-label {
  background: transparent !important;
  border: none !important;
  border-top: 1.5px solid var(--ui-border) !important;
  border-radius: 0 !important;
  padding: 12px 0 2px !important;
  font-size: 11px;
  font-weight: 700;
  color: var(--ui-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
}

@media (max-width: 700px) {
  #modalEmpreendimento .premissas-container {
    grid-template-columns: 1fr !important;
  }
  #modalEmpreendimento .emp-mode-toggle-row {
    flex-wrap: wrap !important;
  }
}

.proposal-history-item {
  border: 1px solid #d8dee9;
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.proposal-history-item:hover,
.proposal-history-item:focus-visible {
  border-color: #b6c2d4;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.proposal-history-item.is-success { border-left-color: #15803d; }
.proposal-history-item.is-danger { border-left-color: #b91c1c; }
.proposal-history-item.is-info { border-left-color: #2563eb; }
.proposal-history-item.is-neutral { border-left-color: #64748b; }

.proposal-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.proposal-history-head strong {
  color: #1f2937;
  font-size: 0.9rem;
}

.proposal-history-meta {
  color: #64748b;
  font-size: 0.74rem;
  line-height: 1.35;
  margin-bottom: 6px;
}

.proposal-history-message {
  color: #334155;
  font-size: 0.86rem;
  line-height: 1.45;
  min-height: calc(0.86rem * 1.45 * 3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.proposal-history-message.is-empty {
  color: #94a3b8;
  font-style: italic;
}

.detalhe-item--stack .proposal-history-item {
  padding: 8px 10px;
}

.detalhe-item--stack .proposal-history-head {
  align-items: flex-start;
}

.detalhe-item--stack .proposal-history-head strong {
  font-size: 0.82rem;
}

.detalhe-item--stack .proposal-history-meta {
  font-size: 0.7rem;
}

.detalhe-item--stack .proposal-history-message {
  font-size: 0.78rem;
  min-height: calc(0.78rem * 1.45 * 3);
}

#modalHistoricoDetalhes .detalhes-grid {
  align-items: start;
}

#modalHistoricoDetalhes .detalhe-item.detalhe-item--stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  height: 100%;
}

#modalHistoricoDetalhes .status-column-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  width: 100%;
}

#modalHistoricoDetalhes .status-column-header .detalhe-label {
  min-width: 0;
}

#modalHistoricoDetalhes .detalhe-item--stack .detalhes-help {
  margin-top: 0;
}

.proposal-history-dialog {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
}

.proposal-history-dialog.is-visible {
  display: flex;
}

.proposal-history-dialog-content {
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #d8dee9;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.proposal-history-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.proposal-history-dialog-header h3 {
  margin: 0;
  color: #1f2937;
  font-size: 1rem;
  font-weight: 900;
}

.proposal-history-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow: auto;
}

.proposal-history-dialog-meta {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.proposal-history-dialog-message {
  color: #334155;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nova-observacao-proposta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  background: #f8fafc;
}

.nova-observacao-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

html[data-theme="dark"] .dashboard-page-header,
html[data-theme="dark"] .dashboard-metric-card,
html[data-theme="dark"] .dashboard-panel {
  background: #111c32;
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

.usuario-assistidos-filtros {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.usuario-assistidos-filtro {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.usuario-assistidos-filtro label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}

.usuario-assistidos-filtro input,
.usuario-assistidos-filtro select {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #d7e0ee;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.usuario-assistidos-filtro input:focus,
.usuario-assistidos-filtro select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.usuario-assistidos-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.usuario-assistidos-node {
  padding: 10px 12px;
  border: 1px solid #d7e0ee;
  border-radius: 12px;
  background: #f8fbff;
}

.usuario-assistidos-node > label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #1e293b;
}

.usuario-assistidos-node ul {
  margin: 10px 0 0 28px;
  padding-left: 18px;
  color: #475569;
}

.usuario-assistidos-node li + li {
  margin-top: 6px;
}

.usuario-assistidos-empty {
  color: #64748b;
  font-size: 0.92rem;
}

@media (max-width: 768px) {
  .usuario-assistidos-filtros {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .proposal-history-item {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .proposal-history-item:hover,
html[data-theme="dark"] .proposal-history-item:focus-visible {
  border-color: rgba(148, 163, 184, 0.44);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .proposal-history-item.is-success { border-left-color: #22c55e; }
html[data-theme="dark"] .proposal-history-item.is-danger { border-left-color: #ef4444; }
html[data-theme="dark"] .proposal-history-item.is-info { border-left-color: #60a5fa; }
html[data-theme="dark"] .proposal-history-item.is-neutral { border-left-color: #94a3b8; }

html[data-theme="dark"] .proposal-history-head strong,
html[data-theme="dark"] .proposal-history-message {
  color: #e2e8f0;
}

html[data-theme="dark"] .proposal-history-meta,
html[data-theme="dark"] .proposal-history-message.is-empty {
  color: #94a3b8;
}

html[data-theme="dark"] .proposal-history-dialog-content {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.26);
}

html[data-theme="dark"] .proposal-history-dialog-header {
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .proposal-history-dialog-header h3,
html[data-theme="dark"] .proposal-history-dialog-message {
  color: #e2e8f0;
}

html[data-theme="dark"] .proposal-history-dialog-meta {
  color: #94a3b8;
}

html[data-theme="dark"] .nova-observacao-proposta {
  background: #111c32;
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .dashboard-meta-card,
html[data-theme="dark"] .dashboard-entity-meta span,
html[data-theme="dark"] .dashboard-inline-stat,
html[data-theme="dark"] .dashboard-compact-item,
html[data-theme="dark"] .dashboard-empty-state {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .dashboard-section-heading h3,
html[data-theme="dark"] .dashboard-metric-value,
html[data-theme="dark"] .dashboard-entity-header h4,
html[data-theme="dark"] .dashboard-inline-stat strong,
html[data-theme="dark"] .dashboard-compact-item strong,
html[data-theme="dark"] .dashboard-meta-card strong,
html[data-theme="dark"] .dashboard-table td {
  color: #f8fafc;
}

html[data-theme="dark"] .dashboard-section-heading p,
html[data-theme="dark"] .dashboard-meta-card small,
html[data-theme="dark"] .dashboard-meta-label,
html[data-theme="dark"] .dashboard-metric-label,
html[data-theme="dark"] .dashboard-metric-detail,
html[data-theme="dark"] .dashboard-entity-header p,
html[data-theme="dark"] .dashboard-inline-stat span,
html[data-theme="dark"] .dashboard-inline-stat small,
html[data-theme="dark"] .dashboard-compact-item span,
html[data-theme="dark"] .dashboard-compact-item small,
html[data-theme="dark"] .dashboard-inline-note,
html[data-theme="dark"] .dashboard-empty-state,
html[data-theme="dark"] .dashboard-table th,
html[data-theme="dark"] .dashboard-table td,
html[data-theme="dark"] .dashboard-entity-meta span {
  color: #94a3b8;
}

html[data-theme="dark"] .dashboard-table th,
html[data-theme="dark"] .dashboard-table td,
html[data-theme="dark"] .dashboard-details {
  border-color: rgba(148, 163, 184, 0.14);
}

@media (max-width: 980px) {
  .dashboard-page-header,
  .dashboard-split-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-page-header {
    flex-direction: column;
  }

  .dashboard-header-meta {
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .dashboard-table {
    min-width: 620px;
  }
}

.usuario-assistidos-filtros {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.usuario-assistidos-filtro {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.usuario-assistidos-filtro label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}

.usuario-assistidos-filtro input,
.usuario-assistidos-filtro select {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #d7e0ee;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.usuario-assistidos-filtro input:focus,
.usuario-assistidos-filtro select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.usuario-assistidos-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.usuario-assistidos-node {
  padding: 10px 12px;
  border: 1px solid #d7e0ee;
  border-radius: 12px;
  background: #f8fbff;
}

.usuario-assistidos-node > label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #1e293b;
}

.usuario-assistidos-node ul {
  margin: 10px 0 0 28px;
  padding-left: 18px;
  color: #475569;
}

.usuario-assistidos-node li + li {
  margin-top: 6px;
}

.usuario-assistidos-empty {
  color: #64748b;
  font-size: 0.92rem;
}

@media (max-width: 768px) {
  .usuario-assistidos-filtros {
    grid-template-columns: 1fr;
  }
}
