/* F.O.C.O — chat (custo/referências), anti-sobreposição, shell em altura cheia e serviços. Carregado depois do arquivo anterior em index.html (a ordem da cascata importa). */

/* =====================================================================
   Chat: chip de modelo, referências, contador de custo
   ===================================================================== */
.msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  font-size: var(--fs-12);
  color: var(--text-muted);
}

.msg-refs {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--divider);
}

.msg-refs__title {
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.msg-refs ol {
  list-style: none;
  margin: var(--sp-1) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-13);
}

.chat-cost {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: var(--fs-12);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.chat-cost strong {
  color: var(--text);
}

.router-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--fs-13);
}

.chat-cost[hidden] {
  display: none;
}

/* =====================================================================
   Anti-sobreposição: KPIs, cabeçalhos e identificadores longos
   ===================================================================== */
.kpi-row {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.kpi__value {
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.kpi__id {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.kpi__value .kpi__id {
  font-size: var(--fs-16);
}

.kpi__hint {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.meta__item {
  min-width: 0;
}

.meta__id {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.report-header__title {
  overflow-wrap: anywhere;
}

.page-header > div {
  min-width: 0;
}

.min-w-0 {
  min-width: 0;
}

.truncate-inline {
  display: inline-block;
  max-width: 32ch;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.page-eyebrow {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-13);
}

.page-eyebrow .link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

@media (max-width: 1180px) {
  .diff__pane + .diff__pane {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 1100px) {
  .report-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .report-header__actions {
    justify-content: flex-start;
  }
}

/* painel de explicação: lateral fixa em telas largas, gaveta com fundo abaixo de 1200px */
.explain-backdrop {
  position: fixed;
  inset: var(--header-h, 56px) 0 0 0;
  z-index: 59;
  background: rgba(0, 20, 50, 0.45);
}

.explain-backdrop[hidden] {
  display: none;
}

@media (min-width: 1200px) {
  .explain-backdrop {
    display: none;
  }
  #panel.has-explain .page--report {
    padding-right: calc(min(440px, 100vw) + var(--sp-5));
  }
}

/* =====================================================================
   Shell em altura cheia (Assistente): só a lista de mensagens rola
   ===================================================================== */
.app--fill {
  height: 100vh;
  min-height: 0;
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  overflow: hidden;
}

.app--fill .app-main {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.app--fill #panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.app--fill .app-footer {
  display: none;
}

.app--fill .app-nav {
  position: relative;
  top: 0;
  align-self: stretch;
  height: auto;
  min-height: 0;
}

.nav__new {
  flex: none;
}

.nav__chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.nav__convs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.nav__conv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 34px;
  padding: var(--sp-1) var(--sp-3);
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-13);
  text-align: left;
  cursor: pointer;
}

.nav__conv:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.nav__conv:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.nav__conv--active {
  background: var(--brand-badge-bg);
  color: var(--text);
  font-weight: 600;
}

.nav__conv-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav__conv-ts {
  font-size: var(--fs-12);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.nav__empty {
  padding: 0 var(--sp-3);
  font-size: var(--fs-13);
  color: var(--text-subtle);
}

.chat-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 48px;
  padding: var(--sp-2) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.chat-bar__title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--text);
}

.chat-bar__end {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
}

.chat-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: auto;
}

.chat-col {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.chat-scroll .chat__log {
  padding: var(--sp-6) 0 var(--sp-5);
}

.chat-dock {
  position: relative;
  flex: none;
  border-top: 1px solid var(--divider);
  background: var(--bg);
}

.chat-dock .alert {
  margin-top: var(--sp-3);
}

.chat-dock .composer,
.chat-hero .composer {
  position: static;
  padding: var(--sp-3) 0 var(--sp-3);
  background: none;
}

.chat-jump {
  position: absolute;
  left: 50%;
  top: calc(-1 * var(--sp-8));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 32px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-13);
  box-shadow: var(--shadow-2);
  cursor: pointer;
}

.chat-jump[hidden] {
  display: none;
}

.chat-jump:hover {
  border-color: var(--foco-blue);
  color: var(--link);
}

.chat-page--empty {
  justify-content: center;
  overflow-y: auto;
}

.chat-hero {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: var(--sp-6);
  text-align: center;
}

.chat-hero__title {
  font-family: var(--font-display);
  font-size: var(--fs-32);
  font-weight: 700;
  color: var(--foco-navy);
}

[data-theme="dark"] .chat-hero__title {
  color: var(--text);
}

.chat-hero__lead {
  margin: var(--sp-2) 0 var(--sp-5);
  font-size: var(--fs-20);
  color: var(--text-2);
}

.chat-hero .alert {
  margin-bottom: var(--sp-3);
  text-align: left;
}

.chat-hero .composer {
  text-align: left;
}

.chat-hero .chat-suggest {
  justify-content: center;
  margin-top: var(--sp-3);
}

.chat-hero__how {
  margin-top: var(--sp-6);
  text-align: left;
}

.chat-hero__how > summary {
  cursor: pointer;
  font-size: var(--fs-13);
  color: var(--text-muted);
  text-align: center;
}

.chat-hero__how .steps {
  margin-top: var(--sp-4);
}

.composer__box {
  grid-template-columns: minmax(0, 1fr);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-2);
}

.composer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.composer__tools {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.composer__tool {
  color: var(--text-2);
}

.composer__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--foco-blue);
  color: #ffffff;
  cursor: pointer;
}

.composer__send:hover:not(:disabled) {
  background: var(--foco-navy);
}

.composer__send:disabled {
  background: var(--surface-3);
  color: var(--text-subtle);
  cursor: not-allowed;
}

.composer__send:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.composer-menu {
  position: relative;
}

.composer-menu__list {
  position: absolute;
  left: 0;
  bottom: calc(100% + var(--sp-2));
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  max-width: min(420px, 80vw);
  padding: var(--sp-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}

.composer-menu__list[hidden] {
  display: none;
}

.composer-menu__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.composer-menu__item:hover:not(:disabled),
.composer-menu__item:focus-visible {
  background: var(--surface-3);
  outline: none;
}

.composer-menu__item:disabled {
  cursor: default;
  color: var(--text-subtle);
}

.composer-menu__label {
  font-size: var(--fs-14);
  font-weight: 600;
}

.composer-menu__hint {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--fs-12);
  color: var(--text-muted);
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-width: 0;
  min-height: 28px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.composer__hint {
  text-align: center;
}

/* =====================================================================
   Status dos serviços
   ===================================================================== */
.mesh-table th[scope="row"] {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 400;
}

.mesh__name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
}

.mesh__desc {
  font-size: var(--fs-12);
  color: var(--text-muted);
}
