/* ============================================================
   Shell do sistema — TechFlow SystemManager
   Template baseado no tema "Focus": claro, com sidebar escura.
   ============================================================ */

:root {
    --tf-primary: #593bdb;
    --tf-primary-2: #6b51df;
    --tf-sidebar: #343957;
    --tf-sidebar-sub: #2c3049;
    --tf-sidebar-text: #bdbdc7;
    --tf-sidebar-label: #8a8fa8;
    --tf-content-bg: #f4f5fb;
    --tf-card: #ffffff;
    --tf-border: #eaeaea;
    --tf-heading: #3d4465;
    --tf-text: #464a53;
    --tf-muted: #828690;
    --tf-shadow: 0 0 40px 0 rgba(82, 63, 105, .10);
}

.app-layout {
    background: var(--tf-content-bg);
    min-height: 100vh;
    /* Largura da sidebar (padrão do MudBlazor é 240px). */
    --mud-drawer-width-left: 235px;
}

/* ---------------- Top bar (branca) ---------------- */
.techflow-appbar {
    background: #ffffff !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .06);
    border-bottom: 1px solid var(--tf-border);
    gap: 8px;
}

.appbar-menu-btn { color: var(--tf-primary) !important; }

.appbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    min-width: 200px;
    max-width: 380px;
    flex: 0 1 340px;
    margin-left: 8px;
    padding: 0 16px;
    border-radius: 999px;
    background: #f4f5fb;
    border: 1px solid transparent;
    transition: border-color .15s, box-shadow .15s;
}

.appbar-search:focus-within {
    border-color: rgba(89, 59, 219, .35);
    box-shadow: 0 0 0 4px rgba(89, 59, 219, .08);
}

.appbar-search-icon { color: var(--tf-muted); font-size: 1.2rem; }

.appbar-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--tf-text);
    font-size: .9rem;
}

.appbar-search-input::placeholder { color: #a7abbb; }

.appbar-actions { display: flex; align-items: center; gap: 6px; }

.appbar-action-btn {
    color: #6a707e !important;
    border-radius: 10px !important;
}
.appbar-action-btn:hover { background: #f4f5fb !important; color: var(--tf-primary) !important; }

/* Usuário */
.appbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s;
}
.appbar-user:hover { background: #f4f5fb; }

.appbar-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--tf-primary), var(--tf-primary-2));
    overflow: hidden;
}

.appbar-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.appbar-user-text { display: flex; flex-direction: column; line-height: 1.1; }
.appbar-username { font-size: .9rem; font-weight: 600; color: var(--tf-heading); white-space: nowrap; }
.appbar-userrole { font-size: .68rem; color: var(--tf-muted); }

/* ---------------- Sidebar (escura) ---------------- */
.app-drawer {
    background: var(--tf-sidebar) !important;
    border-right: none !important;
    overflow-x: hidden;
}
.app-drawer .mud-drawer-content { overflow-x: hidden; }

/* Marca no topo da sidebar */
.drawer-brand {
    height: 80px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: var(--tf-sidebar);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.drawer-logo {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    filter: brightness(0) invert(1); /* logo preto -> branco */
}

.drawer-brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: .3px;
    color: #ffffff;
    white-space: nowrap;
}

.app-drawer-inner {
    display: flex;
    flex-direction: column;
    padding-top: 6px;
}

.nav-section-label {
    padding: 18px 16px 8px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .05rem;
    text-transform: uppercase;
    color: var(--tf-sidebar-label);
}

.app-nav { padding: 0; }

.app-nav .mud-nav-link {
    color: var(--tf-sidebar-text);
    font-weight: 400;
    padding: 12px 16px;
    margin: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: background .15s, color .15s;
}

.app-nav .mud-nav-link .mud-icon-root {
    color: var(--tf-sidebar-text);
    font-size: 1.2rem;
}

.app-nav .mud-nav-link:hover {
    background: var(--tf-primary-2);
    color: #ffffff;
}
.app-nav .mud-nav-link:hover .mud-icon-root { color: #ffffff; }

.app-nav .mud-nav-link.active {
    background: var(--tf-primary-2);
    color: #ffffff;
    font-weight: 500;
}
.app-nav .mud-nav-link.active .mud-icon-root { color: #ffffff; }

/* Submenu (agrupadores) — fundo mais escuro */
.app-nav .mud-nav-group .mud-nav-link { font-weight: 500; }
.app-nav .mud-navmenu .mud-collapse-container .mud-nav-link {
    background: rgba(0, 0, 0, .18);
    padding-left: 42px;
    font-weight: 300;
}
.app-nav .mud-navmenu .mud-collapse-container .mud-nav-link:hover,
.app-nav .mud-navmenu .mud-collapse-container .mud-nav-link.active {
    background: var(--tf-primary);
    color: #fff;
}

/* Estado recolhido (mini): apenas ícones centralizados */
.app-drawer.mud-drawer--closed .drawer-brand { justify-content: center; padding: 0; }
.app-drawer.mud-drawer--closed .app-nav .mud-nav-link { justify-content: center; padding: 13px 0; }
.app-drawer.mud-drawer--closed .app-nav .mud-nav-link .mud-nav-link-text { display: none; }

/* ---------------- Conteúdo / módulos ---------------- */
.app-main { min-height: 100vh; background: var(--tf-content-bg); }
.app-content { padding: 28px 30px; max-width: 1440px; }

.module-header .module-title { font-weight: 700; color: var(--tf-heading); }
.module-header .module-subtitle { color: var(--tf-muted); margin-top: 2px; }

/* Cards padrão do sistema */
.tf-card,
.module-placeholder {
    background: var(--tf-card);
    border: 1px solid var(--tf-border);
    border-radius: 10px;
    box-shadow: var(--tf-shadow);
}

.module-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    color: var(--tf-muted);
    border-style: dashed;
}

/* Visualização de registro (modal em leitura) */
.ver-label {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03rem;
    text-transform: uppercase;
    color: var(--tf-muted);
    margin-bottom: 2px;
}

.ver-valor {
    font-size: .95rem;
    color: var(--tf-heading);
    word-break: break-word;
}

/* ---------------- Rodapé da sidebar ---------------- */
.app-drawer-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, .06);
}

/* ---------------- Tela de Ajustes ---------------- */
.ajustes-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: stretch;
}

@media (max-width: 900px) {
    .ajustes-grid { grid-template-columns: 1fr; }
}

.ajustes-perfil {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ajustes-foto {
    position: relative;
    width: 110px;
    margin: 0 auto 12px;
}

/* Input de arquivo invisível cobrindo o avatar (clique abre o seletor). */
.ajustes-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.ajustes-foto-remover {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--tf-card) !important;
    box-shadow: 0 2px 8px rgba(82, 63, 105, .25);
    z-index: 2;
}

.ajustes-avatar-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(82, 63, 105, .18);
}

.ajustes-avatar,
.ajustes-avatar-img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.ajustes-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--tf-primary), var(--tf-primary-2));
}

.ajustes-avatar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: rgba(20, 22, 40, .45);
    opacity: 0;
    transition: opacity .15s ease-in-out;
}

.ajustes-avatar-wrap:hover .ajustes-avatar-overlay { opacity: 1; }

.ajustes-nome {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tf-heading);
}

.ajustes-bloco {
    width: 100%;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--tf-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ajustes-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--tf-border);
}

.ajustes-toggle:last-child { border-bottom: none; }

.ajustes-toggle-label {
    color: var(--tf-text);
    font-size: .92rem;
}

/* ---------------- Imagem do insumo ---------------- */
.insumo-imagem-wrap {
    position: relative;
    width: 160px;
}

.insumo-imagem-box {
    position: relative;
    display: block;
    width: 160px;
    height: 120px;
    border: 1px dashed var(--tf-border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #fafafd;
}

.insumo-imagem {
    max-width: 100%;
    max-height: 240px;
    border-radius: 10px;
    object-fit: contain;
}

.insumo-imagem-box .insumo-imagem {
    width: 100%;
    height: 100%;
}

.insumo-imagem-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--tf-muted);
    font-size: .8rem;
}

.insumo-imagem-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 22, 40, .45);
}

.insumo-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.insumo-imagem-remover {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: var(--tf-card) !important;
    box-shadow: 0 2px 8px rgba(82, 63, 105, .25);
    z-index: 2;
}

/* ---------------- Galeria de mídias (dialog de Conteúdo) ---------------- */
/* Global (não scoped): precisa alcançar o <input> renderizado pelo InputFile. */
.galeria-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.galeria-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border: 1px solid var(--tf-border, #e0e0e0);
    border-radius: 8px;
    background: var(--tf-card, #fff);
}

.galeria-item--dragging {
    opacity: .5;
}

.galeria-mover {
    display: inline-flex;
    align-items: center;
    color: var(--tf-muted, #9e9e9e);
    cursor: grab;
    flex: 0 0 auto;
}

.galeria-mover:active {
    cursor: grabbing;
}

.galeria-thumb {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tf-muted, #757575);
}

.galeria-thumb-img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid var(--tf-border, #e0e0e0);
}

.galeria-nome {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9rem;
}

.galeria-acoes {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

/* Botão "alterar arquivo": label relativo com o InputFile transparente por cima. */
.galeria-editar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--tf-primary, #7b5cff);
    transition: background-color .15s ease-in-out;
}

.galeria-editar:hover {
    background: rgba(123, 92, 255, .12);
}

/* Zona de upload (MudFileUpload ActivatorContent) */
.conteudo-drop-wrap {
    display: block;
    width: 100%;
    margin-top: 10px;
    cursor: pointer;
}

.conteudo-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 22px;
    border: 1px dashed var(--tf-border, #c4c4c4);
    border-radius: 8px;
    background: #fafafd;
    color: var(--tf-muted, #757575);
    text-align: center;
    transition: border-color .15s ease-in-out, background-color .15s ease-in-out, color .15s ease-in-out;
}

.conteudo-drop--over {
    border-color: var(--tf-primary, #7b5cff);
    background: rgba(123, 92, 255, .06);
    color: var(--tf-primary, #7b5cff);
}

.conteudo-drop-txt {
    font-size: .9rem;
    font-weight: 500;
}

.conteudo-drop-sub {
    font-size: .72rem;
}

/* ---------------- Base de Conhecimento (visualização pública) ---------------- */
/* Global (não scoped) para garantir aplicação consistente do carrossel/cards. */
.bc-carrossel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}

.bc-carrossel .bc-card {
    flex: 0 0 300px;
    scroll-snap-align: start;
}

.bc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.bc-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--tf-border, #e0e0e0);
    border-radius: 12px;
    overflow: hidden;
    background: var(--tf-card, #fff);
    cursor: pointer;
    transition: box-shadow .15s ease, transform .15s ease;
}

.bc-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
    transform: translateY(-2px);
}

.bc-card-destaque {
    border-color: var(--tf-primary, #1b6ec2);
}

/* Destaque: Categoria (topo) → Imagem → Título → Descrição, centralizados */
.bc-destaque-cat {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: .72rem;
    font-weight: 600;
    color: var(--tf-primary, #1b6ec2);
    padding: 12px 14px 8px;
}

.bc-card-img {
    height: 150px;
    background-size: cover;
    background-position: center;
    background-color: #eef1f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tf-muted, #9aa4b2);
}

.bc-card-destaque .bc-card-img {
    height: 160px;
    margin: 0 14px;
    border-radius: 8px;
}

.bc-card-body {
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bc-destaque-body {
    align-items: center;
    text-align: center;
}

.bc-chip {
    align-self: flex-start;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--tf-primary, #1b6ec2);
    color: #fff;
}

.bc-card-titulo {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tf-text, #212121);
    line-height: 1.25;
}

.bc-card-desc {
    font-size: .85rem;
    color: var(--tf-muted, #616161);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Carrossel com setas de navegação */
.bc-carrossel-wrap {
    position: relative;
}

.bc-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: var(--tf-card, #fff) !important;
    color: var(--tf-primary, #593bdb) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

.bc-nav-left {
    left: -8px;
}

.bc-nav-right {
    right: -8px;
}

/* ---------------- Detalhe de Conteúdo (visualização pública) ---------------- */
.cd-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.cd-header-img {
    flex: 0 0 260px;
    width: 260px;
    max-width: 100%;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f6fa;
    border: 1px solid var(--tf-border, #e0e0e0);
}

.cd-header-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Imagem de destaque clicável → abre o lightbox */
.cd-header-img--zoom {
    position: relative;
    cursor: zoom-in;
}

.cd-header-img-lupa {
    position: absolute;
    bottom: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(20, 22, 40, .55);
    color: #fff;
    opacity: 0;
    transition: opacity .15s ease-in-out;
}

.cd-header-img--zoom:hover .cd-header-img-lupa {
    opacity: 1;
}

/* Lightbox: modal em tela cheia com a imagem completa */
.cd-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, .85);
    cursor: zoom-out;
}

.cd-lightbox img {
    max-width: 95vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.cd-lightbox-fechar {
    position: fixed;
    top: 16px;
    right: 20px;
    color: #fff !important;
}

.cd-header-img-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tf-muted, #9aa4b2);
}

.cd-header-info {
    flex: 1 1 320px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cd-cat {
    align-self: flex-end;
}

.cd-titulo {
    line-height: 1.2;
}

.cd-desc {
    color: var(--tf-muted, #555);
    font-size: 1rem;
    line-height: 1.5;
}

.cd-data {
    font-size: .78rem;
    color: var(--tf-muted, #888);
}

/* Conteúdo HTML autoral (imagens sempre limitadas à largura) */
.cd-conteudo {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--tf-text, #212121);
    overflow-wrap: anywhere;
}

.cd-conteudo img { max-width: 100%; height: auto; border-radius: 8px; }
.cd-conteudo h1, .cd-conteudo h2, .cd-conteudo h3 { margin: 1.2em 0 .5em; }
.cd-conteudo p { margin: 0 0 1em; }
.cd-conteudo ul, .cd-conteudo ol { margin: 0 0 1em 1.5em; }
.cd-conteudo a { color: var(--tf-primary, #593bdb); }
.cd-conteudo table { border-collapse: collapse; width: 100%; margin: 0 0 1em; }
.cd-conteudo table td, .cd-conteudo table th { border: 1px solid var(--tf-border, #e0e0e0); padding: 6px 10px; }

/* Galeria: carrossel de imagens/vídeos */
.cd-carrossel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}

.cd-slide {
    flex: 0 0 auto;
    scroll-snap-align: start;
    max-width: 100%;
}

.cd-slide-media {
    display: block;
    max-height: 300px;
    max-width: 480px;
    width: auto;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--tf-border, #e0e0e0);
    background: #000;
    object-fit: contain;
}

/* Galeria: arquivos em linhas (visualizar/baixar) */
.cd-arquivos {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cd-arquivo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border: 1px solid var(--tf-border, #e0e0e0);
    border-radius: 8px;
    background: var(--tf-card, #fff);
}

.cd-arquivo-icone {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tf-muted, #757575);
}

.cd-arquivo-nome {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9rem;
}

.cd-arquivo-acoes {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

/* ---------------- Histórico de movimentação (linhas por tipo) ---------------- */
.mov-entrada > td {
    background: #e4f5e9 !important;
    color: #1f6b3b !important;
}
.mov-saida > td {
    background: #fce4e6 !important;
    color: #9b2530 !important;
}
.mov-criacao > td {
    background: #f2f2f5 !important;
    color: #5a5f6b !important;
}
.mov-entrada:hover > td,
.mov-saida:hover > td,
.mov-criacao:hover > td {
    filter: brightness(0.97);
}

/* ---------------- Registro excluído logicamente ---------------- */
/* Linha exibida "borrada" (esmaecida) mantendo a tag "Excluído" visível. */
.tf-excluido > td {
    opacity: .6;
    filter: grayscale(.6) blur(.5px);
}

.tf-tag-excluido {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: #fce4e6;
    color: #9b2530;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04rem;
    vertical-align: middle;
}

/* ---------------- Board de Tarefas (Kanban) ---------------- */
.tf-kanban {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
}

.tf-kanban-col {
    flex: 0 0 260px;
    min-width: 260px;
    background: var(--tf-content-bg, #f4f5fb);
    border: 1px solid var(--tf-border, #eaeaea);
    border-radius: 12px;
    padding: 12px;
    min-height: 120px;
}

.tf-kanban-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    color: var(--tf-heading, #3d4465);
    font-size: .9rem;
    padding: 2px 4px 10px;
    border-bottom: 1px solid var(--tf-border, #eaeaea);
    margin-bottom: 10px;
}

.tf-kanban-col-count {
    background: #fff;
    border-radius: 999px;
    padding: 0 8px;
    font-size: .7rem;
    color: var(--tf-muted, #828690);
}

.tf-kanban-card {
    background: var(--tf-card, #fff);
    border-radius: 10px;
    border: 1px solid var(--tf-border, #eaeaea);
    border-left: 4px solid transparent;
    box-shadow: 0 1px 4px rgba(82,63,105,.08);
    padding: 10px 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: box-shadow .15s ease, transform .05s ease;
}

.tf-kanban-card:hover {
    box-shadow: 0 4px 14px rgba(82,63,105,.16);
}

.tf-kanban-card:active {
    transform: scale(.99);
}

.tf-kanban-card-titulo {
    font-weight: 600;
    color: var(--tf-heading, #3d4465);
    margin-bottom: 6px;
    line-height: 1.25;
}

.tf-kanban-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: .76rem;
    color: var(--tf-muted, #828690);
    margin-bottom: 8px;
}

/* Destaque do card por prioridade (barra lateral) */
.tf-prio-baixa { border-left-color: #2e7d32; }   /* verde */
.tf-prio-media { border-left-color: #f9a825; }   /* amarelo */
.tf-prio-alta  { border-left-color: #c62828; }   /* vermelho */

.tf-kanban-col--over {
    outline: 2px dashed var(--tf-primary, #593bdb);
    outline-offset: -4px;
    background: #eef0fb;
}

.tf-kanban-card--dragging {
    opacity: .5;
}

/* ---------------- Timeline do histórico da tarefa ---------------- */
.tf-log-card {
    background: var(--tf-content-bg, #f4f5fb);
    border: 1px solid var(--tf-border, #eaeaea);
    border-radius: 10px;
}

.tf-log-data {
    color: var(--tf-muted, #828690);
}

/* Linhas de insumos utilizados no modal de conclusão de tarefa. */
.tf-insumo-linha + .tf-insumo-linha {
    border-top: 1px solid var(--tf-border, #eaeaea);
}

/* ---------------- Bookmark de favoritos nos cards da base de conhecimento ---------------- */
.bc-card {
    position: relative;
}

.bc-fav {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    background: rgba(255, 255, 255, .9);
}

.bc-fav:hover {
    background: #ffffff;
}

/* ---------------- Dashboard ---------------- */
/* Campos de exportação lado a lado, todos alinhados à esquerda. Cada select fica num
   contêiner de largura fixa: o MudSelect cresce (flex-grow) e espalharia os campos. */
.tf-dash-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin: 14px 0 6px;
}

.tf-dash-toolbar > .tf-dash-campo { flex: 0 0 240px; width: 240px; }
.tf-dash-toolbar > .tf-dash-campo .mud-input-control { margin-top: 0; }
.tf-dash-toolbar > .tf-dash-exportar { flex: 0 0 auto; height: 40px; text-transform: none; }

@media (max-width: 600px) {
    .tf-dash-toolbar > .tf-dash-campo { flex: 1 1 100%; width: 100%; }
}

.tf-dash-card {
    height: 100%;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}

.tf-dash-titulo {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--tf-heading);
}

.tf-dash-titulo small {
    font-weight: 400;
    font-size: .75rem;
    color: var(--tf-muted);
    text-align: right;
}

.tf-dash-grafico {
    flex: 1;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tf-dash-vazio {
    color: var(--tf-muted);
    text-align: center;
    padding: 32px 8px;
}

.tf-dash-legenda { color: var(--tf-muted); }

/* Card numérico escuro (Tempo médio de resolução) */
.tf-dash-numero {
    background: var(--tf-sidebar) !important;
    border-radius: 10px;
    box-shadow: var(--tf-shadow);
    color: #ffffff;
    min-height: 0;
}

.tf-dash-numero .tf-dash-titulo { color: #ffffff; }
.tf-dash-numero .tf-dash-titulo small,
.tf-dash-numero .tf-dash-numero-legenda { color: var(--tf-sidebar-text); text-align: center; }

.tf-dash-numero-corpo {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
}

.tf-dash-numero-valor { font-size: 2.6rem; font-weight: 300; line-height: 1; }
.tf-dash-numero-icone { font-size: 1.7rem; color: #4bc0c0; }

/* Medidor da meta de atendimento (meio círculo) */
.tf-dash-gauge { display: block; width: 100%; max-width: 260px; margin: 4px auto 0; }

.tf-dash-meta-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    font-size: .85rem;
    color: var(--tf-text);
}

.tf-dash-meta-info i { width: 16px; text-align: center; margin-right: 6px; }
.tf-dash-meta-ok { color: #2e7d32; }
.tf-dash-meta-falta { color: #b26a00; }
.tf-dash-meta-sobe { color: #2e7d32; }
.tf-dash-meta-desce { color: #c62828; }
.tf-dash-meta-neutro { color: var(--tf-muted); }

/* Comparação com o mês anterior no card escuro (menos tempo = melhor) */
.tf-dash-numero-variacao {
    text-align: center;
    font-size: .78rem;
    color: var(--tf-sidebar-text);
    margin-bottom: 2px;
}

.tf-dash-numero-variacao i { margin-right: 4px; }
.tf-dash-numero-variacao.melhor { color: #6fdc9b; }
.tf-dash-numero-variacao.pior { color: #ff8a80; }

/* Blocos compactos da primeira linha (Saída de insumos / Tempo médio de resolução) */
.tf-dash-card--compacto { padding: 10px 14px; }
.tf-dash-card--compacto .tf-dash-titulo { margin-bottom: 4px; font-size: .9rem; }
.tf-dash-card--compacto .tf-dash-grafico { min-height: 0; }
.tf-dash-card--compacto .tf-dash-vazio { padding: 16px 8px; }
.tf-dash-numero.tf-dash-card--compacto .tf-dash-numero-corpo { padding: 6px 0; gap: 14px; }

/* Histórico da meta: últimas 4 semanas */
.tf-dash-semanas {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--tf-border);
}

.tf-dash-semanas-titulo {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tf-muted);
    margin-bottom: 6px;
}

.tf-dash-semanas-barras {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.tf-dash-semanas-barras .mud-tooltip-root { display: block; }

.tf-dash-semana {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: default;
}

.tf-dash-semana-valor { font-size: .72rem; font-weight: 600; color: var(--tf-heading); }
.tf-dash-semana-rotulo { font-size: .68rem; color: var(--tf-muted); }

.tf-dash-semana-trilho {
    position: relative;
    width: 100%;
    max-width: 34px;
    height: 46px;
    background: var(--tf-content-bg);
    border-radius: 6px;
    overflow: hidden;
}

.tf-dash-semana-barra {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 6px 6px 0 0;
    transition: height .3s ease;
}

.tf-dash-semana-barra.atingida { background: #2e7d32; }
.tf-dash-semana-barra.abaixo { background: #e53935; }
.tf-dash-semana-barra.vazia { background: transparent; }

/* Linha tracejada na altura da meta (90%) */
.tf-dash-semana-meta {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed var(--tf-heading);
    opacity: .55;
    z-index: 1;
}

/* ---------------- Home ---------------- */
.home-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.home-data {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--tf-card);
    border: 1px solid var(--tf-border);
    color: var(--tf-heading);
    font-size: .85rem;
}

.home-data i { color: var(--tf-primary); }

.home-skeleton { border-radius: 12px; }

/* Tons reutilizados por indicadores e ícones das listas */
.tom-primario { --tom: #593bdb; --tom-fundo: rgba(89, 59, 219, .10); }
.tom-info     { --tom: #2c88ff; --tom-fundo: rgba(44, 136, 255, .11); }
.tom-sucesso  { --tom: #20a779; --tom-fundo: rgba(32, 167, 121, .12); }
.tom-alerta   { --tom: #e09400; --tom-fundo: rgba(245, 166, 35, .15); }
.tom-perigo   { --tom: #e5533d; --tom-fundo: rgba(229, 83, 61, .12); }

/* Indicadores (KPIs) */
.home-kpi {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
    padding: 20px 22px;
    background: var(--tf-card);
    border: 1px solid var(--tf-border);
    border-radius: 12px;
    box-shadow: var(--tf-shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}

.home-kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(82, 63, 105, .14); }

.home-kpi-icone {
    flex: 0 0 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 1.35rem;
    color: var(--tom, var(--tf-primary));
    background: var(--tom-fundo, rgba(89, 59, 219, .10));
}

.home-kpi-texto { display: flex; flex-direction: column; min-width: 0; }

.home-kpi-valor {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--tf-heading);
}

.home-kpi-titulo { font-size: .85rem; color: var(--tf-muted); }

/* Indicador em destaque: gradiente da cor primária */
.home-kpi--destaque {
    background: linear-gradient(135deg, var(--tf-primary) 0%, #7b61ff 100%);
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(89, 59, 219, .28);
}

.home-kpi--destaque .home-kpi-icone { color: #ffffff; background: rgba(255, 255, 255, .18); }
.home-kpi--destaque .home-kpi-valor { color: #ffffff; }
.home-kpi--destaque .home-kpi-titulo { color: rgba(255, 255, 255, .82); }

/* Blocos (Notificações / Últimas Interações) */
.home-bloco {
    height: 100%;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    padding: 18px 8px 10px;
}

.home-bloco-cabecalho {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 14px;
    border-bottom: 1px solid var(--tf-border);
}

.home-bloco-icone {
    flex: 0 0 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--tf-primary);
    background: rgba(89, 59, 219, .10);
}

.home-bloco-titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.home-bloco-titulo h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--tf-heading);
}

.home-bloco-titulo span { font-size: .78rem; color: var(--tf-muted); }

.home-bloco-acao { text-transform: none !important; white-space: nowrap; }

/* Listas */
.home-lista {
    list-style: none;
    margin: 0;
    padding: 6px 0 0;
    overflow-y: auto;
    max-height: 420px;
}

.home-item {
    position: relative;
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    font: inherit;
    color: var(--tf-text);
    cursor: pointer;
    transition: background-color .15s ease;
}

.home-item:hover { background: var(--tf-content-bg); }
.home-item:focus-visible { outline: 2px solid rgba(89, 59, 219, .45); outline-offset: -2px; }

.home-item.nao-lida { background: rgba(89, 59, 219, .05); }
.home-item.nao-lida:hover { background: rgba(89, 59, 219, .09); }

/* Barra de destaque à esquerda das não lidas */
.home-item.nao-lida::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 3px;
    background: var(--tf-primary);
}

.home-item-icone {
    flex: 0 0 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: .95rem;
    color: var(--tom);
    background: var(--tom-fundo);
}

.home-item-corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.home-item-titulo {
    font-size: .88rem;
    font-weight: 600;
    color: var(--tf-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-item-descricao {
    font-size: .8rem;
    color: var(--tf-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-item-descricao--forte { color: var(--tf-text); font-size: .85rem; }
.home-item-descricao--forte strong { color: var(--tf-heading); }

.home-item-tarefa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    max-width: 100%;
    margin-top: 3px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--tf-content-bg);
    color: var(--tf-primary);
    font-size: .72rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-item-meta {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    font-size: .72rem;
    color: var(--tf-muted);
    white-space: nowrap;
}

.home-item-ponto {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tf-primary);
}

.home-item-seta { font-size: .7rem; opacity: 0; transition: opacity .15s ease, transform .15s ease; }
.home-item:hover .home-item-seta { opacity: .8; transform: translateX(2px); }

/* Avatares com iniciais (Últimas Interações) */
.home-avatar {
    flex: 0 0 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
}

/* Linha do tempo ligando os avatares */
.home-linha-tempo li { position: relative; }
.home-linha-tempo li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 29px;
    top: 50px;
    bottom: -8px;
    width: 2px;
    background: var(--tf-border);
}

/* Estado vazio */
.home-vazio {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 36px 24px;
    text-align: center;
    color: var(--tf-muted);
    font-size: .82rem;
}

.home-vazio strong { color: var(--tf-heading); font-size: .92rem; font-weight: 600; }

.home-vazio-icone {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin-bottom: 6px;
    border-radius: 50%;
    background: var(--tf-content-bg);
    color: #b5b8c2;
    font-size: 1.5rem;
}

/* ---------------- Animações de entrada (Home e Dashboard) ---------------- */
@keyframes tf-surgir {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

@keyframes tf-revelar { to { opacity: 1; } }

/* Cards e itens de lista entram em sequência (--i = ordem, definida na marcação). */
.tf-animavel .tf-dash-card,
.tf-animavel .home-kpi,
.tf-animavel .home-bloco,
.tf-animavel .home-lista > li {
    animation: tf-surgir .5s cubic-bezier(.22, .61, .36, 1) both;
    animation-delay: calc(var(--i, 0) * 70ms);
}

.tf-animavel .home-lista > li { animation-duration: .4s; animation-delay: calc(200ms + var(--i, 0) * 60ms); }
.tf-animavel .home-bloco { animation-delay: 180ms; }

/* Até o JS iniciar as animações, números e gráficos ficam ocultos (evita mostrar o valor
   final e "voltar" a zero). Se o JS não rodar, aparecem sozinhos após 2,5s. */
.tf-animavel:not(.tf-animado) [data-tf-contar],
.tf-animavel:not(.tf-animado) .tf-anim-grafico svg,
.tf-animavel:not(.tf-animado) [data-tf-crescer] {
    opacity: 0;
    animation: tf-revelar 0s linear 2.5s forwards;
}

@media (prefers-reduced-motion: reduce) {
    .tf-animavel .tf-dash-card,
    .tf-animavel .home-kpi,
    .tf-animavel .home-bloco,
    .tf-animavel .home-lista > li { animation: none; }
}
