/* ---------------------------------------------------------------------------
   Identidade Ambition: verde #004445/#001f1f + dourado #C9A66B/#EFD19F,
   Michroma nos titulos e Inter no corpo.

   A area de trabalho fica CLARA de proposito: e uma ferramenta de uso diario,
   com tabelas densas e leitura longa. O dourado tem contraste ruim sobre
   branco (~2.2:1), entao aqui ele so aparece como filete, borda e detalhe -
   nunca como texto. Fundo escuro da marca fica na barra lateral e no login.
   --------------------------------------------------------------------------- */
:root {
  --brand-green: #004445;
  --brand-dark: #001f1f;
  --gold: #c9a66b;
  --gold-light: #efd19f;
  --gold-bar: linear-gradient(135deg, #c9a66b 0%, #efd19f 50%, #c9a66b 100%);

  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #eef2f2;
  --border: #dde4e3;
  --text: #0d1f1f;
  --muted: #5f7574;
  --primary: #004445;
  --primary-dark: #001f1f;
  --primary-soft: #e3eeed;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warn: #b54708;
  --warn-soft: #fef0c7;
  --ok: #067647;
  --ok-soft: #d3f8df;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 31, 31, 0.06), 0 8px 24px -12px rgba(0, 31, 31, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Montserrat, "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* Michroma so nos titulos: em texto corrido fica ilegivel */
h1,
.brand strong {
  font-family: Michroma, Inter, sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
h1 {
  font-size: 17px;
  line-height: 1.35;
}
/* filete dourado da marca sob o titulo da pagina */
.page-head h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 9px;
  border-radius: 2px;
  background: var(--gold-bar);
}

.hidden {
  display: none !important;
}

/* ------------------------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: radial-gradient(circle at 30% 0%, #004445 0%, #001f1f 100%);
  color: #d7e6e1;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(201, 166, 107, 0.22);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 6px;
}
.brand img {
  width: 132px;
  max-width: 100%;
  filter: drop-shadow(0 0 10px rgba(239, 209, 159, 0.28));
}
.brand strong {
  display: block;
  color: #fff;
  font-size: 11.5px;
  letter-spacing: 2.2px;
}
.brand small {
  color: var(--gold-light);
  font-size: 11px;
  display: block;
  max-width: 172px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.brand-divisor {
  height: 2px;
  border-radius: 2px;
  background: var(--gold-bar);
  opacity: 0.85;
}

#nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
#nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b9d3cc;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 500;
}
#nav a span {
  opacity: 0.75;
  width: 16px;
  text-align: center;
}
#nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
/* item ativo: verde da marca com a assinatura dourada na borda */
#nav a.active {
  background: rgba(201, 166, 107, 0.14);
  color: #fff;
  border-left: 3px solid var(--gold);
  padding-left: 9px;
  box-shadow: 0 0 20px rgba(201, 166, 107, 0.12);
}
#nav a.active span {
  opacity: 1;
  color: var(--gold-light);
}

.sidebar-foot {
  border-top: 1px solid rgba(201, 166, 107, 0.25);
  padding-top: 12px;
  font-size: 11px;
  color: #8fb3ab;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.engine {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.engine.idle {
  background: rgba(255, 255, 255, 0.07);
  color: #9fc0b8;
}
.engine.running {
  background: var(--gold-bar);
  color: #00292a;
  box-shadow: 0 0 20px rgba(201, 166, 107, 0.4);
}

main {
  padding: 26px 30px 60px;
  max-width: 1180px;
  width: 100%;
}

/* --------------------------------------------------------------- primitivos */

h1 {
  margin: 0 0 4px;
}
h2 {
  font-size: 16px;
  margin: 0 0 12px;
}
h3 {
  font-size: 14px;
  margin: 0 0 8px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.error {
  color: var(--danger);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card {
  margin-top: 16px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  gap: 16px;
}
.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.grid.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}

.btn {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.12s ease, background 0.12s ease;
}
.btn:hover {
  background: var(--surface-2);
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover {
  background: var(--primary-dark);
}
/* acao de destaque da marca (dourado com texto escuro, como no onboarding) */
.btn.gold {
  background: var(--gold-bar);
  border-color: var(--gold);
  color: #00292a;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.btn.gold:hover {
  box-shadow: 0 0 20px rgba(201, 166, 107, 0.45);
}
.btn.danger {
  background: var(--surface);
  border-color: #f1b0aa;
  color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger-soft);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 6px 8px;
}
.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.sm {
  padding: 5px 10px;
  font-size: 12px;
}
a.btn,
a.btn:hover {
  color: var(--text);
}
a.btn.primary,
a.btn.primary:hover {
  color: #fff;
}
.cap-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.cap-field input {
  width: 78px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 5px;
  color: #344054;
}
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}
textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.55;
}
.field {
  margin-bottom: 14px;
}
.hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  cursor: pointer;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.chip.on {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge.off {
  background: #eaecf0;
  color: #475467;
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge.err {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge.info {
  background: #e0f2fe;
  color: #026aa2;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef1f3;
}
tr:last-child td {
  border-bottom: none;
}
.table-wrap {
  overflow-x: auto;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat b {
  display: block;
  font-size: 26px;
  line-height: 1.2;
}
.stat small {
  color: var(--muted);
  font-size: 12px;
}

.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.logbox {
  background: #0b2d26;
  color: #cfe3de;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: Consolas, monospace;
  font-size: 12px;
  max-height: 260px;
  overflow-y: auto;
}
.logbox div {
  padding: 2px 0;
  white-space: pre-wrap;
}
.logbox .warn {
  color: #fcd34d;
}
.logbox .error {
  color: #fda4a1;
}

/* ------------------------------------------------------------------- wizard */

.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.step {
  flex: 1;
  min-width: 150px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.step b {
  display: block;
  color: var(--text);
  font-size: 13px;
}
.step.on {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.step.on b {
  color: var(--primary-dark);
}
.step.done {
  border-color: #b7e0d4;
}

.preview-msg {
  background: #e7f7d8;
  border-radius: 10px 10px 10px 2px;
  padding: 10px 12px;
  white-space: pre-wrap;
  font-size: 13.5px;
  border: 1px solid #cfeab8;
  margin-bottom: 8px;
}

/* -------------------------------------------------------------- modal/toast */

#modal-root:not(:empty) {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h2 {
  margin-top: 0;
}

#toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}
.toast {
  background: #101828;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: 380px;
}
.toast.err {
  background: var(--danger);
}
.toast.ok {
  background: var(--ok);
}

/* -------------------------------------------------------------------- login */

/* Login: a marca aparece inteira aqui — fundo da Ambition, logo e dourado. */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #004445 0%, #001f1f 100%);
  padding: 24px;
}
.login-card {
  background: rgba(0, 20, 20, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(201, 166, 107, 0.32);
  border-radius: 16px;
  padding: 34px 30px;
  width: min(380px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.login-logo {
  width: 168px;
  margin: 0 auto 4px;
  filter: drop-shadow(0 0 12px rgba(239, 209, 159, 0.3));
}
.login-card h1 {
  margin: 0;
  color: #fff;
  font-size: 14px;
  letter-spacing: 3px;
}
.login-card h1::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin: 10px auto 0;
  border-radius: 2px;
  background: var(--gold-bar);
}
.login-card .muted {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12.5px;
  margin: 0 0 4px;
}
.login-card input {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(201, 166, 107, 0.32);
  color: #fff;
  text-align: left;
}
.login-card input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.login-card input:focus {
  border-color: var(--gold-light);
  outline: 2px solid rgba(201, 166, 107, 0.25);
}
.login-card .btn.primary {
  background: var(--gold-bar);
  border-color: var(--gold);
  color: #00292a;
  font-family: Michroma, Inter, sans-serif;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  padding: 12px 14px;
  margin-top: 4px;
}
.login-card .btn.primary:hover {
  box-shadow: 0 0 24px rgba(201, 166, 107, 0.5);
}
.login-card .error {
  color: #ffb4ae;
  font-size: 12.5px;
  margin: 4px 0 0;
}
.login-rodape {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-top: 18px;
  text-align: center;
}

.qr-box {
  text-align: center;
}
.qr-box img {
  width: 260px;
  height: 260px;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.paircode {
  font-family: Consolas, monospace;
  font-size: 30px;
  letter-spacing: 5px;
  font-weight: 700;
  color: var(--primary-dark);
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  #nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  main {
    padding: 18px 16px 50px;
  }
}

/* seletor de cliente (admin) */
#tenant-switch {
  padding: 0 6px;
}
#tenant-switch select {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12.5px;
  padding: 7px 9px;
}
#tenant-switch option {
  color: #101828;
}

/* --------------------------------------------------- toques da identidade */

.card > h2:first-child,
.card-head h2 {
  color: var(--brand-green);
}

/* numeros do painel: verde da marca, com filete dourado */
.stat {
  border-left: 3px solid var(--gold);
}
.stat b {
  color: var(--brand-green);
}

.progress > div {
  background: linear-gradient(90deg, #004445 0%, #0a6a63 100%);
}

.chip.on {
  background: var(--primary-soft);
  border-color: var(--brand-green);
  color: var(--brand-green);
}

.step.on {
  border-color: var(--gold);
  background: #fbf7ef;
}
.step.on b {
  color: var(--brand-green);
}

.logbox {
  background: var(--brand-dark);
  border: 1px solid rgba(201, 166, 107, 0.2);
}

/* seletor de cliente na barra lateral */
#tenant-switch select {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(201, 166, 107, 0.32);
}
#tenant-switch select:focus {
  border-color: var(--gold-light);
}

/* prévia da mensagem continua verde de WhatsApp — é o que o eleitor vê */
