:root {
  --navy: #0f172a;
  --navy-2: #17233a;
  --blue: #2563eb;
  --blue-2: #dbeafe;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #dce4ef;
  --text: #152033;
  --muted: #66758d;
  --green: #15803d;
  --green-bg: #eaf8ef;
  --red: #c62828;
  --red-bg: #fff0f1;
  --amber: #9a6700;
  --amber-bg: #fff8dc;
  --gray-bg: #f1f4f8;
  --shadow: 0 10px 30px rgba(19, 36, 62, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  color: #fff;
  background: linear-gradient(180deg, #0d1525 0%, #111a2a 100%);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 5px 7px 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; background: linear-gradient(135deg, #5b8cff, #2058d8);
  box-shadow: 0 8px 24px rgba(37, 99, 235, .35);
}
.brand strong { display: block; font-size: 14px; line-height: 1.2; }
.brand span { display: block; margin-top: 4px; color: #aab8cf; font-size: 11px; }
.nav { display: grid; gap: 5px; }
.nav-label { margin: 16px 8px 5px; color: #7183a1; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.nav-item {
  width: 100%; border: 0; border-radius: 10px; padding: 10px 10px;
  display: flex; align-items: center; gap: 9px; color: #cbd5e1; background: transparent;
  font-weight: 750; text-align: left; transition: .18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: #22304a; box-shadow: inset 3px 0 0 #4e7df5; }
.nav-icon { width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.07); font-size: 10px; font-weight: 900; }
.nav-icon.ml { background: #275fe1; }
.nav-icon.web { background: #1d4652; font-size: 8px; }
.sidebar-status {
  margin-top: auto; display: flex; gap: 9px; align-items: flex-start; padding: 12px;
  background: #17243a; border: 1px solid #2c3b55; border-radius: 12px;
}
.status-dot { width: 8px; height: 8px; margin-top: 5px; flex: 0 0 auto; border-radius: 50%; background: #f5b82e; box-shadow: 0 0 0 4px rgba(245,184,46,.1); }
.sidebar-status.online .status-dot { background: #39c978; box-shadow: 0 0 0 4px rgba(57,201,120,.12); }
.sidebar-status strong { display: block; font-size: 11px; color: #fff; }
.sidebar-status small { display: block; margin-top: 3px; color: #91a1ba; font-size: 9px; line-height: 1.4; }

.main { min-width: 0; padding: 26px 28px 38px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 5px; color: #657694; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(28px, 2.5vw, 38px); line-height: 1.05; letter-spacing: -.04em; }
.page-description { margin: 7px 0 0; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.role-badge { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 11px; font-weight: 850; }
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; font-weight: 850;
  transition: .18s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(37,99,235,.18); }
.btn.secondary { color: var(--text); background: #fff; border-color: var(--line); }
.btn.danger { color: var(--red); background: #fff; border-color: #f3c7ca; }
.btn.small { padding: 7px 10px; border-radius: 8px; font-size: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.page-content { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 17px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-header h2 { margin: 0; font-size: 17px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 18px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { padding: 17px; min-height: 116px; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -24px; bottom: -30px; width: 88px; height: 88px; border-radius: 50%; background: rgba(37,99,235,.06); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-value { display: block; margin-top: 8px; font-size: 30px; font-weight: 900; letter-spacing: -.04em; }
.stat-note { margin-top: 3px; color: var(--muted); font-size: 11px; }
.stat-card.good .stat-value { color: var(--green); }
.stat-card.alert .stat-value { color: var(--red); }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-card { padding: 17px; min-width: 0; }
.chart-card h3 { margin: 0; font-size: 15px; }
.chart-card p { margin: 4px 0 12px; color: var(--muted); font-size: 11px; }
.chart-legend { display: flex; gap: 15px; margin-bottom: 10px; color: var(--muted); font-size: 10px; font-weight: 750; }
.legend-dot { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 3px; }
.legend-dot.ours { background: #2563eb; }
.legend-dot.competitor { background: #f06b75; }
canvas { width: 100%; height: 270px; display: block; }
.sync-strip { margin-top: 14px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sync-strip strong { font-size: 12px; }
.sync-strip span { color: var(--muted); font-size: 11px; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 160px auto; gap: 10px; margin-bottom: 12px; }
.field { display: grid; gap: 6px; }
.field label { color: #53627a; font-size: 9px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.input, .select {
  width: 100%; height: 40px; border: 1px solid #ced8e6; border-radius: 9px; padding: 0 12px;
  color: var(--text); background: #fff; outline: none; transition: .15s ease;
}
.input:focus, .select:focus { border-color: #6e94ef; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.matrix-card { overflow: hidden; }
.matrix-meta { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.matrix-meta strong { font-size: 13px; }
.matrix-meta span { color: var(--muted); font-size: 10px; }
.matrix-wrap { width: 100%; overflow: hidden; }
.matrix-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.matrix-table th {
  height: 46px; padding: 7px 7px; color: #5f6f87; background: #eef3f9;
  border-right: 1px solid #dce4ee; border-bottom: 1px solid #d5deea;
  font-size: 9px; line-height: 1.2; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  text-align: center; overflow: hidden; text-overflow: ellipsis;
}
.matrix-table th:first-child { text-align: left; padding-left: 13px; }
.matrix-table td {
  height: 58px; padding: 6px; border-right: 1px solid #e3e9f1; border-bottom: 1px solid #e6ebf2;
  vertical-align: middle; background: #fff;
}
.matrix-table tbody tr:nth-child(even) td { background: #fbfcfe; }
.matrix-table tbody tr:hover td { background: #f5f8fd; }
.matrix-table th:last-child, .matrix-table td:last-child { border-right: 0; }
.product-cell { padding-left: 13px !important; }
.product-name { display: block; max-width: 100%; font-weight: 850; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-code { display: block; margin-top: 3px; color: #77869c; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-cell { text-align: center; }
.stock-pill { display: inline-flex; min-width: 34px; height: 25px; padding: 0 7px; align-items: center; justify-content: center; border-radius: 999px; font-weight: 900; font-size: 11px; }
.stock-high { color: #08763b; background: #ddf7e8; }
.stock-low { color: #8c5b00; background: #fff1c4; }
.stock-zero { color: #9c2530; background: #ffe2e5; }
.money-static { text-align: center; font-weight: 850; font-size: 11px; }
.price-cell { position: relative; transition: background .2s ease; }
.price-input-wrap { position: relative; }
.price-prefix { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); color: #697890; font-size: 10px; font-weight: 750; }
.price-input {
  width: 100%; height: 32px; border: 1px solid #cad5e3; border-radius: 7px; padding: 0 5px 0 17px;
  background: rgba(255,255,255,.88); color: #142033; font-size: 10px; font-weight: 850; outline: none;
}
.price-input:focus { border-color: #5a86ec; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.price-cell .cell-result { display: block; height: 10px; margin-top: 2px; text-align: center; color: #6e7d93; font-size: 7px; font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price-cell.ours { background: #edf4ff !important; }
.price-cell.win { background: var(--green-bg) !important; }
.price-cell.lose { background: var(--red-bg) !important; }
.price-cell.tie { background: var(--amber-bg) !important; }
.price-cell.pending { background: #f4f6f9 !important; }
.price-cell.no-stock { background: #eceff4 !important; }
.price-cell.win .cell-result { color: var(--green); }
.price-cell.lose .cell-result { color: var(--red); }
.price-cell.tie .cell-result { color: var(--amber); }
.saving .price-input { opacity: .55; }
.saved-flash { animation: savedFlash .7s ease; }
@keyframes savedFlash { 0% { box-shadow: inset 0 0 0 2px #22a25d; } 100% { box-shadow: inset 0 0 0 0 transparent; } }
.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--text); }

.simple-table { width: 100%; border-collapse: collapse; }
.simple-table th { padding: 11px; color: #607089; background: #f0f4f9; border-bottom: 1px solid var(--line); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; text-align: left; }
.simple-table td { padding: 11px; border-bottom: 1px solid #e6ebf2; font-size: 12px; }
.simple-table tbody tr:hover td { background: #f8faff; }
.actions { display: flex; gap: 7px; justify-content: flex-end; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-actions { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 9px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
.settings-section h3 { margin: 0 0 14px; font-size: 15px; }
.settings-section .field + .field { margin-top: 11px; }
.switch-line { display: flex; align-items: center; gap: 9px; min-height: 40px; }
.switch-line input { width: 18px; height: 18px; }
.info-box { margin-top: 13px; padding: 12px; border-radius: 10px; color: #45566f; background: #eef4ff; border: 1px solid #d7e4fb; font-size: 11px; line-height: 1.55; }
.code-line { display: block; margin-top: 7px; padding: 8px 10px; border-radius: 7px; background: #0f172a; color: #dbe8ff; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.company-counter { color: var(--muted); font-size: 11px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 390px; padding: 12px 14px; color: #fff; background: #172238; border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.22); font-size: 12px; animation: toastIn .2s ease; }
.toast.error { background: #a82732; }
.toast.success { background: #137443; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); }

@media (max-width: 1250px) {
  .app-shell { grid-template-columns: 188px minmax(0,1fr); }
  .main { padding: 22px 18px 32px; }
  .sidebar { padding-inline: 10px; }
  .matrix-table th { font-size: 8px; padding-inline: 4px; }
  .matrix-table td { padding-inline: 4px; }
  .price-input { font-size: 9px; padding-left: 14px; }
  .price-prefix { left: 5px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .brand { padding-bottom: 10px; }
  .nav { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .nav-label, .sidebar-status { display: none; }
  .nav-item { width: auto; flex: 0 0 auto; }
  .main { padding: 18px 12px 28px; }
  .topbar { display: block; }
  .topbar-actions { margin-top: 14px; justify-content: flex-start; }
  .stats-grid, .dashboard-grid, .settings-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { grid-template-columns: 1fr 130px; }
  .toolbar .btn { grid-column: 1 / -1; }
  .matrix-table th:nth-child(3), .matrix-table td:nth-child(3) { display: none; }
}

@media (max-width: 620px) {
  .stats-grid, .dashboard-grid, .settings-grid, .form-grid, .form-grid.two { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .topbar-actions { align-items: stretch; }
  .topbar-actions .btn { flex: 1; }
  .matrix-table th { height: 54px; writing-mode: vertical-rl; transform: rotate(180deg); }
  .matrix-table th:first-child, .matrix-table th:nth-child(2), .matrix-table th:nth-child(4) { writing-mode: horizontal-tb; transform: none; }
  .product-code, .cell-result { display: none !important; }
}

.cell-bottom { display: flex; align-items: center; justify-content: space-between; gap: 3px; margin-top: 2px; min-width: 0; }
.cell-bottom .cell-result { flex: 1 1 auto; min-width: 0; margin-top: 0; text-align: left; }
.competitor-stock { display: inline-flex; align-items: center; justify-content: center; min-width: 0; max-width: 58%; padding: 2px 5px; border-radius: 999px; font-size: 7px; font-weight: 900; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.competitor-stock.available { color: #08763b; background: #dff7e8; }
.competitor-stock.out { color: #a12630; background: #ffe2e5; }
.competitor-stock.unknown { color: #65738a; background: #e9edf3; }
.competitor-stock.error { color: #9a6700; background: #fff0bd; }
.source-toolbar { grid-template-columns: 230px minmax(260px,1fr) auto; }
.source-info { margin: 14px 18px 0; }
.source-table-wrap { overflow: auto; padding-top: 10px; }
.source-table { min-width: 980px; }
.source-table th:nth-child(1) { width: 25%; }
.source-table th:nth-child(2), .source-table th:nth-child(3) { width: 31%; }
.source-table th:last-child { width: 13%; }
.source-product small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.source-url { height: 36px; font-size: 11px; }
.source-result { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 5px; color: var(--muted); font-size: 10px; }
.source-result .competitor-stock { max-width: none; font-size: 9px; }
.source-actions { align-items: center; }

@media (max-width: 900px) {
  .source-toolbar { grid-template-columns: 1fr 1fr; }
}

/* V6: búsqueda automática por página principal */
.source-toolbar-v6 { grid-template-columns: 230px minmax(280px, 1fr) auto; }
.company-search-config { display: grid; grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1fr) auto; gap: 12px; align-items: end; }
.company-search-buttons { display: flex; gap: 8px; align-items: end; }
.source-table-v6 { width: 100%; table-layout: fixed; }
.source-table-v6 th:nth-child(1) { width: 27%; }
.source-table-v6 th:nth-child(2) { width: 28%; }
.source-table-v6 th:nth-child(3) { width: 10%; }
.source-table-v6 th:nth-child(4) { width: 10%; }
.source-table-v6 th:nth-child(5) { width: 13%; }
.source-table-v6 th:nth-child(6) { width: 12%; }
.match-badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.match-found { background: #dcfce7; color: #08783d; }
.match-review { background: #fef3c7; color: #915f00; }
.match-missing { background: #f1f5f9; color: #526174; }
.match-error { background: #fee2e2; color: #b42336; }
.match-pending { background: #eaf1ff; color: #2456a6; }
.match-title { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-table-wrap { overflow: hidden; }
.company-table { width: 100%; table-layout: fixed; }
.company-table th:nth-child(1) { width: 5%; }
.company-table th:nth-child(2) { width: 28%; }
.company-table th:nth-child(3) { width: 48%; }
.company-table th:nth-child(4) { width: 19%; }
@media (max-width: 1050px) {
  .source-toolbar-v6, .company-search-config { grid-template-columns: 1fr; }
  .company-search-buttons { flex-wrap: wrap; }
  .source-table-wrap { overflow-x: auto; }
  .source-table-v6 { min-width: 900px; }
}

/* V8: identificación Bsale visible y acciones de sincronización por canal */
.matrix-toolbar { grid-template-columns: minmax(260px, 1fr) 160px auto; align-items: end; }
.matrix-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.product-identifiers { display: flex; align-items: center; gap: 5px; margin-top: 5px; min-width: 0; }
.sku-chip, .barcode-chip {
  display: inline-flex; align-items: center; min-width: 0; max-width: 100%; padding: 3px 6px;
  border-radius: 6px; font-size: 7.5px; line-height: 1.15; font-weight: 850;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sku-chip { color: #4e6079; background: #eef2f7; }
.barcode-chip { color: #174a8a; background: #e7f0ff; border: 1px solid #d3e2fb; }
.matrix-sync-dates { display: grid; gap: 3px; text-align: right; }

@media (max-width: 1100px) {
  .matrix-toolbar { grid-template-columns: minmax(220px, 1fr) 150px; }
  .matrix-toolbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 620px) {
  .product-identifiers { display: grid; gap: 3px; }
  .sku-chip, .barcode-chip { width: fit-content; max-width: 100%; font-size: 7px; }
  .matrix-sync-dates { text-align: left; }
}
.btn.success { background:#15803d; color:#fff; border-color:#15803d; }
.btn.success:hover { background:#166534; }

/* V10: categorías Bsale y búsqueda completa en segundo plano */
.category-chip {
  display: inline-flex; align-items: center; width: fit-content; max-width: 100%;
  margin-top: 4px; padding: 3px 6px; border-radius: 999px;
  color: #28527f; background: #e8f1fb; border: 1px solid #d5e5f7;
  font-size: 7.5px; line-height: 1.15; font-weight: 850;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.source-product .category-chip { margin-right: 6px; }
.source-toolbar-v10 {
  grid-template-columns: 210px minmax(250px, 1fr) 230px 150px auto;
  align-items: end;
}
.source-search-field { min-width: 0; }
.matrix-toolbar { grid-template-columns: minmax(250px, 1fr) 150px 220px auto; }
.company-search-buttons { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 1350px) {
  .source-toolbar-v10 { grid-template-columns: 190px minmax(230px,1fr) 210px 140px; }
  .source-toolbar-v10 > .btn { grid-column: 1 / -1; justify-self: start; }
  .matrix-toolbar { grid-template-columns: minmax(220px, 1fr) 145px 210px; }
  .matrix-toolbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 900px) {
  .source-toolbar-v10, .matrix-toolbar { grid-template-columns: 1fr 1fr; }
  .source-search-field { grid-column: 1 / -1; }
  .source-toolbar-v10 > .btn, .matrix-toolbar-actions { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .source-toolbar-v10, .matrix-toolbar { grid-template-columns: 1fr; }
  .source-search-field { grid-column: auto; }
  .category-chip { font-size: 7px; }
}

/* V14: resultado exacto de Mercado Libre con precio y enlace directo */
.ml-market-cell { padding: 7px 8px !important; vertical-align: middle; background: #f8fafc; }
.ml-market-cell.exact { background: #eaf9ef; box-shadow: inset 0 0 0 1px #c9efd6; }
.ml-market-cell.review { background: #fff8df; box-shadow: inset 0 0 0 1px #f4dfa0; }
.ml-market-cell.error { background: #fff0f1; }
.ml-market-price { font-size: 14px; font-weight: 950; color: #0b3f24; }
.ml-market-tags { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.ml-market-actions { display: flex; align-items: center; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.mini-link, .mini-action { min-height: 25px; display: inline-flex; align-items: center; justify-content: center; padding: 4px 7px; border-radius: 7px; border: 1px solid #cbd8e8; background: #fff; color: #1559b7; font-size: 8px; font-weight: 900; text-decoration: none; cursor: pointer; }
.mini-link:hover, .mini-action:hover { border-color: #2563eb; }
.mini-link.warning { color: #8a5a00; border-color: #efd68c; }
.mini-action.danger { color: #b42336; border-color: #f2c2c8; }
.ml-review-label { display: inline-flex; padding: 3px 6px; border-radius: 999px; background: #fef3c7; color: #915f00; font-size: 8px; font-weight: 950; }
.ml-review-title { margin-top: 4px; font-size: 8px; line-height: 1.25; color: #5f5230; max-height: 2.5em; overflow: hidden; }
.ml-review-price { margin-top: 3px; font-size: 11px; font-weight: 900; color: #6f4b00; }
.ml-empty-label { font-size: 9px; font-weight: 900; color: #5d6c82; }
.ml-empty-note { margin: 3px 0 5px; color: #8490a2; font-size: 7.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .ml-market-price { font-size: 12px; }
  .mini-link, .mini-action { font-size: 7px; padding: 3px 5px; }
}

/* V15: Mercado Libre separado, tres publicaciones exactas más baratas */
.ml-offer-cell { padding: 6px 8px !important; vertical-align: middle; background: #f8fafc !important; }
.ml-offer-cell.exact { background: #eefaf2 !important; box-shadow: inset 0 0 0 1px #d1eedb; }
.ml-offer-cell.error { background: #fff0f1 !important; }
.ml-offer-cell.empty { color: #98a3b3; text-align: center; }
.ml-offer-rank { color: #08763b; font-size: 7px; font-weight: 950; letter-spacing: .04em; text-transform: uppercase; }
.ml-offer-title { margin-top: 3px; color: #405069; font-size: 8px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-top3-table .ml-market-price { margin-top: 2px; font-size: 13px; }
.ml-top3-table .competitor-stock { max-width: 100%; font-size: 7px; }
@media (max-width: 900px) {
  .ml-offer-title { display: none; }
  .ml-offer-rank { font-size: 6px; }
}

/* V16 Mercado Libre: candidatos y diagnóstico */
.ml-offer-cell.review { background: #fff8df !important; box-shadow: inset 0 0 0 1px #f2dda0; }
.ml-offer-rank.review { color: #9a6400; }
.match-score { display:inline-flex; align-items:center; border-radius:999px; padding:2px 5px; font-size:7px; font-weight:900; background:#fff1bf; color:#855600; }
.mini-action.danger { border-color:#f1b7bd; color:#b4232e; background:#fff6f7; }
.ml-offer-cell.error .ml-empty-note { color:#ad2935; white-space:normal; line-height:1.25; }
.ml-offer-cell.not_found .ml-empty-note { white-space:normal; line-height:1.25; }

/* V17: conexión OAuth de Mercado Libre con un clic */
.success-box { background:#ecfdf3 !important; border-color:#b7ebc8 !important; color:#14532d !important; }
.advanced-settings { margin-top:12px; border:1px solid #d9e3f0; border-radius:10px; background:#f8fafc; padding:10px 12px; }
.advanced-settings summary { cursor:pointer; color:#42536c; font-size:11px; font-weight:850; }
.advanced-settings[open] summary { margin-bottom:12px; }

/* V18: publicaciones propias + tres enlaces exactos de competencia Mercado Libre */
.ml-own-cell, .ml-link-cell { padding: 7px 8px !important; vertical-align: top; background: #f8fafc !important; }
.ml-own-cell.found { background: #eefaf2 !important; box-shadow: inset 0 0 0 1px #d1eedb; }
.ml-own-cell.empty, .ml-link-cell.empty { background: #f8fafc !important; }
.ml-link-cell.exact { background: #eefaf2 !important; box-shadow: inset 0 0 0 1px #d1eedb; }
.ml-link-cell.review { background: #fff9e8 !important; box-shadow: inset 0 0 0 1px #f1e0ad; }
.ml-link-cell.error { background: #fff1f2 !important; box-shadow: inset 0 0 0 1px #f4c6cc; }
.ml-slot-label { margin-bottom: 5px; color: #50627b; font-size: 7px; font-weight: 950; letter-spacing: .06em; text-transform: uppercase; }
.ml-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; align-items: center; }
.ml-link-input { width: 100%; min-width: 0; height: 31px; padding: 5px 7px; border: 1px solid #cbd8e8; border-radius: 7px; background: #fff; color: #18263b; font: inherit; font-size: 8px; }
.ml-link-input:focus { outline: 2px solid rgba(37, 99, 235, .18); border-color: #4f7ee8; }
.ml-link-warning { margin-top: 4px; color: #a32935; font-size: 7px; line-height: 1.25; }
.ml-links-table .ml-market-price { margin-top: 5px; font-size: 12px; }
.ml-links-table .ml-offer-title { display: block; }
.match-score.exact { background: #dff7e7; color: #0b6d36; }
.match-score.error { background: #ffe0e4; color: #a32935; }
@media (max-width: 1150px) {
  .ml-links-table { min-width: 1280px; }
  .matrix-wrap { overflow-x: auto; }
}
