:root {
    --tc-bg: #0d1220;
    --tc-surface: #141b2d;
    --tc-surface-2: #1b2438;
    --tc-border: #26314a;
    --tc-text: #e3e8f2;
    --tc-muted: #8b96ad;
    --tc-accent: #4f8cff;
    --tc-pendente: #f5b942;
    --tc-processando: #4f8cff;
    --tc-falha: #ff5d6c;
    --tc-sucesso: #33c38a;
    --tc-esgotado: #c27bff;
}

body {
    background: var(--tc-bg);
    color: var(--tc-text);
    font-size: .925rem;
}

code { color: #9fb6ff; }
a { color: #8fb3ff; }

/* ---------- shell ---------- */
.tc-shell { display: flex; min-height: 100vh; }

.tc-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--tc-surface);
    border-right: 1px solid var(--tc-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.tc-brand {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: 1.1rem 1.25rem;
    color: var(--tc-text);
    text-decoration: none;
    border-bottom: 1px solid var(--tc-border);
}
.tc-brand i { font-size: 1.7rem; color: var(--tc-accent); }
.tc-brand span { font-weight: 700; line-height: 1.1; }
.tc-brand small { display: block; font-weight: 400; font-size: .75rem; color: var(--tc-muted); }

.tc-nav { flex: 1; overflow-y: auto; padding: .75rem 0; }
.tc-nav-group {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tc-muted);
    padding: 1rem 1.25rem .35rem;
}
.tc-nav-item {
    display: block;
    padding: .45rem 1.25rem;
    color: var(--tc-text);
    text-decoration: none;
    border-left: 3px solid transparent;
}
.tc-nav-item:hover { background: var(--tc-surface-2); color: #fff; }
.tc-nav-item.active { background: var(--tc-surface-2); border-left-color: var(--tc-accent); color: #fff; }
.tc-nav-sub { padding-left: 2.1rem; font-size: .85rem; color: #c3cbdc; }

.tc-user { padding: 1rem 1.25rem; border-top: 1px solid var(--tc-border); font-size: .85rem; }

.tc-main { flex: 1; min-width: 0; padding: 1.5rem 2rem 3rem; }

.tc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.tc-header h1 { font-size: 1.6rem; font-weight: 700; margin: 0; }
.tc-breadcrumb { font-size: .8rem; color: var(--tc-muted); margin-bottom: .25rem; }
.tc-breadcrumb a { color: var(--tc-muted); }

/* ---------- cards ---------- */
.tc-card {
    background: var(--tc-surface);
    border: 1px solid var(--tc-border);
    border-radius: .75rem;
    overflow: hidden;
}
.tc-card-header {
    padding: .75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--tc-border);
    background: var(--tc-surface-2);
}

.tc-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.tc-kpi {
    background: var(--tc-surface);
    border: 1px solid var(--tc-border);
    border-left: 4px solid var(--tc-border);
    border-radius: .75rem;
    padding: 1rem 1.25rem;
}
.tc-kpi span { display: block; color: var(--tc-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tc-kpi strong { font-size: 2rem; font-weight: 700; }
.kpi-pendente { border-left-color: var(--tc-pendente); }
.kpi-processando { border-left-color: var(--tc-processando); }
.kpi-falha { border-left-color: var(--tc-falha); }
.kpi-travado { border-left-color: #ff9f43; }
.kpi-esgotado { border-left-color: var(--tc-esgotado); }

/* ---------- tables ---------- */
.tc-table { --bs-table-bg: transparent; --bs-table-hover-bg: rgba(79, 140, 255, .07); }
.tc-table th { color: var(--tc-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.tc-row-link { cursor: pointer; }
.tc-truncate { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tc-num { font-weight: 700; }

/* ---------- status ---------- */
.status-pendente { color: var(--tc-pendente); }
.status-processando { color: var(--tc-processando); }
.status-falha { color: var(--tc-falha); }
.status-sucesso { color: var(--tc-sucesso); }
.status-outro { color: var(--tc-muted); }

.tc-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    letter-spacing: .03em;
}

.tc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-ok { background: var(--tc-sucesso); box-shadow: 0 0 6px var(--tc-sucesso); }
.dot-warn { background: var(--tc-pendente); box-shadow: 0 0 6px var(--tc-pendente); }
.dot-err { background: var(--tc-falha); box-shadow: 0 0 6px var(--tc-falha); }

.tc-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.tc-status-chip {
    display: flex;
    flex-direction: column;
    padding: .5rem .75rem;
    border: 1px solid var(--tc-border);
    border-radius: .5rem;
    background: var(--tc-surface-2);
    text-decoration: none;
}
.tc-status-chip span { font-size: .7rem; font-weight: 600; letter-spacing: .03em; }
.tc-status-chip strong { font-size: 1.3rem; color: var(--tc-text); }
.tc-status-chip.selected { border-color: currentColor; }

/* ---------- workers ---------- */
.tc-workers { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; padding: 1rem; }
.tc-worker { border: 1px solid var(--tc-border); border-radius: .5rem; padding: .75rem 1rem; background: var(--tc-surface-2); }
.tc-health-list { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .82rem; max-height: 260px; overflow-y: auto; }
.tc-health-list li { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; }

/* ---------- detalhe ---------- */
.tc-dl dt { font-size: .72rem; color: var(--tc-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.tc-dl dd { margin-bottom: .7rem; word-break: break-word; }

.tc-pre {
    margin: 0;
    padding: 1rem;
    max-height: 520px;
    overflow: auto;
    font-size: .8rem;
    color: #cfe0ff;
    background: #0a0f1b;
    white-space: pre-wrap;
    word-break: break-word;
}
.tc-message { color: #ffc2c8; }

/* ---------- login / vazio ---------- */
.tc-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #1a2b55 0%, var(--tc-bg) 60%);
    padding: 1rem;
}
.tc-login-card {
    width: 100%;
    max-width: 380px;
    background: var(--tc-surface);
    border: 1px solid var(--tc-border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.tc-login-brand { text-align: center; margin-bottom: 1.5rem; }
.tc-login-brand i { font-size: 2.6rem; color: var(--tc-accent); }
.tc-login-brand h1 { font-size: 1.4rem; font-weight: 700; margin: .5rem 0 .25rem; }
.tc-login-brand p { color: var(--tc-muted); font-size: .85rem; margin: 0; }

.tc-empty { text-align: center; padding: 4rem 1rem; color: var(--tc-muted); }
.tc-empty i { font-size: 3rem; display: block; margin-bottom: .5rem; }
.tc-empty h2 { color: var(--tc-text); font-size: 1.3rem; }

@media (max-width: 992px) {
    .tc-shell { flex-direction: column; }
    .tc-sidebar { width: 100%; height: auto; position: static; }
    .tc-nav { max-height: 240px; }
    .tc-main { padding: 1rem; }
}

/* ---------- módulos / acesso rápido ---------- */
.tc-section-title {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tc-muted);
    font-weight: 600;
    margin: 0 0 .75rem;
}
.tc-h-icon { color: var(--tc-accent); margin-right: .25rem; }
.tc-header h1 .tc-saude { font-size: .8rem; vertical-align: middle; margin-left: .5rem; }

.tc-saude {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--tc-surface-2);
    border: 1px solid var(--tc-border);
    color: var(--tc-text);
    white-space: nowrap;
}
.tc-saude .tc-dot { width: 8px; height: 8px; box-shadow: none; }

.tc-grid-modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.tc-grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }

.tc-modulo-card, .tc-fila-card {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    background: var(--tc-surface);
    border: 1px solid var(--tc-border);
    border-top: 3px solid var(--tc-border);
    border-radius: .75rem;
    padding: 1rem 1.1rem;
    color: var(--tc-text);
    text-decoration: none;
    transition: border-color .15s, transform .15s, background .15s;
}
.tc-modulo-card:hover, .tc-fila-card:hover { background: var(--tc-surface-2); transform: translateY(-2px); color: var(--tc-text); }
.saude-borda-ok { border-top-color: var(--sw-sucesso); }
.saude-borda-alerta { border-top-color: var(--sw-pendente); }
.saude-borda-erro { border-top-color: var(--sw-falha); }

.tc-modulo-card h3, .tc-fila-card h3 { font-size: 1.05rem; font-weight: 700; margin: .25rem 0 0; }
.tc-fila-card code { font-size: .72rem; }
.tc-modulo-icone {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: .6rem;
    background: rgba(79, 140, 255, .12);
    color: var(--tc-accent);
    font-size: 1.25rem;
}

.tc-mini-stats { display: flex; gap: 1.25rem; margin: .6rem 0 .2rem; }
.tc-mini-stats dt { font-size: .68rem; color: var(--tc-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tc-mini-stats dd { margin: 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.tc-fila-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .78rem; color: var(--tc-muted); margin-top: .35rem; }
.tc-fila-abrir { margin-top: auto; padding-top: .6rem; font-size: .8rem; color: var(--tc-accent); font-weight: 600; }

/* ---------- gráficos (barras horizontais) ---------- */
:root {
    /* Marcas dos gráficos: paleta de status validada contra a superfície #141b2d.
       Ordem da pilha Pendente → Processando → Falha (verde nunca fica ao lado do vermelho). */
    --sw-pendente: #fab219;
    --sw-processando: #3987e5;
    --sw-falha: #d03b3b;
    --sw-sucesso: #0ca30c;
}
.sw-pendente { background: var(--sw-pendente); }
.sw-processando { background: var(--sw-processando); }
.sw-falha { background: var(--sw-falha); }

.tc-chart { padding: 1rem 1.25rem 1.25rem; }
.tc-legend { display: flex; gap: 1.25rem; font-size: .78rem; color: var(--tc-muted); margin-bottom: .9rem; }
.tc-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.tc-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.tc-chart-vazio { color: var(--tc-muted); padding: 1.5rem 0; text-align: center; }

.tc-bars { list-style: none; margin: 0; padding: 0; }
.tc-bar-row {
    display: grid;
    grid-template-columns: minmax(140px, 32%) 1fr 90px;
    align-items: center;
    gap: .9rem;
    padding: .45rem .5rem;
    margin: 0 -.5rem;
    border-radius: .4rem;
}
.tc-bar-row:hover { background: rgba(79, 140, 255, .07); }
.tc-bar-label { font-size: .85rem; line-height: 1.2; min-width: 0; }
.tc-bar-label a { color: var(--tc-text); text-decoration: none; }
.tc-bar-label small { display: block; color: var(--tc-muted); font-size: .72rem; }
.tc-bar-track {
    display: flex;
    gap: 2px;
    height: 14px;
    background: rgba(255, 255, 255, .035);
    border-radius: 4px;
    overflow: hidden;
}
.tc-seg { display: block; height: 100%; min-width: 3px; flex-shrink: 1; }
.tc-seg:first-child { border-radius: 4px 0 0 4px; }
.tc-seg:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.tc-bar-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
.tc-bar-value small { display: block; font-weight: 600; font-size: .72rem; }
.tc-bar-mini { height: 6px; margin-top: .4rem; }

.tc-tooltip {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    background: #0a0f1b;
    border: 1px solid var(--tc-border);
    border-radius: .5rem;
    padding: .5rem .7rem;
    font-size: .78rem;
    white-space: pre-line;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    max-width: 280px;
}
.tc-tooltip::first-line { font-weight: 700; }

/* nomes longos de hosted service não podem empurrar o selo de saúde para fora do card */
.tc-fila-card > div:first-child > div { min-width: 0; }
.tc-fila-card code { display: block; overflow-wrap: anywhere; }
.tc-saude { flex-shrink: 0; }

/* ---------- contadores dos cards de módulo: uma linha por status (não estoura com números grandes) ---------- */
.tc-grid-modulos { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tc-mini-stats-linhas { flex-direction: column; gap: .2rem; }
.tc-mini-stats-linhas > div { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; min-width: 0; }
.tc-mini-stats-linhas dd { font-size: 1.05rem; }
.tc-mini-stats > div { min-width: 0; }
.tc-mini-stats dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-mini-stats { flex-wrap: wrap; }

/* ---------- filtro de loja ---------- */
.tc-filtro-loja {
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: 520px;
    margin-bottom: .75rem;
}
.tc-filtro-loja > i { color: var(--tc-muted); }
.tc-loja-ativa {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .4rem .8rem;
    margin-bottom: 1rem;
    border: 1px solid var(--tc-accent);
    border-radius: .5rem;
    background: rgba(79, 140, 255, .08);
    font-size: .85rem;
}
.tc-nota {
    font-size: .8rem;
    color: var(--tc-muted);
    border-left: 3px solid var(--tc-border);
    padding: .35rem .75rem;
}
.tc-card-inativo { opacity: .55; }

/* Gráfico de colunas (série única no tempo) - relatório de pedidos integrados */
.sw-sucesso { background: var(--sw-sucesso); }
.kpi-sucesso { border-left-color: var(--tc-sucesso); }
.tc-kpi small { display: block; font-size: .75rem; }
.tc-cols-escala { font-size: .72rem; color: var(--tc-muted); margin-bottom: .25rem; }
.tc-cols {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 180px;
    border-bottom: 1px solid var(--tc-border);
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 100% 25%;
}
.tc-col {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 4px 4px 0 0;
}
.tc-col:hover { background: rgba(79, 140, 255, .07); }
.tc-col > span { display: block; min-height: 3px; border-radius: 4px 4px 0 0; }
.tc-cols-eixo { display: flex; gap: 2px; margin-top: .3rem; font-size: .68rem; color: var(--tc-muted); }
.tc-cols-eixo span { flex: 1 1 0; min-width: 0; text-align: left; white-space: nowrap; overflow: visible; }
