:root {
  --bg-dark: #020617;
  --card-bg: #0f172a;
  --accent: #38bdf8;
  --success: #10b981;
  --danger: #f43f5e;
  --text-main: #f1f5f9;
  --text-dim: #94a3b8;
  --border: rgba(56, 189, 248, 0.2);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg-dark);
  background-image: radial-gradient(circle at 50% -20%, #1e293b 0%, var(--bg-dark) 80%);
  margin: 0;
  display: flex;
  color: var(--text-main);
  min-height: 100vh;
}

/* ===== Layout ===== */
.sidebar {
  width: 280px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  height: 100vh;
  border-right: 1px solid var(--border);
  padding: 30px 20px;
  position: fixed;
  box-sizing: border-box;
}

.main-content {
  margin-left: 280px;
  flex: 1;
  padding: 50px;
  display: flex;
  flex-direction: column;
}

.logo-img {
  width: 100%;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.3));
  margin-bottom: 40px;
}

.nav-item {
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 10px;
  text-decoration: none;
  color: #94a3b8;
  display: block;
  transition: 0.3s;
  font-weight: 600;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-main);
}

.active {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

/* ===== Títulos ===== */
h1 {
  margin: 0 0 18px 0;
  text-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
  letter-spacing: -1px;
}

.page-subtitle {
  margin: -6px 0 18px 0;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
}

/* ===== Dashboard Fluxograma ===== */
.fluxo-container {
  position: relative;
  width: 100%;
  max-width: 1100px;
  background: var(--card-bg);
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

.fluxo-img {
  width: 100%;
  display: block;
  filter: brightness(0.8) contrast(1.2);
}

.link-overlay {
  position: absolute;
  cursor: pointer;
  z-index: 10;
}

/* Ajuste fino das áreas clicáveis */
.pos-circuitos { top: 18%; left: 3.5%; width: 18%; height: 12%; }
.pos-ticket   { top: 20%; left: 26%; width: 13%; height: 10%; }

/* ===== Componentes ===== */
.container {
  width: 100%;
  max-width: 1200px;
}

.search-box {
  width: 420px;
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(15,23,42,0.55);
  color: var(--text-main);
  outline: none;
  font-weight: 600;
  margin-bottom: 10px;
}

.search-box::placeholder { color: rgba(148,163,184,0.85); }

.search-box:focus {
  border-color: rgba(56,189,248,0.55);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.18);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: 0.22s;
}

.card:hover {
  transform: translateX(8px);
  border-color: rgba(56,189,248,0.35);
  box-shadow: 0 0 28px rgba(56,189,248,0.18), 0 4px 20px rgba(0,0,0,0.35);
}

.label {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 10px;
}

.small {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.client-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Status Badge (ATIVO verde / INATIVO vermelho) ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--success);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 10px rgba(16,185,129,0.6);
}

.status-badge.is-inactive {
  color: var(--danger);
}

.status-badge.is-inactive .dot {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.55);
}

/* cards críticos */
.critico { border-left: 4px solid var(--danger); }

/* opcional: deixa o card inativo levemente “apagado” */
.status-inativo { opacity: 0.92; }

.back-link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  text-transform: uppercase;
}

/* ===== Chips/Filtros ===== */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 16px 0;
}

.chip {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(15, 23, 42, 0.45);
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: 0.2s;
  user-select: none;
}

.chip:hover {
  border-color: rgba(56,189,248,0.30);
  color: var(--text-main);
}

.chip.active {
  background: rgba(56, 189, 248, 0.10);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.40);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.10);
}

.chip.danger.active {
  background: rgba(244, 63, 94, 0.10);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.45);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.12);
}

.chip.success.active {
  background: rgba(16, 185, 129, 0.10);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.12);
}

/* ===== Header com Donut à direita (Clientes / Contratos) ===== */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.page-head-left { flex: 1; }

.page-head-right {
  width: 320px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .page-head-right {
    width: 100%;
    justify-content: flex-start;
  }
}

.donut-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  width: 320px;
}

@media (max-width: 980px) {
  .donut-card { width: 100%; }
}

.donut-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.donut-title h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.donut-title .donut-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 800;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: center;
}

.donut {
  width: 150px;
  height: 150px;
  display: block;
}

.donut-legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.donut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 900;
}

.donut-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.swatch.success { background: var(--success); }
.swatch.danger  { background: var(--danger); }

/* ===== Card Detalhado (card.html) ===== */
.header-unit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  gap: 14px;
}

.badge-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.info-card {
  background: var(--card-bg);
  padding: 25px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.info-card h3 {
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  margin: 0 0 18px 0;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-row {
  margin-bottom: 14px;
  border-left: 2px solid var(--border);
  padding-left: 14px;
}

.contact-row strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-main);
}

.contact-row span {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  word-break: break-word;
}

.tech-data {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.9rem;
}

.tech-label { color: var(--text-dim); }

.tech-value {
  color: var(--accent);
  font-weight: 700;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

hr.sep {
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 12px 0;
}

/* ===== Responsivo ===== */
@media (max-width: 900px) {
  body { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; }
  .main-content { margin-left: 0; padding: 20px; }
}

/* ===== ALERTA CONTRATO INATIVO ===== */
.alerta-inativo {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: var(--danger);
  padding: 14px;
  border-radius: 10px;
  font-weight: 800;
  line-height: 1.5;
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.15);
}

/* ===== LINK MIDGARD (Quadrado Roxo) ===== */
.pos-midgard {
  position: absolute;
  top: 42%;
  left: 74%;
  width: 12%;
  height: 12%;
}

/* ==========================
   PATCH CARD.HTML – manter valores em azul no Plano/Notas
   (não afeta clientes/contratos)
   ========================== */

/* Dentro do card.html, o Plano usa .contact-row e as linhas usam .tech-label/.tech-value.
   Esta regra evita que .contact-row span { color: var(--text-dim) } sobrescreva o azul. */
.info-card .contact-row .tech-label {
  color: var(--text-dim) !important;
}

.info-card .contact-row .tech-value {
  color: var(--accent) !important;
  font-weight: 700;
}

/* card.html: esconder label vazio (para NOTAS sem "NOTA") */
.tech-label:empty {
  display: none;
}

/* ===== Card.html alinhado à esquerda ===== */

.info-card .tech-data {
  justify-content: flex-start;
  gap: 8px;
}

.info-card .tech-value {
  text-align: left;
}

/* =====================================================
   AJUSTE EXCLUSIVO DO CARD.HTML (não afeta outras páginas)
   ===================================================== */

.card-page .tech-data {
  justify-content: flex-start; /* alinhado à esquerda */
  gap: 8px;
}

.card-page .tech-label {
  font-size: 0.75rem;   /* label menor */
  letter-spacing: 0.5px;
}

.card-page .tech-value {
  font-size: 0.85rem;   /* valor um pouco maior */
  text-align: left;
}

/* esconder label vazio nas notas */
.card-page .tech-label:empty {
  display: none;
}

