/**
 * TecnoDesk - Design System & Estilos Principais 2.0
 * Tecnobeach Tecnologia
 * Modern SaaS UI/UX, Glassmorphism, Fluid Responsiveness & High-Contrast Light/Dark Mode
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   1. TOKENS DE DESIGN & VARIÁVEIS CSS
   ========================================================================== */

:root {
    /* Brand & Primary */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-gradient: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
    --primary-glow: rgba(37, 99, 235, 0.25);
    
    /* Secondary & Neutrals */
    --secondary-color: #64748b;
    --secondary-light: #f1f5f9;
    
    /* Semantics & Status */
    --success-color: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    --success-text: #059669;
    --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);

    --warning-color: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    --warning-text: #d97706;
    --warning-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);

    --danger-color: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --danger-text: #dc2626;
    --danger-gradient: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);

    --info-color: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.12);
    --info-text: #0891b2;
    --info-gradient: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);

    --indigo-color: #6366f1;
    --indigo-light: rgba(99, 102, 241, 0.12);
    --indigo-text: #4f46e5;

    /* Legacy compatibility aliases */
    --tecnobeach-blue: var(--primary-color);
    --tecnobeach-light: var(--primary-light);
    --light-color: #f8fafc;
    --dark-color: #0f172a;

    /* Shadows & Elevations (Multi-Stop Ambient & Directional) */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.08), 0 4px 10px -3px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 24px 50px -12px rgba(0, 0, 0, 0.13), 0 8px 20px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 25px rgba(79, 70, 229, 0.25);

    /* Radius Tokens (Menos Quadrado / Curvaturas Orgânicas e Proporcionais) */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 9999px;
}

/* ==========================================================================
   2. TEMAS (CLARO & ESCURO)
   ========================================================================== */

/* Tema Claro */
.theme-light, :root:not(.theme-dark):not([data-bs-theme="dark"]), [data-bs-theme="light"] {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --card-border: rgba(226, 232, 240, 0.85);
    --border-color: #e2e8f0;
    --navbar-bg: rgba(255, 255, 255, 0.82);
    --navbar-border: rgba(226, 232, 240, 0.8);
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --table-header-bg: #f8fafc;
    --table-row-hover: rgba(79, 70, 229, 0.03);
    --link-color: var(--primary-color, #4f46e5);
    --muted-color: #64748b;
    --modal-bg: #ffffff;
}

/* Tema Escuro (Cyber Slate Corporativo) */
.theme-dark, [data-bs-theme="dark"] {
    --bg-color: var(--dark-bg, #090d16);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: var(--dark-card, #0f172a);
    --card-border: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.09);
    --navbar-bg: rgba(9, 13, 22, 0.82);
    --navbar-border: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #0c121e;
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --input-bg: #0f172a;
    --input-border: rgba(255, 255, 255, 0.14);
    --table-header-bg: #0c121e;
    --table-row-hover: rgba(99, 102, 241, 0.06);
    --link-color: #818cf8;
    --muted-color: #94a3b8;
    --modal-bg: #0f172a;

    /* Bootstrap Overrides no Dark Mode */
    --bs-body-bg: var(--bg-color);
    --bs-body-color: var(--text-color);
    --bs-border-color: var(--border-color);
    --bs-secondary-color: var(--muted-color);
    --bs-heading-color: var(--text-color);
    --bs-link-color: var(--link-color);
    --bs-body-color-rgb: 241, 245, 249;
    --bs-body-bg-rgb: 11, 15, 25;
    --bs-tertiary-bg: #1e293b;
    --bs-secondary-bg: #131b2e;
}

/* ==========================================================================
   3. RESET & TIPOGRAFIA GERAL
   ========================================================================== */

* {
    box-sizing: border-box;
}

html, body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.935rem;
    line-height: 1.6;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    padding-top: 64px !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

body.has-impersonation {
    padding-top: 96px !important;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.025em;
}

h1, .h1 { font-size: 1.75rem; }
h2, .h2 { font-size: 1.45rem; }
h3, .h3 { font-size: 1.25rem; }

.font-mono, .code-text, .ticket-badge, .ip-badge {
    font-family: 'JetBrains Mono', monospace !important;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

/* ==========================================================================
   4. ALERTS & CAIXAS DE INFORMAÇÕES IMPORTANTES (ALTO CONTRASTE)
   ========================================================================== */

.alert {
    border-radius: var(--radius-md);
    padding: 0.95rem 1.25rem;
    font-size: 0.9rem;
    border-width: 1px;
    border-style: solid;
    margin-bottom: 1.25rem;
}

.alert h1, .alert h2, .alert h3, .alert h4, .alert h5, .alert h6,
.alert .alert-heading {
    font-weight: 700;
    font-size: 0.98rem;
    margin-bottom: 0.4rem;
}

.alert ul, .alert ol {
    padding-left: 1.2rem;
    margin-bottom: 0;
}

/* --- Alerts no Tema Claro --- */
.theme-light .alert-info,
:root:not(.theme-dark) .alert-info {
    background-color: #ecfeff !important;
    border-color: #a5f3fc !important;
    color: #0e7490 !important;
}
.theme-light .alert-info h1, .theme-light .alert-info h2, .theme-light .alert-info h3, 
.theme-light .alert-info h4, .theme-light .alert-info h5, .theme-light .alert-info h6,
.theme-light .alert-info strong, .theme-light .alert-info .alert-heading, .theme-light .alert-info a,
:root:not(.theme-dark) .alert-info h1, :root:not(.theme-dark) .alert-info h2, :root:not(.theme-dark) .alert-info h3,
:root:not(.theme-dark) .alert-info h4, :root:not(.theme-dark) .alert-info h5, :root:not(.theme-dark) .alert-info h6,
:root:not(.theme-dark) .alert-info strong, :root:not(.theme-dark) .alert-info .alert-heading, :root:not(.theme-dark) .alert-info a {
    color: #155e75 !important;
}

.theme-light .alert-warning,
:root:not(.theme-dark) .alert-warning {
    background-color: #fffbeb !important;
    border-color: #fde68a !important;
    color: #92400e !important;
}
.theme-light .alert-warning h1, .theme-light .alert-warning h2, .theme-light .alert-warning h3,
.theme-light .alert-warning h4, .theme-light .alert-warning h5, .theme-light .alert-warning h6,
.theme-light .alert-warning strong, .theme-light .alert-warning .alert-heading, .theme-light .alert-warning a,
:root:not(.theme-dark) .alert-warning h1, :root:not(.theme-dark) .alert-warning h2, :root:not(.theme-dark) .alert-warning h3,
:root:not(.theme-dark) .alert-warning h4, :root:not(.theme-dark) .alert-warning h5, :root:not(.theme-dark) .alert-warning h6,
:root:not(.theme-dark) .alert-warning strong, :root:not(.theme-dark) .alert-warning .alert-heading, :root:not(.theme-dark) .alert-warning a {
    color: #78350f !important;
}

.theme-light .alert-success,
:root:not(.theme-dark) .alert-success {
    background-color: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
    color: #166534 !important;
}
.theme-light .alert-success h1, .theme-light .alert-success h2, .theme-light .alert-success h3,
.theme-light .alert-success h4, .theme-light .alert-success h5, .theme-light .alert-success h6,
.theme-light .alert-success strong, .theme-light .alert-success .alert-heading, .theme-light .alert-success a,
:root:not(.theme-dark) .alert-success h1, :root:not(.theme-dark) .alert-success h2, :root:not(.theme-dark) .alert-success h3,
:root:not(.theme-dark) .alert-success h4, :root:not(.theme-dark) .alert-success h5, :root:not(.theme-dark) .alert-success h6,
:root:not(.theme-dark) .alert-success strong, :root:not(.theme-dark) .alert-success .alert-heading, :root:not(.theme-dark) .alert-success a {
    color: #14532d !important;
}

.theme-light .alert-danger,
:root:not(.theme-dark) .alert-danger {
    background-color: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #991b1b !important;
}
.theme-light .alert-danger h1, .theme-light .alert-danger h2, .theme-light .alert-danger h3,
.theme-light .alert-danger h4, .theme-light .alert-danger h5, .theme-light .alert-danger h6,
.theme-light .alert-danger strong, .theme-light .alert-danger .alert-heading, .theme-light .alert-danger a,
:root:not(.theme-dark) .alert-danger h1, :root:not(.theme-dark) .alert-danger h2, :root:not(.theme-dark) .alert-danger h3,
:root:not(.theme-dark) .alert-danger h4, :root:not(.theme-dark) .alert-danger h5, :root:not(.theme-dark) .alert-danger h6,
:root:not(.theme-dark) .alert-danger strong, :root:not(.theme-dark) .alert-danger .alert-heading, :root:not(.theme-dark) .alert-danger a {
    color: #7f1d1d !important;
}

.theme-light .alert-primary,
:root:not(.theme-dark) .alert-primary {
    background-color: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1e40af !important;
}
.theme-light .alert-primary h1, .theme-light .alert-primary h2, .theme-light .alert-primary h3,
.theme-light .alert-primary h4, .theme-light .alert-primary h5, .theme-light .alert-primary h6,
.theme-light .alert-primary strong, .theme-light .alert-primary .alert-heading, .theme-light .alert-primary a,
:root:not(.theme-dark) .alert-primary h1, :root:not(.theme-dark) .alert-primary h2, :root:not(.theme-dark) .alert-primary h3,
:root:not(.theme-dark) .alert-primary h4, :root:not(.theme-dark) .alert-primary h5, :root:not(.theme-dark) .alert-primary h6,
:root:not(.theme-dark) .alert-primary strong, :root:not(.theme-dark) .alert-primary .alert-heading, :root:not(.theme-dark) .alert-primary a {
    color: #1e3a8a !important;
}

.theme-light .alert-secondary,
.theme-light .alert-light,
:root:not(.theme-dark) .alert-secondary,
:root:not(.theme-dark) .alert-light {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}
.theme-light .alert-secondary strong,
.theme-light .alert-light strong,
:root:not(.theme-dark) .alert-secondary strong,
:root:not(.theme-dark) .alert-light strong {
    color: #0f172a !important;
}

/* --- Alerts no Tema Escuro (Dark Mode) --- */
.theme-dark .alert-info {
    background-color: rgba(6, 182, 212, 0.16) !important;
    border-color: rgba(6, 182, 212, 0.45) !important;
    color: #67e8f9 !important;
}
.theme-dark .alert-info h1, .theme-dark .alert-info h2, .theme-dark .alert-info h3,
.theme-dark .alert-info h4, .theme-dark .alert-info h5, .theme-dark .alert-info h6,
.theme-dark .alert-info strong, .theme-dark .alert-info .alert-heading, .theme-dark .alert-info a {
    color: #e0f2fe !important;
}

.theme-dark .alert-warning {
    background-color: rgba(245, 158, 11, 0.16) !important;
    border-color: rgba(245, 158, 11, 0.45) !important;
    color: #fde047 !important;
}
.theme-dark .alert-warning h1, .theme-dark .alert-warning h2, .theme-dark .alert-warning h3,
.theme-dark .alert-warning h4, .theme-dark .alert-warning h5, .theme-dark .alert-warning h6,
.theme-dark .alert-warning strong, .theme-dark .alert-warning .alert-heading, .theme-dark .alert-warning a {
    color: #fef08a !important;
}

.theme-dark .alert-success {
    background-color: rgba(16, 185, 129, 0.16) !important;
    border-color: rgba(16, 185, 129, 0.45) !important;
    color: #6ee7b7 !important;
}
.theme-dark .alert-success h1, .theme-dark .alert-success h2, .theme-dark .alert-success h3,
.theme-dark .alert-success h4, .theme-dark .alert-success h5, .theme-dark .alert-success h6,
.theme-dark .alert-success strong, .theme-dark .alert-success .alert-heading, .theme-dark .alert-success a {
    color: #d1fae5 !important;
}

.theme-dark .alert-danger {
    background-color: rgba(239, 68, 68, 0.16) !important;
    border-color: rgba(239, 68, 68, 0.45) !important;
    color: #fca5a5 !important;
}
.theme-dark .alert-danger h1, .theme-dark .alert-danger h2, .theme-dark .alert-danger h3,
.theme-dark .alert-danger h4, .theme-dark .alert-danger h5, .theme-dark .alert-danger h6,
.theme-dark .alert-danger strong, .theme-dark .alert-danger .alert-heading, .theme-dark .alert-danger a {
    color: #fee2e2 !important;
}

.theme-dark .alert-primary {
    background-color: rgba(37, 99, 235, 0.18) !important;
    border-color: rgba(37, 99, 235, 0.45) !important;
    color: #93c5fd !important;
}
.theme-dark .alert-primary h1, .theme-dark .alert-primary h2, .theme-dark .alert-primary h3,
.theme-dark .alert-primary h4, .theme-dark .alert-primary h5, .theme-dark .alert-primary h6,
.theme-dark .alert-primary strong, .theme-dark .alert-primary .alert-heading, .theme-dark .alert-primary a {
    color: #dbeafe !important;
}

.theme-dark .alert-secondary,
.theme-dark .alert-light {
    background-color: rgba(100, 116, 139, 0.22) !important;
    border-color: rgba(100, 116, 139, 0.45) !important;
    color: #e2e8f0 !important;
}
.theme-dark .alert-secondary strong,
.theme-dark .alert-light strong {
    color: #f8fafc !important;
}

/* ==========================================================================
   5. OVERRIDES GLOBAIS DE UTILITÁRIOS (BG-LIGHT, BG-WHITE, TEXT-DARK, ETC.)
   ========================================================================== */

/* Tema Claro */
.bg-light {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}
.text-dark { color: #0f172a !important; }
.text-black { color: #000000 !important; }
.text-muted { color: #64748b !important; }
.text-secondary { color: #475569 !important; }

/* Tema Escuro */
.theme-dark .bg-light, [data-bs-theme="dark"] .bg-light {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}
.theme-dark .bg-white, [data-bs-theme="dark"] .bg-white {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}
.theme-dark .card-header.bg-white, [data-bs-theme="dark"] .card-header.bg-white,
.theme-dark .card-footer.bg-white, [data-bs-theme="dark"] .card-footer.bg-white,
.theme-dark .card-footer.bg-light, [data-bs-theme="dark"] .card-footer.bg-light {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}
.theme-dark .text-dark, [data-bs-theme="dark"] .text-dark { color: #f1f5f9 !important; }
.theme-dark .text-black, [data-bs-theme="dark"] .text-black { color: #f1f5f9 !important; }
.theme-dark .text-black-50, [data-bs-theme="dark"] .text-black-50 { color: rgba(255, 255, 255, 0.6) !important; }
.theme-dark .text-muted, [data-bs-theme="dark"] .text-muted { color: #94a3b8 !important; }
.theme-dark .text-secondary, [data-bs-theme="dark"] .text-secondary { color: #cbd5e1 !important; }
.theme-dark .border, [data-bs-theme="dark"] .border { border-color: var(--border-color) !important; }
.theme-dark hr, [data-bs-theme="dark"] hr { border-color: var(--border-color) !important; }

.theme-dark pre, [data-bs-theme="dark"] pre,
.theme-dark pre.bg-light, [data-bs-theme="dark"] pre.bg-light,
.theme-dark code, [data-bs-theme="dark"] code {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

/* ==========================================================================
   6. NAVBAR & HEADER
   ========================================================================== */

.navbar-custom {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--navbar-border);
    box-shadow: var(--shadow-sm);
    min-height: 64px;
    z-index: 1030;
    transition: all 0.2s ease;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-brand img {
    max-height: 36px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.navbar-brand:hover img {
    transform: scale(1.02);
}

.user-avatar-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.85rem;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: var(--radius-pill);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-avatar-pill:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.35);
}

.user-avatar-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: rotate(15deg);
}

.theme-dark .theme-toggle-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-color: #60a5fa;
}

/* ==========================================================================
   7. SIDEBAR MODERNA
   ========================================================================== */

.sidebar {
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    min-height: calc(100vh - 64px);
    padding-top: 1rem;
    padding-bottom: 2rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-color);
    padding: 1.25rem 1.25rem 0.4rem;
    margin: 0;
}

.sidebar .nav-link {
    color: var(--text-color);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.65rem 1rem;
    margin: 2px 10px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .nav-link i.fa-fw,
.sidebar .nav-link > i:first-child {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    color: var(--muted-color);
    transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
    transform: translateX(3px);
}

.sidebar .nav-link:hover i.fa-fw,
.sidebar .nav-link:hover > i:first-child {
    color: var(--primary-color);
    transform: scale(1.1);
}

.sidebar .nav-link.active {
    background: var(--primary-gradient);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.sidebar .nav-link.active i.fa-fw,
.sidebar .nav-link.active > i:first-child {
    color: #ffffff !important;
}

.sidebar .collapse .nav-link {
    padding-left: 2.25rem;
    font-size: 0.84rem;
}

/* ==========================================================================
   8. CARDS & ELEVAÇÕES
   ========================================================================== */

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.22s ease;
    position: relative;
    overflow: hidden;
}

.card-hover:hover,
.card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.35);
}

.theme-dark .card-hover:hover,
.theme-dark .card-interactive:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.15);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.1rem 1.4rem;
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

.card-body {
    padding: 1.4rem;
    color: var(--text-color);
}

.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.4rem;
}

/* ==========================================================================
   9. WIDGETS DE MÉTRICAS & DASHBOARD STATS
   ========================================================================== */

.stat-widget {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    align-items: center;
    gap: 1.15rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--widget-accent, var(--primary-color));
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}

.stat-widget:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-widget-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: var(--widget-bg, rgba(37, 99, 235, 0.1));
    color: var(--widget-color, var(--primary-color));
}

.stat-widget-info {
    flex: 1;
    min-width: 0;
}

.stat-widget-title {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-color);
    margin-bottom: 0.25rem;
}

.stat-widget-value {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text-color);
    margin: 0;
}

.stat-widget.widget-primary { --widget-accent: #2563eb; --widget-bg: rgba(37, 99, 235, 0.12); --widget-color: #2563eb; }
.stat-widget.widget-success { --widget-accent: #10b981; --widget-bg: rgba(16, 185, 129, 0.12); --widget-color: #059669; }
.stat-widget.widget-warning { --widget-accent: #f59e0b; --widget-bg: rgba(245, 158, 11, 0.12); --widget-color: #d97706; }
.stat-widget.widget-danger  { --widget-accent: #ef4444; --widget-bg: rgba(239, 68, 68, 0.12); --widget-color: #dc2626; }
.stat-widget.widget-info    { --widget-accent: #06b6d4; --widget-bg: rgba(6, 182, 212, 0.12); --widget-color: #0891b2; }
.stat-widget.widget-indigo  { --widget-accent: #6366f1; --widget-bg: rgba(99, 102, 241, 0.12); --widget-color: #4f46e5; }

.theme-dark .stat-widget.widget-primary { --widget-bg: rgba(37, 99, 235, 0.22); --widget-color: #60a5fa; }
.theme-dark .stat-widget.widget-success { --widget-bg: rgba(16, 185, 129, 0.22); --widget-color: #34d399; }
.theme-dark .stat-widget.widget-warning { --widget-bg: rgba(245, 158, 11, 0.22); --widget-color: #fbbf24; }
.theme-dark .stat-widget.widget-danger  { --widget-bg: rgba(239, 68, 68, 0.22); --widget-color: #f87171; }
.theme-dark .stat-widget.widget-info    { --widget-bg: rgba(6, 182, 212, 0.22); --widget-color: #22d3ee; }
.theme-dark .stat-widget.widget-indigo  { --widget-bg: rgba(99, 102, 241, 0.22); --widget-color: #818cf8; }

/* ==========================================================================
   10. BADGES & PILLS
   ========================================================================== */

.badge {
    padding: 0.35rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: var(--radius-pill);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Badges Padrão com Contraste Garantido */
.theme-light .badge.bg-warning, :root:not(.theme-dark) .badge.bg-warning {
    background-color: #fffbeb !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
}
.theme-dark .badge.bg-warning {
    background-color: rgba(245, 158, 11, 0.2) !important;
    color: #fde047 !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

.theme-light .badge.bg-info, :root:not(.theme-dark) .badge.bg-info {
    background-color: #ecfeff !important;
    color: #0e7490 !important;
    border: 1px solid #a5f3fc !important;
}
.theme-dark .badge.bg-info {
    background-color: rgba(6, 182, 212, 0.2) !important;
    color: #67e8f9 !important;
    border: 1px solid rgba(6, 182, 212, 0.4) !important;
}

.theme-light .badge.bg-light, :root:not(.theme-dark) .badge.bg-light {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}
.theme-dark .badge.bg-light {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
}

.theme-light .badge.bg-secondary, :root:not(.theme-dark) .badge.bg-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}
.theme-dark .badge.bg-secondary {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
}

/* Soft Badges */
.badge-soft-primary   { background-color: rgba(37, 99, 235, 0.12) !important; color: #2563eb !important; border: 1px solid rgba(37, 99, 235, 0.25); }
.badge-soft-success   { background-color: rgba(16, 185, 129, 0.12) !important; color: #059669 !important; border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-soft-warning   { background-color: rgba(245, 158, 11, 0.12) !important; color: #d97706 !important; border: 1px solid rgba(245, 158, 11, 0.25); }
.badge-soft-danger    { background-color: rgba(239, 68, 68, 0.12) !important; color: #dc2626 !important; border: 1px solid rgba(239, 68, 68, 0.25); }
.badge-soft-info      { background-color: rgba(6, 182, 212, 0.12) !important; color: #0891b2 !important; border: 1px solid rgba(6, 182, 212, 0.25); }
.badge-soft-secondary { background-color: rgba(100, 116, 139, 0.12) !important; color: #475569 !important; border: 1px solid rgba(100, 116, 139, 0.25); }

.theme-dark .badge-soft-primary   { background-color: rgba(37, 99, 235, 0.22) !important; color: #93c5fd !important; border-color: rgba(37, 99, 235, 0.4); }
.theme-dark .badge-soft-success   { background-color: rgba(16, 185, 129, 0.22) !important; color: #6ee7b7 !important; border-color: rgba(16, 185, 129, 0.4); }
.theme-dark .badge-soft-warning   { background-color: rgba(245, 158, 11, 0.22) !important; color: #fde047 !important; border-color: rgba(245, 158, 11, 0.4); }
.theme-dark .badge-soft-danger    { background-color: rgba(239, 68, 68, 0.22) !important; color: #fca5a5 !important; border-color: rgba(239, 68, 68, 0.4); }
.theme-dark .badge-soft-info      { background-color: rgba(6, 182, 212, 0.22) !important; color: #67e8f9 !important; border-color: rgba(6, 182, 212, 0.4); }
.theme-dark .badge-soft-secondary { background-color: rgba(100, 116, 139, 0.25) !important; color: #cbd5e1 !important; border-color: rgba(100, 116, 139, 0.4); }

/* Badges de Prioridade */
.priority-pill {
    padding: 0.3rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--radius-pill);
}

.priority-baixa    { background-color: rgba(16, 185, 129, 0.12); color: #059669; border: 1px solid rgba(16, 185, 129, 0.25); }
.priority-media    { background-color: rgba(245, 158, 11, 0.12); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.25); }
.priority-alta     { background-color: rgba(239, 68, 68, 0.12); color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.25); }
.priority-critica  { background-color: rgba(15, 23, 42, 0.85); color: #ffffff; border: 1px solid rgba(239, 68, 68, 0.6); box-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }

/* Indicador de SLA */
.sla-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.82rem;
}
.sla-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.sla-ok .sla-dot { background-color: var(--success-color); box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
.sla-warning .sla-dot { background-color: var(--warning-color); box-shadow: 0 0 6px rgba(245, 158, 11, 0.6); }
.sla-danger .sla-dot { background-color: var(--danger-color); box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }

/* ==========================================================================
   11. TIMELINE DE ATUALIZAÇÕES DOS CHAMADOS
   ========================================================================== */

.timeline-card-observacao {
    background-color: #fffbeb !important;
    border: 1px solid #fde68a !important;
    color: #92400e !important;
}
.theme-dark .timeline-card-observacao {
    background-color: rgba(245, 158, 11, 0.14) !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
    color: #fef08a !important;
}

.timeline-card-mudanca {
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
}
.theme-dark .timeline-card-mudanca {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}

.timeline-card-resolucao {
    background-color: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
    color: #166534 !important;
}
.theme-dark .timeline-card-resolucao {
    background-color: rgba(16, 185, 129, 0.14) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    color: #a7f3d0 !important;
}

.timeline {
    position: relative;
    width: 100%;
}

.timeline-item {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.timeline-item .d-flex {
    width: 100%;
    max-width: 100%;
}

.timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 0.75rem;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.timeline-item .card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.timeline-item .card-header {
    width: 100%;
    max-width: 100%;
}

.timeline-item .card-body {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ==========================================================================
   12. TABELAS & DATATABLES
   ========================================================================== */

.table-responsive {
    border-radius: var(--radius-lg);
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    display: block;
}

.table {
    margin-bottom: 0;
    color: var(--text-color);
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table > :not(caption) > * > * {
    padding: 0.95rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table thead th {
    background-color: var(--table-header-bg) !important;
    color: var(--muted-color) !important;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--table-row-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   13. BOTÕES & CONTROLES DE FORMULÁRIO
   ========================================================================== */

.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.58rem 1.25rem;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn-sm {
    padding: 0.38rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.65rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38);
}

.btn-success {
    background: var(--success-gradient);
    border: none;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
    color: #ffffff !important;
}

.btn-outline-primary {
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.theme-dark .btn-outline-secondary {
    border-color: #475569;
    color: #cbd5e1;
}

.theme-dark .btn-outline-secondary:hover {
    background-color: #334155;
    color: #f1f5f9;
    border-color: #64748b;
}

/* Inputs & Form Controls */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border: 1.5px solid var(--input-border);
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    max-width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background-color: var(--input-bg);
    color: var(--text-color);
    outline: none;
}

.form-control:disabled, .form-select:disabled {
    background-color: var(--table-header-bg);
    color: var(--muted-color);
    opacity: 0.75;
}

.input-group-text {
    border-radius: var(--radius-md);
    border: 1.5px solid var(--input-border);
    background-color: var(--table-header-bg);
    color: var(--muted-color);
}

.theme-dark .input-group-text {
    background-color: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

.form-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.4rem;
}

.form-floating > .form-control {
    border-radius: var(--radius-md);
}

/* ==========================================================================
   14. MODAIS, DROPDOWNS & LIST GROUPS
   ========================================================================== */

/* Modals */
.modal-content {
    background-color: var(--modal-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}
.modal-body {
    padding: 1.5rem;
}
.theme-dark .btn-close {
    filter: invert(1) grayscale(100%);
    opacity: 0.8;
}
.theme-dark .btn-close:hover {
    opacity: 1;
}

/* Dropdowns */
.dropdown-menu {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}
.dropdown-item {
    color: var(--text-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
    transition: all 0.15s ease;
}
.dropdown-item:hover, .dropdown-item:focus {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
}
.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.4rem 0;
}
.theme-dark .dropdown-item:hover, .theme-dark .dropdown-item:focus {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* List Groups */
.list-group-item {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}
.theme-dark .list-group-item {
    background-color: var(--card-bg);
    color: #f1f5f9;
    border-color: #1e293b;
}
.theme-dark .list-group-item-action:hover {
    background-color: #1e293b;
    color: #60a5fa;
}

/* ==========================================================================
   15. TELAS DE LOGIN MODERNAS
   ========================================================================== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
                var(--bg-color);
    position: relative;
    overflow: hidden;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2.2rem;
    position: relative;
    z-index: 1;
}

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand img {
    max-height: 48px;
    margin-bottom: 0.75rem;
}

.auth-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.88rem;
    color: var(--muted-color);
}

.auth-portal-switch {
    display: flex;
    background: var(--table-header-bg);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 1.75rem;
    border: 1px solid var(--border-color);
}

.auth-portal-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    color: var(--muted-color);
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.auth-portal-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   16. MICRO-INTERAÇÕES & ANIMAÇÕES
   ========================================================================== */

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    animation: pulseGlow 2s infinite ease-in-out;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* ==========================================================================
   17. RESPONSIVIDADE COMPLETA & ZERO HORIZONTAL OVERFLOW PARA CELULARES
   ========================================================================== */

/* Regras Globais Anti-Overflow & Flex Children Safety */
.container, .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    box-sizing: border-box;
}

.row {
    margin-left: -0.45rem !important;
    margin-right: -0.45rem !important;
}

.row > * {
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Layout Principal: Em telas médias e desktop (>= 768px), o Main Content fica lado a lado com a Sidebar */
@media (min-width: 768px) {
    main,
    .main-content,
    main[role="main"] {
        flex: 1 1 0% !important;
        width: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .sidebar {
        flex: 0 0 auto !important;
    }
}

/* Em dispositivos móveis / smartphones (< 768px), o Main Content ocupa 100% da largura da tela */
@media (max-width: 767.98px) {
    .main-content,
    main[role="main"],
    main {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

    /* Cabeçalhos e Títulos de Páginas */
    .d-flex.justify-content-between.flex-wrap,
    .d-flex.justify-content-between.align-items-center.pt-3,
    .border-bottom.d-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    /* Barras de Ações e Ferramentas */
    .btn-toolbar {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0.5rem !important;
        margin: 0 !important;
    }

    /* Desfaz a trava rígida horizontal do btn-group no mobile */
    .btn-toolbar .btn-group,
    .btn-group:not(.table .btn-group):not(.table-responsive .btn-group) {
        display: flex !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        gap: 0.45rem !important;
        margin: 0 !important;
    }

    .btn-toolbar .btn-group > .btn,
    .btn-toolbar .btn-group > a.btn,
    .btn-toolbar .btn-group > button.btn,
    .btn-group:not(.table .btn-group):not(.table-responsive .btn-group) > .btn,
    .btn-group:not(.table .btn-group):not(.table-responsive .btn-group) > a.btn,
    .btn-group:not(.table .btn-group):not(.table-responsive .btn-group) > button.btn {
        flex: 1 1 auto !important;
        min-width: calc(50% - 0.45rem) !important;
        max-width: 100% !important;
        border-radius: var(--radius-md) !important;
        margin: 0 !important;
        white-space: normal !important;
        text-align: center !important;
        padding: 0.55rem 0.75rem !important;
        font-size: 0.82rem !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .btn-toolbar > .btn,
    .btn-toolbar > a.btn,
    .btn-toolbar > button.btn,
    .btn-toolbar > .dropdown,
    .btn-toolbar > .dropdown > .btn {
        flex: 1 1 auto !important;
        min-width: calc(50% - 0.45rem) !important;
    }

    /* Botões dentro de tabelas mantêm-se compactos sem quebrar o layout */
    .table .btn-group,
    .table-responsive .btn-group {
        display: inline-flex !important;
        flex-wrap: nowrap !important;
        width: auto !important;
        gap: 0.25rem !important;
    }
    .table .btn-group > .btn,
    .table-responsive .btn-group > .btn {
        flex: 0 0 auto !important;
        min-width: auto !important;
        padding: 0.3rem 0.55rem !important;
        font-size: 0.78rem !important;
        border-radius: var(--radius-sm) !important;
    }
}

/* Breakpoint Exclusivo para Celulares / Smartphones (<= 768px) */
@media (max-width: 768px) {
    body {
        font-size: 0.88rem;
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    }

    body.sidebar-open {
        overflow: hidden !important;
    }

    h1, .h1 { font-size: 1.3rem !important; word-break: break-word !important; }
    h2, .h2 { font-size: 1.15rem !important; word-break: break-word !important; }
    h3, .h3 { font-size: 1.05rem !important; word-break: break-word !important; }
    h4, .h4 { font-size: 0.95rem !important; }
    h5, .h5 { font-size: 0.9rem !important; }
    h6, .h6 { font-size: 0.84rem !important; }

    .display-4 { font-size: 1.75rem !important; }
    .display-3 { font-size: 2rem !important; }

    /* Top Navbar no Celular */
    .navbar-custom {
        min-height: 56px;
        padding: 0.35rem 0.5rem;
    }

    .navbar-brand img {
        max-height: 28px !important;
    }

    .user-avatar-pill {
        padding: 0.25rem 0.5rem;
        gap: 0.35rem;
    }

    .user-avatar-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .theme-toggle-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    /* Sidebar Drawer Mobile */
    .sidebar {
        position: fixed;
        top: 56px;
        bottom: 0;
        left: -100%;
        width: min(290px, 82vw);
        z-index: 1050;
        overflow-y: auto;
        box-shadow: var(--shadow-xl);
        transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: var(--sidebar-bg);
    }

    .sidebar.show {
        left: 0;
    }

    /* Cards e Espaçamentos Compactos */
    .card {
        border-radius: var(--radius-md);
        margin-bottom: 0.85rem;
    }

    .card-header {
        padding: 0.75rem 1rem !important;
        font-size: 0.92rem !important;
    }

    .card-body {
        padding: 0.85rem !important;
    }

    .card-footer {
        padding: 0.75rem 1rem !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    .card-footer .btn {
        flex: 1 1 auto !important;
    }

    /* Grade 2 colunas para widgets de estatísticas no celular */
    .row:has(.stat-widget),
    .stats-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 0.85rem !important;
    }

    .row:has(.stat-widget) > [class*="col-"],
    .stats-row > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        flex: none !important;
    }

    /* Widgets Estatísticos Mobile */
    .stat-widget {
        padding: 0.75rem 0.85rem !important;
        gap: 0.55rem !important;
        border-radius: var(--radius-md);
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .stat-widget-icon {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        font-size: 1.1rem !important;
        border-radius: var(--radius-sm);
    }

    .stat-widget-title {
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.15rem !important;
    }

    .stat-widget-value {
        font-size: 1.35rem !important;
        font-weight: 800 !important;
        line-height: 1.1 !important;
    }

    /* Botões & Formulários */
    .btn {
        padding: 0.48rem 0.85rem;
        font-size: 0.82rem;
        border-radius: var(--radius-sm);
    }

    .btn-lg {
        padding: 0.6rem 1.15rem;
        font-size: 0.92rem;
    }

    .form-control, .form-select {
        padding: 0.55rem 0.75rem;
        font-size: 16px; /* 16px previne zoom involuntário no iOS */
        border-radius: var(--radius-sm);
    }

    .input-group {
        flex-wrap: nowrap;
    }

    /* Tabelas no Celular */
    .table > :not(caption) > * > * {
        padding: 0.65rem 0.75rem !important;
        font-size: 0.82rem;
    }

    .table thead th {
        font-size: 0.68rem !important;
        padding: 0.55rem 0.75rem !important;
    }

    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.55rem;
    }

    /* Alertas e Caixas de Dica */
    .alert {
        padding: 0.75rem 0.95rem;
        font-size: 0.84rem;
        margin-bottom: 0.85rem;
    }

    /* Tela de Login */
    .auth-wrapper {
        padding: 1rem 0.5rem !important;
    }

    .auth-card {
        padding: 1.75rem 1.25rem !important;
        border-radius: var(--radius-lg);
        max-width: 100% !important;
    }

    .auth-title {
        font-size: 1.2rem !important;
    }

    .auth-subtitle {
        font-size: 0.8rem !important;
    }

    .auth-portal-btn {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.5rem !important;
    }

    /* Modais */
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }

    .modal-content {
        border-radius: var(--radius-md) !important;
    }

    .modal-header, .modal-footer {
        padding: 0.85rem 1rem !important;
    }

    .modal-footer {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    .modal-footer .btn {
        flex: 1 1 auto !important;
    }

    .modal-body {
        padding: 1rem !important;
    }

    /* Pre e Code Blocks */
    pre, code {
        word-break: break-word !important;
        white-space: pre-wrap !important;
        max-width: 100% !important;
    }

    /* Dropdowns */
    .dropdown-menu {
        max-width: 90vw !important;
    }
}

/* Breakpoint para Telas Menores / Celulares em Modo Retrato (<= 576px) */
@media (max-width: 576px) {
    .btn-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .btn-toolbar .btn,
    .btn-toolbar a.btn,
    .btn-toolbar button.btn,
    .btn-toolbar .dropdown,
    .btn-toolbar .dropdown > .btn {
        width: 100% !important;
        min-width: 100% !important;
    }

    .btn-toolbar .btn-group > .btn,
    .btn-toolbar .btn-group > a.btn,
    .btn-toolbar .btn-group > button.btn {
        width: 100% !important;
        min-width: 100% !important;
    }

    /* Se houver exatamente 2 botões de ação curtos, ficam lado a lado */
    .btn-toolbar.d-flex.flex-row,
    .btn-toolbar.two-buttons {
        flex-direction: row !important;
    }
}

/* Breakpoint para Telas Ultracompactas (<= 380px) */
@media (max-width: 380px) {
    .container-fluid {
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }

    .card-body {
        padding: 0.75rem !important;
    }

    .stat-widget {
        padding: 0.75rem !important;
    }
}

/* ==========================================================================
   18. PWA INSTALLATION BANNER & MOBILE PROMPT
   ========================================================================== */
.tecnodesk-pwa-banner {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 480px;
    z-index: 10000;
    pointer-events: auto;
}

.pwa-card-inner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(79, 70, 229, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.pwa-app-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

.pwa-app-info {
    flex: 1;
    min-width: 0;
}

.pwa-app-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.pwa-app-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    line-height: 1.3;
}

.pwa-app-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pwa-btn-main {
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    padding: 0.45rem 0.85rem !important;
    border-radius: var(--radius-sm) !important;
    white-space: nowrap !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3) !important;
}

.pwa-btn-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.35rem;
    line-height: 1;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.pwa-btn-dismiss:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.pwa-ios-card .pwa-app-desc {
    font-size: 0.8rem;
}

/* Animações de Entrada e Saída do Banner */
@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 30px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes pwaSlideDown {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, 30px);
    }
}

.animate-slide-up {
    animation: pwaSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-down {
    animation: pwaSlideDown 0.25s ease-in forwards;
}

@media (max-width: 576px) {
    .tecnodesk-pwa-banner {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px) + 0.75rem);
        width: calc(100% - 1.25rem);
    }
    .pwa-card-inner {
        padding: 0.75rem 0.9rem;
        gap: 0.65rem;
    }
    .pwa-app-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
}

/* ==========================================================================
   19. BACKDROP MODAL DA SIDEBAR (MOBILE DRAWER)
   ========================================================================== */

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1045;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ==========================================================================
   20. DOCK INFERIOR CORPORATIVO (MOBILE BOTTOM DOCK)
   ========================================================================== */

.mobile-bottom-dock {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-dock {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(60px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--navbar-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        z-index: 1040;
        align-items: center;
        justify-content: space-around;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .theme-dark .mobile-bottom-dock {
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        background: rgba(12, 18, 30, 0.92);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .mobile-dock-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--muted-color);
        text-decoration: none !important;
        font-size: 0.65rem;
        font-weight: 600;
        gap: 2px;
        padding: 5px 8px;
        border-radius: var(--radius-md);
        transition: all 0.2s ease;
        position: relative;
        flex: 1;
        max-width: 68px;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

    .mobile-dock-item i {
        font-size: 1.15rem;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .mobile-dock-item:hover,
    .mobile-dock-item:active {
        color: var(--primary-color);
    }

    .mobile-dock-item.active {
        color: var(--primary-color);
    }

    .mobile-dock-item.active i {
        transform: translateY(-2px);
    }

    .mobile-dock-item.active::after {
        content: '';
        position: absolute;
        bottom: 1px;
        width: 14px;
        height: 3px;
        border-radius: var(--radius-pill);
        background: var(--primary-color);
    }

    /* Botão Central Elevado (FAB / Novo Chamado) */
    .mobile-dock-fab-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
        max-width: 64px;
    }

    .mobile-dock-fab {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: var(--primary-gradient);
        color: #ffffff !important;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        box-shadow: 0 4px 16px var(--primary-glow), 0 2px 6px rgba(0, 0, 0, 0.15);
        margin-top: -16px;
        border: 3px solid var(--card-bg);
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        text-decoration: none !important;
    }

    .mobile-dock-fab:active {
        transform: scale(0.92) translateY(-2px);
    }
}



