@import url("tokens.css");  /* cores, fonte, raios e sombra: só lá (skill design-ignis) */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--fonte);
  background: var(--creme-claro);
  color: var(--tinta);
}
header {
  background: var(--terracota);
  padding: 16px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  color: #fff;
}
header .brand {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}
header .brand img { height: 28px; width: auto; display: block; }
header button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

/* elemento: menu — navegação (skill tela-painel, design-ignis) */
header .menu-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}
header .user-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  /* fundo escuro: texto branco a 6,8:1 (sobre o --brand ficava 2,2:1 no e-mail e 3,9:1 no Sair) */
  background: var(--brand-deep);
  border-radius: var(--radius-sm);
  padding: 4px 4px 4px 12px;
}
header .user-area #user-email {
  font-size: 13px;
  white-space: nowrap;
  color: var(--branco);
  font-weight: 500;
}

/* Botão toggle do menu (só visível no celular) */
#menu-toggle {
  display: none;
  background: var(--ink-800);
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 6px;
  gap: 6px;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}
#menu-toggle:hover {
  background: var(--ink-700);
}
#menu-toggle:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Lista de itens do menu */
#menu-lista {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}
#menu-lista li {
  margin: 0;
}
#menu-lista a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 6px;
  transition: background var(--duracao-rapida);
  white-space: nowrap;
  min-height: 44px;
  box-sizing: border-box;
  background: var(--brand-deep);
  font-weight: 600;
}
#menu-lista a:hover {
  background: var(--ink-700);
}
#menu-lista a:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
#menu-lista a[aria-current="page"] {
  background: var(--ink-800);
  color: #fff;
  font-weight: 600;
}

/* Celular: menu em coluna */
@media (max-width: 600px) {
  header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
  }
  header .menu-container {
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 0;
  }
  #menu-toggle {
    display: flex;
    width: 100%;
    justify-content: space-between;
  }
  #menu-lista {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--terracota);
    padding: 8px 0;
    gap: 4px;
    position: relative;
    z-index: 100;
    margin-top: 8px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  #menu-toggle[aria-expanded="true"] ~ #menu-lista,
  #menu-lista:has(a:focus) {
    display: flex;
  }
  #menu-lista a {
    min-height: 44px;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 0 8px;
    background: transparent;
  }
  #menu-lista a[aria-current="page"] {
    background: var(--brand-deep);
  }
}
main {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card .label {
  font-size: 12px;
  color: #8A857D;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.card .value {
  font-size: 26px;
  font-weight: bold;
}
.card .value.warn { color: var(--perigo); }
.progress-bar {
  background: var(--creme);
  border-radius: 6px;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--terracota);
}
section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
section h2 {
  font-size: 15px;
  margin: 0 0 14px;
  color: var(--tinta);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--creme); }
th { color: #8A857D; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-row .name { width: 160px; font-size: 12px; color: var(--tinta); }
.bar-row .bar-outer { flex: 1; background: var(--creme); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-row .bar-inner { height: 100%; background: var(--terracota); }
.bar-row .amount { width: 80px; text-align: right; font-size: 12px; }
.empty { color: #A39A8C; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-low { background: #DCFCE7; color: #166534; }
.badge-medium { background: #FEF3C7; color: #92400E; }
.badge-high, .badge-veryhigh { background: #FEE2E2; color: #991B1B; }

.btn-pill {
  background: var(--terracota);
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  display: inline-block;
  border: none;
  cursor: pointer;
}
.btn-agente {
  background: rgba(255,255,255,0.9);
  color: var(--terracota-escuro);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--creme);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #8A857D;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--tinta); }
.tab-btn.active { color: var(--terracota-escuro); border-bottom-color: var(--terracota); }
.updated { color: #A39A8C; font-size: 12px; text-align: right; margin-top: -8px; margin-bottom: 20px; }

/* elemento: icone — SVG inline do Lucide (scripts/icone.py svg <nome>). origem: painel */
.icone { width: 1.25em; height: 1.25em; vertical-align: -0.2em; flex-shrink: 0; }

/* Movimento reduzido: quem pede no sistema não vê animação (skill design-ignis, "Movimento"). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* elemento: servico-com-detalhe — linha de "Gasto por serviço" que abre um detalhe (Ignis-Bedrock). origem: painel */
.servico-com-detalhe {
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.servico-com-detalhe .name { color: var(--brand-deep); font-weight: 600; text-decoration: underline; }
.servico-com-detalhe:focus-visible { outline: 2px solid var(--brand-deep); outline-offset: 2px; }
.detalhe-servico {
  margin: 4px 0 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.detalhe-servico h3 { font-size: 13px; margin: 12px 0 4px; color: var(--ink-800); }
.detalhe-servico td.valor { text-align: right; white-space: nowrap; }
.detalhe-servico .hint { font-size: 12px; color: var(--ink-700); margin: 0 0 4px; }
@media (max-width: 600px) {
  .servico-com-detalhe { min-height: 44px; }
}
