/* ============================================================
   PDV GLOBAL — DARK THEME PREMIUM
   Design System Centralizado — Antigravity PDV WEB
   ============================================================ */

/* --- CSS Variables (Design Tokens) --- */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242835;
    --bg-header: #12141c;
    --surface: #2a2e3d;
    --surface-hover: #333849;

    --accent: #2563eb;
    --accent-hover: #3b82f6;
    --accent-glow: rgba(37, 99, 235, 0.25);
    --accent-soft: rgba(37, 99, 235, 0.12);

    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;

    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(37, 99, 235, 0.5);

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 16px var(--accent-glow);

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(37, 99, 235, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-hover);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--accent);
}

/* --- HEADER & NAVIGATION --- */
header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 100;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
}

.logo h1 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: -0.5px;
}

.logo img {
    filter: brightness(1.1);
}

.nav-list {
    display: flex;
    align-items: center;
}

.nav-list > ul {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.nav-item {
    margin: 0;
}

.nav-link {
    text-decoration: none;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    display: inline-block;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--accent-soft);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 60%;
}

/* Login / SAIR button */
.login-button {
    display: flex;
    align-items: center;
}

.login-button button {
    border: none;
    background: var(--accent);
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--accent-glow);
}

.login-button button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
    background: var(--accent-hover);
}

.login-button button a {
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Mobile menu */
.mobile-menu-icon {
    display: none;
}

.mobile-menu {
    display: none;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.mobile-menu ul {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.mobile-menu .nav-item {
    display: block;
    text-align: center;
}

.mobile-menu .nav-link {
    display: block;
    padding: 12px 24px;
    color: var(--text-secondary);
    border-radius: 0;
}

.mobile-menu .nav-link:hover {
    background: var(--accent-soft);
    color: var(--text-primary);
}

@media screen and (max-width: 730px) {
    .nav-item {
        display: none;
    }
    .login-button {
        display: none;
    }
    .mobile-menu-icon {
        display: block;
    }
    .mobile-menu-icon button {
        background-color: transparent;
        border: none;
        cursor: pointer;
        padding: 4px;
        border-radius: var(--radius-sm);
        transition: var(--transition-fast);
    }
    .mobile-menu-icon button:hover {
        background: var(--accent-soft);
    }
    .mobile-menu .nav-item {
        display: block;
    }
    .mobile-menu .login-button {
        display: block;
        padding: 0.5rem 1.5rem;
    }
    .mobile-menu .login-button button {
        width: 100%;
    }
    .open {
        display: block;
    }
    /* Mobile: dropdown abre inline */
    .nav-dropdown-menu {
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        padding-left: 20px !important;
    }
}

/* --- NAV DROPDOWN (Status submenu) --- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    cursor: pointer;
}

.nav-dropdown-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 200;
    padding: 6px 0;
    margin-top: 4px;
    list-style: none;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block !important;
    animation: fadeIn 0.2s ease-out;
}

.nav-dropdown-menu li {
    margin: 0;
    list-style: none;
}

.nav-dropdown-menu li a {
    display: block;
    padding: 10px 18px;
    color: var(--text-secondary) !important;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
    border-radius: 0;
}

.nav-dropdown-menu li a:hover {
    background: var(--accent-soft);
    color: var(--text-primary) !important;
}

/* --- SECTION & CONTENT --- */
section {
    position: relative;
    z-index: 1;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.3px;
}

h3 {
    margin: 16px 0 8px 0;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
    font-size: 1.1rem;
}

p {
    margin-left: 10px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- FORM ELEMENTS --- */
input, textarea {
    padding: 12px 16px;
    border: 1px solid var(--border);
    outline: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
    margin: 4px 0;
}

input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

input[readonly] {
    opacity: 0.6;
    cursor: default;
}

select {
    padding: 12px 16px;
    border: 1px solid var(--border);
    outline: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
    cursor: pointer;
    margin: 4px 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b8fa3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 10px;
    margin-bottom: 4px;
    display: inline-block;
}

/* --- BUTTONS --- */
.inputButton, .inputButton_pesquisa {
    background: var(--accent);
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 8px var(--accent-glow);
    margin: 4px;
}

.inputButton:hover, .inputButton_pesquisa:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
    background: var(--accent-hover);
}

.inputButton:active, .inputButton_pesquisa:active {
    transform: translateY(0);
}

/* Generic button styling for pages with raw <button> */
button {
    font-family: 'Inter', sans-serif;
}

/* --- CARD COMPONENT --- */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.container-card {
    padding: 12px 16px;
}

/* --- LIST ITEM / CHECKBOX CONTAINER --- */
.container {
    display: block;
    position: relative;
    padding: 12px 12px 12px 44px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.container:hover {
    background: var(--accent-soft);
    border-color: var(--border);
}

.container a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
    line-height: 1.5;
}

.container a:hover {
    color: var(--accent-hover);
}

/* Hide default checkbox */
.container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    padding: 0;
    margin: 0;
    border: none;
}

/* Custom checkbox */
.checkmark {
    position: absolute;
    top: 12px;
    left: 10px;
    height: 22px;
    width: 22px;
    background-color: var(--surface);
    border: 2px solid var(--border);
    border-radius: 6px;
    transition: var(--transition-fast);
}

.container:hover input ~ .checkmark {
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

.container input:checked ~ .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.container input:checked ~ .checkmark:after {
    display: block;
}

.container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* --- NAV (secondary bar) --- */
nav {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

nav ul {
    display: flex;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 10px 16px;
    gap: 8px;
}

ul li {
    margin-left: 0;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

ul li a {
    color: var(--accent-hover);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-size: 0.9rem;
}

ul li a:hover {
    background: var(--accent-soft);
    color: var(--text-primary);
}

/* --- FOOTER --- */
footer {
    border-top: 1px solid var(--border);
    margin-top: 32px;
    padding: 16px 20px;
    text-align: center;
    background: var(--bg-header);
    color: var(--text-muted);
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}

/* --- STATUS COLORS (for inline PHP styles) --- */
/* These utility classes let PHP color-code items in the dark theme */
.status-success, [style*="color: green"], [style*="color:green"], [style*="color : green"] { color: var(--success) !important; }
.status-danger, [style*="color: red"], [style*="color:red"], [style*="color : red"] { color: var(--danger) !important; }
.status-warning { color: var(--warning) !important; }
.status-info, [style*="color: blue"], [style*="color:blue"], [style*="color : blue"] { color: var(--info) !important; }
[style*="color:black"], [style*="color: black"], [style*="color : black"] { color: var(--text-primary) !important; }
[style*="color: grey"], [style*="color: gray"], [style*="color:grey"], [style*="color:gray"] { color: var(--text-secondary) !important; }

/* --- ALERT COMPONENT (for guarita) --- */
.alerta-cuidado {
    background: var(--danger-bg) !important;
    color: var(--danger) !important;
    border: 1px solid rgba(248, 113, 113, 0.3) !important;
    border-radius: var(--radius-md) !important;
    padding: 12px 16px !important;
    margin: 12px 0 !important;
    font-weight: 600;
    display: none;
    backdrop-filter: blur(8px);
}

.campo-invalido {
    border: 2px solid var(--danger) !important;
    background-color: var(--danger-bg) !important;
}

.campo-autopreenchido {
    border: 2px solid var(--success) !important;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.4) !important;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

/* --- FORM LAYOUT (guarita, clientes, etc.) --- */
/* Formulários que usam <p> como wrapper de campo */
section form p,
section > div > p {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 16px 10px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Inputs/selects dentro de <p> — largura padronizada */
section form p input,
section form p select,
section > div > form p input,
section > div > form p select {
    width: 100% !important;
    max-width: 600px !important;
    min-width: 0 !important;
}

/* Campos de texto diretos (fora de <p>) — mesma largura */
section form > input[type="text"],
section form > input[type="number"],
section form > input[type="date"],
section form > select,
section > div > form > div2 > input[type="text"],
section > div > form > div2 > input[type="number"],
section > div > form > div2 > input[type="date"],
section > div > form > div2 > select,
section > div > form > input[type="text"],
section > div > form > input[type="number"],
section > div > form > input[type="date"],
section > div > form > select {
    width: 100% !important;
    max-width: 600px !important;
    display: block;
    margin: 8px 10px;
}

/* Obs e campos largos — ocupar toda a linha */
section form input[style*="width:80%"],
section form input[style*="width: 80%"] {
    max-width: 100% !important;
}

/* Botões do formulário — espaçamento superior */
section form .inputButton {
    margin-top: 8px;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

section {
    animation: fadeIn 0.3s ease-out;
}

/* --- CALENDAR PAGE OVERRIDES --- */
#calendar {
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

/* FullCalendar dark theme overrides */
.fc {
    --fc-border-color: var(--border) !important;
    --fc-button-bg-color: var(--accent) !important;
    --fc-button-border-color: var(--accent) !important;
    --fc-button-hover-bg-color: var(--accent-hover) !important;
    --fc-button-hover-border-color: var(--accent-hover) !important;
    --fc-button-active-bg-color: #1d4ed8 !important;
    --fc-button-active-border-color: #1d4ed8 !important;
    --fc-today-bg-color: var(--accent-soft) !important;
    --fc-neutral-bg-color: var(--bg-secondary) !important;
    --fc-page-bg-color: var(--bg-secondary) !important;
    --fc-event-bg-color: var(--accent) !important;
    --fc-event-border-color: var(--accent) !important;
    --fc-event-text-color: #ffffff !important;
}

.fc .fc-col-header-cell,
.fc .fc-daygrid-day,
.fc .fc-timegrid-slot {
    background: var(--bg-secondary) !important;
    color: #ffffff !important;
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
    color: #ffffff !important;
}

.fc .fc-toolbar-title {
    color: #ffffff !important;
}

.fc .fc-event,
.fc .fc-event-title,
.fc .fc-event-main,
.fc .fc-daygrid-event-dot {
    color: #ffffff !important;
}

.fc .fc-daygrid-event {
    color: #ffffff !important;
}

.fc a {
    color: #ffffff !important;
}

/* --- LOGIN PAGE STYLES --- */
body.login-page {
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

body.login-page form,
body.login-page .formulario {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

body.login-page::before {
    background: 
        radial-gradient(ellipse at 30% 40%, rgba(37, 99, 235, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(30, 64, 175, 0.06) 0%, transparent 60%);
}

.login-card {
    background: rgba(26, 29, 39, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease-out;
}

.login-card h3 {
    text-align: center;
    border: none;
    padding: 0;
    margin: 0 0 8px 0;
    font-size: 1.4rem;
    color: var(--text-primary);
}

.login-card p {
    text-align: center;
    margin: 0 0 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-card input {
    width: 100%;
    margin: 6px 0;
}

.login-card select {
    width: 100%;
    margin: 6px 0;
}

.login-card button,
.login-card .inputButton {
    width: 100%;
    margin: 16px 0 0 0;
    padding: 14px;
    font-size: 15px;
}

/* --- UTILITY CLASSES --- */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }
.text-bold { font-weight: 600; }

/* Override inline background colors for cards in dark mode */
/* Cards com fundo CINZA (fundo escuro → texto branco) */
[style*="background-color: rgb(196, 196, 196)"],
[style*="background-color: rgb(220, 220, 220)"] {
    background-color: var(--surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
}

/* Cards do PHP: verde filiado — fundo claro = texto PRETO */
[style*="background-color:rgb(152, 224, 152)"],
[style*="background-color: rgb(152, 224, 152)"] {
    background-color: #86efac !important;
    color: #111 !important;
    border: 1px solid #4ade80 !important;
    border-radius: var(--radius-md) !important;
}

/* Cards do PHP: amarelo não-filiado — fundo claro = texto PRETO */
[style*="background-color:rgb(255, 206, 100)"],
[style*="background-color: rgb(255, 206, 100)"] {
    background-color: #fcd34d !important;
    color: #111 !important;
    border: 1px solid #f59e0b !important;
    border-radius: var(--radius-md) !important;
}

/* Cards do PHP: cinza (PAGO) — fundo escuro = texto branco */
[style*="background-color:rgb(209, 209, 209)"],
[style*="background-color: rgb(209, 209, 209)"] {
    background-color: var(--surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
}

/* Cards do PHP: vermelho (DEVOLVIDO) — fundo escuro = texto branco */
[style*="background-color:rgb(189, 114, 114)"],
[style*="background-color: rgb(189, 114, 114)"] {
    background-color: rgba(248, 113, 113, 0.2) !important;
    color: var(--danger) !important;
    border: 1px solid rgba(248, 113, 113, 0.3) !important;
    border-radius: var(--radius-md) !important;
}

/* Cards do PHP: lilás (comanda ABERTA detail) — fundo escuro = texto branco */
[style*="background-color:rgb(220, 160, 255)"],
[style*="background-color: rgb(220, 160, 255)"],
[style*="background-color:rgb(213, 139, 255)"],
[style*="background-color: rgb(213, 139, 255)"] {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--accent) !important;
    border-radius: var(--radius-md) !important;
}

/* Filhos do card lilás herdam branco */
[style*="background-color:rgb(220, 160, 255)"] *,
[style*="background-color:rgb(213, 139, 255)"] * {
    color: inherit !important;
}

/* HERANÇA: todos os filhos de cards CLAROS herdam texto preto */
[style*="background-color:rgb(152, 224, 152)"] a,
[style*="background-color:rgb(152, 224, 152)"] p,
[style*="background-color:rgb(152, 224, 152)"] h3,
[style*="background-color:rgb(152, 224, 152)"] h4,
[style*="background-color:rgb(152, 224, 152)"] b,
[style*="background-color:rgb(152, 224, 152)"] span,
[style*="background-color:rgb(255, 206, 100)"] a,
[style*="background-color:rgb(255, 206, 100)"] p,
[style*="background-color:rgb(255, 206, 100)"] h3,
[style*="background-color:rgb(255, 206, 100)"] h4,
[style*="background-color:rgb(255, 206, 100)"] b,
[style*="background-color:rgb(255, 206, 100)"] span {
    color: #111 !important;
}

/* Filiado green cards — fundo claro = texto preto */
[style*="background-color: rgb(153, 243, 168)"],
[style*="background-color: rgb(173, 250, 185)"] {
    background-color: #bbf7d0 !important;
    color: #111 !important;
    border: 1px solid #86efac !important;
    border-radius: var(--radius-md) !important;
}

/* Comanda status colors */
[style*="background-color: violet"],
[style*="background-color:violet"] {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--accent) !important;
    border-radius: var(--radius-md) !important;
}

[style*="background-color: violet"] *,
[style*="background-color:violet"] * {
    color: inherit !important;
}

[style*="background-color: lightgreen"],
[style*="background-color:lightgreen"] {
    background: #bbf7d0 !important;
    color: #111 !important;
    border: 1px solid #86efac !important;
    border-radius: var(--radius-md) !important;
}

[style*="background-color: lightyellow"],
[style*="background-color:lightyellow"] {
    background: #fef3c7 !important;
    color: #111 !important;
    border: 1px solid #fcd34d !important;
    border-radius: var(--radius-md) !important;
}

[style*="background-color: lightblue"],
[style*="background-color:lightblue"] {
    background: #bfdbfe !important;
    color: #111 !important;
    border: 1px solid #93c5fd !important;
    border-radius: var(--radius-md) !important;
}

[style*="background-color: lightcoral"],
[style*="background-color:lightcoral"] {
    background: #fecaca !important;
    color: #111 !important;
    border: 1px solid #fca5a5 !important;
    border-radius: var(--radius-md) !important;
}

/* Product conference colors — fundo claro = texto preto */
[style*="background-color: rgb(252, 179, 179)"] {
    background-color: #fecaca !important;
    color: #111 !important;
    border: 1px solid #fca5a5 !important;
    border-radius: var(--radius-md) !important;
}

[style*="background-color: rgb(189, 240, 195)"] {
    background-color: #bbf7d0 !important;
    color: #111 !important;
    border: 1px solid #86efac !important;
    border-radius: var(--radius-md) !important;
}

/* --- PRINT STYLES --- */
@media print {
    body {
        background: #fff;
        color: #000;
    }
    header, footer, .mobile-menu, .mobile-menu-icon, .login-button {
        display: none !important;
    }
}

/* --- CARDS COM FUNDO CLARO: todos os filhos herdam cor do pai --- */
/* Agrupa todos os seletores de fundo claro para forçar cor preta nos filhos */
[style*="background-color:rgb(152, 224, 152)"] *,
[style*="background-color:rgb(255, 206, 100)"] *,
[style*="background-color: rgb(153, 243, 168)"] *,
[style*="background-color: rgb(173, 250, 185)"] *,
[style*="background-color: rgb(189, 240, 195)"] *,
[style*="background-color: rgb(252, 179, 179)"] *,
[style*="background-color: lightgreen"] *,
[style*="background-color:lightgreen"] *,
[style*="background-color: lightyellow"] *,
[style*="background-color:lightyellow"] *,
[style*="background-color: lightblue"] *,
[style*="background-color:lightblue"] *,
[style*="background-color: lightcoral"] *,
[style*="background-color:lightcoral"] * {
    color: inherit !important;
}

/* Cards escuros: filhos herdam branco */
[style*="background-color:rgb(209, 209, 209)"] *,
[style*="background-color:rgb(189, 114, 114)"] *,
[style*="background-color: rgb(196, 196, 196)"] *,
[style*="background-color: rgb(220, 220, 220)"] * {
    color: inherit !important;
}

/* ============================================================
   SIDEBAR MODERNA (ESTILO CRMWHATSAPP)
   ============================================================ */

/* Suporte de espaçamento global no Desktop */
@media screen and (min-width: 992px) {
    body {
        padding-left: 260px !important;
        transition: padding-left 0.3s ease;
    }
    
    /* Esconde elementos móveis antigos e novos */
    .mobile-header,
    .sidebar-overlay {
        display: none !important;
    }
}

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    height: 100vh;
    height: 100dvh; /* Altura Dinâmica de Viewport para Mobile */
    background: var(--bg-header);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}

/* Header da Sidebar (Logo) */
.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.sidebar-header img {
    filter: brightness(1.1);
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Corpo da Sidebar (Menu) */
.sidebar-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 14px;
}

/* Scrollbar personalizada para a Sidebar */
.sidebar-body::-webkit-scrollbar {
    width: 4px;
}
.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Menu de Itens */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-item {
    position: relative;
    list-style: none;
}

/* Link Geral */
.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary) !important;
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    text-decoration: none !important;
    cursor: pointer;
    border: 1px solid rgba(56, 189, 248, 0.15); /* Borda padrão igual do auditor */
    background: rgba(56, 189, 248, 0.02); /* Fundo padrão igual do auditor */
}

.menu-link:hover {
    color: var(--text-primary) !important;
    background: rgba(56, 189, 248, 0.08) !important;
    border-color: rgba(56, 189, 248, 0.35);
    transform: translateX(4px);
}

/* Link Ativo */
.menu-item.active .menu-link,
.menu-link.active {
    color: #fff !important;
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.menu-item.active .menu-link .menu-icon,
.menu-link.active .menu-icon {
    color: #fff !important;
}

/* Ícone do Menu */
.menu-icon {
    font-size: 1.1rem;
    width: 24px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.menu-link:hover .menu-icon {
    color: #38bdf8; /* Ícone acende na cor azul celeste do auditor no hover */
}

/* Texto do Menu */
.menu-text {
    flex-grow: 1;
}

/* Estilo do Auditor Link unificado com o padrão */
.auditor-link {
    /* Herda o padrão de todos os botões */
}

/* DROPDOWN INTERNO (Status Submenu) */
.sidebar-menu .dropdown-toggle {
    position: relative;
}

.dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-submenu {
    display: none;
    list-style: none;
    padding: 4px 0 4px 36px;
    margin: 0;
    flex-direction: column;
    gap: 4px;
    animation: fadeInFast 0.2s ease-out;
}

.dropdown.open .dropdown-submenu {
    display: flex;
}

.dropdown-submenu li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-secondary) !important;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.dropdown-submenu li a:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.04);
}

.dropdown-submenu li a i {
    width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

@keyframes fadeInFast {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Rodapé da Sidebar */
.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    display: flex;
    flex-direction: column;
    max-width: 170px;
}

.sidebar-footer .user-name {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .user-company {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.sidebar-footer .logout-btn {
    color: var(--danger) !important;
    background: var(--danger-bg);
    border: 1px solid rgba(248, 113, 113, 0.2);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-footer .logout-btn:hover {
    background: var(--danger);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(248, 113, 113, 0.3);
    transform: translateY(-1px);
}

/* ============================================================
   RESPONSIVIDADE (MOBILE & TABLET)
   ============================================================ */
@media screen and (max-width: 991px) {
    /* Desativa padding lateral global */
    body {
        padding-left: 0 !important;
        padding-top: 60px !important; /* Espaço para a barra superior móvel */
    }

    /* Esconde barra lateral por padrão */
    .sidebar {
        left: -260px;
        top: 0;
        bottom: 0;
        height: 100%;
        height: 100dvh;
        z-index: 1001; /* Fica acima do mobile-header */
    }

    /* Sidebar ativa */
    .sidebar.active {
        left: 0;
    }

    /* Barra Superior Mobile */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-header);
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        z-index: 999;
        box-shadow: var(--shadow-sm);
    }

    .mobile-menu-toggle {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.4rem;
        cursor: pointer;
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
        transition: background 0.2s ease;
    }

    .mobile-menu-toggle:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .mobile-logo img {
        height: 32px;
        width: auto;
        object-fit: contain;
    }

    /* Overlay escuro de fundo */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
}
