/* ======================================
   Mobile CSS - Sistema de Demandas
   Arquivo 100% isolado para dispositivos móveis
   Carregado apenas em telas ≤768px
====================================== */

/* Prevent any horizontal page scroll on mobile */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
}

/* All non-kanban sections need their own scroll */
.funcionarios-section,
.tarefas-usuario-section,
.cronograma-section,
.user-dashboard-section,
.planejamento-section {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

/* ======================================
   Mobile Sidebar
====================================== */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    z-index: 999;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.mobile-sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.sidebar-header h2 {
    font-size: 18px;
    color: var(--accent);
    margin: 0;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    min-height: 50px;
    padding: 16px 20px;
    /* Liquid Glass Background */
    background: linear-gradient(145deg,
            rgba(40, 40, 40, 0.9) 0%,
            rgba(30, 30, 30, 0.95) 50%,
            rgba(35, 35, 35, 0.9) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

/* LED Glow de fundo */
.sidebar-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0%;
    height: 0%;
    background: radial-gradient(circle, rgba(230, 126, 34, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.sidebar-item:hover {
    background: linear-gradient(145deg,
            rgba(50, 40, 35, 0.95) 0%,
            rgba(40, 35, 30, 0.98) 50%,
            rgba(45, 38, 32, 0.95) 100%);
    border-color: rgba(230, 126, 34, 0.3);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.sidebar-item:hover::before {
    width: 150%;
    height: 300%;
}

.sidebar-item:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Esconde os ícones emoji */
.sidebar-icon {
    display: none;
}

/* ======================================
   Header Mobile - Linha Única
====================================== */
.header {
    padding: 10px 12px;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 200 !important;
}

/* Hamburger Button - Esquerda */
.mobile-hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    flex-shrink: 0;
    order: 0;
}

.mobile-hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    transition: var(--transition);
}

.mobile-hamburger:hover span {
    background: var(--accent-hover);
}

/* ── New unified header mobile ── */
.header-unified {
    display: flex !important;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Brand — keep visible */
.header-brand {
    flex-shrink: 0;
}

.brand-text {
    font-size: 16px !important;
}

/* Hide nav tabs on mobile — they live in the sidebar */
.header-nav {
    display: none !important;
}

/* Hide separators */
.header-sep,
.header-sep-sm {
    display: none !important;
}

/* Hide inline filters on mobile (kanban tabs handle this) */
.header-filters {
    display: none !important;
}

/* Hide spacer */
.header-spacer {
    display: none !important;
}

/* Actions — show only IA + Nova buttons */
.header-actions {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Hide profile info and logout on mobile (in sidebar) */
.header-profile,
.btn-logout {
    display: none !important;
}

/* IA and Nova buttons — compact */
.header-actions .btn-ia,
.header-actions .btn-nova {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
}

/* ── Old header classes (keep hiding) ── */
.header-left {
    display: none !important;
}

.header-center {
    display: none !important;
}

/* Header Right - hide (replaced by header-actions) */
.header-right {
    display: none !important;
}

#user-info {
    display: none !important;
}

.header-right .btn {
    padding: 8px 12px;
    font-size: 11px;
}

/* Botão Toggle de Tema - Liquid Glass */
.btn-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: linear-gradient(145deg,
            rgba(40, 40, 40, 0.9) 0%,
            rgba(30, 30, 30, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.btn-theme-toggle:hover {
    border-color: rgba(230, 126, 34, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.btn-theme-toggle:active {
    transform: scale(0.95);
}

/* ======================================
   Kanban Container Mobile - CARROSSEL COM ABAS
====================================== */

/* Barra de Abas Mobile - Liquid Glass Container */
.mobile-kanban-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 0;
    z-index: 50;
    /* Container para o indicador líquido */
    position: relative;
}

/* Indicador Liquid Glass - Sliding Pill */
.liquid-indicator {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 10px;
    width: calc(20% - 4px);
    border-radius: 25px;
    background: linear-gradient(135deg,
            rgba(230, 126, 34, 0.35) 0%,
            rgba(230, 126, 34, 0.2) 50%,
            rgba(230, 126, 34, 0.3) 100%);
    border: 1px solid rgba(230, 126, 34, 0.4);
    box-shadow: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.1s ease-out, width 0.2s ease;
    pointer-events: none;
    z-index: 0;
    /* Posição controlada via JS */
    transform: translateX(var(--liquid-offset, 0px));
    animation: liquidPulse 2s ease-in-out infinite;
}

/* Animação de pulso no indicador líquido */
@keyframes liquidPulse {

    0%,
    100% {
        box-shadow: none;
    }

    50% {
        box-shadow: none;
    }
}

/* Efeito de "stretch" durante movimento rápido */
.liquid-indicator.stretching {
    transition: transform 0.05s linear;
}

/* Aba Individual - Liquid Glass Style */
.mobile-tab {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    background: transparent;
    border: none;
    border-radius: 25px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.mobile-tab:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* Aba Ativa - Apenas destaque de texto */
.mobile-tab.active {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(230, 126, 34, 0.5);
}

/* Container do Kanban - CARROSSEL */
.kanban-container {
    display: flex;
    flex-direction: row;
    padding: 10px;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    height: calc(100vh - 140px);
    max-height: calc(100vh - 140px);
    overscroll-behavior-x: contain;
}

/* Hide horizontal scrollbar */
.kanban-container::-webkit-scrollbar {
    display: none;
}
.kanban-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Colunas do Carrossel */
.kanban-column {
    display: flex !important;
    flex-direction: column;
    flex: 0 0 100vw;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    padding: 12px 16px;
    border-radius: 0;
    height: 100%;
    max-height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    box-sizing: border-box;
}

.column-header {
    margin-bottom: 15px;
    padding-bottom: 12px;
    flex-shrink: 0;
}

.column-title {
    font-size: 16px;
}

.column-count {
    padding: 4px 12px;
    font-size: 12px;
}

.column-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    padding-bottom: 20px;
}

/* Scrollbar sutil */
.column-cards::-webkit-scrollbar {
    width: 3px;
}

.column-cards::-webkit-scrollbar-track {
    background: transparent;
}

.column-cards::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.column-cards::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ======================================
   Demand Cards Mobile - Otimizado para Toque
====================================== */
.demand-card {
    padding: 14px;
    border-radius: 12px;
    flex-shrink: 0;
    /* Área de toque maior */
    min-height: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.demand-card:hover {
    transform: none;
}

.demand-card:active {
    transform: scale(0.98);
    background: var(--bg-tertiary);
}

.demand-card-id {
    font-size: 10px;
    margin-bottom: 6px;
}

.demand-card-title {
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.demand-card-info {
    margin-bottom: 10px;
}

.info-row {
    font-size: 11px;
    margin-bottom: 3px;
}

.demand-card-timer {
    font-size: 13px;
    padding: 8px 0;
    margin-bottom: 10px;
}

.demand-card-footer {
    flex-wrap: nowrap;
    gap: 8px;
}

.demand-card-requester {
    flex: 1;
    min-width: 0;
}

.requester-name {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: 10px;
    flex-shrink: 0;
    aspect-ratio: 1;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 11px;
}

/* Column Tabs Mobile */
.column-tabs {
    gap: 5px;
}

.column-tab {
    font-size: 12px;
    padding: 4px 6px;
}

/* Nivel Pills Mobile */
.nivel-selector {
    gap: 8px;
}

.nivel-pill {
    padding: 8px 14px;
    font-size: 11px;
    flex: 1;
    justify-content: center;
    min-height: 44px;
}

.nivel-badge {
    font-size: 9px;
    padding: 2px 7px;
}

/* Etiqueta Filter Bar Mobile */
.etiqueta-filter-bar {
    padding: 8px 15px;
    gap: 8px;
}

.etiqueta-filter-bar .filter-label {
    display: none;
}

.etiqueta-filter-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.etiqueta-filter-pill {
    padding: 5px 10px;
    font-size: 10px;
}

.etq-badge {
    font-size: 8px;
    padding: 1px 6px;
}

/* ======================================
   Modais Mobile
====================================== */
.modal:not(.hidden) {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px;
    padding-top: 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    width: 95%;
    max-width: 95%;
    max-height: calc(100vh - 60px);
    max-height: calc(100dvh - 60px);
    margin: 0 auto;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Close button — big touch target */
.modal-close {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    -webkit-tap-highlight-color: rgba(255,255,255,0.1);
    touch-action: manipulation;
}

.modal-header {
    padding: 15px;
    background: var(--bg-secondary);
    z-index: 10;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
}

.modal-body {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Nova Demanda Form — scrollable body + fixed footer */
.modal-form-body {
    padding: 15px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.modal-form-footer {
    flex-shrink: 0;
    padding: 12px 15px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    gap: 10px;
}

.modal-form-footer button {
    flex: 1;
    min-height: 44px;
    font-size: 14px;
}

/* Form elements — prevent iOS zoom */
.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content input[type="url"],
.modal-content textarea,
.modal-content select {
    font-size: 16px !important;
}

.form-row-2col {
    flex-direction: column;
    gap: 12px;
}




/* Modal de ver demanda - garantir scroll */
#modal-ver-demanda .modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    overflow: hidden;
}

#modal-ver-demanda .modal-header {
    flex-shrink: 0;
}

#modal-ver-demanda .modal-tabs {
    flex-shrink: 0;
}

#modal-ver-demanda .modal-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

#modal-ver-demanda .modal-tab-content.active {
    display: flex;
}

#modal-ver-demanda .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

#modal-ver-demanda .modal-footer {
    flex-shrink: 0;
}

#modal-ver-demanda .demand-actions {
    flex-shrink: 0;
}

/* Form dentro do modal - permite scroll */
.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-content form .form-group {
    flex-shrink: 0;
}

/* Wrapper scrollável para os campos do form */
.modal-content form {
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
    max-height: calc(80vh - 60px);
}

.modal-footer {
    padding: 15px;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.modal-footer select,
.modal-footer button {
    width: 100%;
}

.modal-tabs {
    padding: 0 10px;
    gap: 5px;
}

.modal-tab {
    font-size: 13px;
    padding: 10px 15px;
}

.form-actions {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    margin: 0 -15px -15px -15px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
}

.form-actions .btn {
    width: 100%;
    justify-content: center;
}

.demand-actions {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.demand-actions .actions-left,
.demand-actions .actions-right {
    display: flex;
    gap: 10px;
    width: 100%;
}

.demand-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 12px;
}

/* ======================================
   User Kanban (Por Usuário) Mobile
====================================== */
.user-kanban-container {
    flex-direction: column;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    gap: 15px;
}

.user-kanban-column {
    min-width: 100%;
    max-width: 100%;
}

.user-column-header {
    padding: 12px 15px;
}

.user-column-name {
    font-size: 14px;
}

/* BI Dashboard Mobile rules — see dedicated section below (line ~2286+) */

/* ======================================
   Funcionários Section Mobile
====================================== */
.funcionarios-section {
    padding: 15px;
    overflow-x: auto;
}

.section-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.section-header h2 {
    font-size: 20px;
}

.section-header .btn {
    width: 100%;
    justify-content: center;
}

.table {
    font-size: 12px;
    min-width: 600px;
}

.table th,
.table td {
    padding: 10px 12px;
}

/* ======================================
   Tarefas por Usuário Mobile
====================================== */
.tarefas-usuario-section {
    padding: 15px;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 60px !important;
}

.tarefas-usuario-section .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
}

.section-header-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.section-header-left h2 {
    font-size: 18px;
}

.section-header-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.section-header-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.section-header-filters .filter-group label {
    color: var(--text-secondary);
    font-size: 12px;
}

.section-header-filters .filter-input,
.section-header-filters .filter-select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
}

.section-header-filters .btn {
    width: 100%;
    margin-top: 5px;
}

/* Quick date filter buttons mobile */
.filter-date-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-quick-btns {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.filter-quick-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    text-align: center;
    min-width: 70px;
}

.filter-quick-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.filter-period-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-period-inputs .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* ======================================
   Form Groups Mobile
====================================== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-size: 13px;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    font-size: 16px;
    /* Previne zoom automático no iOS */
}

/* ======================================
   Demanda Info Grid Mobile
====================================== */
.demanda-info-grid {
    grid-template-columns: 1fr;
    gap: 8px;
}

/* ======================================
   Empty Messages Mobile
====================================== */
.empty-message {
    padding: 30px 15px;
    font-size: 13px;
}

/* ======================================
   Footer Mobile
====================================== */
.footer {
    padding: 15px;
    font-size: 11px;
    text-align: center;
}

/* ======================================
   Login Page Mobile
====================================== */
.login-card {
    margin: 20px;
    padding: 25px;
    max-width: calc(100% - 40px);
}

.login-card h1 {
    font-size: 22px;
    margin-bottom: 25px;
}

/* ======================================
   Light Theme Mobile Overrides
====================================== */
body.light-theme .mobile-sidebar {
    background: #ffffff;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
}

body.light-theme .sidebar-header {
    background: #f8f8f8;
    border-bottom-color: #e0e0e0;
}

body.light-theme .sidebar-header h2 {
    color: #d35400;
}

body.light-theme .sidebar-item {
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(245, 245, 245, 0.98) 100%);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.light-theme .sidebar-item:hover {
    background: linear-gradient(145deg,
            rgba(255, 248, 240, 0.98) 0%,
            rgba(255, 245, 235, 1) 100%);
    border-color: rgba(211, 84, 0, 0.25);
    color: #1a1a1a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-theme .mobile-kanban-tabs {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .mobile-tab {
    color: rgba(0, 0, 0, 0.5);
}

body.light-theme .mobile-tab.active {
    color: #d35400;
}

body.light-theme .liquid-indicator {
    background: linear-gradient(135deg,
            rgba(211, 84, 0, 0.15) 0%,
            rgba(211, 84, 0, 0.08) 50%,
            rgba(211, 84, 0, 0.12) 100%);
    border-color: rgba(211, 84, 0, 0.2);
    box-shadow: 0 0 1px rgba(211, 84, 0, 0.05);
}

body.light-theme .btn-theme-toggle {
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(245, 245, 245, 0.98) 100%);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body.light-theme .btn-theme-toggle:hover {
    border-color: rgba(211, 84, 0, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Light Theme - BI Dashboard */
body.light-theme .bi-dashboard-section,
body.light-theme .funcionarios-section,
body.light-theme .tarefas-usuario-section {
    background: var(--bg-primary);
}

body.light-theme .kpi-card,
body.light-theme .chart-container,
body.light-theme .table-container {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

body.light-theme .kpi-value,
body.light-theme .kpi-label,
body.light-theme .chart-title,
body.light-theme .section-title {
    color: var(--text-primary);
}

body.light-theme .form-group label,
body.light-theme .form-group select,
body.light-theme .form-group input {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.light-theme .btn-primary,
body.light-theme .btn-success {
    background: var(--accent);
    color: #1a1a1a;
    text-shadow: none;
}

body.light-theme .kanban-column {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.light-theme .demand-card {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.light-theme .header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

body.light-theme .footer {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* Light Theme - Modais */
body.light-theme .modal-content {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .modal-header {
    background: #f8f8f8;
    border-bottom-color: #e0e0e0;
}

body.light-theme .modal-header h2 {
    color: #1a1a1a;
}

body.light-theme .modal-close {
    color: #666666;
}

body.light-theme .modal-tabs {
    background: #f5f5f5;
    border-bottom-color: #e0e0e0;
}

body.light-theme .modal-tab {
    color: #666666;
}

body.light-theme .modal-tab.active {
    color: #d35400;
    border-bottom-color: #d35400;
}

body.light-theme .modal-body {
    background: #ffffff;
}

body.light-theme .demand-detail-card {
    background: #f8f8f8;
    border-color: #e0e0e0;
}

body.light-theme .detail-label {
    color: #666666;
}

body.light-theme .detail-value {
    color: #1a1a1a;
}

body.light-theme .demand-actions {
    background: #f8f8f8;
    border-top-color: #e0e0e0;
}

body.light-theme .btn-secondary,
body.light-theme .btn-outline-danger {
    background: #ffffff;
    border-color: #d0d0d0;
    color: #333333;
}

body.light-theme .btn-outline-danger {
    border-color: #c0392b;
    color: #c0392b;
}

body.light-theme select {
    background: #ffffff;
    border-color: #d0d0d0;
    color: #1a1a1a;
}

/* ======================================
   Responsive Breakpoints para dispositivos específicos
====================================== */

/* iPhone SE, iPhone 5/5S/5C (320-375px) - Telas muito pequenas */
@media screen and (max-width: 375px) {
    .mobile-kanban-tabs {
        padding: 6px 8px;
        gap: 3px;
    }

    .mobile-tab {
        font-size: 9px;
        padding: 6px 8px;
    }

    .kanban-container {
        padding: 8px;
        height: calc(100vh - 130px);
        height: calc(100dvh - 130px);
    }

    .kanban-column {
        flex: 0 0 calc(100vw - 16px);
        width: calc(100vw - 16px);
        min-width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        padding: 10px;
    }

    .demand-card {
        padding: 10px;
    }

    .demand-card-title {
        font-size: 13px;
    }

    .info-row {
        font-size: 10px;
    }

    .modal-content {
        max-height: 85vh;
        max-height: 85dvh;
    }

    .header {
        padding: 8px 10px;
    }

    .header-title {
        font-size: 16px;
    }
}

/* iPhone 6/7/8, iPhone X/XS/11 Pro (375-414px) */
@media screen and (min-width: 376px) and (max-width: 414px) {
    .kanban-container {
        height: calc(100vh - 135px);
        height: calc(100dvh - 135px);
    }

    .modal-content {
        max-height: 82vh;
        max-height: 82dvh;
    }
}

/* iPhone 11/12/13/14, iPhone Plus models (414-430px) */
@media screen and (min-width: 415px) and (max-width: 430px) {
    .kanban-container {
        height: calc(100vh - 140px);
        height: calc(100dvh - 140px);
    }
}

/* iPhone 14 Pro Max, Galaxy S series (430px+) */
@media screen and (min-width: 431px) and (max-width: 768px) {
    .kanban-container {
        height: calc(100vh - 145px);
        height: calc(100dvh - 145px);
    }

    .kanban-column {
        flex: 0 0 calc(100vw - 30px);
        width: calc(100vw - 30px);
        min-width: calc(100vw - 30px);
        max-width: calc(100vw - 30px);
    }
}

/* Altura dinâmica para dispositivos com notch/dynamic island */
@supports (height: 100dvh) {
    .kanban-container {
        height: calc(100dvh - 140px);
    }

    .modal-content {
        max-height: 80dvh;
    }
}

/* Safe area para dispositivos com bordas arredondadas */
@supports (padding: env(safe-area-inset-bottom)) {
    .kanban-container {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .modal-content {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .form-actions {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* Landscape mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .kanban-container {
        height: calc(100vh - 100px);
        height: calc(100dvh - 100px);
    }

    .kanban-column {
        flex: 0 0 50vw;
        width: 50vw;
        min-width: 50vw;
        max-width: 50vw;
    }

    .modal-content {
        max-height: 90vh;
        max-height: 90dvh;
    }
}

/* ======================================
   CRONOGRAMA MOBILE
====================================== */
.cronograma-section {
    padding: 12px;
}

.cronograma-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.cronograma-header-left h2 {
    font-size: 18px;
}

.cronograma-filters {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.cronograma-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cronograma-filters .filter-group label {
    font-size: 12px;
}

.cronograma-filters .filter-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px; /* prevent iOS zoom */
    min-height: 44px;
}

.cronograma-filters .filter-quick-btn,
#cronograma-filter-btn,
#cronograma-pdf-btn {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    justify-content: center;
}

.cronograma-kanban {
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding: 10px 0;
    height: calc(100vh - 280px);
    height: calc(100dvh - 280px);
}

.cronograma-day-column {
    flex: 0 0 85vw;
    min-width: 85vw;
    max-width: 85vw;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    border-radius: 12px;
}

.cronograma-card {
    padding: 12px;
    border-radius: 10px;
}

.cronograma-card-title {
    font-size: 13px;
}

.cronograma-card-desc {
    font-size: 11px;
}

.cronograma-card-info {
    font-size: 11px;
}

/* ======================================
   MEU PAINEL (USER DASHBOARD) MOBILE
====================================== */
.user-dashboard-section {
    padding: 12px;
}

.user-dashboard-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.user-dashboard-header-left h2 {
    font-size: 18px;
}

.user-dashboard-filters {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.user-dashboard-filters .filter-group {
    width: 100%;
}

.user-dashboard-filters .filter-quick-btn,
#dashboard-cal-trigger,
#dashboard-pdf-btn {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    justify-content: center;
    text-align: center !important;
}

/* Calendar popup mobile */
.bi-calendar-popup {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    z-index: 1000 !important;
    max-height: 60vh;
}

.user-dashboard-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    padding: 14px 12px;
}

.stat-number {
    font-size: 22px;
}

.stat-label {
    font-size: 11px;
}

.user-dashboard-demands {
    margin-top: 15px;
}

.user-dashboard-demands h3 {
    font-size: 16px;
}

.demands-list {
    gap: 10px;
}

.dashboard-body {
    padding: 0;
}

/* ======================================
   PLANEJAMENTO GRID MOBILE
====================================== */
.planejamento-section {
    padding: 12px;
    overflow-x: hidden;
    max-width: 100vw;
}

.planejamento-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.planejamento-header h2 {
    font-size: 18px;
}

.planejamento-header .section-subtitle {
    font-size: 12px;
}

.planejamento-header-right {
    width: 100%;
}

.planejamento-header-right .btn-nova,
#btn-novo-planejamento {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    font-size: 14px;
}

.planejamento-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
}

.plan-card {
    padding: 14px;
    border-radius: 12px;
}

.plan-card-title {
    font-size: 15px;
}

.plan-card-meta {
    font-size: 11px;
}

.plan-card-actions {
    gap: 8px;
}

.plan-card-actions button {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
}

/* Modal Novo Planejamento */
#modal-novo-planejamento .modal-body {
    padding: 15px;
}

.plan-type-selector {
    flex-direction: column;
    gap: 10px;
}

.plan-type-option {
    min-height: 60px;
    padding: 14px;
    font-size: 14px;
}

/* Modal Pessoas */
#modal-plan-pessoas .modal-body {
    padding: 15px;
}

.plan-people-list {
    gap: 8px;
}

.plan-person-item {
    padding: 12px;
    min-height: 44px;
}

.plan-person-item label {
    font-size: 14px;
    gap: 12px;
}

.plan-person-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
}

/* ======================================
   NOTION EDITOR MOBILE
====================================== */

/* Toolbar */
.notion-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
}

.notion-toolbar .plan-toolbar-btn {
    min-height: 40px;
    font-size: 12px;
    padding: 8px 10px;
}

#notion-title {
    width: 100%;
    order: 10;
    font-size: 16px;
    padding: 10px 12px;
}

/* Editor layout — stack vertically */
.notion-editor-layout {
    flex-direction: column !important;
}

/* Sidebar → Bottom Sheet */
.notion-sidebar {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 55vh;
    border-radius: 16px 16px 0 0;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 200;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
    padding: 12px 16px 20px;
    background: var(--bg-secondary);
}

.notion-sidebar.mobile-open {
    transform: translateY(0);
}

/* Bottom sheet handle */
.notion-sidebar::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto 12px;
}

.nsb-section {
    margin-bottom: 12px;
}

.nsb-label {
    font-size: 11px;
    margin-bottom: 6px;
}

/* Format buttons - horizontal scroll */
.nsb-row {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.nsb-btn {
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    font-size: 14px;
}

/* Block buttons - grid 3 columns */
.nsb-section:last-child {
    display: flex;
    flex-direction: column;
}

.nsb-block-btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
}

.nsb-icon {
    min-width: 28px;
}

/* Floating toggle button for sidebar */
.notion-sidebar-toggle {
    display: flex !important;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 24px;
    align-items: center;
    justify-content: center;
    z-index: 199;
    box-shadow: 0 4px 15px rgba(230,126,34,0.4);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.notion-sidebar-toggle:active {
    transform: scale(0.9);
}

/* Mobile overlay behind bottom sheet */
.notion-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}

.notion-sidebar-overlay.active {
    display: block;
}

/* Editor area */
.notion-editor-container {
    width: 100% !important;
    max-width: 100%;
    padding: 0 4px;
}

.notion-editor {
    padding: 10px 8px;
    min-height: 50vh;
}

.notion-block {
    font-size: 15px;
    padding: 6px 8px;
}

.notion-h1 {
    font-size: 22px !important;
    padding: 8px 8px 4px !important;
}

.notion-h2 {
    font-size: 18px !important;
}

.notion-h3 {
    font-size: 15px !important;
}

/* Slash menu mobile */
.slash-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 50vh;
    border-radius: 16px 16px 0 0;
    z-index: 300;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.slash-item {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
}

/* ======================================
   MIND MAP MOBILE
====================================== */

/* Prevent horizontal page scroll */
#planejamento-mindmap-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overflow: hidden;
    width: 100vw;
    max-width: 100vw;
}

/* Toolbar — 2 compact rows */
.mindmap-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    align-items: center;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

/* Row 1 buttons: keep compact */
.mindmap-toolbar .plan-toolbar-btn {
    min-height: 36px;
    font-size: 11px;
    padding: 6px 8px;
    flex-shrink: 0;
}

/* Title — takes remaining space in row 1 */
#mindmap-title {
    flex: 1;
    min-width: 80px;
    font-size: 14px;
    padding: 6px 10px;
    order: 0;
}

/* Salvar and Pessoas — stay in row 1 */
.mindmap-toolbar > #mindmap-save {
    order: 0;
    flex-shrink: 0;
}

.mindmap-toolbar > #mindmap-pessoas {
    order: 0;
    flex-shrink: 0;
}

/* Tools row — full width, scrollable */
.mindmap-tools {
    order: 10;
    width: 100%;
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0;
}

/* Hide text inside tool buttons on mobile — icon only */
.mindmap-tools .plan-toolbar-btn {
    min-height: 34px;
    min-width: 34px;
    padding: 5px 7px;
    font-size: 11px;
    flex-shrink: 0;
}

.toolbar-sep {
    display: none;
}

/* Canvas — fills remaining space */
#mindmap-canvas {
    flex: 1;
    touch-action: none;
    max-width: 100vw;
}

/* Hide keyboard shortcuts hint */
.mindmap-shortcuts-hint {
    display: none !important;
}

/* Zoom controls */
.zoom-label {
    font-size: 10px;
    min-width: 30px;
    text-align: center;
}

/* ======================================
   MODAL IA — CENTERED POPUP MOBILE
====================================== */
.modal-ia:not(.hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    padding: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    touch-action: manipulation;
}

.modal-ia-content {
    width: 92% !important;
    max-width: 400px !important;
    height: auto !important;
    max-height: 80vh !important;
    max-height: 80dvh !important;
    min-height: 0 !important;
    border-radius: 16px !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    pointer-events: auto !important;
}

.ia-header {
    padding: 12px 16px;
    flex-shrink: 0;
}

.ia-header-icon {
    width: 32px;
    height: 32px;
}

.ia-header-title {
    font-size: 15px;
}

.ia-header-sub {
    font-size: 11px;
}

.ia-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255,255,255,0.1);
    position: relative;
}

/* Chat area */
.ia-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ia-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
}

.ia-msg-bubble {
    max-width: 85%;
    font-size: 14px;
    padding: 10px 14px;
}

/* Input bar - fixed at bottom */
.ia-input-bar {
    flex-shrink: 0;
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.ia-input-bar textarea {
    font-size: 16px !important; /* prevent iOS zoom */
    min-height: 44px;
    padding: 10px 14px;
}

.ia-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
}

.ia-mic-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
}

/* Preview area */
.ia-preview-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ia-preview-toolbar {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.ia-preview-toolbar label {
    font-size: 14px;
}

.ia-preview-toolbar select {
    width: 100%;
    font-size: 16px;
    min-height: 44px;
}

.ia-preview-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 12px;
}

.ia-preview-card {
    padding: 12px;
}

.ia-preview-footer {
    flex-shrink: 0;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    flex-direction: column;
}

.ia-preview-footer button {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    justify-content: center;
}

/* Success area */
.ia-success-area {
    padding: 40px 20px;
}

.ia-success-icon {
    width: 60px;
    height: 60px;
}

.ia-success-count {
    font-size: 36px;
}

.ia-btn-close-success {
    width: 100%;
    max-width: 280px;
    min-height: 44px;
}

/* ======================================
   KANBAN AJUSTES MOBILE
====================================== */

/* IA & Nova buttons - ensure touch targets */
.btn-ia,
.btn-nova {
    min-height: 36px;
    min-width: 36px;
    padding: 8px 12px;
    font-size: 12px;
}

/* Filters bar */
.kanban-filters {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ======================================
   BI DASHBOARD AJUSTES MOBILE
====================================== */

/* Section container — flex column, bi-body scrolls */
.bi-dashboard-section:not(.hidden) {
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: 100% !important;
}

/* Header + date filter — fixed, no shrink */
.bi-dashboard-section .bi-header {
    flex-shrink: 0 !important;
    padding: 12px !important;
}

.bi-dashboard-section .bi-date-filter-row {
    flex-shrink: 0 !important;
    padding: 8px 12px !important;
}

/* bi-body is the ONLY vertical scrollable area */
.bi-dashboard-section .bi-body {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding: 12px !important;
    padding-bottom: 60px !important;
}

/* Header — stack vertically */
.bi-header {
    flex-direction: column !important;
    gap: 10px;
    align-items: stretch !important;
    padding-bottom: 12px;
}

.bi-header-left h2 {
    font-size: 20px;
}

.bi-header-right {
    flex-direction: column;
    gap: 8px;
}

.bi-header-right .bi-select {
    width: 100%;
    min-height: 44px;
    font-size: 16px !important;
}

.bi-header-right .filter-quick-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    font-size: 14px;
}

/* Date filter — horizontal scroll pills */
.bi-date-filter-row {
    flex-direction: column;
    gap: 8px;
}

.bi-date-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    flex-wrap: nowrap;
}

.bi-date-pill {
    flex-shrink: 0;
    min-height: 36px;
    padding: 6px 14px;
    font-size: 12px;
    white-space: nowrap;
}

.bi-date-range-wrapper {
    width: 100%;
}

.bi-date-range-trigger {
    width: 100%;
    min-height: 40px;
    font-size: 13px;
}

/* Calendar popup — full width */
.bi-calendar-popup {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
}

/* KPI Cards — 2x2 grid */
.bi-kpi-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bi-kpi-card {
    padding: 12px 10px;
}

.kpi-label {
    font-size: 10px;
}

.kpi-value {
    font-size: 22px;
}

/* Charts — stack vertically (override desktop grid) */
.bi-charts-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px;
}

/* --- Chart Cards --- */
.bi-chart-card {
    width: 100% !important;
    overflow: hidden !important;
    padding: 12px !important;
}

.bi-chart-card h3 {
    font-size: 14px;
    margin-bottom: 8px;
}

/* Override desktop .chart-container{height:240px} */
#chart-status {
    width: 100% !important;
    height: auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

#chart-status > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100%;
}

/* Donut — scale down for mobile */
.donut-chart-container {
    width: 150px !important;
    height: 150px !important;
    margin: 0 auto !important;
}

.donut-center {
    width: 75px !important;
    height: 75px !important;
}

.donut-center-value {
    font-size: 20px !important;
}

.chart-legend {
    font-size: 11px;
    gap: 4px 8px;
    justify-content: center;
    margin-top: 10px !important;
    width: 100%;
    text-align: center;
}

/* Chart header — stack title and tabs */
.bi-chart-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    margin-bottom: 8px;
}

/* Chart tabs — scrollable, start from left */
.bi-chart-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    width: 100%;
}

.bi-chart-tabs .bi-tab {
    flex-shrink: 0;
    font-size: 10px;
    padding: 5px 10px;
    min-height: 32px;
    white-space: nowrap;
}

/* Bar chart — horizontally scrollable */
/* Override desktop: .chart-container{height:240px;display:flex;align-items:center;justify-content:center} */
#chart-usuarios {
    width: 100% !important;
    max-width: calc(100vw - 48px) !important;
    height: auto !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    align-items: flex-end !important;
    justify-content: flex-start !important;
}

/* Override desktop: .chart-bars{height:180px;overflow:hidden;justify-content:center} */
#chart-usuarios .chart-bars {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    gap: 2px !important;
    min-width: max-content !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px 0 4px 0 !important;
}

/* Override desktop: .chart-bar-item{flex:0 1 48px;overflow:hidden} */
#chart-usuarios .chart-bar-item {
    flex: 0 0 55px !important;
    min-width: 55px !important;
    overflow: visible !important;
}

/* ======================================
   TABLE — Detalhamento por Responsável
====================================== */

/* Card wrapper — hidden on mobile */
.bi-table-card {
    display: none !important;
}

/* Header — stack vertically */
.bi-table-header {
    flex-direction: column;
    gap: 8px;
    align-items: stretch !important;
    margin-bottom: 10px;
}

.bi-table-header h3 {
    font-size: 14px;
}

/* Search input */
.bi-table-search {
    width: 100%;
}

.bi-table-search input {
    width: 100%;
    min-height: 40px;
    font-size: 16px !important;
}

/* Table — force horizontal scroll by setting min-width wider than viewport */
.bi-table {
    min-width: 580px !important;
    border-collapse: collapse !important;
}

/* All cells — compact */
.bi-table th,
.bi-table td {
    font-size: 11px !important;
    padding: 8px 6px !important;
    white-space: nowrap !important;
    text-align: center !important;
}

/* First column — sticky "Responsável" */
.bi-table th:first-child,
.bi-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 2 !important;
    background: var(--bg-secondary) !important;
    text-align: left !important;
    min-width: 110px !important;
    max-width: 140px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Sticky header first-child needs darker bg */
.bi-table thead th:first-child {
    background: rgba(20,20,22,1) !important;
}

/* Data columns */
.bi-table th:not(:first-child),
.bi-table td:not(:first-child) {
    min-width: 75px !important;
}

/* Scroll hint gradient on right edge */
.bi-table-card::after {
    content: '';
    position: absolute;
    top: 80px;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, rgba(22,22,24,0.9));
    pointer-events: none;
    z-index: 3;
}

/* ======================================
   FUNCIONÁRIOS AJUSTES MOBILE
====================================== */
.funcionarios-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.funcionarios-header h2 {
    font-size: 18px;
}

.funcionarios-header .filter-quick-btn,
#btn-novo-funcionario {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    font-size: 14px;
}

.funcionarios-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table scroll shadow hint */
.funcionarios-body::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 25px;
    background: linear-gradient(to right, transparent, var(--bg-primary));
    pointer-events: none;
}

/* Action buttons in table */
.funcionarios-body .btn-sm {
    min-width: 44px;
    min-height: 36px;
}

/* ======================================
   MODAL DELETE CONFIRM MOBILE
====================================== */
#modal-delete-confirm .modal-body {
    padding: 20px 15px;
    text-align: center;
}

#modal-delete-confirm .modal-footer {
    flex-direction: column;
    gap: 10px;
}

#modal-delete-confirm .modal-footer button {
    width: 100%;
    min-height: 44px;
}

/* ======================================
   LIGHT THEME — NEW SECTIONS
====================================== */
body.light-theme .notion-sidebar {
    background: #ffffff;
    border-top-color: #e0e0e0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.15);
}

body.light-theme .notion-sidebar::before {
    background: rgba(0,0,0,0.15);
}

body.light-theme .notion-sidebar-toggle {
    box-shadow: 0 4px 15px rgba(211,84,0,0.3);
}

body.light-theme .notion-sidebar-overlay.active {
    background: rgba(0,0,0,0.3);
}

body.light-theme .slash-menu {
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
}

body.light-theme .cronograma-section,
body.light-theme .user-dashboard-section,
body.light-theme .planejamento-section {
    background: var(--bg-primary);
}

body.light-theme .modal-ia-content {
    background: #ffffff;
}

body.light-theme .ia-input-bar {
    border-top-color: #e0e0e0;
}