/* ==============================================================================
   02_base_elements.css — DESIGN SYSTEM INSTITUCIONAL MONTENEGRO INTERIORES (v2.3)
   Reset, Layout Base, Headers, Sidebar, Botões, Filtros, Formulários e Tabelas
   ============================================================================== */

/* -------------------------------------------------------------------------
   1. RESET GLOBAL & SCROLLBAR CORPORATIVA
   ------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    padding-left: 110px; /* Margem de segurança para a Sidebar fixa */
    overflow-x: hidden;
    line-height: 1.5;
}

html {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface-elevated) var(--bg-app);
}

/* Scrollbar fina, escura e ergonômica */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
}

#main-header {
    width: 0;
    height: 0;
    flex-shrink: 0;
}

main {
    flex-grow: 1;
    padding: 28px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    overflow-x: hidden;
}

/* -------------------------------------------------------------------------
   2. HIERARQUIA TIPOGRÁFICA & CABEÇALHOS DE PÁGINA (.page-header)
   ------------------------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 4px;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-title,
.page-header h1,
.page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-subtitle,
.header-content p,
.page-header p {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.4;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-link {
    color: var(--text-muted);
    font-size: 0.88rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition-fast);
}

.btn-link:hover {
    color: #ffffff;
}

/* -------------------------------------------------------------------------
   3. SIDEBAR ELEGANTE & NAVEGAÇÃO FLUTUANTE (GLASSMORPHISM)
   ------------------------------------------------------------------------- */
.sidebar {
    position: fixed;
    left: 10px;
    top: 10px;
    height: calc(100vh - 20px);
    width: 72px; /* Estado retraído */
    background: rgba(15, 17, 21, 0.45);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transition: width 350ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 350ms ease;
    box-shadow: var(--shadow-md);
}

.sidebar:hover,
.sidebar.mobile-open {
    width: 240px;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-subtle);
    transition: height 0.3s ease, padding 0.3s ease;
}

.sidebar:hover .sidebar-header,
.sidebar.mobile-open .sidebar-header {
    height: 100px;
    padding: 10px 12px;
}

.logo-container {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-container img {
    max-height: 52px;
    max-width: 52px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.sidebar:hover .logo-container img,
.sidebar.mobile-open .logo-container img {
    transform: scale(1.6) translateX(10px) translateY(4px);
}

/* Perfil do Operador na Sidebar */
.sidebar-user-profile {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    background: linear-gradient(135deg, rgba(229, 57, 53, 0.35) 0%, rgba(15, 17, 21, 0.8) 100%);
    border-bottom: 1px solid var(--border-subtle);
    overflow: hidden;
    white-space: nowrap;
}

.user-avatar {
    min-width: 36px;
    height: 36px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    color: var(--primary);
}

.user-avatar svg {
    width: 20px;
    height: 20px;
}

.user-details {
    margin-left: 14px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 300ms ease, transform 300ms ease;
    pointer-events: none;
}

.sidebar:hover .user-details,
.sidebar.mobile-open .user-details {
    opacity: 1;
    transform: translateX(0);
}

.user-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 140px;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Lista de Navegação (rolagem limpa: sem barra visível, mouse wheel e touch preservados) */
.sidebar,
.sidebar-nav {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

.sidebar-nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.nav-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 12px;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    position: relative;
    white-space: nowrap;
}

.nav-item .icon {
    font-size: 1.2rem;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    transition: all var(--transition-normal);
}

.nav-item .icon svg {
    width: 22px;
    height: 22px;
    opacity: 0.7;
    transition: all var(--transition-normal);
}

.nav-item .label {
    margin-left: 14px;
    font-size: 0.92rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 300ms ease, transform 300ms ease;
    pointer-events: none;
}

.sidebar:hover .nav-item .label,
.sidebar.mobile-open .nav-item .label {
    opacity: 1;
    transform: translateX(0);
}

.nav-item:hover {
    background: var(--bg-surface-elevated);
    color: #ffffff;
}

.nav-item:hover .icon svg {
    opacity: 1;
    transform: scale(1.08);
}

.nav-item.active {
    background: rgba(229, 57, 53, 0.12);
    border: 1px solid rgba(229, 57, 53, 0.28);
    color: #ffffff;
    font-weight: 600;
}

.nav-item.active .icon svg {
    opacity: 1;
    color: var(--primary-color);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 10px rgba(229, 57, 53, 0.5);
}

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid var(--border-subtle);
}

.btn-sair {
    color: #ff6b6b;
}

.btn-sair:hover {
    background: var(--primary-soft);
    color: #ff5252;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

body:has(.sidebar:hover, .sidebar.mobile-open) .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Compatibilidade com visibilidade dinâmica controlada por JS */
.nav-item[style*="inline-block"],
.nav-item[style*="block"],
#nav-gestao[style*="inline-block"] {
    display: flex !important;
}

/* Botão Hambúrguer Mobile: Totalmente Oculto por padrão em Desktop e Tablet */
.mobile-menu-toggle {
    display: none !important;
}

/* -------------------------------------------------------------------------
   4. SISTEMA UNIFICADO DE BOTÕES (.btn-*)
   ------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 10px 18px;
    height: 42px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    outline: none;
    user-select: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none !important;
}

/* Botão Primário: Vermelho Montenegro Institucional */
.btn-primary,
.btn-red,
.action-btn-primary,
.add-new-btn,
.btn-salvar,
#add-new-material-btn,
#btn-nova-op {
    background: linear-gradient(135deg, var(--primary) 0%, #c62828 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(229, 57, 53, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.btn-primary:hover,
.btn-red:hover,
.action-btn-primary:hover,
.add-new-btn:hover,
.btn-salvar:hover,
#add-new-material-btn:hover,
#btn-nova-op:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #b71c1c 100%);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 16px rgba(229, 57, 53, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Botão Secundário / Neutro */
.btn-secondary,
.btn-light {
    background-color: var(--bg-surface-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    height: 42px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.btn-secondary:hover,
.btn-light:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Botão Perigo / Exclusão */
.btn-danger {
    background-color: var(--status-red);
    color: #ffffff;
    border: 1px solid var(--status-red);
    border-radius: var(--radius-sm);
    height: 42px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.3);
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background-color: #b71c1c;
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.45);
}

/* Botões de Ferramenta (Toggle View, Impressão, Exportação) */
.view-toggle-btn,
.print-btn,
.btn-tool {
    height: 42px;
    min-width: 42px;
    padding: 0 12px;
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.view-toggle-btn:hover,
.print-btn:hover,
.btn-tool:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.view-toggle-btn svg,
.print-btn svg,
.btn-tool svg {
    width: 20px;
    height: 20px;
}

/* Botão de Ação Compacto / Operacional em Tabelas */
.btn-action,
.action-btn,
.btn-detalhes,
.btn-info-small {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    padding: 6px 14px;
    height: 32px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-action:hover,
.action-btn:hover,
.btn-detalhes:hover,
.btn-info-small:hover {
    background: var(--primary-soft);
    border-color: var(--border-highlight);
    color: #ffffff;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-surface-elevated);
    color: #ffffff;
}

.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Tamanhos auxiliares */
.btn-sm {
    padding: 6px 12px;
    height: 32px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 14px 24px;
    height: 48px;
    font-size: 1rem;
}

.w-full {
    width: 100% !important;
}

/* -------------------------------------------------------------------------
   5. CONTROLES UNIFICADOS DE FILTRO & BUSCA (.controls-bar, .agenda-controls, etc.)
   ------------------------------------------------------------------------- */
.controls-bar,
.agenda-controls,
.filter-bar,
.filters-wrapper,
.filters-container,
.search-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

/* Linha Principal: Pesquisa + Filtros Lado a Lado (Preenchendo 100% da Largura Disponível) */
.controls-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
    flex-wrap: nowrap;
    box-sizing: border-box;
}

/* Box de Busca Universal (Sempre o Maior Elemento da Linha) */
.controls-row .search-box,
.controls-bar .search-box,
.agenda-controls .search-box,
.filters-container .search-box,
.search-box,
.search-input-wrapper {
    flex: 3 1 300px;
    min-width: 200px;
    max-width: none;
    width: auto;
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.search-box svg,
.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.search-box input,
.search-input-wrapper input,
.controls-bar input[type="text"],
.agenda-controls input[type="text"] {
    width: 100%;
    height: 42px;
    padding: 10px 16px 10px 42px;
    background-color: var(--bg-surface-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
    outline: none;
    box-sizing: border-box;
}

.search-box input:focus,
.search-input-wrapper input:focus,
.controls-bar input[type="text"]:focus,
.agenda-controls input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background-color: var(--bg-surface-elevated);
}

.search-box:focus-within svg,
.search-input-wrapper:focus-within .search-icon {
    color: var(--primary);
}

/* Box de Filtro Select (Preenche Proporcionalmente a Linha ao Lado da Busca) */
.controls-row .filter-box,
.controls-bar .filter-box,
.agenda-controls .filter-box,
.filters-container .filter-box,
.filter-box {
    flex: 1 1 180px;
    min-width: 140px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.filter-box select,
.filters select {
    width: 100%;
    height: 42px;
    display: block;
    box-sizing: border-box;
}

/* Suporte caso haja agrupador .filters */
.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
}

.filters .filter-box {
    flex: 1 1 140px;
}

/* Linha de Ações/Botões (Sempre na Linha de Baixo) */
.controls-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    box-sizing: border-box;
}

.actions-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* -------------------------------------------------------------------------
   6. FORMULÁRIOS, INPUTS E SELECTS CUSTOMIZADOS
   ------------------------------------------------------------------------- */
.form-group {
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: var(--space-4);
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-label,
label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

.form-control,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="password"],
input[type="email"],
input[type="url"],
select,
textarea {
    width: 100%;
    height: 42px;
    padding: 10px 14px;
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
    outline: none;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background-color: var(--bg-surface-elevated);
}

/* Select Estilizado Escuro com Seta SVG Embutida */
select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

select:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: var(--bg-surface-elevated);
}

select option {
    background-color: #14171d;
    color: #f1f5f9;
    padding: 8px 12px;
}

select optgroup {
    background-color: #0b0d11;
    color: var(--text-muted);
    font-weight: 700;
}

textarea {
    height: auto;
    resize: vertical;
    min-height: 80px;
}

/* -------------------------------------------------------------------------
   7. TABELAS OPERACIONAIS PADRONIZADAS (.table-container, table)
   ------------------------------------------------------------------------- */
.table-responsive,
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
}

table,
.production-table,
.history-table,
.users-table,
.estoque-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-main);
}

thead,
th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bg-surface-elevated);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

/* Valores monetários, datas e quantidades com espaçamento uniforme */
td.numeric,
td.valor,
td.data,
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

tbody tr {
    transition: background-color var(--transition-fast);
}

tbody tr:nth-child(even) {
    background-color: var(--bg-surface-alt);
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* -------------------------------------------------------------------------
   8. STATUS BADGES & PILLS UNIFICADOS
   ------------------------------------------------------------------------- */
.badge,
.status-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1;
    text-transform: capitalize;
    white-space: nowrap;
}

.status-badge.status-normal,
.status-pill.status-normal,
.status-finalizado-text,
.kpi-normal .kpi-value,
.badge-normal {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.status-baixo,
.status-pill.status-baixo,
.status-producao-text,
.kpi-baixo .kpi-value,
.badge-baixo {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-badge.status-critico,
.status-pill.status-critico,
.kpi-critico .kpi-value,
.badge-critico {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-aguardando,
.status-alerta {
    color: #f59e0b;
}

/* -------------------------------------------------------------------------
   9. NAVEGAÇÃO POR ABAS (TABS MENU)
   ------------------------------------------------------------------------- */
.tabs-menu,
.tabs-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tabs-menu::-webkit-scrollbar,
.tabs-nav::-webkit-scrollbar {
    height: 0px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 18px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.75;
    transition: opacity var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn:hover svg {
    opacity: 1;
}

.tab-btn.active {
    color: #ffffff;
    border-bottom-color: var(--primary);
    background: rgba(229, 57, 53, 0.06);
}

.tab-btn.active svg {
    opacity: 1;
    color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInTab 0.25s ease-out;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------------
   10. SISTEMA DE NOTIFICAÇÕES (TOASTS)
   ------------------------------------------------------------------------- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.92rem;
    font-weight: 500;
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    pointer-events: auto;
    animation: slideInToast 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.error,
.toast.danger {
    border-left-color: var(--status-red);
}

.toast.success {
    border-left-color: var(--status-green);
}

.toast.warning {
    border-left-color: var(--status-amber);
}

@keyframes slideInToast {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* -------------------------------------------------------------------------
   11. RESPONSIVIDADE MOBILE-FIRST & DRAWER LATERAL SUAVE
   ------------------------------------------------------------------------- */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        padding-left: 0;
        padding-top: 60px;
    }

    main {
        padding: 16px;
        margin: 0;
        max-width: 100vw;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .controls-row .search-box,
    .controls-bar .search-box,
    .agenda-controls .search-box,
    .filters-container .search-box,
    .controls-row .filter-box,
    .controls-bar .filter-box,
    .agenda-controls .filter-box,
    .filters-container .filter-box,
    .search-box,
    .search-input-wrapper {
        max-width: 100%;
        min-width: 100%;
        width: 100%;
        flex: none;
    }

    .controls-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .actions-group {
        width: 100%;
        justify-content: space-between;
    }

    /* Mobile Topbar Fixa */
    .sidebar {
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        flex-direction: column;
        border-radius: 0;
        border-left: none;
        border-top: none;
        border-bottom: none;
        box-shadow: var(--shadow-xl);
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 99999;
        background: rgba(15, 17, 21, 0.96);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        z-index: 99998;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar.mobile-open ~ .sidebar-overlay,
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-header {
        height: 70px;
        border-bottom: 1px solid var(--border-subtle);
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
    }

    .sidebar,
    .sidebar-nav {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    .sidebar::-webkit-scrollbar,
    .sidebar-nav::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }

    .sidebar-nav {
        flex-direction: column;
        overflow-y: auto;
        padding: 16px 12px;
        height: auto;
        opacity: 1;
        -webkit-overflow-scrolling: touch;
    }

    .nav-item .label {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }

    .sidebar-user-profile {
        display: flex;
    }

    .user-details {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }

    .sidebar-footer {
        display: block;
    }

    /* Botão Hambúrguer Mobile Flutuante */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 10px;
        left: 10px;
        width: 42px;
        height: 42px;
        border-radius: var(--radius-md);
        background: var(--bg-surface);
        border: 1px solid var(--border-medium);
        color: var(--text-main);
        z-index: 99999;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        transition: background-color var(--transition-fast), border-color var(--transition-fast);
    }

    .mobile-menu-toggle:hover {
        background: var(--bg-surface-elevated);
        border-color: var(--primary-color);
    }

    #toast-container {
        top: 16px;
        bottom: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 90%;
    }
}

/* -------------------------------------------------------------------------
   12. MICROINTERAÇÕES TÁTEIS & FEEDBACK DE CLIQUE EM BOTÕES
   ------------------------------------------------------------------------- */
.btn:active,
.btn-action:active,
.action-btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active,
.tab-btn:active,
.mobile-menu-toggle:active,
.view-toggle-btn:active,
.print-btn:active,
.add-new-btn:active {
    transform: scale(0.975);
    transition: transform 0.05s ease;
}

:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--primary-color) !important;
}

/* -------------------------------------------------------------------------
   13. SKELETON SCREENS (PREVENÇÃO DE CLS & CARREGAMENTO FLUIDO DE DADOS)
   ------------------------------------------------------------------------- */
@keyframes skeletonShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton,
.skeleton-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.08) 37%,
        rgba(255, 255, 255, 0.03) 63%
    );
    background-size: 400% 100%;
    animation: skeletonShimmer 1.6s ease infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

.skeleton-text {
    height: 13px;
    margin-bottom: 6px;
    border-radius: 4px;
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.skeleton-card {
    min-height: 160px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.page-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), #ff7961);
    z-index: 999999;
    transition: width 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0 8px var(--primary-color);
}
