/* ========================================
   MOOD NFE v3.1
   Sistema de Emissão de Nota Fiscal Eletrônica
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: rgba(236, 112, 20, 0.2);
}

:root {
    /* Modern Mood Brand Colors */
    --brand-orange: #EC7014;
    --brand-off-white: #F8F3EB;
    --brand-black: #141414;
    --brand-pink: #F1B3C2;
    --brand-green: #E0F431;
    
    /* Functional Colors */
    --primary-color: #EC7014;
    --primary-hover: #d46312;
    --success-color: #10b981;
    --warning-color: #EC7014;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Grays */
    --gray-50: #F8F3EB;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-700: #141414;
    --gray-800: #1f2937;
    --gray-900: #141414;
    
    /* Layout */
    --sidebar-width: 280px;
}

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

/* ========================================
   LOGIN SCREEN
   ======================================== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-off-white) 0%, #fff 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 3rem;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(20, 20, 20, 0.1);
    border: 2px solid var(--brand-orange);
}

.login-logo {
    display: block;
    max-width: 200px;
    margin: 0 auto 2rem;
}

.login-logo.logo-dark {
    display: none;
}

.login-card h2 {
    text-align: center;
    color: var(--brand-black);
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

.login-card p {
    text-align: center;
    color: #6b7280;
    margin-bottom: 2rem;
}

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

.form-group-login label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--brand-black);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    width: 100%;
    padding: 0.875rem;
    padding-right: 3rem;
    border: 2px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.password-wrapper input:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(236, 112, 20, 0.1);
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 0.5rem;
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.875rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    text-align: center;
    border: 1px solid #ef4444;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--brand-off-white);
    border-bottom: 3px solid var(--brand-orange);
}

.logo-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    max-width: 180px;
    height: auto;
    display: block;
}

.close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray-700);
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--brand-orange);
}

.sidebar-content {
    padding: 1rem;
}

.menu-section {
    margin-bottom: 2rem;
}

.menu-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--brand-black);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 1rem;
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--brand-black);
    transition: all 0.2s;
    text-align: left;
    font-weight: 500;
}

.menu-item i {
    width: 20px;
    text-align: center;
    color: var(--brand-orange);
}

.menu-item:hover:not(:disabled) {
    background: rgba(236, 112, 20, 0.1);
    transform: translateX(4px);
}

.menu-item.active {
    background: var(--brand-orange);
    color: white;
}

.menu-item.active i {
    color: white;
}

.menu-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========================================
   OVERLAY
   ======================================== */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.overlay.active {
    display: block;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.header {
    background: white;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(20, 20, 20, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 3px solid var(--brand-orange);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--brand-orange);
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.menu-toggle:hover {
    background: rgba(236, 112, 20, 0.1);
}

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

.header-logo {
    height: 50px;
    width: auto;
}

.header h1 {
    font-size: 1.5rem;
    color: var(--brand-black);
    font-weight: 700;
}

.content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   PAGE CONTENT
   ======================================== */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ========================================
   HOME PAGE
   ======================================== */
.welcome-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(20, 20, 20, 0.08);
    border: 2px solid var(--brand-orange);
}

.welcome-header h2 {
    font-size: 2rem;
    color: var(--brand-black);
    margin-bottom: 0.5rem;
}

.welcome-header h2 i {
    color: var(--brand-orange);
}

.welcome-header p {
    font-size: 1.1rem;
    color: #6b7280;
}

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

.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(20, 20, 20, 0.08);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(20, 20, 20, 0.12);
}

.stat-card.stat-success {
    border-color: var(--success-color);
}

.stat-card.stat-info {
    border-color: var(--info-color);
}

.stat-card.stat-warning {
    border-color: var(--brand-orange);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stat-success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-info .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.stat-warning .stat-icon {
    background: rgba(236, 112, 20, 0.1);
    color: var(--brand-orange);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-black);
}

.stat-label {
    font-size: 0.9rem;
    color: #6b7280;
}

/* Section Title */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-black);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--brand-orange);
}

/* Action Cards Grid */
.action-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.action-card-modern {
    background: white;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(20, 20, 20, 0.08);
    border: 2px solid var(--gray-200);
    transition: all 0.3s ease;
}

.action-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(236, 112, 20, 0.2);
    border-color: var(--brand-orange);
}

.action-card-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.3s ease;
}

.action-primary {
    background: rgba(236, 112, 20, 0.1);
    color: var(--brand-orange);
}

.action-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.action-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.action-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.action-card-modern:hover .action-card-icon {
    transform: scale(1.1) rotate(5deg);
}

.action-card-modern h4 {
    font-size: 1.25rem;
    color: var(--brand-black);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.action-card-modern p {
    color: #6b7280;
    font-size: 0.95rem;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(20, 20, 20, 0.08);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(236, 112, 20, 0.1);
}

.card h2 {
    font-size: 1.5rem;
    color: var(--brand-black);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h2 i {
    color: var(--brand-orange);
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--brand-black);
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(236, 112, 20, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.field-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--brand-orange);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(236, 112, 20, 0.3);
}

.btn-secondary {
    background: var(--brand-off-white);
    color: var(--brand-black);
    border: 2px solid var(--brand-black);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--brand-black);
    color: var(--brand-off-white);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

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

.btn-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    width: 20px;
    height: 20px;
    animation: spin 0.6s linear infinite;
}

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

/* ========================================
   RESULTS
   ======================================== */
.result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid;
}

.result.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
    color: #065f46;
}

.result.error {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.result.info {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--info-color);
    color: #1e3a8a;
}

/* ========================================
   HISTÓRICO
   ======================================== */
.historico-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-outline {
    background: white;
    border: 2px solid var(--brand-orange);
    color: var(--brand-orange);
}

.btn-outline:hover {
    background: var(--brand-orange);
    color: white;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ========================================
   DOCUMENT LINKS (Download Buttons)
   ======================================== */
.document-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

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

.document-group .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 120px;
}

.document-links .btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .document-group {
        flex-direction: column;
    }
    
    .document-group .btn {
        width: 100%;
    }
}

.historico-container {
    background: var(--gray-50);
    border-radius: 0.5rem;
    padding: 1.5rem;
    min-height: 200px;
}

.empty-state {
    text-align: center;
    color: #6b7280;
    padding: 3rem;
}

.error-state {
    text-align: center;
    color: var(--danger-color);
    padding: 3rem;
}

/* Estatísticas do Histórico */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

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

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

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

/* Dark Theme para Estatísticas */
[data-theme="dark"] .stat-card {
    background: var(--dark-card-bg);
    border-color: var(--dark-border);
}

[data-theme="dark"] .stat-card:hover {
    border-color: var(--primary-color);
}

[data-theme="dark"] .stat-label {
    color: #9ca3af;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ========================================
   HISTÓRICO - CARDS MODERNOS
   ======================================== */
.historico-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    overflow: hidden;
}

.historico-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.historico-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-bottom: 1px solid var(--gray-200);
}

.historico-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

.historico-badge .badge-icon {
    font-size: 1.125rem;
}

/* Cores por tipo de operação */
.tipo-blue { background: #dbeafe; color: #1e40af; }
.tipo-purple { background: #e9d5ff; color: #7c3aed; }
.tipo-red { background: #fee2e2; color: #dc2626; }
.tipo-orange { background: #fed7aa; color: #ea580c; }
.tipo-green { background: #d1fae5; color: #059669; }
.tipo-gray { background: #f3f4f6; color: #4b5563; }
.tipo-teal { background: #ccfbf1; color: #0d9488; }

.historico-timestamp {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
}

.timestamp-date {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.timestamp-time {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.historico-card-body {
    padding: 1.5rem;
}

.historico-main-info {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.info-pedido,
.info-ref {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.info-value {
    font-size: 1rem;
    color: var(--gray-800);
    font-weight: 600;
}

.pedido-number {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.historico-status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.ambiente-badge {
    padding: 0.375rem 0.875rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.ambiente-badge.prod {
    background: #dbeafe;
    color: #1e40af;
}

.ambiente-badge.homolog {
    background: #fef3c7;
    color: #d97706;
}

.historico-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.detail-item:hover {
    background: var(--gray-100);
}

.detail-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

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

.detail-value {
    font-size: 0.875rem;
    color: var(--gray-800);
    font-weight: 500;
}

.valor-destaque {
    color: #059669;
    font-weight: 700;
    font-size: 1rem;
}

.chave-item {
    grid-column: 1 / -1;
}

.chave-acesso {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    word-break: break-all;
    color: var(--gray-600);
}

.historico-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem;
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.message-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.message-text {
    font-size: 0.875rem;
    color: #1e40af;
    line-height: 1.5;
}

.historico-error {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem;
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.error-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.error-text {
    font-size: 0.875rem;
    color: #991b1b;
    line-height: 1.5;
}

.historico-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.xml-btn {
    background: #f0fdf4;
    color: #15803d;
    border: 2px solid #bbf7d0;
}

.xml-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
    transform: translateY(-1px);
}

.pdf-btn {
    background: #fef3c7;
    color: #d97706;
    border: 2px solid #fde68a;
}

.pdf-btn:hover {
    background: #fde68a;
    border-color: #fbbf24;
    transform: translateY(-1px);
}

/* Dark Theme para Histórico */
[data-theme="dark"] .historico-card {
    background: var(--dark-card-bg);
    border-color: var(--dark-border);
}

[data-theme="dark"] .historico-card:hover {
    border-color: var(--primary-color);
}

[data-theme="dark"] .historico-card-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.05) 100%);
    border-bottom-color: var(--dark-border);
}

[data-theme="dark"] .tipo-blue { background: rgba(37, 99, 235, 0.15); color: #93c5fd; }
[data-theme="dark"] .tipo-purple { background: rgba(124, 58, 237, 0.15); color: #c4b5fd; }
[data-theme="dark"] .tipo-red { background: rgba(220, 38, 38, 0.15); color: #fca5a5; }
[data-theme="dark"] .tipo-orange { background: rgba(234, 88, 12, 0.15); color: #fdba74; }
[data-theme="dark"] .tipo-green { background: rgba(5, 150, 105, 0.15); color: #6ee7b7; }
[data-theme="dark"] .tipo-gray { background: rgba(75, 85, 99, 0.15); color: #d1d5db; }
[data-theme="dark"] .tipo-teal { background: rgba(13, 148, 136, 0.15); color: #5eead4; }

[data-theme="dark"] .timestamp-date,
[data-theme="dark"] .info-value {
    color: var(--dark-text);
}

[data-theme="dark"] .timestamp-time,
[data-theme="dark"] .info-label,
[data-theme="dark"] .detail-label {
    color: #9ca3af;
}

[data-theme="dark"] .detail-item {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .detail-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .detail-value {
    color: var(--dark-text);
}

[data-theme="dark"] .ambiente-badge.prod {
    background: rgba(37, 99, 235, 0.15);
    color: #93c5fd;
}

[data-theme="dark"] .ambiente-badge.homolog {
    background: rgba(217, 119, 6, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .historico-message {
    background: rgba(37, 99, 235, 0.1);
    border-left-color: #3b82f6;
}

[data-theme="dark"] .message-text {
    color: #93c5fd;
}

[data-theme="dark"] .historico-error {
    background: rgba(220, 38, 38, 0.1);
    border-left-color: #ef4444;
}

[data-theme="dark"] .error-text {
    color: #fca5a5;
}

[data-theme="dark"] .xml-btn {
    background: rgba(5, 150, 105, 0.1);
    color: #6ee7b7;
    border-color: rgba(5, 150, 105, 0.3);
}

[data-theme="dark"] .xml-btn:hover {
    background: rgba(5, 150, 105, 0.2);
}

[data-theme="dark"] .pdf-btn {
    background: rgba(217, 119, 6, 0.1);
    color: #fbbf24;
    border-color: rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .pdf-btn:hover {
    background: rgba(217, 119, 6, 0.2);
}

[data-theme="dark"] .historico-status-row {
    border-bottom-color: var(--dark-border);
}

[data-theme="dark"] .historico-actions {
    border-top-color: var(--dark-border);
}

/* Responsivo para cards de histórico */
@media (max-width: 768px) {
    .historico-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .historico-timestamp {
        align-items: flex-start;
    }
    
    .historico-main-info {
        flex-direction: column;
        gap: 1rem;
    }
    
    .historico-details-grid {
        grid-template-columns: 1fr;
    }
    
    .historico-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 4rem;
    border-top: 2px solid var(--gray-200);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .close-btn {
        display: block;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 1rem;
    }
    
    .welcome-header {
        padding: 1.5rem;
    }
    
    .welcome-header h2 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 2rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .sidebar {
        width: 100%;
    }
}

/* ========================================
   UTILITIES
   ======================================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ========================================
   CONFIGURAÇÕES PAGE
   ======================================== */
.config-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-weight: 500;
}

.config-status i {
    font-size: 1.25rem;
}

.config-status.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.config-status.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    opacity: 0.7;
}

.form-hint a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.form-hint a:hover {
    text-decoration: underline;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions .btn {
    flex: 1;
}

/* Info Box */
.info-box {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid;
}

.info-box i {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.info-box.info {
    background: #dbeafe;
    color: #1e40af;
    border-left-color: #3b82f6;
}

.info-box.warning {
    background: #fef3c7;
    color: #92400e;
    border-left-color: #f59e0b;
}

.info-box ul {
    margin-top: 0.5rem;
    margin-left: 1.25rem;
}

.info-box li {
    margin-bottom: 0.25rem;
}

/* ========================================
   NFE RECEBIDAS - TABELA
   ======================================== */
.nfe-recebida-item {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.nfe-recebida-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(236, 112, 20, 0.1);
}

.nfe-recebida-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.nfe-recebida-info {
    flex: 1;
}

.nfe-recebida-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--gray-900);
    font-size: 1.1rem;
}

.nfe-recebida-info p {
    margin: 0.25rem 0;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.nfe-recebida-info small {
    color: var(--gray-700);
    opacity: 0.7;
}

.nfe-recebida-valor {
    text-align: right;
}

.nfe-recebida-valor .valor {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.nfe-recebida-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.nfe-recebida-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-manifestar {
    background: var(--success-color);
    color: white;
}

.btn-manifestar:hover {
    background: #059669;
}

.btn-ciencia {
    background: var(--info-color);
    color: white;
}

.btn-ciencia:hover {
    background: #2563eb;
}

.btn-desconhecer {
    background: var(--warning-color);
    color: white;
}

.btn-desconhecer:hover {
    background: #d97706;
}

.btn-nao-realizada {
    background: var(--danger-color);
    color: white;
}

.btn-nao-realizada:hover {
    background: #dc2626;
}

.status-manifestacao {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.status-manifestacao.ciencia {
    background: #dbeafe;
    color: #1e40af;
}

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

.status-manifestacao.nao-realizada {
    background: #fee2e2;
    color: #991b1b;
}

/* ========================================
   EMISSÃO EM MASSA
   ======================================== */
.massa-add-section {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.massa-add-section h3 {
    margin: 0 0 1rem 0;
    color: var(--gray-900);
}

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

.massa-lista-header h3 {
    margin: 0;
    color: var(--gray-900);
}

.massa-actions {
    display: flex;
    gap: 0.5rem;
}

.massa-lista-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.massa-pedido-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.massa-pedido-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(236, 112, 20, 0.1);
}

.massa-pedido-info {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.massa-pedido-field {
    display: flex;
    flex-direction: column;
}

.massa-pedido-field label {
    font-size: 0.75rem;
    color: var(--gray-700);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.massa-pedido-field span {
    font-weight: 600;
    color: var(--gray-900);
}

.massa-pedido-remove {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.massa-pedido-remove:hover {
    background: #dc2626;
}

.massa-submit-section {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-200);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--gray-200);
    border-radius: 15px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--warning-color));
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.massa-results-list {
    margin-top: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.massa-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-left: 4px solid;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.massa-result-item.success {
    border-left-color: var(--success-color);
    background: #f0fdf4;
}

.massa-result-item.error {
    border-left-color: var(--danger-color);
    background: #fef2f2;
}

.massa-result-item.processing {
    border-left-color: var(--warning-color);
    background: #fef3c7;
}

.massa-result-icon {
    font-size: 1.25rem;
}

.massa-result-item.success .massa-result-icon {
    color: var(--success-color);
}

.massa-result-item.error .massa-result-icon {
    color: var(--danger-color);
}

.massa-result-item.processing .massa-result-icon {
    color: var(--warning-color);
}

.massa-result-content {
    flex: 1;
}

.massa-result-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.massa-result-content small {
    color: var(--gray-700);
    opacity: 0.8;
}

@media (max-width: 768px) {
    .massa-lista-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .massa-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .massa-actions button {
        width: 100%;
    }
    
    .massa-pedido-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .massa-pedido-info {
        grid-template-columns: 1fr;
        margin-bottom: 1rem;
    }
    
    .massa-pedido-remove {
        width: 100%;
    }
}

.status-manifestacao.pendente {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s ease;
    pointer-events: auto;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(calc(100% + 40px));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 26px;
    flex-shrink: 0;
    line-height: 1;
}

.toast-content {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
    color: #1a1a1a;
    line-height: 1.3;
}

.toast-message {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    word-break: break-word;
    white-space: normal;
}

.toast-message small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}

.toast-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    border-radius: 6px;
    font-weight: 600;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: scale(1.1);
}

.toast-close:active {
    transform: scale(0.95);
}

/* Toast Types */
.toast-success {
    border-left: 5px solid #10b981;
    background: linear-gradient(to right, rgba(16, 185, 129, 0.05) 0%, white 15%);
}

.toast-error {
    border-left: 5px solid #ef4444;
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05) 0%, white 15%);
}

.toast-warning {
    border-left: 5px solid #f59e0b;
    background: linear-gradient(to right, rgba(245, 158, 11, 0.05) 0%, white 15%);
}

.toast-info {
    border-left: 5px solid #3b82f6;
    background: linear-gradient(to right, rgba(59, 130, 246, 0.05) 0%, white 15%);
}

/* Dark Mode */
[data-theme="dark"] .toast {
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast-success {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.15) 0%, #1f2937 15%);
}

[data-theme="dark"] .toast-error {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.15) 0%, #1f2937 15%);
}

[data-theme="dark"] .toast-warning {
    background: linear-gradient(to right, rgba(245, 158, 11, 0.15) 0%, #1f2937 15%);
}

[data-theme="dark"] .toast-info {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.15) 0%, #1f2937 15%);
}

[data-theme="dark"] .toast-title {
    color: #f3f4f6;
}

[data-theme="dark"] .toast-message {
    color: #d1d5db;
}

[data-theme="dark"] .toast-message small {
    color: #9ca3af;
}

[data-theme="dark"] .toast-close {
    background: rgba(255, 255, 255, 0.05);
    color: #9ca3af;
}

[data-theme="dark"] .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

/* Mobile Responsivo */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        padding: 14px 16px;
        gap: 12px;
        border-radius: 10px;
    }
    
    .toast-icon {
        font-size: 22px;
    }
    
    .toast-title {
        font-size: 14px;
    }
    
    .toast-message {
        font-size: 12px;
    }
    
    .toast-message small {
        font-size: 11px;
    }
    
    .toast-close {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
}

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .toast-container {
        max-width: 380px;
    }
}

/* ========================================
   BUSCA DE NFe - Timeline e Histórico
   ======================================== */

#resultadoBusca,
#historicoEmissoes {
    margin-top: 2rem;
    display: none;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item strong {
    font-size: 0.875rem;
    color: var(--gray-700);
    font-weight: 600;
}

.info-item span,
.info-item code {
    font-size: 0.9375rem;
    color: var(--gray-900);
}

.info-item code {
    background: var(--gray-100);
    padding: 0.5rem;
    border-radius: 0.375rem;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 0.8125rem;
}

.actions-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.actions-row .btn {
    flex: 1;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 3rem;
    margin-top: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1.125rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

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

.timeline-badge {
    position: absolute;
    left: -2.25rem;
    top: 0;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--gray-300);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    z-index: 2;
    border: 3px solid var(--brand-off-white);
}

.timeline-item.active .timeline-badge {
    background: var(--success-color);
}

.timeline-item.cancelled .timeline-badge {
    background: var(--danger-color);
}

.timeline-content {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.timeline-content:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(236, 112, 20, 0.1);
}

.timeline-item.active .timeline-content {
    border-color: var(--success-color);
    background: linear-gradient(to bottom, #f0fdf4, white);
}

.timeline-content h4 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

.timeline-content p {
    font-size: 0.9375rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.timeline-content p:last-of-type {
    margin-bottom: 0;
}

.timeline-content .small-code {
    font-size: 0.75rem;
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
}

.timeline-content .text-muted {
    color: var(--gray-500);
}

.timeline-content .small {
    font-size: 0.8125rem;
}

.timeline-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.timeline-actions .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Dark Theme Adjustments */
[data-theme="dark"] .info-item strong {
    color: var(--gray-300);
}

[data-theme="dark"] .info-item span,
[data-theme="dark"] .info-item code {
    color: var(--gray-200);
}

[data-theme="dark"] .info-item code {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .timeline::before {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .timeline-badge {
    border-color: var(--gray-800);
}

[data-theme="dark"] .timeline-content {
    background: var(--gray-800);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .timeline-content:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(236, 112, 20, 0.2);
}

[data-theme="dark"] .timeline-item.active .timeline-content {
    border-color: var(--success-color);
    background: linear-gradient(to bottom, rgba(16, 185, 129, 0.1), var(--gray-800));
}

[data-theme="dark"] .timeline-content h4 {
    color: var(--gray-100);
}

[data-theme="dark"] .timeline-content p {
    color: var(--gray-300);
}

[data-theme="dark"] .timeline-content .small-code {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .badge-warning {
    background: rgba(236, 112, 20, 0.2);
    color: #fcd34d;
}

/* Responsive */
@media (max-width: 768px) {
    .timeline {
        padding-left: 2.5rem;
    }
    
    .timeline-badge {
        left: -1.875rem;
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    
    .timeline-content {
        padding: 1rem;
    }
    
    .timeline-content h4 {
        font-size: 1rem;
    }
    
    .timeline-actions {
        flex-direction: column;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .actions-row {
        flex-direction: column;
    }
}

/* ========================================
   PEDIDO PREVIEW - Auto-fetch CPF
   ======================================== */

/* Loading state para input */
input.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%23EC7014' stroke-width='3' fill='none' stroke-dasharray='30 70' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='1s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px !important;
}

/* Auto-filled state para input */
input.auto-filled {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: var(--success-color) !important;
}

input.auto-filled:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Preview do pedido */
.pedido-preview-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

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

.preview-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.preview-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.preview-value {
    color: var(--text-primary);
    font-weight: 500;
}

.preview-cpf .preview-value {
    color: var(--success-color);
    font-family: monospace;
}

.preview-warning {
    padding: 0.5rem;
    background: rgba(236, 112, 20, 0.1);
    color: var(--warning-color);
    border-radius: 4px;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Tema escuro ajustes */
.dark-theme .pedido-preview-card {
    background: var(--gray-800);
}

.dark-theme input.auto-filled {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

/* Preview do Pedido - Estilos Melhorados */
.pedido-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.preview-section h5 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-address {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.preview-items-list {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
}

.preview-item-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

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

.item-qtd {
    font-weight: bold;
    color: var(--primary-color);
    min-width: 30px;
}

.item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-sku {
    font-size: 0.75rem;
}

.item-ncm {
    font-size: 0.75rem;
}

.preview-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.preview-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

.discount-row .preview-value {
    color: var(--success-color);
}

/* Badges de Drive */
.drive-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.drive-badge.success {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.drive-badge.error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.drive-badge.warning {
    background: #ffedd5;
    color: #9a3412;
    border-color: #fed7aa;
}
