/* ============================================================
   PREÇO DO NEGÓCIO — Design System v2 (visual corporativo/SaaS)
   Tema claro por padrão + tema escuro. Cores de marketplace
   são usadas como identidade (faixas, chips, bordas), nunca
   como cor de texto, para manter legibilidade (ex.: amarelo ML).
   ============================================================ */

:root {
    /* Superfícies */
    --bg-primary: #f4f6fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-sidebar: #0f172a;
    --bg-input: #f8fafc;
    --bg-input-focus: #ffffff;
    --bg-muted: #eef2f7;

    /* Texto */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    /* Bordas */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Marca */
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-soft: #eff6ff;
    --accent-glow: rgba(37, 99, 235, 0.18);
    --accent-gradient: linear-gradient(180deg, #2f6df0 0%, #2563eb 100%);

    /* Semânticas */
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #2563eb;
    --info-bg: #eff6ff;

    /* Marketplaces */
    --ml-color: #ffe600;
    --shopee-color: #ee4d2d;
    --dafit-color: #00d4aa;
    --magalu-color: #0086ff;
    --amazon-color: #ff9900;
    --netshoes-color: #e91e63;
    --site-color: #8b5cf6;
    --shein-color: #111111;
    --direta-color: #10b981;

    /* Medidas */
    --sidebar-width: 248px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 2px 8px -2px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, 0.16);
    --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.28);
    --shadow-glow: 0 0 0 3px var(--accent-glow);

    --transition-fast: 140ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0b1120;
    --bg-secondary: #111a2e;
    --bg-card: #131d33;
    --bg-card-hover: #19253f;
    --bg-sidebar: #070d1a;
    --bg-input: #0f1829;
    --bg-input-focus: #0b1322;
    --bg-muted: #17233b;

    --text-primary: #e8edf6;
    --text-secondary: #a8b5cc;
    --text-muted: #7b8aa5;

    --border-color: #243350;
    --border-hover: #34476b;

    --accent-primary: #4f8cff;
    --accent-primary-hover: #7aa7ff;
    --accent-soft: rgba(79, 140, 255, 0.12);
    --accent-glow: rgba(79, 140, 255, 0.25);
    --accent-gradient: linear-gradient(180deg, #5b95ff 0%, #4f8cff 100%);

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.12);

    --shein-color: #e5e7eb;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
}

/* ============================================================
   Base
   ============================================================ */

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
}

button { font-family: inherit; }

.app-container { display: flex; min-height: 100vh; align-items: flex-start; }

/* ============================================================
   Sidebar (sempre escura — padrão de apps corporativos)
   ============================================================ */

.sidebar {
    /* variáveis locais: tudo dentro da sidebar usa paleta escura */
    --text-primary: #e8edf6;
    --text-secondary: #b6c2d9;
    --text-muted: #8493ae;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --accent-primary: #5b95ff;

    position: sticky;
    top: 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all var(--transition-base);
}

.sidebar-header { padding: 1.25rem 1.25rem 1rem; }

.logo { display: flex; align-items: center; gap: 0.7rem; }

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.55);
    flex-shrink: 0;
}

.logo-icon svg { width: 20px; height: 20px; color: #fff; }

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav::before {
    content: 'MENU';
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem 0.4rem;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.88rem;
    font-weight: 500;
    width: 100%;
    text-align: left;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.nav-item.active {
    background: rgba(91, 149, 255, 0.16);
    color: #fff;
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #5b95ff;
}

.nav-item.active svg { stroke: #8db4ff; opacity: 1; }

.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); }

.version-badge {
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}

/* Botões secundários dentro da sidebar escura */
.sidebar .btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: #e8edf6;
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

.sidebar .btn-secondary:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); }

/* Card de conta (sidebar) */
.account-sidebar-card {
    margin: 0 0.75rem 0.75rem;
    padding: 0.85rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.account-sidebar-user { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.7rem; }

.account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.plan-quota-bar {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    margin: 0.4rem 0;
}

.plan-quota-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.plan-quota-fill.near-limit { background: linear-gradient(90deg, #f59e0b, #ef4444); }

/* ============================================================
   Conteúdo principal e header
   ============================================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary);
    min-width: 0;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    gap: 1rem;
}

.main-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex: 1;
    color: var(--text-primary);
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.menu-toggle:hover { background: var(--bg-muted); }
.menu-toggle svg { width: 24px; height: 24px; }

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover { background: var(--bg-muted); color: var(--text-primary); border-color: var(--border-hover); }
.btn-icon svg { width: 17px; height: 17px; }

.header-actions { display: flex; gap: 0.5rem; }

/* Badges do header */
.conn-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
    white-space: nowrap;
}

.conn-badge.info {
    background: var(--info-bg);
    color: var(--info);
    border-color: color-mix(in srgb, var(--info) 25%, transparent);
}

.conn-badge.offline {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

/* ============================================================
   Abas
   ============================================================ */

.tab-content {
    display: none;
    flex: 1;
    padding: 1.75rem 1.75rem 3.5rem;
    scroll-behavior: smooth;
}

.tab-content.active { display: block; animation: fadeIn 0.25s ease; }

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

.section-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.2px;
}

.title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent-soft);
    font-size: 0.95rem;
}

/* ============================================================
   Cards base
   ============================================================ */

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   Entradas
   ============================================================ */

.input-section { margin-bottom: 1.75rem; }

.input-card { padding: 1.35rem 1.5rem; box-shadow: var(--shadow-md); }

.input-group-main { display: flex; align-items: flex-end; gap: 1.25rem; flex-wrap: wrap; }

.input-field-large { flex: 1; min-width: 220px; }
.input-field-small { min-width: 150px; }

.input-field-large label,
.input-field-small label,
.form-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.currency-input,
.pct-input {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.currency-input:hover, .pct-input:hover { border-color: var(--border-hover); }

.currency-input:focus-within,
.pct-input:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    background: var(--bg-input-focus);
}

.currency-prefix, .pct-suffix {
    padding: 0 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    user-select: none;
}

.currency-prefix { background: var(--bg-muted); align-self: stretch; display: flex; align-items: center; border-right: 1px solid var(--border-color); }
.pct-suffix { background: var(--bg-muted); align-self: stretch; display: flex; align-items: center; border-left: 1px solid var(--border-color); }

.currency-input input,
.pct-input input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.7rem 0.65rem;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    outline: none;
    min-width: 0;
}

.currency-input.small input,
.pct-input.small input { font-size: 0.9rem; padding: 0.55rem 0.5rem; }

/* ============================================================
   Cards de marketplace (identidade por cor)
   ============================================================ */

.results-section { margin-bottom: 2.25rem; }
.sold-price-section { padding-top: 0.25rem; }

.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.marketplace-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.1rem 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

/* faixa superior com a cor da loja */
.marketplace-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--card-accent, var(--accent-primary));
}

.marketplace-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--card-accent, #2563eb) 45%, var(--border-color));
}

.marketplace-card.is-best {
    border-color: color-mix(in srgb, var(--success) 55%, var(--border-color));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 35%, transparent), var(--shadow-md);
}

.best-flag {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    padding: 2px 7px;
    border-radius: 999px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0.35rem 0 0.9rem;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.1px;
}

.mp-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.9rem;
    background: color-mix(in srgb, var(--card-accent, #2563eb) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--card-accent, #2563eb) 35%, transparent);
    flex-shrink: 0;
}

.card-badge {
    font-size: 0.66rem;
    font-weight: 600;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    background: var(--bg-muted);
    color: var(--text-secondary);
    white-space: nowrap;
}

.card-config-shortcut {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 3px 5px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.card-config-shortcut:hover { color: var(--text-primary); background: var(--bg-muted); }

.card-price {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.65rem;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    border-radius: 6px;
    transition: color var(--transition-fast);
}

.card-price:hover { color: var(--accent-primary); }

.card-margin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.78rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--border-color);
}

.margin-label { color: var(--text-muted); }

.margin-value {
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.margin-value.positive { background: var(--success-bg); color: var(--success); }
.margin-value.negative { background: var(--danger-bg); color: var(--danger); }
.margin-value.neutral { background: var(--warning-bg); color: var(--warning); }

/* Análise de margem */
.margin-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.75rem;
}

.margin-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    text-align: left;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.margin-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--card-accent, var(--accent-primary));
}

.margin-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.margin-card .mp-name {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.margin-card .mp-margin {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Configurações
   ============================================================ */

.config-section { margin-bottom: 2rem; }

.freight-config {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1rem;
}

.freight-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.freight-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--card-accent, var(--accent-primary));
}

.config-card-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.2rem 0 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.config-subtitle {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.55rem;
    text-transform: uppercase;
}

.freight-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
    font-size: 0.82rem;
}

.freight-row label { color: var(--text-secondary); font-weight: 500; flex: 1; }
.freight-row .currency-input, .freight-row .pct-input { width: 130px; flex: none; }

.config-actions { display: flex; gap: 0.75rem; padding-top: 1.25rem; }

/* Nicho e resumo dentro dos cards de loja e guia SEO */
.mp-niche-pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    margin-bottom: 0.45rem;
    line-height: 1.3;
}

.mp-summary-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0.25rem 0 0.5rem;
}

.marketplace-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1rem;
}

.guide-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.65rem;
    overflow: hidden;
}

.guide-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--card-accent, var(--accent-primary));
}

.guide-card-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border-color);
    font-size: 0.76rem;
}

.guide-card-links a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.guide-card-links a:hover { text-decoration: underline; }

/* Detalhamento nos cards das Calculadoras por Loja (SEO) */
.card-breakdown-list {
    margin: 0.65rem 0;
    padding: 0.65rem 0;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.78rem;
}

.card-breakdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.card-breakdown-row strong {
    color: var(--text-primary);
    font-weight: 600;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0.85rem 0.75rem 0.35rem;
    text-transform: uppercase;
}

.nav-item-link {
    text-decoration: none;
}

.table-container.table-full {
    max-height: none;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.faq-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
    box-shadow: var(--shadow-sm);
}

.faq-card h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.faq-card p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================================
   Painel Interativo de Taxas/Perfis Oficiais por Loja
   ============================================================ */

.rate-profiles-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px dashed var(--border-color);
}

.rate-profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.78rem;
    border-radius: var(--radius-md);
    font-size: 0.76rem;
    font-weight: 600;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.rate-profile-pill:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: var(--accent-soft);
}

.rate-profile-pill.active {
    background: var(--accent-soft);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.rate-profile-pill .pill-badge {
    font-size: 0.64rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.store-rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 0.85rem;
}

.store-rate-field label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================================
   Espaços Publicitários Google AdSense (Policy-Compliant & CLS-Safe)
   ============================================================ */

.ad-slot-wrapper {
    display: none;
    margin: 1.5rem 0;
    padding: 0.5rem 0;
    text-align: center;
}

.ad-slot-wrapper.ad-active {
    display: block;
}

.ad-slot-wrapper.calc-mode-hidden,
.ad-slot-wrapper:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
    display: none !important;
}

ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}

.ad-slot-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    user-select: none;
}

.ad-slot-box {
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ============================================================
   Botões
   ============================================================ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--accent-gradient);
    color: #fff;
    border: 1px solid color-mix(in srgb, var(--accent-primary) 80%, #000);
    padding: 0.62rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 6px 14px -4px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.62rem 1.05rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover { background: var(--bg-muted); border-color: var(--border-hover); }

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }

.btn-edit {
    display: inline-flex;
    align-items: center;
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.38rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-edit:hover { color: var(--accent-primary); border-color: var(--accent-primary); }

.btn-check-row {
    padding: 4px 9px;
    font-size: 0.74rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    background: var(--success-bg);
    color: var(--success);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-check-row:hover { background: color-mix(in srgb, var(--success) 20%, transparent); }

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.72rem 1rem;
    border-radius: var(--radius-md);
    background: #fff;
    color: #1f2937;
    font-weight: 600;
    font-size: 0.88rem;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.google-btn:hover { background: #f3f4f6; box-shadow: var(--shadow-md); }

/* ============================================================
   Filtros
   ============================================================ */

.filters-bar { padding: 1rem 1.15rem; margin-bottom: 1rem; }

.filters-row { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }

.filter-field { flex: 1; min-width: 120px; max-width: 200px; }

.filter-field label {
    display: block;
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.filter-field select,
.filter-field > input,
.form-field select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.form-field select { padding: 0.65rem 0.75rem; font-size: 0.9rem; border-radius: var(--radius-md); }

.filter-field select:focus,
.filter-field > input:focus,
.form-field select:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    background: var(--bg-input-focus);
}

.filter-field select option, .form-field select option { background: var(--bg-secondary); color: var(--text-primary); }

.filter-actions { display: flex; align-items: flex-end; }

.btn-filter-clear {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-filter-clear:hover { background: var(--bg-muted); color: var(--text-primary); }

.filters-info { margin-top: 0.7rem; font-size: 0.74rem; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   Tabela de controle
   ============================================================ */

.control-section { margin-bottom: 2rem; }

.control-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.control-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: auto;
    max-height: calc(100vh - 330px);
    box-shadow: var(--shadow-sm);
}

.control-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8rem; }

.control-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-muted);
    padding: 0.7rem 0.75rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.66rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    z-index: 10;
    /* cor da loja como faixa superior (definida inline em --mp) */
    box-shadow: inset 0 3px 0 var(--mp, transparent);
}

.control-table tbody td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    color: var(--text-primary);
    background: var(--bg-card);
}

.control-table tbody tr:hover td { background: var(--bg-card-hover); }

.control-table .price-cell { font-weight: 600; font-variant-numeric: tabular-nums; }

/* colunas fixas (marca/ref) */
.control-table .sticky-col, .control-table .sticky-col-2 { position: sticky; z-index: 5; }
.control-table .sticky-col { left: 0; min-width: 100px; }
.control-table .sticky-col-2 { left: 100px; min-width: 150px; box-shadow: 1px 0 0 var(--border-color); }
.control-table thead th.sticky-col, .control-table thead th.sticky-col-2 { z-index: 12; }

/* linha com pendências / sincronizada */
.control-table tbody tr.row-has-pending td { background: color-mix(in srgb, var(--warning) 7%, var(--bg-card)); }
.control-table tbody tr.row-has-pending td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.control-table tbody tr.row-has-pending:hover td { background: color-mix(in srgb, var(--warning) 12%, var(--bg-card)); }
.control-table tbody tr.row-all-synced td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--success) 60%, transparent); }

/* célula de loja clicável */
.mp-sync-cell {
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    user-select: none;
    box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--mp, transparent) 70%, transparent);
}

.control-table tbody td.mp-sync-cell:hover { background: var(--accent-soft); }

.mp-sync-cell.mp-pending { font-weight: 700; }
.mp-sync-cell.mp-synced { opacity: 0.95; }

.mp-cell-inner { display: inline-flex; align-items: center; gap: 6px; }

.mp-dot-pending {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
    display: inline-block;
    flex-shrink: 0;
}

.mp-check-synced { color: var(--success); font-size: 0.72rem; font-weight: 800; }

.mp-old-price-hint {
    display: block;
    font-size: 0.64rem;
    color: var(--warning);
    text-decoration: line-through;
    opacity: 0.85;
    line-height: 1;
    margin-top: 2px;
}

.control-table .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-badge.synced { background: var(--success-bg); color: var(--success); }
.status-badge.pending { background: var(--warning-bg); color: var(--warning); }
.status-badge.partial-pending {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
}

/* resumo de pendências */
.sync-summary-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sync-summary-stats { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; font-size: 0.82rem; }

.sync-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.78rem;
}

.sync-stat-pill.pending {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
}

.sync-stat-pill.synced {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}

/* avisos */
.local-storage-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.1rem;
    border-radius: var(--radius-md);
    background: var(--info-bg);
    border: 1px solid color-mix(in srgb, var(--info) 28%, transparent);
    font-size: 0.82rem;
    color: var(--text-primary);
}

.alert-warning {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--warning-bg);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
    color: var(--warning);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.saved-accounts-list { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.75rem; }

.saved-account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.saved-account-item:hover { background: var(--accent-soft); border-color: var(--accent-primary); }

/* ============================================================
   Modais
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; animation: fadeIn 0.18s ease; }

.modal {
    width: min(500px, 92vw);
    max-height: 92vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-xl);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.2px; }

.modal-body { padding: 1.4rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.9rem 1.4rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-muted);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-field { display: flex; flex-direction: column; }

.form-field input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    outline: none;
}

.form-field input:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    background: var(--bg-input-focus);
}

/* ============================================================
   Toasts
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.7rem 1.1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    animation: slideUp 0.28s ease;
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 280px;
    max-width: 420px;
    border-left: 4px solid var(--info);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: #f59e0b; }
.toast.info { border-left-color: var(--info); }

.toast-icon { font-size: 1rem; }

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

/* ============================================================
   Scrollbar
   ============================================================ */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; border: 2px solid transparent; }

/* ============================================================
   Responsivo
   ============================================================ */

@media (max-width: 900px) {
    .conn-badge { display: none; }
}

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -100%; box-shadow: var(--shadow-xl); }
    .sidebar.open { left: 0; }
    .menu-toggle { display: block; }
    .main-header { padding: 0 1rem; }
    .tab-content { padding: 1rem; }
    .input-group-main { flex-direction: column; align-items: stretch; }
    .marketplace-grid { grid-template-columns: 1fr; }
    .control-actions { width: 100%; }
    .control-actions .btn-primary, .control-actions .btn-secondary { flex: 1; padding: 0.55rem 0.7rem; font-size: 0.8rem; }
    .form-grid { grid-template-columns: 1fr; }
    .freight-row .currency-input, .freight-row .pct-input { width: 120px; }
}

@media (max-width: 480px) {
    .margin-analysis-grid { grid-template-columns: 1fr 1fr; }
}
