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

:root {
    /* Paleta de cores - Amarelo e Azul Escuro */
    --primary-blue: #1a2332;
    --secondary-blue: #2c3e50;
    --accent-blue: #34495e;
    --light-blue: #ecf0f1;
    
    --primary-yellow: #f39c12;
    --secondary-yellow: #f1c40f;
    --light-yellow: #fef5e7;
    
    --accent-gold: #ffd700;
    --accent-amber: #ffb347;
    
    --success-green: #27ae60;
    --success-dark: #229954;
    --success-light: #d5f4e6;
    
    --danger-red: #e74c3c;
    --danger-dark: #c0392b;
    --danger-light: #fadbd8;
    
    --warning-yellow: #f39c12;
    --warning-light: #fef5e7;
    
    --neutral-gray: #7f8c8d;
    --light-gray: #ecf0f1;
    --border-gray: #bdc3c7;
    --dark-gray: #2c3e50;
    
    --white: #fffef8;
    --bg-gradient-start: #fef9f3;
    --bg-gradient-end: #fdefd4;
    
    /* Sombras refinadas */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --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-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(to bottom right, var(--bg-gradient-start), var(--bg-gradient-end));
    min-height: 100vh;
    padding: 24px;
    color: var(--primary-blue);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

.auth-warning {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff4e5;
    border: 1px solid #ffd9a8;
    border-radius: 12px;
    padding: 18px 24px;
    margin-bottom: 24px;
    color: #8a5a00;
    box-shadow: var(--shadow-sm);
}

.auth-warning i {
    font-size: 28px;
}

.auth-warning p {
    margin: 4px 0 0 0;
    font-size: 0.95em;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(249, 115, 22, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease-out;
}

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

/* Header profissional */
header {
    text-align: center;
    margin-bottom: 32px;
    padding: 48px 32px;
    background: #fffef8;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-gray);
    position: relative;
    overflow: hidden;
}

/* Seletor de Estoque */
.inventory-selector-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
    padding: 24px;
    background: var(--light-gray);
    border-radius: 12px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.inventory-selector-container label {
    font-size: 1em;
    font-weight: 600;
    color: var(--primary-blue);
}

.inventory-select {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    color: var(--primary-blue);
    background: #fffef8;
    cursor: pointer;
    transition: all 0.3s ease;
}

.inventory-select:hover {
    border-color: var(--accent-blue);
}

.inventory-select:focus {
    outline: none;
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Page Switcher */
.page-switcher {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 6px;
    background: var(--light-gray);
    border-radius: 12px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.page-switch-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--neutral-gray);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9375em;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
}

.page-switch-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
}

.page-switch-btn.active {
    background: var(--secondary-blue);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

/* Page Content */
.page-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

.hidden {
    display: none !important;
}

.show {
    display: block !important;
}

.tabs.show {
    display: flex !important;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-yellow) 0%, var(--accent-gold) 50%, var(--secondary-yellow) 100%);
}

header h1 {
    font-size: 2.75em;
    margin-bottom: 12px;
    font-weight: 800;
    color: var(--primary-blue);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.subtitle {
    color: var(--neutral-gray);
    font-size: 1.125em;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Info Section */
.info-section {
    margin-bottom: 32px;
}

.info-box {
    background: linear-gradient(135deg, var(--light-yellow) 0%, #fffef8 100%);
    border: 2px solid var(--primary-yellow);
    border-radius: 16px;
    padding: 48px 32px;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
}

.info-content svg {
    color: var(--primary-yellow);
    margin-bottom: 20px;
    animation: pulse-soft 2s ease-in-out infinite;
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.info-content h2 {
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-size: 1.5em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.info-content p {
    color: var(--neutral-gray);
    margin: 4px 0;
    font-size: 1em;
    font-weight: 500;
}

.file-info {
    font-size: 0.875em;
    color: var(--neutral-gray);
    margin-top: 8px;
    font-weight: 500;
}

/* Tabs com hierarquia visual clara */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--white);
    padding: 6px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-gray);
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--neutral-gray);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9375em;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
    position: relative;
}

.tab-btn:hover {
    background: var(--light-gray);
    color: var(--primary-blue);
}

.tab-btn.active {
    background: var(--secondary-blue);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

/* Content Section */
.content-section {
    background: #fffef8;
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    border: 1px solid var(--border-gray);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

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

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--light-gray);
}

.section-header h2 {
    font-size: 1.75em;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Botão de exportar com destaque amarelo */
.btn-export {
    background: linear-gradient(135deg, var(--primary-yellow), var(--secondary-yellow));
    color: var(--primary-blue);
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9375em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--accent-gold), var(--primary-yellow));
}

.btn-export:active {
    transform: translateY(0);
}

/* Table com design profissional */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-gray);
    transition: all 0.3s ease;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fffef8;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--accent-gold);
}

thead th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    user-select: none;
    border: none;
}

thead th.sortable {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding-right: 36px;
}

thead th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

thead th.sortable .sort-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1em;
    opacity: 0.6;
    transition: all 0.2s ease;
}

thead th.sortable:hover .sort-icon {
    opacity: 1;
    transform: translateY(-50%) scale(1.15);
}

thead th.sortable.sort-asc,
thead th.sortable.sort-desc {
    background: rgba(255, 255, 255, 0.15);
}

thead th.sortable.sort-asc .sort-icon,
thead th.sortable.sort-desc .sort-icon {
    opacity: 1;
    font-weight: bold;
}

thead th:first-child {
    border-radius: 12px 0 0 0;
}

thead th:last-child {
    border-radius: 0 12px 0 0;
}

/* Rows com alternância sutil */
tbody tr {
    border-bottom: 1px solid var(--border-gray);
    transition: background 0.2s ease, transform 0.2s ease;
}

tbody tr:nth-child(even) {
    background: #f9fafb;
}

tbody tr:hover {
    background: var(--light-blue);
}

tbody tr.footer-row:hover {
    background: linear-gradient(135deg, var(--light-yellow), rgba(254, 249, 231, 0.5)) !important;
}

/* Sobrescrever hover para linhas editáveis */
tbody tr.editable-row:hover {
    background: linear-gradient(90deg, #fff9e6 0%, #fffef8 100%) !important;
}

tbody td {
    padding: 16px 20px;
    color: var(--dark-gray);
    font-weight: 500;
    font-size: 0.9375em;
    position: relative;
}

tbody td strong {
    color: var(--primary-yellow);
    font-weight: 700;
    font-size: 1.125em;
}

.qtd-estoque {
    text-align: center;
    font-weight: 600;
    color: var(--dark-gray);
    background: var(--light-gray);
    border-left: 2px solid var(--border-gray);
    border-right: 2px solid var(--border-gray);
}

.empty-message {
    text-align: center;
    color: var(--neutral-gray);
    font-style: italic;
    padding: 64px 20px !important;
    font-size: 1.0625em;
    font-weight: 500;
}

/* Footer Row com destaque */
.footer-row {
    background: linear-gradient(135deg, var(--light-yellow), rgba(254, 249, 231, 0.5)) !important;
    border-top: 3px solid var(--primary-yellow) !important;
    border-bottom: none !important;
}

.footer-info {
    padding: 18px 20px !important;
    font-size: 0.9375em;
    font-weight: 600;
    color: var(--primary-blue);
    text-align: center;
    background: transparent !important;
}

.footer-info strong {
    color: var(--primary-yellow);
    font-weight: 700;
    font-size: 1.0625em;
}

/* Status Badges com cores distintas */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.status-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.status-badge.critico {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-color: var(--danger-red);
}

.status-badge.suficiente {
    background: var(--success-light);
    color: var(--success-dark);
    border-color: var(--success-green);
}

.status-badge.vazio {
    background: #F1F5F9;
    color: #475569;
    border-color: #94A3B8;
}

.status-badge.negativo {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-color: var(--danger-red);
    font-weight: 800;
}

/* Category Tag */
.category-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.category-tag:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.stat-card {
    background: #fffef8;
    padding: 28px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-gray);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-yellow), var(--accent-gold));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-blue);
}

.stat-value {
    font-size: 2.75em;
    font-weight: 800;
    color: var(--primary-yellow);
    margin-bottom: 8px;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-label {
    color: var(--neutral-gray);
    font-size: 0.9375em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsivo */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    header {
        padding: 32px 24px;
    }

    header h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .upload-box {
        padding: 48px 24px;
    }

    .upload-content h2 {
        font-size: 1.25em;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 16px;
    }

    .section-header h2 {
        font-size: 1.5em;
    }

    .btn-export {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }

    .content-section {
        padding: 24px;
    }

    table {
        font-size: 0.875em;
    }

    thead th,
    tbody td {
        padding: 12px 12px;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .stat-card {
        padding: 24px 16px;
    }

    .stat-value {
        font-size: 2.25em;
    }

    .footer-info {
        font-size: 0.8125em;
    }
}

/* Estilos para página de análise */
.section-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 8px;
    text-align: center;
}

.section-subtitle {
    color: var(--neutral-gray);
    font-size: 1em;
    font-weight: 500;
    text-align: center;
    margin-bottom: 32px;
}

.estoques-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.estoque-upload-box {
    background: var(--white);
    border: 2px dashed var(--border-gray);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.estoque-upload-box:hover {
    border-color: var(--accent-blue);
    background: var(--light-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.estoque-upload-box.has-file {
    border-color: var(--success-green);
    background: var(--success-light);
    border-style: solid;
}

.estoque-upload-box.has-file:hover {
    border-color: var(--success-dark);
}

.estoque-upload-box input[type="file"] {
    display: none;
}

.estoque-upload-box svg {
    color: var(--accent-blue);
    margin-bottom: 16px;
    transition: transform 0.3s ease, color 0.3s ease;
    width: 48px;
    height: 48px;
}

.estoque-upload-box:hover svg {
    transform: translateY(-4px) scale(1.05);
    color: var(--secondary-blue);
}

.estoque-upload-box.has-file svg {
    color: var(--success-green);
}

.estoque-upload-box h3 {
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-size: 1.125em;
    font-weight: 600;
}

.estoque-upload-box p {
    color: var(--neutral-gray);
    font-size: 0.875em;
    font-weight: 500;
    margin: 4px 0;
}

.estoque-file-name {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fffef8;
    border-radius: 8px;
    color: var(--success-dark);
    font-size: 0.8125em;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compare-section {
    text-align: center;
    margin-bottom: 32px;
}

.btn-compare {
    background: linear-gradient(135deg, var(--primary-yellow), var(--accent-gold));
    color: var(--primary-blue);
    border: none;
    padding: 16px 48px;
    border-radius: 12px;
    font-size: 1.125em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    letter-spacing: -0.01em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-compare:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, var(--accent-gold), var(--secondary-yellow));
}

.btn-compare:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn-compare:disabled {
    background: var(--light-gray);
    color: var(--neutral-gray);
    cursor: not-allowed;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 480px) {
    .stats-section {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
        gap: 6px;
    }

    .tab-btn {
        width: 100%;
    }

    header h1 {
        font-size: 1.75em;
    }

    table {
        font-size: 0.8125em;
    }

    thead th,
    tbody td {
        padding: 10px 8px;
    }

    .page-switcher {
        flex-direction: column;
        width: 100%;
    }

    .page-switch-btn {
        width: 100%;
    }

    .estoques-container {
        grid-template-columns: 1fr;
    }
}

/* ===== BOTÃO DE EDIÇÃO (FIXO NO HEADER) ===== */
.btn-edit {
    background: linear-gradient(135deg, var(--primary-yellow), var(--accent-gold));
    color: var(--primary-blue);
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-edit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-edit:hover::before {
    width: 300px;
    height: 300px;
}

.btn-edit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(243, 156, 18, 0.5);
}

.btn-edit.active {
    background: linear-gradient(135deg, var(--danger-red), var(--danger-dark));
    color: white;
    animation: pulse-edit 1.5s infinite;
}

@keyframes pulse-edit {
    0%, 100% { box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6); }
}

.btn-edit i {
    font-size: 18px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Banner de Modo Edição */
.edit-mode-banner {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border: 2px solid var(--primary-yellow);
    border-radius: 10px;
    padding: 14px 20px;
    margin: 16px 0 20px 0;
    display: none;
    animation: slideDown 0.3s ease;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.15);
}

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

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.5;
}

.banner-content i {
    font-size: 22px;
    color: var(--primary-yellow);
    flex-shrink: 0;
}

/* ===== LINHAS EDITÁVEIS ===== */
.editable-row {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent !important;
    cursor: pointer !important;
}

.editable-row::before {
    content: '✏️';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    opacity: 0;
    transition: all 0.3s ease;
}

.editable-row:hover::before {
    opacity: 1;
    left: 10px;
}

.editable-row:hover {
    background: linear-gradient(90deg, var(--light-yellow) 0%, #fffef8 100%) !important;
    transform: translateX(8px) scale(1.02);
    box-shadow: -5px 0 0 var(--primary-yellow), 0 6px 20px rgba(243, 156, 18, 0.4);
    border-left: 5px solid var(--primary-yellow) !important;
}

.editable-row:active {
    transform: translateX(3px) scale(0.99);
    transition: all 0.1s ease;
}

.editable-row td:first-child {
    padding-left: 40px !important;
    position: relative;
}

/* Efeito de "clique aqui" */
body.edit-mode-active .editable-row:hover td:last-child::after {
    content: '← Clique para editar';
    position: absolute;
    right: -150px;
    background: var(--primary-yellow);
    color: var(--primary-blue);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 700;
    white-space: nowrap;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        right: -180px;
    }
    to {
        opacity: 1;
        right: -150px;
    }
}

.edit-icon {
    color: var(--primary-yellow);
    font-size: 1em;
    margin-left: 10px;
    animation: bounce-icon 2s infinite;
}

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

/* Indicador visual no modo edição */
body.edit-mode-active .editable-row {
    border-left: 3px solid rgba(243, 156, 18, 0.3) !important;
    background: rgba(255, 250, 240, 0.5) !important;
}

body.edit-mode-active #geralTable,
body.edit-mode-active #pedidosTable,
body.edit-mode-active #estoqueTable,
body.edit-mode-active #vaziosTable {
    border: 3px dashed var(--primary-yellow);
    border-radius: 12px;
    box-shadow: 0 0 0 4px rgba(243, 156, 18, 0.1);
}

/* Cursor especial no modo edição */
body.edit-mode-active .editable-row {
    cursor: pointer !important;
}

body.edit-mode-active .editable-row td:first-child::before {
    content: '👉';
    position: absolute;
    left: 15px;
    opacity: 0;
    transition: all 0.3s ease;
}

body.edit-mode-active .editable-row:hover td:first-child::before {
    opacity: 1;
    left: 8px;
}

/* ===== MODAL DE EDIÇÃO ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 35, 50, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: #fffef8;
    border-radius: 20px;
    padding: 36px;
    max-width: 550px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 3px solid var(--primary-yellow);
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-yellow), var(--accent-gold), var(--primary-yellow));
    border-radius: 20px 20px 0 0;
}

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

.modal-content h3 {
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-content h3 + p {
    color: var(--neutral-gray);
    font-size: 0.9em;
    margin-bottom: 24px;
    padding: 12px;
    background: var(--light-yellow);
    border-radius: 8px;
    border-left: 4px solid var(--primary-yellow);
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    color: var(--primary-yellow);
    font-size: 1.1em;
}

.form-group input {
    padding: 14px 18px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    font-size: 1.05em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fffef8;
}

.form-group input:hover {
    border-color: var(--primary-yellow);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-yellow);
    box-shadow: 0 0 0 4px rgba(243, 156, 18, 0.15);
    background: white;
    transform: scale(1.01);
}

.form-group.readonly {
    background: linear-gradient(135deg, var(--light-yellow) 0%, var(--light-gray) 100%);
    padding: 14px 18px;
    border-radius: 8px;
    border: 2px solid var(--primary-yellow);
}

.form-group.readonly label {
    color: var(--neutral-gray);
    font-size: 0.85em;
    margin-bottom: 6px;
}

.readonly-value {
    font-weight: 800;
    color: var(--primary-yellow);
    font-size: 1.4em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.error-message {
    background: var(--danger-light);
    color: var(--danger-dark);
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 0.95em;
    border: 2px solid var(--danger-red);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.error-message::before {
    content: '⚠️';
    font-size: 1.3em;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-save {
    flex: 1;
    background: linear-gradient(135deg, var(--success-green), var(--success-dark));
    color: white;
    font-weight: 700;
    position: relative;
    overflow: hidden;
}

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

.btn-save:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.5);
}

.btn-save:active:not(:disabled) {
    transform: translateY(0);
}

.btn-cancel {
    flex: 1;
    background: var(--light-gray);
    color: var(--dark-gray);
    font-weight: 600;
}

.btn-cancel:hover {
    background: var(--border-gray);
    transform: translateY(-2px);
}

/* ===== TOAST DE NOTIFICAÇÃO ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-blue);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background: linear-gradient(135deg, var(--success-green), var(--success-dark));
}

.toast-error {
    background: linear-gradient(135deg, var(--danger-red), var(--danger-dark));
}

.toast-info {
    background: linear-gradient(135deg, var(--primary-yellow), var(--accent-gold));
    color: var(--primary-blue);
    font-weight: 600;
}

.toast-warning {
    background: linear-gradient(135deg, #ff9800, #ff5722);
    color: white;
    font-weight: 600;
}

/* ===== MELHORIAS DE ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {
    .editable-row,
    .btn-edit,
    .modal-content,
    .toast,
    .banner-content i {
        animation: none !important;
        transition: none !important;
    }
}

/* ===== AJUSTES FINAIS ===== */
.section-header .header-actions {
    flex-shrink: 0;
}

/* Garantir que ícones de edição não quebrem layout */
.edit-icon {
    display: inline-block;
    vertical-align: middle;
}

/* Ajustar espaçamento da primeira coluna no modo edição */
body.edit-mode-active tbody td:first-child {
    padding-left: 24px;
}

/* Remover overflow visual */
body.edit-mode-active .table-container {
    overflow: visible;
}

/* Melhorar contraste dos badges */
.status-badge {
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ===== FILTRO DE CATEGORIA ===== */
.filter-section {
    margin: 0 0 20px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fff9e6 0%, #fffef8 100%);
    border-radius: 10px;
    border: 2px solid var(--border-gray);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group label {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label i {
    color: var(--primary-yellow);
    font-size: 1.1em;
}

.category-filter {
    padding: 10px 16px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    color: var(--primary-blue);
    background: #fffef8;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 250px;
}

.category-filter:hover {
    border-color: var(--primary-yellow);
}

.category-filter:focus {
    outline: none;
    border-color: var(--primary-yellow);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

@media (max-width: 768px) {
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-filter {
        width: 100%;
        min-width: auto;
    }
}
