:root {
  /* Identidade visual Exato: laranja #FF6600 + cinza-chumbo #4D4D4D */
  --bg: #f1f2f4;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e3e5e9;
  --text: #3a3a3a;
  --muted: #6b7280;
  --accent: #ff6600;         /* laranja da marca (preenchimentos) */
  --accent-hover: #e65c00;   /* laranja mais escuro (hover) */
  --accent-strong: #b34700;  /* laranja escuro (texto/links sobre branco) */
  --accent-soft: #fff1e6;    /* laranja bem claro (fundos ativos) */
  --cinza: #4d4d4d;          /* cinza-chumbo da marca */
  --danger: #b42318;
  --sucesso: #0a7d55;
  --sucesso-bg: #e7f6ee;
  --sucesso-bd: #a9dcc3;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.06), 0 8px 24px rgba(16, 32, 48, 0.08);
  --radius: 14px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-strong); }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.marca { display: inline-flex; align-items: center; flex-shrink: 0; }
.logo-img { height: 40px; width: auto; display: block; }
.topbar-sub {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}
.nav {
  margin-left: auto;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: var(--cinza);
  font-size: 14px; font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
}
.nav a:hover { background: var(--surface-2); color: var(--accent-strong); }
.nav a.sair { color: var(--muted); }
@media (max-width: 520px) {
  .topbar-sub { border-left: none; padding-left: 0; width: 100%; }
}

.voltar { margin: 0 0 16px; font-size: 14px; }
.voltar a { text-decoration: none; font-weight: 600; }

.muted { color: var(--muted); font-size: 13px; }

/* Stepper */
.steps { display: flex; gap: 8px; margin: 0 0 20px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px;
}
.step .num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border); color: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.step.active { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.step.active .num, .step.done .num { background: var(--accent); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.login-card { max-width: 420px; margin: 40px auto 0; }

/* Form */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
label .req { color: var(--danger); margin-left: 2px; }
.field { margin-bottom: 16px; }
.field .ajuda { font-size: 12px; color: var(--muted); margin-top: 5px; }

input[type="text"], input[type="date"], input[type="number"],
input[type="password"], input[type="file"], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 110px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }

/* Combobox de condomínio (dropdown estilizado com busca) */
.combo { position: relative; }
.combo > input { padding-right: 38px; }
.combo-caret {
  position: absolute; right: 14px; top: 21px; transform: translateY(-50%);
  width: 0; height: 0; pointer-events: none;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
}
.combo-lista {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(16, 32, 48, 0.16);
  max-height: 300px; overflow-y: auto;
}
.combo-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
}
.combo-item:hover, .combo-item.ativo { background: var(--accent-soft); }
.combo-nome { font-weight: 600; font-size: 14px; color: var(--text); line-height: 1.3; }
.combo-cidade { font-size: 12px; color: var(--muted); }
.combo-lista::-webkit-scrollbar { width: 12px; }
.combo-lista::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 8px; border: 3px solid var(--surface);
}

/* Campos lado a lado (ex.: data + hora) */
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; margin-bottom: 16px; }
@media (max-width: 480px) { .field-row { flex-direction: column; gap: 0; } }

/* Anexo de imagens */
.img-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.img-previews:empty { margin-top: 0; }
.img-thumb { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-remove {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; cursor: pointer; line-height: 18px;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.img-remove:hover { background: var(--danger); }

/* Imagens dentro do documento gerado */
.doc-imagens { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0; }
.doc-imagens img {
  max-width: 320px; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: 8px;
}

/* Grade de cartões (ferramentas / tarefas) */
.grade-cartoes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .grade-cartoes { grid-template-columns: 1fr; } }

.tarefa-btn {
  text-align: left; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  display: flex; gap: 12px; align-items: flex-start;
  text-decoration: none; color: inherit; font: inherit;
}
.tarefa-btn:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tarefa-btn:active { transform: translateY(1px); }
.tarefa-btn.sel { border-color: var(--accent); background: var(--accent-soft); }
.tarefa-btn .ico { font-size: 24px; line-height: 1; }
.tarefa-btn .t { display: block; font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.tarefa-btn .d { display: block; font-size: 13px; color: var(--muted); }

/* Botões */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  font: inherit; font-weight: 600; border-radius: 10px;
  padding: 11px 18px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-strong); padding-left: 4px; padding-right: 4px; }

/* Resultado */
.resultado {
  white-space: pre-wrap; word-wrap: break-word;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px 24px;
  font-size: 15px; line-height: 1.7; min-height: 120px;
  font-family: Georgia, "Times New Roman", serif;
}
.resultado.carregando::after {
  content: "Gerando o documento…";
  color: var(--muted); font-family: "Segoe UI", Arial, sans-serif; font-style: italic;
}

/* Alertas */
.alerta {
  background: #fef3f2; border: 1px solid #fecdca; color: #912018;
  border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px;
}
.alerta.sucesso { background: var(--sucesso-bg); border-color: var(--sucesso-bd); color: var(--sucesso); }

/* Tabela / listas */
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th, .tabela td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tabela th { color: var(--muted); font-weight: 700; }
.tabela td { word-break: break-word; }

.lista-clientes { margin: 0; padding-left: 20px; columns: 2; }
.lista-clientes li { margin-bottom: 4px; break-inside: avoid; }
@media (max-width: 600px) { .lista-clientes { columns: 1; } }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--accent-strong); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 50;
}

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff;
  border-radius: 50%; display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
