:root {
    --sidebar-width: 280px;
    --primary-color: #2d3748;
    --primary-hover: #1a202c;
    --sidebar-bg: #ffffff;
    --sidebar-text: #4a5568;
    --border-color: #e2e8f0;
    --bg-light: #f7fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s ease;
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar.active {
    margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-header {
    padding: 25px 20px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    text-align: center;
    margin-bottom: 15px;
}

.sidebar-logo {
    max-width: 200px;
    width: 100%;
    height: auto;
}

.system-title {
    text-align: center;
    margin-top: 10px;
}

.system-title h5 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
}

.system-title small {
    color: #718096;
    font-size: 0.8rem;
}

.sidebar ul.components {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Estilo da barra de rolagem do menu */
.sidebar ul.components::-webkit-scrollbar {
    width: 6px;
}

.sidebar ul.components::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar ul.components::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.sidebar ul.components::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.sidebar ul li {
    list-style: none;
    margin: 5px 12px;
}

.menu-section-title {
    padding: 15px 15px 5px 15px;
    margin: 5px 0 0 0 !important;
    border-top: 1px solid #e2e8f0;
}

.menu-section-title:first-child {
    border-top: none;
    padding-top: 5px;
}

.menu-section-title small {
    font-size: 0.7rem;
    font-weight: 700;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-link {
    padding: 12px 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 500;
}

.sidebar-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
    transform: translateX(3px);
}

.sidebar-link:focus,
.sidebar-link:focus-visible,
.sidebar ul ul a:focus,
.sidebar ul ul a:focus-visible {
    outline: none;
    box-shadow: none;
}

.sidebar-link i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar ul ul {
    background: transparent;
    border-left: none;
    padding-left: 0;
    margin-top: 5px;
}

.sidebar ul ul li {
    margin: 3px 12px;
}

.sidebar ul ul a {
    padding: 10px 15px 10px 47px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    color: #718096;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar ul ul a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.sidebar ul ul a i {
    margin-right: 8px;
    font-size: 0.9rem;
}

.sidebar-footer {
    padding: 20px 15px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.user-avatar i {
    font-size: 2.2rem;
    color: var(--primary-color);
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.75rem;
    color: #718096;
}

.btn-profile {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-profile:hover {
    background: var(--primary-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 55, 72, 0.2);
}

#content {
    width: calc(100% - var(--sidebar-width));
    padding: 0;
    min-height: 100vh;
    transition: all 0.3s;
    margin-left: var(--sidebar-width);
    background: var(--bg-light);
    overflow-x: clip;
}

#content.active {
    margin-left: 0;
    width: 100%;
}

.navbar {
    padding: 18px 25px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.navbar-title h5 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
}

.btn-toggle {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-toggle:hover {
    background: var(--primary-color);
    color: white;
}

.btn-logout {
    background: transparent;
    border: 1px solid #e53e3e;
    color: #e53e3e;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

.content-area {
    padding: 25px;
}

.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
    border-radius: 12px;
    background: white;
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--primary-color);
    border-radius: 12px 12px 0 0 !important;
    padding: 18px 20px;
    font-size: 1.05rem;
}

.card-body {
    padding: 20px;
}

.badge {
    font-weight: 600;
    padding: 0.5em 0.8em;
    border-radius: 6px;
    font-size: 0.8rem;
}

.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 18px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 55, 72, 0.2);
}

.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead {
    background: var(--bg-light);
    color: var(--primary-color);
    font-weight: 700;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-light);
}

.kanban-board {
    padding: 10px 0;
}

.kanban-board .row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
}

.kanban-column {
    min-width: 280px;
    max-width: 280px;
    flex: 0 0 280px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 15px;
}

.kanban-cards {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

.kanban-cards::-webkit-scrollbar {
    width: 6px;
}

.kanban-cards::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}

.kanban-cards::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.kanban-cards::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.kanban-card {
    cursor: move;
    transition: all 0.1s ease;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    background: white;
    min-height: 100px;
}

.kanban-card::-webkit-scrollbar {
    width: 5px;
}

.kanban-card::-webkit-scrollbar-track {
    background: transparent;
}

.kanban-card::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.kanban-card::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.kanban-card .card-text {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    max-height: none;
}

.kanban-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.drag-over {
    background-color: #e6f7ff;
    border: 2px dashed var(--primary-color);
}

/* Chat Styles - Estilo WhatsApp/Slack */
.chat-messages-container {
    background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%);
}

.chat-messages-container::-webkit-scrollbar {
    width: 8px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.chat-message {
    animation: fadeInMessage 0.3s ease-in;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble-own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-align: left;
}

.chat-bubble-own .chat-author {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

.chat-bubble-own .chat-text {
    color: white;
    margin-bottom: 8px;
}

.chat-bubble-own .chat-timestamp {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.75rem;
}

.chat-bubble-other {
    background: white;
    color: var(--primary-color);
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    text-align: left;
}

.chat-bubble-other .chat-author {
    color: var(--primary-color);
    font-size: 0.85rem;
}

.chat-bubble-other .chat-text {
    color: #4a5568;
    margin-bottom: 8px;
}

.chat-bubble-other .chat-timestamp {
    color: #718096 !important;
    font-size: 0.75rem;
}

#chatInput {
    border-radius: 20px;
    padding: 12px 20px;
}

#chatInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

#chatForm button {
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#chatForm button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-messages {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 15px;
}

.table-danger {
    background-color: #fff5f5 !important;
}

.form-label {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.1);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: 700;
}

/* Timeline Styles - Histórico de Alterações */
.timeline {
    position: relative;
    padding-left: 25px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #3182ce 0%, #e2e8f0 100%);
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
    padding-bottom: 15px;
}

.timeline-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -22px;
    top: 5px;
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #3182ce;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 3px solid #3182ce;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.timeline-content:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateX(2px);
}

.change-detail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.change-detail .badge {
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
    }
    
    .sidebar.active {
        margin-left: 0;
    }
    
    #content {
        margin-left: 0;
        width: 100%;
    }
    
    .navbar-title h5 {
        font-size: 1rem;
    }
    
    .timeline {
        padding-left: 20px;
    }
    
    .timeline-marker {
        left: -19px;
    }
}

/* ============================================================
   MODAL DESIGN SYSTEM — colored header variants
   ============================================================ */
:root {
    --modal-header-primary-bg: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    --modal-header-teal-bg:    linear-gradient(135deg, #0f766e 0%, #0891b2 100%);
    --modal-header-danger-bg:  linear-gradient(135deg, #7f1d1d 0%, #b91c1c 100%);
    --modal-header-success-bg: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --modal-header-purple-bg:  linear-gradient(135deg, #6c3fc5 0%, #3b82f6 100%);
    --modal-header-neutral-bg: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

/* Shared base for all colored header variants */
.modal-header-primary,
.modal-header-teal,
.modal-header-danger,
.modal-header-success,
.modal-header-purple,
.modal-header-neutral,
.modal-header-custom {
    border-bottom: none !important;
    padding: 16px 20px;
}

.modal-header-primary .modal-title,
.modal-header-teal .modal-title,
.modal-header-danger .modal-title,
.modal-header-success .modal-title,
.modal-header-purple .modal-title,
.modal-header-neutral .modal-title,
.modal-header-custom .modal-title {
    color: white !important;
    font-size: 0.95rem;
    font-weight: 600;
}

.modal-header-primary .btn-close,
.modal-header-teal .btn-close,
.modal-header-danger .btn-close,
.modal-header-success .btn-close,
.modal-header-purple .btn-close,
.modal-header-neutral .btn-close,
.modal-header-custom .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

/* Individual variants */
.modal-header-primary {
    background: var(--modal-header-primary-bg);
    color: white;
}

.modal-header-teal {
    background: var(--modal-header-teal-bg);
    color: white;
}

.modal-header-danger {
    background: var(--modal-header-danger-bg);
    color: white;
}

.modal-header-success {
    background: var(--modal-header-success-bg);
    color: white;
}

.modal-header-purple {
    background: var(--modal-header-purple-bg);
    color: white;
}

.modal-header-neutral {
    background: var(--modal-header-neutral-bg);
    color: white;
}

/* modal-header-custom: alias for primary blue */
.modal-header-custom {
    background: var(--modal-header-primary-bg);
    color: white;
}

/* Global modal shadow/radius */
.modal-content {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.10);
}

@media (max-width: 767px) {
    .co-form > .co-item {
        grid-column: 1 / -1 !important;
    }

    .co-form {
        gap: 6px 0 !important;
    }

    #modalOS .modal-content,
    #modalNovoPedido .modal-content,
    #modalRetiradaEntrega .modal-content {
        max-width: 100%;
        overflow-x: hidden;
    }

    #modalOS .modal-body,
    #modalNovoPedido .modal-body,
    #modalRetiradaEntrega .modal-body {
        padding: 0.75rem !important;
        overflow-x: hidden;
    }

    #modalOS .modal-header,
    #modalNovoPedido .modal-header,
    #modalRetiradaEntrega .modal-header {
        padding: 0.75rem 1rem;
    }
}
