:root {
    --primary: #19253f;
    --accent-light: #eef1ff;
    --bg: #F0F0F0;
    --card-bg: #fff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}



/* TOPBAR */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #f0fdf4;
    display: grid;
    place-items: center;
    font-size: 17px;
}

.page-title {
    font-size: 16px;
    font-weight: 800;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* SELECTORS */
.sel-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 5px 11px;
}

.sel-group label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.sel-group select {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    outline: none;
}

.sel-group .material-symbols-rounded {
    font-size: 15px;
    color: var(--text-muted);
}

/* BTN */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: #243460;
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

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

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-outline-pink {
    border-color: #fbb6ce;
    color: #db2777;
    background: #fff0f5;
}

.btn-outline-pink:hover {
    background: #fce7f3;
}

.btn .material-symbols-rounded {
    font-size: 15px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* CONTENT */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* FILTROS AVANÇADOS */
.filtros-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 18px;
    display: none;
}

.filtros-panel.open {
    display: block;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

@media(max-width:900px) {
    .filtros-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.filt-field label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    display: block;
    margin-bottom: 5px;
}

.filt-field input,
.filt-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: #f8fafc;
    outline: none;
    transition: border-color .2s;
}

.filt-field input:focus,
.filt-field select:focus {
    border-color: #94a3b8;
}

.filt-field .input-icon {
    position: relative;
}

.filt-field .input-icon .material-symbols-rounded {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
}

.filt-field .input-icon input,
.filt-field .input-icon select {
    padding-left: 28px;
}

.filtros-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

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

/* TOOLBAR PRINCIPAL */
.main-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
}

.search-wrap input {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    padding: 7px 10px 7px 30px;
    border-radius: 8px;
    width: 220px;
    outline: none;
    transition: border-color .2s;
}

.search-wrap input:focus {
    border-color: #94a3b8;
}

.search-wrap .material-symbols-rounded {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
}

.toolbar-sel {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
}

.total-info {
    font-size: 12px;
    color: var(--text-muted);
}

.total-info strong {
    color: var(--text);
}

/* PEDIDO CARD */
.pedido-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow .2s;
}

.pedido-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, .07);
}

/* ── CARTÃO DO PEDIDO ── */
.pedido-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    /* Sombra suave igual à imagem */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* ── CABEÇALHO DO PEDIDO (Seu código atualizado) ── */
.pedido-header {
    display: flex;
    justify-content: space-between;
    /* Separa a esquerda (data/hora) da direita (loja) */
    align-items: center;
    padding: 12px 18px;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}

.pedido-header:hover {
    background: #f8fafc;
}

/* Quando expandido, mostra a linha separadora */
.pedido-card.expanded .pedido-header {
    border-bottom: 1px solid #f1f5f9;
}

/* Lado esquerdo do Header (Status, Data, Hora, Transportadora) */
.pedido-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-yellow {
    background: #facc15;
}

.dot-green {
    background: #10b981;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-info .material-symbols-rounded {
    font-size: 16px;
    color: #64748b;
}

.shipping-full {
    color: #16a34a;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.05em;
}

.shipping-full .material-symbols-rounded {
    color: #16a34a;
    font-size: 18px;
}

/* Lado direito do Header (Loja) */
.pedido-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
}

/* ── CORPO DO PEDIDO (Oculto por padrão, visível quando expandido) ── */
.pedido-body {
    display: none;
    /* Muda para block via JS quando clica no header */
    padding: 20px;
    background: #ffffff;
}

.pedido-card.expanded .pedido-body {
    display: block;
}

/* ── GRID DA TABELA DE ITENS ── */
.data-grid {
    display: grid;
    /* Define a proporção das 10 colunas da sua segunda imagem */
    grid-template-columns: minmax(250px, 3.5fr) 0.5fr 1fr 1fr 1.2fr 1fr 1.2fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: center;
}

.grid-header {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    padding-bottom: 12px;
    letter-spacing: 0.05em;
}

.grid-header span,
.item-row .grid-val {
    display: block;
    text-align: center;
}

/* Alinha a primeira coluna à esquerda */
.grid-header span:first-child,
.item-row .item-col {
    text-align: left;
}

.item-row {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.item-col {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.item-image {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.item-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-sku {
    font-size: 11px;
    color: #64748b;
}

.value-cell {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

/* Margem Badges */
.margin-badge {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    margin: 0 auto;
}

.bg-orange {
    background: #fcb07e;
}

.bg-gold {
    background: #fbbf24;
}

/* ── RODAPÉ COM A SETA (Opcional, igual à imagem) ── */
.pedido-footer {
    display: flex;
    justify-content: center;
    padding: 6px 0;
    border-top: 1px solid #f8fafc;
    cursor: pointer;
}

.pedido-footer:hover {
    background: #f1f5f9;
}

.pedido-footer .material-symbols-rounded {
    color: #22c55e;
    font-size: 20px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.concluido {
    background: var(--success);
}

.status-dot.pendente {
    background: var(--warning);
}

.status-dot.cancelado {
    background: var(--danger);
}

.status-dot.pago {
    background: var(--success);
}

.status-dot.pendente {
    background: var(--warning);
}

.status-dot.cancelado {
    background: var(--danger);
}

.status-dot.em_transito {
    background: var(--info);
}

.pedido-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    flex-wrap: wrap;
}

.pedido-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.pedido-meta-item strong {
    color: var(--text);
    font-weight: 600;
}

.pedido-meta-item .material-symbols-rounded {
    font-size: 14px;
}

.loja-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    margin-left: auto;
}

/* TABELA DE ITENS */
.pedido-body {
    border-top: 1px solid var(--border);
    padding: 0 18px 14px;
    display: none;
}

.pedido-body.open {
    display: block;
}

.items-table {
    width: calc(100% - 36px);
    border-collapse: collapse;
    margin: 14px 18px;
    font-size: 12px;
}

.items-table thead tr {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.items-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .7px;
    white-space: nowrap;
}

.items-table th.right {
    text-align: right;
}

.items-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}

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

.items-table td {
    padding: 10px 10px;
    vertical-align: middle;
}

.items-table td.right {
    text-align: right;
}

.item-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: #f8fafc;
}

.item-name {
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
    max-width: 280px;
}

.item-sku {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.margem-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.margem-badge.good {
    background: #dcfce7;
    color: #166534;
}

.margem-badge.ok {
    background: #fef9c3;
    color: #92400e;
}

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

/* DETALHE FINANCEIRO */
.pedido-detail {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

@media(max-width:800px) {
    .pedido-detail {
        grid-template-columns: 1fr;
    }
}

.detail-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 16px 14px;
    min-height: 74px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.info-box-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}

.info-box-value {
    font-size: 13px;
    font-weight: 600;
}

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

.info-id {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.info-id span {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.info-id strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}

/* BREAKDOWN FINANCEIRO */
.breakdown {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 16px;
}

.breakdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
}

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

.breakdown-row.total-row {
    padding-top: 12px;
    margin-top: 4px;
    border-top: 2px solid var(--border);
    border-bottom: none;
    font-size: 13px;
}

.breakdown-row.total-row .label {
    color: var(--text);
    font-weight: 700;
}

.breakdown-row.total-row .value {
    font-size: 15px;
}

.breakdown-row .label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.breakdown-row .label .material-symbols-rounded {
    font-size: 14px;
}

.breakdown-row .label small {
    font-size: 10px;
    color: #94a3b8;
    display: block;
}

.breakdown-row .value {
    font-weight: 700;
}

.breakdown-row .value.pos {
    color: var(--success);
}

.breakdown-row .value.neg {
    color: var(--danger);
}

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

.breakdown-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 11px;
}

/* EMPTY */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .ei {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: .4;
}

/* PAGINAÇÃO */
.pag-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.pag-btns {
    display: flex;
    gap: 4px;
}

.pag-btn {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    width: 30px;
    height: 30px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: grid;
    place-items: center;
    transition: all .15s;
    font-family: inherit;
}

.pag-btn:hover {
    border-color: #94a3b8;
}

.pag-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

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

/* SCROLL */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 600;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
    transform: translateY(60px);
    opacity: 0;
    transition: all .25s;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show {
    transform: none;
    opacity: 1;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}