/* =============================================================================
   Wenz FinOps — Sistema visual "Direção C · Painel etéreo"
   Fonte da verdade: ajustes_frontEND/sistema-visual-direcao-c.html
                     ajustes_frontEND/recomendacoes-direcao-c.html
   CSS puro, sem framework. Breakpoints: >=1200 (desktop) · 768–1199 (md) · <768 (sm).
   ============================================================================= */

/* =========================================================================
   1. Tokens
   ========================================================================= */
:root {
  --navy-900: #0F2138;   /* blocos de código */
  --navy-700: #1B365D;   /* marca */
  --blue-600: #0066CC;   /* ação / links */
  --blue-700: #004E9C;   /* hover */
  --ink-900: #14243C;    /* títulos */
  --ink-700: #33445C;    /* corpo */
  --ink-500: #5A6B82;    /* subtítulo */
  --ink-400: #97A6BA;    /* rótulos caps */
  --ink-350: #8A99AF;    /* meta */
  --ink-300: #94A3B8;    /* placeholder */
  --fill-soft: #F1F4F9;  /* pílulas */
  --fill-field: #F4F7FB; /* campos */
  --fill-row: #F8FAFD;   /* linha expandida */
  --bg: #FAFBFD;
  --card: #FFFFFF;
  --green: #0B7A4B;
  --green-tint: #E7F5EE;
  --amber: #D99A1B;
  --amber-tint: #FBF3E0;
  --amber-ink: #6B4E12;
  --red: #B3453B;
  --red-tint: #F7E9E7;
  --teal: #0E7A73;
  --teal-tint: #E4F3F2;
  --blue-tint: #EAF2FD;
  --blue-chip: #0A5AB0;
  --navy-tint: #E5EBF4;
  --gray-chip-bg: #EDF1F7;
  --sep: #F1F4F9;
  --shadow-card: 0 2px 12px rgba(27, 54, 93, .08);
  --shadow-tile: 0 1px 6px rgba(27, 54, 93, .06);
  --font-sans: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;
  --halo: 0 0 0 3px rgba(0, 102, 204, .12); /* halo de foco */
}

/* =========================================================================
   2. Reset mínimo e base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-700);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* nunca scroll horizontal de página */
}
h1, h2, h3, h4, h5, h6, p, figure, dl, dd { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
img { max-width: 100%; height: auto; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
:focus-visible { outline: none; box-shadow: var(--halo); }
code, kbd, pre { font-family: var(--font-mono); }

/* =========================================================================
   3. Tipografia utilitária
   ========================================================================= */
.lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.kpi-v {
  font-size: 33px;
  font-weight: 700;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.015em;
  color: var(--ink-900);
}
.mono { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-500); }
.h1-page {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
.h-sec { font-size: 18px; font-weight: 600; color: var(--ink-900); }
.tag-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #7C8DA5;
  background: #EDF1F8;
  border-radius: 6px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* =========================================================================
   4. Shell — rail, topbar, conteúdo
   ========================================================================= */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--card);
  color: var(--blue-600);
  padding: 8px 14px;
  border-radius: 0 0 10px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 76px;
  background: var(--card);
  border-right: 1px solid #EFF3F9;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 18px;
  z-index: 50;
}
.rail-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--navy-700);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rail-logo:hover { color: #FFFFFF; opacity: .92; }
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 26px;
  padding: 0;
}
.rail-i {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7C8DA5;
}
.rail-i:hover { background: #EFF3F9; color: var(--ink-700); }
.rail-on, .rail-on:hover { background: var(--blue-600); color: #FFFFFF; }
.rail-avatar {
  margin-top: auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-700);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rail-avatar:hover { color: #FFFFFF; opacity: .9; }

.main { margin-left: 76px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 40px 0;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; min-width: 0; }
.crumbs a { color: var(--ink-350); }
.crumbs a:hover { color: var(--blue-600); }
.crumb-sep { color: #C2CDDC; }
.crumb-cur {
  color: var(--ink-900);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 18px; min-width: 0; }
.topbar-search .pill { width: 250px; }

.user-menu { position: relative; }
.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-900);
  padding: 6px 2px;
  border-radius: 8px;
  max-width: 240px;
}
.user-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn svg { flex: 0 0 auto; }
.user-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 172px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(27, 54, 93, .16);
  padding: 6px;
  display: none;
  z-index: 60;
}
.user-menu.open .user-drop { display: block; }
.user-drop form { margin: 0; }
.drop-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  font-size: 13px;
  color: var(--ink-700);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.drop-item:hover { background: var(--fill-soft); color: var(--ink-900); }

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px 40px 48px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Cabeçalho de página (bloco page_header) */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
.page-sub { font-size: 14px; color: var(--ink-500); margin-top: 6px; }
.page-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-350);
  white-space: nowrap;
  padding-bottom: 4px;
}

/* =========================================================================
   5. Cartões e KPIs
   ========================================================================= */
.fcard { background: var(--card); border-radius: 14px; box-shadow: var(--shadow-card); }
.kpi-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 18px; }
.kpi-grid .fcard { padding: 22px 26px; }

/* =========================================================================
   6. Botões
   ========================================================================= */
.btn-pri {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 20px;
  background: var(--blue-600);
  color: #FFFFFF;
  border: none;
  border-radius: 19px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-pri:hover { background: var(--blue-700); color: #FFFFFF; }
.btn-pri:focus-visible { box-shadow: var(--halo); }
.btn-pri:disabled, .btn-pri[aria-disabled="true"] {
  background: var(--gray-chip-bg);
  color: #A7B4C6;
  cursor: not-allowed;
}
.btn-dis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 20px;
  background: var(--gray-chip-bg);
  color: #A7B4C6;
  border: none;
  border-radius: 19px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: not-allowed;
  white-space: nowrap;
}
.btn-sec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-600);
  cursor: pointer;
  text-decoration: none;
}
.btn-sec:hover { color: var(--blue-700); }
.btn-sec:disabled { color: var(--ink-300); cursor: not-allowed; }

/* =========================================================================
   7. Pílulas de filtro e campos
   ========================================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: var(--fill-soft);
  border-radius: 19px;
  font-size: 13px;
}
.pill-l { color: #7C8DA5; white-space: nowrap; }
.pill-v { font-weight: 600; color: var(--ink-900); }
.pill:focus-within { box-shadow: var(--halo); }

/* select real dentro da pílula: transparente, sem borda, com chevron próprio */
.pill select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  padding: 0 18px 0 0;
  cursor: pointer;
  max-width: 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%238A99AF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 14px;
}
.pill select:focus { outline: none; box-shadow: none; }

/* input de busca dentro da pílula */
.pill input[type="search"], .pill input[type="text"] {
  border: 0;
  background: transparent;
  font-size: 13px;
  color: var(--ink-900);
  width: 100%;
  min-width: 0;
  padding: 0;
}
.pill input:focus { outline: none; box-shadow: none; }
.pill input::placeholder { color: var(--ink-300); }
.pill-search { width: 210px; }

/* barra de filtros */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }

/* rótulo e campo de formulário */
.field-l {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-400);
  margin-bottom: 6px;
}
.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 14px;
  background: var(--fill-field);
  border: 0;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink-900);
}
input.field, select.field { display: block; }
select.field {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%238A99AF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 36px;
}
textarea.field {
  display: block;
  height: auto;
  min-height: 70px;
  padding: 10px 14px;
  resize: vertical;
  line-height: 1.5;
}
.field::placeholder { color: var(--ink-300); }
.field:focus, .field:focus-within { outline: none; box-shadow: var(--halo); }
.field:disabled { color: var(--ink-300); cursor: not-allowed; }

/* =========================================================================
   8. Chips de status e confiança
   ========================================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 11px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-open { background: var(--blue-tint); color: var(--blue-chip); }
.chip-accepted { background: var(--green-tint); color: var(--green); }
.chip-applied { background: var(--navy-tint); color: var(--navy-700); }
.chip-dismissed { background: var(--gray-chip-bg); color: var(--ink-500); }
.chip-resolved { background: var(--teal-tint); color: var(--teal); }
.chip-warn { background: var(--amber-tint); color: var(--amber-ink); }
.chip-danger { background: var(--red-tint); color: var(--red); }

.conf {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-700);
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-high { background: var(--green); }
.dot-med { background: var(--amber); }
.dot-low { background: var(--red); }

/* =========================================================================
   9. Evidências, progresso e blocos de código
   ========================================================================= */
.ev-tile {
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow-tile);
  padding: 13px 15px;
}
.ev-l {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.ev-v {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.ev-s { font-size: 11.5px; color: var(--ink-350); margin-top: 2px; }

.progress-mini { height: 6px; background: #EAEFF6; border-radius: 3px; overflow: hidden; }
.progress-mini > span, .progress-mini-fill {
  display: block;
  height: 100%;
  background: var(--blue-600);
  border-radius: 3px;
}

.code-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--navy-900);
  border-radius: 10px;
  padding: 12px 15px;
  min-width: 0;
}
.code-block code, .code-block .code-txt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #C9D8EC;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.code-copy {
  background: none;
  border: 0;
  color: #7FA3D4;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  flex: 0 0 auto;
}
.code-copy:hover { color: #FFFFFF; background: rgba(255, 255, 255, .08); }

/* =========================================================================
   10. Listagem em grid (.tgrid) — NÃO usar <table>
   ========================================================================= */
.tgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 100px 100px 118px 96px 36px;
  gap: 14px;
  align-items: center;
  padding: 0 26px;
}
.tgrid > * { min-width: 0; }
.tgrid-head { padding-top: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--sep); }
.trow { border-top: 1px solid #F3F6FA; padding-top: 13px; padding-bottom: 13px; }
.row-open { background: var(--fill-row); }

.t-title { font-size: 14px; font-weight: 600; color: var(--ink-900); line-height: 1.35; overflow-wrap: anywhere; }
.t-meta {
  font-size: 12px;
  color: var(--ink-350);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.t-res {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-500);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}
.num { font-size: 13.5px; color: var(--ink-700); text-align: right; font-variant-numeric: tabular-nums; }
.econ { text-align: right; }
.econ-v {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.econ-p {
  display: block;
  font-size: 11.5px;
  color: var(--ink-350);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.econ-zero { color: var(--ink-350); }

.exp-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--fill-soft);
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-500);
  cursor: pointer;
  padding: 0;
}
.exp-btn:hover { background: #E4EAF3; color: var(--ink-700); }
.exp-btn svg { transition: transform .15s ease; }
.exp-btn-on, .exp-btn-on:hover { background: var(--blue-600); color: #FFFFFF; }
details[open] > summary .exp-btn svg, .exp-btn-on svg { transform: rotate(180deg); }

/* Área expandida da linha (detalhe da recomendação) */
.exp-area { background: var(--fill-row); padding: 20px 26px 26px; }
.exp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; }
.exp-grid > * { min-width: 0; }

/* =========================================================================
   11. Avisos (.note-banner) e mensagens do Django
   ========================================================================= */
.note-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 18px;
  background: var(--amber-tint);
  border-radius: 12px;
  font-size: 13px;
  color: var(--amber-ink);
  line-height: 1.5;
}
.note-banner svg { flex: 0 0 18px; margin-top: 1px; }
.note-banner a { font-weight: 600; }
.note-banner-success { background: var(--green-tint); color: var(--green); }
.note-banner-danger { background: var(--red-tint); color: var(--red); }

/* =========================================================================
   12. Login (página sem shell)
   ========================================================================= */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 32px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(27, 54, 93, .12);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-logo { max-width: 190px; margin: 0 auto 4px; border-radius: 12px; }
.login-title { font-size: 24px; font-weight: 700; color: var(--ink-900); letter-spacing: -.02em; }
.login-sub { font-size: 13.5px; color: var(--ink-500); }
.login-btn { width: 100%; margin-top: 6px; }
.login-note {
  font-size: 12px;
  color: var(--ink-400);
  line-height: 1.5;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--sep);
}
/* o parcial partials/login_message.html usa .alert/.alert-danger */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  text-align: left;
  background: var(--amber-tint);
  color: var(--amber-ink);
}
.alert-danger { background: var(--red-tint); color: var(--red); }

/* =========================================================================
   13. Perfil
   ========================================================================= */
.profile-card { max-width: 640px; width: 100%; padding: 24px 26px; }
.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--sep);
}
.profile-photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: 0 0 56px; }
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--navy-700);
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 56px;
}
.profile-name { font-size: 16px; font-weight: 600; color: var(--ink-900); overflow-wrap: anywhere; }
.profile-role { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.profile-list { display: flex; flex-direction: column; }
.profile-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--sep);
}
.profile-row:last-child { border-bottom: 0; padding-bottom: 0; }
.profile-row dd {
  font-size: 13.5px;
  color: var(--ink-700);
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}

/* =========================================================================
   14. Legado FinOps (restilizado nos novos tokens)
   ========================================================================= */
.finops-json {
  max-height: 340px;
  overflow: auto;
  background: var(--fill-field);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-500);
  line-height: 1.5;
  margin: 0;
  white-space: pre;
}
.finops-usercode {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: .3em;
  color: var(--navy-700);
  background: var(--fill-soft);
  border-radius: 14px;
  padding: .6rem .8rem .6rem 1.1rem;
  display: inline-block;
}
.finops-mono { font-family: var(--font-mono); font-size: 12px; }
.finops-help { font-size: 12px; color: var(--ink-400); }
.finops-truncate {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.finops-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-400);
  margin-bottom: 6px;
}
.finops-input {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--fill-field);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--ink-900);
}
.finops-input:focus { outline: none; box-shadow: var(--halo); }
.finops-note {
  background: var(--blue-tint);
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.5;
}
.finops-note.finops-note-warning { background: var(--amber-tint); color: var(--amber-ink); }
.finops-step {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  background: var(--navy-700);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================================
   15. Utilitários responsivos
   ========================================================================= */
.only-sm { display: none !important; }
/* .hide-md: escondido de 1199px para baixo (md e sm) */
/* .stack-label: no sm mostra o rótulo via attr(data-label) — ver media queries */

/* =========================================================================
   16. Breakpoint md — 768px a 1199px
   ========================================================================= */
/* Comandos e identificadores dentro de cartões: nunca alargar o cartão.
   `code` solto (ação recomendada) quebra onde precisar; o .code-block rola. */
.fcard code, .exp-area code, .tgrid code {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.code-block { overflow-x: auto; }
.code-block .mono, .code-block code { overflow-wrap: normal; word-break: normal; }

@media (max-width: 1199px) {
  .hide-md { display: none !important; }

  .topbar { padding: 20px 24px 0; }
  .topbar-search { display: none; }
  .content { padding: 20px 24px 48px; }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* sem as colunas Hoje/Depois (.hide-md nas células) */
  .tgrid { grid-template-columns: minmax(0, 1fr) 92px 118px 96px 36px; }

  .exp-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; }
}

/* =========================================================================
   17. Breakpoint sm — <768px
   ========================================================================= */
@media (max-width: 767px) {
  .only-sm { display: revert !important; }

  /* rail vira barra fixa inferior */
  .rail {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 76px;
    flex-direction: row;
    align-items: center;
    padding: 0 16px;
    border-right: 0;
    border-top: 1px solid #EFF3F9;
  }
  .rail-logo { display: none; }
  .rail-nav { flex-direction: row; margin-top: 0; gap: 6px; flex: 1; justify-content: center; }
  .rail-avatar { margin-top: 0; margin-left: auto; }
  .main { margin-left: 0; }

  .topbar { padding: 16px 16px 0; }
  .content { padding: 16px 16px 96px; }

  .page-head h1, .h1-page { font-size: 24px; }
  .kpi-v { font-size: 26px; }

  .kpi-grid { grid-template-columns: 1fr; }

  .filter-bar .pill-search { width: 100%; }
  .filter-actions { margin-left: 0; width: 100%; justify-content: flex-end; }

  /* .tgrid vira cartão empilhado: título em cima, métricas como pares rótulo/valor */
  .tgrid { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; padding: 0 18px; }
  .tgrid > * { grid-column: 1 / -1; }
  .tgrid > :nth-last-child(2) { grid-column: 1; align-self: center; }
  .tgrid > :last-child { grid-column: 2; justify-self: end; }
  .tgrid-head { display: none; }
  .num, .econ { text-align: left; }
  .t-res { max-width: 100%; }

  .stack-label { display: flex !important; align-items: baseline; gap: 8px; }
  .stack-label::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-400);
    margin-right: auto;
    white-space: nowrap;
  }
  .stack-label .econ-v, .stack-label .econ-p { display: inline; }

  /* detalhe expandido: decisão abaixo da evidência */
  .exp-area { padding: 16px 18px 22px; }
  .exp-grid { grid-template-columns: 1fr; gap: 18px; }

  .profile-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .profile-row dd { text-align: left; }
}
