* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --ink: #000f34;
    --ink2: #3d4451;
    --ink3: #717990;
    --line: #e4e7ee;
    --line2: #f0f2f7;
    --surface: #ffffff;
    --bg: #f5f6fa;
    --accent: #2d6be4;
    --accent-light: rgba(45, 107, 228, .1);
    --green: #0fa85a;
    --green-light: rgba(15, 168, 90, .1);
    --amber: #e08c00;
    --amber-light: rgba(224, 140, 0, .1);
    --red: #e03a2f;
    --red-light: rgba(224, 58, 47, .1);
    --yellow: #ffe600;
    --sidebar: 260px;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(17, 19, 24, .07);
    --shadow-lg: 0 8px 32px rgba(17, 19, 24, .12);
    --shadow-sm: 0 1px 4px rgba(17, 19, 24, .06);
    --t: .18s cubic-bezier(.4, 0, .2, 1);
}

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

/* ── PAINEL DE STATUS CANAIS (canto inferior esquerdo) ── */
.mini-status {
    background: white;
    border: 1px solid var(--line);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.btn-sync-manual {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-sync-manual:hover {
    transform: scale(1.05);
    background: #1a52c5;
}

/* ── CARD SELECIONADO ── */
.pedido-card {
    position: relative;
    transition: all 0.2s ease;
}

.pedido-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(45, 107, 228, 0.15);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.pedido-card.selecionado::after {
    opacity: 1;
}

/* ── LUCIDE ICONS ── */
.lucide {
    vertical-align: middle;
    stroke-width: 2;
}

.icon-xs {
    width: 14px;
    height: 14px;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-md {
    width: 20px;
    height: 20px;
}

.icon-lg {
    width: 32px;
    height: 32px;
    stroke-width: 1.5;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1.2s linear infinite;
}

/* ── LAYOUT ── */
.app {
    display: grid;
    grid-template-columns: var(--sidebar) 1fr;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    background: var(--ink);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-logo .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: var(--yellow);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: var(--ink);
    flex-shrink: 0;
}

.logo-name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: white;
}

.logo-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, .4);
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-group {
    margin-bottom: 24px;
}

.nav-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: rgba(255, 255, 255, .3);
    padding: 0 12px;
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, .6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--t);
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .07);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, .12);
    color: white;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.sidebar-bottom {
    padding: 16px 12px 60px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sync-btn {
    width: 100%;
    padding: 11px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
    font-family: 'Montserrat', sans-serif;
}

.sync-btn:hover {
    background: rgba(255, 255, 255, .12);
    color: white;
}

.sync-status {
    font-size: 11px;
    color: rgba(255, 255, 255, .35);
    text-align: center;
    margin-top: 8px;
}

/* ── MAIN & TOPBAR ── */
.main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: scroll;
    background: var(--bg);
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 10px 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left h1 {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

.topbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ── FILTROS & BOTÕES ── */
.filters-row {
    padding: 16px 32px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

select.flt,
input.flt {
    height: 36px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 7px;
    font-size: 13px;
    background: white;
    color: var(--ink);
    cursor: pointer;
    transition: var(--t);
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
}

select.flt:focus,
input.flt:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.flt-spacer {
    flex: 1;
}

.btn {
    height: 36px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--t);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Montserrat', sans-serif;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2259c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 107, 228, .3);
}

.btn-secondary {
    background: var(--line2);
    color: var(--ink2);
    border-color: var(--line);
}

.btn-secondary:hover {
    background: var(--line);
}

.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
}

.btn-icon {
    height: 30px;
    width: 30px;
    padding: 0;
    justify-content: center;
    background: var(--line2);
    color: var(--ink2);
    border-color: var(--line);
}

.btn-icon:hover {
    background: var(--line);
}

/* ── STATS ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 0 32px 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 24px;
    transition: var(--t);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    color: var(--ink3);
    margin-bottom: 10px;
}

.stat-val {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
}

.stat-sub {
    font-size: 12px;
    color: var(--ink3);
    margin-top: 8px;
}

.stat-card.s-blue .stat-val { color: var(--accent); }
.stat-card.s-green .stat-val { color: var(--green); }
.stat-card.s-amber .stat-val { color: var(--amber); }
.stat-card.s-red .stat-val { color: var(--red); }

/* ── TABELA & CARDS DE PEDIDO ── */
.table-wrap {
    flex: 1;
    margin: 0 32px 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table-head-bar {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.table-head-bar h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pedido-card {
    display: flex;
    align-items: center;
    padding: 18px 24px;
    background: white;
    border-bottom: 1px solid var(--line2);
    border-left: 10px solid transparent;
    border-radius: 12px;
    margin: 8px;
    gap: 20px;
    transition: background 0.2s;
    min-height: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.pedido-card:hover {
    background: #eeeeee67;
}

.pedido-card:last-child {
    border-bottom: none;
}

/* Checkbox */
.card-chk {
    flex-shrink: 0;
}

.card-chk input[type=checkbox] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Thumbnail */
.card-thumb {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    background: var(--line2);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumb:hover .card-thumb-ov {
    opacity: 1;
}

.card-thumb-ov {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--t);
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-align: center;
}

/* Info principal */
.card-info-main {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.card-cliente-nome {
    font-size: 18px;
    font-weight: 800;
    color: var(--ink);
    margin: 0;
}

.card-cliente-end {
    font-size: 14px;
    color: var(--ink3);
    margin: 0;
    line-height: 1.4;
}

.card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* Data Limite */
.card-deadline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    margin-top: 4px;
    width: fit-content;
}

.dl-ok {
    background: var(--line2);
    color: var(--ink3);
}

.dl-urgente {
    background: var(--amber-light);
    color: var(--amber);
}

.dl-atrasado {
    background: var(--red-light);
    color: var(--red);
}

/* Info produto */
.card-info-produto {
    flex: 2;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-end;
    min-width: 250px;
}

.card-produto-nome {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
    line-height: 1.4;
    white-space: normal;
    text-align: right;
}

.card-status-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ── BADGE DE STATUS (canto inferior fixo) ── */
.status-badge {
    background: #fff;
    padding: 6px 12px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--line);
    transition: all 0.3s ease;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    transition: background 0.3s ease;
}

/* ── STATUS INDICATOR (bolinha no card) ── */
.status-indicator {
    padding: 5px 10px;
    border-radius: 30px;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
}

.status-indicator .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.4);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* ── KEBAB MENU ── */
.kebab-wrap {
    position: relative;
}

.kebab-btn {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--ink3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--t);
}

.kebab-btn:hover {
    background: var(--line2);
    color: var(--ink);
}

.kebab-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: white;
    border: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 6px 0;
    z-index: 200;
    min-width: 200px;
    display: none;
    flex-direction: column;
    transform-origin: top right;
    animation: menuFade 0.15s ease;
}

.kebab-menu.show {
    display: flex;
}

@keyframes menuFade {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.kebab-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: var(--t);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.kebab-item:hover {
    background: #f5f6fa;
    color: var(--accent);
}

.kebab-item:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.kebab-item:disabled:hover {
    background: transparent;
    color: var(--ink);
}

/* ── BADGES DE CANAIS ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-canal-mercadolivre { background: #ffe225; color: #333; }
.badge-canal-shopee { background: #ee4d2d; color: #fff; }
.badge-canal-whatsapp { background: #25D366; color: #fff; }
.badge-canal-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
}
.badge-canal-site { background: #004aff; color: rgb(255, 242, 0); }
.badge-canal-outro { background: var(--line2); color: var(--ink3); }
.badge-img-ok { background: var(--green-light); color: var(--green); }
.badge-img-nao { background: var(--amber-light); color: var(--amber); }

/* ── FORMULÁRIO MANUAL ── */
.form-panel {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    margin: 40px auto;
}

.form-panel-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
}

.form-panel-header h3 {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

.form-section-title {
    font-weight: 700;
    color: #4b5563;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    margin: 24px 0 16px 0;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
    grid-column: 1 / -1;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.form-col-2 { grid-column: span 2; }
.form-col-3 { grid-column: span 3; }

.form-group { display: flex; flex-direction: column; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Montserrat', sans-serif;
    color: var(--ink);
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background: #f9fafb;
    transition: var(--t);
    color: var(--ink3);
    font-size: 14px;
    font-weight: 500;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: #eff6ff;
    color: var(--accent);
}

.upload-preview {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.form-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ── MODAIS ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 19, 24, .7);
    z-index: 500;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: white;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 580px;
    max-height: 92vh;
    overflow-y: auto;
    animation: modalIn .22s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.94); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    font-family: 'Syne', sans-serif;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--line2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--t);
}

.modal-close:hover {
    background: var(--line);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-upload-zone {
    border: 2px dashed var(--line);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--t);
}

.modal-upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.modal-upload-zone input {
    display: none;
}

.modal-sm {
    max-width: 420px;
}

.color-picker-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.color-opt {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--t);
}

.color-opt.sel {
    border-color: var(--ink);
    transform: scale(1.1);
}

/* ── ESTADOS ── */
.state-box {
    text-align: center;
    padding: 80px 40px;
    color: var(--ink3);
}

.state-box h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink2);
    margin-bottom: 6px;
}

.state-box p {
    font-size: 13px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 16px;
}

/* ── CONFIGURAÇÕES ── */
.config-panel {
    margin: 0 auto;
    max-width: 800px;
    padding: 40px 32px;
}

.config-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.config-section-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.config-section-header h3 {
    font-size: 15px;
    font-weight: 600;
    font-family: 'Syne', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-list {
    padding: 4px 0;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line2);
    transition: var(--t);
}

.config-item:last-child {
    border-bottom: none;
}

.config-item:hover {
    background: var(--bg);
}

.ci-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ci-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.ci-keywords {
    font-size: 11px;
    color: var(--ink3);
    font-family: monospace;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ci-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── PAGE CONTENT WRAPPER ── */
.page-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 24px;
}

/* ── RESPONSIVO ── */
@media(max-width:1100px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width:900px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .filters-row,
    .stats-row,
    .table-wrap,
    .form-panel,
    .config-panel {
        margin-left: 16px;
        margin-right: 16px;
        padding-left: 0;
        padding-right: 0;
        margin-top: 24px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-col-2,
    .form-col-3 {
        grid-column: span 1;
    }

    .pedido-card {
        flex-wrap: wrap;
        border-left-width: 6px;
    }

    .card-info-produto {
        text-align: left;
        align-items: flex-start;
        width: 100%;
    }

    .card-produto-nome {
        text-align: left;
    }

    .card-status-row {
        justify-content: flex-start;
    }
}