:root {
    --amber: #fdb600;
    --amber-escuro: #d99c00;
    --amber-claro: rgba(253, 182, 0, .14);
    --amber-glow: rgba(253, 182, 0, .35);
    --coral: #ef8354;
    --coral-claro: rgba(239, 131, 84, .16);
    --vermelho: #9a0000;
    --vermelho-escuro: #520000;
    --vermelho-claro: rgba(154, 0, 0, .18);
    --vermelho-glow: rgba(154, 0, 0, .4);
    --verde: #34d399;
    --verde-claro: rgba(52, 211, 153, .14);
    --cinza: #bfc0c0;
    --texto: #f7f5f2;
    --texto-fraco: #8a8c8c;
    --borda: rgba(191, 192, 192, .13);
    --borda-forte: rgba(191, 192, 192, .24);
    --fundo: #150606;
    --fundo-elevado: #520000;
    --fundo-elevado-2: #6c1414;
}

* { box-sizing: border-box; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulso {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 131, 84, .55); }
    70% { box-shadow: 0 0 0 7px rgba(239, 131, 84, 0); }
}
@keyframes gradienteAndando {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

html { scrollbar-color: var(--amber-escuro) var(--fundo-elevado); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--fundo); }
::-webkit-scrollbar-thumb { background: var(--fundo-elevado-2); border-radius: 999px; border: 2px solid var(--fundo); }
::-webkit-scrollbar-thumb:hover { background: var(--amber-escuro); }

body {
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-feature-settings: 'tnum' 1;
    background:
        radial-gradient(900px 420px at 12% -10%, rgba(154, 0, 0, .22), transparent 60%),
        radial-gradient(900px 460px at 90% 0%, rgba(253, 182, 0, .10), transparent 55%),
        var(--fundo);
    background-attachment: fixed;
    color: var(--texto);
    margin: 0;
}

a { color: var(--amber); text-decoration: none; transition: color .15s ease; }
a:hover { color: #ffcc4d; text-decoration: underline; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(120deg, var(--vermelho-escuro), var(--vermelho) 45%, var(--vermelho-escuro) 100%);
    background-size: 200% 200%;
    animation: gradienteAndando 14s ease infinite;
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 8px;
    border-bottom: 3px solid var(--amber);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.topbar .left { display: flex; align-items: center; flex-wrap: wrap; row-gap: 6px; }
.topbar a.brand { display: flex; align-items: center; margin-right: 30px; transition: transform .18s ease; }
.topbar a.brand:hover { transform: scale(1.04); }
.topbar a.brand img { height: 30px; width: auto; display: block; }
.topbar a {
    position: relative;
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    margin-right: 20px;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
}
.topbar a::after {
    content: '';
    position: absolute;
    left: 0; bottom: -3px;
    height: 2px; width: 0;
    background: var(--amber);
    transition: width .2s ease;
}
.topbar a:hover { color: #fff; text-decoration: none; }
.topbar a:hover::after { width: 100%; }
.topbar .right { font-size: 13px; color: rgba(255, 255, 255, .8); }
.topbar .right a { color: var(--amber); margin: 0; }
.topbar .right a::after { display: none; }

.nav-dropdown { position: relative; display: inline-block; margin-right: 20px; }
.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: rgba(255, 255, 255, .85);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: color .15s ease;
    user-select: none;
}
.nav-dropdown:hover .nav-dropdown-trigger { color: #fff; }
.nav-caret { font-size: 10px; transition: transform .18s ease; }
.nav-dropdown:hover .nav-caret { transform: rotate(180deg); }
.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--fundo-elevado);
    border: 1px solid var(--borda);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
    z-index: 60;
}
.nav-dropdown:hover .nav-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(4px); }
.nav-dropdown-menu a {
    display: block;
    padding: 9px 12px;
    margin: 0;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, .85);
    border-bottom: none;
}
.nav-dropdown-menu a::after { display: none; }
.nav-dropdown-menu a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-dropdown-menu a.ativo { color: var(--amber); font-weight: 700; background: rgba(255, 255, 255, .06); }

.container { max-width: 1180px; margin: 24px auto; padding: 0 16px; }

.card {
    position: relative;
    background: var(--fundo-elevado);
    border: 1px solid var(--borda);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 26px rgba(0, 0, 0, .32);
    overflow: hidden;
    animation: fadeInUp .45s ease both;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--coral), var(--amber));
    opacity: .6;
}
.card:hover { border-color: var(--borda-forte); box-shadow: 0 4px 10px rgba(0, 0, 0, .3), 0 16px 34px rgba(0, 0, 0, .36); }

.card h3 { color: var(--texto); margin-top: 0; font-size: 16px; font-weight: 700; }
.card h4 { color: var(--amber); }

h2 {
    color: var(--texto);
    font-weight: 800;
    letter-spacing: -.01em;
    border-bottom: 3px solid var(--amber);
    display: inline-block;
    padding-bottom: 4px;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
    position: relative;
    background: var(--fundo-elevado);
    border: 1px solid var(--borda);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 20px rgba(0, 0, 0, .3);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    animation: fadeInUp .45s ease both;
    overflow: hidden;
}
.kpi::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--amber), var(--coral));
    opacity: .55;
    transition: opacity .16s ease;
}
.kpis .kpi:nth-child(1) { animation-delay: .02s; }
.kpis .kpi:nth-child(2) { animation-delay: .06s; }
.kpis .kpi:nth-child(3) { animation-delay: .10s; }
.kpis .kpi:nth-child(4) { animation-delay: .14s; }
.kpis .kpi:nth-child(5) { animation-delay: .18s; }
.kpis .kpi:nth-child(6) { animation-delay: .22s; }
.kpis .kpi:nth-child(7) { animation-delay: .26s; }
.kpis .kpi:nth-child(8) { animation-delay: .30s; }
.kpis .kpi:nth-child(9) { animation-delay: .34s; }
.kpi:hover {
    transform: translateY(-3px);
    border-color: var(--borda-forte);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .32), 0 0 0 1px var(--amber-glow), 0 14px 30px rgba(0, 0, 0, .32);
}
.kpi:hover::before { opacity: 1; }
.kpi.negativo::before { background: linear-gradient(90deg, #ff6b5b, var(--coral)); }
.kpi.negativo:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, .32), 0 0 0 1px var(--vermelho-glow), 0 14px 30px rgba(0, 0, 0, .32); }
.kpi.positivo::before { background: linear-gradient(90deg, var(--verde), #6ee7b7); }
.kpi.positivo:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, .32), 0 0 0 1px rgba(52, 211, 153, .35), 0 14px 30px rgba(0, 0, 0, .32); }

.kpi-icone {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--amber-claro);
    color: var(--amber);
}
.kpi-icone svg { width: 20px; height: 20px; }
.kpi-texto { flex: 1; min-width: 0; }
.kpi .label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cinza);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: 3px;
}
.kpi .valor {
    font-size: 18px;
    font-weight: 800;
    color: var(--texto);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: visible;
}
.kpi.negativo .kpi-icone { background: var(--coral-claro); color: #ff8f6b; }
.kpi.negativo .valor { color: #ff8f6b; }
.kpi.positivo .kpi-icone { background: var(--verde-claro); color: var(--verde); }
.kpi.positivo .valor { color: var(--verde); }

.painel-titulo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.painel-titulo h3 { margin: 0; }
.painel-titulo .sub { color: var(--cinza); font-size: 12px; }

.ranking-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borda); animation: fadeInUp .4s ease both; }
.ranking-item:last-child { border-bottom: none; }
.ranking-pos {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--amber-claro);
    color: var(--amber);
    font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.ranking-item:nth-child(1) .ranking-pos { background: var(--amber); color: #2a1a00; box-shadow: 0 0 0 3px var(--amber-claro); }
.ranking-info { flex: 1; min-width: 0; }
.ranking-info .nome { font-size: 13px; font-weight: 700; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-info .barra-fundo { background: var(--fundo); border-radius: 999px; height: 6px; margin-top: 6px; overflow: hidden; }
.ranking-info .barra-preenchida { background: linear-gradient(90deg, var(--amber-escuro), var(--amber)); height: 100%; border-radius: 999px; transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.ranking-valor { flex: 0 0 auto; text-align: right; font-size: 13px; font-weight: 700; color: var(--texto); }
.ranking-valor .qtd { display: block; font-size: 11px; font-weight: 400; color: var(--cinza); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--borda); text-align: left; }
th { background: rgba(253, 182, 0, .08); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cinza); }
tr { transition: background .12s ease; }
tr:hover { background: rgba(191, 192, 192, .05); }
td a { color: var(--amber); }

.pedido-id { font-family: 'JetBrains Mono', Consolas, monospace; font-weight: 700; background: var(--amber-claro); border: 1px solid rgba(253, 182, 0, .4); padding: 2px 6px; border-radius: 4px; color: var(--texto); }

.btn {
    display: inline-block;
    background: var(--amber);
    color: #241800;
    padding: 9px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    transition: filter .15s ease, transform .1s ease, box-shadow .15s ease;
    box-shadow: 0 2px 10px rgba(253, 182, 0, .2);
}
.btn:hover { filter: brightness(1.08); text-decoration: none; box-shadow: 0 4px 16px rgba(253, 182, 0, .32); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.secundario { background: transparent; color: var(--texto); border: 1px solid var(--borda-forte); box-shadow: none; }
.btn.secundario:hover { background: rgba(191, 192, 192, .08); filter: none; box-shadow: none; }
.btn.perigo { background: var(--coral); color: #2a1000; box-shadow: 0 2px 10px rgba(239, 131, 84, .3); }
.btn.perigo:hover { filter: brightness(1.08); box-shadow: 0 4px 16px rgba(239, 131, 84, .4); }

label { display: block; font-size: 13px; font-weight: 500; color: var(--cinza); margin-bottom: 4px; margin-top: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=file], select, textarea {
    width: 100%;
    padding: 9px 10px;
    background: var(--fundo-elevado-2);
    border: 1px solid var(--borda);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--texto);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--texto-fraco); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-claro); }
select option { background: var(--fundo-elevado-2); color: var(--texto); }

.form-narrow { max-width: 420px; }

.alerta { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; font-weight: 500; animation: fadeInUp .35s ease both; border: 1px solid transparent; }
.alerta.erro { background: var(--coral-claro); color: #ffab84; border-color: rgba(239, 131, 84, .35); }
.alerta.sucesso { background: var(--verde-claro); color: #7cf0c2; border-color: rgba(52, 211, 153, .35); }
.alerta.info { background: var(--amber-claro); color: #ffcf7a; border-color: rgba(253, 182, 0, .35); }
.alerta a { color: inherit; text-decoration: underline; }
.alerta.erro { position: relative; padding-left: 30px; }
.alerta.erro::before {
    content: '';
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--coral);
    animation: pulso 1.8s infinite;
}

.status-valido { color: var(--verde); font-weight: 700; }
.status-invalido { color: var(--coral); font-weight: 700; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fundo), var(--vermelho-escuro) 45%, var(--vermelho) 100%);
    background-size: 200% 200%;
    animation: gradienteAndando 16s ease infinite;
}
.login-box {
    background: var(--fundo-elevado);
    border: 1px solid var(--borda);
    border-radius: 14px;
    padding: 36px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(253, 182, 0, .1);
    text-align: center;
    animation: fadeInUp .5s ease both;
}
.login-box img.logo { height: 42px; margin-bottom: 22px; }
.login-box form { text-align: left; }

.filtros { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filtros > div { min-width: 150px; }

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

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.cinza { background: rgba(191, 192, 192, .12); color: var(--cinza); }

.produto-foto-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--borda); }
.produto-foto-placeholder { width: 44px; height: 44px; border-radius: 6px; border: 1px dashed var(--borda); display: flex; align-items: center; justify-content: center; color: var(--texto-fraco); font-size: 10px; text-align: center; }
