/* Gatos Ofertas — painel mobile-first na linguagem visual do Mercado Livre
   (paleta, tipografia, cartões e botões). Sem logotipo ou marca do Mercado Livre. */

:root {
  --ml-yellow: #FFE600;
  --ml-yellow-dark: #F5D90A;
  --ml-blue: #3483FA;
  --ml-blue-hover: #2968C8;
  --ml-blue-soft: rgba(65, 137, 230, .15);
  --ml-navy: #2D3277;
  --ml-green: #00A650;
  --ml-green-hover: #008C44;
  --ml-red: #F23D4F;
  --ml-red-hover: #D9293B;
  --ml-orange: #FF7733;
  --bg: #EDEDED;
  --surface: #FFFFFF;
  --text: rgba(0, 0, 0, .9);
  --text-2: rgba(0, 0, 0, .55);
  --text-3: rgba(0, 0, 0, .45);
  --line: rgba(0, 0, 0, .1);
  --shadow: 0 1px 2px 0 rgba(0, 0, 0, .12);
  --shadow-lg: 0 6px 16px 0 rgba(0, 0, 0, .1);
  --radius: 6px;
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: "Proxima Nova", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); font-size: 15px; line-height: 1.35; }
img { max-width: 100%; display: block; }
a { color: var(--ml-blue); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- topo */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top, 0px);
  background: var(--ml-yellow); box-shadow: 0 1px 0 rgba(0, 0, 0, .1);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ml-navy); font-weight: 700; font-size: 18px; }
.brand img { border-radius: 8px; }
.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ml-navy); cursor: pointer; }
.bell:active { background: rgba(0, 0, 0, .06); }
.bell__count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--ml-blue); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; }

/* --------------------------------------------------------------- barra inferior */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); box-shadow: 0 -1px 0 var(--line), 0 -2px 8px rgba(0, 0, 0, .04);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-2); font-size: 11px; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--ml-blue); font-weight: 600; }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--ml-red); color: #fff; font-size: 11px; display: grid; place-items: center; }

/* --------------------------------------------------------------- layout */
.app { max-width: 1180px; margin: 0 auto; padding: 16px 12px; }
.page-title { margin: 4px 4px 12px; font-size: 22px; font-weight: 600; }
.section-title { margin: 20px 4px 8px; font-size: 16px; font-weight: 600; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { padding: 32px 16px; text-align: center; color: var(--text-2); }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 10px; }
.card--flush { padding: 0; overflow: hidden; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.kpi__value { font-size: 28px; font-weight: 300; line-height: 1.1; }
.kpi__label { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.kpi--accent { background: var(--ml-blue); color: #fff; }
.kpi--accent .kpi__label { color: rgba(255, 255, 255, .85); }

/* listas de ofertas / anúncios (padrão de cartão de produto ML) */
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.item { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; border: 0; text-align: left; width: 100%; }
.item:active { box-shadow: var(--shadow-lg); }
.item__img { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 4px; }
.item__img--ph { display: grid; place-items: center; background: #F5F5F5; color: var(--text-3); font-size: 32px; }
.item__title { margin: 0 0 6px; font-size: 14px; font-weight: 400; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item__meta { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }

/* preço no estilo ML: inteiro grande e centavos sobrescritos */
.price { display: inline-flex; align-items: flex-start; font-weight: 300; color: var(--text); line-height: 1; }
.price__cur { font-size: .6em; margin: .2em .25em 0 0; }
.price__int { font-size: 1em; }
.price__cents { font-size: .5em; margin: .15em 0 0 .1em; }
.price--md { font-size: 24px; }
.price--lg { font-size: 36px; }
.price--old { font-size: 14px; color: var(--text-3); text-decoration: line-through; }
.off { color: var(--ml-green); font-size: 14px; font-weight: 400; margin-left: 8px; }
.free { color: var(--ml-green); font-weight: 600; font-size: 14px; }

/* etiquetas */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 3px;
  font-size: 12px; font-weight: 600; background: #F5F5F5; color: var(--text-2); }
.tag--blue { background: var(--ml-blue-soft); color: var(--ml-blue); }
.tag--green { background: rgba(0, 166, 80, .1); color: var(--ml-green); }
.tag--orange { background: var(--ml-orange); color: #fff; }
.tag--yellow { background: #FFF6B3; color: #6B5A00; }
.tag--red { background: rgba(242, 61, 79, .1); color: var(--ml-red); }

/* botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px;
  border: 0; border-radius: var(--radius); font-size: 16px; font-weight: 600; cursor: pointer;
  background: var(--ml-blue); color: #fff; transition: background .15s; }
.btn:hover { background: var(--ml-blue-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--soft { background: var(--ml-blue-soft); color: var(--ml-blue); }
.btn--soft:hover { background: rgba(65, 137, 230, .25); }
.btn--green { background: var(--ml-green); }
.btn--green:hover { background: var(--ml-green-hover); }
.btn--red { background: var(--ml-red); }
.btn--red:hover { background: var(--ml-red-hover); }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.link-btn { border: 0; background: none; color: var(--ml-blue); cursor: pointer; padding: 6px 0; font-weight: 600; }

/* filtros (chips) */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 14px; }
.chip.active { background: var(--ml-blue); border-color: var(--ml-blue); color: #fff; }

/* formulários */
.field { display: block; margin-bottom: 14px; }
.field__label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text-2); }
.input, .textarea { width: 100%; min-height: 48px; padding: 12px; border: 1px solid rgba(0, 0, 0, .25);
  border-radius: var(--radius); background: #fff; font-size: 16px; }
.input:focus, .textarea:focus { outline: none; border-color: var(--ml-blue); box-shadow: 0 0 0 1px var(--ml-blue); }
.textarea { min-height: 180px; resize: vertical; line-height: 1.4; }
.search { position: sticky; top: 64px; z-index: 5; margin-bottom: 10px; }
.hint { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.hint--warn { color: #8A5A00; }
.hint--error { color: var(--ml-red); }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ml-blue); border-radius: var(--radius); overflow: hidden; }
.segmented button { min-height: 40px; border: 0; background: #fff; color: var(--ml-blue); font-weight: 600; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--ml-blue); }
.segmented button.active { background: var(--ml-blue); color: #fff; }

/* login */
.login { max-width: 400px; margin: 10vh auto 0; }
.login h1 { font-size: 24px; font-weight: 600; margin: 0 0 6px; }

/* tabelas simples */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

/* --------------------------------------------------------------- modal (bottom sheet) */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); animation: fade .2s ease; }
.modal__sheet { position: absolute; inset: auto 0 0 0; max-height: 94vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 12px 12px 0 0; box-shadow: var(--shadow-lg); animation: up .25s ease; }
.modal__grab { width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: rgba(0, 0, 0, .2); }
.modal__close { position: absolute; top: 6px; right: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .9); font-size: 26px; line-height: 1; color: var(--text-2); cursor: pointer; z-index: 2; }
.modal__body { overflow-y: auto; padding: 8px 16px 16px; -webkit-overflow-scrolling: touch; }
.modal__actions { display: flex; gap: 0; padding: 0; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.modal__actions:empty { display: none; }
.modal__actions .btn { flex: 1 1 50%; width: 50%; border-radius: 0; min-height: 56px; font-size: 17px; }
body.modal-open { overflow: hidden; }

.offer__head { display: flex; align-items: center; gap: 8px; margin: 4px 40px 8px 0; flex-wrap: wrap; }
.offer__img { width: 100%; aspect-ratio: 1 / 1; max-height: 340px; object-fit: contain; background: #fff; margin: 4px 0 12px; }
.offer__title { margin: 0 0 10px; font-size: 18px; font-weight: 400; line-height: 1.3; }
.offer__price { margin: 8px 0 4px; }
.box { margin-top: 14px; padding: 14px; border-radius: var(--radius); background: #F5F5F5; }
.box h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.verdict { margin-top: 14px; padding: 14px; border-radius: var(--radius); border-left: 4px solid var(--ml-blue); background: var(--ml-blue-soft); }
.verdict h3 { margin: 0 0 4px; font-size: 17px; }
.verdict--great, .verdict--good { border-color: var(--ml-green); background: rgba(0, 166, 80, .08); }
.verdict--partial { border-color: #E0B800; background: #FFF9D6; }
.verdict--weak, .verdict--blocked { border-color: var(--ml-red); background: rgba(242, 61, 79, .07); }
.score { display: flex; align-items: baseline; gap: 6px; }
.score__value { font-size: 32px; font-weight: 300; }
.bar { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .08); overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--ml-blue); }
.crit { padding: 8px 0; border-bottom: 1px solid var(--line); }
.crit:last-child { border-bottom: 0; }
.crit__top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.crit__detail { margin-top: 2px; font-size: 13px; color: var(--text-2); }
.warn { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: #6B5A00; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; word-break: break-word; }
.desc { white-space: pre-wrap; font-size: 14px; color: var(--text-2); max-height: 220px; overflow: auto; }
.chart { width: 100%; height: 120px; }
.chart path.line { fill: none; stroke: var(--ml-blue); stroke-width: 2; }
.chart path.area { fill: rgba(52, 131, 250, .12); }
.chart circle { fill: var(--ml-blue); }
.preview-img { width: 100%; max-height: 260px; object-fit: contain; background: #F5F5F5; border-radius: var(--radius); margin-bottom: 8px; }
.post__text { white-space: pre-wrap; font-size: 14px; background: #F5F5F5; padding: 12px; border-radius: var(--radius); margin: 8px 0; }
.counter { font-size: 13px; color: var(--text-2); }
.changes { margin: 0 0 12px; padding: 12px; border-radius: var(--radius); background: rgba(242, 61, 79, .08); color: #8A1C27; font-size: 14px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); transform: translateX(-50%);
  z-index: 60; max-width: 92vw; padding: 12px 18px; border-radius: var(--radius); background: rgba(0, 0, 0, .85);
  color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: fade .2s ease; }
.toast--ok { background: var(--ml-green); }
.toast--error { background: var(--ml-red); }

.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, #f3f3f3 25%, #fafafa 37%, #f3f3f3 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; }

@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --------------------------------------------------------------- telas maiores */
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  body { padding-bottom: 24px; }
  body.authed .app { padding-left: 104px; }
  .tabbar { inset: 56px auto 0 0; width: 88px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 72px;
    align-content: start; padding: 8px 0; box-shadow: 1px 0 0 var(--line); }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .modal__sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 640px; max-height: 90vh;
    border-radius: 12px; animation: fade .2s ease; }
  .modal__grab { display: none; }
  .modal__actions .btn:first-child { border-bottom-left-radius: 12px; }
  .modal__actions .btn:last-child { border-bottom-right-radius: 12px; }
  .toast { bottom: 24px; }
}
