@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   LAYOUT PRINCIPAL E HEADER SUPERIOR
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    font-family: var(--idl-font-sans);
    font-size: 14px;
    background-color: var(--idl-bg);
    color: var(--idl-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

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

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

/* Header Superior Compacto e Discreto */
.top-header {
    height: var(--idl-header-height);
    background-color: var(--idl-surface);
    border-bottom: 1px solid var(--idl-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--idl-page-pad-x);
    position: sticky;
    top: 0;
    z-index: 1020;
    gap: 0.75rem;
}

.top-header-left,
.top-header-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.header-toggler {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--idl-radius-sm);
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    color: var(--idl-text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.header-toggler:hover {
    background-color: var(--idl-surface-hover);
    border-color: var(--idl-border);
    color: var(--idl-text);
}

/* Seletor de Empresa Compacto */
.form-select-modern {
    background-color: var(--idl-surface-subtle);
    border: 1px solid var(--idl-border);
    border-radius: var(--idl-radius-sm);
    height: 32px;
    padding: 0 2rem 0 0.75rem;
    font-family: var(--idl-font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--idl-text);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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 0.6rem center;
    background-size: 14px 12px;
}

.form-select-modern:hover,
.form-select-modern:focus {
    border-color: var(--idl-border-strong);
    outline: none;
    background-color: var(--idl-surface);
    box-shadow: 0 0 0 2px var(--idl-focus-ring);
}

/* Badge Asaas no Header */
.header-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 30px;
    padding: 0 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    background-color: var(--idl-surface-subtle);
    border: 1px solid var(--idl-border);
    color: var(--idl-text-secondary);
    transition: all 0.15s ease;
}

.header-pill-badge:hover {
    background-color: var(--idl-surface-hover);
    border-color: var(--idl-border-strong);
    color: var(--idl-text);
}

/* Botão Alternador de Tema (Claro / Escuro) */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 30px;
    padding: 0 0.6rem;
    border-radius: var(--idl-radius-sm);
    background-color: var(--idl-surface-subtle);
    border: 1px solid var(--idl-border);
    color: var(--idl-text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--idl-surface-hover);
    border-color: var(--idl-border-strong);
    color: var(--idl-text);
}

.theme-toggle-btn i {
    font-size: 1rem;
}

/* Área de Conteúdo Otimizada */
.page-body {
    padding: var(--idl-page-pad-y) var(--idl-page-pad-x);
    flex-grow: 1;
}

@media (max-width: 767.98px) {
    .page-body {
        padding: 0.85rem 0.9rem;
    }
    .top-header {
        padding: 0 0.9rem;
    }
}

.nested-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
