/*
 * Design system do DooConnect sobre o BlazorBlueprint (shadcn/ui para Blazor).
 *
 * Os componentes (botao, campo, cartao, tabela, modal, menu, sidebar...) vem estilizados pelo
 * blazorblueprint.css. Aqui fica o layout do produto -- shell, cabecalho de pagina, metricas,
 * fluxo da mensageria, visualizador de JSON, telas de autenticacao -- e os poucos ajustes nos
 * componentes da lib.
 *
 * Regras que valem para o arquivo inteiro:
 *
 * - Cores so pelos tokens do shadcn (--background, --foreground, --primary, --muted,
 *   --muted-foreground, --border, --destructive...), que o themes.css define para o preset
 *   Zinc + Violet e troca sozinho no modo escuro (classe .dark no <html>). Nenhuma cor fixa
 *   fora do painel de marca do login.
 * - Este arquivo nao usa @layer de proposito: todo o CSS da lib vive em cascade layers, entao
 *   qualquer regra daqui vence a da lib sem !important. E assim que os ajustes via Class
 *   funcionam.
 * - Classe passada em Class= de componente da lib sempre com prefixo dc-. O valor passa pelo
 *   TailwindMerge da lib, e um nome com cara de utilitario do Tailwind (p-4, flex, hidden)
 *   removeria a classe equivalente do proprio componente sem que nada a substituisse, ja que o
 *   app nao tem build de Tailwind.
 * - A lib traz o reset do Tailwind (preflight): titulos herdam tamanho, listas perdem marcador,
 *   paragrafos perdem margem. Tudo o que a tela precisa e declarado aqui explicitamente.
 */

:root {
    --dc-topbar-height: 60px;
    --dc-radius: calc(var(--radius) + 4px);
    --dc-radius-sm: var(--radius);
    --dc-gap: 20px;

    --dc-border: var(--border);
    --dc-border-soft: color-mix(in oklch, var(--border) 65%, transparent);
    --dc-hover: color-mix(in oklch, var(--muted) 70%, transparent);
    --dc-tint: color-mix(in oklch, var(--primary) 10%, transparent);
    --dc-tint-strong: color-mix(in oklch, var(--primary) 18%, transparent);

    /* O shadcn nao tem token de sucesso nem de alerta; estes seguem as escalas green/amber do
       Tailwind, com a versao mais clara no modo escuro. */
    --dc-success: oklch(0.527 0.154 150.069);
    --dc-warning: oklch(0.666 0.179 58.318);

    --dc-mono: "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;

    /* Graficos do modo painel. Sucesso, falha e recebidas (ou em andamento) tem a mesma cor em
       todos os graficos. Regras:
       - OPACOS: o chart-theme.js da lib converte OKLCH na mao e descarta o "/ alpha", e um
         color-mix com transparent perde a transparencia;
       - conferidos nos dois modos (contraste com o fundo, separacao para daltonismo). No escuro o
         par sucesso/falha fica na faixa de aviso (dE 6,2 para protanopia), o que so e aceitavel
         porque toda cor de status vem com rotulo (legenda, tooltip, legenda em HTML da rosca). */
    --dc-chart-success: var(--dc-success);
    --dc-chart-failure: var(--destructive);
    --dc-chart-received: var(--primary);
    --dc-chart-duration: oklch(0.62 0.13 215);

    /* "Instavel" na faixa de disponibilidade. Verde, ambar e vermelho juntos nao se separam so pela
       cor para daltonismo (no escuro nenhum tom resolve dentro da faixa de luminosidade), entao o
       segmento instavel tambem leva listras: a textura e a segunda codificacao. */
    --dc-chart-warning: oklch(0.75 0.15 75);

    /* Modo monitor (tela cheia). Cor so para problema, como em sala de controle: o normal e neutro
       (fundo, borda e texto de sempre, so o icone verde), e ambar e vermelho ficam reservados para
       o que precisa de gente olhando. Os "-bg" misturam o tom com a superficie, entao valem nos dois
       temas; os "-fg" sao escuros no claro e claros no escuro, para passar 4,5:1 sobre o "-bg".
       As misturas com a superficie sao em oklab, nao oklch: em oklch o matiz e interpolado ate o
       do branco, e o verde vira caqui e o ambar vira salmao. */
    --dc-mon-bg: color-mix(in oklab, var(--muted) 60%, var(--background));
    --dc-mon-surface: var(--card);
    --dc-mon-inset: color-mix(in oklab, var(--muted) 45%, var(--card));
    --dc-mon-line: var(--border);
    --dc-state-ok: var(--dc-success);
    --dc-state-warn-fg: oklch(0.47 0.13 55);
    --dc-state-warn-line: var(--dc-warning);
    --dc-state-warn-bg: color-mix(in oklab, var(--dc-warning) 16%, var(--dc-mon-surface));
    --dc-state-crit-fg: oklch(0.5 0.2 27);
    --dc-state-crit-line: var(--destructive);
    --dc-state-crit-bg: color-mix(in oklab, var(--destructive) 11%, var(--dc-mon-surface));
    /* Faixa de alarme e etiqueta "Critico": vermelho cheio com texto claro. O --destructive do escuro
       e um vermelho claro demais para texto branco, por isso o proprio. */
    --dc-state-crit-solid: oklch(0.55 0.22 27);
    --dc-state-crit-solid-fg: oklch(0.985 0 0);
    /* Barras do monitor: sucesso num verde apagado (e o normal, nao chama o olho), falha no vermelho
       cheio dos graficos, recebidas no acento. color-mix pode aqui: e SVG proprio, sem ECharts. */
    --dc-mon-bar-ok: color-mix(in oklab, var(--dc-chart-success) 50%, var(--dc-mon-surface));
    --dc-mon-bar-fail: var(--dc-chart-failure);
    --dc-mon-bar-recv: var(--dc-chart-received);
    /* Linhas do grafico ao vivo: o verde um pouco abaixo do cheio (normal nao grita), a falha cheia. */
    --dc-mon-live-ok: color-mix(in oklab, var(--dc-chart-success) 80%, var(--dc-mon-surface));
    --dc-mon-live-fail: var(--dc-mon-bar-fail);

    /* Item ativo da sidebar no acento violeta, e nao no cinza padrao do shadcn: a tela em que a
       pessoa esta tem de ser a primeira coisa que o olho acha no menu. */
    --sidebar-menu-button-active-bg: var(--dc-tint);
    --sidebar-menu-button-active-color: var(--primary);
    --sidebar-menu-button-active-font-weight: 600;
}

.dark {
    --dc-success: oklch(0.723 0.219 149.579);
    --dc-warning: oklch(0.769 0.188 70.08);

    /* Proprios dos graficos: o verde e o vermelho de texto do modo escuro (claros) ficam quase
       iguais para quem tem deuteranopia. Aqui o verde desce e o vermelho sobe, para a diferenca
       de luminosidade separar os dois. */
    --dc-chart-success: oklch(0.55 0.17 150);
    --dc-chart-failure: oklch(0.66 0.22 24);
    --dc-chart-duration: oklch(0.66 0.17 250);
    --dc-chart-warning: oklch(0.66 0.15 85);

    /* No Zinc escuro cartao e fundo tem a mesma cor: a superficie do monitor clareia um pouco para
       os blocos se separarem do fundo sem precisar de borda forte. */
    --dc-mon-bg: var(--background);
    --dc-mon-surface: color-mix(in oklab, var(--foreground) 5%, var(--card));
    --dc-mon-inset: color-mix(in oklab, var(--foreground) 9%, var(--card));
    --dc-state-warn-fg: oklch(0.84 0.15 80);
    --dc-state-warn-bg: color-mix(in oklab, var(--dc-warning) 20%, var(--dc-mon-surface));
    --dc-state-crit-fg: oklch(0.8 0.13 25);
    --dc-state-crit-line: var(--dc-chart-failure);
    --dc-state-crit-bg: color-mix(in oklab, var(--dc-chart-failure) 20%, var(--dc-mon-surface));
    --dc-state-crit-solid: oklch(0.5 0.19 25);
    /* 70%, e nao menos: a coluna de sucesso ainda precisa aparecer sobre o fundo ambar de um bloco
       em alerta, e continua bem mais escura que o vermelho da falha. */
    --dc-mon-bar-ok: color-mix(in oklab, var(--dc-chart-success) 70%, var(--dc-mon-surface));
}

body {
    background: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
}

/* O FocusOnNavigate do Routes.razor foca o h1 a cada navegacao para leitores de tela.
   O anel de foco em um titulo, porem, aparece como uma caixa preta sem sentido. */
[tabindex="-1"]:focus {
    outline: none;
}

.dc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================================
   Shell autenticado
   ========================================================================= */

/* A sidebar (ilha interativa) e o shell (estatico) sao irmaos numa linha flex. O
   BbSidebarProvider nasce com largura total; a classe dc-sidebar-root (passada em HeightClass)
   o encolhe para a largura da propria sidebar -- aberta ou recolhida nos icones. No mobile a
   sidebar vira gaveta e o provider fica sem largura. Nao mexer no display do <aside> da lib: e
   ele que o esconde no celular, inclusive no prerender. */
.dc-app {
    display: flex;
    min-height: 100svh;
}

.dc-sidebar-root {
    flex: none;
    width: auto;
    min-height: 0;
    height: 100svh;
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.dc-shell {
    flex: 1 1 0;
    min-width: 0;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
}

.dc-content {
    flex: 1;
    padding: 28px 32px 56px;
}

.dc-content--plain {
    padding: 48px 32px;
}

/* --- Sidebar ------------------------------------------------------------- */

.dc-brand {
    gap: 10px;
}

.dc-brand__mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 9px;
    background: linear-gradient(140deg, var(--primary), color-mix(in oklch, var(--primary) 55%, black));
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
}

.dc-brand__mark--lg {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.15rem;
}

.dc-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    overflow: hidden;
}

.dc-brand__text strong {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.dc-brand__text small {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted-foreground);
}

/* Recolhida nos icones, a marca ocupa o botao inteiro em vez de ser cortada pelo padding. */
[data-collapsible="icon"] .dc-brand {
    padding: 0;
    justify-content: center;
}

.dc-sidebar__foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 0.72rem;
    color: var(--muted-foreground);
}

.dc-sidebar__foot svg {
    flex: none;
    color: var(--primary);
}

[data-collapsible="icon"] .dc-sidebar__foot {
    justify-content: center;
    padding: 6px 0;
}

[data-collapsible="icon"] .dc-sidebar__foot span {
    display: none;
}

/* --- Topbar ------------------------------------------------------------- */

.dc-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--dc-topbar-height);
    padding: 0 24px 0 12px;
    background: color-mix(in oklch, var(--background) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--dc-border);
}

.dc-topbar__spacer {
    flex: 1;
}

.dc-tenant,
.dc-user {
    gap: 8px;
    max-width: 260px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--dc-border);
    border-radius: 999px;
    font-size: 0.85rem;
}

.dc-tenant:hover,
.dc-user:hover {
    border-color: color-mix(in oklch, var(--primary) 40%, transparent);
}

.dc-tenant > svg:first-child {
    color: var(--primary);
}

.dc-tenant__name,
.dc-user__name {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.dc-user {
    padding-left: 4px;
}

.dc-user__avatar {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
}

.dc-user__avatar > span,
.dc-profile__avatar > span {
    background: var(--dc-tint-strong);
    color: var(--primary);
    font-weight: 700;
}

/* --- Menus (tenant e conta) --------------------------------------------- */

.dc-menu {
    min-width: 220px;
}

/* O item da lib nao tem espaco entre icone e texto quando o icone vem no conteudo. */
.dc-menu [role="menuitem"],
.dc-menu [role="menuitemcheckbox"] {
    gap: 8px;
}

.dc-usercard {
    display: flex;
    flex-direction: column;
    padding: 2px 0;
    font-weight: 400;
}

.dc-usercard__label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted-foreground);
}

.dc-usercard__value {
    margin-top: 2px;
    font-size: 0.85rem;
    font-weight: 600;
    word-break: break-all;
}

.dc-usercard__sub {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    word-break: break-all;
}

.dc-menu-form {
    display: block;
    margin: 0;
}

/* Botao de formulario (logout, troca de tenant) com a cara do BbDropdownMenuItem. Nao e item
   da lib porque precisa submeter um POST nativo, com o antiforgery. */
.dc-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: calc(var(--radius) - 4px);
    background: none;
    color: inherit;
    font: inherit;
    font-size: 0.875rem;
    text-align: start;
    cursor: default;
    outline: none;
}

.dc-menu-item:hover,
.dc-menu-item:focus {
    background: var(--bb-menu-accent, var(--accent));
    color: var(--bb-menu-accent-foreground, var(--accent-foreground));
}

.dc-menu-item svg {
    flex: none;
    color: var(--muted-foreground);
}

.dc-menu-item.is-current,
.dc-menu-item.is-current svg {
    color: var(--primary);
    font-weight: 600;
}

/* O tenant atual: informa, nao e clicavel. */
.dc-menu-item--static {
    padding-left: 0;
    padding-right: 0;
}

.dc-menu-item--static:hover {
    background: none;
    color: var(--primary);
}

.dc-menu-item__text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.dc-menu-item__text small {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--muted-foreground);
}

/* Acao destrutiva dentro do menu. Sem isto "Excluir" tem o mesmo peso visual de "Rotacionar",
   que e reversivel. */
.dc-menu-item--danger,
.dc-menu-item--danger svg,
.dc-menu-item--danger:focus,
.dc-menu-item--danger:hover {
    color: var(--destructive);
}

.dc-menu-item--danger:focus,
.dc-menu-item--danger:hover {
    background: color-mix(in oklch, var(--destructive) 10%, transparent);
}

.dc-menu-section {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted-foreground);
}

.dc-menu-empty {
    padding: 8px;
    font-size: 0.82rem;
    color: var(--muted-foreground);
}

/* =========================================================================
   Pagina
   ========================================================================= */

.dc-page {
    max-width: 1360px;
    margin: 0 auto;
}

.dc-page--loading {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dc-page__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.dc-page__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dc-page__subtitle {
    margin: 4px 0 0;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.dc-page__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Erro e nao encontrado: texto do template, centralizado e com respiro. */
.dc-page-message {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 640px;
    margin: 0 auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

.dc-page-message h2 {
    margin-top: 12px;
    font-size: 1.05rem;
    font-weight: 650;
}

/* --- Cartao ------------------------------------------------------------- */

.dc-card {
    overflow: hidden;
}

.dc-card + .dc-card {
    margin-top: var(--dc-gap);
}

.dc-card__head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--dc-border-soft);
}

.dc-card__head > * {
    margin: 0;
}

.dc-card__heading {
    min-width: 0;
}

.dc-card__title {
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: normal;
}

.dc-card__desc {
    margin-top: 3px;
    font-size: 0.8rem;
}

.dc-card__actions {
    flex: none;
    gap: 8px;
}

.dc-card__body {
    padding: 20px;
}

.dc-card__body--flush {
    padding: 0;
}

.dc-card code,
.dc-grid code {
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--muted);
    font-family: var(--dc-mono);
    font-size: 0.8rem;
}

/* --- Metricas ----------------------------------------------------------- */

.dc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--dc-gap);
    margin-bottom: var(--dc-gap);
}

.dc-stat {
    position: relative;
    padding: 18px 20px;
}

.dc-stat__icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--muted);
    color: var(--muted-foreground);
    margin-bottom: 12px;
}

.dc-stat__label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-foreground);
}

.dc-stat__value {
    margin: 4px 0 0;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.dc-stat__hint {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.dc-stat--success .dc-stat__icon {
    background: color-mix(in oklch, var(--dc-success) 14%, transparent);
    color: var(--dc-success);
}

.dc-stat--success .dc-stat__value {
    color: var(--dc-success);
}

.dc-stat--info .dc-stat__icon {
    background: var(--dc-tint);
    color: var(--primary);
}

.dc-stat--danger .dc-stat__icon {
    background: color-mix(in oklch, var(--destructive) 14%, transparent);
    color: var(--destructive);
}

.dc-stat--danger .dc-stat__value {
    color: var(--destructive);
}

/* --- Colunas e modulos -------------------------------------------------- */

.dc-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: var(--dc-gap);
    align-items: start;
}

.dc-columns > .dc-card + .dc-card {
    margin-top: 0;
}

.dc-modules {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dc-module {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--dc-border-soft);
    border-radius: var(--dc-radius-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms ease, background 120ms ease;
}

.dc-module:hover {
    background: var(--dc-hover);
    border-color: color-mix(in oklch, var(--primary) 35%, transparent);
}

.dc-module__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    background: var(--dc-tint);
    color: var(--primary);
}

.dc-module__text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.dc-module__text strong {
    font-size: 0.9rem;
    font-weight: 650;
}

.dc-module__text small {
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

/* --- Tabelas ------------------------------------------------------------ */

.dc-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--dc-border-soft);
}

.dc-filter {
    gap: 6px;
}

.dc-filter__count {
    padding: 0 6px;
    border-radius: 999px;
    background: var(--muted);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.dc-filter[data-state="on"] .dc-filter__count {
    background: var(--background);
}

.dc-toolbar__count {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted-foreground);
}

/* Grid da lib em modo denso: listagens do hub leem de relance, e o padding padrao (16px) deixa
   cada linha alta demais. */
.dc-grid table {
    font-size: 0.875rem;
}

.dc-grid th {
    height: 40px;
    padding: 0 12px;
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
}

.dc-grid td {
    padding: 10px 12px;
}

.dc-grid tr {
    border-color: var(--dc-border-soft);
}

.dc-grid th:first-child,
.dc-grid td:first-child {
    padding-left: 20px;
}

.dc-grid th:last-child,
.dc-grid td:last-child {
    padding-right: 20px;
}

.dc-row-clickable {
    cursor: pointer;
}

/* Credencial que nao autentica mais: continua na lista "Todas" para poder ser excluida, mas
   apagada, para nao ser lida como uma que funciona. */
.dc-grid tr.is-muted td {
    color: var(--muted-foreground);
}

.dc-grid tr.is-muted td > * {
    opacity: 0.7;
}

.dc-cell-strong {
    display: block;
    font-weight: 600;
}

.dc-cell-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Data, hora e referencia de lote nao quebram: partidas em duas linhas, cada linha da tabela
   saia de uma altura. */
.dc-nowrap {
    white-space: nowrap;
}

.dc-cell-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.dc-cell-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dc-cell-status__error {
    color: var(--destructive);
}

/* Motivo da falha ao lado do status (ErrorReason): rotulo curto a vista, explicacao no tooltip. */
.dc-reason {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: help;
}

.dc-reason__tip {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 320px;
    font-size: 0.78rem;
}

.dc-reason__tip code {
    font-family: var(--dc-mono);
    font-size: 0.72rem;
    opacity: 0.75;
}

.dc-reason__message {
    font-style: italic;
}

/* Nome de fila e client_id sao longos e opacos: o comeco identifica, o resto so ocupa. O valor
   inteiro continua no title, para copiar ou conferir. */
.dc-cell-code {
    display: inline-block;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.dc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Chips numa linha so: empilhadas, cada linha da tabela saia de uma altura. */
.dc-chips--inline {
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* Rotulo curto e neutro (canal, tipo). O accent marca o caso que tem algo a mais. */
.dc-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--dc-border);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--muted-foreground);
}

.dc-tag--accent {
    border-color: transparent;
    background: var(--dc-tint);
    color: var(--primary);
}

/* --- Situacao ----------------------------------------------------------- */

/* BbBadge Outline com ponto colorido: a cor responde "da para usar?" antes de ler o texto. */
.dc-status {
    --dc-status-color: var(--muted-foreground);
    gap: 6px;
    padding: 2px 10px 2px 8px;
    border-color: transparent;
    background: color-mix(in oklch, var(--dc-status-color) 12%, transparent);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.dc-status__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dc-status-color);
}

.dc-status__label {
    color: var(--dc-status-color);
}

.dc-status__icon {
    flex: none;
    color: var(--dc-status-color);
}

.dc-status__hint {
    font-weight: 500;
    color: var(--muted-foreground);
}

.dc-status--ok {
    --dc-status-color: var(--dc-success);
}

.dc-status--warn {
    --dc-status-color: var(--dc-warning);
}

.dc-status--danger {
    --dc-status-color: var(--destructive);
}

/* --- Cartoes de direcao (Integracoes) ----------------------------------- */

/* BbTabs restilizado: a lista vira grade de dois cartoes e cada gatilho, um cartao. A seta
   De -> Para e o que distingue os dois lados, por isso ela vem no titulo e nao escondida num
   subtitulo. */
.dc-directions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    height: auto;
    margin-bottom: 16px;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.dc-direction {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    height: auto;
    padding: 14px 16px;
    border: 1px solid var(--dc-border);
    border-radius: var(--dc-radius);
    background: var(--card);
    color: var(--card-foreground);
    font-weight: 400;
    text-align: start;
    white-space: normal;
    box-shadow: none;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.dc-direction:hover {
    border-color: color-mix(in oklch, var(--primary) 35%, transparent);
}

.dc-direction[data-state="active"] {
    border-color: var(--primary);
    background: var(--dc-tint);
    color: var(--card-foreground);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.dc-direction__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    background: var(--dc-tint);
    color: var(--primary);
}

.dc-direction[data-state="active"] .dc-direction__icon {
    background: var(--primary);
    color: var(--primary-foreground);
}

.dc-direction__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    line-height: 1.3;
}

.dc-direction__text small {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.dc-direction__text strong {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 650;
}

.dc-direction__text > span {
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.dc-direction__arrow {
    color: var(--muted-foreground);
}

.dc-direction__summary {
    margin-left: auto;
    flex: none;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--muted-foreground);
}

/* Permissoes no detalhe: nome traduzido e, ao lado, o valor que vai no token. */
.dc-scope-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dc-scope-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--dc-border-soft);
    font-size: 0.85rem;
}

.dc-scope-list li:last-child {
    border-bottom: none;
}

.dc-scope-list code {
    margin-left: auto;
}

.dc-scope-list__check {
    flex: none;
    color: var(--dc-success);
}

/* --- Estado vazio ------------------------------------------------------- */

.dc-empty {
    padding: 40px 24px;
}

.dc-empty p {
    max-width: 460px;
}

.dc-empty__actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* =========================================================================
   Modais
   ========================================================================= */

/* O conteiner do BbDialogProvider nao tem altura maxima: sem isto, um JSON grande ou uma lista
   longa empurraria o rodape para fora da tela. O corpo rola; cabecalho e rodape ficam. O padding
   com margem negativa evita que o overflow corte o anel de foco dos campos. */
.dc-dialog__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100svh - 14rem);
    overflow: auto;
    padding: 3px;
    margin: -3px;
}

.dc-dialog__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.dc-dialog__loading {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dc-dialog__footer {
    flex-wrap: wrap;
    row-gap: 8px;
}

/* Botao fantasma para acao destrutiva (Excluir, Revogar no detalhe da credencial). */
.dc-btn-danger,
.dc-btn-danger:hover {
    color: var(--destructive);
}

.dc-btn-danger:hover {
    background: color-mix(in oklch, var(--destructive) 10%, transparent);
}

.dc-field-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.dc-field-row > * {
    flex: 1;
    min-width: 0;
}

.dc-field-row > .dc-field-row__narrow {
    flex: 0 0 92px;
}

.dc-form-legend {
    margin: 4px 0 -8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted-foreground);
}

/* Opcao de checkbox com o valor tecnico (o scope) alinhado a direita. */
.dc-option {
    width: 100%;
}

.dc-option code {
    margin-left: auto;
}

/* --- Revelacao de segredo --------------------------------------------- */

.dc-secret-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dc-secret__label {
    margin: 0 0 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-foreground);
}

.dc-secret__row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px 6px 12px;
    border: 1px solid var(--dc-border);
    border-radius: var(--dc-radius-sm);
    background: var(--muted);
}

.dc-secret__value {
    flex: 1;
    min-width: 0;
    font-family: var(--dc-mono);
    font-size: 0.8rem;
    word-break: break-all;
}

/* Mesma coisa dentro de celula de tabela: sem caixa, e com os botoes colados no valor para a
   coluna nao crescer. */
.dc-secret__inline {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Em celula de tabela o valor nao pode ditar a largura da coluna: o client_id tem 35 caracteres
   e sozinho empurrava a coluna de acoes para fora da tela. O valor inteiro sai pelo botao de
   copiar e pelo title. */
.dc-secret__inline-value {
    display: inline-block;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* Os bullets chegam colados; sem isto "dck_live_••••••••" vira um borrao. */
.dc-secret__inline-value,
.dc-secret__value {
    letter-spacing: 0.02em;
}

/* --- Detalhe de operacao ---------------------------------------------- */

.dc-detail {
    display: flex;
    flex-direction: column;
}

.dc-detail__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--dc-border-soft);
    font-size: 0.85rem;
}

.dc-detail__row:last-child {
    border-bottom: none;
}

.dc-detail__row > span:first-child {
    color: var(--muted-foreground);
    flex: none;
}

.dc-detail__row code {
    font-family: var(--dc-mono);
    font-size: 0.78rem;
    word-break: break-all;
    text-align: right;
}

.dc-muted {
    margin: 0;
    font-size: 0.84rem;
    color: var(--muted-foreground);
}

.dc-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dc-timeline__item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
}

.dc-timeline__dot {
    width: 9px;
    height: 9px;
    margin-top: 6px;
    flex: none;
    border-radius: 50%;
}

.dc-timeline__dot--ok {
    background: var(--dc-success);
}

.dc-timeline__dot--fail {
    background: var(--destructive);
}

.dc-timeline__title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.dc-timeline__meta {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.dc-timeline__error {
    margin: 4px 0 0;
    font-size: 0.78rem;
    color: var(--destructive);
}

/* Falha no modal (ErrorAlert): o motivo, o texto do erro, o que fazer e o codigo por ultimo. */
.dc-error {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* O texto gravado na operacao: chaves de itens e caminhos de campo longos quebram em qualquer ponto. */
.dc-error__message {
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

.dc-error__code {
    font-size: 0.72rem;
    opacity: 0.8;
}

/* Detalhe por empresa da falha parcial do portal (PortalResultDetail), dentro do alerta. */
.dc-portal-result {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dc-portal-result p {
    margin: 0;
}

.dc-portal-result__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    border-radius: var(--dc-radius-sm);
    background: color-mix(in oklch, var(--card) 70%, transparent);
    color: var(--foreground);
}

.dc-portal-result__list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
}

.dc-portal-result__list li {
    display: flex;
    align-items: baseline;
    gap: 6px;
    overflow-wrap: anywhere;
}

/* O icone alinha pela primeira linha do texto, mesmo quando a lista de empresas quebra. */
.dc-portal-result__list li > svg {
    flex: none;
    position: relative;
    top: 2px;
}

.dc-portal-result__list .is-ok > svg {
    color: var(--dc-success);
}

.dc-portal-result__list .is-fail > svg {
    color: var(--destructive);
}

/* O reset do tema tira o marcador de toda lista: aqui ele volta, porque cada linha e um passo. */
.dc-portal-result__todo {
    margin: 2px 0;
    padding-left: 1.2em;
    list-style: disc;
}

.dc-portal-result__more {
    font-size: 0.78rem;
    opacity: 0.85;
}

.dc-error__code code {
    font-family: var(--dc-mono);
}

/* =========================================================================
   Modo painel dos modulos de integracao
   ========================================================================= */

.dc-panel__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: var(--dc-gap);
    align-items: start;
    margin-bottom: var(--dc-gap);
}

.dc-panel__grid > .dc-card + .dc-card {
    margin-top: 0;
}

.dc-panel__stamp {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted-foreground);
}

.dc-panel__footnote {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 16px 0 0;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--muted-foreground);
}

.dc-panel__footnote svg {
    flex: none;
    margin-top: 1px;
}

/* --- Fluxo da mensageria ------------------------------------------------ */

.dc-pipeline {
    display: flex;
    align-items: stretch;
    gap: 4px;
}

.dc-stage {
    flex: 1;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--dc-border-soft);
    border-radius: var(--dc-radius-sm);
    background: var(--dc-hover);
}

.dc-stage__icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: var(--dc-tint);
    color: var(--primary);
}

/* Altura fixa: "Publicado no Service Bus" ocupa duas linhas e sem isto os numeros das quatro
   etapas ficariam em alturas diferentes. */
.dc-stage__title {
    margin: 0;
    min-height: 2.2em;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-foreground);
}

.dc-stage__value {
    margin: 3px 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.dc-stage__hint {
    margin: 3px 0 0;
    min-height: 2.7em;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--muted-foreground);
}

.dc-stage__arrow {
    display: flex;
    align-items: center;
    color: var(--muted-foreground);
    opacity: 0.5;
}

/* --- Indicadores ------------------------------------------------------- */

.dc-metrics {
    display: flex;
    flex-direction: column;
}

.dc-metric {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--dc-border-soft);
    font-size: 0.85rem;
}

.dc-metric:last-child {
    border-bottom: none;
}

.dc-metric > span {
    color: var(--muted-foreground);
}

.dc-metric > strong {
    font-variant-numeric: tabular-nums;
}

.dc-metric > strong.is-danger {
    color: var(--destructive);
}

/* --- Abas do painel ----------------------------------------------------- */

/* O BbTabs separa lista e conteudo com 8px; o painel usa o mesmo respiro das faixas. */
.dc-panel-tabs {
    gap: var(--dc-gap);
}

/* max-width + overflow: com tres abas a lista passa da largura de um celular, e sem isto a pagina
   inteira ganharia rolagem horizontal. */
.dc-panel-tabs__list {
    align-self: flex-start;
    max-width: 100%;
    overflow-x: auto;
}

.dc-panel-tab {
    gap: 6px;
    padding-inline: 12px;
}

/* --- Dashboard ---------------------------------------------------------- */

.dc-dashboard__toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: var(--dc-gap);
}

.dc-dashboard__scope {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.dc-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--dc-gap);
    align-items: start;
}

.dc-chart-grid > .dc-card + .dc-card {
    margin-top: 0;
}

.dc-chart-card--wide {
    grid-column: 1 / -1;
}

.dc-donut {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* A rosca pinta as fatias com --chart-1..3 em ordem (sucesso, falha, em andamento). Redefinir a
   paleta so aqui da a cada fatia a cor do seu status sem mexer nos outros graficos. */
.dc-donut__chart {
    flex: 1 1 0;
    min-width: 0;
    --chart-1: var(--dc-chart-success);
    --chart-2: var(--dc-chart-failure);
    --chart-3: var(--dc-chart-received);
}

.dc-donut__legend {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 190px;
}

.dc-donut__item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.dc-donut__item strong {
    font-variant-numeric: tabular-nums;
}

.dc-donut__item small {
    min-width: 3.5em;
    text-align: right;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted-foreground);
}

.dc-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--muted-foreground);
}

.dc-dot--success {
    background: var(--dc-chart-success);
}

.dc-dot--danger {
    background: var(--dc-chart-failure);
}

.dc-dot--info {
    background: var(--dc-chart-received);
}

/* --- Disponibilidade ---------------------------------------------------- */

.dc-availability {
    display: flex;
    flex-direction: column;
    gap: var(--dc-gap);
}

.dc-availability > .dc-card + .dc-card,
.dc-availability__grid > .dc-card + .dc-card {
    margin-top: 0;
}

.dc-availability__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--dc-gap);
    align-items: start;
}

/* Motivo do estado: a primeira linha do cartao, no tom do estado. */
.dc-service__reason {
    --dc-reason-color: var(--muted-foreground);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: var(--dc-radius-sm);
    background: color-mix(in oklch, var(--dc-reason-color) 10%, transparent);
    font-size: 0.85rem;
    line-height: 1.45;
}

.dc-service__reason svg {
    flex: none;
    margin-top: 1px;
    color: var(--dc-reason-color);
}

.dc-service__reason--warn {
    --dc-reason-color: var(--dc-warning);
}

.dc-service__reason--danger {
    --dc-reason-color: var(--destructive);
}

.dc-service__reason--ok {
    --dc-reason-color: var(--dc-success);
}

/* Numeros-chave em linha: rotulo pequeno em cima, valor forte embaixo. */
.dc-kpis,
.dc-calls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.dc-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--dc-border-soft);
    border-radius: var(--dc-radius-sm);
}

.dc-kpi > span {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-foreground);
}

.dc-kpi > strong {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.dc-kpi--success > strong {
    color: var(--dc-success);
}

.dc-kpi--danger > strong {
    color: var(--destructive);
}

.dc-service__history {
    margin-top: 20px;
}

.dc-service__history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.dc-service__caption {
    margin: 8px 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--muted-foreground);
}

.dc-service__history-head .dc-service__caption {
    margin: 0;
}

.dc-service__split {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: var(--dc-gap);
    margin-top: 24px;
}

.dc-service__block + .dc-service__block,
.dc-service__split + .dc-service__block {
    margin-top: 24px;
}

.dc-service__split > .dc-service__block + .dc-service__block {
    margin-top: 0;
}

.dc-block-title {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-foreground);
}

.dc-block-title--spaced {
    margin-top: 20px;
}

.dc-service__quiet {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

/* --- Faixa de disponibilidade (estilo pagina de status) ----------------- */

.dc-uptime__bar {
    display: flex;
    gap: 3px;
    height: 34px;
}

/* O gatilho do tooltip e o proprio segmento. O BbTooltipTrigger poe a classe num span com
   display: contents (sem caixa) e o elemento focavel dentro dele: aqui o span externo vira a caixa
   e o interno a preenche. Minimo de 4px: 30 segmentos cabem em 390px. */
.dc-uptime__seg {
    display: block;
    flex: 1 1 0;
    min-width: 4px;
    height: 100%;
    border-radius: 3px;
    background: var(--muted);
    cursor: default;
}

.dc-uptime__seg > span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.dc-uptime__seg:hover,
.dc-uptime__seg > span:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 1px;
}

.dc-uptime__seg--up {
    background: var(--dc-chart-success);
}

.dc-uptime__seg--degraded {
    background: repeating-linear-gradient(
        135deg,
        var(--dc-chart-warning) 0 3px,
        color-mix(in oklch, var(--dc-chart-warning) 45%, var(--card)) 3px 6px);
}

.dc-uptime__seg--down {
    background: var(--dc-chart-failure);
}

.dc-uptime__seg--none {
    background: var(--muted);
}

.dc-uptime__axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--muted-foreground);
}

.dc-uptime__tip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.78rem;
}

.dc-uptime__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.dc-uptime__legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dc-uptime__swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* --- Incidentes, origens, consumidores ---------------------------------- */

.dc-incidents,
.dc-origins,
.dc-consumers {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dc-incident,
.dc-origin,
.dc-consumer {
    padding: 10px 0;
    border-bottom: 1px solid var(--dc-border-soft);
}

.dc-incident:first-child,
.dc-origin:first-child,
.dc-consumer:first-child {
    padding-top: 0;
}

.dc-incident:last-child,
.dc-origin:last-child,
.dc-consumer:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.dc-incident {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.dc-incident__text,
.dc-consumer__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 0.82rem;
}

.dc-incident__text > span,
.dc-consumer__text > span {
    color: var(--muted-foreground);
    overflow-wrap: anywhere;
}

.dc-origin__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.dc-origin__name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    min-width: 0;
}

.dc-origin__name strong {
    font-size: 0.9rem;
    font-weight: 650;
}

.dc-origin__name code,
.dc-consumer__text code {
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--muted);
    font-family: var(--dc-mono);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

.dc-origin__line {
    margin: 6px 0 0;
    font-size: 0.85rem;
}

.dc-origin__meta {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.dc-consumer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.dc-consumer__icon {
    flex: none;
    margin-top: 2px;
}

.dc-consumer__icon--ok {
    color: var(--dc-success);
}

.dc-consumer__icon--danger {
    color: var(--destructive);
}

.dc-consumer__text code {
    align-self: flex-start;
}

.dc-consumer__text > .dc-consumer__error {
    color: var(--destructive);
}

/* --- Faixa de status no Painel geral ------------------------------------ */

.dc-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin-bottom: var(--dc-gap);
    padding: 12px 16px;
    border: 1px solid var(--dc-border-soft);
    border-radius: var(--dc-radius);
    background: var(--card);
}

.dc-strip__item {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    font-size: 0.85rem;
}

.dc-strip__icon {
    color: var(--muted-foreground);
}

.dc-strip__name {
    font-weight: 600;
}

.dc-strip__hint {
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.dc-strip__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.dc-strip__link:hover {
    text-decoration: underline;
}

/* --- Visualizador de JSON ---------------------------------------------- */

.dc-json {
    border: 1px solid var(--dc-border);
    border-radius: var(--dc-radius-sm);
    overflow: hidden;
    background: var(--card);
}

.dc-json + .dc-json {
    margin-top: 12px;
}

.dc-json__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 6px 12px;
    border-bottom: 1px solid var(--dc-border-soft);
    background: var(--muted);
}

.dc-json__label {
    font-size: 0.75rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-foreground);
}

.dc-json__meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dc-json__size {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted-foreground);
}

.dc-json__body {
    margin: 0;
    padding: 14px;
    max-height: 380px;
    overflow: auto;
    font-family: var(--dc-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    tab-size: 2;
    white-space: pre;
    color: var(--foreground);
}

.dc-json__empty,
.dc-json__note {
    margin: 0;
    padding: 12px 14px;
    font-size: 0.78rem;
    color: var(--muted-foreground);
}

.dc-json__note {
    border-top: 1px solid var(--dc-border-soft);
}

/* Realce de sintaxe amarrado aos tokens, e nao a cores fixas: o themes.css troca os tokens no
   modo escuro, e o realce acompanha o tema que a pessoa escolheu (nao o do sistema). */
.dc-json__key {
    color: var(--primary);
    font-weight: 600;
}

.dc-json__string {
    color: var(--dc-success);
}

.dc-json__number {
    color: var(--dc-warning);
}

.dc-json__keyword {
    color: var(--destructive);
    font-weight: 600;
}

.dc-json__punct {
    color: var(--muted-foreground);
}

/* --- Inspetor de mensagem --------------------------------------------- */

.dc-inspector__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0 28px;
}

.dc-inspector__tabs [role="tab"] {
    gap: 6px;
}

.dc-inspector__tabs [role="tabpanel"] {
    padding-top: 12px;
}

.dc-envelopes {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dc-envelope {
    padding: 12px;
    border: 1px solid var(--dc-border-soft);
    border-radius: var(--dc-radius-sm);
}

.dc-envelope__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.dc-envelope__type {
    font-size: 0.85rem;
    font-weight: 650;
}

.dc-envelope__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    font-size: 0.74rem;
    color: var(--muted-foreground);
}

.dc-envelope__meta code {
    font-family: var(--dc-mono);
}

.dc-envelope__error {
    margin: 0 0 10px;
    font-size: 0.76rem;
    color: var(--destructive);
}

/* --- Meu perfil --------------------------------------------------------- */

/* Formulario a esquerda, resumo da conta a direita; em tela estreita um embaixo do outro. */
.dc-profile {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--dc-gap);
    align-items: start;
}

.dc-profile .dc-card + .dc-card {
    margin-top: 0;
}

.dc-profile__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dc-profile__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.dc-profile__identity {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.dc-profile__identity > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.dc-profile__identity small {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    word-break: break-all;
}

/* =========================================================================
   Modo monitor (tela cheia)
   ========================================================================= */

/* Uma tela so, sem rolagem, para TV na parede (3-5 m) e para o monitor do operador. Regras:

   - A unidade e --mu: 1% da altura, limitado pela largura numa tela mais estreita que 16:9. Tudo
     escala com ela -- 1366x768, 1080p e 4K tem o mesmo desenho, so maior ou menor. A fonte base
     fica em ~19px em 1080p e ~39px em 4K; o resto e em em.
   - Nenhum filho de grid ou flex tem altura minima implicita (min-height: 0 / minmax(0, ...)): e o
     que costuma empurrar a tela para fora da janela.
   - O que e so contexto leva data-tier="3" e some em tela baixa (max-height: 800px).
   - Os blocos de numero sao containers de tamanho: o numero cresce ate o que o bloco comporta.
   - Cor so para problema (ver os tokens --dc-state-* no :root). O estado de um bloco vem em
     data-state="warn|crit|off"; o normal nao tem atributo. */

html:has(.dc-monitor-layout),
html:has(.dc-monitor-layout) body {
    height: 100%;
    overflow: hidden;
}

.dc-monitor {
    --mu: min(1dvh, 0.5625dvw);
    --dc-mon-gap: calc(var(--mu) * 1.2);
    --dc-mon-pad: calc(var(--mu) * 1.4);
    --dc-mon-radius: calc(var(--mu) * 0.9);
    --dc-mon-line-w: max(1px, calc(var(--mu) * 0.1));
    --dc-mon-edge: calc(var(--mu) * 0.4);

    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--dc-mon-bg);
    color: var(--foreground);
    font-size: clamp(12px, calc(var(--mu) * 1.8), 72px);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}

/* O padding carrega 2px a mais: e o espaco do deslocamento contra burn-in, que nao pode cortar a borda. */
.dc-monitor__canvas {
    height: 100%;
    padding: calc(var(--mu) * 1.6 + 2px);
    transform: translate(var(--dc-shift-x, 0), var(--dc-shift-y, 0));
}

.dc-monitor[data-idle="true"] {
    cursor: none;
}

/* O LucideIcon desenha em px (Size); no monitor o icone acompanha o texto. */
.dc-monitor .dc-mon-ico {
    width: 1.1em;
    height: 1.1em;
    flex: none;
}

.dc-monitor code {
    font-family: var(--dc-mono);
    font-size: 0.88em;
    padding: 0.05em 0.35em;
    border-radius: 0.25em;
    background: var(--muted);
    white-space: nowrap;
}

/* Motivo de falha traduzido (ErrorCatalog): o mesmo chip do codigo, mas na fonte do texto -- e
   para ler, nao para copiar. O codigo cru vai no title. Prefixado com .dc-monitor para vencer o
   ".dc-mon-lane__facts dd span" (cinza e menor), que e o lugar dele no "Ultima falha". */
.dc-monitor .dc-mon-reason {
    font-size: 0.88em;
    font-weight: 600;
    color: inherit;
    padding: 0.05em 0.35em;
    border-radius: 0.25em;
    background: var(--muted);
    white-space: nowrap;
}

.dc-mon-board {
    display: flex;
    flex-direction: column;
    gap: var(--dc-mon-gap);
    height: 100%;
    min-height: 0;
}

.dc-mon-board > main {
    flex: 1 1 0;
    min-height: 0;
}

.dc-mon-loading {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    color: var(--muted-foreground);
    font-size: 1.3em;
}

/* Dado velho: sem coleta ha tres intervalos, nada pode continuar parecendo normal. O monitor.js
   marca a raiz; as etiquetas trocam para "Sem dados" (MonitorStatePill) e o conteudo acinzenta. */
.dc-monitor[data-stale] .dc-mon-board > main {
    filter: grayscale(1);
    opacity: 0.55;
}

.dc-monitor[data-stale] [data-dc-live],
.dc-monitor:not([data-stale]) [data-dc-stale-only] {
    display: none;
}

.dc-monitor[data-stale] .dc-mon-head__age {
    color: var(--dc-state-warn-fg);
    font-weight: 700;
}

/* O motivo e a faixa sao da ultima coleta que deu certo: com o dado velho, perdem a cor (e o motivo
   de atencao some) para ninguem ler como situacao de agora. */
.dc-monitor[data-stale] .dc-mon-head__headline {
    display: none;
}

.dc-monitor[data-stale] .dc-mon-banner {
    filter: grayscale(1);
    opacity: 0.55;
}

/* Destaque de mudanca de estado: um pulso so, e nada de animacao continua. */
.dc-monitor [data-flash] {
    animation: dc-mon-flash 1.6s ease-out 1;
}

@keyframes dc-mon-flash {
    0% {
        outline: calc(var(--mu) * 0.5) solid var(--ring);
        outline-offset: 0;
    }

    100% {
        outline: calc(var(--mu) * 0.5) solid transparent;
        outline-offset: calc(var(--mu) * 0.8);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dc-monitor [data-flash] {
        animation: none;
        outline: calc(var(--mu) * 0.4) solid var(--ring);
    }
}

/* --- Cabecalho ------------------------------------------------------------ */

.dc-mon-head {
    display: flex;
    align-items: center;
    gap: calc(var(--mu) * 2);
    min-width: 0;
}

.dc-mon-head__title {
    display: flex;
    align-items: center;
    gap: 0.6em;
    flex: 0 0 auto;
    max-width: 45%;
    min-width: 0;
}

.dc-mon-head__mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.9em;
    height: 1.9em;
    border-radius: 0.45em;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 1.1em;
    font-weight: 800;
}

.dc-mon-head__text {
    min-width: 0;
}

.dc-mon-head__text h1 {
    font-size: 1.75em;
    font-weight: 750;
    line-height: 1.1;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-head__text p {
    font-size: 0.8em;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-head__state {
    display: flex;
    align-items: center;
    gap: 0.7em;
    flex: 0 1 auto;
    min-width: 0;
    border-radius: 999px;
}

.dc-mon-head__headline {
    font-size: 1.1em;
    font-weight: 650;
    color: var(--dc-state-warn-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.dc-mon-head__meta {
    display: flex;
    align-items: center;
    gap: 0.9em;
    margin-left: auto;
    flex: none;
    white-space: nowrap;
}

.dc-mon-head__age {
    font-size: 0.85em;
    color: var(--muted-foreground);
}

.dc-mon-head__clock {
    font-size: 1.75em;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.dc-mon-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.2em 0.6em;
    border-radius: 999px;
    border: var(--dc-mon-line-w) solid var(--dc-mon-line);
    background: var(--dc-mon-surface);
    font-size: 0.85em;
    font-weight: 650;
}

.dc-mon-chip--live {
    font-weight: 650;
}

.dc-mon-chip--paused {
    border-color: var(--dc-state-warn-line);
    background: var(--dc-state-warn-bg);
    color: var(--dc-state-warn-fg);
    text-transform: uppercase;
}

.dc-mon-chip--error {
    color: var(--dc-state-warn-fg);
}

/* --- Etiqueta de estado ------------------------------------------------- */

.dc-mon-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    flex: none;
    padding: 0.25em 0.7em;
    border-radius: 999px;
    border: var(--dc-mon-line-w) solid transparent;
    font-weight: 750;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.dc-mon-pill--lg {
    font-size: 1.3em;
}

.dc-mon-pill--md {
    font-size: 0.85em;
}

.dc-mon-pill--ok {
    background: var(--dc-mon-surface);
    border-color: var(--dc-mon-line);
    color: var(--foreground);
}

.dc-mon-pill--ok .dc-mon-ico {
    color: var(--dc-state-ok);
}

.dc-mon-pill--warn {
    background: var(--dc-state-warn-bg);
    border-color: var(--dc-state-warn-line);
    color: var(--dc-state-warn-fg);
}

.dc-mon-pill--crit {
    background: var(--dc-state-crit-solid);
    color: var(--dc-state-crit-solid-fg);
}

.dc-mon-pill--off {
    background: var(--muted);
    color: var(--muted-foreground);
}

/* --- Faixa de alarme ------------------------------------------------------ */

.dc-mon-banner {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.45em 0.9em;
    border-radius: var(--dc-mon-radius);
    background: var(--dc-state-crit-solid);
    color: var(--dc-state-crit-solid-fg);
    font-size: 1.45em;
    min-width: 0;
}

.dc-mon-banner__label {
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dc-mon-banner__text {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-banner__more {
    font-size: 0.7em;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.9;
}

/* --- Blocos --------------------------------------------------------------- */

/* A borda esquerda mais grossa e a faixa de estado do bloco: neutra no normal, ambar ou vermelha
   quando algum motivo de saude fala dele. */
.dc-mon-card,
.dc-mon-kpi,
.dc-mon-lane {
    --dc-mon-here: var(--dc-mon-surface);

    min-width: 0;
    min-height: 0;
    background: var(--dc-mon-surface);
    border: var(--dc-mon-line-w) solid var(--dc-mon-line);
    border-left-width: var(--dc-mon-edge);
    border-radius: var(--dc-mon-radius);
    overflow: hidden;
}

.dc-mon-card[data-state="warn"],
.dc-mon-kpi[data-state="warn"],
.dc-mon-lane[data-state="warn"] {
    --dc-mon-here: var(--dc-state-warn-bg);

    background: var(--dc-state-warn-bg);
    border-color: var(--dc-state-warn-line);
}

.dc-mon-card[data-state="crit"],
.dc-mon-kpi[data-state="crit"],
.dc-mon-lane[data-state="crit"] {
    --dc-mon-here: var(--dc-state-crit-bg);

    background: var(--dc-state-crit-bg);
    border-color: var(--dc-state-crit-line);
}

.dc-mon-card {
    display: flex;
    flex-direction: column;
    gap: calc(var(--mu) * 1);
    padding: var(--dc-mon-pad);
}

.dc-mon-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    min-width: 0;
}

.dc-mon-card__head h2 {
    display: flex;
    align-items: center;
    gap: 0.45em;
    min-width: 0;
    font-size: 1.15em;
    font-weight: 700;
}

.dc-mon-card__head h2 span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-card__head h2 .dc-mon-ico {
    color: var(--muted-foreground);
}

.dc-mon-card__hint {
    font-size: 0.8em;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.dc-mon-empty {
    display: flex;
    align-items: center;
    gap: 0.45em;
    margin: auto 0;
    color: var(--muted-foreground);
}

.dc-mon-note {
    display: flex;
    align-items: flex-start;
    gap: 0.45em;
    min-width: 0;
    font-size: 0.9em;
    color: var(--muted-foreground);
}

.dc-mon-note span {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.dc-mon-note--warn {
    color: var(--dc-state-warn-fg);
}

.dc-mon-note--crit {
    color: var(--dc-state-crit-fg);
    font-weight: 600;
}

.dc-mon-note--neutral .dc-mon-ico {
    color: var(--dc-state-ok);
}

/* --- Numero grande -------------------------------------------------------- */

.dc-mon-kpi {
    container-type: size;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.12em;
    padding: calc(var(--mu) * 1) calc(var(--mu) * 1.3);
}

.dc-mon-kpi__label {
    font-size: min(1.2em, 9cqi);
    font-weight: 650;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-kpi__value {
    font-size: min(3.8em, 31cqi, 44cqb);
    font-weight: 750;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.dc-mon-kpi--hero .dc-mon-kpi__value {
    font-size: min(4.4em, 25cqi, 44cqb);
}

.dc-mon-kpi__value small {
    margin-left: 0.12em;
    font-size: 0.42em;
    font-weight: 650;
    letter-spacing: 0;
    color: var(--muted-foreground);
}

.dc-mon-kpi__delta,
.dc-mon-kpi__sub {
    font-size: clamp(11px, 7.5cqi, 0.95em);
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-kpi__delta {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}

/* Variacao para pior em ambar, e nao vermelho: queda de volume e sinal, nao incidente. */
.dc-mon-kpi__delta.is-worse {
    color: var(--dc-state-warn-fg);
    font-weight: 650;
}

.dc-mon-kpi[data-state="warn"] .dc-mon-kpi__label {
    color: var(--dc-state-warn-fg);
}

.dc-mon-kpi[data-state="crit"] .dc-mon-kpi__label,
.dc-mon-kpi[data-state="crit"] .dc-mon-kpi__value {
    color: var(--dc-state-crit-fg);
}

/* --- Volume (colunas e linha) --------------------------------------------- */

/* --dc-mon-here e o fundo do bloco em que o grafico esta (neutro, ambar ou vermelho): o anel dos
   pontos e o selo de "nenhuma mensagem" usam ele para recortar a grade sem pintar um quadrado. */
.dc-mon-bars {
    --dc-mon-bars-ring: max(2px, calc(var(--mu) * 0.2));

    display: flex;
    flex-direction: column;
    gap: 0.35em;
    flex: 1 1 0;
    min-height: 0;
    margin: 0;
}

/* Escala a esquerda, plot a direita, horas embaixo. O respiro no topo e a metade do rotulo do teto,
   que fica centrado na linha dele. */
.dc-mon-bars__body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: 0.5em;
    row-gap: 0.4em;
    flex: 1 1 0;
    min-height: 0;
    padding-top: 0.45em;
}

.dc-mon-bars__yaxis {
    position: relative;
    font-size: 0.72em;
    color: var(--muted-foreground);
    text-align: right;
}

.dc-mon-bars__ysizer {
    display: block;
    height: 0;
    overflow: hidden;
    visibility: hidden;
}

.dc-mon-bars__ytick {
    position: absolute;
    right: 0;
    line-height: 1;
    transform: translateY(50%);
    white-space: nowrap;
}

.dc-mon-bars__plot {
    position: relative;
    min-width: 0;
    min-height: 0;
}

/* Grade em HTML, e nao no SVG esticado: fica sempre com a espessura de uma linha da tela. */
.dc-mon-bars__rule {
    position: absolute;
    left: 0;
    right: 0;
    height: var(--dc-mon-line-w);
    background: var(--dc-mon-line);
    transform: translateY(50%);
}

.dc-mon-bars__rule--base {
    background: color-mix(in oklab, var(--muted-foreground) 55%, transparent);
}

.dc-mon-bars__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.dc-mon-bars__area-top {
    stop-color: var(--dc-mon-bar-recv);
    stop-opacity: 0.2;
}

.dc-mon-bars__area-bottom {
    stop-color: var(--dc-mon-bar-recv);
    stop-opacity: 0.02;
}

.dc-mon-bars__line {
    fill: none;
    stroke: var(--dc-mon-bar-recv);
    stroke-width: max(2px, calc(var(--mu) * 0.25));
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dc-mon-bars__line.is-pending {
    stroke-dasharray: calc(var(--mu) * 0.5) calc(var(--mu) * 0.55);
    stroke-linecap: butt;
}

.dc-mon-bars__cols {
    position: absolute;
    inset: 0;
    display: grid;
}

/* A fatia inteira do intervalo e o alvo do mouse (title com os numeros), nao so a coluna. */
.dc-mon-bars__slot {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-width: 0;
    height: 100%;
}

/* Canto arredondado so no topo, quadrado na base; o respiro entre falha e sucesso e o fundo. */
.dc-mon-bars__stack {
    display: flex;
    flex-direction: column;
    gap: max(2px, calc(var(--mu) * 0.2));
    width: min(68%, calc(var(--mu) * 2.8));
    min-height: max(3px, calc(var(--mu) * 0.3));
    border-radius: calc(var(--mu) * 0.45) calc(var(--mu) * 0.45) 0 0;
    overflow: hidden;
}

.dc-mon-bars__ok,
.dc-mon-bars__fail {
    flex: 1 1 0;
    min-height: max(2px, calc(var(--mu) * 0.25));
}

.dc-mon-bars__ok {
    background: var(--dc-mon-bar-ok);
}

.dc-mon-bars__fail {
    background: var(--dc-mon-bar-fail);
}

.dc-mon-bars__dot {
    position: absolute;
    width: max(8px, calc(var(--mu) * 0.85));
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--dc-mon-bar-recv);
    box-shadow: 0 0 0 var(--dc-mon-bars-ring) var(--dc-mon-here, var(--dc-mon-surface));
    transform: translate(-50%, 50%);
    pointer-events: none;
}

.dc-mon-bars .is-partial {
    opacity: 0.55;
}

.dc-mon-bars__empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.dc-mon-bars__empty > span {
    padding: 0.15em 0.7em;
    border-radius: 999px;
    background: var(--dc-mon-here, var(--dc-mon-surface));
    color: var(--muted-foreground);
}

.dc-mon-bars__axis {
    grid-column: 2;
    position: relative;
    height: 1.25em;
    font-size: 0.78em;
    color: var(--muted-foreground);
}

.dc-mon-bars__xtick {
    position: absolute;
    top: 0;
    white-space: nowrap;
    transform: translateX(-50%);
}

.dc-mon-bars__xtick.is-last {
    right: 0;
    transform: none;
}

/* --- Volume ao vivo (live-chart.js) --------------------------------------- */

/* A trilha e o que rola (translateX no compositor); o recorte a esconde fora do plot. O recorte
   sobra meio --mu em cima e embaixo, para o traco no teto e no zero nao sair cortado. */
.dc-mon-live__clip {
    position: absolute;
    inset: calc(var(--mu) * -0.5) 0;
    overflow: hidden;
    pointer-events: none;
}

.dc-mon-live__clip > .dc-mon-live__track {
    position: absolute;
    top: calc(var(--mu) * 0.5);
    left: 0;
    width: 100%;
    height: calc(100% - var(--mu));
    will-change: transform;
}

.dc-mon-live__svg {
    position: absolute;
    top: 0;
    left: 0;
    overflow: visible;
}

.dc-mon-live__line {
    fill: none;
    stroke-width: max(2px, calc(var(--mu) * 0.25));
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dc-mon-live__line--ok {
    stroke: var(--dc-mon-live-ok);
}

.dc-mon-live__line--fail {
    stroke: var(--dc-mon-live-fail);
}

.dc-mon-live__stop--ok-top {
    stop-color: var(--dc-mon-live-ok);
    stop-opacity: 0.22;
}

.dc-mon-live__stop--ok-bottom {
    stop-color: var(--dc-mon-live-ok);
    stop-opacity: 0.02;
}

.dc-mon-live__stop--fail-top {
    stop-color: var(--dc-mon-live-fail);
    stop-opacity: 0.28;
}

.dc-mon-live__stop--fail-bottom {
    stop-color: var(--dc-mon-live-fail);
    stop-opacity: 0.02;
}

/* As horas passam por baixo do "agora", que fica parado na direita: somem antes de chegar nele. */
.dc-mon-live__ticks {
    position: absolute;
    inset: 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 2.5em, #000 calc(100% - 6.5em), transparent calc(100% - 4.5em));
    mask-image: linear-gradient(to right, transparent 0, #000 2.5em, #000 calc(100% - 6.5em), transparent calc(100% - 4.5em));
}

.dc-mon-live__ticks > .dc-mon-live__track {
    position: absolute;
    inset: 0;
    will-change: transform;
}

.dc-mon-live__tick {
    position: absolute;
    top: 0;
    white-space: nowrap;
    transform: translateX(-50%);
}

.dc-mon-live__now {
    position: absolute;
    top: 0;
    right: 0;
}

/* Selo e "atrasado" sao ligados pelo JS (data-empty / data-stale na raiz), nao pelo Blazor. */
.dc-mon-live__empty {
    display: none;
}

.dc-mon-live[data-empty="true"] .dc-mon-live__empty {
    display: grid;
}

.dc-mon-live__stale {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    align-items: center;
    padding: 0.1em 0.6em;
    border-radius: 999px;
    background: var(--dc-state-warn-bg);
    color: var(--dc-state-warn-fg);
    font-size: 0.75em;
    font-weight: 650;
}

.dc-mon-live[data-stale="true"] .dc-mon-live__stale {
    display: inline-flex;
}

/* Dado velho nunca continua colorido: a linha acinzenta ate a coleta voltar. */
.dc-mon-live[data-stale="true"] .dc-mon-live__clip {
    filter: grayscale(1);
    opacity: 0.45;
}

.dc-mon-live-dot {
    display: inline-block;
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    background: var(--dc-mon-live-ok);
    animation: dc-mon-live-pulse 2s ease-in-out infinite;
}

@keyframes dc-mon-live-pulse {
    50% {
        opacity: 0.35;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dc-mon-live-dot {
        animation: none;
    }
}

.dc-mon-legend {
    display: flex;
    align-items: center;
    gap: 0.9em;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8em;
    color: var(--muted-foreground);
}

.dc-mon-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
}

.dc-mon-legend__swatch {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    border-radius: 0.2em;
}

.dc-mon-legend__swatch--ok {
    background: var(--dc-mon-bar-ok);
}

.dc-mon-legend__swatch--fail {
    background: var(--dc-mon-bar-fail);
}

.dc-mon-legend__swatch--live-ok,
.dc-mon-legend__swatch--live-fail {
    width: 1.3em;
    height: 0.2em;
    border-radius: 999px;
}

.dc-mon-legend__swatch--live-ok {
    background: var(--dc-mon-live-ok);
}

.dc-mon-legend__swatch--live-fail {
    background: var(--dc-mon-live-fail);
}

.dc-mon-legend__swatch--recv {
    position: relative;
    width: 1.3em;
    height: 0.2em;
    border-radius: 999px;
    background: var(--dc-mon-bar-recv);
}

.dc-mon-legend__swatch--recv::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    background: var(--dc-mon-bar-recv);
    transform: translate(-50%, -50%);
}

/* --- Destino e hub ------------------------------------------------------- */

.dc-mon-dest__figures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--dc-mon-gap);
}

.dc-mon-figure {
    min-width: 0;
}

.dc-mon-figure__label {
    display: block;
    font-size: 0.85em;
    font-weight: 650;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.dc-mon-figure__value {
    display: block;
    font-size: 1.9em;
    font-weight: 750;
    line-height: 1.05;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.dc-mon-figure__value small {
    margin-left: 0.12em;
    font-size: 0.45em;
    font-weight: 650;
    letter-spacing: 0;
    color: var(--muted-foreground);
}

/* No cartao do destino a frase de baixo e uma linha so: o espaco e dos numeros e da faixa. */
.dc-mon-dest .dc-mon-note span {
    -webkit-line-clamp: 1;
}

.dc-monitor .dc-uptime__bar {
    height: 1.6em;
    gap: max(2px, calc(var(--mu) * 0.22));
}

.dc-monitor .dc-uptime__seg {
    min-width: 0;
    border-radius: 0.18em;
}

.dc-monitor .dc-uptime__seg--up {
    background: var(--dc-mon-bar-ok);
}

.dc-monitor .dc-uptime__axis {
    margin-top: 0.3em;
    font-size: 0.75em;
}

.dc-mon-hub__facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--dc-mon-gap);
    margin: 0;
}

.dc-mon-hub__facts dt {
    font-size: 0.8em;
    font-weight: 650;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.dc-mon-hub__facts dd {
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
    white-space: nowrap;
}

.dc-mon-hub__facts .is-warn dd {
    color: var(--dc-state-warn-fg);
}

/* De quem e o numero: as filas sao de todos, o outbox so dos modulos na tela. */
.dc-mon-hub__facts dd.dc-mon-hub__scope {
    margin-top: 0.1em;
    font-size: 0.72em;
    font-weight: 500;
    color: var(--muted-foreground);
    white-space: normal;
}

.dc-mon-hub__facts .is-warn dd.dc-mon-hub__scope {
    color: var(--muted-foreground);
}

/* --- Ultimos eventos ------------------------------------------------------ */

.dc-mon-feed {
    min-height: 0;
}

/* Linhas de altura fixa; as que nao cabem ganham altura 0 e somem inteiras, sem meia linha. */
.dc-mon-feed__rows {
    flex: 1 1 0;
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(auto-fill, calc(var(--mu) * 3.5));
    grid-auto-rows: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
}

.dc-mon-event {
    display: grid;
    grid-template-columns: auto 6.9em minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7em;
    min-width: 0;
    padding: 0 0.4em;
    border-bottom: var(--dc-mon-line-w) solid var(--dc-mon-line);
    font-size: 0.95em;
    overflow: hidden;
}

/* Feed com o modulo (central): o nome do modulo e curto e sempre inteiro; quem encolhe e o
   detalhe -- um motivo longo (Parceiro desconhecido) vira reticencias, e a linha leva a
   explicacao inteira e o codigo no tooltip. */
.dc-mon-feed__rows.has-module .dc-mon-event {
    grid-template-columns: auto 6.9em max-content minmax(0, 1fr);
    /* Quatro colunas na lateral estreita: o respiro menor e o que faz "Falha parcial" caber inteiro em 1080p. */
    column-gap: 0.5em;
}

.dc-mon-event.is-failed {
    background: color-mix(in oklch, var(--dc-state-crit-bg) 80%, transparent);
}

.dc-mon-event__time {
    color: var(--muted-foreground);
}

.dc-mon-event__status {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    min-width: 0;
    font-weight: 650;
    white-space: nowrap;
}

.dc-mon-event__status--ok .dc-mon-ico {
    color: var(--dc-state-ok);
}

.dc-mon-event__status--danger {
    color: var(--dc-state-crit-fg);
}

.dc-mon-event__status--off .dc-mon-ico {
    color: var(--muted-foreground);
}

.dc-mon-event__module {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-event__ref {
    min-width: 0;
    font-family: var(--dc-mono);
    font-size: 0.85em;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-event__detail {
    justify-self: end;
    grid-column: -2;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Principais erros ----------------------------------------------------- */

.dc-mon-errors {
    min-height: 0;
}

.dc-mon-lastfail {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2em 0.6em;
    padding-bottom: 0.6em;
    border-bottom: var(--dc-mon-line-w) solid var(--dc-mon-line);
}

.dc-mon-lastfail__when {
    font-weight: 700;
}

.dc-mon-lastfail__message {
    flex-basis: 100%;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 0.85em;
    color: var(--muted-foreground);
}

.dc-mon-hbars {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    min-height: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
}

.dc-mon-hbar {
    display: grid;
    grid-template-columns: minmax(0, 11em) minmax(0, 1fr) 2.5em;
    align-items: center;
    gap: 0.6em;
}

.dc-mon-hbar__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-hbar__track {
    height: 0.8em;
    border-radius: 0.2em;
    background: var(--muted);
    overflow: hidden;
}

.dc-mon-hbar__fill {
    display: block;
    width: var(--dc-w, 0%);
    height: 100%;
    background: var(--dc-mon-bar-fail);
}

.dc-mon-hbar__count {
    text-align: right;
    font-weight: 700;
}

.dc-mon-origins {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em 0.9em;
    margin-top: auto;
    font-size: 0.85em;
    color: var(--muted-foreground);
}

.dc-mon-origins__item strong {
    color: var(--foreground);
}

/* --- Monitor de um modulo ---------------------------------------------- */

/* Numeros em cima, volume ao lado do que o modulo depende, detalhe embaixo. Em 1080p: faixa de
   ~190px, meio de ~390px e base de ~350px. */
.dc-mon-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 20fr) minmax(0, 44fr) minmax(0, 36fr);
    grid-template-areas:
        "kpis kpis"
        "volume side"
        "feed errors";
    gap: var(--dc-mon-gap);
}

.dc-mon-panel__kpis {
    grid-area: kpis;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--dc-mon-gap);
    min-height: 0;
}

.dc-mon-panel .dc-mon-volume {
    grid-area: volume;
}

.dc-mon-panel__side {
    grid-area: side;
    display: flex;
    flex-direction: column;
    gap: var(--dc-mon-gap);
    min-width: 0;
    min-height: 0;
}

.dc-mon-panel__side .dc-mon-dest {
    flex: 1 1 0;
}

.dc-mon-panel .dc-mon-feed {
    grid-area: feed;
}

.dc-mon-panel .dc-mon-errors {
    grid-area: errors;
}

/* --- Central ------------------------------------------------------------ */

/* Uma coluna por modulo e a coluna do que todos dependem, um pouco mais larga. */
/* A coluna da direita tem sempre a largura que tem com tres modulos (1,15 de 4,15 partes, sem os
   tres vaos): com menos modulos, quem cresce sao as colunas deles, e nao o destino e o feed. */
.dc-mon-central {
    display: grid;
    grid-template-columns:
        repeat(var(--dc-lanes, 3), minmax(0, 1fr))
        calc((100% - 3 * var(--dc-mon-gap)) * 1.15 / 4.15);
    gap: var(--dc-mon-gap);
}

.dc-mon-central__side {
    display: flex;
    flex-direction: column;
    gap: var(--dc-mon-gap);
    min-width: 0;
    min-height: 0;
}

.dc-mon-central__side .dc-mon-feed {
    flex: 1 1 0;
}

/* Um modulo so, com a largura das tres colunas: os quatro numeros numa linha, o grafico com a
   altura que sobra e os fatos de baixo lado a lado. So na tela cheia -- empilhado (tela estreita
   ou baixa demais) continua o desenho de coluna. */
@media (min-width: 1101px) and (min-height: 561px) {
    .dc-mon-central[data-lanes="1"] .dc-mon-lane {
        grid-template-rows: auto auto minmax(0, 4fr) minmax(0, 11fr) auto;
    }

    .dc-mon-central[data-lanes="1"] .dc-mon-lane__kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-rows: minmax(0, 1fr);
    }

    .dc-mon-central[data-lanes="1"] .dc-mon-lane__facts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: calc(var(--mu) * 1.5);
    }

    /* Visao de parceiro: quatro fatos (os itens a mais) em duas linhas, e nao quatro colunas
       espremidas a ponto de cortar o texto. */
    .dc-mon-central[data-lanes="1"] .dc-mon-lane__facts:has(> :nth-child(4)) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.dc-mon-lane {
    display: grid;
    grid-template-rows: auto auto minmax(0, 9fr) minmax(0, 10fr) auto;
    gap: calc(var(--mu) * 1);
    padding: var(--dc-mon-pad);
}

.dc-mon-lane__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    min-width: 0;
}

.dc-mon-lane__name {
    display: flex;
    align-items: center;
    gap: 0.45em;
    min-width: 0;
    font-size: 1.45em;
    font-weight: 750;
    color: inherit;
    text-decoration: none;
}

.dc-mon-lane__name span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-lane__name .dc-mon-ico {
    color: var(--muted-foreground);
}

.dc-mon-lane__reason {
    min-width: 0;
    font-size: 0.95em;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-mon-lane[data-state="warn"] .dc-mon-lane__reason.is-alert {
    color: var(--dc-state-warn-fg);
    font-weight: 650;
}

.dc-mon-lane[data-state="crit"] .dc-mon-lane__reason.is-alert {
    color: var(--dc-state-crit-fg);
    font-weight: 650;
}

.dc-mon-lane__kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: calc(var(--mu) * 0.9);
    min-height: 0;
}

/* Dentro da coluna (que ja e um bloco), os numeros ficam num tom abaixo da superficie. */
.dc-mon-lane .dc-mon-kpi {
    background: var(--dc-mon-inset);
    border-left-width: var(--dc-mon-line-w);
}

.dc-mon-lane .dc-mon-kpi[data-state] {
    border-left-width: var(--dc-mon-edge);
}

.dc-mon-lane__facts {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    margin: 0;
}

.dc-mon-lane__facts > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6em;
    min-width: 0;
    padding: 0.15em 0.4em;
    border-radius: 0.3em;
}

.dc-mon-lane__facts > div[data-state="warn"] {
    background: var(--dc-state-warn-bg);
    color: var(--dc-state-warn-fg);
}

.dc-mon-lane__facts > div[data-state="crit"] {
    background: var(--dc-state-crit-bg);
    color: var(--dc-state-crit-fg);
}

.dc-mon-lane__facts dt {
    font-size: 0.9em;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.dc-mon-lane__facts dd {
    display: flex;
    align-items: baseline;
    gap: 0.5em;
    min-width: 0;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
}

.dc-mon-lane__facts dd strong {
    font-size: 1.2em;
}

.dc-mon-lane__facts dd span {
    font-size: 0.85em;
    color: var(--muted-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Controles do cabecalho ---------------------------------------------- */

/* Em px e rem de proposito, como o painel que abrem: sao para quem esta na frente da tela com um
   mouse, nao para ler de longe. Mouse parado, apagam junto com o cursor (data-idle, do monitor.js),
   mas sem sair do lugar -- o relogio nao pula -- e voltam com o foco ou com o painel aberto. */
.dc-mon-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
    padding-left: calc(var(--mu) * 1.4);
    border-left: var(--dc-mon-line-w) solid var(--dc-mon-line);
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.dc-monitor[data-idle="true"] .dc-mon-actions:not(:focus-within):not(:has([aria-expanded="true"])) {
    opacity: 0.3;
}

.dc-mon-actions__display {
    margin-right: 4px;
}

.dc-mon-actions__icon {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
}

.dc-mon-actions__icon:hover {
    background: var(--dc-hover);
}

.dc-mon-actions__icon:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* So a tela cheia da API sai pelo botao; a do F11 nativo o navegador nao deixa sair por script. */
.dc-mon-actions__leave,
.dc-monitor[data-fs="api"] .dc-mon-actions__enter {
    display: none;
}

.dc-monitor[data-fs="api"] .dc-mon-actions__leave {
    display: inline;
}

/* Cabecalho apertado (1366, 1440): o "Configurar" vira so o icone e o title diz o resto. */
@media (max-width: 1600px) {
    .dc-mon-actions__label {
        display: none;
    }

    .dc-mon-actions__display {
        padding-inline: 0.5rem;
    }
}

/* --- Painel "O que esta tela mostra" ------------------------------------- */

/* Fica num portal, fora da raiz .dc-monitor: nada do --mu chega aqui. A lib desenha o lado
   (inset, borda, animacao); aqui so largura, espacamento e a rolagem do corpo, com o rodape fixo. */
.dc-mon-sheet {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: min(440px, 100vw);
    max-width: none;
    padding: 0;
    font-size: 14px;
}

/* Cada escolha vale na hora: o fundo escurece pouco para a tela mudando continuar a vista. O
   overlay e o irmao do painel dentro do portal da lib (id "sheet-N-overlay"). */
.blazorblueprint-portal:has(> .dc-mon-sheet) > [id$="-overlay"] {
    background-color: rgb(0 0 0 / 0.35);
}

.dc-mon-sheet__head {
    padding: 22px 56px 14px 24px;
    border-bottom: 1px solid var(--border);
}

.dc-mon-sheet__title {
    font-size: 1.05rem;
    font-weight: 650;
}

.dc-mon-sheet__desc {
    margin-top: 2px;
    font-size: 0.82rem;
    color: var(--muted-foreground);
}

.dc-mon-sheet__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 18px 24px 24px;
    overflow-y: auto;
}

.dc-mon-sheet__foot {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
    margin-top: 0;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
}

.dc-mon-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.dc-mon-field--row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dc-mon-field__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.dc-mon-field__count {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--muted);
    color: var(--foreground);
    font-size: 0.72rem;
    letter-spacing: 0;
    text-transform: none;
    font-variant-numeric: tabular-nums;
}

.dc-mon-field__hint {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--muted-foreground);
}


/* Opcao em cartao (visao, modulos): o input nativo fica a vista, e o cartao inteiro e o alvo. */
.dc-mon-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dc-mon-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dc-mon-option:hover {
    background: var(--dc-hover);
}

.dc-mon-option:has(input:checked) {
    border-color: color-mix(in oklch, var(--primary) 55%, var(--border));
    background: var(--dc-tint);
}

.dc-mon-option:has(input:focus-visible) {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Travado: o unico marcado continua com cara de escolhido (so nao desmarca); o que nao cabe apaga. */
.dc-mon-option:has(input:disabled) {
    cursor: not-allowed;
}

.dc-mon-option:has(input:disabled:not(:checked)) {
    opacity: 0.55;
}

.dc-mon-option:has(input:disabled:not(:checked)):hover {
    background: transparent;
}

.dc-mon-option input {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--primary);
    cursor: inherit;
}

.dc-mon-option__icon {
    flex: none;
    margin-top: 1px;
    color: var(--muted-foreground);
}

.dc-mon-option:has(input:checked) .dc-mon-option__icon {
    color: var(--primary);
}

.dc-mon-option__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dc-mon-option__text strong {
    font-size: 0.875rem;
    font-weight: 600;
}

.dc-mon-option__text small {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--muted-foreground);
}

/* Grupo de botoes na largura do painel, cada opcao com a mesma largura. */
.dc-mon-segment > * {
    display: flex;
    width: 100%;
}

.dc-mon-segment > * > * {
    flex: 1 1 0;
    min-width: 0;
}

/* O "ligado" padrao do toggle e um cinza quase igual ao desligado; aqui a escolha atual tem de
   saltar, como nos cartoes de cima. */
.dc-mon-segment [data-state="on"] {
    border-color: color-mix(in oklch, var(--primary) 55%, var(--border));
    background: var(--dc-tint);
    color: var(--primary);
    font-weight: 600;
}

.dc-mon-url {
    display: flex;
    gap: 8px;
}

.dc-mon-url__value {
    flex: 1 1 auto;
    min-width: 0;
    height: 2rem;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--muted);
    color: var(--foreground);
    font-family: var(--dc-mono);
    font-size: 0.75rem;
    font-weight: 400;
}

.dc-mon-url__value:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 1px;
}

/* --- Telas de bloqueio ---------------------------------------------------- */

.dc-mon-blocker {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 0.8em;
    height: 100%;
    text-align: center;
}

.dc-mon-blocker h1 {
    font-size: 2.2em;
    font-weight: 750;
}

.dc-mon-blocker p {
    max-width: 42ch;
    font-size: 1.1em;
    color: var(--muted-foreground);
}

.dc-monitor .dc-mon-blocker__icon {
    width: 3em;
    height: 3em;
    color: var(--muted-foreground);
}

/* Reconexao: no monitor o dialogo do Blazor vira um aviso pequeno embaixo, sem cobrir a tela --
   o vigia ja acinzenta o dado, e a nova tentativa e automatica (ReconnectModal.razor.js). */
html:has(.dc-monitor) #components-reconnect-modal {
    inset: auto 0 1.5rem 0;
    padding: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    pointer-events: none;
}

html:has(.dc-monitor) #components-reconnect-modal .bb-reconnect-dialog {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: auto;
    max-width: 34rem;
    padding: 0.6rem 1rem;
    text-align: left;
    pointer-events: auto;
}

html:has(.dc-monitor) #components-reconnect-modal .bb-reconnect-spinner,
html:has(.dc-monitor) #components-reconnect-modal .bb-reconnect-attempt,
html:has(.dc-monitor) #components-reconnect-modal .bb-reconnect-actions {
    display: none;
}

html:has(.dc-monitor) #components-reconnect-modal .bb-reconnect-text {
    margin: 0;
}

/* --- Tamanhos de tela ---------------------------------------------------- */

/* Por altura, e nao por largura como o "Responsivo" do app: numa tela deitada, e a altura que
   acaba primeiro. 1366x768 e o mesmo desenho, menor -- o que e so contexto sai para caber. */
@media (max-height: 800px) {
    .dc-monitor [data-tier="3"] {
        display: none;
    }

    .dc-monitor .dc-uptime__axis {
        display: none;
    }
}

/* Estreito ou baixo demais para uma tela so (celular, janela pequena): empilha e rola. Nao e o
   uso do monitor, mas a tela nao pode quebrar. */
@media (max-width: 1100px), (max-height: 560px) {
    html:has(.dc-monitor-layout),
    html:has(.dc-monitor-layout) body {
        height: auto;
        overflow: auto;
    }

    .dc-monitor {
        --mu: 8px;

        height: auto;
        min-height: 100dvh;
        overflow: visible;
        font-size: 14px;
    }

    .dc-mon-head {
        flex-wrap: wrap;
    }

    .dc-mon-panel,
    .dc-mon-central {
        display: flex;
        flex-direction: column;
    }

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

    .dc-mon-kpi {
        height: 7.5em;
    }

    .dc-mon-lane {
        grid-template-rows: auto auto 16em 10em auto;
    }

    .dc-mon-volume,
    .dc-mon-feed {
        min-height: 18em;
    }
}

/* =========================================================================
   Autenticacao e onboarding (render estatico)
   ========================================================================= */

.dc-auth {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* Painel de marca: as unicas cores fixas do app. Fica igual nos dois temas, como a marca. */
.dc-auth__aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 52px;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 12% 8%, rgba(167, 139, 250, 0.45), transparent 60%),
        radial-gradient(90% 80% at 88% 92%, rgba(76, 29, 149, 0.75), transparent 62%),
        linear-gradient(155deg, #4C1D95 0%, #2E1065 55%, #170A33 100%);
    color: #F5F3FF;
}

/* Malha discreta por cima do gradiente, para o painel nao ficar liso demais. */
.dc-auth__aside::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(80% 70% at 30% 20%, #000 20%, transparent 75%);
    pointer-events: none;
}

.dc-auth__aside > * {
    position: relative;
    z-index: 1;
}

.dc-auth__aside .dc-brand__mark {
    background: linear-gradient(140deg, #7C3AED, #4C1D95);
}

.dc-auth__aside-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dc-auth__wordmark {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.dc-auth__pitch {
    max-width: 460px;
}

.dc-auth__pitch h2 {
    margin: 0;
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.03em;
}

.dc-auth__pitch > p {
    margin: 14px 0 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(245, 243, 255, 0.72);
}

.dc-auth__features {
    list-style: none;
    margin: 32px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dc-auth__features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.dc-auth__features li > span:last-child {
    display: flex;
    flex-direction: column;
    font-size: 0.84rem;
    line-height: 1.45;
    color: rgba(245, 243, 255, 0.7);
}

.dc-auth__features strong {
    font-size: 0.88rem;
    font-weight: 650;
    color: #fff;
}

.dc-auth__feature-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #DDD6FE;
}

.dc-auth__aside-foot {
    margin: 0;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(245, 243, 255, 0.45);
}

.dc-auth__panel {
    display: grid;
    place-items: center;
    padding: 40px 24px;
    background: var(--background);
}

.dc-auth__card {
    width: 100%;
    max-width: 400px;
}

.dc-auth__mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    font-size: 1.05rem;
    font-weight: 700;
}

.dc-form__head {
    margin-bottom: 26px;
}

.dc-form__head h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.dc-form__head p {
    margin: 6px 0 0;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.dc-form__alert {
    margin-bottom: 18px;
}

.dc-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dc-form__foot {
    margin: 26px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--dc-border-soft);
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

.dc-form__foot a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.dc-form__foot a:hover {
    text-decoration: underline;
}

.dc-submit {
    width: 100%;
    margin-top: 4px;
}

.dc-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
}

.dc-steps__item {
    flex: 1;
    padding-top: 8px;
    border-top: 2px solid var(--dc-border);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted-foreground);
}

.dc-steps__item.is-active {
    border-top-color: var(--primary);
    color: var(--primary);
}

.dc-steps__item.is-done {
    border-top-color: var(--dc-success);
    color: var(--dc-success);
}

/* ValidationMessage do Blazor (campos das telas estaticas e dos formularios de modal). */
.validation-message {
    font-size: 0.8rem;
    color: var(--destructive);
}

/* =========================================================================
   Responsivo
   ========================================================================= */

@media (max-width: 1300px) {
    .dc-panel__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 1100px) {
    .dc-columns,
    .dc-chart-grid,
    .dc-availability__grid,
    .dc-service__split {
        grid-template-columns: minmax(0, 1fr);
    }

    /* O fluxo vira coluna: quatro etapas lado a lado nao caberiam sem cortar os numeros. */
    .dc-pipeline {
        flex-direction: column;
    }

    .dc-stage__arrow {
        justify-content: center;
        transform: rotate(90deg);
    }
}

@media (max-width: 1024px) {
    .dc-auth {
        grid-template-columns: minmax(0, 1fr);
    }

    .dc-auth__aside {
        display: none;
    }

    .dc-auth__mobile-brand {
        display: flex;
    }
}

@media (max-width: 900px) {
    .dc-content {
        padding: 20px 16px 48px;
    }

    .dc-topbar {
        padding: 0 12px;
    }

    .dc-user__name {
        display: none;
    }

    .dc-tenant__name {
        max-width: 110px;
    }

    .dc-directions,
    .dc-profile {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    /* O resumo desce para baixo do texto em vez de espremer a seta De -> Para. */
    .dc-direction {
        flex-wrap: wrap;
    }

    .dc-direction__summary {
        margin-left: 46px;
    }

    .dc-field-row {
        flex-direction: column;
    }

    /* A legenda da rosca desce para baixo do grafico em vez de espremer os dois lado a lado. */
    .dc-donut {
        flex-direction: column;
        align-items: stretch;
    }

    .dc-dashboard__scope,
    .dc-strip__link {
        margin-left: 0;
    }

    /* 30 segmentos em ~330px: o espaco entre eles vira a maior parte da faixa se nao encolher. */
    .dc-uptime__bar {
        gap: 2px;
    }

    /* Sem os icones as tres abas cabem em 390px; o nome ja diz o que cada uma e. */
    .dc-panel-tab svg {
        display: none;
    }

    .dc-panel-tab {
        padding-inline: 10px;
    }

    .dc-field-row > *,
    .dc-field-row > .dc-field-row__narrow {
        flex: none;
        width: 100%;
    }
}

/* =========================================================================
   Erro de circuito do Blazor
   ========================================================================= */

#blazor-error-ui {
    background: var(--popover);
    color: var(--popover-foreground);
    border-top: 1px solid var(--dc-border);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1500;
}

#blazor-error-ui .reload {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
