/* ========================================
   PRINTFLOW - GESTÃO DE PRODUÇÃO GRÁFICA
   Tema: Camaleão (Laranja)
   ======================================== */

:root {
    --primary: #FF6B00;
    --primary-hover: #E55F00;
    --primary-light: #FFF3E6;
    --secondary: #2C3E50;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray-50: #e0e0e0;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-largura: 220px;
    --sidebar-cor: #1a1a2e;
    --sidebar-texto: #d1d5db;
    --sidebar-hover: #2a2a3e;
    --sidebar-ativo: var(--primary);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* ========================================
   AUTENTICAÇÃO
   ======================================== */

#auth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #FF8C42 100%);
}

.auth-container {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 1rem;
}

.auth-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.85rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: -0.125rem;
}

.form-input {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
}

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

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

.custos-grupo-ativo {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.visivel {
    display: block;
}

.sidebar {
    width: var(--sidebar-largura);
    background: var(--sidebar-cor);
    color: var(--sidebar-texto);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icone {
    font-size: 1.75rem;
}

.sidebar-logo-texto {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
}

.sidebar-logo-sub {
    font-size: 0.75rem;
    color: var(--sidebar-texto);
    opacity: 0.6;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin: 0 8px 4px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
}

.sidebar-back-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.sidebar-back-arrow {
    font-size: 0.9rem;
}

.sidebar-secao {
    padding: 8px 14px;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
    margin-top: 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--sidebar-texto);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-item.ativo {
    background: var(--sidebar-ativo);
    color: #fff;
    font-weight: 500;
}

.sidebar-item-icone {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.8;
}

.sidebar-item.ativo .sidebar-item-icone {
    opacity: 1;
}

.sidebar-user {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #FF8C42);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-nome {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.5);
}

.sidebar-btn-sair {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 4px;
    font-size: 1.125rem;
    transition: color 0.2s;
}

.sidebar-btn-sair:hover {
    color: var(--danger);
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

#app-section {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-largura);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    position: sticky;
    top: 0;
    height: 56px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-titulo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.btn-menu-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-700);
    padding: 4px;
}

.page-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeInPage 0.2s ease;
}

@keyframes fadeInPage {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   DASHBOARD CARDS
   ======================================== */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 0.75rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.stat-card.active-filter {
    border-color: var(--primary);
    background: linear-gradient(135deg, #FFF3E6 0%, white 100%);
    box-shadow: 0 4px 20px rgba(255,107,0,0.25);
    transform: translateY(-4px);
}

.stat-card.active-filter::after {
    content: '\2713 Filtrado';
    position: absolute;
    top: -8px;
    right: 8px;
    background: var(--primary);
    color: white;
    font-size: 0.625rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.stat-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.stat-info {
    min-width: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-info-bar {
    background: linear-gradient(135deg, #FFF3E6 0%, #FFE4CC 100%);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-info-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

.btn-filter-clear {
    background: var(--primary);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-filter-clear:hover {
    background: var(--primary-hover);
}

/* ========================================
   ACTION BAR
   ======================================== */

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-bar-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-input {
    width: 320px;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 18px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ========================================
   TABLE
   ======================================== */

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

/* ========================================
   ACCORDION ORÇAMENTOS
   ======================================== */

.orcamento-row {
    transition: background-color 0.2s ease;
}

.orcamento-row:hover {
    background: var(--primary-light) !important;
}

.orcamento-itens-row {
    background: var(--gray-50) !important;
}

.orcamento-itens-row:hover {
    background: var(--gray-50) !important;
}

.orcamento-itens-row td {
    border-bottom: 2px solid var(--gray-200) !important;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-400);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--info);
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   CONFIRM MODAL CUSTOMIZADO
   ======================================== */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

.confirm-dialog {
    background: var(--white, #fff);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.15s ease;
}

.confirm-message {
    font-size: 1rem;
    color: var(--gray-800, #1f2937);
    line-height: 1.5;
    margin: 0 0 1.25rem 0;
    white-space: pre-line;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ========================================
   STATUS BADGES
   ======================================== */

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
}

/* Status de Produção */
.status-criar_arte {
    background: #dbeafe;
    color: #1e40af;
}

.status-impressao {
    background: #ede9fe;
    color: #6b21a8;
}

.status-montagem {
    background: #fef3c7;
    color: #92400e;
}

.status-montagem_externa {
    background: #fce7f3;
    color: #9f1239;
}

.status-disponivel {
    background: #d1fae5;
    color: #065f46;
}

.status-entregue {
    background: #e5e7eb;
    color: #374151;
}

/* Status Financeiro */
.status-pendente {
    background: #fee2e2;
    color: #991b1b;
}

.status-em_processamento {
    background: #fef3c7;
    color: #92400e;
}

.status-pago {
    background: #d1fae5;
    color: #065f46;
}

/* ========================================
   BOTÕES DE AÇÃO
   ======================================== */

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--gray-100);
    transform: scale(1.1);
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 700px;
    max-height: 75vh;
}

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

.modal-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Scrollbar customizada para melhor visualização */
.modal-body::-webkit-scrollbar {
    width: 12px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 6px;
    margin: 4px 0;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 6px;
    border: 2px solid var(--gray-100);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
    border-color: var(--primary-light);
}

.modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ========================================
   FORM GRID
   ======================================== */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-textarea {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
    resize: vertical;
    width: 100%;
    min-height: 60px;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input-file {
    padding: 0.5rem 0.75rem;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
}

.form-input-file:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.image-preview-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

img.image-preview {
    width: 180px;
    height: 180px;
    border-radius: 8px;
    border: 2px solid var(--gray-200);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

.btn-remove-image {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.4rem 0.875rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove-image:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Thumbnail na tabela */
.pedido-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
}

.pedido-thumbnail:hover {
    transform: scale(1.1);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Modal de visualização de imagem */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: white;
    color: var(--gray-900);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.image-modal-close:hover {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
}

/* ========================================
   MULTI-ITEM PEDIDO INTERFACE
   ======================================== */

/* Modal extra-large para pedidos multi-item */
.modal-xlarge {
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Cabeçalho do pedido */
.pedido-header {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.pedido-header h4 {
    margin: 0 0 1rem 0;
    color: var(--gray-900);
    font-size: 1.1rem;
}

/* Seção de itens */
.pedido-itens-section {
    margin-bottom: 2rem;
}

.itens-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.itens-header h4 {
    margin: 0;
    color: var(--gray-900);
    font-size: 1.1rem;
}

/* Lista de itens */
.itens-lista {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Item individual (quando usado em divs do formulário) */
div.item-row {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    padding: 1rem;
    display: grid;
    grid-template-columns: 2fr 100px 120px 120px 40px;
    gap: 1rem;
    align-items: start;
    transition: all 0.2s;
}

div.item-row:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.1);
}

div.item-row .form-group {
    margin-bottom: 0;
}

div.item-row .form-group label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

div.item-row .form-input,
div.item-row .form-textarea {
    font-size: 0.9rem;
}

/* Item individual na tabela */
tr.item-row {
    display: table-row !important;
    width: 100%;
}

tr.item-row td {
    vertical-align: top;
}

/* Autocomplete de produtos */
.produto-ac-wrapper {
    position: relative;
    width: 100%;
}
.produto-ac-input {
    width: 100%;
    box-sizing: border-box;
}
.produto-ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
}
.produto-ac-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
}
.produto-ac-option:hover {
    background: var(--primary-light);
}
.produto-ac-manual {
    color: var(--primary);
    font-weight: 500;
    border-bottom: 1px solid var(--gray-200);
}

.item-numero {
    position: absolute;
    top: -8px;
    left: 12px;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Campo de total calculado */
.item-total-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: 4px;
    text-align: right;
}

/* Botão remover item */
.btn-remove-item {
    background: var(--danger);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 1.5rem;
}

.btn-remove-item:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Detalhes expandidos do item */
.item-detalhes {
    grid-column: 1 / -1;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.item-detalhes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.btn-toggle-detalhes {
    grid-column: 1 / -1;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--gray-700);
    transition: all 0.2s;
}

.btn-toggle-detalhes:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

/* Mensagem de lista vazia */
.itens-empty {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    color: var(--gray-600);
}

.itens-empty.hidden {
    display: none;
}

/* Totais do pedido */
.pedido-totais {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--gray-200);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.total-row.total-final {
    border-top: 2px solid var(--gray-300);
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.total-label {
    color: var(--gray-700);
}

.total-value {
    color: var(--primary);
    font-weight: 600;
}

.total-final .total-value {
    font-size: 1.5rem;
}

/* Botão pequeno */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ========================================
   TAGS DE DEPARTAMENTOS
   ======================================== */

.departamento-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--gray-100);
    border: 2px solid var(--gray-300);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.2s;
}

.departamento-tag:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.departamento-tag .btn-remove-tag {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.departamento-tag .btn-remove-tag:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

#lista-departamentos:empty::before {
    content: 'Nenhum departamento adicionado';
    color: var(--gray-400);
    font-size: 0.875rem;
    font-style: italic;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.aberta {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-menu-mobile {
        display: block;
    }

    .page-content {
        padding: 1rem;
    }

    .search-input {
        width: 100%;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-bar-group {
        flex-direction: column;
    }

    .table-container {
        overflow-x: auto;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 1rem;
    }

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

    .dashboard-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .stat-icon {
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1.125rem;
    }

    .stat-label {
        font-size: 0.625rem;
    }
}

/* ========== TABELA DE PEDIDOS - ITENS EXPANSÍVEIS ========== */

/* Contagem de itens */
.itens-count {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--gray-100);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* Linha de itens expandidos */
.itens-expandidos {
    transition: all 0.3s ease;
}

.itens-expandidos.hidden {
    display: none;
}

/* Container dos itens detalhados */
.itens-detalhes-container {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.itens-detalhes-container h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
}

/* Grid de itens */
.itens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Card de item individual */
.item-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.item-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.1);
}

/* Header do card de item */
.item-card-header {
    background: var(--gray-100);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--gray-200);
}

.item-card-header strong {
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Body do card de item */
.item-card-body {
    padding: 1rem;
}

/* Linha de informação do item */
.item-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.item-info-row:last-child {
    border-bottom: none;
}

.item-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 1rem;
}

.item-value {
    font-size: 0.875rem;
    color: var(--gray-900);
    text-align: right;
    flex: 1;
    word-break: break-word;
}

/* Ícone de expansão */
.expand-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.875rem;
}

/* Responsivo para itens grid */
@media (max-width: 768px) {
    .itens-grid {
        grid-template-columns: 1fr;
    }

    .item-info-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .item-label {
        margin-bottom: 0.25rem;
    }

    .item-value {
        text-align: left;
    }
}

/* ========================================
   STATUS DROPDOWN
   ======================================== */

.status-dropdown {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

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

.status-dropdown-header {
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}

.status-dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dropdown-item:hover {
    background: var(--primary-50);
    color: var(--primary-700);
}

.status-dropdown-item:active {
    background: var(--primary-100);
}

/* ========================================
   SISTEMA DE PERMISSÕES
   ======================================== */

.permissions-module {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s;
}

.permissions-module:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.module-title {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--gray-900);
    font-size: 1.125rem;
    font-weight: 600;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
}

.permission-item:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    transform: translateY(-1px);
}

.permission-item:has(input:checked) {
    background: var(--primary-100);
    border-color: var(--primary-500);
}

.permission-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-600);
}

.permission-item span {
    font-size: 0.875rem;
    color: var(--gray-700);
    user-select: none;
}

.permission-advanced {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

.permission-advanced h5 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-group label:hover {
    background: var(--gray-100);
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-600);
}

.checkbox-group label:has(input:checked) {
    background: var(--primary-50);
    color: var(--primary-700);
}

/* Informações da aba de permissões */
.permissions-info-box {
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.permissions-info-box h3 {
    margin-top: 0;
    color: var(--primary-700);
    font-size: 1rem;
}

.permissions-info-box ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.permissions-info-box li {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Header de informações do usuário */
.user-info-header {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.user-info-header h4 {
    margin: 0;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
    font-size: 1.125rem;
}

.user-info-header p {
    margin: 0;
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Responsividade para permissões */
@media (max-width: 768px) {
    .permissions-grid {
        grid-template-columns: 1fr;
    }

    .permission-item {
        padding: 1rem;
    }

    .permissions-module {
        padding: 1rem;
    }
}

/* ========================================
   ITEM-SPECIFIC IMAGE & LINK
   ======================================== */

.image-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

.image-preview img {
    width: 180px;
    height: 180px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    object-fit: cover;
}

.btn-remove-image {
    padding: 4px 12px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-remove-image:hover {
    background: #dc2626;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--gray-500);
    font-size: 0.8125rem;
}

/* ========================================
   ESTEIRA DE PRODUÇÃO (Cards)
   ======================================== */

.esteira-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.esteira-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.esteira-arrow {
    font-size: 0.8rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

/* Tabs (Disponíveis/Entregues) */
.page-tab {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.page-tab:hover {
    color: var(--primary);
}

.page-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.page-tab.active span {
    background: var(--primary) !important;
    color: white;
}

/* Card agrupado por pedido */
.esteira-card-pedido {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: auto;
    padding: 14px 16px;
}

.esteira-pedido-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    cursor: pointer;
    min-width: 0;
}

.esteira-pedido-header:hover {
    background: var(--gray-50);
    border-radius: 6px;
    margin: -4px -6px;
    padding: 4px 6px;
}

.esteira-pedido-cliente {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9rem;
    min-width: 100px;
}

.esteira-pedido-titulo {
    flex: 1;
    min-width: 120px;
    max-width: 400px;
    padding: 4px 10px;
    border: 1px dashed var(--gray-300);
    background: transparent;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--gray-700);
    border-radius: 4px;
    outline: none;
    transition: all 0.15s;
    font-family: inherit;
}

.esteira-pedido-titulo:hover {
    background: #fff7ed;
    border-color: var(--primary);
    border-style: solid;
}

.esteira-pedido-titulo:focus {
    background: white;
    border-color: var(--primary);
    border-style: solid;
    font-style: normal;
    color: var(--gray-900);
    box-shadow: 0 0 0 3px rgba(237, 119, 47, 0.15);
}

.esteira-pedido-titulo::placeholder {
    color: var(--gray-400);
    font-style: italic;
}

.esteira-item-observacao {
    width: 100%;
    padding: 6px 10px;
    border: 1px dashed var(--gray-300);
    background: transparent;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--gray-700);
    border-radius: 6px;
    outline: none;
    resize: none;
    font-family: inherit;
    transition: all 0.15s;
    min-height: 50px;
    align-self: stretch;
}

.esteira-item-observacao:hover {
    background: #fff7ed;
    border-color: var(--primary);
    border-style: solid;
}

.esteira-item-observacao:focus {
    background: white;
    border-color: var(--primary);
    border-style: solid;
    font-style: normal;
    color: var(--gray-900);
    box-shadow: 0 0 0 3px rgba(237, 119, 47, 0.15);
}

.esteira-item-observacao::placeholder {
    color: var(--gray-400);
    font-style: italic;
}

.esteira-pedido-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
    margin-left: auto;
}

.esteira-pedido-meta .esteira-card-entrega {
    min-width: 120px;
    text-align: right;
    white-space: nowrap;
}

.esteira-pedido-pecas {
    font-size: 0.8rem;
    color: var(--gray-700);
    font-weight: 500;
    min-width: 120px;
    text-align: right;
    white-space: nowrap;
}

.esteira-pedido-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

.esteira-pedido-itens {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.esteira-pedido-item-row {
    display: grid;
    grid-template-columns: 50px 1fr minmax(200px, 320px);
    gap: 10px;
    padding: 8px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--primary);
    align-items: stretch;
}

.esteira-item-img {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.esteira-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.esteira-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.esteira-item-info-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    row-gap: 6px;
}

.esteira-item-nome {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-900);
}

.esteira-item-qtd {
    font-size: 0.8rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 4px;
}

.esteira-btn-mover-mini,
.esteira-btn-editar-mini {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    cursor: pointer;
}

.esteira-pedido-item-row.selected {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: #fff7ed;
}

.esteira-btn-mover-mini:hover { background: var(--primary); color: white; border-color: var(--primary); }
.esteira-btn-editar-mini:hover { background: var(--gray-100); }

.esteira-item-timeline {
    font-size: 0.8rem;
}

.esteira-item-timeline .esteira-timeline {
    gap: 4px;
}

.esteira-item-timeline .esteira-timeline-ponto {
    font-size: 0.75rem;
}

.esteira-item-timeline .esteira-timeline-check {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
}

.esteira-item-timeline .esteira-timeline-linha {
    height: 2px;
    width: 20px;
}

/* Legacy card individual (fallback) */
.esteira-card:not(.esteira-card-pedido) {
    display: grid;
    grid-template-columns: 180px 1fr;
    grid-template-rows: auto auto 1fr;
    gap: 12px 20px;
    min-height: 180px;
}

.esteira-card.selected {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
    box-shadow: 0 0 0 6px rgba(237, 119, 47, 0.15);
}

.esteira-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Imagem (ocupa toda a altura) */
.esteira-card-imagem {
    grid-row: 1 / -1;
    width: 180px;
    height: 180px;
    background: var(--gray-50);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 0.75rem;
    overflow: hidden;
}

.esteira-card-imagem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Header do card */
.esteira-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.esteira-card-descricao {
    font-size: 0.85rem;
    color: var(--gray-900);
    font-weight: 600;
    line-height: 1.4;
    padding: 6px 10px;
    background: #f0f0f0;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    min-height: 32px;
    max-height: 60px;
    overflow-y: auto;
    white-space: pre-line;
    margin-top: 4px;
}
.esteira-card-descricao:empty {
    display: none;
}

.esteira-card-header-esq {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.esteira-card-header-dir {
    display: flex;
    align-items: center;
    gap: 8px;
}

.esteira-card-codigo {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8125rem;
    font-family: monospace;
}

.esteira-card-separador {
    color: var(--gray-400);
    font-size: 0.75rem;
}

.esteira-card-cliente {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.esteira-card-entrega {
    color: var(--gray-500);
    font-size: 0.8125rem;
}
.esteira-card-entrega.entrega-proxima {
    color: #e6a817;
    font-weight: 600;
}
.esteira-card-entrega.entrega-atrasada {
    color: #dc3545;
    font-weight: 600;
}

.esteira-card-pecas {
    font-size: 0.8125rem;
    font-weight: 500;
}

.esteira-card-notas {
    cursor: pointer;
    font-size: 1.125rem;
    opacity: 0.7;
    position: relative;
    padding: 6px 8px;
    transition: opacity 0.2s;
}

.esteira-card-notas:hover {
    opacity: 0.8;
}

.esteira-card-notas.tem-notas {
    opacity: 1;
}

.esteira-card-notas-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Botões do card */
.esteira-btn-editar,
.esteira-btn-mover,
.esteira-btn-tipo {
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.esteira-btn-editar {
    background: #fff;
    color: var(--gray-600);
}
.esteira-btn-editar:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.esteira-btn-mover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.esteira-btn-mover:hover {
    background: var(--primary-dark, #e65100);
    border-color: var(--primary-dark, #e65100);
}
.esteira-btn-tipo {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}
.esteira-btn-tipo:hover {
    background: #d97706;
    border-color: #d97706;
}
.status-dropdown-atual {
    background: #f0fdf4;
    font-weight: 600;
}

/* Timeline horizontal */
.esteira-card-timeline {
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
    min-width: 0;
    padding-bottom: 4px;
}

.esteira-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    width: max-content;
}

.esteira-timeline-ponto {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.esteira-timeline-check {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.esteira-timeline-check.pendente {
    background: var(--gray-200);
    color: var(--gray-400);
}

.esteira-timeline-check.destino {
    background: var(--gray-200);
    border: 2px solid var(--gray-300);
    color: var(--gray-400);
}

.esteira-timeline-check.clicavel {
    cursor: pointer;
    transition: all 0.2s;
}

.esteira-timeline-check.clicavel:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: scale(1.2);
}

.esteira-timeline-linha {
    height: 4px;
    flex: 1;
    min-width: 60px;
    max-width: 160px;
    background: var(--success);
    margin-top: 22px;
}

.esteira-timeline-linha.pendente {
    background: var(--gray-200);
}

.esteira-timeline-info {
    text-align: center;
    margin-top: 8px;
    line-height: 1.4;
}

.esteira-timeline-status {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--primary);
}

.esteira-timeline-detalhe {
    font-size: 0.8125rem;
    color: var(--gray-400);
}

.esteira-timeline-tempo {
    font-size: 0.8125rem;
    color: var(--success);
    font-weight: 600;
}

/* Estado vazio da esteira */
.esteira-vazio {
    text-align: center;
    padding: 3rem;
    color: var(--gray-400);
}

.esteira-vazio-icone {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.esteira-vazio-texto {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Badge de status financeiro no card */
.esteira-card-badge-financeiro {
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Responsivo */
@media (max-width: 768px) {
    .esteira-card {
        grid-template-columns: 1fr;
    }

    .esteira-card-imagem {
        grid-row: auto;
        width: 100%;
        height: 80px;
    }

    .esteira-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .esteira-card-header-dir {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ========================================
   LOADING SPINNER & SKELETON
   ======================================== */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
    gap: 1rem;
}

.loading-spinner::before {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-spinner-text {
    font-size: 0.9rem;
    color: var(--gray-500);
}

/* Skeleton para tabelas */
.skeleton-row td {
    position: relative;
    overflow: hidden;
}

.skeleton-row td::after {
    content: '';
    display: block;
    height: 14px;
    width: 70%;
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Botao desabilitado durante submit */
.btn[disabled], button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */

/* Focus visivel para navegacao por teclado */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Botoes de icone - area de clique minima (44px WCAG) */
.btn-icon {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Stat cards como botoes clicaveis */
.stat-card {
    cursor: pointer;
}

.stat-card:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Data-action clicaveis devem ter cursor pointer */
[data-action] {
    cursor: pointer;
}

/* Screen reader only (conteudo acessivel mas invisivel) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   DROPZONE DE ANEXO (Conversão Orçamento)
   ======================================== */

.dropzone-anexo {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #fafafa;
    padding: 18px;
    transition: all 0.15s;
    cursor: pointer;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-anexo:hover {
    border-color: var(--primary);
    background: #fff7ed;
}

.dropzone-anexo.dragging {
    border-color: var(--primary);
    background: #fff7ed;
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(237, 119, 47, 0.15);
}

.dropzone-anexo:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(237, 119, 47, 0.15);
}

.dropzone-conteudo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    width: 100%;
}

.dropzone-icone {
    font-size: 1.8rem;
    opacity: 0.7;
}

.dropzone-texto {
    font-size: 0.9rem;
    color: #374151;
}

.dropzone-texto strong { color: #111827; }
.dropzone-texto a { color: var(--primary); text-decoration: underline; }
.dropzone-texto a:hover { text-decoration: none; }

.dropzone-dica {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 2px;
}

.dropzone-dica kbd {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-family: inherit;
    box-shadow: 0 1px 0 #d1d5db;
}

.dropzone-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 4px;
}

.dropzone-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: white;
}

.dropzone-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dropzone-preview-info strong {
    color: #111827;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropzone-preview-info span {
    color: #6b7280;
    font-size: 0.75rem;
}

.dropzone-btn-remover {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dropzone-btn-remover:hover {
    background: #fecaca;
}

/* ========================================
   UI INSPECTOR / EDITOR VISUAL
   ======================================== */

body.ui-inspector-ativo {
    cursor: crosshair;
}

.ui-inspector-hover {
    outline: 2px dashed var(--primary, #ed772f) !important;
    outline-offset: 2px !important;
    cursor: pointer !important;
}

.ui-inspector-selected {
    outline: 3px solid var(--primary, #ed772f) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px rgba(237, 119, 47, 0.15) !important;
}

.ui-inspector-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    cursor: default;
    overflow: hidden;
}

.ui-inspector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--primary, #ed772f);
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ui-inspector-titulo {
    font-weight: 700;
    font-size: 1rem;
}

.ui-inspector-fechar {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-inspector-fechar:hover {
    background: rgba(255, 255, 255, 0.35);
}

.ui-inspector-info {
    padding: 12px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
    font-size: 0.8rem;
    line-height: 1.5;
}

.ui-inspector-info-linha {
    margin-bottom: 4px;
}

.ui-inspector-info code {
    background: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
    font-size: 0.75rem;
    color: #ed772f;
}

.ui-inspector-form {
    padding: 12px 18px;
    overflow-y: auto;
    flex: 1;
}

.ui-inspector-campo {
    margin-bottom: 14px;
    position: relative;
}

.ui-inspector-label {
    display: block;
    font-weight: 600;
    font-size: 0.75rem;
    color: #374151;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ui-inspector-badge {
    color: var(--primary, #ed772f);
    font-size: 1.2rem;
    line-height: 0;
}

.ui-inspector-color-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ui-inspector-color-wrap input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

.ui-inspector-color-wrap input[type="text"] {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: monospace;
}

.ui-inspector-size-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ui-inspector-size-wrap input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

.ui-inspector-size-wrap span {
    font-size: 0.75rem;
    color: #6b7280;
    min-width: 20px;
}

.ui-inspector-form select,
.ui-inspector-form input[type="range"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

.ui-inspector-range-valor {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.75rem;
    color: #6b7280;
}

.ui-inspector-restaurar {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.ui-inspector-restaurar:hover {
    background: #fee2e2;
}

.ui-inspector-footer {
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ui-inspector-btn-salvar {
    flex: 1;
    padding: 10px 16px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    transition: all 0.15s;
}

.ui-inspector-btn-salvar:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.ui-inspector-btn-descartar {
    padding: 10px 14px;
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
}

.ui-inspector-btn-descartar:hover {
    background: #f3f4f6;
    color: #ef4444;
    border-color: #ef4444;
}
