/* =====================================================================
   Design System
   Carregado por includes/header.php em toda página (logada ou não) e
   pelas telas de login (pages/login.php, pages/login_2fa.php).

   Tema escuro (padrão) e claro via atributo [data-theme] no <html>
   (o mesmo valor é espelhado em [data-bs-theme], para o Bootstrap 5.3
   ajustar sozinho setas de <select>, botão de fechar, checkboxes etc.).
   A troca em tempo real é feita pelo botão sol/lua (initThemeToggle()
   em public/js/app.js); a leitura inicial do tema salvo (localStorage)
   acontece num script inline no <head>, ANTES deste CSS aplicar, para
   não haver "flash" de tema errado.

   Seções, na ordem:
   1.  Tokens de cor (escuro / claro) e ponte com as variáveis do Bootstrap
       — para mudar a paleta do sistema é SÓ AQUI (e em theme-brand.css,
       que sobrescreve os mesmos tokens quando o tema "brand" está ativo).
   2.  Base (tipografia, links, scrollbar).
   3.  Shell: sidebar, área principal e topbar.
   4.  Telas de autenticação (login, 2FA).
   5.  Cards, tabelas, formulários, botões, badges, alerts, dropdowns,
       modais, abas, listas, progress, accordion e utilitários do Bootstrap
       reestilizados para os tokens.
   6.  KPI cards, hero e blocos do dashboard.
   7.  Kanban e task cards.
   8.  Editor de texto rico (reconciliação com os tokens).
   9.  Banner de cronômetro, tabelas ordenáveis, fixes de tabela em card.
   10. Responsivo.
   11. Minhas Tasks e modal de task (tela /minhas-tasks, modal de task em duas
       colunas).
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Tokens
   --------------------------------------------------------------------- */
:root,
[data-theme="dark"] {
    color-scheme: dark;

    --bg: #131313;
    --bg-elevated: #1a1a1a;
    --bg-card: #1f1f1f;
    --bg-input: #161616;
    --bg-hover: #2a2a2a;
    --border: #2e2e2e;
    --text: #f4f4f1;
    --text-rgb: 244, 244, 241;
    --text-muted: #a8a8a3;
    --text-faint: #8a8a85;

    --sidebar-bg: #191919;
    --sidebar-hover: #262626;
    --sidebar-text: #b4b4af;
    --sidebar-text-active: #ffffff;
    --topbar-bg: rgba(19, 19, 19, 0.82);

    --primary: #d4450d;
    --primary-rgb: 212, 69, 13;
    --primary-2: #e8690f;
    --primary-hover: #ff8a50;
    /* texto/ícones de destaque sobre fundo escuro */
    --primary-dark: #b13a0a;
    /* hover/active de superfícies preenchidas com texto branco */
    --primary-soft: rgba(212, 69, 13, 0.2);
    --on-primary: #ffffff;

    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.14);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.15);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.14);
    --purple: #a78bfa;
    --purple-soft: rgba(167, 139, 250, 0.15);

    /* Escala tipográfica única (ver "Tipografia" em README.md). No celular (< 768 px) os quatro menores descem 1 px (seção 12). */
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-md-sm: 0.875rem;
    --fs-base: 0.9375rem;
    --fs-md: 1rem;
    --fs-lg: 1.25rem;
    --fs-xl: 1.5rem;

    --radius: 1rem;
    --radius-sm: 0.65rem;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
    color-scheme: light;

    --bg: #f4f3f0;
    --bg-elevated: #faf9f7;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #efede9;
    --border: #e4e1da;
    --text: #1c1917;
    --text-rgb: 28, 25, 23;
    --text-muted: #6b6760;
    --text-faint: #6f6b64;

    --sidebar-bg: #ffffff;
    --sidebar-hover: #f4f2ee;
    --sidebar-text: #57534e;
    --sidebar-text-active: #ffffff;
    --topbar-bg: rgba(244, 243, 240, 0.85);

    --primary: #cc410b;
    --primary-rgb: 204, 65, 11;
    --primary-2: #e0650a;
    --primary-hover: #b93a0a;
    /* texto/ícones de destaque sobre fundo claro */
    --primary-dark: #a83409;
    --primary-soft: rgba(204, 65, 11, 0.1);
    --on-primary: #ffffff;

    --success: #15803d;
    --success-soft: rgba(21, 128, 61, 0.1);
    --warning: #b45309;
    --warning-soft: rgba(217, 119, 6, 0.12);
    --danger: #c62828;
    --danger-soft: rgba(198, 40, 40, 0.09);
    --info: #0369a1;
    --info-soft: rgba(3, 105, 161, 0.1);
    --purple: #6d28d9;
    --purple-soft: rgba(109, 40, 217, 0.1);

    --shadow: 0 12px 32px rgba(40, 30, 20, 0.1);
    --shadow-sm: 0 1px 3px rgba(40, 30, 20, 0.08);
}

/* Ponte: faz o Bootstrap (utilitários .text-primary, .border, .bg-*, focus, etc.)
   usar os nossos tokens. Declarada em :root para valer nos dois temas. */
:root,
[data-theme="dark"],
[data-theme="light"] {
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-body-color-rgb: var(--text-rgb);
    --bs-secondary-color: var(--text-muted);
    --bs-tertiary-bg: var(--bg-hover);
    --bs-border-color: var(--border);
    --bs-border-radius: 0.65rem;
    --bs-primary: var(--primary);
    --bs-primary-rgb: var(--primary-rgb);
    --bs-link-color: var(--primary-hover);
    --bs-link-hover-color: var(--primary-hover);
    --bs-link-color-rgb: var(--primary-rgb);
    --bs-emphasis-color: var(--text);
    --bs-heading-color: var(--text);
    --bs-focus-ring-color: var(--primary-soft);
    --bs-primary-bg-subtle: var(--primary-soft);
    --bs-primary-border-subtle: rgba(var(--primary-rgb), 0.45);
    --bs-primary-text-emphasis: var(--primary-hover);
    --bs-secondary-bg: var(--bg-hover);
}

/* ---------------------------------------------------------------------
   2. Base
   --------------------------------------------------------------------- */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: var(--fs-base);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text);
    letter-spacing: -0.01em;
}

a {
    color: var(--primary-hover);
}

a:hover {
    color: var(--primary-hover);
}

::selection {
    background: var(--primary-soft);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
    background-clip: padding-box;
    border: 2px solid transparent;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   3. Shell: sidebar, área principal, topbar
   --------------------------------------------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 268px;
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    z-index: 1030;
}

/* Selo do logo: o logo.png é BRANCO sobre transparente, então precisa de um fundo
   colorido nos dois temas (no claro, fundo branco o faria desaparecer). */
.brand-mark {
    width: 38px;
    height: 38px;
    padding: 7px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 14px -6px rgba(var(--primary-rgb), 0.7);
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-mark i {
    color: #fff;
    font-size: 1.2rem;
}

.brand-mark-lg {
    width: 68px;
    height: 68px;
    padding: 13px;
    border-radius: 20px;
    margin: 0 auto 1rem;
    display: flex;
}

.brand-mark-lg i {
    font-size: 2rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    height: 72px;
    padding: 0 1.15rem;
    flex-shrink: 0;
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
}

.sidebar-brand:hover {
    color: var(--text);
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: var(--fs-md);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.25rem 0.8rem 1rem;
}

.sidebar-section {
    text-transform: uppercase;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    padding: 1.1rem 0.85rem 0.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
}

.sidebar-section .count {
    background: var(--primary-soft);
    color: var(--primary-hover);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: var(--fs-xs);
    letter-spacing: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.62rem 0.85rem;
    margin-bottom: 3px;
    border-radius: 0.8rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: var(--fs-base);
    font-weight: 500;
    white-space: nowrap;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--text);
}

.sidebar-link.active {
    background-color: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
    box-shadow: 0 8px 18px -8px rgba(var(--primary-rgb), 0.65);
}

.sidebar-link.active:hover {
    background-color: var(--primary-dark);
    color: var(--on-primary);
}

.sidebar-link .sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-align: center;
    background: var(--warning-soft);
    color: var(--warning);
}

.sidebar-badge.is-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.sidebar-link.active .sidebar-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.project-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-project {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-weight: 400;
}

.sidebar-project .project-dot {
    margin: 0 6.5px;
}

/* Alça de recolher: círculo na borda direita do sidebar (desktop) */
.sidebar-collapse-handle {
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    position: absolute;
    top: 23px;
    right: -13px;
    box-shadow: var(--shadow-sm);
    padding: 0;
    font-size: var(--fs-xs);
    z-index: 2;
}

.sidebar-collapse-handle:hover {
    color: var(--primary-hover);
    border-color: var(--primary);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1025;
}

/* Modo recolhido (desktop): só ícones. A classe -init é aplicada no <head>
   antes do JS, para o menu já nascer recolhido (sem "flash"). */
html.sidebar-collapsed .app-sidebar,
html.sidebar-collapsed-init .app-sidebar {
    width: 80px;
}

html.sidebar-collapsed .sidebar-label,
html.sidebar-collapsed .sidebar-badge,
html.sidebar-collapsed .sidebar-section,
html.sidebar-collapsed .sidebar-brand-name,
html.sidebar-collapsed-init .sidebar-label,
html.sidebar-collapsed-init .sidebar-badge,
html.sidebar-collapsed-init .sidebar-section,
html.sidebar-collapsed-init .sidebar-brand-name {
    display: none;
}

html.sidebar-collapsed .sidebar-link,
html.sidebar-collapsed-init .sidebar-link {
    justify-content: center;
    padding: 0.65rem;
}

html.sidebar-collapsed .sidebar-brand,
html.sidebar-collapsed-init .sidebar-brand {
    justify-content: center;
    padding: 0;
}

html.sidebar-collapsed .sidebar-project .project-dot,
html.sidebar-collapsed-init .sidebar-project .project-dot {
    margin: 0;
}

html.sidebar-collapsed .sidebar-collapse-handle i,
html.sidebar-collapsed-init .sidebar-collapse-handle i {
    transform: rotate(180deg);
}

/* Área principal */
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex-grow: 1;
    min-width: 0;
}

.app-container {
    max-width: 1680px;
    margin-inline: auto;
}

/* Topbar */
.app-topbar {
    height: 72px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--bg);
    background: var(--topbar-bg);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    font-weight: 600;
    font-size: var(--fs-md);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    min-width: 0;
}

.topbar-brand:hover {
    color: var(--text);
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    position: relative;
    flex-shrink: 0;
    text-decoration: none;
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text);
    border-color: var(--border);
}

.btn-icon.btn-ghost {
    background: transparent;
    border-color: transparent;
}

.btn-icon.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-icon i {
    font-size: 1.05rem;
}

#themeIconLight,
#themeIconDark {
    font-size: var(--fs-md);
}

[data-theme="dark"] #themeIconDark {
    display: none;
}

[data-theme="light"] #themeIconLight {
    display: none;
}

/* Item de tema no menu do usuário (celular): mostra o ícone do tema para o qual vai trocar */
[data-theme="dark"] .theme-ico-dark,
[data-theme="light"] .theme-ico-light {
    display: none;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    transition: background-color 0.15s ease;
}

.user-chip:hover,
.user-chip.show {
    background: var(--bg-hover);
    color: var(--text);
}

.user-chip::after {
    display: none;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--fs-md-sm);
    flex-shrink: 0;
    text-transform: uppercase;
}

/* Abaixo de 576 px o nome e a seta somem: o chip vira só o avatar, circular. */
@media (max-width: 575.98px) {
    .user-chip {
        padding: 0.2rem;
        gap: 0;
    }
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
    min-width: 0;
}

.user-meta .name {
    font-size: var(--fs-md-sm);
    font-weight: 600;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta .role {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-hover);
    font-weight: 700;
}

.role-badge {
    background-color: var(--primary-soft);
    color: var(--primary-hover);
    font-size: var(--fs-xs);
    letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------
   4. Telas de autenticação
   --------------------------------------------------------------------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(60rem 36rem at 85% -10%, rgba(var(--primary-rgb), 0.28), transparent 60%),
        radial-gradient(40rem 30rem at -10% 110%, rgba(var(--primary-rgb), 0.16), transparent 60%),
        var(--bg);
}

.auth-top-actions {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.auth-card {
    width: 100%;
    max-width: 410px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1.4rem;
    box-shadow: var(--shadow);
    padding: 2.25rem 2rem;
}

/* ---------------------------------------------------------------------
   5. Componentes do Bootstrap reestilizados
   --------------------------------------------------------------------- */
.card {
    --bs-card-bg: var(--bg-card);
    --bs-card-border-color: var(--border);
    --bs-card-cap-bg: transparent;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
    color: var(--text);
}

.transition-hover {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.transition-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: rgba(var(--primary-rgb), 0.45);
}

.text-muted,
.text-secondary,
.text-body-secondary {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary-hover) !important;
}

.text-dark {
    color: var(--text) !important;
}

.bg-white {
    background-color: var(--bg-card) !important;
}

.bg-light {
    background-color: var(--bg-hover) !important;
}

.border,
.border-top,
.border-bottom,
.border-start,
.border-end {
    border-color: var(--border) !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

hr {
    border-color: var(--border);
    opacity: 1;
}

/* Tabelas */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--bg-hover);
    --bs-table-hover-color: var(--text);
    --bs-table-striped-bg: var(--bg-elevated);
    color: var(--text);
    margin-bottom: 0;
}

.table> :not(caption)>*>* {
    background-color: transparent;
    color: var(--text);
    border-color: var(--border);
    padding: 0.85rem 1rem;
}

/* Tabela compacta (ex.: Meus Atendimentos): menos espaço horizontal entre colunas; a Solicitação quebra linha */
.table.table-compacta> :not(caption)>*>* {
    padding: 0.5rem 0.6rem;
}

.table.table-compacta> :not(caption)>*>:first-child {
    padding-left: 1rem;
}

.table.table-compacta> :not(caption)>*>:last-child {
    padding-right: 1rem;
}

.table-compacta td {
    font-size: var(--fs-md-sm);
    line-height: 1.35;
}

.table-compacta td .badge {
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: 0.28em 0.6em;
}

/* Ocupa a largura do card: as colunas curtas ficam do tamanho do conteúdo (width 1% + nowrap) e a Solicitação
   usa o espaço que sobrar, quebrando em até 2 linhas (o texto longo termina em "…"). */
.table-compacta th:not(.col-solicitacao) {
    width: 1%;
}

.table-compacta .col-solicitacao {
    white-space: normal;
    min-width: 240px;
}

.table-compacta .sol-texto {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.table-light,
.table thead.table-light,
.table-light>*>* {
    --bs-table-bg: transparent;
    background-color: transparent !important;
    color: var(--text-muted) !important;
}

.table-hover>tbody>tr:hover>* {
    background-color: var(--bg-hover);
}

.table thead th {
    text-transform: uppercase;
    font-size: var(--fs-xs);
    letter-spacing: 0.07em;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border) !important;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    background-color: var(--bg-elevated);
}

/* Listas */
.list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-border-color: var(--border);
    --bs-list-group-color: var(--text);
    --bs-list-group-action-hover-bg: var(--bg-hover);
    --bs-list-group-action-hover-color: var(--text);
    --bs-list-group-action-active-bg: var(--bg-hover);
    --bs-list-group-action-color: var(--text);
    --bs-list-group-active-bg: var(--primary);
    --bs-list-group-active-border-color: var(--primary);
}

.list-group-item {
    background-color: transparent;
    color: var(--text);
    border-color: var(--border);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background-color: var(--bg-hover);
    color: var(--text);
}

.list-group-flush>.list-group-item {
    border-width: 0 0 1px;
}

.list-group-flush>.list-group-item:last-child {
    border-bottom-width: 0;
}

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.alert-success {
    background-color: var(--success-soft);
    color: var(--success);
    border-color: transparent;
}

.alert-danger {
    background-color: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.alert-warning {
    background-color: var(--warning-soft);
    color: var(--warning);
    border-color: transparent;
}

.alert-info {
    background-color: var(--info-soft);
    color: var(--info);
    border-color: transparent;
}

.alert-secondary,
.alert-light {
    background-color: var(--bg-hover);
    color: var(--text-muted);
    border-color: transparent;
}

.alert .alert-link {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.text-preserve-lines {
    white-space: pre-line;
    word-break: break-word;
}

/* Formulários */
.form-label {
    color: var(--text-muted);
    font-weight: 500;
}

.form-control,
.form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 0.7rem;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input);
    border-color: var(--primary);
    color: var(--text);
    box-shadow: 0 0 0 0.22rem var(--primary-soft);
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: var(--bg-hover);
    opacity: 0.8;
}

.form-control::placeholder {
    color: var(--text-faint);
}

.form-control-color {
    padding: 0.25rem;
}

.input-group-text {
    background-color: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-muted);
    border-radius: 0.7rem;
}

.form-text {
    color: var(--text-muted) !important;
}

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--text-faint);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.22rem var(--primary-soft);
    border-color: var(--primary);
}

/* Botões */
.btn {
    --bs-btn-border-radius: 0.7rem;
    --bs-btn-font-weight: 500;
    --bs-btn-focus-shadow-rgb: var(--primary-rgb);
}

.btn-primary {
    --bs-btn-color: var(--on-primary);
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-color: var(--on-primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-color: var(--on-primary);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-disabled-color: var(--on-primary);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
    box-shadow: 0 6px 16px -8px rgba(var(--primary-rgb), 0.7);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary-hover);
    --bs-btn-border-color: rgba(var(--primary-rgb), 0.55);
    --bs-btn-hover-color: var(--on-primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-color: var(--on-primary);
    --bs-btn-active-bg: var(--primary);
    --bs-btn-active-border-color: var(--primary);
}

.btn-secondary,
.btn-light {
    --bs-btn-color: var(--text);
    --bs-btn-bg: var(--bg-hover);
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: var(--border);
    --bs-btn-hover-border-color: var(--border);
    --bs-btn-active-color: var(--text);
    --bs-btn-active-bg: var(--border);
    --bs-btn-active-border-color: var(--border);
}

.btn-outline-secondary,
.btn-outline-light {
    --bs-btn-color: var(--text-muted);
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: var(--bg-hover);
    --bs-btn-hover-border-color: var(--border);
    --bs-btn-active-color: var(--text);
    --bs-btn-active-bg: var(--bg-hover);
    --bs-btn-active-border-color: var(--border);
}

.btn-outline-danger {
    --bs-btn-color: var(--danger);
    --bs-btn-border-color: rgba(var(--text-rgb), 0.18);
    --bs-btn-hover-bg: var(--danger);
    --bs-btn-hover-border-color: var(--danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--danger);
    --bs-btn-active-border-color: var(--danger);
    --bs-btn-active-color: #fff;
}

.btn-outline-success {
    --bs-btn-color: var(--success);
    --bs-btn-border-color: rgba(var(--text-rgb), 0.18);
    --bs-btn-hover-bg: var(--success);
    --bs-btn-hover-border-color: var(--success);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--success);
    --bs-btn-active-border-color: var(--success);
    --bs-btn-active-color: #fff;
}

.btn-outline-warning {
    --bs-btn-color: var(--warning);
    --bs-btn-border-color: rgba(var(--text-rgb), 0.18);
    --bs-btn-hover-bg: var(--warning);
    --bs-btn-hover-border-color: var(--warning);
    --bs-btn-hover-color: #111;
    --bs-btn-active-bg: var(--warning);
    --bs-btn-active-border-color: var(--warning);
    --bs-btn-active-color: #111;
}

.btn-link {
    color: var(--primary-hover);
}

.btn-group>.btn {
    --bs-btn-border-radius: 0.7rem;
}

.btn-group>.btn:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-group>.btn:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Badges: sempre "suaves" (cor translúcida + texto colorido), nos dois temas */
.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 0.5rem;
}

.text-bg-success,
.badge.bg-success {
    background-color: var(--success-soft) !important;
    color: var(--success) !important;
}

.text-bg-warning,
.badge.bg-warning {
    background-color: var(--warning-soft) !important;
    color: var(--warning) !important;
}

.text-bg-danger,
.badge.bg-danger {
    background-color: var(--danger-soft) !important;
    color: var(--danger) !important;
}

.text-bg-info,
.badge.bg-info {
    background-color: var(--info-soft) !important;
    color: var(--info) !important;
}

.text-bg-secondary,
.badge.bg-secondary {
    background-color: var(--bg-hover) !important;
    color: var(--text-muted) !important;
}

.text-bg-light,
.badge.bg-light {
    background-color: var(--bg-hover) !important;
    color: var(--text) !important;
}

.text-bg-primary,
.badge.bg-primary {
    background-color: var(--primary-soft) !important;
    color: var(--primary-hover) !important;
}

.badge.border {
    border-color: transparent !important;
}

/* Dropdown */
.dropdown-menu {
    --bs-dropdown-bg: var(--bg-card);
    --bs-dropdown-color: var(--text);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-link-color: var(--text);
    --bs-dropdown-link-hover-bg: var(--bg-hover);
    --bs-dropdown-link-hover-color: var(--text);
    --bs-dropdown-link-active-bg: var(--primary);
    --bs-dropdown-divider-bg: var(--border);
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 0.9rem;
    padding: 0.4rem;
}

.dropdown-item {
    color: var(--text);
    border-radius: 0.55rem;
    padding: 0.5rem 0.75rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--bg-hover);
    color: var(--text);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-soft);
}

.dropdown-item-text {
    color: var(--text-muted);
}

.dropdown-divider {
    border-color: var(--border);
}

/* Modal */
.modal-content {
    background-color: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 1.1rem;
    box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.modal-backdrop {
    --bs-backdrop-bg: #000;
    --bs-backdrop-opacity: 0.6;
}

/* Abas */
.nav-tabs {
    border-color: var(--border);
}

.tab-scroll-x {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-scroll-x::-webkit-scrollbar {
    display: none;
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.7rem 1.05rem;
    font-weight: 500;
    white-space: nowrap;
    background: transparent;
    margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
    color: var(--text);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    background: transparent;
    color: var(--primary-hover);
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
}

/* Progress, accordion, tooltip */
.progress {
    --bs-progress-bg: var(--bg-hover);
    --bs-progress-bar-bg: var(--primary);
    background-color: var(--bg-hover);
    border-radius: 999px;
}

.progress-bar {
    border-radius: 999px;
}

.accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-color: var(--text);
    --bs-accordion-border-color: var(--border);
    --bs-accordion-btn-color: var(--text);
    --bs-accordion-btn-bg: transparent;
    --bs-accordion-active-bg: var(--primary-soft);
    --bs-accordion-active-color: var(--primary-hover);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.22rem var(--primary-soft);
}

/* Utilitário de scroll para listas que podem crescer muito */
.scroll-list {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 2px;
}

/* Dashboard, "Meus Projetos Ativos" (só com mais de 6 projetos): mostra 6 cards antes de rolar.
   Celular = 1 coluna (6 linhas); a partir de md = 2 colunas (3 linhas). */
.scroll-list.scroll-projetos {
    max-height: 480px;
    overflow-x: hidden; /* a margem negativa do .row não pode criar rolagem horizontal */
}

@media (min-width: 768px) {
    .scroll-list.scroll-projetos {
        max-height: 236px;
    }
}

.cursor-pointer {
    cursor: pointer;
}

/* Botão "Voltar ao topo" (includes/footer.php; mostrado por initVoltarTopo() em app.js ao rolar a página) */
.voltar-topo {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1015;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.voltar-topo[hidden] {
    display: none;
}

.voltar-topo:hover {
    background: var(--primary-hover);
}

/* Busca rápida (modal da lupa da topbar; initBuscaRapida() em app.js) */
.busca-rapida-dialog {
    max-width: 560px;
}

.busca-rapida-grupo {
    margin-bottom: 0.75rem;
}

.busca-rapida-grupo h3 {
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.25rem;
}

.busca-rapida-item {
    display: flex;
    flex-direction: column;
    padding: 0.45rem 0.6rem;
    border-radius: 0.5rem;
    color: var(--text);
    text-decoration: none;
}

.busca-rapida-item:hover,
.busca-rapida-item:focus {
    background: var(--bg-hover);
    color: var(--text);
}

.busca-rapida-item .sub {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

/* Gestão Geral > Diagnóstico: menu de seções preso logo abaixo da topbar (72px; 62px no celular) */
.dg-menu-fixo {
    position: sticky;
    top: 72px;
    z-index: 1010;
    background: var(--bg);
    padding-top: 0.5rem;
    margin-bottom: 1.5rem; /* mesmo respiro do menu de abas do projeto (mb-4) */
}

.dg-menu-fixo ~ h2[id^="sec-"] {
    scroll-margin-top: 140px;
}

@media (max-width: 767.98px) {
    .dg-menu-fixo {
        top: 62px;
    }

    .dg-menu-fixo ~ h2[id^="sec-"] {
        scroll-margin-top: 130px;
    }
}

/* ---------------------------------------------------------------------
   6. KPI cards, hero e blocos do dashboard
   --------------------------------------------------------------------- */
.hero-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.25rem;
    padding: 1.6rem 1.75rem;
    color: #fff;
    background: linear-gradient(115deg, var(--primary) 0%, var(--primary-2) 100%);
    box-shadow: 0 18px 40px -20px rgba(var(--primary-rgb), 0.75);
}

.hero-card::before,
.hero-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    pointer-events: none;
}

.hero-card::before {
    width: 340px;
    height: 340px;
    right: -90px;
    top: -150px;
    box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.05), 0 0 0 70px rgba(255, 255, 255, 0.04);
}

.hero-card::after {
    width: 160px;
    height: 160px;
    right: 160px;
    bottom: -100px;
}

.hero-card h1,
.hero-card h2 {
    color: #fff;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.hero-card p {
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.hero-card>* {
    position: relative;
    z-index: 1;
}

.kpi-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.95rem;
    padding: 1.1rem 1.15rem;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.kpi-card .kpi-arrow {
    position: absolute;
    top: 0.8rem;
    right: 0.9rem;
    font-size: 0.85rem;
    color: var(--text-faint);
    transition: color 0.15s ease, transform 0.15s ease;
}

.kpi-card:hover .kpi-arrow {
    color: var(--primary-hover);
    transform: translate(2px, -2px);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.kpi-primary {
    background-image: linear-gradient(var(--primary-soft), var(--primary-soft));
}

.kpi-success {
    background-image: linear-gradient(var(--success-soft), var(--success-soft));
}

.kpi-warning {
    background-image: linear-gradient(var(--warning-soft), var(--warning-soft));
}

.kpi-danger {
    background-image: linear-gradient(var(--danger-soft), var(--danger-soft));
}

.kpi-info {
    background-image: linear-gradient(var(--info-soft), var(--info-soft));
}

.kpi-purple {
    background-image: linear-gradient(var(--purple-soft), var(--purple-soft));
}

.kpi-primary .kpi-icon {
    background: var(--primary);
    color: #fff;
}

.kpi-success .kpi-icon {
    background: var(--success);
    color: #fff;
}

.kpi-warning .kpi-icon {
    background: var(--warning);
    color: #fff;
}

.kpi-danger .kpi-icon {
    background: var(--danger);
    color: #fff;
}

.kpi-info .kpi-icon {
    background: var(--info);
    color: #fff;
}

.kpi-purple .kpi-icon {
    background: var(--purple);
    color: #fff;
}

[data-theme="dark"] .kpi-success .kpi-icon,
[data-theme="dark"] .kpi-warning .kpi-icon,
[data-theme="dark"] .kpi-danger .kpi-icon,
[data-theme="dark"] .kpi-info .kpi-icon,
[data-theme="dark"] .kpi-purple .kpi-icon {
    color: #111;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.05;
    color: var(--text);
    letter-spacing: -0.02em;
}

.kpi-label {
    font-size: var(--fs-md-sm);
    color: var(--text-muted);
    font-weight: 500;
}

/* Cabeçalho de widget (título + ação) */
.widget-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--fs-md);
    font-weight: 600;
    margin: 0;
}

.widget-title .icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary-hover);
    font-size: 0.95rem;
}

/* Linhas de projeto (dashboard) */
.project-row {
    display: block;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--bg-elevated);
    text-decoration: none;
    color: var(--text);
    height: 100%;
}

.project-row:hover {
    color: var(--text);
}

.project-row .progress {
    height: 6px;
}

/* Linha do tempo (atividade recente) */
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.activity-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.activity-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary-hover);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.activity-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.activity-time {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    white-space: nowrap;
}

/* ---------------------------------------------------------------------
   7. Kanban e task cards
   --------------------------------------------------------------------- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(250px, 1fr));
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.kanban-column {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    min-height: 200px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.kanban-column-title {
    font-weight: 700;
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.65rem;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.task-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    border-color: rgba(var(--primary-rgb), 0.4);
}

.task-card:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.5;
}

.priority-critica {
    border-left: 4px solid var(--danger);
}

.priority-alta {
    border-left: 4px solid var(--warning);
}

.priority-media {
    border-left: 4px solid var(--info);
}

.priority-baixa {
    border-left: 4px solid var(--success);
}

/* ---------------------------------------------------------------------
   8. Editor de texto rico em blocos (reconciliação com os tokens)
   --------------------------------------------------------------------- */
.richtext-editor-wrap .richtext-holder,
.richtext-viewer {
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    padding: 0.75rem 0.9rem;
    color: var(--text);
}

.richtext-viewer {
    padding: 0;
    background: transparent;
    border: none;
}

.codex-editor {
    color: var(--text);
}

.codex-editor__redactor {
    padding-bottom: 40px !important;
}

.ce-block__content,
.ce-toolbar__content {
    max-width: 100% !important;
}

.ce-paragraph,
.ce-header,
.cdx-block {
    color: var(--text);
}

.ce-paragraph[data-placeholder]::before {
    color: var(--text-faint);
}

.ce-toolbar__plus,
.ce-toolbar__settings-btn {
    color: var(--text-muted);
    background-color: var(--bg-card);
    border: 1px solid var(--border);
}

.ce-toolbar__plus:hover,
.ce-toolbar__settings-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text);
}

.ce-inline-toolbar,
.ce-conversion-toolbar,
.ce-settings,
.ce-popover,
.ce-popover__items,
.ce-popover-item {
    background-color: var(--bg-card) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.ce-popover-item:hover,
.ce-popover-item--focused {
    background-color: var(--bg-hover) !important;
}

.ce-popover-item__title {
    color: var(--text) !important;
}

.ce-popover-item__icon {
    background-color: var(--bg-elevated) !important;
}

.ce-inline-tool {
    color: var(--text) !important;
}

.ce-inline-tool:hover {
    background-color: var(--bg-hover) !important;
}

.cdx-settings-button:hover {
    background-color: var(--bg-hover) !important;
}

.tc-table,
.tc-row,
.tc-cell {
    border-color: var(--border) !important;
    color: var(--text);
}

.tc-add-row,
.tc-add-column {
    color: var(--text-muted) !important;
}

.cdx-warning {
    background-color: var(--warning-soft);
    border-color: var(--warning);
}

.cdx-warning__title,
.cdx-warning__message {
    color: var(--text) !important;
}

.cdx-quote__text,
.cdx-quote__caption {
    color: var(--text);
    background-color: var(--bg-card);
}

.cdx-marker {
    background-color: var(--warning-soft);
}

.ce-code__textarea {
    background-color: var(--bg-elevated) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.cdx-checklist__item-checkbox {
    border-color: var(--border);
}

.ce-delimiter::before {
    color: var(--text-faint);
}

/* ---------------------------------------------------------------------
   9. Banner de cronômetro, tabelas ordenáveis, fixes de tabela em card
   --------------------------------------------------------------------- */
.timer-banner-alert {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1.05rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(var(--primary-rgb), 0.45);
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.16), rgba(var(--primary-rgb), 0.06));
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.18s, transform 0.12s;
    margin-bottom: 0.9rem;
}

.timer-banner-alert:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    color: var(--text);
}

.timer-banner-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.05rem;
    flex-shrink: 0;
    animation: timerPulse 1.8s ease-in-out infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.5);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(var(--primary-rgb), 0);
    }
}

.timer-banner-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: hidden;
}

.timer-banner-title {
    font-size: var(--fs-md-sm);
    font-weight: 700;
    color: var(--primary-hover);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer-banner-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer-banner-time {
    font-size: var(--fs-base);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary-hover);
    white-space: nowrap;
    flex-shrink: 0;
}

.timer-banner-cta {
    font-size: var(--fs-md);
    color: var(--primary-hover);
    opacity: 0.7;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.15s;
}

.timer-banner-alert:hover .timer-banner-cta {
    opacity: 1;
    transform: translateX(3px);
}

.table-sortable th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.table-sortable th:hover {
    color: var(--primary-hover);
}

.table-sortable th::after {
    content: '\F284';
    font-family: 'bootstrap-icons' !important;
    opacity: 0.25;
    margin-left: 0.4rem;
    font-size: 0.8em;
    vertical-align: middle;
}

.table-sortable th.sort-asc::after {
    content: '\F282';
    opacity: 1;
    color: var(--primary-hover);
}

.table-sortable th.sort-desc::after {
    content: '\F27F';
    opacity: 1;
    color: var(--primary-hover);
}

.table-sortable th.no-sort {
    cursor: default;
}

.table-sortable th.no-sort:hover {
    color: inherit;
}

.table-sortable th.no-sort::after {
    display: none;
}

/* Tabelas dentro de card: cantos arredondados cortados e sem linha sobrando no rodapé */
.card>.table-responsive:first-child,
.card>.table-responsive:only-child {
    border-radius: inherit;
    overflow-x: auto;
}

.card>.table-responsive>.table>tbody>tr:last-child>td,
.card>.table-responsive>.table>tbody>tr:last-child>th,
.card .table>tbody>tr:last-child>td,
.card .table>tbody>tr:last-child>th {
    border-bottom: none;
}

.card .tab-pane>.table-responsive:first-child {
    overflow-x: auto;
}

.card:has(> .table-responsive:first-child) {
    overflow: hidden;
}

.card>.table-responsive {
    overflow-x: auto;
}

/* ---------------------------------------------------------------------
   10. Responsivo
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .app-topbar {
        padding: 0 1rem;
    }

    /* Celular e tablet: o menu lateral vira gaveta (off-canvas) e o conteúdo usa a largura toda. */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: -290px;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        width: 280px !important;
        transition: left 0.22s ease;
        box-shadow: none;
    }

    .app-sidebar.open {
        left: 0;
        box-shadow: var(--shadow);
    }

    .app-sidebar.open~.sidebar-backdrop,
    #sidebarBackdrop.show {
        display: block;
    }

    /* No celular o menu nunca aparece "recolhido" */
    html.sidebar-collapsed .app-sidebar .sidebar-label,
    html.sidebar-collapsed .app-sidebar .sidebar-badge,
    html.sidebar-collapsed .app-sidebar .sidebar-section,
    html.sidebar-collapsed .app-sidebar .sidebar-brand-name,
    html.sidebar-collapsed-init .app-sidebar .sidebar-label,
    html.sidebar-collapsed-init .app-sidebar .sidebar-badge,
    html.sidebar-collapsed-init .app-sidebar .sidebar-section,
    html.sidebar-collapsed-init .app-sidebar .sidebar-brand-name {
        display: revert;
    }

    html.sidebar-collapsed .app-sidebar .sidebar-link,
    html.sidebar-collapsed-init .app-sidebar .sidebar-link {
        justify-content: flex-start;
        padding: 0.62rem 0.85rem;
    }

    html.sidebar-collapsed .app-sidebar .sidebar-brand,
    html.sidebar-collapsed-init .app-sidebar .sidebar-brand {
        justify-content: flex-start;
        padding: 0 1.15rem;
    }

    html.sidebar-collapsed .app-sidebar,
    html.sidebar-collapsed-init .app-sidebar {
        width: 280px !important;
    }

    .sidebar-collapse-handle {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .app-topbar {
        height: 62px;
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        padding: 0.85rem;
        gap: 0.7rem;
    }

    .kpi-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
        border-radius: 12px;
    }

    .kpi-value {
        font-size: 1.4rem;
    }

    .kpi-card .kpi-arrow {
        display: none;
    }

    .hero-card {
        padding: 1.25rem;
        border-radius: 1.1rem;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
        border-radius: 1.2rem;
    }

    .table> :not(caption)>*>* {
        padding: 0.7rem 0.75rem;
    }

    .timer-banner-subtitle {
        display: none;
    }
}

/* Ribbon (Dobrinha) para Contrato de Manutenção */
.ribbon-manutencao {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    /* Faz um triângulo perfeito na ponta direita usando gradiente */
    background: linear-gradient(225deg, var(--primary) 50%, transparent 50%);
    z-index: 5;
    border-top-right-radius: inherit;
    /* Segue o arredondamento do card */
}

.ribbon-manutencao-icon {
    position: absolute;
    top: 5px;
    right: 0px;
    width: 20px;
    height: 20px;
    /* A cor de fundo será branca pura (para contrastar com var(--primary) laranja) */
    background-color: #ffffff;
    -webkit-mask-image: url('../img/icone-manutencao.png');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-image: url('../img/icone-manutencao.png');
    mask-size: 14px;
    mask-repeat: no-repeat;
}

/* Ícone de manutenção para uso inline (ex: ao lado do nome do cliente) */
.icon-manutencao-inline {
    display: inline-block;
    width: 22px;
    height: 22px;
    background-color: var(--primary);
    /* A cor principal do tema */
    -webkit-mask-image: url('../img/icone-manutencao.png');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-image: url('../img/icone-manutencao.png');
    mask-size: contain;
    mask-repeat: no-repeat;
    vertical-align: middle;
}

/* ------------------------------------------------------------------
   Notificações: sino da topbar, menu e lista (includes/header.php, pages/notificacoes.php)
   ------------------------------------------------------------------ */
.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
    pointer-events: none;
}

.notif-menu {
    width: 380px;
    max-width: calc(100vw - 24px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Celular: o menu ocupa a largura da tela (margem de 12 px) logo abaixo da topbar, em vez de ficar preso ao sino. */
@media (max-width: 575.98px) {
    .notif-menu {
        position: fixed !important;
        inset: 68px 12px auto 12px !important;
        width: auto;
        max-width: none;
        transform: none !important;
    }

    .notif-menu .btn-link {
        min-height: 0;
    }

    .notif-menu .btn-outline-primary {
        min-height: 36px;
    }
}

.notif-lista {
    max-height: min(420px, 60vh);
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.notif-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.notif-nao-lida {
    background: var(--primary-soft);
}

.notif-icone {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-corpo {
    min-width: 0;
}

.notif-msg {
    overflow-wrap: anywhere;
}

.notif-quando {
    font-size: var(--fs-xs);
}

.notif-destinatarios {
    max-height: 340px;
    overflow-y: auto;
}

.notif-dest {
    cursor: pointer;
}

.notif-dest:hover {
    background: var(--bg-hover);
}

/* =====================================================================
   Anotações (views/notes/index.php, public/js/anotacoes.js, gaveta global)
   ===================================================================== */
.notes-app [hidden],
.note-drawer [hidden],
.note-picker[hidden] {
    display: none !important;
}

.notes-app {
    display: grid;
    grid-template-columns: minmax(290px, 370px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.notes-list-col,
.notes-detail-col {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.notes-list-col {
    position: sticky;
    top: 0.5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
}

.notes-detail-col {
    min-height: 60vh;
}

.notes-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.notes-capture {
    position: relative;
    margin-bottom: 0.6rem;
}

.notes-capture > i,
.notes-search > i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    pointer-events: none;
}

.notes-capture .form-control {
    padding-left: 2.2rem;
    background: var(--bg-input);
    border-color: var(--primary);
}

.notes-search {
    position: relative;
    margin-bottom: 0.6rem;
}

.notes-search .form-control {
    padding-left: 2.2rem;
}

.notes-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.notes-filter {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: var(--fs-sm);
    cursor: pointer;
}

.notes-filter:hover {
    background: var(--bg-hover);
}

.notes-filter.active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--text);
}

.notes-filter-badge {
    display: inline-block;
    min-width: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--primary);
    color: var(--on-primary);
    font-size: var(--fs-xs);
    text-align: center;
}

.notes-grupo {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    margin: 0.6rem 0 0.3rem;
}

.note-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.45rem;
    background: var(--bg-elevated);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.note-card:hover,
.note-card:focus-visible {
    background: var(--bg-hover);
    outline: none;
}

.note-card.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.note-card.has-cor {
    border-left: 4px solid var(--note-cor);
}

.note-card-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.note-card-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card.is-unread .note-card-title {
    color: var(--primary-hover);
}

.note-card-ic {
    color: var(--text-muted);
    font-size: var(--fs-md-sm);
}

.note-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.note-card-snippet {
    font-size: var(--fs-md-sm);
    color: var(--text-muted);
    margin-top: 0.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.note-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    font-size: var(--fs-sm);
    color: var(--text-faint);
}

.note-avatars {
    display: inline-flex;
}

.note-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 2px solid var(--bg-elevated);
    color: var(--text);
    font-size: var(--fs-xs);
    font-weight: 600;
    margin-left: -0.35rem;
    flex-shrink: 0;
}

.note-avatars .note-avatar:first-child {
    margin-left: 0;
}

.note-avatar.is-dono {
    background: var(--primary);
    color: var(--on-primary);
}

.notes-reminders {
    border: 1px solid var(--warning);
    background: var(--warning-soft);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.7rem;
}

.notes-reminders-tit {
    font-size: var(--fs-sm);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--warning);
    margin-bottom: 0.3rem;
}

.notes-reminder {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
}

.notes-reminder-tit {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.notes-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 4rem 1rem;
}

.notes-empty i {
    font-size: 2.5rem;
    color: var(--text-faint);
    display: block;
    margin-bottom: 0.5rem;
}

/* Painel do editor */
.note-panel {
    position: relative;
}

.note-panel.has-cor {
    border-top: 4px solid var(--note-cor);
    border-radius: 2px;
    padding-top: 0.6rem;
}

.note-panel-top {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.note-title {
    flex: 1;
    min-width: 0;
    border: 0;
    border-bottom: 1px solid transparent;
    background: transparent;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 700;
    padding: 0.2rem 0;
}

.note-title:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.note-status {
    font-size: var(--fs-sm);
    color: var(--text-faint);
    white-space: nowrap;
}

.note-status.is-ok { color: var(--success); }
.note-status.is-warn { color: var(--warning); }
.note-status.is-erro { color: var(--danger); }

.note-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.5rem 0;
}

.note-tool {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: var(--fs-md-sm);
    cursor: pointer;
}

.note-tool:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text);
}

.note-tool:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.note-tool.active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--text);
}

.note-tool.is-vencido {
    border-color: var(--danger);
    color: var(--danger);
}

.gg-popover {
    min-width: min(20rem, 92vw);
}

.gg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35em 0.7em;
}

.gg-chip-x {
    display: inline-flex;
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1;
}

.gg-chip-x:hover {
    color: var(--danger);
}

.note-tool[hidden] {
    display: none;
}

.note-tool-excluir:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
}

.note-tool-n {
    font-size: var(--fs-sm);
}

.note-tool-fechar {
    margin-left: auto;
}

.note-pop {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 0.7rem;
    margin-bottom: 0.6rem;
}

.note-cores {
    display: flex;
    gap: 0.4rem;
}

.note-cor {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    border: 2px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
}

.note-cor.active {
    border-color: var(--primary);
}

.note-banner {
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.6rem;
    font-size: var(--fs-base);
}

.note-banner-conflito {
    border: 1px solid var(--warning);
    background: var(--warning-soft);
}

.note-banner-lembrete {
    border: 1px solid var(--info);
    background: var(--info-soft);
}

.note-parts {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
}

.note-parts li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.note-parts .note-avatar {
    margin-left: 0;
    border-color: var(--bg-elevated);
}

.note-part-nome {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-parts-res {
    margin-top: 0.3rem;
    max-height: 160px;
    overflow-y: auto;
}

.note-parts-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--text);
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
}

.note-parts-item:hover {
    background: var(--bg-hover);
}

.note-editor-wrap {
    min-height: 40vh;
}

.note-editor-wrap .notion-editor-container {
    /* Espaço à esquerda para os controles "+" e "arrastar" dos blocos (mesmo recuo de .richtext-editor-wrap). */
    padding-left: 54px !important;
    padding-right: 12px !important;
    padding-bottom: 3rem;
}

.note-foot {
    font-size: var(--fs-sm);
    color: var(--text-faint);
    margin: 0.5rem 0 0;
}

/* Chips de menção dentro do editor */
.note-chip {
    display: inline-block;
    padding: 0 0.4rem;
    border-radius: 0.4rem;
    font-size: 0.92em;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    cursor: pointer;
    user-select: all;
    background: var(--primary-soft);
    color: var(--text);
    border: 1px solid transparent;
}

.note-chip-user { background: var(--info-soft); cursor: default; }
.note-chip-project { background: var(--primary-soft); }
.note-chip-client { background: var(--purple-soft); }
.note-chip-task { background: var(--success-soft); }
.note-chip-atendimento { background: var(--warning-soft); }

.note-chip-semacesso {
    background: transparent;
    border: 1px dashed var(--text-faint);
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.note-chip:not(.note-chip-user):not(.note-chip-semacesso):hover {
    border-color: var(--primary);
}

/* Seletor "@" e avisos (ficam acima da gaveta e dos menus do editor) */
.note-picker {
    position: fixed;
    z-index: 100000;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 0.25rem;
}

.note-picker-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.note-picker-item.active,
.note-picker-item:hover {
    background: var(--bg-hover);
}

.note-picker-corpo {
    min-width: 0;
}

.note-picker-label {
    font-size: var(--fs-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-picker-sub {
    font-size: var(--fs-sm);
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-picker-aviso {
    padding: 0.5rem 0.6rem;
    font-size: var(--fs-md-sm);
    color: var(--text-muted);
}

.notes-toasts {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(420px, calc(100vw - 2rem));
}

.notes-toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 0.6rem 0.8rem;
    font-size: var(--fs-md-sm);
}

.notes-toast.is-danger { border-left-color: var(--danger); }
.notes-toast.is-warn { border-left-color: var(--warning); }

/* Gaveta global */
.note-drawer {
    width: min(560px, 100vw) !important;
    background: var(--bg-card);
    color: var(--text);
}

.note-drawer .offcanvas-header {
    border-bottom: 1px solid var(--border);
}

.note-drawer .note-panel {
    padding: 0.75rem 1rem 1rem;
}

.note-drawer-list {
    border-top: 1px solid var(--border);
    padding: 0.75rem 1rem 1.25rem;
}

/* Celular: lista OU editor, nunca os dois */
@media (max-width: 767.98px) {
    .notes-app {
        grid-template-columns: minmax(0, 1fr);
    }

    .notes-list-col {
        position: static;
        max-height: none;
    }

    .notes-detail-col {
        display: none;
        padding: 0.75rem;
    }

    .notes-app.detail-open .notes-list-col {
        display: none;
    }

    .notes-app.detail-open .notes-detail-col {
        display: block;
    }

    .note-title {
        font-size: var(--fs-md);
    }
}

/* ---------------------------------------------------------------------
   11. Minhas Tasks e modal de task
   Tela /minhas-tasks (barra de filtros, lista agrupada, kanban,
   iniciais dos responsáveis) e modal de task em duas colunas
   (views/projects/_task_modal_corpo.php) com a tela cheia ligada por
   public/js/app.js (initTaskModalFullscreen()).
   --------------------------------------------------------------------- */

/* ---------- Minhas Tasks: barra de filtros ---------- */
.mt-barra {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    align-items: center;
    gap: .5rem;
    padding: .65rem .75rem;
    margin-bottom: 1rem;
}

.mt-barra .form-control, .mt-barra .form-select, .mt-barra .input-group-text, .mt-barra .btn {
    font-size: var(--fs-md-sm);
}

.mt-barra .mt-busca {
    grid-column: span 2;
}

.mt-barra .input-group-text {
    color: var(--text-muted);
    background: transparent;
}

.mt-barra .mt-fim {
    display: flex;
    justify-content: flex-end;
}

/* ---------- Lista ---------- */
.mt-tabela {
    margin: 0;
}

.mt-tabela thead th {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.mt-tabela tbody td {
    padding: .6rem .9rem;
    font-size: var(--fs-base);
    vertical-align: middle;
}

.mt-tabela .mt-titulo {
    white-space: normal;
    min-width: 260px;
    max-width: 480px;
    line-height: 1.35;
    font-weight: 500;
}

.mt-tabela .mt-projeto {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fs-md-sm);
}

.mt-tabela tr.mt-grupo > td {
    background: var(--bg-elevated);
    padding: .5rem .9rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 4px 0 0 var(--mt-cor);
    cursor: pointer;
    user-select: none;
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.mt-tabela tbody tr:first-child.mt-grupo > td {
    border-top: 0;
}

.mt-tabela tr[data-modal] {
    cursor: pointer;
}

.mt-tabela tr[draggable="true"] {
    cursor: grab;
}

.mt-tabela tr.mt-arrastando {
    opacity: .4;
}

.mt-tabela tr.mt-grupo.mt-alvo > td {
    background: rgba(var(--primary-rgb), .14);
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}

.mt-qtd {
    display: inline-block;
    margin-left: .5rem;
    padding: .05rem .55rem;
    border-radius: 999px;
    background: rgba(128, 128, 128, .18);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    letter-spacing: 0;
}

.mt-tabela .badge {
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: .4em .75em;
}

.mt-status-sel {
    width: 142px;
    margin: 0 auto;
    font-size: var(--fs-md-sm);
    padding-top: .25rem;
    padding-bottom: .25rem;
    border-left: 4px solid var(--mt-cor);
}

.mt-status-ro {
    display: block;
    border: 1px solid var(--border);
    border-left: 4px solid var(--mt-cor);
    border-radius: var(--bs-border-radius, .375rem);
    padding: .25rem .75rem;
    text-align: left;
    color: var(--text-muted);
}

/* ---------- Responsáveis (iniciais sobrepostas) ---------- */
.mt-avs {
    display: inline-flex;
    align-items: center;
}

.mt-av {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #64748b;
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    box-shadow: 0 0 0 2px var(--bg-card);
}

.mt-av + .mt-av {
    margin-left: -7px;
}

.mt-av-mais {
    background: var(--bg-elevated);
    color: var(--text-muted);
    box-shadow: 0 0 0 2px var(--bg-card), inset 0 0 0 1px var(--border);
}

/* ---------- Kanban ---------- */
.mt-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: .9rem;
    align-items: stretch;
    overflow-x: auto;
    padding-bottom: .5rem;
    /* Altura limitada ao que cabe na tela: cada coluna rola por dentro (o JS de Minhas Tasks ajusta a altura exata). */
    grid-template-rows: minmax(0, 1fr);
    height: calc(100vh - 21rem);
    min-height: 320px;
}

.mt-col {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .65rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.mt-col[data-status="done"] .mt-card {
    opacity: .8;
}

.mt-col-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .15rem .25rem .6rem;
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.mt-col-head .mt-ponto {
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    background: var(--mt-cor);
    flex: none;
}

.mt-col-head .mt-qtd {
    margin-left: auto;
}

.mt-cards {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    flex: 1 1 0;
    min-height: 120px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: .6rem;
    padding: .15rem;
    transition: background-color .12s ease;
}

.mt-col.mt-over {
    border-color: var(--primary);
}

.mt-col.mt-over .mt-cards {
    background: rgba(var(--primary-rgb), .08);
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}

.mt-vazio {
    margin: auto;
    padding: 1rem;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    text-align: center;
}

.mt-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--mt-cor);
    border-radius: .7rem;
    padding: .65rem .75rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow .12s ease, border-color .12s ease;
}

.mt-card[draggable="true"] {
    cursor: grab;
}

.mt-card:hover {
    box-shadow: var(--shadow);
}

.mt-card.mt-arrastando {
    opacity: .45;
}

.mt-card-titulo {
    font-size: var(--fs-md-sm);
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.mt-card-proj {
    margin-top: .4rem;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-card-rodape {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .6rem;
    font-size: var(--fs-sm);
}

.mt-card-rodape .mt-avs {
    margin-left: auto;
}

.mt-nota {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    padding: .35rem .25rem 0;
}

/* ---------- Modal de task (duas colunas) ---------- */

.task-modal .modal-header {
    padding: .65rem 1rem;
    align-items: center;
}

.task-modal .modal-body {
    padding: 0;
}

.task-modal-grade {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    min-height: 100%;
}

.task-modal-main {
    padding: 1.25rem 1.5rem 1.5rem;
    min-width: 0;
}

.task-modal-lateral {
    padding: 1.25rem;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
}

.task-modal-titulo {
    display: block;
    width: 100%;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.25;
    color: inherit;
    background: transparent;
    border: 2px solid transparent;
    border-radius: .5rem;
    padding: .35rem .6rem;
    margin: 0 0 .25rem -.6rem;
    width: calc(100% + .6rem);
}

textarea.task-modal-titulo {
    resize: none;
    overflow: hidden;
}

.task-modal-titulo:hover:not([readonly]) {
    background: rgba(128, 128, 128, .12);
}

.task-modal-titulo:focus {
    outline: 0;
    background: var(--bg-card);
    border-color: var(--primary);
}

.task-modal-secao {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 1.25rem 0 .6rem;
    font-size: var(--fs-base);
    font-weight: 700;
}

.task-modal-secao i {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.task-modal-lateral .task-modal-secao {
    margin-top: 0;
    font-size: var(--fs-sm);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.task-modal-lateral .task-modal-secao i {
    font-size: .9rem;
}

.task-modal-campo {
    margin-bottom: 1rem;
}

.task-modal-campo > .form-label {
    margin-bottom: .3rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-muted);
}

.task-modal-projeto {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .65rem;
    border: 1px solid var(--border);
    border-radius: .5rem;
    background: var(--bg-card);
    font-size: var(--fs-md-sm);
}

.task-modal-lateral .form-select, .task-modal-lateral .form-control {
    font-size: var(--fs-md-sm);
}

.task-modal .richtext-holder {
    min-height: 240px;
}

.modal-fullscreen .task-modal .richtext-holder {
    min-height: 55vh;
}

@media (max-width: 991.98px) {
    .task-modal-grade {
        grid-template-columns: minmax(0, 1fr);
    }
    .task-modal-lateral {
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}

/* ---------- Histórico interno da task (só admin/gestor) ---------- */
.task-modal-secao-historico {
    margin-top: 1.25rem;
}

.task-historico {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: .5rem;
    background: var(--bg-card);
    padding: .25rem .65rem;
    font-size: var(--fs-sm);
}

.task-historico-item {
    position: relative;
    padding: .5rem 0 .5rem .9rem;
    border-bottom: 1px solid var(--border);
}

.task-historico-item:last-child {
    border-bottom: 0;
}

.task-historico-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: .85rem;
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: var(--primary);
}

.task-historico-texto {
    line-height: 1.3;
    word-break: break-word;
}

.task-historico-meta {
    margin-top: .1rem;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.task-historico-vazio {
    padding: .4rem 0;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------------
   12. Revisão de layout: títulos, botões, rolagem, cabeçalho de página e celular
   Tamanhos de texto vêm da escala --fs-* (seção 1). Regras do celular ficam no fim, em < 768 px.
   --------------------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

h1.h4 {
    font-size: var(--fs-xl);
}

h1.h5,
h2.h5 {
    font-size: var(--fs-lg);
}

.btn-sm {
    min-height: 32px;
}

.sidebar-collapse-handle {
    width: 32px;
    height: 32px;
    right: -16px;
}

/* Item de página selecionado (lista da Wiki e listas de pessoas/projetos de Acessos): fundo suave + barra lateral,
   em vez de um bloco laranja cheio. */
.list-group-item.active {
    background-color: var(--primary-soft);
    border-color: var(--border);
    box-shadow: inset 3px 0 0 var(--primary);
    color: var(--text);
}

.list-group-item.active .opacity-75 {
    opacity: 1 !important;
    color: var(--text-muted);
}

/* Lembretes vencidos das Anotações: botões numa linha só. */
.notes-reminder .btn,
.notes-reminder button {
    white-space: nowrap;
}

.hero-card {
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
}

/* Cartão de projeto/cliente: nome do cliente e do grupo quebram em até 2 linhas, em vez de cortar. */
.project-card-container .text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 991.98px) {
    /* Tablet: tabelas em cartões também a partir da largura em que o menu vira gaveta não é necessário; só afrouxa colunas. */
    .table-compacta th:nth-child(n+8),
    .table-compacta td:nth-child(n+8) {
        white-space: normal;
    }
}

@media (max-width: 767.98px) {
    :root {
        --fs-xs: 0.6875rem;
        --fs-sm: 0.75rem;
        --fs-md-sm: 0.8125rem;
        --fs-base: 0.875rem;
    }

    h1.h4 {
        font-size: 1.375rem;
    }

    /* Alvos de toque de 40 px (36 px nos botões pequenos) e campos com 16 px (o iPhone amplia a tela ao focar campo menor).
       Botão e link-botão centralizam o conteúdo (um <a class="btn"> é inline-block e deixava o texto colado no topo). */
    .btn:not(.btn-close):not(.btn-icon),
    .btn-sm:not(.btn-close):not(.btn-icon) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    .btn:not(.btn-close):not(.btn-icon) {
        min-height: 40px;
    }

    .btn-sm:not(.btn-close):not(.btn-icon) {
        min-height: 36px;
    }

    .form-control,
    .form-select,
    .input-group-text {
        min-height: 40px;
        font-size: 16px;
    }

    .form-control-sm,
    .form-select-sm {
        min-height: 38px;
        font-size: 16px;
    }

    textarea.form-control {
        min-height: 88px;
    }

    .form-label {
        margin-bottom: 0.25rem;
    }

    .nav-tabs .nav-link {
        min-height: 40px;
        display: flex;
        align-items: center;
    }

    /* Botões do cabeçalho do app e de listas: um pouco menores para caber na tela sem apertar. */
    .btn-icon {
        width: 38px;
        height: 38px;
        border-radius: 0.7rem;
    }

    /* Botões dentro de tabelas: compactos, para as colunas de ações não ficarem largas e altas. */
    .table .btn,
    .table .btn-sm {
        min-height: 34px;
        min-width: 34px;
        padding: 0 0.5rem;
        line-height: 1;
    }

    /* Colunas: largura do conteúdo, sem os mínimos fixos de desktop (a tabela ainda rola na horizontal se precisar). */
    .table th[style*="min-width"] {
        min-width: 0 !important;
    }

    .table> :not(caption)>*>* {
        padding: 0.55rem 0.6rem;
    }

    .table thead th {
        letter-spacing: 0.04em;
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }

    .card-body {
        padding: 0.9rem;
    }

    .notes-filter {
        min-height: 36px;
    }

    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
    }

    /* Cabeçalho de página: título em cima, ações embaixo em linha. */
    .page-head {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .page-head > :last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-head > :last-child > .btn,
    .page-head > :last-child > form {
        flex: 0 0 auto;
    }
    /* Botão de voltar ao topo: menor e discreto. */
    #voltarTopo {
        width: 40px;
        height: 40px;
        opacity: 0.8;
    }

    /* Tasks: seletor de visão só com ícones e "Nova Task" ocupando o resto da linha. */
    .tasks-barra-visao {
        flex-wrap: nowrap !important;
    }

    .tasks-barra-visao > .btn-primary {
        flex: 1 1 auto;
    }

    /* Projeto: ações do cabeçalho ocupam a linha toda. */
    .projeto-acoes {
        width: 100%;
    }

    .projeto-acoes > .btn:first-child {
        flex: 1 1 auto;
    }

    /* Kanban: colunas de 85% da largura, com a próxima "espiando" na borda. */
    .mt-board,
    .kanban-board {
        grid-auto-flow: column;
        grid-auto-columns: 85%;
        grid-template-columns: none;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }

    .mt-col,
    .kanban-column {
        scroll-snap-align: start;
        min-height: 0;
    }
}

@media (max-width: 767.98px) {
    /* Cabeçalho do app: só o logo (o nome do sistema cortado como "Marc…" não ajuda). */
    .topbar-brand .text-truncate {
        display: none;
    }

    /* Anotações: filtros em uma linha com rolagem lateral. */
    .notes-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }

    .notes-filters .notes-filter {
        flex: 0 0 auto;
    }
}

/* Badges e texto auxiliar na escala: o Bootstrap usa .75em/.875em (10,5 px e 12,25 px dentro de um texto de 14 px). */
.badge {
    font-size: var(--fs-xs);
}

.small,
small {
    font-size: var(--fs-sm);
}


.task-modal-titulo::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Lista de páginas da Wiki: no celular rola por dentro (não empurra o texto para baixo). */
@media (max-width: 767.98px) {
    .wiki-paginas {
        max-height: 11rem;
        overflow-y: auto;
    }

    /* Cartões de projeto/cliente mais compactos. */
    .project-card-container .card.p-3 {
        padding: 0.85rem !important;
    }

    /* Links soltos no cabeçalho de página com área de toque maior. */
    .page-head p a {
        display: inline-block;
        padding: 0.4rem 0;
    }
}

.notes-empty {
    font-size: var(--fs-base);
}

/* "Mais filtros" de Projetos: mesmo aspecto dos selects vizinhos. */
.filtros-mais-btn {
    background-color: var(--bg-input);
    border-color: var(--border);
    color: var(--text);
    font-weight: 400;
    text-align: left;
}

/* Kanban: o quadro e as colunas viram o "pai posicionado" dos textos .visually-hidden (position: absolute) dos cards;
   sem isso eles escapam da rolagem interna e aumentam a altura da página (rolagem extra). */
.mt-board,
.mt-cards,
.kanban-board {
    position: relative;
}
