:root {
    --primary: #EA580C;
    --primary-dark: #C2410C;
    --primary-light: #FFF7ED;
    --primary-lighter: #FFEDD5;
    --secondary: #FCD34D;
    --secondary-dark: #F59E0B;
    --white: #FFFFFF;
    --black: #1F2937;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--black);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--black);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-block {
    display: block;
    width: 100%;
}

.landing-header {
    background: var(--white);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.landing-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.logo span {
    color: var(--black);
}

.nav-links a {
    margin-left: 20px;
    text-decoration: none;
    color: var(--black);
    font-weight: 500;
}

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 180px 0 100px;
    text-align: center;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.hero .subtitle {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.hero .price {
    font-size: 56px;
    font-weight: 700;
    color: var(--secondary);
    margin: 30px 0;
}

.hero .price span {
    font-size: 20px;
    opacity: 0.8;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 40px;
}

.features {
    padding: 80px 0;
    background: var(--gray-100);
}

.features h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 50px;
    color: var(--black);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.feature-card .icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--primary);
}

.cta {
    background: var(--secondary);
    padding: 60px 0;
    text-align: center;
}

.cta h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: var(--black);
}

.landing-footer {
    background: var(--black);
    color: var(--white);
    padding: 40px 0;
    text-align: center;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.auth-box {
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px;
}

.auth-box h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    font-size: 15px;
    background: #EAECEF;
    color: var(--black);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    background: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.form-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 5px;
    line-height: 1.4;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #FEE2E2;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-success {
    background: #D1FAE5;
    color: var(--success);
    border: 1px solid var(--success);
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 32px;
    }
    
    .hero .price {
        font-size: 40px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        display: none;
    }
}

/* Correção limpa: produtos sem quebrar colunas e sem cortar ações */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.main-content,
.content,
.page-content,
.dashboard-content {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.card,
.table-card,
.content-card {
    max-width: 100%;
    min-width: 0;
    overflow: visible !important;
}

.card:has(table),
.table-responsive,
.table-container {
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

/* Não transformar table em block. Isso quebra as colunas. */
table {
    border-collapse: collapse;
    width: 100%;
}

/* Só no desktop: dá largura mínima para caber as ações */
@media (min-width: 900px) {
    .card:has(table) table,
    .table-responsive table,
    .table-container table {
        min-width: 1220px;
    }

    table th,
    table td {
        padding: 9px 10px;
        font-size: 0.9rem;
        vertical-align: middle;
    }

    table th:last-child,
    table td:last-child {
        min-width: 280px;
        width: 280px;
        white-space: nowrap;
    }

    table td:last-child .btn,
    table td:last-child button,
    table td:last-child a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 6px;
        white-space: nowrap;
    }
}

.page-header,
.content-header,
.card-header {
    overflow: visible !important;
}

/* Produtos: manter tabela rolável sem fixar a última coluna */
body:has(a[href="/produtos"].active) .card:has(table) {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

body:has(a[href="/produtos"].active) table {
    width: max-content !important;
    min-width: 1180px !important;
}

/* Ações antigas não devem virar coluna fixa; na tela atual os botões ficam no topo. */
body:has(a[href="/produtos"].active) table th:last-child,
body:has(a[href="/produtos"].active) table td:last-child {
    position: static !important;
    right: auto !important;
    left: auto !important;
    z-index: auto !important;
    background: inherit !important;
    min-width: auto !important;
    width: auto !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

/* LUMI_PRODUTOS_DESFIXAR_VALOR_LOJISTA_V7
   Remove coluna fixa antiga da tela de produtos.
   O Valor Lojista era a última coluna e herdava position: sticky/right:0 de style.css.
*/
body:has(a[href="/produtos"].active) table th:last-child,
body:has(a[href="/produtos"].active) table td:last-child,
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table th:last-child,
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table td:last-child,
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table th[data-lumi-col-key="valor_lojista"],
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table td[data-lumi-col-key="valor_lojista"],
body .produtos-page .lumi-produtos-grid-table th:last-child,
body .produtos-page .lumi-produtos-grid-table td:last-child,
body .produtos-page .lumi-produtos-grid-table th[data-lumi-col-key="valor_lojista"],
body .produtos-page .lumi-produtos-grid-table td[data-lumi-col-key="valor_lojista"]{
    position:static !important;
    inset:auto !important;
    left:auto !important;
    right:auto !important;
    top:auto !important;
    bottom:auto !important;
    z-index:auto !important;
    min-width:120px !important;
    width:auto !important;
    max-width:none !important;
    white-space:nowrap !important;
    box-shadow:none !important;
    transform:none !important;
}

/* Mantém só o cabeçalho superior sticky, não coluna lateral. */
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table thead th{
    position:sticky !important;
    top:0 !important;
    right:auto !important;
    left:auto !important;
}

/* Última coluna no cabeçalho também não pode colar na direita. */
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table thead th:last-child,
body .produtos-page .lumi-produtos-grid-table thead th:last-child{
    position:sticky !important;
    top:0 !important;
    right:auto !important;
    left:auto !important;
    z-index:4 !important;
    box-shadow:0 1px 0 #E2E8F0 !important;
}

/* Se alguma regra antiga deixou largura de 260px, derruba só nos dados da tabela nova. */
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table td:last-child,
body .produtos-page .lumi-produtos-grid-table td:last-child{
    min-width:120px !important;
    width:auto !important;
    background:inherit !important;
}

/* LUMI_PRODUTOS_VALOR_LOJISTA_SOBREPOSTO_V8
   Corrige o preço do Valor Lojista entrando visualmente no cabeçalho.
   A causa é conflito de sticky/z-index/altura na última coluna antiga.
*/
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table{
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

body:has(a[href="/produtos"].active) .lumi-produtos-grid-table thead,
body .produtos-page .lumi-produtos-grid-table thead{
    position: relative !important;
    z-index: 50 !important;
}

body:has(a[href="/produtos"].active) .lumi-produtos-grid-table thead th,
body .produtos-page .lumi-produtos-grid-table thead th{
    position: sticky !important;
    top: 0 !important;
    z-index: 60 !important;
    background: #F8FAFC !important;
    overflow: hidden !important;
    vertical-align: middle !important;
    line-height: 1.25 !important;
    min-height: 42px !important;
    height: 42px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    box-shadow: inset 0 -1px 0 #E2E8F0 !important;
}

/* Último cabeçalho continua só fixo no topo, nunca fixo na direita. */
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table thead th:last-child,
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table thead th[data-lumi-col-key="valor_lojista"],
body .produtos-page .lumi-produtos-grid-table thead th:last-child,
body .produtos-page .lumi-produtos-grid-table thead th[data-lumi-col-key="valor_lojista"]{
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 70 !important;
    background: #F8FAFC !important;
    min-width: 130px !important;
    width: auto !important;
    max-width: none !important;
}

/* Dado do Valor Lojista: célula normal, sem top/right/sticky, sem invadir cabeçalho. */
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table tbody td:last-child,
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table tbody td[data-lumi-col-key="valor_lojista"],
body .produtos-page .lumi-produtos-grid-table tbody td:last-child,
body .produtos-page .lumi-produtos-grid-table tbody td[data-lumi-col-key="valor_lojista"]{
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto !important;
    z-index: 1 !important;
    transform: none !important;
    background: inherit !important;
    overflow: hidden !important;
    vertical-align: middle !important;
    line-height: 1.25 !important;
    min-height: 42px !important;
    height: 42px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    min-width: 130px !important;
    width: auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

/* Garante que nenhuma linha suba por cima do cabeçalho sticky. */
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table tbody,
body .produtos-page .lumi-produtos-grid-table tbody{
    position: relative !important;
    z-index: 1 !important;
}

body:has(a[href="/produtos"].active) .lumi-produtos-grid-table tbody tr,
body .produtos-page .lumi-produtos-grid-table tbody tr{
    position: relative !important;
    z-index: 1 !important;
}

/* Se o produto zerado/negativo ficou vermelho, mantém vermelho só dentro da linha, não acima do cabeçalho. */
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table tbody tr.lumi-produto-negativo td,
body:has(a[href="/produtos"].active) .lumi-produtos-grid-table tbody tr.lumi-produto-estoque-zero td,
body .produtos-page .lumi-produtos-grid-table tbody tr.lumi-produto-negativo td,
body .produtos-page .lumi-produtos-grid-table tbody tr.lumi-produto-estoque-zero td{
    z-index: 1 !important;
}
