/* ═══════════════════════════════════════════════════════
   TITAN CORE — Design System CSS
   The Analytical Atelier · v1.0
   ═══════════════════════════════════════════════════════ */

/* ── Google Fonts fallback (já carregado no header.php) ── */

/* ──────────────────────────────────────────────────────────
   1. DESIGN TOKENS — CSS Variables
   ────────────────────────────────────────────────────────── */
:root {
    /* Primárias */
    --tc-primary:       #000613;
    --tc-primary-c:     #001f3f;
    --tc-accent:        #4586e2;
    --tc-accent-dim:    #6f88ad;

    /* Superfícies */
    --tc-bg:            #f7f9fb;
    --tc-surface:       #ffffff;
    --tc-surface-low:   #f2f4f6;
    --tc-surface-c:     #eceef0;
    --tc-surface-high:  #e6e8ea;

    /* Texto */
    --tc-on-surface:    #191c1e;
    --tc-muted:         #74777f;
    --tc-on-accent:     #ffffff;

    /* Bordas */
    --tc-outline:       #dfe2e8;   /* hairline mais suave (era #c4c6cf) */

    /* Semânticas */
    --tc-success:       #10b981;
    --tc-warning:       #f59e0b;
    --tc-danger:        #ba1a1a;
    --tc-info:          #4586e2;

    /* Sidebar */
    --tc-sidebar-bg:    #ffffff;
    --tc-sidebar-text:  #191c1e;
    --tc-sidebar-muted: #74777f;
    --tc-sidebar-hover: #eceef0;
    --tc-sidebar-active:#f2f4f6;

    /* Header */
    --tc-topbar-bg:     rgba(255,255,255,0.88);

    /* Footer */
    --tc-footer-bg:     #f2f4f6;
    --tc-footer-text:   #74777f;

    /* Sombras */
    /* Sombras ambientes em camadas — mais difusas e suaves */
    --tc-shadow:        0 1px 2px rgba(16,24,40,0.04), 0 10px 28px rgba(16,24,40,0.07);
    --tc-shadow-sm:     0 1px 2px rgba(16,24,40,0.05), 0 1px 3px rgba(16,24,40,0.06);
    --tc-shadow-primary:0 8px 24px rgba(69,134,226,0.28);

    /* Dimensões */
    --tc-sidebar-w:     260px;
    --tc-sidebar-cw:    64px;
    --tc-header-h:      64px;
    --tc-footer-h:      52px;

    /* Forma */
    --tc-radius:        8px;    /* cantos um pouco mais suaves (era 6px) */
    --tc-radius-md:     12px;   /* (era 10px) */
    --tc-radius-lg:     16px;   /* (era 14px) */
    --tc-radius-xl:     20px;
    --tc-radius-full:   999px;

    /* Tipografia */
    --tc-font:          'DM Sans', system-ui, sans-serif;

    /* Transição */
    --tc-ease:          cubic-bezier(0.4, 0, 0.2, 1);
    --tc-transition:    all 0.28s var(--tc-ease);
}

/* Dark Mode */
html.dark {
    --tc-bg:            #0e1420;
    --tc-surface:       #131a28;
    --tc-surface-low:   #1a2333;
    --tc-surface-c:     #20293b;
    --tc-surface-high:  #283246;

    --tc-on-surface:    #eceef2;
    --tc-muted:         #8b95a8;
    --tc-outline:       #2f3648;

    --tc-sidebar-bg:    #0d121e;
    --tc-sidebar-text:  #eceef2;
    --tc-sidebar-muted: #8b95a8;
    --tc-sidebar-hover: rgba(255,255,255,0.05);
    --tc-sidebar-active:rgba(175,200,240,0.12);

    --tc-topbar-bg:     rgba(14,20,32,0.92);
    --tc-footer-bg:     #0d121e;
    --tc-footer-text:   #6b7488;
}

/* ──────────────────────────────────────────────────────────
   2. RESET & BASE
   ────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--tc-font);
    background: var(--tc-bg);
    color: var(--tc-on-surface);
    font-size: 14px;
    line-height: 1.5;
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--tc-font); border: none; background: none; }
input, select, textarea { font-family: var(--tc-font); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tc-outline); border-radius: 99px; }

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    flex-shrink: 0;
}
.tc-icon-filled {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Utilitários */
.tc-truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ──────────────────────────────────────────────────────────
   3. LAYOUT — App Shell
   ────────────────────────────────────────────────────────── */

/* Shell raiz */
.tc-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Wrapper sidebar + conteúdo */
.tc-main-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    margin-left: var(--tc-sidebar-w);
    transition: margin-left 0.28s var(--tc-ease);
    height: 100vh;
    overflow: hidden;
}

/* Quando sidebar está colapsada */
html.tc-sidebar-collapsed .tc-main-wrapper {
    margin-left: var(--tc-sidebar-cw);
}

/* Main content area */
.tc-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px;
    background: var(--tc-bg);
}

/* ──────────────────────────────────────────────────────────
   4. SIDEBAR
   ────────────────────────────────────────────────────────── */
.tc-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--tc-sidebar-w);
    background: var(--tc-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--tc-transition);
    box-shadow: var(--tc-shadow);
    overflow: visible;
}

/* Estado colapsado */
html.tc-sidebar-collapsed .tc-sidebar {
    width: var(--tc-sidebar-cw);
}

/* Brand */
.tc-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    height: var(--tc-header-h);
    border-bottom: 1px solid var(--tc-outline);
    flex-shrink: 0;
    overflow: hidden;
}

.tc-sidebar__logo {
    width: 34px;
    height: 34px;
    border-radius: var(--tc-radius-md);
    background: linear-gradient(135deg, var(--tc-primary-c) 0%, var(--tc-accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(69,134,226,0.35);
}

.tc-sidebar__brand-text {
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.18s, width 0.28s var(--tc-ease);
}

.tc-sidebar__site-name {
    display: block;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--tc-sidebar-text);
    line-height: 1.1;
    text-transform: uppercase;
}

.tc-sidebar__site-slogan {
    display: block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--tc-sidebar-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

html.tc-sidebar-collapsed .tc-sidebar__brand-text {
    opacity: 0;
    width: 0;
}

/* Botão toggle desktop */
.tc-sidebar__toggle-btn {
    position: absolute;
    top: 70px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--tc-surface);
    border: 1.5px solid var(--tc-outline);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tc-muted);
    box-shadow: var(--tc-shadow-sm);
    z-index: 101;
    transition: var(--tc-transition);
}
.tc-sidebar__toggle-btn:hover {
    background: var(--tc-surface-c);
    color: var(--tc-on-surface);
}
.tc-sidebar__toggle-btn .material-symbols-outlined { font-size: 14px; }

/* Rótulo de seção */
.tc-sidebar__section-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--tc-sidebar-muted);
    padding: 12px 18px 4px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.18s;
}
html.tc-sidebar-collapsed .tc-sidebar__section-label { opacity: 0; }

/* Nav */
.tc-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
}

/* Item de nav */
.tc-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--tc-radius-md);
    color: var(--tc-sidebar-muted);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: -0.01em;
    transition: var(--tc-transition);
    position: relative;
    white-space: nowrap;
    margin-bottom: 2px;
    cursor: pointer;
}
.tc-nav-item:hover {
    background: var(--tc-sidebar-hover);
    color: var(--tc-sidebar-text);
}
.tc-nav-item--active {
    background: var(--tc-sidebar-active);
    color: var(--tc-sidebar-text);
    font-weight: 600;
}
.tc-nav-item--active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--tc-accent), var(--tc-primary-c));
}
.tc-nav-item--active .material-symbols-outlined { color: var(--tc-accent); }

.tc-nav-item__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.18s, width 0.28s var(--tc-ease);
}
html.tc-sidebar-collapsed .tc-nav-item__label { opacity: 0; width: 0; }
html.tc-sidebar-collapsed .tc-nav-item { justify-content: center; padding: 10px 0; }

.tc-nav-item__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tc-accent);
    flex-shrink: 0;
    margin-left: auto;
}
html.tc-sidebar-collapsed .tc-nav-item__dot { display: none; }

/* Bottom nav */
.tc-sidebar__bottom {
    padding: 10px 10px;
    border-top: 1px solid var(--tc-outline);
    flex-shrink: 0;
}
.tc-nav-item--bottom { margin-bottom: 2px; }

/* Overlay mobile */
.tc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.28s var(--tc-ease);
}

/* Tooltip */
.tc-tooltip {
    position: fixed;
    padding: 5px 10px;
    background: var(--tc-on-surface);
    color: var(--tc-bg);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--tc-radius);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 200;
    transition: opacity 0.15s;
    box-shadow: var(--tc-shadow);
}
.tc-tooltip.tc-tooltip--visible { opacity: 1; }

/* ──────────────────────────────────────────────────────────
   5. TOPBAR
   ────────────────────────────────────────────────────────── */
.tc-topbar {
    height: var(--tc-header-h);
    background: var(--tc-topbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--tc-outline);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
    flex-shrink: 0;
}

.tc-topbar__hamburger {
    width: 36px;
    height: 36px;
    border-radius: var(--tc-radius-md);
    background: var(--tc-surface-low);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tc-muted);
    flex-shrink: 0;
    transition: background 0.15s;
}
.tc-topbar__hamburger:hover { background: var(--tc-surface-c); color: var(--tc-on-surface); }

.tc-topbar__search {
    position: relative;
    flex: 1;
    max-width: 400px;
}
.tc-topbar__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--tc-muted);
    pointer-events: none;
}
.tc-topbar__search-input {
    width: 100%;
    height: 36px;
    background: var(--tc-surface-low);
    border: 1.5px solid transparent;
    border-radius: var(--tc-radius-full);
    padding: 0 14px 0 38px;
    font-size: 13px;
    color: var(--tc-on-surface);
    outline: none;
    transition: border-color 0.2s;
}
.tc-topbar__search-input::placeholder { color: var(--tc-muted); }
.tc-topbar__search-input:focus { border-color: var(--tc-accent); }

.tc-topbar__spacer { flex: 1; }

.tc-topbar__actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-topbar__divider {
    width: 1px;
    height: 24px;
    background: var(--tc-outline);
    margin: 0 4px;
}

/* Icon button */
.tc-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--tc-radius-md);
    background: var(--tc-surface-low);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tc-muted);
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.tc-icon-btn:hover { background: var(--tc-surface-c); color: var(--tc-on-surface); }
.tc-icon-btn--relative { position: relative; }

/* Badge de notificação */
.tc-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tc-danger);
    border: 1.5px solid var(--tc-topbar-bg);
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.tc-badge--pulse {
    animation: tc-pulse 2s ease infinite;
}
@keyframes tc-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.75; }
}

/* User button */
.tc-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: var(--tc-radius-full);
    background: var(--tc-surface-low);
    transition: background 0.15s;
}
.tc-user-btn:hover { background: var(--tc-surface-c); }

.tc-user-btn__info {
    display: none;
    flex-direction: column;
    text-align: left;
}
@media (min-width: 1280px) {
    .tc-user-btn__info { display: flex; }
}
.tc-user-btn__name { font-size: 12px; font-weight: 700; color: var(--tc-on-surface); line-height: 1.2; }
.tc-user-btn__role { font-size: 10px; color: var(--tc-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.tc-user-btn__chevron { font-size: 14px !important; color: var(--tc-muted); }

/* Avatar */
.tc-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tc-primary-c), var(--tc-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.tc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tc-avatar--lg { width: 44px; height: 44px; font-size: 16px; }

/* ──────────────────────────────────────────────────────────
   6. DROPDOWNS
   ────────────────────────────────────────────────────────── */
.tc-dropdown-wrap { position: relative; }

.tc-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: var(--tc-surface);
    border: 1px solid var(--tc-outline);
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    z-index: 200;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s var(--tc-ease);
}
.tc-dropdown--right { width: 220px; }
.tc-dropdown.tc-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.tc-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--tc-outline);
}
.tc-dropdown__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--tc-on-surface);
}
.tc-dropdown__link {
    font-size: 11px;
    font-weight: 600;
    color: var(--tc-accent);
    background: none;
    border: none;
    cursor: pointer;
}
.tc-dropdown__list { max-height: 300px; overflow-y: auto; }
.tc-dropdown__footer {
    padding: 10px 16px;
    border-top: 1px solid var(--tc-outline);
    text-align: center;
}

/* Item de dropdown */
.tc-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    color: var(--tc-muted);
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}
.tc-dropdown__item:hover { background: var(--tc-surface-low); color: var(--tc-on-surface); }
.tc-dropdown__item--danger { color: var(--tc-danger); }
.tc-dropdown__item--danger:hover { background: rgba(186,26,26,0.06); }
.tc-dropdown__item .material-symbols-outlined { font-size: 16px !important; color: var(--tc-outline); }
.tc-dropdown__item--danger .material-symbols-outlined { color: var(--tc-danger); }

/* Perfil no dropdown */
.tc-dropdown__profile {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--tc-outline);
}
.tc-dropdown__profile-name { font-size: 13px; font-weight: 700; color: var(--tc-on-surface); }
.tc-dropdown__profile-email { font-size: 11px; color: var(--tc-muted); margin-top: 2px; }

/* Item de notificação */
.tc-notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--tc-outline);
    cursor: pointer;
    transition: background 0.15s;
}
.tc-notif-item:hover { background: var(--tc-surface-low); }
.tc-notif-item--unread { background: rgba(69,134,226,0.04); }

.tc-notif-item__icon {
    width: 34px;
    height: 34px;
    border-radius: var(--tc-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tc-notif-item__body { flex: 1; min-width: 0; }
.tc-notif-item__title { font-size: 12px; font-weight: 500; color: var(--tc-on-surface); line-height: 1.4; }
.tc-notif-item--unread .tc-notif-item__title { font-weight: 600; }
.tc-notif-item__time { font-size: 11px; color: var(--tc-muted); margin-top: 2px; }
.tc-notif-item__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tc-accent);
    flex-shrink: 0;
    margin-top: 4px;
    animation: tc-pulse 2s ease infinite;
}

/* ──────────────────────────────────────────────────────────
   7. FOOTER
   ────────────────────────────────────────────────────────── */
.tc-footer {
    height: var(--tc-footer-h);
    background: var(--tc-footer-bg);
    border-top: 1px solid var(--tc-outline);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    gap: 16px;
}

.tc-footer__brand {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tc-footer__logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--tc-primary-c), var(--tc-accent));
    display: flex;
    align-items: center;
    justify-content: center;
}
.tc-footer__name { font-size: 11px; font-weight: 700; color: var(--tc-footer-text); }
.tc-footer__sep  { font-size: 11px; color: var(--tc-outline); }
.tc-footer__version { font-size: 11px; color: var(--tc-footer-text); }

.tc-footer__links {
    display: flex;
    gap: 20px;
}
.tc-footer__link {
    font-size: 11px;
    color: var(--tc-footer-text);
    transition: color 0.15s;
}
.tc-footer__link:hover { color: var(--tc-on-surface); }

.tc-footer__copy {
    font-size: 11px;
    color: var(--tc-footer-text);
    white-space: nowrap;
}

/* ──────────────────────────────────────────────────────────
   8. COMPONENTES DE CONTEÚDO
   ────────────────────────────────────────────────────────── */

/* Page Header */
.tc-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.tc-page-title {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--tc-on-surface);
    line-height: 1.1;
}
.tc-page-subtitle {
    font-size: 13px;
    color: var(--tc-muted);
    margin-top: 6px;
    font-weight: 400;
}
.tc-page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Buttons */
.tc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--tc-radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tc-transition);
    border: none;
    white-space: nowrap;
    text-decoration: none;
    font-family: var(--tc-font);
}
.tc-btn:active { transform: scale(0.98); }
.tc-btn--primary {
    background: linear-gradient(135deg, var(--tc-primary-c), var(--tc-accent));
    color: #fff;
    box-shadow: var(--tc-shadow-primary);
}
.tc-btn--primary:hover { filter: brightness(1.1); }
.tc-btn--secondary {
    background: var(--tc-surface-c);
    color: var(--tc-on-surface);
    border: 1px solid var(--tc-outline);
}
.tc-btn--secondary:hover { background: var(--tc-surface-high); }
.tc-btn--danger {
    background: rgba(186,26,26,0.1);
    color: var(--tc-danger);
}
.tc-btn--danger:hover { background: rgba(186,26,26,0.18); }
.tc-btn .material-symbols-outlined { font-size: 16px !important; }

/* Grid padrão */
.tc-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tc-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tc-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 1024px) {
    .tc-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .tc-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .tc-grid-4, .tc-grid-3, .tc-grid-2 { grid-template-columns: 1fr; }
}

/* KPI Card */
.tc-kpi-card {
    background: var(--tc-surface);
    border: 1px solid rgba(69,134,226,0.1);
    border-radius: var(--tc-radius-lg);
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}
.tc-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tc-shadow);
}
.tc-kpi-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}
.tc-kpi-card__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--tc-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tc-kpi-card__icon .material-symbols-outlined { font-size: 17px !important; }
.tc-kpi-card__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tc-muted);
}
.tc-kpi-card__value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--tc-on-surface);
    line-height: 1;
}
.tc-kpi-card__glow {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.12;
    filter: blur(20px);
    pointer-events: none;
}

/* Delta (variação) */
.tc-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
}
.tc-delta .material-symbols-outlined { font-size: 12px !important; }
.tc-delta--up   { background: rgba(16,185,129,0.1);  color: var(--tc-success); }
.tc-delta--down { background: rgba(186,26,26,0.1);   color: var(--tc-danger); }

/* Card genérico */
.tc-card {
    background: var(--tc-surface);
    border: 1px solid rgba(69,134,226,0.1);
    border-radius: var(--tc-radius-lg);
    overflow: hidden;
}
.tc-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--tc-outline);
}
.tc-card__title { font-size: 14px; font-weight: 700; color: var(--tc-on-surface); letter-spacing: -0.02em; }
.tc-card__subtitle { font-size: 11px; color: var(--tc-muted); margin-top: 2px; }
.tc-card__body { padding: 20px 22px; }

/* Status Chips */
.tc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.tc-chip--success { background: rgba(16,185,129,0.1);  color: var(--tc-success); }
.tc-chip--warning { background: rgba(245,158,11,0.1);  color: var(--tc-warning); }
.tc-chip--danger  { background: rgba(186,26,26,0.1);   color: var(--tc-danger);  }
.tc-chip--neutral { background: var(--tc-surface-c);   color: var(--tc-muted);   }
.tc-chip--accent  { background: rgba(69,134,226,0.12); color: var(--tc-accent);  }

/* Tabela */
.tc-table-wrap { overflow-x: auto; }
.tc-table {
    width: 100%;
    border-collapse: collapse;
}
.tc-table thead tr {
    background: var(--tc-surface-low);
}
.tc-table th {
    padding: 10px 20px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tc-muted);
    white-space: nowrap;
}
.tc-table td {
    padding: 13px 20px;
    font-size: 13px;
    color: var(--tc-on-surface);
    vertical-align: middle;
}
.tc-table tbody tr:nth-child(even) { background: var(--tc-surface-low); }
.tc-table tbody tr { transition: background 0.15s; cursor: pointer; }
.tc-table tbody tr:hover { background: var(--tc-surface-c); }

/* Ação rápida na tabela */
.tc-table-actions { display: flex; gap: 4px; justify-content: flex-end; }
.tc-table-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--tc-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tc-surface-low);
    color: var(--tc-muted);
    transition: background 0.15s, color 0.15s;
    border: none;
    cursor: pointer;
}
.tc-table-btn:hover { background: var(--tc-surface-c); color: var(--tc-on-surface); }
.tc-table-btn--danger:hover { background: rgba(186,26,26,0.1); color: var(--tc-danger); }
.tc-table-btn .material-symbols-outlined { font-size: 16px !important; }

/* Paginação */
.tc-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 16px 20px;
    border-top: 1px solid var(--tc-outline);
}
.tc-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--tc-radius);
    border: 1px solid var(--tc-outline);
    background: var(--tc-surface);
    color: var(--tc-on-surface);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.tc-page-btn:hover { background: var(--tc-surface-low); }
.tc-page-btn--active {
    background: var(--tc-accent);
    border-color: var(--tc-accent);
    color: #fff;
}
.tc-page-btn--active:hover { filter: brightness(1.1); }
.tc-page-btn .material-symbols-outlined { font-size: 16px !important; }

/* Formulários */
.tc-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .tc-form-grid { grid-template-columns: 1fr; } }
.tc-form-grid--full { grid-column: 1 / -1; }

.tc-field { display: flex; flex-direction: column; gap: 4px; }
.tc-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tc-muted);
}
.tc-input,
.tc-select,
.tc-textarea {
    width: 100%;
    background: var(--tc-surface-low);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--tc-radius) var(--tc-radius) 0 0;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--tc-on-surface);
    font-family: var(--tc-font);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.tc-input:focus,
.tc-select:focus,
.tc-textarea:focus {
    border-bottom-color: var(--tc-accent);
    background: var(--tc-surface-c);
}
.tc-input.tc-input--error { border-bottom-color: var(--tc-danger); }
.tc-textarea { resize: vertical; min-height: 100px; }
.tc-select { appearance: none; cursor: pointer; }

/* Breadcrumb */
.tc-breadcrumb { margin-bottom: 16px; }
.tc-breadcrumb ol {
    display: flex;
    align-items: center;
    list-style: none;
    flex-wrap: wrap;
    gap: 2px;
}
.tc-breadcrumb__item a, .tc-breadcrumb__item {
    font-size: 12px;
    color: var(--tc-muted);
    font-weight: 500;
    transition: color 0.15s;
}
.tc-breadcrumb__item a:hover { color: var(--tc-on-surface); }
.tc-breadcrumb__item--active { color: var(--tc-on-surface); font-weight: 600; }
.tc-breadcrumb__sep .material-symbols-outlined { font-size: 14px !important; color: var(--tc-outline); }

/* Filtros */
.tc-filters {
    background: var(--tc-surface);
    border: 1px solid rgba(69,134,226,0.1);
    border-radius: var(--tc-radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.tc-filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; flex: 1; }

/* Seção de detalhe */
.tc-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 32px;
    padding: 20px;
}
@media (max-width: 768px) { .tc-detail-grid { grid-template-columns: repeat(2, 1fr); } }
.tc-detail-field__label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tc-muted); margin-bottom: 4px; }
.tc-detail-field__value { font-size: 14px; color: var(--tc-on-surface); font-weight: 500; }

/* ──────────────────────────────────────────────────────────
   9. RESPONSIVIDADE — Mobile
   ────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Sidebar como drawer */
    .tc-sidebar {
        transform: translateX(-100%);
        width: var(--tc-sidebar-w) !important; /* sempre largo no mobile */
        box-shadow: var(--tc-shadow);
    }
    html.tc-drawer-open .tc-sidebar {
        transform: translateX(0);
    }
    html.tc-drawer-open .tc-overlay {
        display: block;
        opacity: 1;
    }

    /* Main sem margem no mobile */
    .tc-main-wrapper { margin-left: 0 !important; }

    /* Ocultar toggle btn no mobile */
    .tc-sidebar__toggle-btn { display: none; }

    /* Main padding menor */
    .tc-main { padding: 16px; }

    /* Footer simplificado */
    .tc-footer__links, .tc-footer__copy { display: none; }

    /* Topbar search menor */
    .tc-topbar__search { max-width: 180px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Tablet: sidebar inicia colapsada */
    .tc-sidebar { width: var(--tc-sidebar-cw); }
    html.tc-sidebar-collapsed .tc-sidebar { width: var(--tc-sidebar-cw); }
    .tc-main-wrapper { margin-left: var(--tc-sidebar-cw); }
}

/* ──────────────────────────────────────────────────────────
   10. ANIMAÇÕES
   ────────────────────────────────────────────────────────── */
@keyframes tc-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes tc-slide-in {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.tc-fade-in  { animation: tc-fade-in 0.22s var(--tc-ease) both; }
.tc-slide-in { animation: tc-slide-in 0.22s var(--tc-ease) both; }

/* ──────────────────────────────────────────────────────────
   11. PRE-LOADER (substitui style.css)
   ────────────────────────────────────────────────────────── */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--tc-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
#preloader.tc-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.waviy {
    display: flex;
    gap: 2px;
}
.waviy span {
    font-size: 32px;
    font-weight: 800;
    color: var(--tc-accent);
    animation: waviy 1s infinite;
    animation-delay: calc(var(--i) * 0.1s);
}
@keyframes waviy {
    0%, 40%, 100% { transform: translateY(0); }
    20%           { transform: translateY(-18px); }
}

/* ──────────────────────────────────────────────────────────
   12. AJUSTES SHELL / INTEGRAÇÕES
   ────────────────────────────────────────────────────────── */

/* Override Bootstrap body background em dark mode */
html.dark body { background-color: var(--tc-bg); color: var(--tc-on-surface); }

/* Remove underline que Bootstrap adiciona em todos os links do shell */
.tc-shell a,
.tc-topbar a,
.tc-dropdown a,
.tc-sidebar a,
.tc-footer a { text-decoration: none !important; }

/* Ícones FontAwesome dentro de tc-nav-item */
.tc-nav-item i {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    color: inherit;
}
html.tc-sidebar-collapsed .tc-nav-item i { font-size: 16px; }

/* Sub-label de grupo de menu */
.tc-nav-group-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--tc-sidebar-muted);
    padding: 8px 10px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.18s;
}
/* Collapsible sidebar groups */
.tc-nav-group { margin-bottom: 2px; }
.tc-nav-group-label.tc-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    border-radius: var(--tc-radius-md);
}
.tc-nav-group-label.tc-group-toggle:hover {
    background: var(--tc-sidebar-hover);
    color: var(--tc-sidebar-text);
}
/* Inner: icon + text side by side */
.tc-grp-label-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tc-grp-label-inner i,
.tc-grp-label-inner .material-symbols-outlined {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 14px;
    color: inherit;
}
.tc-grp-chevron {
    font-size: 14px !important;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    color: var(--tc-sidebar-muted);
}
.tc-group-toggle[aria-expanded="true"] .tc-grp-chevron {
    transform: rotate(90deg);
}
.tc-grp-items:not(.show) { display: none; }

/* Indenta os itens filhos em relação ao label do grupo */
.tc-grp-items > .tc-nav-item {
    padding-left: 38px;
}

/* ── Sidebar colapsada: grupo vira ícone clicável, itens ficam ocultos ── */
html.tc-sidebar-collapsed .tc-nav-group-label {
    opacity: 1;
    justify-content: center;
    padding: 9px 0;
}
html.tc-sidebar-collapsed .tc-grp-label-text { display: none; }
html.tc-sidebar-collapsed .tc-grp-chevron    { display: none; }
html.tc-sidebar-collapsed .tc-grp-items      { display: none !important; }

/* ── Flyout panel (aparece ao hover do grupo colapsado) ── */
.tc-grp-flyout {
    display: none;
    position: fixed;
    min-width: 190px;
    background: var(--tc-surface);
    border: 1px solid var(--tc-outline);
    border-radius: var(--tc-radius-md);
    box-shadow: var(--tc-shadow);
    padding: 6px;
    z-index: 9999;
}
.tc-grp-flyout.tc-grp-flyout--visible { display: block; }
.tc-grp-flyout-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--tc-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px 6px;
    border-bottom: 1px solid var(--tc-outline);
    margin-bottom: 4px;
    white-space: nowrap;
}
.tc-grp-flyout-item {
    display: block;
    padding: 7px 10px;
    border-radius: var(--tc-radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--tc-sidebar-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s;
}
.tc-grp-flyout-item:hover {
    background: var(--tc-sidebar-hover);
    color: var(--tc-on-surface);
}
.tc-grp-flyout-item--active {
    color: var(--tc-accent);
    font-weight: 700;
}

/* Active dot para menu items com rota */
.tc-nav-item--active .tc-nav-item__dot { display: flex; }

/* ──────────────────────────────────────────────────────────
   13. DARK MODE — Bootstrap component overrides
   ────────────────────────────────────────────────────────── */

/* Cards */
html.dark .card {
    background-color: var(--tc-surface);
    border-color: var(--tc-outline);
    color: var(--tc-on-surface);
}
html.dark .card-header {
    background-color: var(--tc-surface-low);
    border-color: var(--tc-outline);
    color: var(--tc-on-surface);
}
html.dark .card-footer {
    background-color: var(--tc-surface-low);
    border-color: var(--tc-outline);
}

/* Tabelas */
html.dark .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--tc-on-surface);
    --bs-table-striped-bg: rgba(255,255,255,0.04);
    --bs-table-striped-color: var(--tc-on-surface);
    --bs-table-hover-bg: rgba(255,255,255,0.06);
    --bs-table-hover-color: var(--tc-on-surface);
    --bs-table-active-color: var(--tc-on-surface);
    color: var(--tc-on-surface);
    border-color: var(--tc-outline);
}
html.dark .table > :not(caption) > * > * { border-color: var(--tc-outline); }
html.dark thead { color: var(--tc-muted); }
/* Garante cor de texto em todas as células, independente do Bootstrap calcular */
html.dark .table tbody td,
html.dark .table tbody th { color: var(--tc-on-surface) !important; }

/* Remove a faixa inferior do card de filtro (margin do .collapse dentro do .card) */
.card > .collapse { margin-bottom: 0 !important; }

/* Formulários */
html.dark .form-control,
html.dark .form-select {
    background-color: var(--tc-surface-low);
    color: var(--tc-on-surface);
    border-color: var(--tc-outline);
}
html.dark .form-control::placeholder { color: var(--tc-muted); }
html.dark .form-control:focus,
html.dark .form-select:focus {
    background-color: var(--tc-surface-c);
    color: var(--tc-on-surface);
    border-color: var(--tc-accent);
    box-shadow: 0 0 0 3px rgba(69,134,226,0.18);
}
html.dark .form-label { color: var(--tc-muted); }

/* Botões */
html.dark .btn-secondary {
    background-color: var(--tc-surface-c);
    color: var(--tc-on-surface);
    border-color: var(--tc-outline);
}
html.dark .btn-light {
    background-color: var(--tc-surface-c);
    color: var(--tc-on-surface);
    border-color: var(--tc-outline);
}

/* Breadcrumb */
html.dark .breadcrumb-item a { color: var(--tc-accent); text-decoration: none; }
html.dark .breadcrumb-item.active,
html.dark .breadcrumb-item + .breadcrumb-item::before { color: var(--tc-muted); }

/* Popover dark mode */
html.dark .popover {
    background-color: var(--tc-surface);
    border-color: var(--tc-outline);
    box-shadow: var(--tc-shadow);
}
html.dark .popover-header {
    background-color: var(--tc-surface-c);
    border-bottom-color: var(--tc-outline);
    color: var(--tc-on-surface);
}
html.dark .popover-body {
    color: var(--tc-on-surface);
}
html.dark .popover .popover-arrow::before { border-bottom-color: var(--tc-outline); }
html.dark .popover .popover-arrow::after  { border-bottom-color: var(--tc-surface-c); }
html.dark .bs-popover-start .popover-arrow::before  { border-left-color: var(--tc-outline); }
html.dark .bs-popover-start .popover-arrow::after   { border-left-color: var(--tc-surface); }
html.dark .bs-popover-end .popover-arrow::before    { border-right-color: var(--tc-outline); }
html.dark .bs-popover-end .popover-arrow::after     { border-right-color: var(--tc-surface); }

/* Alerts */
html.dark .alert-light {
    background-color: var(--tc-surface-low);
    color: var(--tc-muted);
    border-color: var(--tc-outline);
}

/* Modais */
html.dark .modal-content {
    background-color: var(--tc-surface);
    color: var(--tc-on-surface);
    border-color: var(--tc-outline);
}
html.dark .modal-header,
html.dark .modal-footer { border-color: var(--tc-outline); }
html.dark .modal-title { color: var(--tc-on-surface); }

/* Dropdown Bootstrap */
html.dark .dropdown-menu {
    background-color: var(--tc-surface);
    border-color: var(--tc-outline);
}
html.dark .dropdown-item { color: var(--tc-on-surface); }
html.dark .dropdown-item:hover,
html.dark .dropdown-item:focus { background-color: var(--tc-surface-c); }

/* Collapse / accordion */
html.dark .accordion-button {
    background-color: var(--tc-surface-low);
    color: var(--tc-on-surface);
}
html.dark .accordion-body { background-color: var(--tc-surface); color: var(--tc-on-surface); }
html.dark .rounded.p-3 { background-color: var(--tc-surface-low); }

/* Badges */
html.dark .badge.bg-light { background-color: var(--tc-surface-c) !important; color: var(--tc-on-surface) !important; }

/* Charts ApexCharts — fundo transparente */
.mbi-apex { background: transparent !important; }
html.dark .mbi-chart-wrap,
html.dark .card .mbi-apex { background: transparent !important; }
