/* =========================================
   VARIÁVEIS DESENHO MODERNO (GLASSMORPHISM)
   ========================================= */
:root {
    --primary-color: #e67e22;
    /* Laranja vibrante */
    --primary-hover: #d35400;
    --secondary-color: #2b2e38;
    --accent-color: #f1c40f;
    /* Dourado */
    --bg-color: #0f0a09;
    /* Terroso escuro */
    --panel-bg: rgba(18, 12, 10, 0.88);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-color: #ffffff; /* Texto 100% visível e brilhante */
    --text-muted: #cbd5e1; /* Texto secundário com maior contraste */
    --danger-color: #f85149;
    --danger-hover: #da3633;

    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
    --radius-md: 12px;
    --radius-lg: 16px;

    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

/* =========================================
   RESETS E CONFIGURAÇÕES GERAIS
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow: hidden;
    position: relative;
    height: 100vh;
}

/* Elementos de Fundo */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
    /* Fundo mais escuro para garantir total leitura do texto */
    background-image: linear-gradient(rgba(10, 15, 28, 0.92), rgba(10, 15, 28, 0.97)), url('bg-floresta.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.4;
    border-radius: 50%;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: rgba(230, 126, 34, 0.3);
    /* Laranja */
}

.blob-2 {
    bottom: -10%;
    right: -5%;
    width: 600px;
    height: 600px;
    background: rgba(231, 76, 60, 0.2);
    /* Vermelho Pôr do Sol */
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 400px;
    height: 400px;
    background: rgba(241, 196, 15, 0.15);
    /* Dourado */
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.2);
    }
}

/* =========================================
   LAYOUT
   ========================================= */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.main-header {
    text-align: center;
    margin-bottom: 1rem;
}

.main-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    background: linear-gradient(135deg, #fff, #8ab4f8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.2rem;
}

.main-header p {
    color: var(--accent-color);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

/* Glass Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.section-title {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--panel-border);
}

.section-title h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Forms */
.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

/* Layout Simétrico de 2 Colunas para Cadastros (Formulário + Tabela) */
.form-table-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .form-table-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.grid-form-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 1rem;
    align-items: end;
}

@media (max-width: 768px) {
    .grid-form-items {
        grid-template-columns: 1fr 1fr;
    }

    .btn-group {
        grid-column: span 2;
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input,
select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(11, 107, 199, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* =========================================
   SIDEBAR E LAYOUT PRINCIPAL DA SPA
   ========================================= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: rgba(22, 43, 28, 0.95); /* Verde musgo escuro */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    align-self: flex-start;
}

.brand {
    text-align: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

.brand h2 {
    color: #fff;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    font-size: 1.5rem;
}

.brand span {
    color: var(--accent-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.sidebar nav ul {
    list-style: none;
    flex: 1;
}

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1rem 2rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar nav ul li a i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: all 0.3s;
}

.sidebar nav ul li a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.sidebar nav ul li a:hover i {
    color: var(--primary-color);
}

.sidebar nav ul li a.active {
    background: rgba(11, 107, 199, 0.1);
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar nav ul li a.active i {
    color: var(--primary-color);
}

.logout-link {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ÁREA DE CONTEÚDO (MAIN) */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    max-height: 100vh;
}

.view-section {
    max-width: 1200px;
    margin: 0 auto;
    display: none;
}

.view-section.active-section {
    animation: fadeIn 0.24s ease-out forwards;
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* TELA DE LOGIN */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-image: linear-gradient(rgba(10, 15, 28, 0.85), rgba(10, 15, 28, 0.94)), url('bg-floresta.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    z-index: 10;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo-text {
    font-size: 2.2rem;
    font-family: var(--font-heading);
    color: var(--primary-color);
    text-transform: uppercase;
}

.login-header .logo-text span {
    font-size: 0.9rem;
    color: var(--accent-color);
    display: block;
    margin-top: 5px;
}

.login-panel {
    padding: 3rem 2rem;
    background: rgba(15, 20, 25, 0.6);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
}

.input-with-icon input {
    padding-left: 45px;
    width: 100%;
}

.badge {
    color: var(--accent-color);
    font-size: 0.7rem;
    background: rgba(44, 201, 144, 0.1);
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: 5px;
}

.error-msg {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--danger-color);
    color: #ff7b72;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 15px;
}

.login-btn {
    width: 100%;
    margin-top: 10px;
}

.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 15px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.login-divider:not(:empty)::before {
    margin-right: .8em;
}

.login-divider:not(:empty)::after {
    margin-left: .8em;
}


/* DASHBOARD INFORMATIVO */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.kpi-data h3 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    color: #fff;
}

.kpi-data p {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-box {
    padding: 1.5rem;
    height: 400px;
    position: relative;
    overflow: hidden;
}

.chart-box h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-box h3 i {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   BOTÕES
   ========================================= */
button {
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(11, 107, 199, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(11, 107, 199, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(248, 81, 73, 0.3);
    padding: 0.5rem;
    border-radius: 8px;
}

.btn-danger:hover {
    background: var(--danger-color);
    color: #fff;
}

/* =========================================
   TABELA DE ITENS
   ========================================= */
.tabela-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

.tabela-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: #fff;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Compactação de tabela premium para evitar quebra de linhas na Entrada de Toras */
#panelListaEntradas table,
#panelListaEmpreiteiros table {
    min-width: auto;
}

#panelListaEntradas th,
#panelListaEntradas td,
#panelListaEmpreiteiros th,
#panelListaEmpreiteiros td {
    padding: 6px 8px !important;
    font-size: 0.76rem !important;
    white-space: nowrap !important;
    vertical-align: middle;
}

#panelListaEntradas td strong,
#panelListaEmpreiteiros td strong {
    font-size: 0.82rem;
}

#panelListaEntradas small,
#panelListaEmpreiteiros small {
    font-size: 0.68rem !important;
}

#panelListaEntradas button,
#panelListaEmpreiteiros button {
    padding: 4px 6px !important;
    font-size: 0.78rem !important;
    height: auto !important;
    width: auto !important;
}

td {
    font-variant-numeric: tabular-nums;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

tfoot {
    background: rgba(44, 201, 144, 0.05);
}

tfoot td {
    border-top: 2px solid rgba(44, 201, 144, 0.3);
    border-bottom: none;
    color: #fff;
    font-size: 1.1rem;
}

.total-highlight {
    color: var(--accent-color);
    font-family: var(--font-heading);
    font-size: 1.3rem !important;
}

.text-right {
    text-align: right;
}

/* =========================================
   MENSAGENS VAZIAS / ESTADOS
   ========================================= */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* =========================================
   ASSINATURAS (Apenas impressão)
   ========================================= */
.show-on-print {
    display: none;
}

.signatures {
    margin-top: 60px;
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.signature-box {
    text-align: center;
    width: 40%;
}

.signature-box .line {
    border-bottom: 1px solid #000;
    margin-bottom: 10px;
    width: 100%;
}

/* =========================================
   LAYOUT COMPACTO (FASE 4)
   ========================================= */
.compact-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
}

.compact-form .input-group label {
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.compact-form .input-group input,
.compact-form .input-group select {
    padding: 6px 10px;
    font-size: 0.9rem;
}

/* =========================================
   ESTILOS DE IMPRESSÃO
   ========================================= */
@media print {
    body {
        background: #fff;
        color: #000;
        min-height: auto;
    }

    .app-wrapper {
        display: block;
    }

    .sidebar {
        display: none !important;
    }

    .main-content {
        padding: 0;
        overflow: visible;
    }

    .app-container {
        padding: 0;
        max-width: 100%;
        gap: 0;
    }

    .hide-on-print {
        display: none !important;
    }

    .show-on-print {
        display: flex !important;
    }

    .glass-panel {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 10px 0;
        border-radius: 0;
    }

    input,
    select {
        border: none;
        background: transparent;
        color: #000;
        padding: 0;
        font-size: 12px;
        pointer-events: none;
        -webkit-appearance: none;
        appearance: none;
    }

    label {
        color: #555;
        font-size: 10px;
    }

    .section-title {
        border-bottom: 2px solid #000;
        margin-bottom: 15px;
    }

    .section-title h2 {
        color: #000;
        font-size: 14pt;
    }

    .main-header h1 {
        -webkit-text-fill-color: #000;
        color: #000;
        font-size: 18pt;
    }

    .main-header p {
        color: #555;
    }

    table {
        border-collapse: collapse;
    }

    th,
    td {
        border: 1px solid #000 !important;
        padding: 5px;
        font-size: 11px;
    }

    th {
        color: #000;
        background-color: #eee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    tfoot td {
        color: #000;
        border-top: 2px solid #000 !important;
    }

    .total-highlight {
        color: #000;
        font-weight: bold;
    }

    .grid-form {
        grid-template-columns: 1fr 1fr;
        gap: 10px 20px;
    }

    .input-group {
        border-bottom: 1px solid #ccc;
        padding-bottom: 5px;
    }

    @page {
        margin: 1cm;
    }
}

/* =========================================
   ESTILOS CALENDÁRIO E AGENDA
   ========================================= */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.calendar-day-head {
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    padding-bottom: 10px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
    color: var(--text-color);
}

.calendar-day:hover {
    background: rgba(230, 126, 34, 0.1);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.calendar-day.other-month {
    opacity: 0.2;
}

.calendar-day.today {
    background: rgba(230, 126, 34, 0.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(230, 126, 34, 0.3);
}

.calendar-day.selected {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.day-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    margin-top: 4px;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 1rem;
}

.event-item {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--primary-color);
    padding: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-item span {
    font-size: 0.9rem;
    flex: 1;
}

.event-item .btn-del-event {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 5px;
    opacity: 0.7;
}

.event-item .btn-del-event:hover {
    opacity: 1;
    color: #fff;
}
 
 . p r o f i l e - d r o p d o w n . s h o w   {   d i s p l a y :   b l o c k   ! i m p o r t a n t ;   } 
 
.profile-dropdown.show { display: block !important; }
.dropdown-item:hover { background: rgba(255,255,255,0.05); }

/* Injeção premium Orqeustracs: letras maiúsculas instantâneas */
.text-uppercase-input {
    text-transform: uppercase;
}

/* Grid Fixo de Duas Colunas para Formulários Complexos */
.grid-form-fixed-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.col-span-2 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .grid-form-fixed-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .col-span-2 {
        grid-column: span 1;
    }
}

/* --- SIDEBAR RETRÁTIL & CLEAN LAYOUT (Orquestra.cs Premium Upgrade) --- */
.sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
    flex-shrink: 0;
}

/* Estado de Menu Recolhido */
.app-wrapper.sidebar-collapsed .sidebar {
    width: 70px;
    padding: 1.5rem 0;
}

.app-wrapper.sidebar-collapsed .sidebar .brand {
    padding-bottom: 1.5rem;
}

/* Ocultar logotipo textual em collapse */
.app-wrapper.sidebar-collapsed .sidebar .brand div span:nth-child(2),
.app-wrapper.sidebar-collapsed .sidebar .brand div:nth-child(2) {
    display: none !important;
}

.app-wrapper.sidebar-collapsed .sidebar .brand div span:first-child {
    font-size: 28px !important;
}

/* Alinhamento de Ícones no Menu */
.app-wrapper.sidebar-collapsed .sidebar nav ul li a {
    padding: 1rem 0;
    justify-content: center;
    border-left-width: 4px;
    font-size: 0 !important; /* Oculta o texto do link */
    gap: 0;
}

.app-wrapper.sidebar-collapsed .sidebar nav ul li a i {
    font-size: 1.3rem !important;
    margin: 0;
    width: auto;
}

.app-wrapper.sidebar-collapsed .sidebar nav ul li a.logout-link {
    font-size: 0 !important;
}

.app-wrapper.sidebar-collapsed .sidebar nav ul li a.logout-link i {
    font-size: 1.3rem !important;
}

/* --- OTIMIZAÇÃO DE SCROLLBARS (Visual Ultra Premium - Otimizado e Mais Confortável) --- */
::-webkit-scrollbar {
    width: 14px; /* Barra de scroll maior como solicitado */
    height: 14px;
}

::-webkit-scrollbar-track {
    background: rgba(230, 126, 34, 0.03); /* Tom suave terroso/alaranjado */
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: rgba(230, 126, 34, 0.35); /* Laranja amadeirado translúcido */
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    background-clip: padding-box;
    border: 3px solid transparent;
}

/* =========================================================================
   TEMA PÁTIO SIMPLIFICADO (Orquestra.cs - Clean Dark)
   ========================================================================= */
.patio-wood-theme .modal-content-v2 {
    background: #1e1e24 !important;
    color: #dde1e7 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5) !important;
}

.patio-wood-theme h2 { color: #f0f0f5 !important; }
.patio-wood-theme h3 { color: #c8c8d4 !important; font-size: 0.95rem !important; }
.patio-wood-theme small { color: #8a8a9a !important; }

/* Painéis internos */
.patio-wood-theme .glass-panel {
    background: #26262e !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

/* Grade de Parâmetros - 4 colunas compactas */
.patio-params-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Grade do formulário de lançamento - compacta */
.patio-form-grid {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) minmax(125px, 1fr) minmax(150px, 1fr) repeat(3, minmax(80px, 0.7fr)) minmax(68px, 0.5fr) minmax(190px, 1.25fr) minmax(70px, 0.55fr) 48px;
    gap: 8px;
    align-items: flex-end;
}

@media (max-width: 1200px) {
    .patio-params-grid { grid-template-columns: repeat(2, 1fr); }
    .patio-form-grid { grid-template-columns: repeat(4, 1fr); }
    .patio-form-grid .btn-add-lote-col { grid-column: span 4; }
}
@media (max-width: 700px) {
    .patio-params-grid { grid-template-columns: 1fr 1fr; }
    .patio-form-grid { grid-template-columns: 1fr 1fr; }
    .patio-form-grid .btn-add-lote-col { grid-column: span 2; }
}

/* KPI Cards simples */
.patio-wood-theme .patio-kpi-card {
    background: #2c2c36 !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    padding: 14px 16px !important;
    border-radius: 10px !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.patio-wood-theme .patio-kpi-card .kpi-label {
    color: #888899 !important;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.patio-wood-theme .patio-kpi-card .kpi-value {
    color: #f0f0f5 !important;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}
.patio-wood-theme .patio-kpi-blue { border-left: 3px solid #3b82f6 !important; }
.patio-wood-theme .patio-kpi-blue .kpi-label { color: #93c5fd !important; }
.patio-wood-theme .patio-kpi-blue .kpi-value { color: #bfdbfe !important; }
.patio-wood-theme .patio-kpi-green { border-left: 3px solid #22c55e !important; }
.patio-wood-theme .patio-kpi-green .kpi-label { color: #86efac !important; }
.patio-wood-theme .patio-kpi-green .kpi-value { color: #bbf7d0 !important; }

/* Labels e campos compactos */
.patio-wood-theme label {
    color: #9090a0 !important;
    font-size: 0.72rem !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
}
.patio-wood-theme input,
.patio-wood-theme select {
    background: #16161c !important;
    border: 1px solid #383845 !important;
    color: #dde1e7 !important;
    border-radius: 6px !important;
    padding: 7px 10px !important;
    font-size: 0.88rem !important;
    width: 100%;
}
.patio-wood-theme input:focus,
.patio-wood-theme select:focus {
    border-color: #e67e22 !important;
    outline: none !important;
}
.patio-wood-theme input::placeholder { color: #505060 !important; }

/* Tabelas */
.patio-wood-theme th {
    color: #9090a0 !important;
    font-size: 0.72rem !important;
    padding: 10px 8px !important;
    border-bottom: 1px solid #383845 !important;
    font-weight: 700;
    text-transform: uppercase;
}
.patio-wood-theme td {
    padding: 10px 8px !important;
    border-bottom: 1px solid #2a2a35 !important;
    color: #c8c8d8 !important;
    font-size: 0.85rem;
}
.patio-wood-theme tbody tr:hover { background: rgba(255,255,255,0.03) !important; }

/* Botões do Pátio */
.patio-wood-theme .btn-patio-zerar {
    border: 1px solid #383845 !important;
    background: #2c2c36 !important;
    color: #c8c8d4 !important;
    font-size: 0.8rem !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.15s !important;
}
.patio-wood-theme .btn-patio-zerar:hover {
    background: #383845 !important;
    color: #f0f0f5 !important;
}

.patio-wood-theme .btn-patio-print {
    background: #e67e22 !important;
    color: #fff !important;
    font-size: 0.8rem !important;
    padding: 8px 18px !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer !important;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.15s !important;
}
.patio-wood-theme .btn-patio-print:hover { background: #d35400 !important; }

.patio-wood-theme .btn-patio-exit {
    border: 1px solid rgba(239,68,68,0.35) !important;
    background: rgba(239,68,68,0.08) !important;
    color: #f87171 !important;
    font-size: 0.8rem !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.15s !important;
}
.patio-wood-theme .btn-patio-exit:hover {
    background: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
}

.patio-wood-theme .btn-patio-save {
    background: #16a34a !important;
    color: #fff !important;
    border: none !important;
    transition: background 0.15s !important;
}
.patio-wood-theme .btn-patio-save:hover { background: #15803d !important; }

/* Select de qualidade do lote */
.patio-classe-select {
    color: #ffffff !important;
    font-weight: 900 !important;
    border-width: 2px !important;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.patio-classe-select option {
    background: #111827;
    color: #ffffff;
}
.patio-classe-select.patio-classe-1 {
    background: #16a34a !important;
    border-color: #22c55e !important;
}
.patio-classe-select.patio-classe-2 {
    background: #facc15 !important;
    border-color: #eab308 !important;
    color: #111827 !important;
}
.patio-classe-select.patio-classe-3 {
    background: #dc2626 !important;
    border-color: #ef4444 !important;
}

/* Badges de classe */
.patio-wood-theme .patio-tag-1a {
    color: #ffffff !important;
    background: #16a34a !important;
    border: 1px solid #22c55e !important;
}
.patio-wood-theme .patio-tag-2a {
    color: #fbbf24 !important;
    background: rgba(245,158,11,0.15) !important;
    border: 1px solid rgba(245,158,11,0.3) !important;
}
.patio-wood-theme .patio-tag-3a {
    color: #f87171 !important;
    background: rgba(239,68,68,0.15) !important;
    border: 1px solid rgba(239,68,68,0.3) !important;
}

/* Botões +/- de quantidade */
.patio-wood-theme .btn-patio-action-minus {
    border-color: rgba(239,68,68,0.3) !important;
    background: rgba(239,68,68,0.1) !important;
    color: #f87171 !important;
}
.patio-wood-theme .btn-patio-action-minus:hover {
    background: #dc2626 !important; color: #fff !important;
}
.patio-wood-theme .btn-patio-action-plus {
    background: #e67e22 !important;
}
.patio-wood-theme .btn-patio-action-plus:hover { background: #d35400 !important; }

/* Sobrescrita de cores JS */
.patio-wood-theme td[style*="color: #475569"],
.patio-wood-theme td[style*="color: #64748b"],
.patio-wood-theme td[style*="color: #94a3b8"] { color: #8a8a9a !important; }
.patio-wood-theme td[style*="color: #0f172a"],
.patio-wood-theme td div[style*="color: #0f172a"] { color: #dde1e7 !important; }
.patio-wood-theme td div[style*="color: #2563eb"] { color: #60a5fa !important; }
.patio-wood-theme td div[style*="color: #16a34a"],
.patio-wood-theme td span[style*="color: #16a34a"],
.patio-wood-theme td small[style*="color: #16a34a"] { color: #4ade80 !important; }
.patio-wood-theme td small[style*="color: #64748b"],
.patio-wood-theme td small[style*="color: #94a3b8"] { color: #6b6b7a !important; }

/* Botão Ver/Imprimir do Histórico */
.patio-wood-theme button[onclick*="imprimirHistoricoPatio"] {
    background: rgba(37,99,235,0.12) !important;
    border: 1px solid rgba(59,130,246,0.3) !important;
    color: #93c5fd !important;
}
.patio-wood-theme button[onclick*="imprimirHistoricoPatio"]:hover {
    background: #2563eb !important; color: #fff !important;
}


/* --- BOTÕES FLUTUANTES DE NAVEGAÇÃO DE TELA (Scroll Helper Widget) --- */
.btn-scroll-helper:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(230, 126, 34, 0.5) !important;
}

/* --- BOTÕES DE AÇÃO PREMIUM EM CARD (Card Action Buttons - Orquestra.cs Premium Upgrade) --- */
.btn-action-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%) !important;
    border: 1px solid rgba(230, 126, 34, 0.35) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    padding: 11px 22px !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

.btn-action-card i {
    font-size: 1.05rem !important;
    color: var(--accent-color) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn-action-card:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, #e67e22 100%) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
    transform: translateY(-4px) scale(1.04) !important;
    box-shadow: 0 10px 25px rgba(230, 126, 34, 0.5) !important;
}

.btn-action-card:hover i {
    color: #ffffff !important;
    transform: scale(1.2) rotate(10deg) !important;
}

.btn-action-card:active {
    transform: translateY(-1px) scale(1.0) !important;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3) !important;
}

/* --- ESTILOS EXCLUSIVOS DO MOCKUP CONTROLE DE PÁTIO (Light Clean Workspace) --- */
.btn-patio-light {
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.5px !important;
    padding: 10px 20px !important;
    border-radius: 30px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}
.btn-patio-light:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    transform: translateY(-1px) !important;
}

.btn-patio-red {
    background: #dc2626 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.5px !important;
    padding: 10px 22px !important;
    border-radius: 30px !important;
    cursor: pointer !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2) !important;
    transition: all 0.2s ease !important;
}
.btn-patio-red:hover {
    background: #b91c1c !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(220, 38, 38, 0.35) !important;
}

.btn-patio-save:hover {
    background: #15803d !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(22, 163, 74, 0.35) !important;
}

/* Custom class badges style */
.patio-tag-classe {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.78rem;
    text-align: center;
}
.patio-tag-1a {
    color: #ffffff !important;
    background: #16a34a !important;
    border: 1px solid #22c55e !important;
}
.patio-tag-2a {
    color: #b45309 !important;
    background: #fffbeb !important;
    border: 1px solid #fde68a !important;
}
.patio-tag-3a {
    color: #dc2626 !important;
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
}

/* Quantity controls */
.btn-patio-action-minus {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #fca5a5 !important;
    background: #fef2f2 !important;
    color: #ef4444 !important;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.btn-patio-action-minus:hover {
    background: #fee2e2 !important;
    transform: scale(1.08);
}

.btn-patio-action-plus {
    padding: 6px 16px;
    border-radius: 20px;
    border: none !important;
    background: #2563eb !important;
    color: #ffffff !important;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
}
.btn-patio-action-plus:hover {
    background: #1d4ed8 !important;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

/* =========================================
   RECIBO / HOLERITE PRINT CONFIG
   ========================================= */
@media print {
    body.printing-holerite {
        background: white !important;
        color: black !important;
    }
    body.printing-holerite .app-wrapper,
    body.printing-holerite .modal-v2:not(#modalHolerite) {
        display: none !important;
    }
    body.printing-holerite #modalHolerite {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        display: block !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        z-index: 999999 !important;
    }
    body.printing-holerite #modalHolerite .modal-content-v2 {
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        color: black !important;
    }
    
    body.printing-relatorio {
        background: white !important;
        color: black !important;
    }
    body.printing-relatorio .app-wrapper,
    body.printing-relatorio .modal-v2:not(#modalRelatorioHE) {
        display: none !important;
    }
    body.printing-relatorio #modalRelatorioHE {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        display: block !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        z-index: 999999 !important;
    }
    body.printing-relatorio #modalRelatorioHE .modal-content-v2 {
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        color: black !important;
    }
}

/* =========================================
   CONTROLE DE ACESSO BASEADO EM FUNÇÃO (RBAC)
   ========================================= */

/* Perfis no body */
/* 1. Patrão: Leitura Apenas (Dashboard, Histórico de Cargas, Pátio) */
body.role-patrao button.btn-primary:not(.allow-read-only),
body.role-patrao button.btn-danger,
body.role-patrao .btn-action-card:not(.allow-read-only),
body.role-patrao button[type="submit"],
body.role-patrao button[title*="Editar"],
body.role-patrao button[title*="Excluir"],
body.role-patrao button[title*="Alterar"],
body.role-patrao button[title*="Excluir Registro"],
body.role-patrao button[onclick*="Editar"],
body.role-patrao button[onclick*="Excluir"],
body.role-patrao button[onclick*="excluir"],
body.role-patrao button[onclick*="deletar"],
body.role-patrao button[onclick*="alterar"],
body.role-patrao #btnAbrirControleProducao,
body.role-patrao .form-container,
body.role-patrao form button {
    display: none !important;
}

/* 2. Mecânico: Apenas Frotas e Configurações */
body.role-mecanico .sidebar nav ul li a:not([data-target="view-frotas"]):not([data-target="view-configuracoes"]) {
    display: none !important;
}

/* 3. Muqueiro: Apenas Entrada de Toras e Configurações */
body.role-muqueiro .sidebar nav ul li a:not([data-target="view-entrada"]):not([data-target="view-configuracoes"]) {
    display: none !important;
}

/* 4. Estoquista: Apenas Estoque e Configurações */
body.role-estoquista .sidebar nav ul li a:not([data-target="view-estoque"]):not([data-target="view-configuracoes"]) {
    display: none !important;
}

/* 5. Pendente: Bloquear interface e exibir apenas tela de análise */
body.role-pendente .sidebar {
    display: none !important;
}
body.role-pendente .app-wrapper {
    display: block !important;
}
body.role-pendente .global-header {
    display: none !important;
}

/* Loader industrial: serra circular girando */
.saw-loader {
    width: 1.05em;
    height: 1.05em;
    display: inline-block;
    vertical-align: -0.16em;
    margin-right: 0.45em;
    border-radius: 50%;
    background:
        conic-gradient(from 0deg, #f8fafc 0 10deg, #94a3b8 10deg 20deg, #f8fafc 20deg 30deg, #64748b 30deg 40deg, #f8fafc 40deg 50deg, #94a3b8 50deg 60deg, #f8fafc 60deg 70deg, #64748b 70deg 80deg, #f8fafc 80deg 90deg, #94a3b8 90deg 100deg, #f8fafc 100deg 110deg, #64748b 110deg 120deg, #f8fafc 120deg 130deg, #94a3b8 130deg 140deg, #f8fafc 140deg 150deg, #64748b 150deg 160deg, #f8fafc 160deg 170deg, #94a3b8 170deg 180deg, #f8fafc 180deg 190deg, #64748b 190deg 200deg, #f8fafc 200deg 210deg, #94a3b8 210deg 220deg, #f8fafc 220deg 230deg, #64748b 230deg 240deg, #f8fafc 240deg 250deg, #94a3b8 250deg 260deg, #f8fafc 260deg 270deg, #64748b 270deg 280deg, #f8fafc 280deg 290deg, #94a3b8 290deg 300deg, #f8fafc 300deg 310deg, #64748b 310deg 320deg, #f8fafc 320deg 330deg, #94a3b8 330deg 340deg, #f8fafc 340deg 350deg, #64748b 350deg 360deg);
    border: 2px solid rgba(255,255,255,0.35);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.12), 0 0 12px rgba(230,126,34,0.28);
    animation: sawSpin 0.85s linear infinite;
    position: relative;
}

.saw-loader::after {
    content: "";
    position: absolute;
    inset: 34%;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

@keyframes sawSpin {
    to { transform: rotate(360deg); }
}

.assistant-home-search {
    flex: 0 1 420px;
    max-width: 420px;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: var(--accent-color);
}

.assistant-home-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: white;
    font: inherit;
}

.assistant-home-search button,
.assistant-panel-header button,
.assistant-input-row button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    background: var(--accent-color);
    color: #111;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.assistant-float-button {
    position: fixed;
    right: 18px;
    top: 45%;
    z-index: 9998;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.16);
    background: #0f172a;
    color: var(--accent-color);
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
    cursor: pointer;
}

.assistant-panel {
    position: fixed;
    right: 18px;
    top: 88px;
    bottom: 22px;
    width: min(390px, calc(100vw - 36px));
    height: min(680px, calc(100vh - 110px));
    max-height: calc(100vh - 24px);
    z-index: 9999;
    display: none;
    flex-direction: column;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: #111827;
    box-shadow: 0 18px 50px rgba(0,0,0,0.55);
    overflow: hidden;
}

.assistant-panel.dragging {
    user-select: none;
}

.assistant-panel.open {
    display: flex;
}

.assistant-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-bottom: 1px solid var(--panel-border);
    cursor: move;
    touch-action: none;
    flex: 0 0 auto;
}

.assistant-panel-header small {
    display: block;
    color: var(--text-muted);
    margin-top: 2px;
}

.assistant-usage-card {
    display: grid;
    grid-template-columns: 1fr 0.8fr 0.8fr;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(255,255,255,0.035);
    flex: 0 0 auto;
}

.assistant-usage-card strong {
    display: block;
    color: #ffffff;
    font-size: 0.82rem;
}

.assistant-usage-card small,
.assistant-usage-card label {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.assistant-usage-card input {
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    background: rgba(0,0,0,0.16);
    color: white;
    padding: 5px 6px;
    font-size: 0.78rem;
}

.assistant-usage-bar {
    grid-column: 1 / -1;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}

.assistant-usage-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #facc15, #ef4444);
    transition: width 0.2s ease;
}

.assistant-quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    border-bottom: 1px solid var(--panel-border);
    flex: 0 0 auto;
}

.assistant-quick-actions button {
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: white;
    padding: 7px 9px;
    cursor: pointer;
    font-weight: 700;
}

.assistant-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: scroll;
    overscroll-behavior: contain;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.assistant-msg {
    padding: 10px 12px;
    border-radius: 10px;
    line-height: 1.45;
    white-space: pre-line;
    max-width: 92%;
    word-break: break-word;
}

.assistant-msg-user {
    align-self: flex-end;
    background: rgba(107,142,35,0.2);
    color: white;
}

.assistant-msg-bot {
    align-self: flex-start;
    background: rgba(255,255,255,0.06);
    color: #e5e7eb;
}

.assistant-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--panel-border);
    flex: 0 0 auto;
}

.assistant-input-row input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: white;
    padding: 10px;
}

/* Shell principal do aplicativo */
.brand-orquestra {
    font-family: sans-serif;
    text-transform: none;
    letter-spacing: normal;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    white-space: nowrap;
}

.brand-orquestra-logo {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.2));
    justify-content: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.brand-orquestra-initial {
    color: #3b82f6;
    font-weight: 900;
    font-size: 36px;
    letter-spacing: -1px;
    text-transform: none;
}

.brand-orquestra-name {
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
    font-size: 22px;
    letter-spacing: 0.5px;
    text-transform: none;
}

.brand .brand-orquestra-logo .brand-orquestra-initial {
    color: #3b82f6;
    font-weight: 900;
    font-size: 36px;
    letter-spacing: -1px;
    line-height: 1;
    text-transform: none;
}

.brand .brand-orquestra-logo .brand-orquestra-name {
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
    font-size: 22px;
    letter-spacing: 0.5px;
    line-height: 1;
    text-transform: none;
}

.brand .brand-orquestra-subtitle {
    font-size: 10px;
    color: #666;
    margin-top: -4px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    margin-bottom: 20px;
    position: relative;
    z-index: 100;
}

.sidebar-toggle-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    margin-left: -15px;
}

.header-user-group {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user-text {
    text-align: right;
}

.header-user-name {
    color: var(--text-light);
    font-weight: bold;
    font-size: 14px;
}

.header-user-role {
    color: var(--accent-color);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 200px;
    padding: 8px 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 200;
}

.profile-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
}

.profile-dropdown .dropdown-item-danger {
    color: #fca5a5;
}

.profile-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    .background-elements {
        position: fixed;
        height: 100%;
    }

    .app-wrapper {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(84vw, 320px);
        height: 100dvh;
        padding: 1rem 0 max(1rem, env(safe-area-inset-bottom));
        transform: translateX(0);
        transition: transform 0.25s ease;
        z-index: 300;
    }

    .app-wrapper.sidebar-collapsed .sidebar {
        width: min(84vw, 320px);
        padding: 1rem 0 max(1rem, env(safe-area-inset-bottom));
        transform: translateX(-105%);
    }

    .app-wrapper.sidebar-collapsed::before {
        content: none;
    }

    .app-wrapper:not(.sidebar-collapsed)::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(6, 10, 18, 0.56);
        backdrop-filter: blur(2px);
        z-index: 250;
    }

    body.role-pendente .app-wrapper::before {
        content: none !important;
    }

    .main-content {
        overflow: visible;
        max-height: none;
        min-height: 100vh;
        padding: 1rem;
        padding-top: calc(0.75rem + env(safe-area-inset-top));
    }

    .glass-panel {
        padding: 1rem;
        border-radius: 14px;
    }

    .global-header {
        position: sticky;
        top: 0;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 10px;
        padding: 12px 0 14px;
        margin-bottom: 14px;
        background: linear-gradient(180deg, rgba(15, 10, 9, 0.96), rgba(15, 10, 9, 0.82));
        backdrop-filter: blur(12px);
    }

    .sidebar-toggle-button {
        margin-left: 0;
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    .assistant-home-search {
        min-width: 0;
        max-width: none;
        width: 100%;
        padding: 7px 9px;
        gap: 8px;
    }

    .assistant-home-search input {
        font-size: 0.95rem;
    }

    .header-user-group {
        gap: 8px;
        min-width: 0;
    }

    .header-user-text {
        display: none;
    }

    .header-avatar {
        width: 38px;
        height: 38px;
    }

    body.role-pendente .sidebar,
    body.role-pendente .global-header {
        display: none !important;
    }

    body.role-pendente .main-content {
        padding: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.role-pendente #view-pendente > div {
        min-height: calc(100vh - 1.5rem) !important;
        padding: 1.25rem 0.75rem !important;
    }

    body:has(#view-pendente.active-section) .sidebar,
    body:has(#view-pendente.active-section) .global-header {
        display: none !important;
    }

    body:has(#view-pendente.active-section) .app-wrapper::before {
        content: none !important;
    }

    body:has(#view-pendente.active-section) .main-content {
        padding: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body:has(#view-pendente.active-section) #view-pendente > div {
        min-height: calc(100vh - 1.5rem) !important;
        padding: 1.25rem 0.75rem !important;
    }

    .view-section > .glass-panel:first-child,
    .view-section > .glass-panel {
        margin-bottom: 14px;
    }

    .dashboard-grid,
    .grid-form,
    .grid-form-items,
    .form-table-grid {
        grid-template-columns: 1fr !important;
    }

    .table-container,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    table,
    .financeiro-table,
    .package-table {
        min-width: 640px;
    }

    input,
    select,
    textarea,
    button {
        font-size: 16px;
    }

    .form-actions .btn-primary,
    .form-actions .btn-secondary,
    .form-actions .btn-danger,
    .grid-form .btn-primary,
    .grid-form .btn-secondary,
    .grid-form .btn-danger {
        width: 100%;
        justify-content: center;
    }

    .form-actions {
        justify-content: stretch !important;
    }

    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(5"] {
        grid-template-columns: 1fr !important;
    }

    [style*="width: 180px"],
    [style*="width: 190px"],
    [style*="width: 200px"],
    [style*="width: 230px"],
    [style*="width: 250px"],
    [style*="width: 300px"] {
        width: 100% !important;
        max-width: 100%;
    }

    [style*="min-width: 200px"],
    [style*="min-width: 220px"],
    [style*="min-width: 240px"] {
        min-width: 0 !important;
    }
}
