:root {
    --bg:          #f4f5f8;
    --surface:     #ffffff;
    --surface2:    #f0f1f5;
    --surface3:    #e8eaf0;
    --border:      #dde0ea;
    --border2:     #c8ccda;
    --accent:      #4f6fff;
    --accent2:     #3a56e8;
    --accent-dim:  rgba(79,111,255,0.09);
    --accent-glow: rgba(79,111,255,0.18);
    --red:         #e53e5e;
    --red-dim:     rgba(229,62,94,0.10);
    --blue:        #2c8af0;
    --blue-dim:    rgba(44,138,240,0.10);
    --yellow:      #d97706;
    --yellow-dim:  rgba(217,119,6,0.10);
    --green:       #16a34a;
    --green-dim:   rgba(22,163,74,0.10);
    --text:        #0f1320;
    --text2:       #5a627a;
    --text3:       #9aa0b8;
    --font:        'DM Sans', sans-serif;
    --mono:        'JetBrains Mono', monospace;
    --r:           8px;
    --r2:          5px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none; z-index: 0;
}

/* ── LAYOUT ── */
.app { display: none; min-height: 100vh; position: relative; z-index: 1; }
.app.visible { display: flex; animation: fadeIn .35s ease; }

/* ── SIDEBAR ── */
.sidebar {
    width: 220px; min-height: 100vh; background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,.05);
}

.sidebar-logo { padding: 24px 20px 20px; border-bottom: 1px solid var(--border); }

.logo-mark { display: flex; align-items: center; gap: 10px; }

.logo-icon {
    width: 34px; height: 34px; background: var(--accent);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; color: #fff; flex-shrink: 0;
}

.logo-text { font-size: 14px; font-weight: 800; line-height: 1.1; }
.logo-sub { font-size: 10px; color: var(--text2); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }

.nav-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text3); padding: 10px 10px 6px; margin-top: 8px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-radius: var(--r2); cursor: pointer; transition: all .15s;
    font-size: 13px; font-weight: 600; color: var(--text2);
    border: 1px solid transparent; user-select: none;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(108,140,255,0.2); }
.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }

.nav-badge {
    margin-left: auto; background: var(--accent); color: #fff;
    font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 20px;
}

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text3); }

/* ── MAIN ── */
.main { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    height: 56px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

.topbar-title { font-size: 14px; font-weight: 700; }
.topbar-breadcrumb { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.topbar-breadcrumb span { color: var(--text3); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
    border-radius: var(--r2); font-family: var(--font); font-size: 12px;
    font-weight: 700; cursor: pointer; transition: all .15s; border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: transparent; color: var(--text2); border-color: var(--border2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-danger { background: var(--red-dim); color: var(--red); border-color: rgba(255,77,109,0.25); }
.btn-danger:hover { background: rgba(255,77,109,0.2); }

/* ── CONTENT ── */
.content { flex: 1; padding: 28px; }

.page { display: none; animation: fadeIn .25s ease; }
.page.active { display: block; }

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

/* ── CARDS ── */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 20px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 13px; font-weight: 700; }
.card-subtitle { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.gap-16 { gap: 16px; }

/* ── STAT CARDS ── */
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 18px 20px;
    display: flex; flex-direction: column; gap: 8px;
    position: relative; overflow: hidden;
}

.stat-card::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--accent-color, var(--border));
}

.stat-card.green  { --accent-color: var(--accent); }
.stat-card.red    { --accent-color: var(--red); }
.stat-card.blue   { --accent-color: var(--blue); }
.stat-card.yellow { --accent-color: var(--yellow); }

.stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text2); }
.stat-value { font-size: 26px; font-weight: 800; font-family: var(--mono); line-height: 1; }
.stat-meta  { font-size: 11px; color: var(--text2); }

.stat-pill {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
    font-family: var(--mono);
}
.pill-green  { background: var(--green-dim);  color: var(--green);  }
.pill-red    { background: var(--red-dim);    color: var(--red);    }
.pill-blue   { background: var(--blue-dim);   color: var(--blue);   }
.pill-yellow { background: var(--yellow-dim); color: var(--yellow); }

/* ── FORM ── */
.form-group  { display: flex; flex-direction: column; gap: 6px; }
.form-label  { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }

.form-control {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--r2); padding: 9px 12px; font-family: var(--mono);
    font-size: 13px; color: var(--text); outline: none; transition: border-color .15s;
    width: 100%;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control option { background: var(--surface2); }

.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
    text-align: left; padding: 10px 14px; background: var(--surface2);
    border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2);
    white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 11px 14px; vertical-align: middle; }
tbody td.mono { font-family: var(--mono); }

/* ── MARKETPLACE RESULT CARDS ── */
.mkt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 16px; }

.mkt-card {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--r); padding: 16px; position: relative;
    transition: border-color .15s, transform .15s;
}
.mkt-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.mkt-card.positive { border-color: rgba(79,111,255,0.25); }
.mkt-card.negative { border-color: rgba(229,62,94,0.25); }

.mkt-name { font-size: 12px; font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.mkt-tipo { font-size: 9px; font-weight: 600; color: var(--text3); background: var(--surface3); padding: 2px 6px; border-radius: 4px; }
.mkt-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.mkt-row-label { font-size: 11px; color: var(--text2); }
.mkt-row-val { font-size: 12px; font-family: var(--mono); font-weight: 600; }
.mkt-divider { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

.mkt-mc {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg); border-radius: var(--r2); padding: 8px 10px; margin-top: 8px;
}
.mkt-mc-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text2); }
.mkt-mc-val   { font-size: 16px; font-family: var(--mono); font-weight: 700; }

.mkt-badge-best {
    position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff; font-size: 9px; font-weight: 800;
    padding: 2px 10px; border-radius: 20px; white-space: nowrap; letter-spacing: 0.05em;
}

/* ── TOGGLE GROUP ── */
.toggle-group { display: flex; background: var(--surface2); border-radius: var(--r2); padding: 3px; gap: 2px; }
.toggle-btn {
    padding: 6px 14px; border-radius: 5px; font-size: 12px; font-weight: 700;
    cursor: pointer; color: var(--text2); transition: all .15s; border: none; background: none;
    font-family: var(--font);
}
.toggle-btn.active { background: var(--surface3); color: var(--text); }

/* ── DIVIDER / SECTION ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title   { font-size: 16px; font-weight: 800; }
.section-sub     { font-size: 12px; color: var(--text2); margin-top: 3px; }

/* ── TAG ── */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }

/* ── INPUT PREFIX ── */
.input-prefix {
    display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r2); overflow: hidden;
}
.input-prefix span {
    background: var(--surface3); padding: 9px 10px; font-size: 12px; color: var(--text2);
    font-family: var(--mono); border-right: 1px solid var(--border); flex-shrink: 0;
    display: flex; align-items: center;
}
.input-prefix .form-control { border: none; border-radius: 0; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-icon  { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; }

/* ── TOAST ── */
#toast {
    position: fixed; bottom: 24px; right: 24px; background: var(--surface);
    border: 1px solid var(--border2); border-radius: var(--r);
    padding: 12px 18px; font-size: 13px; z-index: 9999;
    display: none; align-items: center; gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    animation: slideUp .2s ease;
}
#toast.show { display: flex; }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── HELPERS ── */
.flex             { display: flex; }
.flex-col         { display: flex; flex-direction: column; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-8            { gap: 8px; }
.gap-12           { gap: 12px; }
.gap-24           { gap: 24px; }
.mt-16            { margin-top: 16px; }
.mt-8             { margin-top: 8px; }
.mb-16            { margin-bottom: 16px; }
.w-full           { width: 100%; }

.text-accent { color: var(--accent); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-muted  { color: var(--text2); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.font-mono   { font-family: var(--mono); }
.font-bold   { font-weight: 700; }
.mono        { font-family: var(--mono); }

/* ── BAR CHART ── */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row   { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-name  { width: 160px; flex-shrink: 0; font-weight: 600; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 24px; background: var(--surface3); border-radius: 4px; overflow: hidden; position: relative; }
.bar-fill  { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-right: 8px; justify-content: flex-end; transition: width .5s cubic-bezier(.4,0,.2,1); min-width: 2px; }
.bar-val   { font-family: var(--mono); font-size: 10px; font-weight: 700; white-space: nowrap; }

/* ── TABS ── */
.tabs    { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab-btn {
    padding: 10px 18px; font-family: var(--font); font-size: 12px; font-weight: 700;
    color: var(--text2); background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* ── TOGGLE SWITCH ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 24px; transition: .25s; }
.toggle-slider:before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: var(--text3); border-radius: 50%; transition: .25s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); background: #fff; }

/* ── MODAL ── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,19,32,.35); backdrop-filter: blur(4px);
    z-index: 1000; display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface); border: 1px solid var(--border2);
    border-radius: var(--r); padding: 28px; width: 480px; max-width: 95vw;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.12);
    animation: fadeIn .2s ease;
}

.modal-title   { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.modal-sub     { font-size: 12px; color: var(--text2); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── COLUMN TOGGLES ── */
.col-toggle-btn {
    padding: 5px 12px; border-radius: var(--r2); font-family: var(--font);
    font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s;
    border: 1px solid var(--border2); background: var(--surface2); color: var(--text2);
    user-select: none;
}
.col-toggle-btn.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(108,140,255,0.25); }
.col-hidden { display: none !important; }

/* ── PV MANUAL INPUT ── */
.pv-manual-input {
    background: var(--surface3); border: 1px solid var(--border2);
    border-radius: var(--r2); padding: 5px 8px;
    font-family: var(--mono); font-size: 12px; font-weight: 600;
    color: var(--text); width: 100px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.pv-manual-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.pv-manual-input.has-value { border-color: rgba(108,140,255,0.35); color: var(--accent); background: var(--accent-dim); }
.pv-manual-input::placeholder { color: var(--text3); }

.pv-overridden { text-decoration: line-through; color: var(--red) !important; opacity: 0.7; font-weight: 400 !important; }

/* ── TABELA MULTI-MARKETPLACE ── */
.tr-produto-header td {
    background: var(--surface2); border-top: 2px solid var(--border2);
    font-weight: 800; font-size: 12px; cursor: pointer; user-select: none;
}
.tr-produto-header:hover td { background: var(--surface3); }
.tr-produto-header .sku-cell { color: var(--accent); font-family: var(--mono); }
.tr-mkt-row td { border-bottom: 1px solid var(--border); font-size: 12px; }
.tr-mkt-row td:first-child { padding-left: 28px; }
.tr-mkt-row.hidden-row { display: none; }
.mkt-name-cell { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.collapse-icon { font-size: 10px; color: var(--text3); transition: transform .2s; display: inline-block; }
.collapsed .collapse-icon { transform: rotate(-90deg); }

/* ── IMPORT ── */
.drop-zone {
    border: 2px dashed var(--border2); border-radius: var(--r);
    padding: 40px 24px; text-align: center; cursor: pointer;
    transition: all .2s; background: var(--surface2);
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.drop-zone .drop-icon  { font-size: 36px; margin-bottom: 10px; }
.drop-zone .drop-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.drop-zone .drop-sub   { font-size: 12px; color: var(--text2); }

.import-preview { overflow-x: auto; max-height: 280px; overflow-y: auto; }
.import-preview table { font-size: 12px; }
.import-preview thead th { position: sticky; top: 0; background: var(--surface2); z-index: 1; padding: 7px 12px; }
.import-preview tbody td { padding: 7px 12px; }
.row-new td:first-child::before    { content: '+ '; color: var(--accent); font-weight: 800; }
.row-update td:first-child::before { content: '↻ '; color: var(--yellow); font-weight: 800; }

.import-legend { display: flex; gap: 16px; font-size: 11px; color: var(--text2); margin-top: 10px; }
.import-legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── LOGIN ── */
#login-screen {
    position: fixed; inset: 0; z-index: 9000;
    background: var(--bg);
    display: flex; align-items: stretch;
}

.login-left {
    flex: 1; position: relative; overflow: hidden;
    background: linear-gradient(145deg, #3a56e8 0%, #4f6fff 45%, #6b8aff 100%);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 52px;
}

.login-left-bg {
    position: absolute; inset: 0;
    background:
            radial-gradient(ellipse 80% 60% at 30% 40%, rgba(255,255,255,0.08) 0%, transparent 70%),
            radial-gradient(ellipse 60% 50% at 70% 80%, rgba(255,255,255,0.05) 0%, transparent 60%);
}

.login-grid {
    position: absolute; inset: 0;
    background-image:
            linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 80% at 30% 40%, black 20%, transparent 80%);
}

.login-left-content { position: relative; z-index: 1; }

.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; }
.login-brand-icon {
    width: 48px; height: 48px; background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3); border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.login-brand-name { font-size: 20px; font-weight: 800; line-height: 1.15; color: #fff; }
.login-brand-sub  { font-size: 11px; color: rgba(255,255,255,0.65); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }

.login-tagline { font-size: 38px; font-weight: 800; line-height: 1.15; margin-bottom: 16px; letter-spacing: -0.02em; color: #fff; }
.login-tagline em { color: rgba(255,255,255,0.75); font-style: normal; }
.login-desc { font-size: 14px; color: rgba(255,255,255,0.7); line-height: 1.6; max-width: 380px; }

.login-stats { display: flex; gap: 32px; margin-top: 40px; }
.login-stat-val   { font-family: var(--mono); font-size: 22px; font-weight: 700; color: #fff; }
.login-stat-label { font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 3px; }

.login-right {
    width: 420px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 52px 48px;
}

.login-form-wrap { width: 100%; }
.login-title    { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--text2); margin-bottom: 32px; }

.login-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.login-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2); }

.login-input-wrap { position: relative; }
.login-input {
    width: 100%; background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--r2); padding: 12px 14px 12px 42px;
    font-family: var(--mono); font-size: 14px; color: var(--text);
    outline: none; transition: border-color .2s, box-shadow .2s;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.login-input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-size: 15px; pointer-events: none; color: var(--text3);
}
.login-input.error { border-color: var(--red); }
.login-input.error:focus { box-shadow: 0 0 0 3px var(--red-dim); }

.login-eye {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text3);
    font-size: 15px; padding: 2px; transition: color .15s;
}
.login-eye:hover { color: var(--text2); }

.login-error-msg {
    font-size: 11px; color: var(--red); font-weight: 600;
    display: none; margin-top: -8px; margin-bottom: 4px;
    animation: fadeIn .2s ease;
}
.login-error-msg.show { display: block; }

.login-options {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; margin-top: 4px;
}
.login-remember { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text2); cursor: pointer; user-select: none; }
.login-remember input { accent-color: var(--accent); }
.login-forgot { font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 600; }
.login-forgot:hover { text-decoration: underline; }

.login-btn {
    width: 100%; padding: 13px; background: var(--accent); color: #fff;
    border: none; border-radius: var(--r2); font-family: var(--font);
    font-size: 14px; font-weight: 800; cursor: pointer; letter-spacing: 0.02em;
    transition: background .15s, transform .1s, box-shadow .15s;
    position: relative; overflow: hidden;
}
.login-btn:hover  { background: var(--accent2); box-shadow: 0 4px 20px var(--accent-glow); }
.login-btn:active { transform: scale(0.99); }
.login-btn.loading { pointer-events: none; }
.login-btn.loading::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
    animation: shimmer .8s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.login-footer { margin-top: 32px; text-align: center; font-size: 11px; color: var(--text3); }

#login-screen.out { animation: loginOut .4s ease forwards; }
@keyframes loginOut { to { opacity: 0; transform: scale(1.02); } }

/* ── MISC ── */
.active-preset { background: var(--accent-dim) !important; color: var(--accent) !important; border-color: rgba(108,140,255,0.25) !important; }
.logo-swatch { cursor: pointer; transition: .15s; }
input[name="nm-logo"]:checked + .logo-swatch { border-color: var(--accent) !important; background: var(--accent-dim) !important; }

/* ── MENU TOGGLE (MOBILE) ── */
.menu-toggle {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--text); font-size: 20px; padding: 4px 8px; line-height: 1;
}

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(15,19,32,.30); z-index: 99;
}
.sidebar-backdrop.open { display: block; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 20px; }
    .stat-value { font-size: 22px; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; z-index: 100; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar { padding: 0 16px; }
    .menu-toggle { display: flex; align-items: center; }
    .topbar-right .btn-ghost:not(.btn-logout) { display: none; }
    .topbar-right { gap: 8px; }
    .content { padding: 14px; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .section-header > div:last-child { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
    .section-header .btn { flex: 1; justify-content: center; min-width: 120px; }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal { width: 100% !important; max-width: 100% !important; border-radius: var(--r) var(--r) 0 0 !important; max-height: 92vh; overflow-y: auto; }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }
    .form-row { grid-template-columns: 1fr; }
    .col-frete, .col-comissao { display: none; }
    .stat-value { font-size: 20px; }
    .stat-card { padding: 14px 16px; }
    .topbar-right .btn { padding: 6px 10px; font-size: 11px; }
    #prec-pagination { flex-direction: column; gap: 8px; align-items: center; }
    .col-dimensoes { display: none; }
}

@media (max-width: 480px) {
    .content { padding: 10px; }
    .card { padding: 14px; }
    .section-title { font-size: 14px; }
    .stat-value { font-size: 18px; }
    .topbar { height: 50px; }
    .modal { max-height: 96vh; }
    .btn { font-size: 11px; padding: 6px 10px; }
}

@media (max-width: 860px) {
    #login-screen { flex-direction: column; overflow-y: auto; }
    .login-left { flex: none; padding: 32px 28px 28px; border-bottom: 1px solid rgba(255,255,255,0.15); justify-content: flex-start; }
    .login-brand { margin-bottom: 20px; }
    .login-tagline { font-size: 26px; margin-bottom: 10px; }
    .login-desc { font-size: 13px; max-width: 100%; }
    .login-stats { margin-top: 20px; gap: 20px; }
    .login-stat-val { font-size: 18px; }
    .login-right { width: 100%; padding: 32px 28px 40px; flex: none; }
}

@media (max-width: 480px) {
    .login-left { padding: 24px 20px 20px; }
    .login-brand-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
    .login-brand-name { font-size: 16px; }
    .login-tagline { font-size: 22px; }
    .login-stats { gap: 16px; }
    .login-stat-val { font-size: 16px; }
    .login-stat-label { font-size: 10px; }
    .login-right { padding: 24px 20px 36px; }
    .login-title { font-size: 20px; }
    .login-input { font-size: 13px; padding: 11px 12px 11px 38px; }
    .login-btn { padding: 12px; }
}
