/* ============================================
   SATE OPERACIONAL - CSS PREMIUM
   Sistema Operacional SATE
   ============================================ */

/* ============================================
   1. CSS RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   2. CSS VARIABLES
   ============================================ */
:root {
    /* Cores Primárias SATE */
    --primary: #07b2ab;
    --primary-light: #0fc9c1;
    --primary-dark: #05a099;
    --primary-50: #e6f7f6;
    --primary-100: #aae3db;
    --primary-200: #64f9d1;
    
    /* Cores Secundárias */
    --secondary: #0d4140;
    --secondary-light: #0a5a58;
    --secondary-dark: #0d2c2b;
    
    /* Cores de Estado */
    --success: #10b981;
    --success-light: #34d399;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    --info-light: #60a5fa;
    --info-bg: #dbeafe;
    
    /* Cores Neutras */
    --white: #ffffff;
    --gray-50: #f0faf9;
    --gray-100: #e6f7f6;
    --gray-200: #d0ede9;
    --gray-300: #a8d8d3;
    --gray-400: #5a8a86;
    --gray-500: #4a7a76;
    --gray-600: #3a6a66;
    --gray-700: #0d4140;
    --gray-800: #0d2c2b;
    --gray-900: #00240e;
    
    /* Sidebar */
    --sidebar-width: 220px;
    --sidebar-collapsed: 64px;
    --sidebar-bg: linear-gradient(180deg, #0d4140 0%, #0a3332 100%);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(7, 178, 171, 0.2);
    --sidebar-border: rgba(255, 255, 255, 0.1);
    
    /* Sombras */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    
    /* Bordas */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-slower: 500ms ease;
    
    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
}

/* ============================================
   3. TIPOGRAFIA
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-800);
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: 1rem;
    color: var(--gray-600);
}

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

a:hover {
    color: var(--primary-dark);
}

small {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ============================================
   4. LAYOUT PRINCIPAL
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left var(--transition-slow);
    background: var(--gray-50);
    min-height: 100vh;
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.95rem;
}

.content-wrapper {
    max-width: 1600px;
    margin: 0 auto;
}

/* ============================================
   5. SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--white);
    z-index: var(--z-fixed);
    transition: width var(--transition-slow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 60px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-brand-subtitle {
    font-size: 0.65rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-collapsed .sidebar-brand {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
    border-radius: var(--radius-full);
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    padding: 0.4rem 1rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    white-space: nowrap;
}

.sidebar-collapsed .nav-section-title {
    text-align: center;
    padding: 0.4rem;
}

.nav-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--gray-300);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--white);
    border-left-color: var(--primary);
}

.nav-item-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active .nav-item-icon {
    opacity: 1;
}

.nav-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.625rem;
}

.sidebar-collapsed .nav-item-text {
    display: none;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.sidebar-collapsed .sidebar-user-info {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    z-index: 10;
}

.sidebar-toggle:hover {
    background: var(--gray-50);
    transform: translateY(-50%) scale(1.1);
}

/* ============================================
   6. CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-base);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: var(--primary-50);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.info {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

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

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

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

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
}

.stat-change.positive {
    background: var(--success-bg);
    color: var(--success);
}

.stat-change.negative {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ============================================
   7. BOTÕES
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn svg {
    width: 18px;
    height: 18px;
}

/* Variantes */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(7, 178, 171, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(7, 178, 171, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-200);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

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

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-info:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary);
    color: var(--white);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.btn-outline-secondary:hover:not(:disabled) {
    background: var(--gray-100);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
}

/* Tamanhos */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    gap: 0.25rem;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-xs {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    gap: 0.125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-lg {
    width: 48px;
    height: 48px;
}

/* Grupo de botões */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

/* ============================================
   8. FORMULÁRIOS
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-control.is-valid {
    border-color: var(--success);
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Select */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Input Group */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--gray-600);
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    white-space: nowrap;
}

.input-group-text:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: 0;
}

.input-group-text:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: 0;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 0.9375rem;
    color: var(--gray-700);
    cursor: pointer;
}

/* Form Text */
.form-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
}

.invalid-feedback {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.375rem;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ============================================
   9. TABELAS
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.table th,
.table td {
    padding: 0.5rem 0.625rem;
    text-align: left;
    vertical-align: middle;
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.table td {
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    white-space: nowrap;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

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

/* Table Striped */
.table-striped tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.table-striped tbody tr:nth-child(even):hover {
    background: var(--gray-100);
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

/* Table Compact */
.table-compact th,
.table-compact td {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
}

.table-compact th {
    font-size: 0.625rem;
}

/* Dashboard Panels */
.panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.panel-heading h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.panel-heading span {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.table-wrap {
    padding: 0;
}

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

.table-wrap .table {
    margin: 0;
}

.table-wrap .table th,
.table-wrap .table td {
    border-left: none;
    border-right: none;
}

.table-wrap .table th:first-child,
.table-wrap .table td:first-child {
    padding-left: 1.25rem;
}

.table-wrap .table th:last-child,
.table-wrap .table td:last-child {
    padding-right: 1.25rem;
}

/* Dashboard Grid */
.dashboard-grid-two {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-grid-two {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   10. MODAIS
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    z-index: var(--z-modal);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--gray-400);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--gray-50);
}

/* ============================================
   11. ALERTAS E BADGES
   ============================================ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.9375rem;
    opacity: 0.9;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-bg);
    color: #065f46;
}

.badge-danger {
    background: var(--danger-bg);
    color: #991b1b;
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-info {
    background: var(--info-bg);
    color: #1e40af;
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Status Badges */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-active,
.status-pago,
.status-aprovado {
    background: var(--success-bg);
    color: #065f46;
}

.status-active::before,
.status-pago::before,
.status-aprovado::before {
    background: var(--success);
}

.status-pending,
.status-aguardando,
.status-rascunho {
    background: var(--warning-bg);
    color: #92400e;
}

.status-pending::before,
.status-aguardando::before,
.status-rascunho::before {
    background: var(--warning);
}

.status-inactive,
.status-cancelado {
    background: var(--danger-bg);
    color: #991b1b;
}

.status-inactive::before,
.status-cancelado::before {
    background: var(--danger);
}

.status-info,
.status-gerado {
    background: var(--info-bg);
    color: #1e40af;
}

.status-info::before,
.status-gerado::before {
    background: var(--info);
}

.status-lancado {
    background: var(--gray-100);
    color: var(--gray-700);
}

.status-lancado::before {
    background: var(--gray-400);
}

.status-aguardando-pagamento {
    background: var(--warning-bg);
    color: #92400e;
}

.status-aguardando-pagamento::before {
    background: var(--warning);
}

.status-em-producao {
    background: #dbeafe;
    color: #1e40af;
}

.status-em-producao::before {
    background: #3b82f6;
}

.status-enviado {
    background: #ede9fe;
    color: #5b21b6;
}

.status-enviado::before {
    background: #8b5cf6;
}

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

.status-pendencia::before {
    background: #f59e0b;
}

/* ============================================
   12. PAGINAÇÃO
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-item {
    display: flex;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination-link:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.pagination-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.pagination-link:disabled,
.pagination-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   13. DROPDOWN
   ============================================ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-fast);
    padding: 0.5rem 0;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu.right {
    left: auto;
    right: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: var(--danger-bg);
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 0.5rem 0;
}

/* ============================================
   14. TOOLTIPS
   ============================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--white);
    background: var(--gray-800);
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

/* ============================================
   15. LOADING & SPINNERS
   ============================================ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

/* ============================================
   16. UTILITÁRIOS
   ============================================ */
/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* Flexbox */
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-start { justify-content: flex-start !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.align-start { align-items: flex-start !important; }
.align-center { align-items: center !important; }
.align-end { align-items: flex-end !important; }
.flex-1 { flex: 1 !important; }

/* Gap */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-5 { gap: 1.5rem !important; }

/* Margin */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 2rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }

/* Width */
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

/* Text */
.text-start { text-align: left !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-lowercase { text-transform: lowercase !important; }
.text-capitalize { text-transform: capitalize !important; }
.fw-normal { font-weight: 400 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.fs-sm { font-size: 0.875rem !important; }
.fs-lg { font-size: 1.125rem !important; }

/* Colors */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--gray-500) !important; }
.text-dark { color: var(--gray-800) !important; }

/* Background */
.bg-white { background-color: var(--white) !important; }
.bg-light { background-color: var(--gray-50) !important; }
.bg-primary { background-color: var(--primary) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-danger { background-color: var(--danger) !important; }

/* Border */
.border { border: 1px solid var(--gray-200) !important; }
.border-0 { border: 0 !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

/* Visibility */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* Cursor */
.cursor-pointer { cursor: pointer !important; }
.cursor-not-allowed { cursor: not-allowed !important; }

/* Truncate */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   17. PÁGINA DE LOGIN
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d4140 0%, #07b2ab 100%);
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 360px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
}

.login-header {
    padding: 1.5rem 1.5rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
}

.login-logo-img {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.login-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--primary) 0%, #64f9d1 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    box-shadow: 0 6px 16px rgba(7, 178, 171, 0.4);
}

.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.login-body {
    padding: 1.25rem 1.5rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form .form-control {
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
}

.login-form .btn {
    width: 100%;
    padding: 0.625rem;
    font-size: 0.9375rem;
}

.login-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

.login-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   18. DASHBOARD
   ============================================ */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-welcome {
    flex: 1;
}

.dashboard-welcome h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.dashboard-welcome p {
    color: var(--gray-500);
    margin: 0;
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quick-action-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-50);
    color: var(--primary);
}

.quick-action-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.quick-action-content p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

/* ============================================
   19. FILTROS E BUSCA
   ============================================ */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

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

.search-box svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   20. EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.empty-state-icon svg {
    width: 40px;
    height: 40px;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* ============================================
   21. TABS
   ============================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
    gap: 0;
}

.tab-item {
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.tab-item:hover {
    color: var(--gray-700);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   22. BREADCRUMB
   ============================================ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--gray-500);
    text-decoration: none;
}

.breadcrumb-item:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--gray-800);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--gray-400);
}

/* ============================================
   23. AVATAR
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 1.75rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* ============================================
   24. RESPONSIVO
   ============================================ */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-collapsed .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .table-container {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }
    
    .modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-body {
        max-height: calc(95vh - 140px);
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-card {
        border-radius: var(--radius-xl);
    }
    
    .login-header,
    .login-body,
    .login-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-item {
        padding: 0.75rem 1rem;
        white-space: nowrap;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 44px;
    height: 44px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-md);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-fixed) - 1);
}

.mobile-overlay.show {
    display: block;
}

/* ============================================
   25. ANIMAÇÕES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-fade-in-up { animation: fadeInUp 0.3s ease; }
.animate-fade-in-down { animation: fadeInDown 0.3s ease; }
.animate-slide-in-left { animation: slideInLeft 0.3s ease; }
.animate-slide-in-right { animation: slideInRight 0.3s ease; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-bounce { animation: bounce 1s infinite; }

/* ============================================
   26. BUSCA DE PRODUTOS (ORCAMENTO/PEDIDO)
   ============================================ */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    box-shadow: var(--shadow-xl);
}

/* Container do campo de busca precisa de position relative */
.card-body .form-group {
    position: relative;
}

/* Garantir que o card não corte o dropdown */
.card {
    overflow: visible;
}

.card-body {
    overflow: visible;
}

.search-results.is-open {
    display: block;
}

.search-results-item {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    border: none;
    border-bottom: 1px solid var(--gray-200);
    background: var(--white);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    transition: background var(--transition-fast);
}

.search-results-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.search-results-item:hover {
    background: var(--primary-50);
}

.search-results-item-nome {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.search-results-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.search-results-item-info .status {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
}

.search-results-item-preco {
    font-weight: 600;
    color: var(--gray-700);
}

.search-results-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Container relativo para posicionar dropdown */
.form-group {
    position: relative;
}

/* Input de busca com borda especial quando ativo */
.form-control:focus + .search-results,
.form-control[data-produto-busca]:focus,
.form-control[data-pedido-produto-busca]:focus {
    border-color: var(--primary);
}

/* ============================================
   27. ORCAMENTO/PEDIDO TOTAIS
   ============================================ */
.orcamento-totais {
    max-width: 320px;
    margin-left: auto;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.orcamento-totais-linha {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

.orcamento-totais-linha:last-child {
    border-bottom: none;
}

.orcamento-totais-linha span {
    font-weight: 500;
}

.orcamento-totais-linha strong {
    font-size: 1rem;
    color: var(--gray-800);
}

.orcamento-totais-final {
    background: var(--primary);
    color: white;
    margin: 0.5rem -1rem -1rem -1rem;
    padding: 0.75rem 1rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.orcamento-totais-final span,
.orcamento-totais-final strong {
    color: white;
    font-size: 1rem;
}

.orcamento-totais-final strong {
    font-size: 1.25rem;
}

/* ============================================
   28. ITEM INDISPONIVEL
   ============================================ */
.item-indisponivel {
    background: rgba(239, 68, 68, 0.05);
}

.item-indisponivel td {
    color: var(--gray-500);
}

/* ============================================
   29. TABELA DE ITENS RESPONSIVA (ORÇAMENTO/PEDIDO)
   ============================================ */
.table-container .table th,
.table-container .table td {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
}

.table-container .table th:first-child,
.table-container .table td:first-child {
    width: 30px;
    padding: 0.4rem 0.25rem;
}

.table-container .table input[type="number"],
.table-container .table input[type="text"] {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    min-width: 60px;
    max-width: 80px;
}

.table-container .table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}

/* Coluna Produto mais compacta */
.table-container .table td:nth-child(2) {
    max-width: 250px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

/* ============================================
   30. RELATÓRIOS
   ============================================ */
.report-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-metrics-three {
    grid-template-columns: repeat(3, 1fr);
}

.report-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.report-card span {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.report-card strong {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}

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

.report-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    margin-bottom: 1.5rem;
}

.report-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.report-status-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.report-status {
    text-align: center;
    padding: 1rem 0.5rem;
    border-radius: var(--radius-md);
    background: var(--gray-50);
}

.report-status strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-700);
}

.report-status span {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.report-status-rascunho { background: var(--gray-100); }
.report-status-gerado { background: var(--info-bg); }
.report-status-gerado strong { color: var(--info); }
.report-status-enviado { background: var(--warning-bg); }
.report-status-enviado strong { color: var(--warning); }
.report-status-aprovado { background: var(--success-bg); }
.report-status-aprovado strong { color: var(--success); }
.report-status-cancelado { background: var(--danger-bg); }
.report-status-cancelado strong { color: var(--danger); }
.report-status-convertido-pedido { background: var(--primary-50); }
.report-status-convertido-pedido strong { color: var(--primary); }

.report-grid-two {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.report-grid-two .report-section {
    margin-bottom: 0;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

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

.report-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.report-table td {
    color: var(--gray-700);
}

.report-table tbody tr:hover {
    background: var(--gray-50);
}

.report-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-bar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.report-bar-label {
    width: 80px;
    font-size: 0.75rem;
    color: var(--gray-600);
}

.report-bar-track {
    flex: 1;
    height: 24px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.report-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    min-width: fit-content;
}

.report-bar-fill span {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

@media (max-width: 1024px) {
    .report-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    .report-metrics-three {
        grid-template-columns: repeat(3, 1fr);
    }
    .report-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .report-grid-two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .report-metrics,
    .report-metrics-three {
        grid-template-columns: 1fr;
    }
    .report-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   31. TABELA PEDIDOS/PENDENCIAS - COLUNAS
   ============================================ */
.table td.td-cliente {
    max-width: 200px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
}

.table td.td-data {
    white-space: nowrap;
}

/* Página de pendências - tabela compacta */
.pendencias-table {
    font-size: 0.75rem;
}

.pendencias-table th,
.pendencias-table td {
    padding: 0.4rem 0.3rem;
}

.pendencias-table th {
    font-size: 0.7rem;
}

.pendencias-table .td-cliente {
    max-width: 100px;
}

.pendencias-table .status {
    font-size: 0.65rem;
    padding: 0.15rem 0.3rem;
    white-space: nowrap;
}

.pendencias-table .btn-sm {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
}

.pendencias-table .table-actions {
    gap: 0.2rem;
}

/* ============================================
   32. ITEM MANUAL FORM
   ============================================ */
.item-manual-toggle {
    margin-bottom: 1rem;
}

.item-manual-form .card {
    margin-bottom: 1rem;
}

.item-manual-form h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-manual-form h4::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: 50%;
}

/* ============================================
   32. PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .btn,
    .filters-bar,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    body {
        background: white !important;
    }
}

